1
0

amber-cli.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895
  1. #!/usr/bin/env node
  2. var define = (function amdefine(module, requireFn) {
  3. 'use strict';
  4. var defineCache = {},
  5. loaderCache = {},
  6. alreadyCalled = false,
  7. path = require('path'),
  8. makeRequire, stringRequire;
  9. /**
  10. * Trims the . and .. from an array of path segments.
  11. * It will keep a leading path segment if a .. will become
  12. * the first path segment, to help with module name lookups,
  13. * which act like paths, but can be remapped. But the end result,
  14. * all paths that use this function should look normalized.
  15. * NOTE: this method MODIFIES the input array.
  16. * @param {Array} ary the array of path segments.
  17. */
  18. function trimDots(ary) {
  19. var i, part;
  20. for (i = 0; ary[i]; i+= 1) {
  21. part = ary[i];
  22. if (part === '.') {
  23. ary.splice(i, 1);
  24. i -= 1;
  25. } else if (part === '..') {
  26. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  27. //End of the line. Keep at least one non-dot
  28. //path segment at the front so it can be mapped
  29. //correctly to disk. Otherwise, there is likely
  30. //no path mapping for a path starting with '..'.
  31. //This can still fail, but catches the most reasonable
  32. //uses of ..
  33. break;
  34. } else if (i > 0) {
  35. ary.splice(i - 1, 2);
  36. i -= 2;
  37. }
  38. }
  39. }
  40. }
  41. function normalize(name, baseName) {
  42. var baseParts;
  43. //Adjust any relative paths.
  44. if (name && name.charAt(0) === '.') {
  45. //If have a base name, try to normalize against it,
  46. //otherwise, assume it is a top-level require that will
  47. //be relative to baseUrl in the end.
  48. if (baseName) {
  49. baseParts = baseName.split('/');
  50. baseParts = baseParts.slice(0, baseParts.length - 1);
  51. baseParts = baseParts.concat(name.split('/'));
  52. trimDots(baseParts);
  53. name = baseParts.join('/');
  54. }
  55. }
  56. return name;
  57. }
  58. /**
  59. * Create the normalize() function passed to a loader plugin's
  60. * normalize method.
  61. */
  62. function makeNormalize(relName) {
  63. return function (name) {
  64. return normalize(name, relName);
  65. };
  66. }
  67. function makeLoad(id) {
  68. function load(value) {
  69. loaderCache[id] = value;
  70. }
  71. load.fromText = function (id, text) {
  72. //This one is difficult because the text can/probably uses
  73. //define, and any relative paths and requires should be relative
  74. //to that id was it would be found on disk. But this would require
  75. //bootstrapping a module/require fairly deeply from node core.
  76. //Not sure how best to go about that yet.
  77. throw new Error('amdefine does not implement load.fromText');
  78. };
  79. return load;
  80. }
  81. makeRequire = function (systemRequire, exports, module, relId) {
  82. function amdRequire(deps, callback) {
  83. if (typeof deps === 'string') {
  84. //Synchronous, single module require('')
  85. return stringRequire(systemRequire, exports, module, deps, relId);
  86. } else {
  87. //Array of dependencies with a callback.
  88. //Convert the dependencies to modules.
  89. deps = deps.map(function (depName) {
  90. return stringRequire(systemRequire, exports, module, depName, relId);
  91. });
  92. //Wait for next tick to call back the require call.
  93. process.nextTick(function () {
  94. callback.apply(null, deps);
  95. });
  96. }
  97. }
  98. amdRequire.toUrl = function (filePath) {
  99. if (filePath.indexOf('.') === 0) {
  100. return normalize(filePath, path.dirname(module.filename));
  101. } else {
  102. return filePath;
  103. }
  104. };
  105. return amdRequire;
  106. };
  107. //Favor explicit value, passed in if the module wants to support Node 0.4.
  108. requireFn = requireFn || function req() {
  109. return module.require.apply(module, arguments);
  110. };
  111. function runFactory(id, deps, factory) {
  112. var r, e, m, result;
  113. if (id) {
  114. e = loaderCache[id] = {};
  115. m = {
  116. id: id,
  117. uri: __filename,
  118. exports: e
  119. };
  120. r = makeRequire(requireFn, e, m, id);
  121. } else {
  122. //Only support one define call per file
  123. if (alreadyCalled) {
  124. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  125. }
  126. alreadyCalled = true;
  127. //Use the real variables from node
  128. //Use module.exports for exports, since
  129. //the exports in here is amdefine exports.
  130. e = module.exports;
  131. m = module;
  132. r = makeRequire(requireFn, e, m, module.id);
  133. }
  134. //If there are dependencies, they are strings, so need
  135. //to convert them to dependency values.
  136. if (deps) {
  137. deps = deps.map(function (depName) {
  138. return r(depName);
  139. });
  140. }
  141. //Call the factory with the right dependencies.
  142. if (typeof factory === 'function') {
  143. result = factory.apply(m.exports, deps);
  144. } else {
  145. result = factory;
  146. }
  147. if (result !== undefined) {
  148. m.exports = result;
  149. if (id) {
  150. loaderCache[id] = m.exports;
  151. }
  152. }
  153. }
  154. stringRequire = function (systemRequire, exports, module, id, relId) {
  155. //Split the ID by a ! so that
  156. var index = id.indexOf('!'),
  157. originalId = id,
  158. prefix, plugin;
  159. if (index === -1) {
  160. id = normalize(id, relId);
  161. //Straight module lookup. If it is one of the special dependencies,
  162. //deal with it, otherwise, delegate to node.
  163. if (id === 'require') {
  164. return makeRequire(systemRequire, exports, module, relId);
  165. } else if (id === 'exports') {
  166. return exports;
  167. } else if (id === 'module') {
  168. return module;
  169. } else if (loaderCache.hasOwnProperty(id)) {
  170. return loaderCache[id];
  171. } else if (defineCache[id]) {
  172. runFactory.apply(null, defineCache[id]);
  173. return loaderCache[id];
  174. } else {
  175. if(systemRequire) {
  176. return systemRequire(originalId);
  177. } else {
  178. throw new Error('No module with ID: ' + id);
  179. }
  180. }
  181. } else {
  182. //There is a plugin in play.
  183. prefix = id.substring(0, index);
  184. id = id.substring(index + 1, id.length);
  185. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  186. if (plugin.normalize) {
  187. id = plugin.normalize(id, makeNormalize(relId));
  188. } else {
  189. //Normalize the ID normally.
  190. id = normalize(id, relId);
  191. }
  192. if (loaderCache[id]) {
  193. return loaderCache[id];
  194. } else {
  195. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  196. return loaderCache[id];
  197. }
  198. }
  199. };
  200. //Create a define function specific to the module asking for amdefine.
  201. function define(id, deps, factory) {
  202. if (Array.isArray(id)) {
  203. factory = deps;
  204. deps = id;
  205. id = undefined;
  206. } else if (typeof id !== 'string') {
  207. factory = id;
  208. id = deps = undefined;
  209. }
  210. if (deps && !Array.isArray(deps)) {
  211. factory = deps;
  212. deps = undefined;
  213. }
  214. if (!deps) {
  215. deps = ['require', 'exports', 'module'];
  216. }
  217. //Set up properties for this module. If an ID, then use
  218. //internal cache. If no ID, then use the external variables
  219. //for this node module.
  220. if (id) {
  221. //Put the module in deep freeze until there is a
  222. //require call for it.
  223. defineCache[id] = [id, deps, factory];
  224. } else {
  225. runFactory(id, deps, factory);
  226. }
  227. }
  228. //define.require, which has access to all the values in the
  229. //cache. Useful for AMD modules that all have IDs in the file,
  230. //but need to finally export a value to node based on one of those
  231. //IDs.
  232. define.require = function (id) {
  233. if (loaderCache[id]) {
  234. return loaderCache[id];
  235. }
  236. if (defineCache[id]) {
  237. runFactory.apply(null, defineCache[id]);
  238. return loaderCache[id];
  239. }
  240. };
  241. define.amd = {};
  242. return define;
  243. })(null, function (id) { throw new Error("Dependency not found: " + id); }), requirejs = define.require;
  244. define("amber_vm/browser-compatibility", [], {});
  245. /* ====================================================================
  246. |
  247. | Amber Smalltalk
  248. | http://amber-lang.net
  249. |
  250. ======================================================================
  251. ======================================================================
  252. |
  253. | Copyright (c) 2010-2014
  254. | Nicolas Petton <petton.nicolas@gmail.com>
  255. |
  256. | Copyright (c) 2012-2014
  257. | The Amber team https://github.com/amber-smalltalk?tab=members
  258. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  259. |
  260. | Amber is released under the MIT license
  261. |
  262. | Permission is hereby granted, free of charge, to any person obtaining
  263. | a copy of this software and associated documentation files (the
  264. | 'Software'), to deal in the Software without restriction, including
  265. | without limitation the rights to use, copy, modify, merge, publish,
  266. | distribute, sublicense, and/or sell copies of the Software, and to
  267. | permit persons to whom the Software is furnished to do so, subject to
  268. | the following conditions:
  269. |
  270. | The above copyright notice and this permission notice shall be
  271. | included in all copies or substantial portions of the Software.
  272. |
  273. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  274. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  275. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  276. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  277. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  278. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  279. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  280. |
  281. ==================================================================== */
  282. define("amber_vm/boot", [ 'require', './browser-compatibility' ], function (require) {
  283. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  284. function Brikz(api, apiKey, initKey) {
  285. var brikz = this, backup = {};
  286. apiKey = apiKey || 'exports';
  287. initKey = initKey || '__init__';
  288. function mixin(src, target, what) {
  289. for (var keys = Object.keys(what||src), l=keys.length, i=0; i<l; ++i) {
  290. var value = src[keys[i]];
  291. if (typeof value !== "undefined") { target[keys[i]] = value; }
  292. }
  293. return target;
  294. }
  295. var d={value: null, enumerable: false, configurable: true, writable: true};
  296. Object.defineProperties(this, { ensure: d, rebuild: d });
  297. var exclude = mixin(this, {});
  298. this.rebuild = function () {
  299. Object.keys(backup).forEach(function (key) {
  300. mixin({}, api, (backup[key]||0)[apiKey]);
  301. });
  302. var oapi = mixin(api, {}), order = [], chk = {};
  303. brikz.ensure = function(key) {
  304. if (key in exclude) { return null; }
  305. var b = brikz[key], bak = backup[key];
  306. mixin({}, api, api);
  307. while (typeof b === "function") { b = new b(brikz, api, bak); }
  308. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  309. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  310. return brikz[key] = b;
  311. };
  312. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  313. brikz.ensure = null;
  314. mixin(oapi, mixin({}, api, api));
  315. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  316. order.forEach(function(brik) { brik[initKey] && brik[initKey](); });
  317. backup = mixin(brikz, {});
  318. };
  319. }
  320. /* Brikz end */
  321. function inherits(child, parent) {
  322. child.prototype = Object.create(parent.prototype, {
  323. constructor: { value: child,
  324. enumerable: false, configurable: true, writable: true }
  325. });
  326. return child;
  327. }
  328. var globals = {};
  329. globals.SmalltalkSettings = {};
  330. var api = Object.create(globals);
  331. var brikz = new Brikz(api);
  332. function RootBrik(brikz, st) {
  333. /* Smalltalk foundational objects */
  334. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  335. All objects including `Object` inherit from SmalltalkRoot */
  336. function SmalltalkRoot() {}
  337. function SmalltalkProtoObject() {}
  338. inherits(SmalltalkProtoObject, SmalltalkRoot);
  339. function SmalltalkObject() {}
  340. inherits(SmalltalkObject, SmalltalkProtoObject);
  341. function SmalltalkNil() {}
  342. inherits(SmalltalkNil, SmalltalkObject);
  343. this.Object = SmalltalkObject;
  344. this.nil = new SmalltalkNil();
  345. // Hidden root class of the system.
  346. this.rootAsClass = {fn: SmalltalkRoot};
  347. this.__init__ = function () {
  348. st.addPackage("Kernel-Objects");
  349. st.addPackage("Kernel-Infrastructure");
  350. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  351. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  352. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  353. };
  354. }
  355. function OrganizeBrik(brikz, st) {
  356. brikz.ensure("augments");
  357. var SmalltalkObject = brikz.ensure("root").Object;
  358. function SmalltalkOrganizer () {}
  359. function SmalltalkPackageOrganizer () {
  360. this.elements = [];
  361. }
  362. function SmalltalkClassOrganizer () {
  363. this.elements = [];
  364. }
  365. inherits(SmalltalkOrganizer, SmalltalkObject);
  366. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  367. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  368. this.__init__ = function () {
  369. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  370. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  371. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  372. };
  373. this.setupClassOrganization = function (klass) {
  374. klass.organization = new SmalltalkClassOrganizer();
  375. klass.organization.theClass = klass;
  376. };
  377. this.setupPackageOrganization = function (pkg) {
  378. pkg.organization = new SmalltalkPackageOrganizer();
  379. };
  380. this.addOrganizationElement = function (owner, element) {
  381. owner.organization.elements.addElement(element);
  382. };
  383. this.removeOrganizationElement = function (owner, element) {
  384. owner.organization.elements.removeElement(element);
  385. };
  386. }
  387. function DNUBrik(brikz, st) {
  388. brikz.ensure("selectorConversion");
  389. brikz.ensure("messageSend");
  390. var manip = brikz.ensure("manipulation");
  391. var rootAsClass = brikz.ensure("root").rootAsClass;
  392. /* Method not implemented handlers */
  393. var methods = [], checker = Object.create(null);
  394. this.selectors = [];
  395. this.get = function (string) {
  396. var index = this.selectors.indexOf(string);
  397. if(index !== -1) {
  398. return methods[index];
  399. }
  400. this.selectors.push(string);
  401. var selector = st.selector(string);
  402. checker[selector] = true;
  403. var method = {jsSelector: selector, fn: createHandler(selector)};
  404. methods.push(method);
  405. manip.installMethod(method, rootAsClass);
  406. return method;
  407. };
  408. this.isSelector = function (selector) {
  409. return checker[selector];
  410. };
  411. /* Dnu handler method */
  412. function createHandler(selector) {
  413. return function() {
  414. var args = Array.prototype.slice.call(arguments);
  415. return brikz.messageSend.messageNotUnderstood(this, selector, args);
  416. };
  417. }
  418. this.installHandlers = function (klass) {
  419. for(var i=0; i<methods.length; i++) {
  420. manip.installMethodIfAbsent(methods[i], klass);
  421. }
  422. };
  423. }
  424. function ClassInitBrik(brikz, st) {
  425. var dnu = brikz.ensure("dnu");
  426. var manip = brikz.ensure("manipulation");
  427. var nil = brikz.ensure("root").nil;
  428. /* Initialize a class in its class hierarchy. Handle both classes and
  429. metaclasses. */
  430. st.init = function(klass) {
  431. st.initClass(klass);
  432. if(klass.klass && !klass.meta) {
  433. st.initClass(klass.klass);
  434. }
  435. };
  436. st.initClass = function(klass) {
  437. if(klass.wrapped) {
  438. copySuperclass(klass);
  439. }
  440. if(klass.wrapped) {
  441. dnu.installHandlers(klass);
  442. }
  443. };
  444. function copySuperclass(klass, superclass) {
  445. var inheritedMethods = Object.create(null);
  446. deinstallAllMethods(klass);
  447. for (superclass = superclass || klass.superclass;
  448. superclass && superclass !== nil;
  449. superclass = superclass.superclass) {
  450. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  451. inheritMethodIfAbsent(superclass.methods[keys[i]]);
  452. }
  453. }
  454. manip.reinstallMethods(klass);
  455. function inheritMethodIfAbsent(method) {
  456. var selector = method.selector;
  457. //TODO: prepare klass methods into inheritedMethods to only test once
  458. if(klass.methods[selector] || inheritedMethods[selector]) {
  459. return;
  460. }
  461. manip.installMethod(method, klass);
  462. inheritedMethods[method.selector] = true;
  463. }
  464. }
  465. function deinstallAllMethods(klass) {
  466. var proto = klass.fn.prototype;
  467. for(var keys = Object.getOwnPropertyNames(proto), i=0; i<keys.length; i++) {
  468. var key = keys[i];
  469. if (dnu.isSelector(key)) {
  470. proto[key] = null;
  471. }
  472. }
  473. }
  474. }
  475. function ManipulationBrik(brikz, st) {
  476. this.installMethodIfAbsent = function (handler, klass) {
  477. if(!klass.fn.prototype[handler.jsSelector]) {
  478. installMethod(handler, klass);
  479. }
  480. };
  481. function installMethod (method, klass) {
  482. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  483. value: method.fn,
  484. enumerable: false, configurable: true, writable: true
  485. });
  486. }
  487. this.installMethod = installMethod;
  488. this.reinstallMethods = function (klass) {
  489. var methods = klass.methods;
  490. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  491. installMethod(methods[keys[i]], klass);
  492. }
  493. };
  494. }
  495. function ClassesBrik(brikz, st) {
  496. var org = brikz.ensure("organize");
  497. var root = brikz.ensure("root");
  498. var nil = root.nil;
  499. var rootAsClass = root.rootAsClass;
  500. var SmalltalkObject = root.Object;
  501. rootAsClass.klass = {fn: SmalltalkClass};
  502. function SmalltalkPackage() {}
  503. function SmalltalkBehavior() {}
  504. function SmalltalkClass() {}
  505. function SmalltalkMetaclass() {}
  506. inherits(SmalltalkPackage, SmalltalkObject);
  507. inherits(SmalltalkBehavior, SmalltalkObject);
  508. inherits(SmalltalkClass, SmalltalkBehavior);
  509. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  510. SmalltalkMetaclass.prototype.meta = true;
  511. this.__init__ = function () {
  512. st.addPackage("Kernel-Classes");
  513. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  514. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  515. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  516. // Manually bootstrap the metaclass hierarchy
  517. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  518. addSubclass(globals.ProtoObject.klass);
  519. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  520. };
  521. /* Smalltalk classes */
  522. var classes = [];
  523. var wrappedClasses = [];
  524. /* We hold all Packages in a separate Object */
  525. st.packages = {};
  526. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  527. function pkg(spec) {
  528. var that = new SmalltalkPackage();
  529. that.pkgName = spec.pkgName;
  530. org.setupPackageOrganization(that);
  531. that.properties = spec.properties || {};
  532. return that;
  533. }
  534. /* Smalltalk class creation. A class is an instance of an automatically
  535. created metaclass object. Newly created classes (not their metaclass)
  536. should be added to the smalltalk object, see smalltalk.addClass().
  537. Superclass linking is *not* handled here, see smalltalk.init() */
  538. function klass(spec) {
  539. spec = spec || {};
  540. var setSuperClass = spec.superclass;
  541. if(!spec.superclass) {
  542. spec.superclass = rootAsClass;
  543. }
  544. var meta = metaclass(spec);
  545. var that = meta.instanceClass;
  546. that.superclass = setSuperClass;
  547. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  548. that.subclasses = [];
  549. setupClass(that, spec);
  550. that.className = spec.className;
  551. that.wrapped = spec.wrapped || false;
  552. meta.className = spec.className + ' class';
  553. meta.superclass = spec.superclass.klass;
  554. return that;
  555. }
  556. function metaclass(spec) {
  557. spec = spec || {};
  558. var that = new SmalltalkMetaclass();
  559. that.fn = inherits(function () {}, spec.superclass.klass.fn);
  560. that.instanceClass = new that.fn();
  561. setupClass(that);
  562. return that;
  563. }
  564. SmalltalkBehavior.prototype.toString = function () {
  565. return 'Smalltalk ' + this.className;
  566. };
  567. function setupClass(klass, spec) {
  568. spec = spec || {};
  569. klass.iVarNames = spec.iVarNames || [];
  570. klass.pkg = spec.pkg;
  571. org.setupClassOrganization(klass);
  572. Object.defineProperty(klass, "methods", {
  573. value: Object.create(null),
  574. enumerable: false, configurable: true, writable: true
  575. });
  576. Object.defineProperty(klass.fn.prototype, "klass", {
  577. value: klass,
  578. enumerable: false, configurable: true, writable: true
  579. });
  580. }
  581. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  582. If pkgName is null or empty we return nil, which is an allowed package for a class.
  583. If package already exists we still update the properties of it. */
  584. st.addPackage = function(pkgName, properties) {
  585. if(!pkgName) {return nil;}
  586. if(!(st.packages[pkgName])) {
  587. st.packages[pkgName] = pkg({
  588. pkgName: pkgName,
  589. properties: properties
  590. });
  591. } else {
  592. if(properties) {
  593. st.packages[pkgName].properties = properties;
  594. }
  595. }
  596. return st.packages[pkgName];
  597. };
  598. /* Add a class to the smalltalk object, creating a new one if needed.
  599. A Package is lazily created if it does not exist with given name. */
  600. st.addClass = function(className, superclass, iVarNames, pkgName) {
  601. if (superclass == nil) { superclass = null; }
  602. // While subclassing nil is allowed, it might be an error, so
  603. // warn about it.
  604. if (superclass === null) {
  605. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  606. }
  607. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  608. };
  609. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  610. var pkg = st.packages[pkgName];
  611. if (!pkg) {
  612. throw new Error("Missing package "+pkgName);
  613. }
  614. if(globals[className] && globals[className].superclass == superclass) {
  615. // globals[className].superclass = superclass;
  616. globals[className].iVarNames = iVarNames || [];
  617. if (pkg) globals[className].pkg = pkg;
  618. if (fn) {
  619. fn.prototype = globals[className].fn.prototype;
  620. globals[className].fn = fn;
  621. fn.prototype.constructor = fn;
  622. }
  623. } else {
  624. if(globals[className]) {
  625. st.removeClass(globals[className]);
  626. }
  627. globals[className] = klass({
  628. className: className,
  629. superclass: superclass,
  630. pkg: pkg,
  631. iVarNames: iVarNames,
  632. fn: fn,
  633. wrapped: wrapped
  634. });
  635. addSubclass(globals[className]);
  636. }
  637. classes.addElement(globals[className]);
  638. org.addOrganizationElement(pkg, globals[className]);
  639. }
  640. st.removeClass = function(klass) {
  641. org.removeOrganizationElement(klass.pkg, klass);
  642. classes.removeElement(klass);
  643. removeSubclass(klass);
  644. delete globals[klass.className];
  645. };
  646. function addSubclass(klass) {
  647. if(klass.superclass) {
  648. klass.superclass.subclasses.addElement(klass);
  649. }
  650. }
  651. function removeSubclass(klass) {
  652. if(klass.superclass) {
  653. klass.superclass.subclasses.removeElement(klass);
  654. }
  655. }
  656. /* Create a new class wrapping a JavaScript constructor, and add it to the
  657. global smalltalk object. Package is lazily created if it does not exist with given name. */
  658. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  659. wrapped = wrapped !== false;
  660. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  661. if(wrapped) {
  662. wrappedClasses.addElement(globals[className]);
  663. }
  664. };
  665. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  666. st.setClassConstructor = function(klass, constructor) {
  667. wrappedClasses.addElement(klass);
  668. klass.wrapped = true;
  669. klass.fn = constructor;
  670. // The fn property changed. We need to add back the klass property to the prototype
  671. Object.defineProperty(klass.fn.prototype, "klass", {
  672. value: klass,
  673. enumerable: false, configurable: true, writable: true
  674. });
  675. st.initClass(klass);
  676. };
  677. /* Create an alias for an existing class */
  678. st.alias = function(klass, alias) {
  679. globals[alias] = klass;
  680. };
  681. /* Answer all registered Smalltalk classes */
  682. //TODO: remove the function and make smalltalk.classes an array
  683. st.classes = function() {
  684. return classes;
  685. };
  686. st.wrappedClasses = function() {
  687. return wrappedClasses;
  688. };
  689. // Still used, but could go away now that subclasses are stored
  690. // into classes directly.
  691. st.allSubclasses = function(klass) {
  692. return klass._allSubclasses();
  693. };
  694. }
  695. function MethodsBrik(brikz, st) {
  696. var manip = brikz.ensure("manipulation");
  697. var org = brikz.ensure("organize");
  698. var stInit = brikz.ensure("stInit");
  699. var dnu = brikz.ensure("dnu");
  700. var SmalltalkObject = brikz.ensure("root").Object;
  701. brikz.ensure("selectorConversion");
  702. brikz.ensure("classes");
  703. brikz.ensure("classInit");
  704. function SmalltalkMethod() {}
  705. inherits(SmalltalkMethod, SmalltalkObject);
  706. this.__init__ = function () {
  707. st.addPackage("Kernel-Methods");
  708. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  709. };
  710. /* Smalltalk method object. To add a method to a class,
  711. use smalltalk.addMethod() */
  712. st.method = function(spec) {
  713. var that = new SmalltalkMethod();
  714. that.selector = spec.selector;
  715. that.jsSelector = spec.jsSelector;
  716. that.args = spec.args || {};
  717. // spec.category is kept for compatibility
  718. that.protocol = spec.protocol || spec.category;
  719. that.source = spec.source;
  720. that.messageSends = spec.messageSends || [];
  721. that.referencedClasses = spec.referencedClasses || [];
  722. that.fn = spec.fn;
  723. return that;
  724. };
  725. function installNewDnuHandler(newHandler) {
  726. var wrappedClasses = st.wrappedClasses();
  727. for(var i = 0; i < wrappedClasses.length; i++) {
  728. manip.installMethodIfAbsent(newHandler, wrappedClasses[i]);
  729. }
  730. }
  731. /* Add/remove a method to/from a class */
  732. st.addMethod = function (method, klass) {
  733. if (!(method.jsSelector)) {
  734. method.jsSelector = st.selector(method.selector);
  735. }
  736. manip.installMethod(method, klass);
  737. klass.methods[method.selector] = method;
  738. method.methodClass = klass;
  739. // During the bootstrap, #addCompiledMethod is not used.
  740. // Therefore we populate the organizer here too
  741. org.addOrganizationElement(klass, method.protocol);
  742. propagateMethodChange(klass);
  743. for(var i=0; i<method.messageSends.length; i++) {
  744. var dnuHandler = dnu.get(method.messageSends[i]);
  745. if(stInit.initialized()) {
  746. installNewDnuHandler(dnuHandler);
  747. }
  748. }
  749. };
  750. function propagateMethodChange(klass) {
  751. // If already initialized (else it will be done later anyway),
  752. // re-initialize all subclasses to ensure the method change
  753. // propagation (for wrapped classes, not using the prototype
  754. // chain).
  755. //TODO: optimize, only one method need to be updated, not all of them
  756. if (stInit.initialized()) {
  757. st.allSubclasses(klass).forEach(function (subclass) {
  758. st.initClass(subclass);
  759. });
  760. }
  761. }
  762. st.removeMethod = function(method, klass) {
  763. if (klass !== method.methodClass) {
  764. throw new Error(
  765. "Refusing to remove method "
  766. + method.methodClass.className+">>"+method.selector
  767. + " from different class "
  768. + klass.className);
  769. }
  770. delete klass.fn.prototype[st.selector(method.selector)];
  771. delete klass.methods[method.selector];
  772. st.initClass(klass);
  773. propagateMethodChange(klass);
  774. // Do *not* delete protocols from here.
  775. // This is handled by #removeCompiledMethod
  776. };
  777. /* Answer all method selectors based on dnu handlers */
  778. st.allSelectors = function() {
  779. return dnu.selectors;
  780. };
  781. }
  782. function AugmentsBrik(brikz, st) {
  783. /* Make sure that console is defined */
  784. if(typeof console === "undefined") {
  785. this.console = {
  786. log: function() {},
  787. warn: function() {},
  788. info: function() {},
  789. debug: function() {},
  790. error: function() {}
  791. };
  792. }
  793. /* Array extensions */
  794. Array.prototype.addElement = function(el) {
  795. if(typeof el === 'undefined') { return; }
  796. if(this.indexOf(el) == -1) {
  797. this.push(el);
  798. }
  799. };
  800. Array.prototype.removeElement = function(el) {
  801. var i = this.indexOf(el);
  802. if (i !== -1) { this.splice(i, 1); }
  803. };
  804. }
  805. function SmalltalkInitBrik(brikz, st) {
  806. brikz.ensure("classInit");
  807. brikz.ensure("classes");
  808. var nil = brikz.ensure("root").nil;
  809. var initialized = false;
  810. /* Smalltalk initialization. Called on page load */
  811. st.initialize = function() {
  812. if(initialized) { return; }
  813. st.classes().forEach(function(klass) {
  814. st.init(klass);
  815. });
  816. runnable();
  817. st.classes().forEach(function(klass) {
  818. klass._initialize();
  819. });
  820. initialized = true;
  821. };
  822. this.initialized = function () {
  823. return initialized;
  824. };
  825. this.__init__ = function () {
  826. st.addPackage("Kernel-Methods");
  827. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  828. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  829. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  830. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  831. st.addPackage("Kernel-Collections");
  832. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  833. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  834. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  835. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  836. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  837. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  838. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  839. st.addPackage("Kernel-Exceptions");
  840. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  841. /* Alias definitions */
  842. st.alias(globals.Array, "OrderedCollection");
  843. st.alias(globals.Date, "Time");
  844. };
  845. }
  846. function PrimitivesBrik(brikz, st) {
  847. /* Unique ID number generator */
  848. var oid = 0;
  849. st.nextId = function() {
  850. oid += 1;
  851. return oid;
  852. };
  853. /* Converts a JavaScript object to valid Smalltalk Object */
  854. st.readJSObject = function(js) {
  855. var object = js;
  856. var readObject = (js.constructor === Object);
  857. var readArray = (js.constructor === Array);
  858. if(readObject) {
  859. object = globals.Dictionary._new();
  860. }
  861. for(var i in js) {
  862. if(readObject) {
  863. object._at_put_(i, st.readJSObject(js[i]));
  864. }
  865. if(readArray) {
  866. object[i] = st.readJSObject(js[i]);
  867. }
  868. }
  869. return object;
  870. };
  871. /* Boolean assertion */
  872. st.assert = function(shouldBeBoolean) {
  873. if (undefined !== shouldBeBoolean && shouldBeBoolean.klass === globals.Boolean) {
  874. return shouldBeBoolean == true;
  875. } else {
  876. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  877. }
  878. };
  879. /* List of all reserved words in JavaScript. They may not be used as variables
  880. in Smalltalk. */
  881. // list of reserved JavaScript keywords as of
  882. // http://es5.github.com/#x7.6.1.1
  883. // and
  884. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  885. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  886. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  887. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  888. 'try', 'typeof', 'var', 'void', 'while', 'with',
  889. // ES5: future use: http://es5.github.com/#x7.6.1.2
  890. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  891. // ES5: future use in strict mode
  892. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  893. 'public', 'static', 'yield'];
  894. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  895. }
  896. function RuntimeBrik(brikz, st) {
  897. brikz.ensure("selectorConversion");
  898. var root = brikz.ensure("root");
  899. var nil = root.nil;
  900. var SmalltalkObject = root.Object;
  901. function SmalltalkMethodContext(home, setup) {
  902. this.sendIdx = {};
  903. this.homeContext = home;
  904. this.setup = setup || function() {};
  905. }
  906. inherits(SmalltalkMethodContext, SmalltalkObject);
  907. this.__init__ = function () {
  908. st.addPackage("Kernel-Methods");
  909. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  910. // Fallbacks
  911. SmalltalkMethodContext.prototype.locals = {};
  912. SmalltalkMethodContext.prototype.receiver = null;
  913. SmalltalkMethodContext.prototype.selector = null;
  914. SmalltalkMethodContext.prototype.lookupClass = null;
  915. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  916. this.receiver = receiver;
  917. this.selector = selector;
  918. this.locals = locals || {};
  919. this.lookupClass = lookupClass;
  920. if(this.homeContext) {
  921. this.homeContext.evaluatedSelector = selector;
  922. }
  923. };
  924. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  925. this.locals = locals || {};
  926. this.outerContext = ctx;
  927. this.index = index || 0;
  928. };
  929. SmalltalkMethodContext.prototype.init = function() {
  930. var home = this.homeContext;
  931. if(home) {
  932. home.init();
  933. }
  934. this.setup(this);
  935. };
  936. SmalltalkMethodContext.prototype.method = function() {
  937. var method;
  938. var lookup = this.lookupClass || this.receiver.klass;
  939. while(!method && lookup) {
  940. method = lookup.methods[st.convertSelector(this.selector)];
  941. lookup = lookup.superclass;
  942. }
  943. return method;
  944. };
  945. };
  946. /* This is the current call context object. While it is publicly available,
  947. Use smalltalk.getThisContext() instead which will answer a safe copy of
  948. the current context */
  949. st.thisContext = undefined;
  950. st.withContext = function(worker, setup) {
  951. if(st.thisContext) {
  952. return inContext(worker, setup);
  953. } else {
  954. try {
  955. return inContext(worker, setup);
  956. } catch(error) {
  957. handleError(error);
  958. st.thisContext = null;
  959. // Rethrow the error in any case.
  960. throw error;
  961. }
  962. }
  963. };
  964. function inContext(worker, setup) {
  965. var context = pushContext(setup);
  966. var result = worker(context);
  967. popContext(context);
  968. return result;
  969. }
  970. /* Wrap a JavaScript exception in a Smalltalk Exception.
  971. In case of a RangeError, stub the stack after 100 contexts to
  972. avoid another RangeError later when the stack is manipulated. */
  973. function wrappedError(error) {
  974. var errorWrapper = globals.JavaScriptException._on_(error);
  975. // Add the error to the context, so it is visible in the stack
  976. try { errorWrapper._signal(); } catch (ex) {}
  977. var context = st.getThisContext();
  978. if(isRangeError(error)) {
  979. stubContextStack(context);
  980. }
  981. errorWrapper._context_(context);
  982. return errorWrapper;
  983. }
  984. /* Stub the context stack after 100 contexts */
  985. function stubContextStack(context) {
  986. var currentContext = context;
  987. var contexts = 0;
  988. while(contexts < 100) {
  989. if(currentContext) {
  990. currentContext = currentContext.homeContext;
  991. }
  992. contexts++;
  993. }
  994. if(currentContext) {
  995. currentContext.homeContext = undefined;
  996. }
  997. }
  998. function isRangeError(error) {
  999. return error instanceof RangeError;
  1000. }
  1001. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  1002. (See the Smalltalk class ErrorHandler and its subclasses */
  1003. function handleError(error) {
  1004. if (!error.smalltalkError) {
  1005. error = wrappedError(error);
  1006. }
  1007. globals.ErrorHandler._handleError_(error);
  1008. }
  1009. /* Handle thisContext pseudo variable */
  1010. st.getThisContext = function() {
  1011. if(st.thisContext) {
  1012. st.thisContext.init();
  1013. return st.thisContext;
  1014. } else {
  1015. return nil;
  1016. }
  1017. };
  1018. function pushContext(setup) {
  1019. return st.thisContext = new SmalltalkMethodContext(st.thisContext, setup);
  1020. }
  1021. function popContext(context) {
  1022. st.thisContext = context.homeContext;
  1023. }
  1024. }
  1025. function MessageSendBrik(brikz, st) {
  1026. brikz.ensure("selectorConversion");
  1027. var nil = brikz.ensure("root").nil;
  1028. /* Handles unhandled errors during message sends */
  1029. // simply send the message and handle #dnu:
  1030. st.send = function(receiver, selector, args, klass) {
  1031. var method;
  1032. if(receiver === null) {
  1033. receiver = nil;
  1034. }
  1035. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  1036. if(method) {
  1037. return method.apply(receiver, args);
  1038. } else {
  1039. return messageNotUnderstood(receiver, selector, args);
  1040. }
  1041. };
  1042. /* Handles #dnu: *and* JavaScript method calls.
  1043. if the receiver has no klass, we consider it a JS object (outside of the
  1044. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  1045. function messageNotUnderstood(receiver, selector, args) {
  1046. /* Handles JS method calls. */
  1047. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  1048. return callJavaScriptMethod(receiver, selector, args);
  1049. }
  1050. /* Handles not understood messages. Also see the Amber counter-part
  1051. Object>>doesNotUnderstand: */
  1052. return receiver._doesNotUnderstand_(
  1053. globals.Message._new()
  1054. ._selector_(st.convertSelector(selector))
  1055. ._arguments_(args)
  1056. );
  1057. }
  1058. /* Call a method of a JS object, or answer a property if it exists.
  1059. Else try wrapping a JSObjectProxy around the receiver.
  1060. If the object property is a function, then call it, except if it starts with
  1061. an uppercase character (we probably want to answer the function itself in this
  1062. case and send it #new from Amber).
  1063. Converts keyword-based selectors by using the first
  1064. keyword only, but keeping all message arguments.
  1065. Example:
  1066. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1067. function callJavaScriptMethod(receiver, selector, args) {
  1068. var jsSelector = selector._asJavaScriptSelector();
  1069. var jsProperty = receiver[jsSelector];
  1070. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  1071. return jsProperty.apply(receiver, args);
  1072. } else if(jsProperty !== undefined) {
  1073. if(args[0]) {
  1074. receiver[jsSelector] = args[0];
  1075. return nil;
  1076. } else {
  1077. return jsProperty;
  1078. }
  1079. }
  1080. return st.send(globals.JSObjectProxy._on_(receiver), selector, args);
  1081. }
  1082. this.messageNotUnderstood = messageNotUnderstood;
  1083. }
  1084. function SelectorConversionBrik(brikz, st) {
  1085. /* Convert a Smalltalk selector into a JS selector */
  1086. st.selector = function(string) {
  1087. var selector = '_' + string;
  1088. selector = selector.replace(/:/g, '_');
  1089. selector = selector.replace(/[\&]/g, '_and');
  1090. selector = selector.replace(/[\|]/g, '_or');
  1091. selector = selector.replace(/[+]/g, '_plus');
  1092. selector = selector.replace(/-/g, '_minus');
  1093. selector = selector.replace(/[*]/g ,'_star');
  1094. selector = selector.replace(/[\/]/g ,'_slash');
  1095. selector = selector.replace(/[\\]/g ,'_backslash');
  1096. selector = selector.replace(/[\~]/g ,'_tild');
  1097. selector = selector.replace(/>/g ,'_gt');
  1098. selector = selector.replace(/</g ,'_lt');
  1099. selector = selector.replace(/=/g ,'_eq');
  1100. selector = selector.replace(/,/g ,'_comma');
  1101. selector = selector.replace(/[@]/g ,'_at');
  1102. return selector;
  1103. };
  1104. /* Convert a string to a valid smalltalk selector.
  1105. if you modify the following functions, also change String>>asSelector
  1106. accordingly */
  1107. st.convertSelector = function(selector) {
  1108. if(selector.match(/__/)) {
  1109. return convertBinarySelector(selector);
  1110. } else {
  1111. return convertKeywordSelector(selector);
  1112. }
  1113. };
  1114. function convertKeywordSelector(selector) {
  1115. return selector.replace(/^_/, '').replace(/_/g, ':');
  1116. }
  1117. function convertBinarySelector(selector) {
  1118. return selector
  1119. .replace(/^_/, '')
  1120. .replace(/_and/g, '&')
  1121. .replace(/_or/g, '|')
  1122. .replace(/_plus/g, '+')
  1123. .replace(/_minus/g, '-')
  1124. .replace(/_star/g, '*')
  1125. .replace(/_slash/g, '/')
  1126. .replace(/_backslash/g, '\\')
  1127. .replace(/_tild/g, '~')
  1128. .replace(/_gt/g, '>')
  1129. .replace(/_lt/g, '<')
  1130. .replace(/_eq/g, '=')
  1131. .replace(/_comma/g, ',')
  1132. .replace(/_at/g, '@');
  1133. }
  1134. }
  1135. /* Adds AMD and requirejs related methods to the smalltalk object */
  1136. function AMDBrik(brikz, st) {
  1137. this.__init__ = function () {
  1138. st.amdRequire = require;
  1139. st.defaultTransportType = st.defaultTransportType || "amd";
  1140. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1141. };
  1142. }
  1143. /* Making smalltalk that can load */
  1144. brikz.root = RootBrik;
  1145. brikz.dnu = DNUBrik;
  1146. brikz.organize = OrganizeBrik;
  1147. brikz.selectorConversion = SelectorConversionBrik;
  1148. brikz.classInit = ClassInitBrik;
  1149. brikz.manipulation = ManipulationBrik;
  1150. brikz.classes = ClassesBrik;
  1151. brikz.methods = MethodsBrik;
  1152. brikz.stInit = SmalltalkInitBrik;
  1153. brikz.augments = AugmentsBrik;
  1154. brikz.amdBrik = AMDBrik;
  1155. brikz.rebuild();
  1156. /* Making smalltalk that can run */
  1157. function runnable () {
  1158. brikz.messageSend = MessageSendBrik;
  1159. brikz.runtime = RuntimeBrik;
  1160. brikz.primitives = PrimitivesBrik;
  1161. brikz.rebuild();
  1162. };
  1163. return { vm: api, nil: brikz.root.nil, globals: globals };
  1164. });
  1165. define("amber_vm/smalltalk", ["./boot"], function (boot) {
  1166. return boot.vm;
  1167. });
  1168. define("amber_vm/globals", ["./boot"], function (boot) {
  1169. return boot.globals;
  1170. });
  1171. define("amber_vm/nil", ["./boot"], function (boot) {
  1172. return boot.nil;
  1173. });
  1174. /**
  1175. * _st is a function used all over the compiled amber code that
  1176. * takes any value (JavaScript or Smalltalk)
  1177. * and returns a proper Amber Smalltalk receiver.
  1178. *
  1179. * null or undefined -> nil,
  1180. * plain JS object -> wrapped JS object,
  1181. * otherwise unchanged
  1182. */
  1183. define("amber_vm/_st", ["./globals", "./nil"], function (globals, nil) {
  1184. return function (o) {
  1185. if (o == null) { return nil; }
  1186. if (o.klass) { return o; }
  1187. return globals.JSObjectProxy._on_(o);
  1188. };
  1189. });
  1190. define("amber_core/Kernel-Objects", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals"], function(smalltalk,nil,_st, globals){
  1191. smalltalk.addPackage('Kernel-Objects');
  1192. smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1193. smalltalk.addClass('ProtoObject', globals.nil, [], 'Kernel-Objects');
  1194. 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.";
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "=",
  1198. protocol: 'comparing',
  1199. fn: function (anObject){
  1200. var self=this;
  1201. return smalltalk.withContext(function($ctx1) {
  1202. var $1;
  1203. $1=self.__eq_eq(anObject);
  1204. return $1;
  1205. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.ProtoObject)})},
  1206. args: ["anObject"],
  1207. source: "= anObject\x0a\x09^ self == anObject",
  1208. messageSends: ["=="],
  1209. referencedClasses: []
  1210. }),
  1211. globals.ProtoObject);
  1212. smalltalk.addMethod(
  1213. smalltalk.method({
  1214. selector: "==",
  1215. protocol: 'comparing',
  1216. fn: function (anObject){
  1217. var self=this;
  1218. return smalltalk.withContext(function($ctx1) {
  1219. var $2,$1;
  1220. $2=self._identityHash();
  1221. $ctx1.sendIdx["identityHash"]=1;
  1222. $1=_st($2).__eq(_st(anObject)._identityHash());
  1223. return $1;
  1224. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},globals.ProtoObject)})},
  1225. args: ["anObject"],
  1226. source: "== anObject\x0a\x09^ self identityHash = anObject identityHash",
  1227. messageSends: ["=", "identityHash"],
  1228. referencedClasses: []
  1229. }),
  1230. globals.ProtoObject);
  1231. smalltalk.addMethod(
  1232. smalltalk.method({
  1233. selector: "asString",
  1234. protocol: 'converting',
  1235. fn: function (){
  1236. var self=this;
  1237. return smalltalk.withContext(function($ctx1) {
  1238. var $1;
  1239. $1=self._printString();
  1240. return $1;
  1241. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.ProtoObject)})},
  1242. args: [],
  1243. source: "asString\x0a\x09^ self printString",
  1244. messageSends: ["printString"],
  1245. referencedClasses: []
  1246. }),
  1247. globals.ProtoObject);
  1248. smalltalk.addMethod(
  1249. smalltalk.method({
  1250. selector: "class",
  1251. protocol: 'accessing',
  1252. fn: function (){
  1253. var self=this;
  1254. return smalltalk.withContext(function($ctx1) {
  1255. return self.klass;
  1256. return self}, function($ctx1) {$ctx1.fill(self,"class",{},globals.ProtoObject)})},
  1257. args: [],
  1258. source: "class\x0a\x09<return self.klass>",
  1259. messageSends: [],
  1260. referencedClasses: []
  1261. }),
  1262. globals.ProtoObject);
  1263. smalltalk.addMethod(
  1264. smalltalk.method({
  1265. selector: "doesNotUnderstand:",
  1266. protocol: 'error handling',
  1267. fn: function (aMessage){
  1268. var self=this;
  1269. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1270. return smalltalk.withContext(function($ctx1) {
  1271. var $1,$2;
  1272. $1=_st($MessageNotUnderstood())._new();
  1273. _st($1)._receiver_(self);
  1274. _st($1)._message_(aMessage);
  1275. $2=_st($1)._signal();
  1276. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.ProtoObject)})},
  1277. args: ["aMessage"],
  1278. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1279. messageSends: ["receiver:", "new", "message:", "signal"],
  1280. referencedClasses: ["MessageNotUnderstood"]
  1281. }),
  1282. globals.ProtoObject);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "identityHash",
  1286. protocol: 'accessing',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. var hash=self.identityHash;
  1291. if (hash) return hash;
  1292. hash=smalltalk.nextId();
  1293. Object.defineProperty(self, 'identityHash', {value:hash});
  1294. return hash;
  1295. ;
  1296. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.ProtoObject)})},
  1297. args: [],
  1298. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=smalltalk.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1299. messageSends: [],
  1300. referencedClasses: []
  1301. }),
  1302. globals.ProtoObject);
  1303. smalltalk.addMethod(
  1304. smalltalk.method({
  1305. selector: "initialize",
  1306. protocol: 'initialization',
  1307. fn: function (){
  1308. var self=this;
  1309. return self},
  1310. args: [],
  1311. source: "initialize",
  1312. messageSends: [],
  1313. referencedClasses: []
  1314. }),
  1315. globals.ProtoObject);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "inspect",
  1319. protocol: 'inspecting',
  1320. fn: function (){
  1321. var self=this;
  1322. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1323. return smalltalk.withContext(function($ctx1) {
  1324. _st($Inspector())._inspect_(self);
  1325. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},globals.ProtoObject)})},
  1326. args: [],
  1327. source: "inspect\x0a\x09Inspector inspect: self",
  1328. messageSends: ["inspect:"],
  1329. referencedClasses: ["Inspector"]
  1330. }),
  1331. globals.ProtoObject);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "inspectOn:",
  1335. protocol: 'inspecting',
  1336. fn: function (anInspector){
  1337. var self=this;
  1338. return self},
  1339. args: ["anInspector"],
  1340. source: "inspectOn: anInspector",
  1341. messageSends: [],
  1342. referencedClasses: []
  1343. }),
  1344. globals.ProtoObject);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "instVarAt:",
  1348. protocol: 'accessing',
  1349. fn: function (aString){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. return self['@'+aString] ;
  1353. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},globals.ProtoObject)})},
  1354. args: ["aString"],
  1355. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1356. messageSends: [],
  1357. referencedClasses: []
  1358. }),
  1359. globals.ProtoObject);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "instVarAt:put:",
  1363. protocol: 'accessing',
  1364. fn: function (aString,anObject){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self['@' + aString] = anObject ;
  1368. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},globals.ProtoObject)})},
  1369. args: ["aString", "anObject"],
  1370. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1371. messageSends: [],
  1372. referencedClasses: []
  1373. }),
  1374. globals.ProtoObject);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "perform:",
  1378. protocol: 'message handling',
  1379. fn: function (aString){
  1380. var self=this;
  1381. return smalltalk.withContext(function($ctx1) {
  1382. var $1;
  1383. $1=self._perform_withArguments_(aString,[]);
  1384. return $1;
  1385. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},globals.ProtoObject)})},
  1386. args: ["aString"],
  1387. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1388. messageSends: ["perform:withArguments:"],
  1389. referencedClasses: []
  1390. }),
  1391. globals.ProtoObject);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "perform:withArguments:",
  1395. protocol: 'message handling',
  1396. fn: function (aString,aCollection){
  1397. var self=this;
  1398. return smalltalk.withContext(function($ctx1) {
  1399. return smalltalk.send(self, aString._asSelector(), aCollection);
  1400. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},globals.ProtoObject)})},
  1401. args: ["aString", "aCollection"],
  1402. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1403. messageSends: [],
  1404. referencedClasses: []
  1405. }),
  1406. globals.ProtoObject);
  1407. smalltalk.addMethod(
  1408. smalltalk.method({
  1409. selector: "printOn:",
  1410. protocol: 'printing',
  1411. fn: function (aStream){
  1412. var self=this;
  1413. return smalltalk.withContext(function($ctx1) {
  1414. var $5,$4,$3,$2,$1;
  1415. $5=self._class();
  1416. $ctx1.sendIdx["class"]=1;
  1417. $4=_st($5)._name();
  1418. $ctx1.sendIdx["name"]=1;
  1419. $3=_st($4)._first();
  1420. $2=_st($3)._isVowel();
  1421. if(smalltalk.assert($2)){
  1422. $1="an ";
  1423. } else {
  1424. $1="a ";
  1425. };
  1426. _st(aStream)._nextPutAll_($1);
  1427. $ctx1.sendIdx["nextPutAll:"]=1;
  1428. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1429. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.ProtoObject)})},
  1430. args: ["aStream"],
  1431. 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",
  1432. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1433. referencedClasses: []
  1434. }),
  1435. globals.ProtoObject);
  1436. smalltalk.addMethod(
  1437. smalltalk.method({
  1438. selector: "printString",
  1439. protocol: 'printing',
  1440. fn: function (){
  1441. var self=this;
  1442. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1443. return smalltalk.withContext(function($ctx1) {
  1444. var $1;
  1445. $1=_st($String())._streamContents_((function(str){
  1446. return smalltalk.withContext(function($ctx2) {
  1447. return self._printOn_(str);
  1448. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1449. return $1;
  1450. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.ProtoObject)})},
  1451. args: [],
  1452. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1453. messageSends: ["streamContents:", "printOn:"],
  1454. referencedClasses: ["String"]
  1455. }),
  1456. globals.ProtoObject);
  1457. smalltalk.addMethod(
  1458. smalltalk.method({
  1459. selector: "yourself",
  1460. protocol: 'accessing',
  1461. fn: function (){
  1462. var self=this;
  1463. return self;
  1464. },
  1465. args: [],
  1466. source: "yourself\x0a\x09^ self",
  1467. messageSends: [],
  1468. referencedClasses: []
  1469. }),
  1470. globals.ProtoObject);
  1471. smalltalk.addMethod(
  1472. smalltalk.method({
  1473. selector: "~=",
  1474. protocol: 'comparing',
  1475. fn: function (anObject){
  1476. var self=this;
  1477. return smalltalk.withContext(function($ctx1) {
  1478. var $1;
  1479. $1=_st(self.__eq(anObject)).__eq(false);
  1480. $ctx1.sendIdx["="]=1;
  1481. return $1;
  1482. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},globals.ProtoObject)})},
  1483. args: ["anObject"],
  1484. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1485. messageSends: ["="],
  1486. referencedClasses: []
  1487. }),
  1488. globals.ProtoObject);
  1489. smalltalk.addMethod(
  1490. smalltalk.method({
  1491. selector: "~~",
  1492. protocol: 'comparing',
  1493. fn: function (anObject){
  1494. var self=this;
  1495. return smalltalk.withContext(function($ctx1) {
  1496. var $1;
  1497. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1498. return $1;
  1499. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},globals.ProtoObject)})},
  1500. args: ["anObject"],
  1501. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1502. messageSends: ["=", "=="],
  1503. referencedClasses: []
  1504. }),
  1505. globals.ProtoObject);
  1506. smalltalk.addMethod(
  1507. smalltalk.method({
  1508. selector: "heliosClass",
  1509. protocol: 'accessing',
  1510. fn: function (){
  1511. var self=this;
  1512. return "class";
  1513. },
  1514. args: [],
  1515. source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
  1516. messageSends: [],
  1517. referencedClasses: []
  1518. }),
  1519. globals.ProtoObject.klass);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "initialize",
  1523. protocol: 'initialization',
  1524. fn: function (){
  1525. var self=this;
  1526. return self},
  1527. args: [],
  1528. source: "initialize",
  1529. messageSends: [],
  1530. referencedClasses: []
  1531. }),
  1532. globals.ProtoObject.klass);
  1533. smalltalk.addClass('Object', globals.ProtoObject, [], 'Kernel-Objects');
  1534. 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.";
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "->",
  1538. protocol: 'converting',
  1539. fn: function (anObject){
  1540. var self=this;
  1541. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  1542. return smalltalk.withContext(function($ctx1) {
  1543. var $1;
  1544. $1=_st($Association())._key_value_(self,anObject);
  1545. return $1;
  1546. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},globals.Object)})},
  1547. args: ["anObject"],
  1548. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1549. messageSends: ["key:value:"],
  1550. referencedClasses: ["Association"]
  1551. }),
  1552. globals.Object);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "asJSON",
  1556. protocol: 'converting',
  1557. fn: function (){
  1558. var self=this;
  1559. var variables;
  1560. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1;
  1563. variables=_st($HashedCollection())._new();
  1564. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1565. return smalltalk.withContext(function($ctx2) {
  1566. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  1567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1568. $1=variables;
  1569. return $1;
  1570. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},globals.Object)})},
  1571. args: [],
  1572. 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",
  1573. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
  1574. referencedClasses: ["HashedCollection"]
  1575. }),
  1576. globals.Object);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "asJSONString",
  1580. protocol: 'converting',
  1581. fn: function (){
  1582. var self=this;
  1583. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $1;
  1586. $1=_st($JSON())._stringify_(self._asJSON());
  1587. return $1;
  1588. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},globals.Object)})},
  1589. args: [],
  1590. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1591. messageSends: ["stringify:", "asJSON"],
  1592. referencedClasses: ["JSON"]
  1593. }),
  1594. globals.Object);
  1595. smalltalk.addMethod(
  1596. smalltalk.method({
  1597. selector: "asJavascript",
  1598. protocol: 'converting',
  1599. fn: function (){
  1600. var self=this;
  1601. return smalltalk.withContext(function($ctx1) {
  1602. var $1;
  1603. $1=self._asString();
  1604. return $1;
  1605. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Object)})},
  1606. args: [],
  1607. source: "asJavascript\x0a\x09^ self asString",
  1608. messageSends: ["asString"],
  1609. referencedClasses: []
  1610. }),
  1611. globals.Object);
  1612. smalltalk.addMethod(
  1613. smalltalk.method({
  1614. selector: "basicAt:",
  1615. protocol: 'accessing',
  1616. fn: function (aString){
  1617. var self=this;
  1618. return smalltalk.withContext(function($ctx1) {
  1619. return self[aString];
  1620. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},globals.Object)})},
  1621. args: ["aString"],
  1622. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1623. messageSends: [],
  1624. referencedClasses: []
  1625. }),
  1626. globals.Object);
  1627. smalltalk.addMethod(
  1628. smalltalk.method({
  1629. selector: "basicAt:put:",
  1630. protocol: 'accessing',
  1631. fn: function (aString,anObject){
  1632. var self=this;
  1633. return smalltalk.withContext(function($ctx1) {
  1634. return self[aString] = anObject;
  1635. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},globals.Object)})},
  1636. args: ["aString", "anObject"],
  1637. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1638. messageSends: [],
  1639. referencedClasses: []
  1640. }),
  1641. globals.Object);
  1642. smalltalk.addMethod(
  1643. smalltalk.method({
  1644. selector: "basicDelete:",
  1645. protocol: 'accessing',
  1646. fn: function (aString){
  1647. var self=this;
  1648. return smalltalk.withContext(function($ctx1) {
  1649. delete self[aString]; return aString;
  1650. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},globals.Object)})},
  1651. args: ["aString"],
  1652. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1653. messageSends: [],
  1654. referencedClasses: []
  1655. }),
  1656. globals.Object);
  1657. smalltalk.addMethod(
  1658. smalltalk.method({
  1659. selector: "basicPerform:",
  1660. protocol: 'message handling',
  1661. fn: function (aString){
  1662. var self=this;
  1663. return smalltalk.withContext(function($ctx1) {
  1664. var $1;
  1665. $1=self._basicPerform_withArguments_(aString,[]);
  1666. return $1;
  1667. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},globals.Object)})},
  1668. args: ["aString"],
  1669. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1670. messageSends: ["basicPerform:withArguments:"],
  1671. referencedClasses: []
  1672. }),
  1673. globals.Object);
  1674. smalltalk.addMethod(
  1675. smalltalk.method({
  1676. selector: "basicPerform:withArguments:",
  1677. protocol: 'message handling',
  1678. fn: function (aString,aCollection){
  1679. var self=this;
  1680. return smalltalk.withContext(function($ctx1) {
  1681. return self[aString].apply(self, aCollection);;
  1682. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},globals.Object)})},
  1683. args: ["aString", "aCollection"],
  1684. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1685. messageSends: [],
  1686. referencedClasses: []
  1687. }),
  1688. globals.Object);
  1689. smalltalk.addMethod(
  1690. smalltalk.method({
  1691. selector: "copy",
  1692. protocol: 'copying',
  1693. fn: function (){
  1694. var self=this;
  1695. return smalltalk.withContext(function($ctx1) {
  1696. var $1;
  1697. $1=_st(self._shallowCopy())._postCopy();
  1698. return $1;
  1699. }, function($ctx1) {$ctx1.fill(self,"copy",{},globals.Object)})},
  1700. args: [],
  1701. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1702. messageSends: ["postCopy", "shallowCopy"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.Object);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "deepCopy",
  1709. protocol: 'copying',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var copy = self.klass._new();
  1714. Object.keys(self).forEach(function (i) {
  1715. if(/^@.+/.test(i)) {
  1716. copy[i] = self[i]._deepCopy();
  1717. }
  1718. });
  1719. return copy;
  1720. ;
  1721. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Object)})},
  1722. args: [],
  1723. 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>",
  1724. messageSends: [],
  1725. referencedClasses: []
  1726. }),
  1727. globals.Object);
  1728. smalltalk.addMethod(
  1729. smalltalk.method({
  1730. selector: "deprecatedAPI",
  1731. protocol: 'error handling',
  1732. fn: function (){
  1733. var self=this;
  1734. return smalltalk.withContext(function($ctx1) {
  1735. var $1,$6,$5,$4,$8,$7,$3,$2;
  1736. $1=console;
  1737. $6=smalltalk.getThisContext()._home();
  1738. $ctx1.sendIdx["home"]=1;
  1739. $5=_st($6)._asString();
  1740. $ctx1.sendIdx["asString"]=1;
  1741. $4=_st($5).__comma(" is deprecated! (in ");
  1742. $8=_st(smalltalk.getThisContext()._home())._home();
  1743. $ctx1.sendIdx["home"]=2;
  1744. $7=_st($8)._asString();
  1745. $3=_st($4).__comma($7);
  1746. $ctx1.sendIdx[","]=2;
  1747. $2=_st($3).__comma(")");
  1748. $ctx1.sendIdx[","]=1;
  1749. _st($1)._warn_($2);
  1750. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},globals.Object)})},
  1751. args: [],
  1752. 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, ')'",
  1753. messageSends: ["warn:", ",", "asString", "home"],
  1754. referencedClasses: []
  1755. }),
  1756. globals.Object);
  1757. smalltalk.addMethod(
  1758. smalltalk.method({
  1759. selector: "error:",
  1760. protocol: 'error handling',
  1761. fn: function (aString){
  1762. var self=this;
  1763. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1764. return smalltalk.withContext(function($ctx1) {
  1765. _st($Error())._signal_(aString);
  1766. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},globals.Object)})},
  1767. args: ["aString"],
  1768. source: "error: aString\x0a\x09Error signal: aString",
  1769. messageSends: ["signal:"],
  1770. referencedClasses: ["Error"]
  1771. }),
  1772. globals.Object);
  1773. smalltalk.addMethod(
  1774. smalltalk.method({
  1775. selector: "halt",
  1776. protocol: 'error handling',
  1777. fn: function (){
  1778. var self=this;
  1779. return smalltalk.withContext(function($ctx1) {
  1780. self._error_("Halt encountered");
  1781. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},globals.Object)})},
  1782. args: [],
  1783. source: "halt\x0a\x09self error: 'Halt encountered'",
  1784. messageSends: ["error:"],
  1785. referencedClasses: []
  1786. }),
  1787. globals.Object);
  1788. smalltalk.addMethod(
  1789. smalltalk.method({
  1790. selector: "ifNil:",
  1791. protocol: 'testing',
  1792. fn: function (aBlock){
  1793. var self=this;
  1794. return self;
  1795. },
  1796. args: ["aBlock"],
  1797. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1798. messageSends: [],
  1799. referencedClasses: []
  1800. }),
  1801. globals.Object);
  1802. smalltalk.addMethod(
  1803. smalltalk.method({
  1804. selector: "ifNil:ifNotNil:",
  1805. protocol: 'testing',
  1806. fn: function (aBlock,anotherBlock){
  1807. var self=this;
  1808. return smalltalk.withContext(function($ctx1) {
  1809. var $1;
  1810. $1=_st(anotherBlock)._value_(self);
  1811. return $1;
  1812. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  1813. args: ["aBlock", "anotherBlock"],
  1814. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1815. messageSends: ["value:"],
  1816. referencedClasses: []
  1817. }),
  1818. globals.Object);
  1819. smalltalk.addMethod(
  1820. smalltalk.method({
  1821. selector: "ifNotNil:",
  1822. protocol: 'testing',
  1823. fn: function (aBlock){
  1824. var self=this;
  1825. return smalltalk.withContext(function($ctx1) {
  1826. var $1;
  1827. $1=_st(aBlock)._value_(self);
  1828. return $1;
  1829. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},globals.Object)})},
  1830. args: ["aBlock"],
  1831. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1832. messageSends: ["value:"],
  1833. referencedClasses: []
  1834. }),
  1835. globals.Object);
  1836. smalltalk.addMethod(
  1837. smalltalk.method({
  1838. selector: "ifNotNil:ifNil:",
  1839. protocol: 'testing',
  1840. fn: function (aBlock,anotherBlock){
  1841. var self=this;
  1842. return smalltalk.withContext(function($ctx1) {
  1843. var $1;
  1844. $1=_st(aBlock)._value_(self);
  1845. return $1;
  1846. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  1847. args: ["aBlock", "anotherBlock"],
  1848. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1849. messageSends: ["value:"],
  1850. referencedClasses: []
  1851. }),
  1852. globals.Object);
  1853. smalltalk.addMethod(
  1854. smalltalk.method({
  1855. selector: "inspectOn:",
  1856. protocol: 'inspecting',
  1857. fn: function (anInspector){
  1858. var self=this;
  1859. var variables;
  1860. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1861. return smalltalk.withContext(function($ctx1) {
  1862. var $1;
  1863. variables=_st($Dictionary())._new();
  1864. _st(variables)._at_put_("#self",self);
  1865. $ctx1.sendIdx["at:put:"]=1;
  1866. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1867. return smalltalk.withContext(function($ctx2) {
  1868. return _st(variables)._at_put_(each,self._instVarAt_(each));
  1869. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1870. _st(anInspector)._setLabel_(self._printString());
  1871. $1=_st(anInspector)._setVariables_(variables);
  1872. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.Object)})},
  1873. args: ["anInspector"],
  1874. 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",
  1875. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"],
  1876. referencedClasses: ["Dictionary"]
  1877. }),
  1878. globals.Object);
  1879. smalltalk.addMethod(
  1880. smalltalk.method({
  1881. selector: "isBehavior",
  1882. protocol: 'testing',
  1883. fn: function (){
  1884. var self=this;
  1885. return false;
  1886. },
  1887. args: [],
  1888. source: "isBehavior\x0a\x09^ false",
  1889. messageSends: [],
  1890. referencedClasses: []
  1891. }),
  1892. globals.Object);
  1893. smalltalk.addMethod(
  1894. smalltalk.method({
  1895. selector: "isBoolean",
  1896. protocol: 'testing',
  1897. fn: function (){
  1898. var self=this;
  1899. return false;
  1900. },
  1901. args: [],
  1902. source: "isBoolean\x0a\x09^ false",
  1903. messageSends: [],
  1904. referencedClasses: []
  1905. }),
  1906. globals.Object);
  1907. smalltalk.addMethod(
  1908. smalltalk.method({
  1909. selector: "isClass",
  1910. protocol: 'testing',
  1911. fn: function (){
  1912. var self=this;
  1913. return false;
  1914. },
  1915. args: [],
  1916. source: "isClass\x0a\x09^ false",
  1917. messageSends: [],
  1918. referencedClasses: []
  1919. }),
  1920. globals.Object);
  1921. smalltalk.addMethod(
  1922. smalltalk.method({
  1923. selector: "isCompiledMethod",
  1924. protocol: 'testing',
  1925. fn: function (){
  1926. var self=this;
  1927. return false;
  1928. },
  1929. args: [],
  1930. source: "isCompiledMethod\x0a\x09^ false",
  1931. messageSends: [],
  1932. referencedClasses: []
  1933. }),
  1934. globals.Object);
  1935. smalltalk.addMethod(
  1936. smalltalk.method({
  1937. selector: "isImmutable",
  1938. protocol: 'testing',
  1939. fn: function (){
  1940. var self=this;
  1941. return false;
  1942. },
  1943. args: [],
  1944. source: "isImmutable\x0a\x09^ false",
  1945. messageSends: [],
  1946. referencedClasses: []
  1947. }),
  1948. globals.Object);
  1949. smalltalk.addMethod(
  1950. smalltalk.method({
  1951. selector: "isKindOf:",
  1952. protocol: 'testing',
  1953. fn: function (aClass){
  1954. var self=this;
  1955. return smalltalk.withContext(function($ctx1) {
  1956. var $2,$1;
  1957. $2=self._isMemberOf_(aClass);
  1958. if(smalltalk.assert($2)){
  1959. $1=true;
  1960. } else {
  1961. $1=_st(self._class())._inheritsFrom_(aClass);
  1962. };
  1963. return $1;
  1964. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.Object)})},
  1965. args: ["aClass"],
  1966. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1967. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
  1968. referencedClasses: []
  1969. }),
  1970. globals.Object);
  1971. smalltalk.addMethod(
  1972. smalltalk.method({
  1973. selector: "isMemberOf:",
  1974. protocol: 'testing',
  1975. fn: function (aClass){
  1976. var self=this;
  1977. return smalltalk.withContext(function($ctx1) {
  1978. var $1;
  1979. $1=_st(self._class()).__eq(aClass);
  1980. return $1;
  1981. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},globals.Object)})},
  1982. args: ["aClass"],
  1983. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  1984. messageSends: ["=", "class"],
  1985. referencedClasses: []
  1986. }),
  1987. globals.Object);
  1988. smalltalk.addMethod(
  1989. smalltalk.method({
  1990. selector: "isMetaclass",
  1991. protocol: 'testing',
  1992. fn: function (){
  1993. var self=this;
  1994. return false;
  1995. },
  1996. args: [],
  1997. source: "isMetaclass\x0a\x09^ false",
  1998. messageSends: [],
  1999. referencedClasses: []
  2000. }),
  2001. globals.Object);
  2002. smalltalk.addMethod(
  2003. smalltalk.method({
  2004. selector: "isNil",
  2005. protocol: 'testing',
  2006. fn: function (){
  2007. var self=this;
  2008. return false;
  2009. },
  2010. args: [],
  2011. source: "isNil\x0a\x09^ false",
  2012. messageSends: [],
  2013. referencedClasses: []
  2014. }),
  2015. globals.Object);
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "isNumber",
  2019. protocol: 'testing',
  2020. fn: function (){
  2021. var self=this;
  2022. return false;
  2023. },
  2024. args: [],
  2025. source: "isNumber\x0a\x09^ false",
  2026. messageSends: [],
  2027. referencedClasses: []
  2028. }),
  2029. globals.Object);
  2030. smalltalk.addMethod(
  2031. smalltalk.method({
  2032. selector: "isPackage",
  2033. protocol: 'testing',
  2034. fn: function (){
  2035. var self=this;
  2036. return false;
  2037. },
  2038. args: [],
  2039. source: "isPackage\x0a\x09^ false",
  2040. messageSends: [],
  2041. referencedClasses: []
  2042. }),
  2043. globals.Object);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "isParseFailure",
  2047. protocol: 'testing',
  2048. fn: function (){
  2049. var self=this;
  2050. return false;
  2051. },
  2052. args: [],
  2053. source: "isParseFailure\x0a\x09^ false",
  2054. messageSends: [],
  2055. referencedClasses: []
  2056. }),
  2057. globals.Object);
  2058. smalltalk.addMethod(
  2059. smalltalk.method({
  2060. selector: "isString",
  2061. protocol: 'testing',
  2062. fn: function (){
  2063. var self=this;
  2064. return false;
  2065. },
  2066. args: [],
  2067. source: "isString\x0a\x09^ false",
  2068. messageSends: [],
  2069. referencedClasses: []
  2070. }),
  2071. globals.Object);
  2072. smalltalk.addMethod(
  2073. smalltalk.method({
  2074. selector: "isSymbol",
  2075. protocol: 'testing',
  2076. fn: function (){
  2077. var self=this;
  2078. return false;
  2079. },
  2080. args: [],
  2081. source: "isSymbol\x0a\x09^ false",
  2082. messageSends: [],
  2083. referencedClasses: []
  2084. }),
  2085. globals.Object);
  2086. smalltalk.addMethod(
  2087. smalltalk.method({
  2088. selector: "notNil",
  2089. protocol: 'testing',
  2090. fn: function (){
  2091. var self=this;
  2092. return smalltalk.withContext(function($ctx1) {
  2093. var $1;
  2094. $1=_st(self._isNil())._not();
  2095. return $1;
  2096. }, function($ctx1) {$ctx1.fill(self,"notNil",{},globals.Object)})},
  2097. args: [],
  2098. source: "notNil\x0a\x09^ self isNil not",
  2099. messageSends: ["not", "isNil"],
  2100. referencedClasses: []
  2101. }),
  2102. globals.Object);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "postCopy",
  2106. protocol: 'copying',
  2107. fn: function (){
  2108. var self=this;
  2109. return self},
  2110. args: [],
  2111. source: "postCopy",
  2112. messageSends: [],
  2113. referencedClasses: []
  2114. }),
  2115. globals.Object);
  2116. smalltalk.addMethod(
  2117. smalltalk.method({
  2118. selector: "putOn:",
  2119. protocol: 'streaming',
  2120. fn: function (aStream){
  2121. var self=this;
  2122. return smalltalk.withContext(function($ctx1) {
  2123. _st(aStream)._nextPut_(self);
  2124. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Object)})},
  2125. args: ["aStream"],
  2126. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2127. messageSends: ["nextPut:"],
  2128. referencedClasses: []
  2129. }),
  2130. globals.Object);
  2131. smalltalk.addMethod(
  2132. smalltalk.method({
  2133. selector: "respondsTo:",
  2134. protocol: 'testing',
  2135. fn: function (aSelector){
  2136. var self=this;
  2137. return smalltalk.withContext(function($ctx1) {
  2138. var $1;
  2139. $1=_st(self._class())._canUnderstand_(aSelector);
  2140. return $1;
  2141. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},globals.Object)})},
  2142. args: ["aSelector"],
  2143. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2144. messageSends: ["canUnderstand:", "class"],
  2145. referencedClasses: []
  2146. }),
  2147. globals.Object);
  2148. smalltalk.addMethod(
  2149. smalltalk.method({
  2150. selector: "shallowCopy",
  2151. protocol: 'copying',
  2152. fn: function (){
  2153. var self=this;
  2154. return smalltalk.withContext(function($ctx1) {
  2155. var copy = self.klass._new();
  2156. Object.keys(self).forEach(function(i) {
  2157. if(/^@.+/.test(i)) {
  2158. copy[i] = self[i];
  2159. }
  2160. });
  2161. return copy;
  2162. ;
  2163. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.Object)})},
  2164. args: [],
  2165. 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>",
  2166. messageSends: [],
  2167. referencedClasses: []
  2168. }),
  2169. globals.Object);
  2170. smalltalk.addMethod(
  2171. smalltalk.method({
  2172. selector: "shouldNotImplement",
  2173. protocol: 'error handling',
  2174. fn: function (){
  2175. var self=this;
  2176. return smalltalk.withContext(function($ctx1) {
  2177. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  2178. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},globals.Object)})},
  2179. args: [],
  2180. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2181. messageSends: ["error:", ",", "name", "class"],
  2182. referencedClasses: []
  2183. }),
  2184. globals.Object);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "size",
  2188. protocol: 'accessing',
  2189. fn: function (){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. self._error_("Object not indexable");
  2193. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Object)})},
  2194. args: [],
  2195. source: "size\x0a\x09self error: 'Object not indexable'",
  2196. messageSends: ["error:"],
  2197. referencedClasses: []
  2198. }),
  2199. globals.Object);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "subclassResponsibility",
  2203. protocol: 'error handling',
  2204. fn: function (){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. self._error_("This method is a responsibility of a subclass");
  2208. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},globals.Object)})},
  2209. args: [],
  2210. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2211. messageSends: ["error:"],
  2212. referencedClasses: []
  2213. }),
  2214. globals.Object);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "throw:",
  2218. protocol: 'error handling',
  2219. fn: function (anObject){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. throw anObject ;
  2223. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},globals.Object)})},
  2224. args: ["anObject"],
  2225. source: "throw: anObject\x0a\x09< throw anObject >",
  2226. messageSends: [],
  2227. referencedClasses: []
  2228. }),
  2229. globals.Object);
  2230. smalltalk.addMethod(
  2231. smalltalk.method({
  2232. selector: "try:catch:",
  2233. protocol: 'error handling',
  2234. fn: function (aBlock,anotherBlock){
  2235. var self=this;
  2236. return smalltalk.withContext(function($ctx1) {
  2237. try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)};
  2238. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  2239. args: ["aBlock", "anotherBlock"],
  2240. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)}>",
  2241. messageSends: [],
  2242. referencedClasses: []
  2243. }),
  2244. globals.Object);
  2245. smalltalk.addMethod(
  2246. smalltalk.method({
  2247. selector: "value",
  2248. protocol: 'accessing',
  2249. fn: function (){
  2250. var self=this;
  2251. return smalltalk.withContext(function($ctx1) {
  2252. return self.valueOf();
  2253. return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.Object)})},
  2254. args: [],
  2255. source: "value\x0a\x09<return self.valueOf()>",
  2256. messageSends: [],
  2257. referencedClasses: []
  2258. }),
  2259. globals.Object);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "accessorProtocolWith:",
  2263. protocol: 'helios',
  2264. fn: function (aGenerator){
  2265. var self=this;
  2266. return smalltalk.withContext(function($ctx1) {
  2267. _st(aGenerator)._accessorProtocolForObject();
  2268. return self}, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2269. args: ["aGenerator"],
  2270. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2271. messageSends: ["accessorProtocolForObject"],
  2272. referencedClasses: []
  2273. }),
  2274. globals.Object.klass);
  2275. smalltalk.addMethod(
  2276. smalltalk.method({
  2277. selector: "accessorsSourceCodesWith:",
  2278. protocol: 'helios',
  2279. fn: function (aGenerator){
  2280. var self=this;
  2281. return smalltalk.withContext(function($ctx1) {
  2282. _st(aGenerator)._accessorsForObject();
  2283. return self}, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2284. args: ["aGenerator"],
  2285. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2286. messageSends: ["accessorsForObject"],
  2287. referencedClasses: []
  2288. }),
  2289. globals.Object.klass);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "heliosClass",
  2293. protocol: 'helios',
  2294. fn: function (){
  2295. var self=this;
  2296. return "class";
  2297. },
  2298. args: [],
  2299. source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
  2300. messageSends: [],
  2301. referencedClasses: []
  2302. }),
  2303. globals.Object.klass);
  2304. smalltalk.addMethod(
  2305. smalltalk.method({
  2306. selector: "initialize",
  2307. protocol: 'initialization',
  2308. fn: function (){
  2309. var self=this;
  2310. return self},
  2311. args: [],
  2312. source: "initialize\x0a\x09\x22no op\x22",
  2313. messageSends: [],
  2314. referencedClasses: []
  2315. }),
  2316. globals.Object.klass);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "initializeProtocolWith:",
  2320. protocol: 'helios',
  2321. fn: function (aGenerator){
  2322. var self=this;
  2323. return smalltalk.withContext(function($ctx1) {
  2324. _st(aGenerator)._initializeProtocolForObject();
  2325. return self}, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2326. args: ["aGenerator"],
  2327. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2328. messageSends: ["initializeProtocolForObject"],
  2329. referencedClasses: []
  2330. }),
  2331. globals.Object.klass);
  2332. smalltalk.addMethod(
  2333. smalltalk.method({
  2334. selector: "initializeSourceCodesWith:",
  2335. protocol: 'helios',
  2336. fn: function (aGenerator){
  2337. var self=this;
  2338. return smalltalk.withContext(function($ctx1) {
  2339. _st(aGenerator)._initializeForObject();
  2340. return self}, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2341. args: ["aGenerator"],
  2342. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2343. messageSends: ["initializeForObject"],
  2344. referencedClasses: []
  2345. }),
  2346. globals.Object.klass);
  2347. smalltalk.addClass('Boolean', globals.Object, [], 'Kernel-Objects');
  2348. 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: [ ... ]";
  2349. smalltalk.addMethod(
  2350. smalltalk.method({
  2351. selector: "&",
  2352. protocol: 'controlling',
  2353. fn: function (aBoolean){
  2354. var self=this;
  2355. return smalltalk.withContext(function($ctx1) {
  2356. if(self == true) {
  2357. return aBoolean;
  2358. } else {
  2359. return false;
  2360. }
  2361. ;
  2362. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},globals.Boolean)})},
  2363. args: ["aBoolean"],
  2364. 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>",
  2365. messageSends: [],
  2366. referencedClasses: []
  2367. }),
  2368. globals.Boolean);
  2369. smalltalk.addMethod(
  2370. smalltalk.method({
  2371. selector: "=",
  2372. protocol: 'comparing',
  2373. fn: function (aBoolean){
  2374. var self=this;
  2375. return smalltalk.withContext(function($ctx1) {
  2376. return aBoolean != null &&
  2377. typeof aBoolean._isBoolean === "function" &&
  2378. aBoolean._isBoolean() &&
  2379. Boolean(self == true) == aBoolean
  2380. ;
  2381. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},globals.Boolean)})},
  2382. args: ["aBoolean"],
  2383. source: "= aBoolean\x0a\x09<\x0a\x09\x09return aBoolean != null &&\x0a\x09\x09\x09typeof aBoolean._isBoolean === \x22function\x22 &&\x0a\x09\x09\x09aBoolean._isBoolean() &&\x0a\x09\x09\x09Boolean(self == true) == aBoolean\x0a\x09>",
  2384. messageSends: [],
  2385. referencedClasses: []
  2386. }),
  2387. globals.Boolean);
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: "==",
  2391. protocol: 'comparing',
  2392. fn: function (aBoolean){
  2393. var self=this;
  2394. return smalltalk.withContext(function($ctx1) {
  2395. var $1;
  2396. $1=self.__eq(aBoolean);
  2397. return $1;
  2398. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},globals.Boolean)})},
  2399. args: ["aBoolean"],
  2400. source: "== aBoolean\x0a\x09^ self = aBoolean",
  2401. messageSends: ["="],
  2402. referencedClasses: []
  2403. }),
  2404. globals.Boolean);
  2405. smalltalk.addMethod(
  2406. smalltalk.method({
  2407. selector: "and:",
  2408. protocol: 'controlling',
  2409. fn: function (aBlock){
  2410. var self=this;
  2411. return smalltalk.withContext(function($ctx1) {
  2412. var $2,$1;
  2413. $2=self.__eq(true);
  2414. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2415. return false;
  2416. }));
  2417. return $1;
  2418. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},globals.Boolean)})},
  2419. args: ["aBlock"],
  2420. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2421. messageSends: ["ifTrue:ifFalse:", "="],
  2422. referencedClasses: []
  2423. }),
  2424. globals.Boolean);
  2425. smalltalk.addMethod(
  2426. smalltalk.method({
  2427. selector: "asBit",
  2428. protocol: 'converting',
  2429. fn: function (){
  2430. var self=this;
  2431. return smalltalk.withContext(function($ctx1) {
  2432. var $1;
  2433. if(smalltalk.assert(self)){
  2434. $1=(1);
  2435. } else {
  2436. $1=(0);
  2437. };
  2438. return $1;
  2439. }, function($ctx1) {$ctx1.fill(self,"asBit",{},globals.Boolean)})},
  2440. args: [],
  2441. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2442. messageSends: ["ifTrue:ifFalse:"],
  2443. referencedClasses: []
  2444. }),
  2445. globals.Boolean);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "asJSON",
  2449. protocol: 'converting',
  2450. fn: function (){
  2451. var self=this;
  2452. return self;
  2453. },
  2454. args: [],
  2455. source: "asJSON\x0a\x09^ self",
  2456. messageSends: [],
  2457. referencedClasses: []
  2458. }),
  2459. globals.Boolean);
  2460. smalltalk.addMethod(
  2461. smalltalk.method({
  2462. selector: "asString",
  2463. protocol: 'converting',
  2464. fn: function (){
  2465. var self=this;
  2466. return smalltalk.withContext(function($ctx1) {
  2467. return self.toString() ;
  2468. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Boolean)})},
  2469. args: [],
  2470. source: "asString\x0a\x09< return self.toString() >",
  2471. messageSends: [],
  2472. referencedClasses: []
  2473. }),
  2474. globals.Boolean);
  2475. smalltalk.addMethod(
  2476. smalltalk.method({
  2477. selector: "deepCopy",
  2478. protocol: 'copying',
  2479. fn: function (){
  2480. var self=this;
  2481. return self;
  2482. },
  2483. args: [],
  2484. source: "deepCopy\x0a\x09^ self",
  2485. messageSends: [],
  2486. referencedClasses: []
  2487. }),
  2488. globals.Boolean);
  2489. smalltalk.addMethod(
  2490. smalltalk.method({
  2491. selector: "ifFalse:",
  2492. protocol: 'controlling',
  2493. fn: function (aBlock){
  2494. var self=this;
  2495. return smalltalk.withContext(function($ctx1) {
  2496. var $1;
  2497. $1=self._ifTrue_ifFalse_((function(){
  2498. }),aBlock);
  2499. return $1;
  2500. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},globals.Boolean)})},
  2501. args: ["aBlock"],
  2502. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2503. messageSends: ["ifTrue:ifFalse:"],
  2504. referencedClasses: []
  2505. }),
  2506. globals.Boolean);
  2507. smalltalk.addMethod(
  2508. smalltalk.method({
  2509. selector: "ifFalse:ifTrue:",
  2510. protocol: 'controlling',
  2511. fn: function (aBlock,anotherBlock){
  2512. var self=this;
  2513. return smalltalk.withContext(function($ctx1) {
  2514. var $1;
  2515. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2516. return $1;
  2517. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
  2518. args: ["aBlock", "anotherBlock"],
  2519. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2520. messageSends: ["ifTrue:ifFalse:"],
  2521. referencedClasses: []
  2522. }),
  2523. globals.Boolean);
  2524. smalltalk.addMethod(
  2525. smalltalk.method({
  2526. selector: "ifTrue:",
  2527. protocol: 'controlling',
  2528. fn: function (aBlock){
  2529. var self=this;
  2530. return smalltalk.withContext(function($ctx1) {
  2531. var $1;
  2532. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2533. }));
  2534. return $1;
  2535. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},globals.Boolean)})},
  2536. args: ["aBlock"],
  2537. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2538. messageSends: ["ifTrue:ifFalse:"],
  2539. referencedClasses: []
  2540. }),
  2541. globals.Boolean);
  2542. smalltalk.addMethod(
  2543. smalltalk.method({
  2544. selector: "ifTrue:ifFalse:",
  2545. protocol: 'controlling',
  2546. fn: function (aBlock,anotherBlock){
  2547. var self=this;
  2548. return smalltalk.withContext(function($ctx1) {
  2549. if(self == true) {
  2550. return aBlock._value();
  2551. } else {
  2552. return anotherBlock._value();
  2553. }
  2554. ;
  2555. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
  2556. args: ["aBlock", "anotherBlock"],
  2557. 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>",
  2558. messageSends: [],
  2559. referencedClasses: []
  2560. }),
  2561. globals.Boolean);
  2562. smalltalk.addMethod(
  2563. smalltalk.method({
  2564. selector: "isBoolean",
  2565. protocol: 'testing',
  2566. fn: function (){
  2567. var self=this;
  2568. return true;
  2569. },
  2570. args: [],
  2571. source: "isBoolean\x0a\x09^ true",
  2572. messageSends: [],
  2573. referencedClasses: []
  2574. }),
  2575. globals.Boolean);
  2576. smalltalk.addMethod(
  2577. smalltalk.method({
  2578. selector: "isImmutable",
  2579. protocol: 'testing',
  2580. fn: function (){
  2581. var self=this;
  2582. return true;
  2583. },
  2584. args: [],
  2585. source: "isImmutable\x0a\x09^ true",
  2586. messageSends: [],
  2587. referencedClasses: []
  2588. }),
  2589. globals.Boolean);
  2590. smalltalk.addMethod(
  2591. smalltalk.method({
  2592. selector: "not",
  2593. protocol: 'controlling',
  2594. fn: function (){
  2595. var self=this;
  2596. return smalltalk.withContext(function($ctx1) {
  2597. var $1;
  2598. $1=self.__eq(false);
  2599. return $1;
  2600. }, function($ctx1) {$ctx1.fill(self,"not",{},globals.Boolean)})},
  2601. args: [],
  2602. source: "not\x0a\x09^ self = false",
  2603. messageSends: ["="],
  2604. referencedClasses: []
  2605. }),
  2606. globals.Boolean);
  2607. smalltalk.addMethod(
  2608. smalltalk.method({
  2609. selector: "or:",
  2610. protocol: 'controlling',
  2611. fn: function (aBlock){
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) {
  2614. var $2,$1;
  2615. $2=self.__eq(true);
  2616. $1=_st($2)._ifTrue_ifFalse_((function(){
  2617. return true;
  2618. }),aBlock);
  2619. return $1;
  2620. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},globals.Boolean)})},
  2621. args: ["aBlock"],
  2622. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2623. messageSends: ["ifTrue:ifFalse:", "="],
  2624. referencedClasses: []
  2625. }),
  2626. globals.Boolean);
  2627. smalltalk.addMethod(
  2628. smalltalk.method({
  2629. selector: "printOn:",
  2630. protocol: 'printing',
  2631. fn: function (aStream){
  2632. var self=this;
  2633. return smalltalk.withContext(function($ctx1) {
  2634. _st(aStream)._nextPutAll_(self._asString());
  2635. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Boolean)})},
  2636. args: ["aStream"],
  2637. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2638. messageSends: ["nextPutAll:", "asString"],
  2639. referencedClasses: []
  2640. }),
  2641. globals.Boolean);
  2642. smalltalk.addMethod(
  2643. smalltalk.method({
  2644. selector: "shallowCopy",
  2645. protocol: 'copying',
  2646. fn: function (){
  2647. var self=this;
  2648. return self;
  2649. },
  2650. args: [],
  2651. source: "shallowCopy\x0a\x09^ self",
  2652. messageSends: [],
  2653. referencedClasses: []
  2654. }),
  2655. globals.Boolean);
  2656. smalltalk.addMethod(
  2657. smalltalk.method({
  2658. selector: "|",
  2659. protocol: 'controlling',
  2660. fn: function (aBoolean){
  2661. var self=this;
  2662. return smalltalk.withContext(function($ctx1) {
  2663. if(self == true) {
  2664. return true;
  2665. } else {
  2666. return aBoolean;
  2667. }
  2668. ;
  2669. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},globals.Boolean)})},
  2670. args: ["aBoolean"],
  2671. 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>",
  2672. messageSends: [],
  2673. referencedClasses: []
  2674. }),
  2675. globals.Boolean);
  2676. smalltalk.addClass('Date', globals.Object, [], 'Kernel-Objects');
  2677. 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.).";
  2678. smalltalk.addMethod(
  2679. smalltalk.method({
  2680. selector: "+",
  2681. protocol: 'arithmetic',
  2682. fn: function (aDate){
  2683. var self=this;
  2684. return smalltalk.withContext(function($ctx1) {
  2685. return self + aDate;
  2686. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},globals.Date)})},
  2687. args: ["aDate"],
  2688. source: "+ aDate\x0a\x09<return self + aDate>",
  2689. messageSends: [],
  2690. referencedClasses: []
  2691. }),
  2692. globals.Date);
  2693. smalltalk.addMethod(
  2694. smalltalk.method({
  2695. selector: "-",
  2696. protocol: 'arithmetic',
  2697. fn: function (aDate){
  2698. var self=this;
  2699. return smalltalk.withContext(function($ctx1) {
  2700. return self - aDate;
  2701. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},globals.Date)})},
  2702. args: ["aDate"],
  2703. source: "- aDate\x0a\x09<return self - aDate>",
  2704. messageSends: [],
  2705. referencedClasses: []
  2706. }),
  2707. globals.Date);
  2708. smalltalk.addMethod(
  2709. smalltalk.method({
  2710. selector: "<",
  2711. protocol: 'comparing',
  2712. fn: function (aDate){
  2713. var self=this;
  2714. return smalltalk.withContext(function($ctx1) {
  2715. return self < aDate;
  2716. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},globals.Date)})},
  2717. args: ["aDate"],
  2718. source: "< aDate\x0a\x09<return self < aDate>",
  2719. messageSends: [],
  2720. referencedClasses: []
  2721. }),
  2722. globals.Date);
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "<=",
  2726. protocol: 'comparing',
  2727. fn: function (aDate){
  2728. var self=this;
  2729. return smalltalk.withContext(function($ctx1) {
  2730. return self <= aDate;
  2731. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},globals.Date)})},
  2732. args: ["aDate"],
  2733. source: "<= aDate\x0a\x09<return self <= aDate>",
  2734. messageSends: [],
  2735. referencedClasses: []
  2736. }),
  2737. globals.Date);
  2738. smalltalk.addMethod(
  2739. smalltalk.method({
  2740. selector: ">",
  2741. protocol: 'comparing',
  2742. fn: function (aDate){
  2743. var self=this;
  2744. return smalltalk.withContext(function($ctx1) {
  2745. return self > aDate;
  2746. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},globals.Date)})},
  2747. args: ["aDate"],
  2748. source: "> aDate\x0a\x09<return self >> aDate>",
  2749. messageSends: [],
  2750. referencedClasses: []
  2751. }),
  2752. globals.Date);
  2753. smalltalk.addMethod(
  2754. smalltalk.method({
  2755. selector: ">=",
  2756. protocol: 'comparing',
  2757. fn: function (aDate){
  2758. var self=this;
  2759. return smalltalk.withContext(function($ctx1) {
  2760. return self >= aDate;
  2761. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},globals.Date)})},
  2762. args: ["aDate"],
  2763. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2764. messageSends: [],
  2765. referencedClasses: []
  2766. }),
  2767. globals.Date);
  2768. smalltalk.addMethod(
  2769. smalltalk.method({
  2770. selector: "asDateString",
  2771. protocol: 'converting',
  2772. fn: function (){
  2773. var self=this;
  2774. return smalltalk.withContext(function($ctx1) {
  2775. return self.toDateString();
  2776. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},globals.Date)})},
  2777. args: [],
  2778. source: "asDateString\x0a\x09<return self.toDateString()>",
  2779. messageSends: [],
  2780. referencedClasses: []
  2781. }),
  2782. globals.Date);
  2783. smalltalk.addMethod(
  2784. smalltalk.method({
  2785. selector: "asLocaleString",
  2786. protocol: 'converting',
  2787. fn: function (){
  2788. var self=this;
  2789. return smalltalk.withContext(function($ctx1) {
  2790. return self.toLocaleString();
  2791. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},globals.Date)})},
  2792. args: [],
  2793. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2794. messageSends: [],
  2795. referencedClasses: []
  2796. }),
  2797. globals.Date);
  2798. smalltalk.addMethod(
  2799. smalltalk.method({
  2800. selector: "asMilliseconds",
  2801. protocol: 'converting',
  2802. fn: function (){
  2803. var self=this;
  2804. return smalltalk.withContext(function($ctx1) {
  2805. var $1;
  2806. $1=self._time();
  2807. return $1;
  2808. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},globals.Date)})},
  2809. args: [],
  2810. source: "asMilliseconds\x0a\x09^ self time",
  2811. messageSends: ["time"],
  2812. referencedClasses: []
  2813. }),
  2814. globals.Date);
  2815. smalltalk.addMethod(
  2816. smalltalk.method({
  2817. selector: "asNumber",
  2818. protocol: 'converting',
  2819. fn: function (){
  2820. var self=this;
  2821. return smalltalk.withContext(function($ctx1) {
  2822. var $1;
  2823. $1=self._asMilliseconds();
  2824. return $1;
  2825. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.Date)})},
  2826. args: [],
  2827. source: "asNumber\x0a\x09^ self asMilliseconds",
  2828. messageSends: ["asMilliseconds"],
  2829. referencedClasses: []
  2830. }),
  2831. globals.Date);
  2832. smalltalk.addMethod(
  2833. smalltalk.method({
  2834. selector: "asString",
  2835. protocol: 'converting',
  2836. fn: function (){
  2837. var self=this;
  2838. return smalltalk.withContext(function($ctx1) {
  2839. return self.toString();
  2840. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Date)})},
  2841. args: [],
  2842. source: "asString\x0a\x09<return self.toString()>",
  2843. messageSends: [],
  2844. referencedClasses: []
  2845. }),
  2846. globals.Date);
  2847. smalltalk.addMethod(
  2848. smalltalk.method({
  2849. selector: "asTimeString",
  2850. protocol: 'converting',
  2851. fn: function (){
  2852. var self=this;
  2853. return smalltalk.withContext(function($ctx1) {
  2854. return self.toTimeString();
  2855. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},globals.Date)})},
  2856. args: [],
  2857. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2858. messageSends: [],
  2859. referencedClasses: []
  2860. }),
  2861. globals.Date);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "day",
  2865. protocol: 'accessing',
  2866. fn: function (){
  2867. var self=this;
  2868. return smalltalk.withContext(function($ctx1) {
  2869. var $1;
  2870. $1=self._dayOfWeek();
  2871. return $1;
  2872. }, function($ctx1) {$ctx1.fill(self,"day",{},globals.Date)})},
  2873. args: [],
  2874. source: "day\x0a\x09^ self dayOfWeek",
  2875. messageSends: ["dayOfWeek"],
  2876. referencedClasses: []
  2877. }),
  2878. globals.Date);
  2879. smalltalk.addMethod(
  2880. smalltalk.method({
  2881. selector: "day:",
  2882. protocol: 'accessing',
  2883. fn: function (aNumber){
  2884. var self=this;
  2885. return smalltalk.withContext(function($ctx1) {
  2886. self._dayOfWeek_(aNumber);
  2887. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},globals.Date)})},
  2888. args: ["aNumber"],
  2889. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2890. messageSends: ["dayOfWeek:"],
  2891. referencedClasses: []
  2892. }),
  2893. globals.Date);
  2894. smalltalk.addMethod(
  2895. smalltalk.method({
  2896. selector: "dayOfMonth",
  2897. protocol: 'accessing',
  2898. fn: function (){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. return self.getDate();
  2902. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},globals.Date)})},
  2903. args: [],
  2904. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2905. messageSends: [],
  2906. referencedClasses: []
  2907. }),
  2908. globals.Date);
  2909. smalltalk.addMethod(
  2910. smalltalk.method({
  2911. selector: "dayOfMonth:",
  2912. protocol: 'accessing',
  2913. fn: function (aNumber){
  2914. var self=this;
  2915. return smalltalk.withContext(function($ctx1) {
  2916. self.setDate(aNumber);
  2917. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},globals.Date)})},
  2918. args: ["aNumber"],
  2919. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2920. messageSends: [],
  2921. referencedClasses: []
  2922. }),
  2923. globals.Date);
  2924. smalltalk.addMethod(
  2925. smalltalk.method({
  2926. selector: "dayOfWeek",
  2927. protocol: 'accessing',
  2928. fn: function (){
  2929. var self=this;
  2930. return smalltalk.withContext(function($ctx1) {
  2931. return self.getDay() + 1;
  2932. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},globals.Date)})},
  2933. args: [],
  2934. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2935. messageSends: [],
  2936. referencedClasses: []
  2937. }),
  2938. globals.Date);
  2939. smalltalk.addMethod(
  2940. smalltalk.method({
  2941. selector: "dayOfWeek:",
  2942. protocol: 'accessing',
  2943. fn: function (aNumber){
  2944. var self=this;
  2945. return smalltalk.withContext(function($ctx1) {
  2946. return self.setDay(aNumber - 1);
  2947. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},globals.Date)})},
  2948. args: ["aNumber"],
  2949. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2950. messageSends: [],
  2951. referencedClasses: []
  2952. }),
  2953. globals.Date);
  2954. smalltalk.addMethod(
  2955. smalltalk.method({
  2956. selector: "hours",
  2957. protocol: 'accessing',
  2958. fn: function (){
  2959. var self=this;
  2960. return smalltalk.withContext(function($ctx1) {
  2961. return self.getHours();
  2962. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},globals.Date)})},
  2963. args: [],
  2964. source: "hours\x0a\x09<return self.getHours()>",
  2965. messageSends: [],
  2966. referencedClasses: []
  2967. }),
  2968. globals.Date);
  2969. smalltalk.addMethod(
  2970. smalltalk.method({
  2971. selector: "hours:",
  2972. protocol: 'accessing',
  2973. fn: function (aNumber){
  2974. var self=this;
  2975. return smalltalk.withContext(function($ctx1) {
  2976. self.setHours(aNumber);
  2977. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},globals.Date)})},
  2978. args: ["aNumber"],
  2979. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2980. messageSends: [],
  2981. referencedClasses: []
  2982. }),
  2983. globals.Date);
  2984. smalltalk.addMethod(
  2985. smalltalk.method({
  2986. selector: "milliseconds",
  2987. protocol: 'accessing',
  2988. fn: function (){
  2989. var self=this;
  2990. return smalltalk.withContext(function($ctx1) {
  2991. return self.getMilliseconds();
  2992. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},globals.Date)})},
  2993. args: [],
  2994. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2995. messageSends: [],
  2996. referencedClasses: []
  2997. }),
  2998. globals.Date);
  2999. smalltalk.addMethod(
  3000. smalltalk.method({
  3001. selector: "milliseconds:",
  3002. protocol: 'accessing',
  3003. fn: function (aNumber){
  3004. var self=this;
  3005. return smalltalk.withContext(function($ctx1) {
  3006. self.setMilliseconds(aNumber);
  3007. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},globals.Date)})},
  3008. args: ["aNumber"],
  3009. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3010. messageSends: [],
  3011. referencedClasses: []
  3012. }),
  3013. globals.Date);
  3014. smalltalk.addMethod(
  3015. smalltalk.method({
  3016. selector: "minutes",
  3017. protocol: 'accessing',
  3018. fn: function (){
  3019. var self=this;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. return self.getMinutes();
  3022. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},globals.Date)})},
  3023. args: [],
  3024. source: "minutes\x0a\x09<return self.getMinutes()>",
  3025. messageSends: [],
  3026. referencedClasses: []
  3027. }),
  3028. globals.Date);
  3029. smalltalk.addMethod(
  3030. smalltalk.method({
  3031. selector: "minutes:",
  3032. protocol: 'accessing',
  3033. fn: function (aNumber){
  3034. var self=this;
  3035. return smalltalk.withContext(function($ctx1) {
  3036. self.setMinutes(aNumber);
  3037. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},globals.Date)})},
  3038. args: ["aNumber"],
  3039. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3040. messageSends: [],
  3041. referencedClasses: []
  3042. }),
  3043. globals.Date);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "month",
  3047. protocol: 'accessing',
  3048. fn: function (){
  3049. var self=this;
  3050. return smalltalk.withContext(function($ctx1) {
  3051. return self.getMonth() + 1;
  3052. return self}, function($ctx1) {$ctx1.fill(self,"month",{},globals.Date)})},
  3053. args: [],
  3054. source: "month\x0a\x09<return self.getMonth() + 1>",
  3055. messageSends: [],
  3056. referencedClasses: []
  3057. }),
  3058. globals.Date);
  3059. smalltalk.addMethod(
  3060. smalltalk.method({
  3061. selector: "month:",
  3062. protocol: 'accessing',
  3063. fn: function (aNumber){
  3064. var self=this;
  3065. return smalltalk.withContext(function($ctx1) {
  3066. self.setMonth(aNumber - 1);
  3067. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},globals.Date)})},
  3068. args: ["aNumber"],
  3069. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3070. messageSends: [],
  3071. referencedClasses: []
  3072. }),
  3073. globals.Date);
  3074. smalltalk.addMethod(
  3075. smalltalk.method({
  3076. selector: "printOn:",
  3077. protocol: 'printing',
  3078. fn: function (aStream){
  3079. var self=this;
  3080. return smalltalk.withContext(function($ctx1) {
  3081. _st(aStream)._nextPutAll_(self._asString());
  3082. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Date)})},
  3083. args: ["aStream"],
  3084. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3085. messageSends: ["nextPutAll:", "asString"],
  3086. referencedClasses: []
  3087. }),
  3088. globals.Date);
  3089. smalltalk.addMethod(
  3090. smalltalk.method({
  3091. selector: "seconds",
  3092. protocol: 'accessing',
  3093. fn: function (){
  3094. var self=this;
  3095. return smalltalk.withContext(function($ctx1) {
  3096. return self.getSeconds();
  3097. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},globals.Date)})},
  3098. args: [],
  3099. source: "seconds\x0a\x09<return self.getSeconds()>",
  3100. messageSends: [],
  3101. referencedClasses: []
  3102. }),
  3103. globals.Date);
  3104. smalltalk.addMethod(
  3105. smalltalk.method({
  3106. selector: "seconds:",
  3107. protocol: 'accessing',
  3108. fn: function (aNumber){
  3109. var self=this;
  3110. return smalltalk.withContext(function($ctx1) {
  3111. self.setSeconds(aNumber);
  3112. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},globals.Date)})},
  3113. args: ["aNumber"],
  3114. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3115. messageSends: [],
  3116. referencedClasses: []
  3117. }),
  3118. globals.Date);
  3119. smalltalk.addMethod(
  3120. smalltalk.method({
  3121. selector: "time",
  3122. protocol: 'accessing',
  3123. fn: function (){
  3124. var self=this;
  3125. return smalltalk.withContext(function($ctx1) {
  3126. return self.getTime();
  3127. return self}, function($ctx1) {$ctx1.fill(self,"time",{},globals.Date)})},
  3128. args: [],
  3129. source: "time\x0a\x09<return self.getTime()>",
  3130. messageSends: [],
  3131. referencedClasses: []
  3132. }),
  3133. globals.Date);
  3134. smalltalk.addMethod(
  3135. smalltalk.method({
  3136. selector: "time:",
  3137. protocol: 'accessing',
  3138. fn: function (aNumber){
  3139. var self=this;
  3140. return smalltalk.withContext(function($ctx1) {
  3141. self.setTime(aNumber);
  3142. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},globals.Date)})},
  3143. args: ["aNumber"],
  3144. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3145. messageSends: [],
  3146. referencedClasses: []
  3147. }),
  3148. globals.Date);
  3149. smalltalk.addMethod(
  3150. smalltalk.method({
  3151. selector: "year",
  3152. protocol: 'accessing',
  3153. fn: function (){
  3154. var self=this;
  3155. return smalltalk.withContext(function($ctx1) {
  3156. return self.getFullYear();
  3157. return self}, function($ctx1) {$ctx1.fill(self,"year",{},globals.Date)})},
  3158. args: [],
  3159. source: "year\x0a\x09<return self.getFullYear()>",
  3160. messageSends: [],
  3161. referencedClasses: []
  3162. }),
  3163. globals.Date);
  3164. smalltalk.addMethod(
  3165. smalltalk.method({
  3166. selector: "year:",
  3167. protocol: 'accessing',
  3168. fn: function (aNumber){
  3169. var self=this;
  3170. return smalltalk.withContext(function($ctx1) {
  3171. self.setFullYear(aNumber);
  3172. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},globals.Date)})},
  3173. args: ["aNumber"],
  3174. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3175. messageSends: [],
  3176. referencedClasses: []
  3177. }),
  3178. globals.Date);
  3179. smalltalk.addMethod(
  3180. smalltalk.method({
  3181. selector: "fromMilliseconds:",
  3182. protocol: 'instance creation',
  3183. fn: function (aNumber){
  3184. var self=this;
  3185. return smalltalk.withContext(function($ctx1) {
  3186. var $1;
  3187. $1=self._new_(aNumber);
  3188. return $1;
  3189. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},globals.Date.klass)})},
  3190. args: ["aNumber"],
  3191. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3192. messageSends: ["new:"],
  3193. referencedClasses: []
  3194. }),
  3195. globals.Date.klass);
  3196. smalltalk.addMethod(
  3197. smalltalk.method({
  3198. selector: "fromSeconds:",
  3199. protocol: 'instance creation',
  3200. fn: function (aNumber){
  3201. var self=this;
  3202. return smalltalk.withContext(function($ctx1) {
  3203. var $1;
  3204. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  3205. return $1;
  3206. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},globals.Date.klass)})},
  3207. args: ["aNumber"],
  3208. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3209. messageSends: ["fromMilliseconds:", "*"],
  3210. referencedClasses: []
  3211. }),
  3212. globals.Date.klass);
  3213. smalltalk.addMethod(
  3214. smalltalk.method({
  3215. selector: "fromString:",
  3216. protocol: 'instance creation',
  3217. fn: function (aString){
  3218. var self=this;
  3219. return smalltalk.withContext(function($ctx1) {
  3220. var $1;
  3221. $1=self._new_(aString);
  3222. return $1;
  3223. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.Date.klass)})},
  3224. args: ["aString"],
  3225. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3226. messageSends: ["new:"],
  3227. referencedClasses: []
  3228. }),
  3229. globals.Date.klass);
  3230. smalltalk.addMethod(
  3231. smalltalk.method({
  3232. selector: "heliosClass",
  3233. protocol: 'helios',
  3234. fn: function (){
  3235. var self=this;
  3236. return "magnitude";
  3237. },
  3238. args: [],
  3239. source: "heliosClass\x0a\x09^ 'magnitude'",
  3240. messageSends: [],
  3241. referencedClasses: []
  3242. }),
  3243. globals.Date.klass);
  3244. smalltalk.addMethod(
  3245. smalltalk.method({
  3246. selector: "millisecondsToRun:",
  3247. protocol: 'instance creation',
  3248. fn: function (aBlock){
  3249. var self=this;
  3250. var t;
  3251. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  3252. return smalltalk.withContext(function($ctx1) {
  3253. var $1;
  3254. t=_st($Date())._now();
  3255. $ctx1.sendIdx["now"]=1;
  3256. _st(aBlock)._value();
  3257. $1=_st(_st($Date())._now()).__minus(t);
  3258. return $1;
  3259. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},globals.Date.klass)})},
  3260. args: ["aBlock"],
  3261. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3262. messageSends: ["now", "value", "-"],
  3263. referencedClasses: ["Date"]
  3264. }),
  3265. globals.Date.klass);
  3266. smalltalk.addMethod(
  3267. smalltalk.method({
  3268. selector: "new:",
  3269. protocol: 'instance creation',
  3270. fn: function (anObject){
  3271. var self=this;
  3272. return smalltalk.withContext(function($ctx1) {
  3273. return new Date(anObject);
  3274. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},globals.Date.klass)})},
  3275. args: ["anObject"],
  3276. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3277. messageSends: [],
  3278. referencedClasses: []
  3279. }),
  3280. globals.Date.klass);
  3281. smalltalk.addMethod(
  3282. smalltalk.method({
  3283. selector: "now",
  3284. protocol: 'instance creation',
  3285. fn: function (){
  3286. var self=this;
  3287. return smalltalk.withContext(function($ctx1) {
  3288. var $1;
  3289. $1=self._today();
  3290. return $1;
  3291. }, function($ctx1) {$ctx1.fill(self,"now",{},globals.Date.klass)})},
  3292. args: [],
  3293. source: "now\x0a\x09^ self today",
  3294. messageSends: ["today"],
  3295. referencedClasses: []
  3296. }),
  3297. globals.Date.klass);
  3298. smalltalk.addMethod(
  3299. smalltalk.method({
  3300. selector: "today",
  3301. protocol: 'instance creation',
  3302. fn: function (){
  3303. var self=this;
  3304. return smalltalk.withContext(function($ctx1) {
  3305. var $1;
  3306. $1=self._new();
  3307. return $1;
  3308. }, function($ctx1) {$ctx1.fill(self,"today",{},globals.Date.klass)})},
  3309. args: [],
  3310. source: "today\x0a\x09^ self new",
  3311. messageSends: ["new"],
  3312. referencedClasses: []
  3313. }),
  3314. globals.Date.klass);
  3315. smalltalk.addClass('Number', globals.Object, [], 'Kernel-Objects');
  3316. 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 ].";
  3317. smalltalk.addMethod(
  3318. smalltalk.method({
  3319. selector: "&",
  3320. protocol: 'converting',
  3321. fn: function (aNumber){
  3322. var self=this;
  3323. return smalltalk.withContext(function($ctx1) {
  3324. return self & aNumber;
  3325. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},globals.Number)})},
  3326. args: ["aNumber"],
  3327. source: "& aNumber\x0a\x09<return self & aNumber>",
  3328. messageSends: [],
  3329. referencedClasses: []
  3330. }),
  3331. globals.Number);
  3332. smalltalk.addMethod(
  3333. smalltalk.method({
  3334. selector: "*",
  3335. protocol: 'arithmetic',
  3336. fn: function (aNumber){
  3337. var self=this;
  3338. return smalltalk.withContext(function($ctx1) {
  3339. return self * aNumber;
  3340. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},globals.Number)})},
  3341. args: ["aNumber"],
  3342. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3343. messageSends: [],
  3344. referencedClasses: []
  3345. }),
  3346. globals.Number);
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "**",
  3350. protocol: 'mathematical functions',
  3351. fn: function (exponent){
  3352. var self=this;
  3353. return smalltalk.withContext(function($ctx1) {
  3354. var $1;
  3355. $1=self._raisedTo_(exponent);
  3356. return $1;
  3357. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},globals.Number)})},
  3358. args: ["exponent"],
  3359. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3360. messageSends: ["raisedTo:"],
  3361. referencedClasses: []
  3362. }),
  3363. globals.Number);
  3364. smalltalk.addMethod(
  3365. smalltalk.method({
  3366. selector: "+",
  3367. protocol: 'arithmetic',
  3368. fn: function (aNumber){
  3369. var self=this;
  3370. return smalltalk.withContext(function($ctx1) {
  3371. return self + aNumber;
  3372. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},globals.Number)})},
  3373. args: ["aNumber"],
  3374. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3375. messageSends: [],
  3376. referencedClasses: []
  3377. }),
  3378. globals.Number);
  3379. smalltalk.addMethod(
  3380. smalltalk.method({
  3381. selector: "-",
  3382. protocol: 'arithmetic',
  3383. fn: function (aNumber){
  3384. var self=this;
  3385. return smalltalk.withContext(function($ctx1) {
  3386. return self - aNumber;
  3387. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},globals.Number)})},
  3388. args: ["aNumber"],
  3389. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3390. messageSends: [],
  3391. referencedClasses: []
  3392. }),
  3393. globals.Number);
  3394. smalltalk.addMethod(
  3395. smalltalk.method({
  3396. selector: "/",
  3397. protocol: 'arithmetic',
  3398. fn: function (aNumber){
  3399. var self=this;
  3400. return smalltalk.withContext(function($ctx1) {
  3401. return self / aNumber;
  3402. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},globals.Number)})},
  3403. args: ["aNumber"],
  3404. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3405. messageSends: [],
  3406. referencedClasses: []
  3407. }),
  3408. globals.Number);
  3409. smalltalk.addMethod(
  3410. smalltalk.method({
  3411. selector: "//",
  3412. protocol: 'arithmetic',
  3413. fn: function (aNumber){
  3414. var self=this;
  3415. return smalltalk.withContext(function($ctx1) {
  3416. var $1;
  3417. $1=_st(self.__slash(aNumber))._floor();
  3418. return $1;
  3419. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},globals.Number)})},
  3420. args: ["aNumber"],
  3421. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3422. messageSends: ["floor", "/"],
  3423. referencedClasses: []
  3424. }),
  3425. globals.Number);
  3426. smalltalk.addMethod(
  3427. smalltalk.method({
  3428. selector: "<",
  3429. protocol: 'comparing',
  3430. fn: function (aNumber){
  3431. var self=this;
  3432. return smalltalk.withContext(function($ctx1) {
  3433. return self < aNumber;
  3434. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},globals.Number)})},
  3435. args: ["aNumber"],
  3436. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3437. messageSends: [],
  3438. referencedClasses: []
  3439. }),
  3440. globals.Number);
  3441. smalltalk.addMethod(
  3442. smalltalk.method({
  3443. selector: "<=",
  3444. protocol: 'comparing',
  3445. fn: function (aNumber){
  3446. var self=this;
  3447. return smalltalk.withContext(function($ctx1) {
  3448. return self <= aNumber;
  3449. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},globals.Number)})},
  3450. args: ["aNumber"],
  3451. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3452. messageSends: [],
  3453. referencedClasses: []
  3454. }),
  3455. globals.Number);
  3456. smalltalk.addMethod(
  3457. smalltalk.method({
  3458. selector: "=",
  3459. protocol: 'comparing',
  3460. fn: function (aNumber){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) {
  3463. return aNumber != null &&
  3464. typeof aNumber._isNumber === "function" &&
  3465. aNumber._isNumber() &&
  3466. Number(self) == aNumber
  3467. ;
  3468. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},globals.Number)})},
  3469. args: ["aNumber"],
  3470. source: "= aNumber\x0a\x09<\x0a\x09\x09return aNumber != null &&\x0a\x09\x09\x09typeof aNumber._isNumber === \x22function\x22 &&\x0a\x09\x09\x09aNumber._isNumber() &&\x0a\x09\x09\x09Number(self) == aNumber\x0a\x09>",
  3471. messageSends: [],
  3472. referencedClasses: []
  3473. }),
  3474. globals.Number);
  3475. smalltalk.addMethod(
  3476. smalltalk.method({
  3477. selector: ">",
  3478. protocol: 'comparing',
  3479. fn: function (aNumber){
  3480. var self=this;
  3481. return smalltalk.withContext(function($ctx1) {
  3482. return self > aNumber;
  3483. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},globals.Number)})},
  3484. args: ["aNumber"],
  3485. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3486. messageSends: [],
  3487. referencedClasses: []
  3488. }),
  3489. globals.Number);
  3490. smalltalk.addMethod(
  3491. smalltalk.method({
  3492. selector: ">=",
  3493. protocol: 'comparing',
  3494. fn: function (aNumber){
  3495. var self=this;
  3496. return smalltalk.withContext(function($ctx1) {
  3497. return self >= aNumber;
  3498. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},globals.Number)})},
  3499. args: ["aNumber"],
  3500. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3501. messageSends: [],
  3502. referencedClasses: []
  3503. }),
  3504. globals.Number);
  3505. smalltalk.addMethod(
  3506. smalltalk.method({
  3507. selector: "@",
  3508. protocol: 'converting',
  3509. fn: function (aNumber){
  3510. var self=this;
  3511. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  3512. return smalltalk.withContext(function($ctx1) {
  3513. var $1;
  3514. $1=_st($Point())._x_y_(self,aNumber);
  3515. return $1;
  3516. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},globals.Number)})},
  3517. args: ["aNumber"],
  3518. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3519. messageSends: ["x:y:"],
  3520. referencedClasses: ["Point"]
  3521. }),
  3522. globals.Number);
  3523. smalltalk.addMethod(
  3524. smalltalk.method({
  3525. selector: "\x5c\x5c",
  3526. protocol: 'arithmetic',
  3527. fn: function (aNumber){
  3528. var self=this;
  3529. return smalltalk.withContext(function($ctx1) {
  3530. return self % aNumber;
  3531. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},globals.Number)})},
  3532. args: ["aNumber"],
  3533. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3534. messageSends: [],
  3535. referencedClasses: []
  3536. }),
  3537. globals.Number);
  3538. smalltalk.addMethod(
  3539. smalltalk.method({
  3540. selector: "abs",
  3541. protocol: 'arithmetic',
  3542. fn: function (){
  3543. var self=this;
  3544. return smalltalk.withContext(function($ctx1) {
  3545. return Math.abs(self);;
  3546. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},globals.Number)})},
  3547. args: [],
  3548. source: "abs\x0a\x09<return Math.abs(self);>",
  3549. messageSends: [],
  3550. referencedClasses: []
  3551. }),
  3552. globals.Number);
  3553. smalltalk.addMethod(
  3554. smalltalk.method({
  3555. selector: "arcCos",
  3556. protocol: 'mathematical functions',
  3557. fn: function (){
  3558. var self=this;
  3559. return smalltalk.withContext(function($ctx1) {
  3560. return Math.acos(self);;
  3561. return self}, function($ctx1) {$ctx1.fill(self,"arcCos",{},globals.Number)})},
  3562. args: [],
  3563. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3564. messageSends: [],
  3565. referencedClasses: []
  3566. }),
  3567. globals.Number);
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "arcSin",
  3571. protocol: 'mathematical functions',
  3572. fn: function (){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. return Math.asin(self);;
  3576. return self}, function($ctx1) {$ctx1.fill(self,"arcSin",{},globals.Number)})},
  3577. args: [],
  3578. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3579. messageSends: [],
  3580. referencedClasses: []
  3581. }),
  3582. globals.Number);
  3583. smalltalk.addMethod(
  3584. smalltalk.method({
  3585. selector: "arcTan",
  3586. protocol: 'mathematical functions',
  3587. fn: function (){
  3588. var self=this;
  3589. return smalltalk.withContext(function($ctx1) {
  3590. return Math.atan(self);;
  3591. return self}, function($ctx1) {$ctx1.fill(self,"arcTan",{},globals.Number)})},
  3592. args: [],
  3593. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3594. messageSends: [],
  3595. referencedClasses: []
  3596. }),
  3597. globals.Number);
  3598. smalltalk.addMethod(
  3599. smalltalk.method({
  3600. selector: "asJSON",
  3601. protocol: 'converting',
  3602. fn: function (){
  3603. var self=this;
  3604. return self;
  3605. },
  3606. args: [],
  3607. source: "asJSON\x0a\x09^ self",
  3608. messageSends: [],
  3609. referencedClasses: []
  3610. }),
  3611. globals.Number);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "asJavascript",
  3615. protocol: 'converting',
  3616. fn: function (){
  3617. var self=this;
  3618. return smalltalk.withContext(function($ctx1) {
  3619. var $1;
  3620. $1=_st("(".__comma(self._printString())).__comma(")");
  3621. $ctx1.sendIdx[","]=1;
  3622. return $1;
  3623. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Number)})},
  3624. args: [],
  3625. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3626. messageSends: [",", "printString"],
  3627. referencedClasses: []
  3628. }),
  3629. globals.Number);
  3630. smalltalk.addMethod(
  3631. smalltalk.method({
  3632. selector: "asNumber",
  3633. protocol: 'converting',
  3634. fn: function (){
  3635. var self=this;
  3636. return self;
  3637. },
  3638. args: [],
  3639. source: "asNumber\x0a\x09^ self",
  3640. messageSends: [],
  3641. referencedClasses: []
  3642. }),
  3643. globals.Number);
  3644. smalltalk.addMethod(
  3645. smalltalk.method({
  3646. selector: "asPoint",
  3647. protocol: 'converting',
  3648. fn: function (){
  3649. var self=this;
  3650. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  3651. return smalltalk.withContext(function($ctx1) {
  3652. var $1;
  3653. $1=_st($Point())._x_y_(self,self);
  3654. return $1;
  3655. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},globals.Number)})},
  3656. args: [],
  3657. source: "asPoint\x0a\x09^ Point x: self y: self",
  3658. messageSends: ["x:y:"],
  3659. referencedClasses: ["Point"]
  3660. }),
  3661. globals.Number);
  3662. smalltalk.addMethod(
  3663. smalltalk.method({
  3664. selector: "asString",
  3665. protocol: 'converting',
  3666. fn: function (){
  3667. var self=this;
  3668. return smalltalk.withContext(function($ctx1) {
  3669. return String(self) ;
  3670. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Number)})},
  3671. args: [],
  3672. source: "asString\x0a\x09< return String(self) >",
  3673. messageSends: [],
  3674. referencedClasses: []
  3675. }),
  3676. globals.Number);
  3677. smalltalk.addMethod(
  3678. smalltalk.method({
  3679. selector: "atRandom",
  3680. protocol: 'converting',
  3681. fn: function (){
  3682. var self=this;
  3683. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  3684. return smalltalk.withContext(function($ctx1) {
  3685. var $1;
  3686. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3687. return $1;
  3688. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.Number)})},
  3689. args: [],
  3690. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3691. messageSends: ["+", "truncated", "*", "next", "new"],
  3692. referencedClasses: ["Random"]
  3693. }),
  3694. globals.Number);
  3695. smalltalk.addMethod(
  3696. smalltalk.method({
  3697. selector: "ceiling",
  3698. protocol: 'converting',
  3699. fn: function (){
  3700. var self=this;
  3701. return smalltalk.withContext(function($ctx1) {
  3702. return Math.ceil(self);;
  3703. return self}, function($ctx1) {$ctx1.fill(self,"ceiling",{},globals.Number)})},
  3704. args: [],
  3705. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3706. messageSends: [],
  3707. referencedClasses: []
  3708. }),
  3709. globals.Number);
  3710. smalltalk.addMethod(
  3711. smalltalk.method({
  3712. selector: "copy",
  3713. protocol: 'copying',
  3714. fn: function (){
  3715. var self=this;
  3716. return self;
  3717. },
  3718. args: [],
  3719. source: "copy\x0a\x09^ self",
  3720. messageSends: [],
  3721. referencedClasses: []
  3722. }),
  3723. globals.Number);
  3724. smalltalk.addMethod(
  3725. smalltalk.method({
  3726. selector: "cos",
  3727. protocol: 'mathematical functions',
  3728. fn: function (){
  3729. var self=this;
  3730. return smalltalk.withContext(function($ctx1) {
  3731. return Math.cos(self);;
  3732. return self}, function($ctx1) {$ctx1.fill(self,"cos",{},globals.Number)})},
  3733. args: [],
  3734. source: "cos\x0a\x09<return Math.cos(self);>",
  3735. messageSends: [],
  3736. referencedClasses: []
  3737. }),
  3738. globals.Number);
  3739. smalltalk.addMethod(
  3740. smalltalk.method({
  3741. selector: "deepCopy",
  3742. protocol: 'copying',
  3743. fn: function (){
  3744. var self=this;
  3745. return smalltalk.withContext(function($ctx1) {
  3746. var $1;
  3747. $1=self._copy();
  3748. return $1;
  3749. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Number)})},
  3750. args: [],
  3751. source: "deepCopy\x0a\x09^ self copy",
  3752. messageSends: ["copy"],
  3753. referencedClasses: []
  3754. }),
  3755. globals.Number);
  3756. smalltalk.addMethod(
  3757. smalltalk.method({
  3758. selector: "even",
  3759. protocol: 'testing',
  3760. fn: function (){
  3761. var self=this;
  3762. return smalltalk.withContext(function($ctx1) {
  3763. var $1;
  3764. $1=(0).__eq(self.__backslash_backslash((2)));
  3765. return $1;
  3766. }, function($ctx1) {$ctx1.fill(self,"even",{},globals.Number)})},
  3767. args: [],
  3768. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3769. messageSends: ["=", "\x5c\x5c"],
  3770. referencedClasses: []
  3771. }),
  3772. globals.Number);
  3773. smalltalk.addMethod(
  3774. smalltalk.method({
  3775. selector: "floor",
  3776. protocol: 'converting',
  3777. fn: function (){
  3778. var self=this;
  3779. return smalltalk.withContext(function($ctx1) {
  3780. return Math.floor(self);;
  3781. return self}, function($ctx1) {$ctx1.fill(self,"floor",{},globals.Number)})},
  3782. args: [],
  3783. source: "floor\x0a\x09<return Math.floor(self);>",
  3784. messageSends: [],
  3785. referencedClasses: []
  3786. }),
  3787. globals.Number);
  3788. smalltalk.addMethod(
  3789. smalltalk.method({
  3790. selector: "identityHash",
  3791. protocol: 'accessing',
  3792. fn: function (){
  3793. var self=this;
  3794. return smalltalk.withContext(function($ctx1) {
  3795. var $1;
  3796. $1=_st(self._asString()).__comma("n");
  3797. return $1;
  3798. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.Number)})},
  3799. args: [],
  3800. source: "identityHash\x0a\x09^ self asString, 'n'",
  3801. messageSends: [",", "asString"],
  3802. referencedClasses: []
  3803. }),
  3804. globals.Number);
  3805. smalltalk.addMethod(
  3806. smalltalk.method({
  3807. selector: "isImmutable",
  3808. protocol: 'testing',
  3809. fn: function (){
  3810. var self=this;
  3811. return true;
  3812. },
  3813. args: [],
  3814. source: "isImmutable\x0a\x09^ true",
  3815. messageSends: [],
  3816. referencedClasses: []
  3817. }),
  3818. globals.Number);
  3819. smalltalk.addMethod(
  3820. smalltalk.method({
  3821. selector: "isNumber",
  3822. protocol: 'testing',
  3823. fn: function (){
  3824. var self=this;
  3825. return true;
  3826. },
  3827. args: [],
  3828. source: "isNumber\x0a\x09^ true",
  3829. messageSends: [],
  3830. referencedClasses: []
  3831. }),
  3832. globals.Number);
  3833. smalltalk.addMethod(
  3834. smalltalk.method({
  3835. selector: "isZero",
  3836. protocol: 'testing',
  3837. fn: function (){
  3838. var self=this;
  3839. return smalltalk.withContext(function($ctx1) {
  3840. var $1;
  3841. $1=self.__eq((0));
  3842. return $1;
  3843. }, function($ctx1) {$ctx1.fill(self,"isZero",{},globals.Number)})},
  3844. args: [],
  3845. source: "isZero\x0a\x09^ self = 0",
  3846. messageSends: ["="],
  3847. referencedClasses: []
  3848. }),
  3849. globals.Number);
  3850. smalltalk.addMethod(
  3851. smalltalk.method({
  3852. selector: "ln",
  3853. protocol: 'mathematical functions',
  3854. fn: function (){
  3855. var self=this;
  3856. return smalltalk.withContext(function($ctx1) {
  3857. return Math.log(self);;
  3858. return self}, function($ctx1) {$ctx1.fill(self,"ln",{},globals.Number)})},
  3859. args: [],
  3860. source: "ln\x0a\x09<return Math.log(self);>",
  3861. messageSends: [],
  3862. referencedClasses: []
  3863. }),
  3864. globals.Number);
  3865. smalltalk.addMethod(
  3866. smalltalk.method({
  3867. selector: "log",
  3868. protocol: 'mathematical functions',
  3869. fn: function (){
  3870. var self=this;
  3871. return smalltalk.withContext(function($ctx1) {
  3872. return Math.log(self) / Math.LN10;;
  3873. return self}, function($ctx1) {$ctx1.fill(self,"log",{},globals.Number)})},
  3874. args: [],
  3875. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3876. messageSends: [],
  3877. referencedClasses: []
  3878. }),
  3879. globals.Number);
  3880. smalltalk.addMethod(
  3881. smalltalk.method({
  3882. selector: "log:",
  3883. protocol: 'mathematical functions',
  3884. fn: function (aNumber){
  3885. var self=this;
  3886. return smalltalk.withContext(function($ctx1) {
  3887. return Math.log(self) / Math.log(aNumber);;
  3888. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},globals.Number)})},
  3889. args: ["aNumber"],
  3890. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  3891. messageSends: [],
  3892. referencedClasses: []
  3893. }),
  3894. globals.Number);
  3895. smalltalk.addMethod(
  3896. smalltalk.method({
  3897. selector: "max:",
  3898. protocol: 'arithmetic',
  3899. fn: function (aNumber){
  3900. var self=this;
  3901. return smalltalk.withContext(function($ctx1) {
  3902. return Math.max(self, aNumber);;
  3903. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},globals.Number)})},
  3904. args: ["aNumber"],
  3905. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3906. messageSends: [],
  3907. referencedClasses: []
  3908. }),
  3909. globals.Number);
  3910. smalltalk.addMethod(
  3911. smalltalk.method({
  3912. selector: "min:",
  3913. protocol: 'arithmetic',
  3914. fn: function (aNumber){
  3915. var self=this;
  3916. return smalltalk.withContext(function($ctx1) {
  3917. return Math.min(self, aNumber);;
  3918. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},globals.Number)})},
  3919. args: ["aNumber"],
  3920. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3921. messageSends: [],
  3922. referencedClasses: []
  3923. }),
  3924. globals.Number);
  3925. smalltalk.addMethod(
  3926. smalltalk.method({
  3927. selector: "negated",
  3928. protocol: 'arithmetic',
  3929. fn: function (){
  3930. var self=this;
  3931. return smalltalk.withContext(function($ctx1) {
  3932. var $1;
  3933. $1=(0).__minus(self);
  3934. return $1;
  3935. }, function($ctx1) {$ctx1.fill(self,"negated",{},globals.Number)})},
  3936. args: [],
  3937. source: "negated\x0a\x09^ 0 - self",
  3938. messageSends: ["-"],
  3939. referencedClasses: []
  3940. }),
  3941. globals.Number);
  3942. smalltalk.addMethod(
  3943. smalltalk.method({
  3944. selector: "negative",
  3945. protocol: 'testing',
  3946. fn: function (){
  3947. var self=this;
  3948. return smalltalk.withContext(function($ctx1) {
  3949. var $1;
  3950. $1=self.__lt((0));
  3951. return $1;
  3952. }, function($ctx1) {$ctx1.fill(self,"negative",{},globals.Number)})},
  3953. args: [],
  3954. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3955. messageSends: ["<"],
  3956. referencedClasses: []
  3957. }),
  3958. globals.Number);
  3959. smalltalk.addMethod(
  3960. smalltalk.method({
  3961. selector: "odd",
  3962. protocol: 'testing',
  3963. fn: function (){
  3964. var self=this;
  3965. return smalltalk.withContext(function($ctx1) {
  3966. var $1;
  3967. $1=_st(self._even())._not();
  3968. return $1;
  3969. }, function($ctx1) {$ctx1.fill(self,"odd",{},globals.Number)})},
  3970. args: [],
  3971. source: "odd\x0a\x09^ self even not",
  3972. messageSends: ["not", "even"],
  3973. referencedClasses: []
  3974. }),
  3975. globals.Number);
  3976. smalltalk.addMethod(
  3977. smalltalk.method({
  3978. selector: "positive",
  3979. protocol: 'testing',
  3980. fn: function (){
  3981. var self=this;
  3982. return smalltalk.withContext(function($ctx1) {
  3983. var $1;
  3984. $1=self.__gt_eq((0));
  3985. return $1;
  3986. }, function($ctx1) {$ctx1.fill(self,"positive",{},globals.Number)})},
  3987. args: [],
  3988. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3989. messageSends: [">="],
  3990. referencedClasses: []
  3991. }),
  3992. globals.Number);
  3993. smalltalk.addMethod(
  3994. smalltalk.method({
  3995. selector: "printOn:",
  3996. protocol: 'printing',
  3997. fn: function (aStream){
  3998. var self=this;
  3999. return smalltalk.withContext(function($ctx1) {
  4000. _st(aStream)._nextPutAll_(self._asString());
  4001. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Number)})},
  4002. args: ["aStream"],
  4003. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4004. messageSends: ["nextPutAll:", "asString"],
  4005. referencedClasses: []
  4006. }),
  4007. globals.Number);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "printShowingDecimalPlaces:",
  4011. protocol: 'printing',
  4012. fn: function (placesDesired){
  4013. var self=this;
  4014. return smalltalk.withContext(function($ctx1) {
  4015. return self.toFixed(placesDesired);
  4016. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},globals.Number)})},
  4017. args: ["placesDesired"],
  4018. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4019. messageSends: [],
  4020. referencedClasses: []
  4021. }),
  4022. globals.Number);
  4023. smalltalk.addMethod(
  4024. smalltalk.method({
  4025. selector: "raisedTo:",
  4026. protocol: 'mathematical functions',
  4027. fn: function (exponent){
  4028. var self=this;
  4029. return smalltalk.withContext(function($ctx1) {
  4030. return Math.pow(self, exponent);;
  4031. return self}, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},globals.Number)})},
  4032. args: ["exponent"],
  4033. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4034. messageSends: [],
  4035. referencedClasses: []
  4036. }),
  4037. globals.Number);
  4038. smalltalk.addMethod(
  4039. smalltalk.method({
  4040. selector: "rounded",
  4041. protocol: 'converting',
  4042. fn: function (){
  4043. var self=this;
  4044. return smalltalk.withContext(function($ctx1) {
  4045. return Math.round(self);;
  4046. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},globals.Number)})},
  4047. args: [],
  4048. source: "rounded\x0a\x09<return Math.round(self);>",
  4049. messageSends: [],
  4050. referencedClasses: []
  4051. }),
  4052. globals.Number);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "sign",
  4056. protocol: 'mathematical functions',
  4057. fn: function (){
  4058. var self=this;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. var $1,$2;
  4061. $1=self._isZero();
  4062. if(smalltalk.assert($1)){
  4063. return (0);
  4064. };
  4065. $2=self._positive();
  4066. if(smalltalk.assert($2)){
  4067. return (1);
  4068. } else {
  4069. return (-1);
  4070. };
  4071. return self}, function($ctx1) {$ctx1.fill(self,"sign",{},globals.Number)})},
  4072. args: [],
  4073. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4074. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"],
  4075. referencedClasses: []
  4076. }),
  4077. globals.Number);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "sin",
  4081. protocol: 'mathematical functions',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. return Math.sin(self);;
  4086. return self}, function($ctx1) {$ctx1.fill(self,"sin",{},globals.Number)})},
  4087. args: [],
  4088. source: "sin\x0a\x09<return Math.sin(self);>",
  4089. messageSends: [],
  4090. referencedClasses: []
  4091. }),
  4092. globals.Number);
  4093. smalltalk.addMethod(
  4094. smalltalk.method({
  4095. selector: "sqrt",
  4096. protocol: 'mathematical functions',
  4097. fn: function (){
  4098. var self=this;
  4099. return smalltalk.withContext(function($ctx1) {
  4100. return Math.sqrt(self);
  4101. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},globals.Number)})},
  4102. args: [],
  4103. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4104. messageSends: [],
  4105. referencedClasses: []
  4106. }),
  4107. globals.Number);
  4108. smalltalk.addMethod(
  4109. smalltalk.method({
  4110. selector: "squared",
  4111. protocol: 'mathematical functions',
  4112. fn: function (){
  4113. var self=this;
  4114. return smalltalk.withContext(function($ctx1) {
  4115. var $1;
  4116. $1=self.__star(self);
  4117. return $1;
  4118. }, function($ctx1) {$ctx1.fill(self,"squared",{},globals.Number)})},
  4119. args: [],
  4120. source: "squared\x0a\x09^ self * self",
  4121. messageSends: ["*"],
  4122. referencedClasses: []
  4123. }),
  4124. globals.Number);
  4125. smalltalk.addMethod(
  4126. smalltalk.method({
  4127. selector: "tan",
  4128. protocol: 'mathematical functions',
  4129. fn: function (){
  4130. var self=this;
  4131. return smalltalk.withContext(function($ctx1) {
  4132. return Math.tan(self);;
  4133. return self}, function($ctx1) {$ctx1.fill(self,"tan",{},globals.Number)})},
  4134. args: [],
  4135. source: "tan\x0a\x09<return Math.tan(self);>",
  4136. messageSends: [],
  4137. referencedClasses: []
  4138. }),
  4139. globals.Number);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "timesRepeat:",
  4143. protocol: 'enumerating',
  4144. fn: function (aBlock){
  4145. var self=this;
  4146. var count;
  4147. return smalltalk.withContext(function($ctx1) {
  4148. count=(1);
  4149. _st((function(){
  4150. return smalltalk.withContext(function($ctx2) {
  4151. return _st(count).__gt(self);
  4152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  4153. return smalltalk.withContext(function($ctx2) {
  4154. _st(aBlock)._value();
  4155. count=_st(count).__plus((1));
  4156. return count;
  4157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4158. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},globals.Number)})},
  4159. args: ["aBlock"],
  4160. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4161. messageSends: ["whileFalse:", ">", "value", "+"],
  4162. referencedClasses: []
  4163. }),
  4164. globals.Number);
  4165. smalltalk.addMethod(
  4166. smalltalk.method({
  4167. selector: "to:",
  4168. protocol: 'converting',
  4169. fn: function (aNumber){
  4170. var self=this;
  4171. var array,first,last,count;
  4172. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4173. return smalltalk.withContext(function($ctx1) {
  4174. var $1;
  4175. first=self._truncated();
  4176. $ctx1.sendIdx["truncated"]=1;
  4177. last=_st(_st(aNumber)._truncated()).__plus((1));
  4178. $ctx1.sendIdx["+"]=1;
  4179. count=(1);
  4180. array=_st($Array())._new();
  4181. _st(_st(last).__minus(first))._timesRepeat_((function(){
  4182. return smalltalk.withContext(function($ctx2) {
  4183. _st(array)._at_put_(count,first);
  4184. count=_st(count).__plus((1));
  4185. $ctx2.sendIdx["+"]=2;
  4186. count;
  4187. first=_st(first).__plus((1));
  4188. return first;
  4189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4190. $1=array;
  4191. return $1;
  4192. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},globals.Number)})},
  4193. args: ["aNumber"],
  4194. 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",
  4195. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
  4196. referencedClasses: ["Array"]
  4197. }),
  4198. globals.Number);
  4199. smalltalk.addMethod(
  4200. smalltalk.method({
  4201. selector: "to:by:",
  4202. protocol: 'converting',
  4203. fn: function (stop,step){
  4204. var self=this;
  4205. var array,value,pos;
  4206. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4207. return smalltalk.withContext(function($ctx1) {
  4208. var $1,$2,$3;
  4209. value=self;
  4210. array=_st($Array())._new();
  4211. pos=(1);
  4212. $1=_st(step).__eq((0));
  4213. if(smalltalk.assert($1)){
  4214. self._error_("step must be non-zero");
  4215. };
  4216. $2=_st(step).__lt((0));
  4217. if(smalltalk.assert($2)){
  4218. _st((function(){
  4219. return smalltalk.withContext(function($ctx2) {
  4220. return _st(value).__gt_eq(stop);
  4221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  4222. return smalltalk.withContext(function($ctx2) {
  4223. _st(array)._at_put_(pos,value);
  4224. $ctx2.sendIdx["at:put:"]=1;
  4225. pos=_st(pos).__plus((1));
  4226. $ctx2.sendIdx["+"]=1;
  4227. pos;
  4228. value=_st(value).__plus(step);
  4229. $ctx2.sendIdx["+"]=2;
  4230. return value;
  4231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4232. $ctx1.sendIdx["whileTrue:"]=1;
  4233. } else {
  4234. _st((function(){
  4235. return smalltalk.withContext(function($ctx2) {
  4236. return _st(value).__lt_eq(stop);
  4237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  4238. return smalltalk.withContext(function($ctx2) {
  4239. _st(array)._at_put_(pos,value);
  4240. pos=_st(pos).__plus((1));
  4241. $ctx2.sendIdx["+"]=3;
  4242. pos;
  4243. value=_st(value).__plus(step);
  4244. return value;
  4245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  4246. };
  4247. $3=array;
  4248. return $3;
  4249. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},globals.Number)})},
  4250. args: ["stop", "step"],
  4251. 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",
  4252. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
  4253. referencedClasses: ["Array"]
  4254. }),
  4255. globals.Number);
  4256. smalltalk.addMethod(
  4257. smalltalk.method({
  4258. selector: "to:by:do:",
  4259. protocol: 'enumerating',
  4260. fn: function (stop,step,aBlock){
  4261. var self=this;
  4262. var value;
  4263. return smalltalk.withContext(function($ctx1) {
  4264. var $1,$2;
  4265. value=self;
  4266. $1=_st(step).__eq((0));
  4267. if(smalltalk.assert($1)){
  4268. self._error_("step must be non-zero");
  4269. };
  4270. $2=_st(step).__lt((0));
  4271. if(smalltalk.assert($2)){
  4272. _st((function(){
  4273. return smalltalk.withContext(function($ctx2) {
  4274. return _st(value).__gt_eq(stop);
  4275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  4276. return smalltalk.withContext(function($ctx2) {
  4277. _st(aBlock)._value_(value);
  4278. $ctx2.sendIdx["value:"]=1;
  4279. value=_st(value).__plus(step);
  4280. $ctx2.sendIdx["+"]=1;
  4281. return value;
  4282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4283. $ctx1.sendIdx["whileTrue:"]=1;
  4284. } else {
  4285. _st((function(){
  4286. return smalltalk.withContext(function($ctx2) {
  4287. return _st(value).__lt_eq(stop);
  4288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  4289. return smalltalk.withContext(function($ctx2) {
  4290. _st(aBlock)._value_(value);
  4291. value=_st(value).__plus(step);
  4292. return value;
  4293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  4294. };
  4295. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},globals.Number)})},
  4296. args: ["stop", "step", "aBlock"],
  4297. 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 ]]",
  4298. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
  4299. referencedClasses: []
  4300. }),
  4301. globals.Number);
  4302. smalltalk.addMethod(
  4303. smalltalk.method({
  4304. selector: "to:do:",
  4305. protocol: 'enumerating',
  4306. fn: function (stop,aBlock){
  4307. var self=this;
  4308. var nextValue;
  4309. return smalltalk.withContext(function($ctx1) {
  4310. nextValue=self;
  4311. _st((function(){
  4312. return smalltalk.withContext(function($ctx2) {
  4313. return _st(nextValue).__lt_eq(stop);
  4314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  4315. return smalltalk.withContext(function($ctx2) {
  4316. _st(aBlock)._value_(nextValue);
  4317. nextValue=_st(nextValue).__plus((1));
  4318. return nextValue;
  4319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4320. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},globals.Number)})},
  4321. args: ["stop", "aBlock"],
  4322. 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 ]",
  4323. messageSends: ["whileTrue:", "<=", "value:", "+"],
  4324. referencedClasses: []
  4325. }),
  4326. globals.Number);
  4327. smalltalk.addMethod(
  4328. smalltalk.method({
  4329. selector: "truncated",
  4330. protocol: 'converting',
  4331. fn: function (){
  4332. var self=this;
  4333. return smalltalk.withContext(function($ctx1) {
  4334. if(self >= 0) {
  4335. return Math.floor(self);
  4336. } else {
  4337. return Math.floor(self * (-1)) * (-1);
  4338. };
  4339. ;
  4340. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},globals.Number)})},
  4341. args: [],
  4342. 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>",
  4343. messageSends: [],
  4344. referencedClasses: []
  4345. }),
  4346. globals.Number);
  4347. smalltalk.addMethod(
  4348. smalltalk.method({
  4349. selector: "|",
  4350. protocol: 'converting',
  4351. fn: function (aNumber){
  4352. var self=this;
  4353. return smalltalk.withContext(function($ctx1) {
  4354. return self | aNumber;
  4355. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},globals.Number)})},
  4356. args: ["aNumber"],
  4357. source: "| aNumber\x0a\x09<return self | aNumber>",
  4358. messageSends: [],
  4359. referencedClasses: []
  4360. }),
  4361. globals.Number);
  4362. smalltalk.addMethod(
  4363. smalltalk.method({
  4364. selector: "e",
  4365. protocol: 'instance creation',
  4366. fn: function (){
  4367. var self=this;
  4368. return smalltalk.withContext(function($ctx1) {
  4369. return Math.E;;
  4370. return self}, function($ctx1) {$ctx1.fill(self,"e",{},globals.Number.klass)})},
  4371. args: [],
  4372. source: "e\x0a\x09<return Math.E;>",
  4373. messageSends: [],
  4374. referencedClasses: []
  4375. }),
  4376. globals.Number.klass);
  4377. smalltalk.addMethod(
  4378. smalltalk.method({
  4379. selector: "heliosClass",
  4380. protocol: 'helios',
  4381. fn: function (){
  4382. var self=this;
  4383. return "magnitude";
  4384. },
  4385. args: [],
  4386. source: "heliosClass\x0a\x09^ 'magnitude'",
  4387. messageSends: [],
  4388. referencedClasses: []
  4389. }),
  4390. globals.Number.klass);
  4391. smalltalk.addMethod(
  4392. smalltalk.method({
  4393. selector: "pi",
  4394. protocol: 'instance creation',
  4395. fn: function (){
  4396. var self=this;
  4397. return smalltalk.withContext(function($ctx1) {
  4398. return Math.PI;
  4399. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},globals.Number.klass)})},
  4400. args: [],
  4401. source: "pi\x0a\x09<return Math.PI>",
  4402. messageSends: [],
  4403. referencedClasses: []
  4404. }),
  4405. globals.Number.klass);
  4406. smalltalk.addClass('Point', globals.Object, ['x', 'y'], 'Kernel-Objects');
  4407. 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";
  4408. smalltalk.addMethod(
  4409. smalltalk.method({
  4410. selector: "*",
  4411. protocol: 'arithmetic',
  4412. fn: function (aPoint){
  4413. var self=this;
  4414. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4415. return smalltalk.withContext(function($ctx1) {
  4416. var $3,$5,$4,$2,$7,$6,$1;
  4417. $3=self._x();
  4418. $ctx1.sendIdx["x"]=1;
  4419. $5=_st(aPoint)._asPoint();
  4420. $ctx1.sendIdx["asPoint"]=1;
  4421. $4=_st($5)._x();
  4422. $2=_st($3).__star($4);
  4423. $ctx1.sendIdx["*"]=1;
  4424. $7=self._y();
  4425. $ctx1.sendIdx["y"]=1;
  4426. $6=_st($7).__star(_st(_st(aPoint)._asPoint())._y());
  4427. $1=_st($Point())._x_y_($2,$6);
  4428. return $1;
  4429. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},globals.Point)})},
  4430. args: ["aPoint"],
  4431. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4432. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4433. referencedClasses: ["Point"]
  4434. }),
  4435. globals.Point);
  4436. smalltalk.addMethod(
  4437. smalltalk.method({
  4438. selector: "+",
  4439. protocol: 'arithmetic',
  4440. fn: function (aPoint){
  4441. var self=this;
  4442. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4443. return smalltalk.withContext(function($ctx1) {
  4444. var $3,$5,$4,$2,$7,$6,$1;
  4445. $3=self._x();
  4446. $ctx1.sendIdx["x"]=1;
  4447. $5=_st(aPoint)._asPoint();
  4448. $ctx1.sendIdx["asPoint"]=1;
  4449. $4=_st($5)._x();
  4450. $2=_st($3).__plus($4);
  4451. $ctx1.sendIdx["+"]=1;
  4452. $7=self._y();
  4453. $ctx1.sendIdx["y"]=1;
  4454. $6=_st($7).__plus(_st(_st(aPoint)._asPoint())._y());
  4455. $1=_st($Point())._x_y_($2,$6);
  4456. return $1;
  4457. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},globals.Point)})},
  4458. args: ["aPoint"],
  4459. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4460. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4461. referencedClasses: ["Point"]
  4462. }),
  4463. globals.Point);
  4464. smalltalk.addMethod(
  4465. smalltalk.method({
  4466. selector: "-",
  4467. protocol: 'arithmetic',
  4468. fn: function (aPoint){
  4469. var self=this;
  4470. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4471. return smalltalk.withContext(function($ctx1) {
  4472. var $3,$5,$4,$2,$7,$6,$1;
  4473. $3=self._x();
  4474. $ctx1.sendIdx["x"]=1;
  4475. $5=_st(aPoint)._asPoint();
  4476. $ctx1.sendIdx["asPoint"]=1;
  4477. $4=_st($5)._x();
  4478. $2=_st($3).__minus($4);
  4479. $ctx1.sendIdx["-"]=1;
  4480. $7=self._y();
  4481. $ctx1.sendIdx["y"]=1;
  4482. $6=_st($7).__minus(_st(_st(aPoint)._asPoint())._y());
  4483. $1=_st($Point())._x_y_($2,$6);
  4484. return $1;
  4485. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},globals.Point)})},
  4486. args: ["aPoint"],
  4487. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4488. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4489. referencedClasses: ["Point"]
  4490. }),
  4491. globals.Point);
  4492. smalltalk.addMethod(
  4493. smalltalk.method({
  4494. selector: "/",
  4495. protocol: 'arithmetic',
  4496. fn: function (aPoint){
  4497. var self=this;
  4498. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4499. return smalltalk.withContext(function($ctx1) {
  4500. var $3,$5,$4,$2,$7,$6,$1;
  4501. $3=self._x();
  4502. $ctx1.sendIdx["x"]=1;
  4503. $5=_st(aPoint)._asPoint();
  4504. $ctx1.sendIdx["asPoint"]=1;
  4505. $4=_st($5)._x();
  4506. $2=_st($3).__slash($4);
  4507. $ctx1.sendIdx["/"]=1;
  4508. $7=self._y();
  4509. $ctx1.sendIdx["y"]=1;
  4510. $6=_st($7).__slash(_st(_st(aPoint)._asPoint())._y());
  4511. $1=_st($Point())._x_y_($2,$6);
  4512. return $1;
  4513. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},globals.Point)})},
  4514. args: ["aPoint"],
  4515. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4516. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4517. referencedClasses: ["Point"]
  4518. }),
  4519. globals.Point);
  4520. smalltalk.addMethod(
  4521. smalltalk.method({
  4522. selector: "=",
  4523. protocol: 'arithmetic',
  4524. fn: function (aPoint){
  4525. var self=this;
  4526. return smalltalk.withContext(function($ctx1) {
  4527. var $3,$2,$5,$4,$7,$6,$1;
  4528. $3=_st(aPoint)._class();
  4529. $ctx1.sendIdx["class"]=1;
  4530. $2=_st($3).__eq(self._class());
  4531. $ctx1.sendIdx["="]=1;
  4532. $1=_st($2)._and_((function(){
  4533. return smalltalk.withContext(function($ctx2) {
  4534. $5=_st(aPoint)._x();
  4535. $ctx2.sendIdx["x"]=1;
  4536. $4=_st($5).__eq(self._x());
  4537. $ctx2.sendIdx["="]=2;
  4538. $7=_st(aPoint)._y();
  4539. $ctx2.sendIdx["y"]=1;
  4540. $6=_st($7).__eq(self._y());
  4541. return _st($4).__and($6);
  4542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4543. return $1;
  4544. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},globals.Point)})},
  4545. args: ["aPoint"],
  4546. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4547. messageSends: ["and:", "=", "class", "&", "x", "y"],
  4548. referencedClasses: []
  4549. }),
  4550. globals.Point);
  4551. smalltalk.addMethod(
  4552. smalltalk.method({
  4553. selector: "asPoint",
  4554. protocol: 'converting',
  4555. fn: function (){
  4556. var self=this;
  4557. return self;
  4558. },
  4559. args: [],
  4560. source: "asPoint\x0a\x09^ self",
  4561. messageSends: [],
  4562. referencedClasses: []
  4563. }),
  4564. globals.Point);
  4565. smalltalk.addMethod(
  4566. smalltalk.method({
  4567. selector: "printOn:",
  4568. protocol: 'printing',
  4569. fn: function (aStream){
  4570. var self=this;
  4571. return smalltalk.withContext(function($ctx1) {
  4572. var $1;
  4573. _st(self["@x"])._printOn_(aStream);
  4574. $ctx1.sendIdx["printOn:"]=1;
  4575. _st(aStream)._nextPutAll_("@");
  4576. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  4577. return smalltalk.withContext(function($ctx2) {
  4578. return _st(self["@y"])._negative();
  4579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4580. if(smalltalk.assert($1)){
  4581. _st(aStream)._space();
  4582. };
  4583. _st(self["@y"])._printOn_(aStream);
  4584. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Point)})},
  4585. args: ["aStream"],
  4586. 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",
  4587. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"],
  4588. referencedClasses: []
  4589. }),
  4590. globals.Point);
  4591. smalltalk.addMethod(
  4592. smalltalk.method({
  4593. selector: "translateBy:",
  4594. protocol: 'transforming',
  4595. fn: function (delta){
  4596. var self=this;
  4597. return smalltalk.withContext(function($ctx1) {
  4598. var $2,$1;
  4599. $2=_st(_st(delta)._x()).__plus(self["@x"]);
  4600. $ctx1.sendIdx["+"]=1;
  4601. $1=_st($2).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4602. return $1;
  4603. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},globals.Point)})},
  4604. args: ["delta"],
  4605. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4606. messageSends: ["@", "+", "x", "y"],
  4607. referencedClasses: []
  4608. }),
  4609. globals.Point);
  4610. smalltalk.addMethod(
  4611. smalltalk.method({
  4612. selector: "x",
  4613. protocol: 'accessing',
  4614. fn: function (){
  4615. var self=this;
  4616. var $1;
  4617. $1=self["@x"];
  4618. return $1;
  4619. },
  4620. args: [],
  4621. source: "x\x0a\x09^ x",
  4622. messageSends: [],
  4623. referencedClasses: []
  4624. }),
  4625. globals.Point);
  4626. smalltalk.addMethod(
  4627. smalltalk.method({
  4628. selector: "x:",
  4629. protocol: 'accessing',
  4630. fn: function (aNumber){
  4631. var self=this;
  4632. self["@x"]=aNumber;
  4633. return self},
  4634. args: ["aNumber"],
  4635. source: "x: aNumber\x0a\x09x := aNumber",
  4636. messageSends: [],
  4637. referencedClasses: []
  4638. }),
  4639. globals.Point);
  4640. smalltalk.addMethod(
  4641. smalltalk.method({
  4642. selector: "y",
  4643. protocol: 'accessing',
  4644. fn: function (){
  4645. var self=this;
  4646. var $1;
  4647. $1=self["@y"];
  4648. return $1;
  4649. },
  4650. args: [],
  4651. source: "y\x0a\x09^ y",
  4652. messageSends: [],
  4653. referencedClasses: []
  4654. }),
  4655. globals.Point);
  4656. smalltalk.addMethod(
  4657. smalltalk.method({
  4658. selector: "y:",
  4659. protocol: 'accessing',
  4660. fn: function (aNumber){
  4661. var self=this;
  4662. self["@y"]=aNumber;
  4663. return self},
  4664. args: ["aNumber"],
  4665. source: "y: aNumber\x0a\x09y := aNumber",
  4666. messageSends: [],
  4667. referencedClasses: []
  4668. }),
  4669. globals.Point);
  4670. smalltalk.addMethod(
  4671. smalltalk.method({
  4672. selector: "heliosClass",
  4673. protocol: 'helios',
  4674. fn: function (){
  4675. var self=this;
  4676. return "magnitude";
  4677. },
  4678. args: [],
  4679. source: "heliosClass\x0a\x09^ 'magnitude'",
  4680. messageSends: [],
  4681. referencedClasses: []
  4682. }),
  4683. globals.Point.klass);
  4684. smalltalk.addMethod(
  4685. smalltalk.method({
  4686. selector: "x:y:",
  4687. protocol: 'instance creation',
  4688. fn: function (aNumber,anotherNumber){
  4689. var self=this;
  4690. return smalltalk.withContext(function($ctx1) {
  4691. var $2,$3,$1;
  4692. $2=self._new();
  4693. _st($2)._x_(aNumber);
  4694. _st($2)._y_(anotherNumber);
  4695. $3=_st($2)._yourself();
  4696. $1=$3;
  4697. return $1;
  4698. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Point.klass)})},
  4699. args: ["aNumber", "anotherNumber"],
  4700. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4701. messageSends: ["x:", "new", "y:", "yourself"],
  4702. referencedClasses: []
  4703. }),
  4704. globals.Point.klass);
  4705. smalltalk.addClass('Random', globals.Object, [], 'Kernel-Objects');
  4706. 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'`.";
  4707. smalltalk.addMethod(
  4708. smalltalk.method({
  4709. selector: "next",
  4710. protocol: 'accessing',
  4711. fn: function (){
  4712. var self=this;
  4713. return smalltalk.withContext(function($ctx1) {
  4714. return Math.random();
  4715. return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.Random)})},
  4716. args: [],
  4717. source: "next\x0a\x09<return Math.random()>",
  4718. messageSends: [],
  4719. referencedClasses: []
  4720. }),
  4721. globals.Random);
  4722. smalltalk.addMethod(
  4723. smalltalk.method({
  4724. selector: "next:",
  4725. protocol: 'accessing',
  4726. fn: function (anInteger){
  4727. var self=this;
  4728. return smalltalk.withContext(function($ctx1) {
  4729. var $1;
  4730. $1=_st((1)._to_(anInteger))._collect_((function(each){
  4731. return smalltalk.withContext(function($ctx2) {
  4732. return self._next();
  4733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4734. return $1;
  4735. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},globals.Random)})},
  4736. args: ["anInteger"],
  4737. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  4738. messageSends: ["collect:", "to:", "next"],
  4739. referencedClasses: []
  4740. }),
  4741. globals.Random);
  4742. smalltalk.addClass('UndefinedObject', globals.Object, [], 'Kernel-Objects');
  4743. 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`.";
  4744. smalltalk.addMethod(
  4745. smalltalk.method({
  4746. selector: "asJSON",
  4747. protocol: 'converting',
  4748. fn: function (){
  4749. var self=this;
  4750. var $1;
  4751. $1=null;
  4752. return $1;
  4753. },
  4754. args: [],
  4755. source: "asJSON\x0a\x09^ null",
  4756. messageSends: [],
  4757. referencedClasses: []
  4758. }),
  4759. globals.UndefinedObject);
  4760. smalltalk.addMethod(
  4761. smalltalk.method({
  4762. selector: "deepCopy",
  4763. protocol: 'copying',
  4764. fn: function (){
  4765. var self=this;
  4766. return self;
  4767. },
  4768. args: [],
  4769. source: "deepCopy\x0a\x09^ self",
  4770. messageSends: [],
  4771. referencedClasses: []
  4772. }),
  4773. globals.UndefinedObject);
  4774. smalltalk.addMethod(
  4775. smalltalk.method({
  4776. selector: "ifNil:",
  4777. protocol: 'testing',
  4778. fn: function (aBlock){
  4779. var self=this;
  4780. return smalltalk.withContext(function($ctx1) {
  4781. var $1;
  4782. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  4783. }));
  4784. return $1;
  4785. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},globals.UndefinedObject)})},
  4786. args: ["aBlock"],
  4787. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  4788. messageSends: ["ifNil:ifNotNil:"],
  4789. referencedClasses: []
  4790. }),
  4791. globals.UndefinedObject);
  4792. smalltalk.addMethod(
  4793. smalltalk.method({
  4794. selector: "ifNil:ifNotNil:",
  4795. protocol: 'testing',
  4796. fn: function (aBlock,anotherBlock){
  4797. var self=this;
  4798. return smalltalk.withContext(function($ctx1) {
  4799. var $1;
  4800. $1=_st(aBlock)._value();
  4801. return $1;
  4802. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
  4803. args: ["aBlock", "anotherBlock"],
  4804. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  4805. messageSends: ["value"],
  4806. referencedClasses: []
  4807. }),
  4808. globals.UndefinedObject);
  4809. smalltalk.addMethod(
  4810. smalltalk.method({
  4811. selector: "ifNotNil:",
  4812. protocol: 'testing',
  4813. fn: function (aBlock){
  4814. var self=this;
  4815. return self;
  4816. },
  4817. args: ["aBlock"],
  4818. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  4819. messageSends: [],
  4820. referencedClasses: []
  4821. }),
  4822. globals.UndefinedObject);
  4823. smalltalk.addMethod(
  4824. smalltalk.method({
  4825. selector: "ifNotNil:ifNil:",
  4826. protocol: 'testing',
  4827. fn: function (aBlock,anotherBlock){
  4828. var self=this;
  4829. return smalltalk.withContext(function($ctx1) {
  4830. var $1;
  4831. $1=_st(anotherBlock)._value();
  4832. return $1;
  4833. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
  4834. args: ["aBlock", "anotherBlock"],
  4835. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  4836. messageSends: ["value"],
  4837. referencedClasses: []
  4838. }),
  4839. globals.UndefinedObject);
  4840. smalltalk.addMethod(
  4841. smalltalk.method({
  4842. selector: "isImmutable",
  4843. protocol: 'testing',
  4844. fn: function (){
  4845. var self=this;
  4846. return true;
  4847. },
  4848. args: [],
  4849. source: "isImmutable\x0a\x09^ true",
  4850. messageSends: [],
  4851. referencedClasses: []
  4852. }),
  4853. globals.UndefinedObject);
  4854. smalltalk.addMethod(
  4855. smalltalk.method({
  4856. selector: "isNil",
  4857. protocol: 'testing',
  4858. fn: function (){
  4859. var self=this;
  4860. return true;
  4861. },
  4862. args: [],
  4863. source: "isNil\x0a\x09^ true",
  4864. messageSends: [],
  4865. referencedClasses: []
  4866. }),
  4867. globals.UndefinedObject);
  4868. smalltalk.addMethod(
  4869. smalltalk.method({
  4870. selector: "notNil",
  4871. protocol: 'testing',
  4872. fn: function (){
  4873. var self=this;
  4874. return false;
  4875. },
  4876. args: [],
  4877. source: "notNil\x0a\x09^ false",
  4878. messageSends: [],
  4879. referencedClasses: []
  4880. }),
  4881. globals.UndefinedObject);
  4882. smalltalk.addMethod(
  4883. smalltalk.method({
  4884. selector: "printOn:",
  4885. protocol: 'printing',
  4886. fn: function (aStream){
  4887. var self=this;
  4888. return smalltalk.withContext(function($ctx1) {
  4889. _st(aStream)._nextPutAll_("nil");
  4890. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.UndefinedObject)})},
  4891. args: ["aStream"],
  4892. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  4893. messageSends: ["nextPutAll:"],
  4894. referencedClasses: []
  4895. }),
  4896. globals.UndefinedObject);
  4897. smalltalk.addMethod(
  4898. smalltalk.method({
  4899. selector: "shallowCopy",
  4900. protocol: 'copying',
  4901. fn: function (){
  4902. var self=this;
  4903. return self;
  4904. },
  4905. args: [],
  4906. source: "shallowCopy\x0a\x09^ self",
  4907. messageSends: [],
  4908. referencedClasses: []
  4909. }),
  4910. globals.UndefinedObject);
  4911. smalltalk.addMethod(
  4912. smalltalk.method({
  4913. selector: "subclass:instanceVariableNames:",
  4914. protocol: 'class creation',
  4915. fn: function (aString,anotherString){
  4916. var self=this;
  4917. return smalltalk.withContext(function($ctx1) {
  4918. var $1;
  4919. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  4920. return $1;
  4921. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.UndefinedObject)})},
  4922. args: ["aString", "anotherString"],
  4923. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  4924. messageSends: ["subclass:instanceVariableNames:package:"],
  4925. referencedClasses: []
  4926. }),
  4927. globals.UndefinedObject);
  4928. smalltalk.addMethod(
  4929. smalltalk.method({
  4930. selector: "subclass:instanceVariableNames:category:",
  4931. protocol: 'class creation',
  4932. fn: function (aString,aString2,aString3){
  4933. var self=this;
  4934. return smalltalk.withContext(function($ctx1) {
  4935. var $1;
  4936. self._deprecatedAPI();
  4937. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  4938. return $1;
  4939. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
  4940. args: ["aString", "aString2", "aString3"],
  4941. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  4942. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4943. referencedClasses: []
  4944. }),
  4945. globals.UndefinedObject);
  4946. smalltalk.addMethod(
  4947. smalltalk.method({
  4948. selector: "subclass:instanceVariableNames:package:",
  4949. protocol: 'class creation',
  4950. fn: function (aString,aString2,aString3){
  4951. var self=this;
  4952. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4953. return smalltalk.withContext(function($ctx1) {
  4954. var $1;
  4955. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  4956. return $1;
  4957. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
  4958. args: ["aString", "aString2", "aString3"],
  4959. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4960. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  4961. referencedClasses: ["ClassBuilder"]
  4962. }),
  4963. globals.UndefinedObject);
  4964. smalltalk.addMethod(
  4965. smalltalk.method({
  4966. selector: "new",
  4967. protocol: 'instance creation',
  4968. fn: function (){
  4969. var self=this;
  4970. return smalltalk.withContext(function($ctx1) {
  4971. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  4972. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.UndefinedObject.klass)})},
  4973. args: [],
  4974. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4975. messageSends: ["error:"],
  4976. referencedClasses: []
  4977. }),
  4978. globals.UndefinedObject.klass);
  4979. });
  4980. define("amber_core/Kernel-Classes", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  4981. smalltalk.addPackage('Kernel-Classes');
  4982. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4983. smalltalk.addClass('Behavior', globals.Object, [], 'Kernel-Classes');
  4984. 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.";
  4985. smalltalk.addMethod(
  4986. smalltalk.method({
  4987. selector: ">>",
  4988. protocol: 'accessing',
  4989. fn: function (aString){
  4990. var self=this;
  4991. return smalltalk.withContext(function($ctx1) {
  4992. var $1;
  4993. $1=self._methodAt_(aString);
  4994. return $1;
  4995. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},globals.Behavior)})},
  4996. args: ["aString"],
  4997. source: ">> aString\x0a\x09^ self methodAt: aString",
  4998. messageSends: ["methodAt:"],
  4999. referencedClasses: []
  5000. }),
  5001. globals.Behavior);
  5002. smalltalk.addMethod(
  5003. smalltalk.method({
  5004. selector: "addCompiledMethod:",
  5005. protocol: 'compiling',
  5006. fn: function (aMethod){
  5007. var self=this;
  5008. var oldMethod,announcement;
  5009. function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5010. function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5011. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5012. return smalltalk.withContext(function($ctx1) {
  5013. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11;
  5014. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  5015. return nil;
  5016. }));
  5017. $2=self._protocols();
  5018. $3=_st(aMethod)._protocol();
  5019. $ctx1.sendIdx["protocol"]=1;
  5020. $1=_st($2)._includes_($3);
  5021. if(! smalltalk.assert($1)){
  5022. $4=self._organization();
  5023. $5=_st(aMethod)._protocol();
  5024. $ctx1.sendIdx["protocol"]=2;
  5025. _st($4)._addElement_($5);
  5026. };
  5027. self._basicAddCompiledMethod_(aMethod);
  5028. $6=oldMethod;
  5029. if(($receiver = $6) == nil || $receiver == null){
  5030. $6;
  5031. } else {
  5032. self._removeProtocolIfEmpty_(_st(oldMethod)._protocol());
  5033. };
  5034. $7=oldMethod;
  5035. if(($receiver = $7) == nil || $receiver == null){
  5036. $8=_st($MethodAdded())._new();
  5037. $ctx1.sendIdx["new"]=1;
  5038. _st($8)._method_(aMethod);
  5039. $ctx1.sendIdx["method:"]=1;
  5040. $9=_st($8)._yourself();
  5041. $ctx1.sendIdx["yourself"]=1;
  5042. announcement=$9;
  5043. } else {
  5044. $10=_st($MethodModified())._new();
  5045. _st($10)._oldMethod_(oldMethod);
  5046. _st($10)._method_(aMethod);
  5047. $11=_st($10)._yourself();
  5048. announcement=$11;
  5049. };
  5050. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  5051. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},globals.Behavior)})},
  5052. args: ["aMethod"],
  5053. 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",
  5054. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  5055. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  5056. }),
  5057. globals.Behavior);
  5058. smalltalk.addMethod(
  5059. smalltalk.method({
  5060. selector: "allInstanceVariableNames",
  5061. protocol: 'accessing',
  5062. fn: function (){
  5063. var self=this;
  5064. var result;
  5065. return smalltalk.withContext(function($ctx1) {
  5066. var $1,$2;
  5067. result=_st(self._instanceVariableNames())._copy();
  5068. $1=self._superclass();
  5069. $ctx1.sendIdx["superclass"]=1;
  5070. if(($receiver = $1) == nil || $receiver == null){
  5071. $1;
  5072. } else {
  5073. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  5074. };
  5075. $2=result;
  5076. return $2;
  5077. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},globals.Behavior)})},
  5078. args: [],
  5079. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5080. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
  5081. referencedClasses: []
  5082. }),
  5083. globals.Behavior);
  5084. smalltalk.addMethod(
  5085. smalltalk.method({
  5086. selector: "allSelectors",
  5087. protocol: 'accessing',
  5088. fn: function (){
  5089. var self=this;
  5090. return smalltalk.withContext(function($ctx1) {
  5091. var $2,$3,$4,$1;
  5092. $2=self._allSuperclasses();
  5093. $3=self._selectors();
  5094. $ctx1.sendIdx["selectors"]=1;
  5095. $1=_st($2)._inject_into_($3,(function(acc,each){
  5096. return smalltalk.withContext(function($ctx2) {
  5097. _st(acc)._addAll_(_st(each)._selectors());
  5098. $4=_st(acc)._yourself();
  5099. return $4;
  5100. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})}));
  5101. return $1;
  5102. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Behavior)})},
  5103. args: [],
  5104. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5105. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"],
  5106. referencedClasses: []
  5107. }),
  5108. globals.Behavior);
  5109. smalltalk.addMethod(
  5110. smalltalk.method({
  5111. selector: "allSubclasses",
  5112. protocol: 'accessing',
  5113. fn: function (){
  5114. var self=this;
  5115. var subclasses,index;
  5116. return smalltalk.withContext(function($ctx1) {
  5117. var $1;
  5118. subclasses=self._subclasses();
  5119. $ctx1.sendIdx["subclasses"]=1;
  5120. index=(1);
  5121. _st((function(){
  5122. return smalltalk.withContext(function($ctx2) {
  5123. return _st(index).__gt(_st(subclasses)._size());
  5124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5125. return smalltalk.withContext(function($ctx2) {
  5126. _st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
  5127. index=_st(index).__plus((1));
  5128. return index;
  5129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5130. $1=subclasses;
  5131. return $1;
  5132. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},globals.Behavior)})},
  5133. args: [],
  5134. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self 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\x09^ subclasses",
  5135. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"],
  5136. referencedClasses: []
  5137. }),
  5138. globals.Behavior);
  5139. smalltalk.addMethod(
  5140. smalltalk.method({
  5141. selector: "allSubclassesDo:",
  5142. protocol: 'enumerating',
  5143. fn: function (aBlock){
  5144. var self=this;
  5145. return smalltalk.withContext(function($ctx1) {
  5146. _st(self._allSubclasses())._do_((function(each){
  5147. return smalltalk.withContext(function($ctx2) {
  5148. return _st(aBlock)._value_(each);
  5149. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5150. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},globals.Behavior)})},
  5151. args: ["aBlock"],
  5152. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  5153. messageSends: ["do:", "allSubclasses", "value:"],
  5154. referencedClasses: []
  5155. }),
  5156. globals.Behavior);
  5157. smalltalk.addMethod(
  5158. smalltalk.method({
  5159. selector: "allSuperclasses",
  5160. protocol: 'accessing',
  5161. fn: function (){
  5162. var self=this;
  5163. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5164. return smalltalk.withContext(function($ctx1) {
  5165. var $1,$2,$5,$4,$6,$3;
  5166. $1=self._superclass();
  5167. $ctx1.sendIdx["superclass"]=1;
  5168. if(($receiver = $1) == nil || $receiver == null){
  5169. $2=[];
  5170. return $2;
  5171. } else {
  5172. $1;
  5173. };
  5174. $5=self._superclass();
  5175. $ctx1.sendIdx["superclass"]=2;
  5176. $4=_st($OrderedCollection())._with_($5);
  5177. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  5178. $6=_st($4)._yourself();
  5179. $3=$6;
  5180. return $3;
  5181. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},globals.Behavior)})},
  5182. args: [],
  5183. 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",
  5184. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"],
  5185. referencedClasses: ["OrderedCollection"]
  5186. }),
  5187. globals.Behavior);
  5188. smalltalk.addMethod(
  5189. smalltalk.method({
  5190. selector: "basicAddCompiledMethod:",
  5191. protocol: 'private',
  5192. fn: function (aMethod){
  5193. var self=this;
  5194. return smalltalk.withContext(function($ctx1) {
  5195. smalltalk.addMethod(aMethod, self);
  5196. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  5197. args: ["aMethod"],
  5198. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  5199. messageSends: [],
  5200. referencedClasses: []
  5201. }),
  5202. globals.Behavior);
  5203. smalltalk.addMethod(
  5204. smalltalk.method({
  5205. selector: "basicNew",
  5206. protocol: 'instance creation',
  5207. fn: function (){
  5208. var self=this;
  5209. return smalltalk.withContext(function($ctx1) {
  5210. return new self.fn();
  5211. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},globals.Behavior)})},
  5212. args: [],
  5213. source: "basicNew\x0a\x09<return new self.fn()>",
  5214. messageSends: [],
  5215. referencedClasses: []
  5216. }),
  5217. globals.Behavior);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "basicRemoveCompiledMethod:",
  5221. protocol: 'private',
  5222. fn: function (aMethod){
  5223. var self=this;
  5224. return smalltalk.withContext(function($ctx1) {
  5225. smalltalk.removeMethod(aMethod,self);
  5226. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  5227. args: ["aMethod"],
  5228. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  5229. messageSends: [],
  5230. referencedClasses: []
  5231. }),
  5232. globals.Behavior);
  5233. smalltalk.addMethod(
  5234. smalltalk.method({
  5235. selector: "canUnderstand:",
  5236. protocol: 'testing',
  5237. fn: function (aSelector){
  5238. var self=this;
  5239. return smalltalk.withContext(function($ctx1) {
  5240. var $3,$2,$1;
  5241. $1=_st(self._includesSelector_(_st(aSelector)._asString()))._or_((function(){
  5242. return smalltalk.withContext(function($ctx2) {
  5243. $3=self._superclass();
  5244. $ctx2.sendIdx["superclass"]=1;
  5245. $2=_st($3)._notNil();
  5246. return _st($2)._and_((function(){
  5247. return smalltalk.withContext(function($ctx3) {
  5248. return _st(self._superclass())._canUnderstand_(aSelector);
  5249. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  5250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5251. return $1;
  5252. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},globals.Behavior)})},
  5253. args: ["aSelector"],
  5254. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5255. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
  5256. referencedClasses: []
  5257. }),
  5258. globals.Behavior);
  5259. smalltalk.addMethod(
  5260. smalltalk.method({
  5261. selector: "comment",
  5262. protocol: 'accessing',
  5263. fn: function (){
  5264. var self=this;
  5265. return smalltalk.withContext(function($ctx1) {
  5266. var $2,$1;
  5267. $2=self._basicAt_("comment");
  5268. if(($receiver = $2) == nil || $receiver == null){
  5269. $1="";
  5270. } else {
  5271. $1=$2;
  5272. };
  5273. return $1;
  5274. }, function($ctx1) {$ctx1.fill(self,"comment",{},globals.Behavior)})},
  5275. args: [],
  5276. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5277. messageSends: ["ifNil:", "basicAt:"],
  5278. referencedClasses: []
  5279. }),
  5280. globals.Behavior);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "comment:",
  5284. protocol: 'accessing',
  5285. fn: function (aString){
  5286. var self=this;
  5287. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5288. function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5289. return smalltalk.withContext(function($ctx1) {
  5290. var $1,$2;
  5291. self._basicAt_put_("comment",aString);
  5292. $1=_st($ClassCommentChanged())._new();
  5293. _st($1)._theClass_(self);
  5294. $2=_st($1)._yourself();
  5295. _st(_st($SystemAnnouncer())._current())._announce_($2);
  5296. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},globals.Behavior)})},
  5297. args: ["aString"],
  5298. 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)",
  5299. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"],
  5300. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"]
  5301. }),
  5302. globals.Behavior);
  5303. smalltalk.addMethod(
  5304. smalltalk.method({
  5305. selector: "commentStamp",
  5306. protocol: 'accessing',
  5307. fn: function (){
  5308. var self=this;
  5309. function $ClassCommentReader(){return globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  5310. return smalltalk.withContext(function($ctx1) {
  5311. var $2,$3,$1;
  5312. $2=_st($ClassCommentReader())._new();
  5313. _st($2)._class_(self);
  5314. $3=_st($2)._yourself();
  5315. $1=$3;
  5316. return $1;
  5317. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},globals.Behavior)})},
  5318. args: [],
  5319. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5320. messageSends: ["class:", "new", "yourself"],
  5321. referencedClasses: ["ClassCommentReader"]
  5322. }),
  5323. globals.Behavior);
  5324. smalltalk.addMethod(
  5325. smalltalk.method({
  5326. selector: "commentStamp:prior:",
  5327. protocol: 'accessing',
  5328. fn: function (aStamp,prior){
  5329. var self=this;
  5330. return smalltalk.withContext(function($ctx1) {
  5331. var $1;
  5332. $1=self._commentStamp();
  5333. return $1;
  5334. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},globals.Behavior)})},
  5335. args: ["aStamp", "prior"],
  5336. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  5337. messageSends: ["commentStamp"],
  5338. referencedClasses: []
  5339. }),
  5340. globals.Behavior);
  5341. smalltalk.addMethod(
  5342. smalltalk.method({
  5343. selector: "compile:",
  5344. protocol: 'compiling',
  5345. fn: function (aString){
  5346. var self=this;
  5347. return smalltalk.withContext(function($ctx1) {
  5348. var $1;
  5349. $1=self._compile_protocol_(aString,"");
  5350. return $1;
  5351. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Behavior)})},
  5352. args: ["aString"],
  5353. source: "compile: aString\x0a\x09^ self compile: aString protocol: ''",
  5354. messageSends: ["compile:protocol:"],
  5355. referencedClasses: []
  5356. }),
  5357. globals.Behavior);
  5358. smalltalk.addMethod(
  5359. smalltalk.method({
  5360. selector: "compile:protocol:",
  5361. protocol: 'compiling',
  5362. fn: function (aString,anotherString){
  5363. var self=this;
  5364. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5365. return smalltalk.withContext(function($ctx1) {
  5366. var $1;
  5367. $1=_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5368. return $1;
  5369. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},globals.Behavior)})},
  5370. args: ["aString", "anotherString"],
  5371. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5372. messageSends: ["install:forClass:protocol:", "new"],
  5373. referencedClasses: ["Compiler"]
  5374. }),
  5375. globals.Behavior);
  5376. smalltalk.addMethod(
  5377. smalltalk.method({
  5378. selector: "definition",
  5379. protocol: 'accessing',
  5380. fn: function (){
  5381. var self=this;
  5382. return "";
  5383. },
  5384. args: [],
  5385. source: "definition\x0a\x09^ ''",
  5386. messageSends: [],
  5387. referencedClasses: []
  5388. }),
  5389. globals.Behavior);
  5390. smalltalk.addMethod(
  5391. smalltalk.method({
  5392. selector: "includesBehavior:",
  5393. protocol: 'testing',
  5394. fn: function (aClass){
  5395. var self=this;
  5396. return smalltalk.withContext(function($ctx1) {
  5397. var $1;
  5398. $1=_st(self.__eq_eq(aClass))._or_((function(){
  5399. return smalltalk.withContext(function($ctx2) {
  5400. return self._inheritsFrom_(aClass);
  5401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5402. return $1;
  5403. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},globals.Behavior)})},
  5404. args: ["aClass"],
  5405. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5406. messageSends: ["or:", "==", "inheritsFrom:"],
  5407. referencedClasses: []
  5408. }),
  5409. globals.Behavior);
  5410. smalltalk.addMethod(
  5411. smalltalk.method({
  5412. selector: "includesSelector:",
  5413. protocol: 'testing',
  5414. fn: function (aString){
  5415. var self=this;
  5416. return smalltalk.withContext(function($ctx1) {
  5417. var $1;
  5418. $1=_st(self._methodDictionary())._includesKey_(aString);
  5419. return $1;
  5420. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},globals.Behavior)})},
  5421. args: ["aString"],
  5422. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5423. messageSends: ["includesKey:", "methodDictionary"],
  5424. referencedClasses: []
  5425. }),
  5426. globals.Behavior);
  5427. smalltalk.addMethod(
  5428. smalltalk.method({
  5429. selector: "inheritsFrom:",
  5430. protocol: 'testing',
  5431. fn: function (aClass){
  5432. var self=this;
  5433. return smalltalk.withContext(function($ctx1) {
  5434. var $1,$4,$3,$2;
  5435. $1=self._superclass();
  5436. $ctx1.sendIdx["superclass"]=1;
  5437. if(($receiver = $1) == nil || $receiver == null){
  5438. return false;
  5439. } else {
  5440. $1;
  5441. };
  5442. $4=self._superclass();
  5443. $ctx1.sendIdx["superclass"]=2;
  5444. $3=_st(aClass).__eq_eq($4);
  5445. $2=_st($3)._or_((function(){
  5446. return smalltalk.withContext(function($ctx2) {
  5447. return _st(self._superclass())._inheritsFrom_(aClass);
  5448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5449. return $2;
  5450. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},globals.Behavior)})},
  5451. args: ["aClass"],
  5452. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5453. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"],
  5454. referencedClasses: []
  5455. }),
  5456. globals.Behavior);
  5457. smalltalk.addMethod(
  5458. smalltalk.method({
  5459. selector: "instanceVariableNames",
  5460. protocol: 'accessing',
  5461. fn: function (){
  5462. var self=this;
  5463. return smalltalk.withContext(function($ctx1) {
  5464. return self.iVarNames;
  5465. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},globals.Behavior)})},
  5466. args: [],
  5467. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5468. messageSends: [],
  5469. referencedClasses: []
  5470. }),
  5471. globals.Behavior);
  5472. smalltalk.addMethod(
  5473. smalltalk.method({
  5474. selector: "isBehavior",
  5475. protocol: 'testing',
  5476. fn: function (){
  5477. var self=this;
  5478. return true;
  5479. },
  5480. args: [],
  5481. source: "isBehavior\x0a\x09^ true",
  5482. messageSends: [],
  5483. referencedClasses: []
  5484. }),
  5485. globals.Behavior);
  5486. smalltalk.addMethod(
  5487. smalltalk.method({
  5488. selector: "javascriptConstructor",
  5489. protocol: 'accessing',
  5490. fn: function (){
  5491. var self=this;
  5492. return smalltalk.withContext(function($ctx1) {
  5493. return self.fn;
  5494. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},globals.Behavior)})},
  5495. args: [],
  5496. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5497. messageSends: [],
  5498. referencedClasses: []
  5499. }),
  5500. globals.Behavior);
  5501. smalltalk.addMethod(
  5502. smalltalk.method({
  5503. selector: "javascriptConstructor:",
  5504. protocol: 'accessing',
  5505. fn: function (aJavaScriptFunction){
  5506. var self=this;
  5507. return smalltalk.withContext(function($ctx1) {
  5508. smalltalk.setClassConstructor(self, aJavaScriptFunction);;
  5509. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},globals.Behavior)})},
  5510. args: ["aJavaScriptFunction"],
  5511. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `smalltalk.setClassConstructor'\x22\x0a\x09\x0a\x09<smalltalk.setClassConstructor(self, aJavaScriptFunction);>",
  5512. messageSends: [],
  5513. referencedClasses: []
  5514. }),
  5515. globals.Behavior);
  5516. smalltalk.addMethod(
  5517. smalltalk.method({
  5518. selector: "lookupSelector:",
  5519. protocol: 'accessing',
  5520. fn: function (selector){
  5521. var self=this;
  5522. var lookupClass;
  5523. return smalltalk.withContext(function($ctx1) {
  5524. var $1,$2;
  5525. var $early={};
  5526. try {
  5527. lookupClass=self;
  5528. _st((function(){
  5529. return smalltalk.withContext(function($ctx2) {
  5530. return _st(lookupClass).__eq(nil);
  5531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5532. return smalltalk.withContext(function($ctx2) {
  5533. $1=_st(lookupClass)._includesSelector_(selector);
  5534. if(smalltalk.assert($1)){
  5535. $2=_st(lookupClass)._methodAt_(selector);
  5536. throw $early=[$2];
  5537. };
  5538. lookupClass=_st(lookupClass)._superclass();
  5539. return lookupClass;
  5540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5541. return nil;
  5542. }
  5543. catch(e) {if(e===$early)return e[0]; throw e}
  5544. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},globals.Behavior)})},
  5545. args: ["selector"],
  5546. 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",
  5547. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"],
  5548. referencedClasses: []
  5549. }),
  5550. globals.Behavior);
  5551. smalltalk.addMethod(
  5552. smalltalk.method({
  5553. selector: "methodAt:",
  5554. protocol: 'accessing',
  5555. fn: function (aString){
  5556. var self=this;
  5557. return smalltalk.withContext(function($ctx1) {
  5558. var $1;
  5559. $1=_st(self._methodDictionary())._at_(aString);
  5560. return $1;
  5561. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},globals.Behavior)})},
  5562. args: ["aString"],
  5563. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5564. messageSends: ["at:", "methodDictionary"],
  5565. referencedClasses: []
  5566. }),
  5567. globals.Behavior);
  5568. smalltalk.addMethod(
  5569. smalltalk.method({
  5570. selector: "methodDictionary",
  5571. protocol: 'accessing',
  5572. fn: function (){
  5573. var self=this;
  5574. return smalltalk.withContext(function($ctx1) {
  5575. var dict = globals.HashedCollection._new();
  5576. var methods = self.methods;
  5577. Object.keys(methods).forEach(function(i) {
  5578. if(methods[i].selector) {
  5579. dict._at_put_(methods[i].selector, methods[i]);
  5580. }
  5581. });
  5582. return dict;
  5583. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},globals.Behavior)})},
  5584. args: [],
  5585. 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>",
  5586. messageSends: [],
  5587. referencedClasses: []
  5588. }),
  5589. globals.Behavior);
  5590. smalltalk.addMethod(
  5591. smalltalk.method({
  5592. selector: "methodTemplate",
  5593. protocol: 'accessing',
  5594. fn: function (){
  5595. var self=this;
  5596. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5597. return smalltalk.withContext(function($ctx1) {
  5598. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5599. $1=_st($String())._streamContents_((function(stream){
  5600. return smalltalk.withContext(function($ctx2) {
  5601. _st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5602. $ctx2.sendIdx["nextPutAll:"]=1;
  5603. $3=_st($String())._lf();
  5604. $ctx2.sendIdx["lf"]=1;
  5605. $4=_st($String())._tab();
  5606. $ctx2.sendIdx["tab"]=1;
  5607. $2=_st($3).__comma($4);
  5608. $ctx2.sendIdx[","]=1;
  5609. _st(stream)._nextPutAll_($2);
  5610. $ctx2.sendIdx["nextPutAll:"]=2;
  5611. _st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5612. $ctx2.sendIdx["nextPutAll:"]=3;
  5613. $7=_st($String())._lf();
  5614. $ctx2.sendIdx["lf"]=2;
  5615. $8=_st($String())._lf();
  5616. $ctx2.sendIdx["lf"]=3;
  5617. $6=_st($7).__comma($8);
  5618. $ctx2.sendIdx[","]=3;
  5619. $9=_st($String())._tab();
  5620. $ctx2.sendIdx["tab"]=2;
  5621. $5=_st($6).__comma($9);
  5622. $ctx2.sendIdx[","]=2;
  5623. _st(stream)._nextPutAll_($5);
  5624. $ctx2.sendIdx["nextPutAll:"]=4;
  5625. _st(stream)._nextPutAll_("| temporary variable names |");
  5626. $ctx2.sendIdx["nextPutAll:"]=5;
  5627. _st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  5628. $ctx2.sendIdx["nextPutAll:"]=6;
  5629. $10=_st(stream)._nextPutAll_("statements");
  5630. return $10;
  5631. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  5632. return $1;
  5633. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)})},
  5634. args: [],
  5635. 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' ]",
  5636. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"],
  5637. referencedClasses: ["String"]
  5638. }),
  5639. globals.Behavior);
  5640. smalltalk.addMethod(
  5641. smalltalk.method({
  5642. selector: "methods",
  5643. protocol: 'accessing',
  5644. fn: function (){
  5645. var self=this;
  5646. return smalltalk.withContext(function($ctx1) {
  5647. var $1;
  5648. $1=_st(self._methodDictionary())._values();
  5649. return $1;
  5650. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.Behavior)})},
  5651. args: [],
  5652. source: "methods\x0a\x09^ self methodDictionary values",
  5653. messageSends: ["values", "methodDictionary"],
  5654. referencedClasses: []
  5655. }),
  5656. globals.Behavior);
  5657. smalltalk.addMethod(
  5658. smalltalk.method({
  5659. selector: "methodsFor:",
  5660. protocol: 'accessing',
  5661. fn: function (aString){
  5662. var self=this;
  5663. function $ClassCategoryReader(){return globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  5664. return smalltalk.withContext(function($ctx1) {
  5665. var $2,$3,$1;
  5666. $2=_st($ClassCategoryReader())._new();
  5667. _st($2)._class_category_(self,aString);
  5668. $3=_st($2)._yourself();
  5669. $1=$3;
  5670. return $1;
  5671. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},globals.Behavior)})},
  5672. args: ["aString"],
  5673. source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  5674. messageSends: ["class:category:", "new", "yourself"],
  5675. referencedClasses: ["ClassCategoryReader"]
  5676. }),
  5677. globals.Behavior);
  5678. smalltalk.addMethod(
  5679. smalltalk.method({
  5680. selector: "methodsFor:stamp:",
  5681. protocol: 'accessing',
  5682. fn: function (aString,aStamp){
  5683. var self=this;
  5684. return smalltalk.withContext(function($ctx1) {
  5685. var $1;
  5686. $1=self._methodsFor_(aString);
  5687. return $1;
  5688. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},globals.Behavior)})},
  5689. args: ["aString", "aStamp"],
  5690. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  5691. messageSends: ["methodsFor:"],
  5692. referencedClasses: []
  5693. }),
  5694. globals.Behavior);
  5695. smalltalk.addMethod(
  5696. smalltalk.method({
  5697. selector: "methodsInProtocol:",
  5698. protocol: 'accessing',
  5699. fn: function (aString){
  5700. var self=this;
  5701. return smalltalk.withContext(function($ctx1) {
  5702. var $1;
  5703. $1=_st(self._methods())._select_((function(each){
  5704. return smalltalk.withContext(function($ctx2) {
  5705. return _st(_st(each)._protocol()).__eq(aString);
  5706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5707. return $1;
  5708. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.Behavior)})},
  5709. args: ["aString"],
  5710. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  5711. messageSends: ["select:", "methods", "=", "protocol"],
  5712. referencedClasses: []
  5713. }),
  5714. globals.Behavior);
  5715. smalltalk.addMethod(
  5716. smalltalk.method({
  5717. selector: "name",
  5718. protocol: 'accessing',
  5719. fn: function (){
  5720. var self=this;
  5721. return smalltalk.withContext(function($ctx1) {
  5722. return self.className || nil;
  5723. return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Behavior)})},
  5724. args: [],
  5725. source: "name\x0a\x09<return self.className || nil>",
  5726. messageSends: [],
  5727. referencedClasses: []
  5728. }),
  5729. globals.Behavior);
  5730. smalltalk.addMethod(
  5731. smalltalk.method({
  5732. selector: "new",
  5733. protocol: 'instance creation',
  5734. fn: function (){
  5735. var self=this;
  5736. return smalltalk.withContext(function($ctx1) {
  5737. var $1;
  5738. $1=_st(self._basicNew())._initialize();
  5739. return $1;
  5740. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Behavior)})},
  5741. args: [],
  5742. source: "new\x0a\x09^ self basicNew initialize",
  5743. messageSends: ["initialize", "basicNew"],
  5744. referencedClasses: []
  5745. }),
  5746. globals.Behavior);
  5747. smalltalk.addMethod(
  5748. smalltalk.method({
  5749. selector: "organization",
  5750. protocol: 'accessing',
  5751. fn: function (){
  5752. var self=this;
  5753. return smalltalk.withContext(function($ctx1) {
  5754. var $1;
  5755. $1=self._basicAt_("organization");
  5756. return $1;
  5757. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Behavior)})},
  5758. args: [],
  5759. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5760. messageSends: ["basicAt:"],
  5761. referencedClasses: []
  5762. }),
  5763. globals.Behavior);
  5764. smalltalk.addMethod(
  5765. smalltalk.method({
  5766. selector: "ownMethods",
  5767. protocol: 'accessing',
  5768. fn: function (){
  5769. var self=this;
  5770. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5771. return smalltalk.withContext(function($ctx1) {
  5772. var $2,$1;
  5773. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  5774. return smalltalk.withContext(function($ctx2) {
  5775. return _st(acc).__comma(self._methodsInProtocol_(each));
  5776. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})})))._sorted_((function(a,b){
  5777. return smalltalk.withContext(function($ctx2) {
  5778. $2=_st(a)._selector();
  5779. $ctx2.sendIdx["selector"]=1;
  5780. return _st($2).__lt_eq(_st(b)._selector());
  5781. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}));
  5782. return $1;
  5783. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},globals.Behavior)})},
  5784. args: [],
  5785. 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 ]",
  5786. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"],
  5787. referencedClasses: ["OrderedCollection"]
  5788. }),
  5789. globals.Behavior);
  5790. smalltalk.addMethod(
  5791. smalltalk.method({
  5792. selector: "ownProtocols",
  5793. protocol: 'accessing',
  5794. fn: function (){
  5795. var self=this;
  5796. return smalltalk.withContext(function($ctx1) {
  5797. var $1;
  5798. $1=_st(self._protocols())._reject_((function(each){
  5799. return smalltalk.withContext(function($ctx2) {
  5800. return _st(each)._match_("^\x5c*");
  5801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5802. return $1;
  5803. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},globals.Behavior)})},
  5804. args: [],
  5805. 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*' ]",
  5806. messageSends: ["reject:", "protocols", "match:"],
  5807. referencedClasses: []
  5808. }),
  5809. globals.Behavior);
  5810. smalltalk.addMethod(
  5811. smalltalk.method({
  5812. selector: "protocols",
  5813. protocol: 'accessing',
  5814. fn: function (){
  5815. var self=this;
  5816. return smalltalk.withContext(function($ctx1) {
  5817. var $1;
  5818. $1=_st(_st(self._organization())._elements())._sorted();
  5819. return $1;
  5820. }, function($ctx1) {$ctx1.fill(self,"protocols",{},globals.Behavior)})},
  5821. args: [],
  5822. source: "protocols\x0a\x09^ self organization elements sorted",
  5823. messageSends: ["sorted", "elements", "organization"],
  5824. referencedClasses: []
  5825. }),
  5826. globals.Behavior);
  5827. smalltalk.addMethod(
  5828. smalltalk.method({
  5829. selector: "protocolsDo:",
  5830. protocol: 'enumerating',
  5831. fn: function (aBlock){
  5832. var self=this;
  5833. var methodsByProtocol;
  5834. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  5835. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  5836. return smalltalk.withContext(function($ctx1) {
  5837. methodsByProtocol=_st($HashedCollection())._new();
  5838. $ctx1.sendIdx["new"]=1;
  5839. _st(self._methodDictionary())._valuesDo_((function(m){
  5840. return smalltalk.withContext(function($ctx2) {
  5841. return _st(_st(methodsByProtocol)._at_ifAbsentPut_(_st(m)._protocol(),(function(){
  5842. return smalltalk.withContext(function($ctx3) {
  5843. return _st($Array())._new();
  5844. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._add_(m);
  5845. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
  5846. _st(self._protocols())._do_((function(protocol){
  5847. return smalltalk.withContext(function($ctx2) {
  5848. return _st(aBlock)._value_value_(protocol,_st(methodsByProtocol)._at_(protocol));
  5849. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)})}));
  5850. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},globals.Behavior)})},
  5851. args: ["aBlock"],
  5852. 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) ]",
  5853. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"],
  5854. referencedClasses: ["HashedCollection", "Array"]
  5855. }),
  5856. globals.Behavior);
  5857. smalltalk.addMethod(
  5858. smalltalk.method({
  5859. selector: "prototype",
  5860. protocol: 'accessing',
  5861. fn: function (){
  5862. var self=this;
  5863. return smalltalk.withContext(function($ctx1) {
  5864. return self.fn.prototype;
  5865. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},globals.Behavior)})},
  5866. args: [],
  5867. source: "prototype\x0a\x09<return self.fn.prototype>",
  5868. messageSends: [],
  5869. referencedClasses: []
  5870. }),
  5871. globals.Behavior);
  5872. smalltalk.addMethod(
  5873. smalltalk.method({
  5874. selector: "recompile",
  5875. protocol: 'compiling',
  5876. fn: function (){
  5877. var self=this;
  5878. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5879. return smalltalk.withContext(function($ctx1) {
  5880. var $1;
  5881. $1=_st(_st($Compiler())._new())._recompile_(self);
  5882. return $1;
  5883. }, function($ctx1) {$ctx1.fill(self,"recompile",{},globals.Behavior)})},
  5884. args: [],
  5885. source: "recompile\x0a\x09^ Compiler new recompile: self",
  5886. messageSends: ["recompile:", "new"],
  5887. referencedClasses: ["Compiler"]
  5888. }),
  5889. globals.Behavior);
  5890. smalltalk.addMethod(
  5891. smalltalk.method({
  5892. selector: "removeCompiledMethod:",
  5893. protocol: 'compiling',
  5894. fn: function (aMethod){
  5895. var self=this;
  5896. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5897. function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  5898. return smalltalk.withContext(function($ctx1) {
  5899. var $1,$2;
  5900. self._basicRemoveCompiledMethod_(aMethod);
  5901. self._removeProtocolIfEmpty_(_st(aMethod)._protocol());
  5902. $1=_st($MethodRemoved())._new();
  5903. _st($1)._method_(aMethod);
  5904. $2=_st($1)._yourself();
  5905. _st(_st($SystemAnnouncer())._current())._announce_($2);
  5906. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  5907. args: ["aMethod"],
  5908. 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)",
  5909. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"],
  5910. referencedClasses: ["SystemAnnouncer", "MethodRemoved"]
  5911. }),
  5912. globals.Behavior);
  5913. smalltalk.addMethod(
  5914. smalltalk.method({
  5915. selector: "removeProtocolIfEmpty:",
  5916. protocol: 'accessing',
  5917. fn: function (aString){
  5918. var self=this;
  5919. return smalltalk.withContext(function($ctx1) {
  5920. _st(self._methods())._detect_ifNone_((function(each){
  5921. return smalltalk.withContext(function($ctx2) {
  5922. return _st(_st(each)._protocol()).__eq(aString);
  5923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  5924. return smalltalk.withContext(function($ctx2) {
  5925. return _st(self._organization())._removeElement_(aString);
  5926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5927. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},globals.Behavior)})},
  5928. args: ["aString"],
  5929. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  5930. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"],
  5931. referencedClasses: []
  5932. }),
  5933. globals.Behavior);
  5934. smalltalk.addMethod(
  5935. smalltalk.method({
  5936. selector: "selectors",
  5937. protocol: 'accessing',
  5938. fn: function (){
  5939. var self=this;
  5940. return smalltalk.withContext(function($ctx1) {
  5941. var $1;
  5942. $1=_st(self._methodDictionary())._keys();
  5943. return $1;
  5944. }, function($ctx1) {$ctx1.fill(self,"selectors",{},globals.Behavior)})},
  5945. args: [],
  5946. source: "selectors\x0a\x09^ self methodDictionary keys",
  5947. messageSends: ["keys", "methodDictionary"],
  5948. referencedClasses: []
  5949. }),
  5950. globals.Behavior);
  5951. smalltalk.addMethod(
  5952. smalltalk.method({
  5953. selector: "subclasses",
  5954. protocol: 'accessing',
  5955. fn: function (){
  5956. var self=this;
  5957. return smalltalk.withContext(function($ctx1) {
  5958. self._subclassResponsibility();
  5959. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Behavior)})},
  5960. args: [],
  5961. source: "subclasses\x0a\x09self subclassResponsibility",
  5962. messageSends: ["subclassResponsibility"],
  5963. referencedClasses: []
  5964. }),
  5965. globals.Behavior);
  5966. smalltalk.addMethod(
  5967. smalltalk.method({
  5968. selector: "superclass",
  5969. protocol: 'accessing',
  5970. fn: function (){
  5971. var self=this;
  5972. return smalltalk.withContext(function($ctx1) {
  5973. return self.superclass || nil;
  5974. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},globals.Behavior)})},
  5975. args: [],
  5976. source: "superclass\x0a\x09<return self.superclass || nil>",
  5977. messageSends: [],
  5978. referencedClasses: []
  5979. }),
  5980. globals.Behavior);
  5981. smalltalk.addMethod(
  5982. smalltalk.method({
  5983. selector: "theMetaClass",
  5984. protocol: 'accessing',
  5985. fn: function (){
  5986. var self=this;
  5987. return smalltalk.withContext(function($ctx1) {
  5988. var $1;
  5989. $1=self._class();
  5990. return $1;
  5991. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},globals.Behavior)})},
  5992. args: [],
  5993. source: "theMetaClass\x0a\x09^ self class",
  5994. messageSends: ["class"],
  5995. referencedClasses: []
  5996. }),
  5997. globals.Behavior);
  5998. smalltalk.addMethod(
  5999. smalltalk.method({
  6000. selector: "theNonMetaClass",
  6001. protocol: 'accessing',
  6002. fn: function (){
  6003. var self=this;
  6004. return self;
  6005. },
  6006. args: [],
  6007. source: "theNonMetaClass\x0a\x09^ self",
  6008. messageSends: [],
  6009. referencedClasses: []
  6010. }),
  6011. globals.Behavior);
  6012. smalltalk.addMethod(
  6013. smalltalk.method({
  6014. selector: "withAllSubclasses",
  6015. protocol: 'accessing',
  6016. fn: function (){
  6017. var self=this;
  6018. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  6019. return smalltalk.withContext(function($ctx1) {
  6020. var $2,$3,$1;
  6021. $2=_st($Array())._with_(self);
  6022. _st($2)._addAll_(self._allSubclasses());
  6023. $3=_st($2)._yourself();
  6024. $1=$3;
  6025. return $1;
  6026. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},globals.Behavior)})},
  6027. args: [],
  6028. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6029. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"],
  6030. referencedClasses: ["Array"]
  6031. }),
  6032. globals.Behavior);
  6033. smalltalk.addClass('Class', globals.Behavior, [], 'Kernel-Classes');
  6034. 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.";
  6035. smalltalk.addMethod(
  6036. smalltalk.method({
  6037. selector: "asJavascript",
  6038. protocol: 'converting',
  6039. fn: function (){
  6040. var self=this;
  6041. return smalltalk.withContext(function($ctx1) {
  6042. var $1;
  6043. $1="globals.".__comma(self._name());
  6044. return $1;
  6045. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Class)})},
  6046. args: [],
  6047. source: "asJavascript\x0a\x09^ 'globals.', self name",
  6048. messageSends: [",", "name"],
  6049. referencedClasses: []
  6050. }),
  6051. globals.Class);
  6052. smalltalk.addMethod(
  6053. smalltalk.method({
  6054. selector: "category",
  6055. protocol: 'accessing',
  6056. fn: function (){
  6057. var self=this;
  6058. return smalltalk.withContext(function($ctx1) {
  6059. var $2,$1;
  6060. $2=self._package();
  6061. $ctx1.sendIdx["package"]=1;
  6062. if(($receiver = $2) == nil || $receiver == null){
  6063. $1="Unclassified";
  6064. } else {
  6065. $1=_st(self._package())._name();
  6066. };
  6067. return $1;
  6068. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.Class)})},
  6069. args: [],
  6070. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6071. messageSends: ["ifNil:ifNotNil:", "package", "name"],
  6072. referencedClasses: []
  6073. }),
  6074. globals.Class);
  6075. smalltalk.addMethod(
  6076. smalltalk.method({
  6077. selector: "definition",
  6078. protocol: 'accessing',
  6079. fn: function (){
  6080. var self=this;
  6081. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6082. return smalltalk.withContext(function($ctx1) {
  6083. var $3,$4,$2,$5,$6,$7,$1;
  6084. $1=_st($String())._streamContents_((function(stream){
  6085. return smalltalk.withContext(function($ctx2) {
  6086. _st(stream)._nextPutAll_(_st(self._superclass())._asString());
  6087. $ctx2.sendIdx["nextPutAll:"]=1;
  6088. _st(stream)._nextPutAll_(" subclass: #");
  6089. $ctx2.sendIdx["nextPutAll:"]=2;
  6090. _st(stream)._nextPutAll_(self._name());
  6091. $ctx2.sendIdx["nextPutAll:"]=3;
  6092. $3=_st($String())._lf();
  6093. $ctx2.sendIdx["lf"]=1;
  6094. $4=_st($String())._tab();
  6095. $ctx2.sendIdx["tab"]=1;
  6096. $2=_st($3).__comma($4);
  6097. $ctx2.sendIdx[","]=1;
  6098. _st(stream)._nextPutAll_($2);
  6099. $ctx2.sendIdx["nextPutAll:"]=4;
  6100. $5=_st(stream)._nextPutAll_("instanceVariableNames: '");
  6101. $ctx2.sendIdx["nextPutAll:"]=5;
  6102. $5;
  6103. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  6104. return smalltalk.withContext(function($ctx3) {
  6105. return _st(stream)._nextPutAll_(each);
  6106. $ctx3.sendIdx["nextPutAll:"]=6;
  6107. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  6108. return smalltalk.withContext(function($ctx3) {
  6109. return _st(stream)._nextPutAll_(" ");
  6110. $ctx3.sendIdx["nextPutAll:"]=7;
  6111. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  6112. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  6113. $ctx2.sendIdx[","]=2;
  6114. _st(stream)._nextPutAll_($6);
  6115. $ctx2.sendIdx["nextPutAll:"]=8;
  6116. _st(stream)._nextPutAll_("package: '");
  6117. $ctx2.sendIdx["nextPutAll:"]=9;
  6118. _st(stream)._nextPutAll_(self._category());
  6119. $ctx2.sendIdx["nextPutAll:"]=10;
  6120. $7=_st(stream)._nextPutAll_("'");
  6121. return $7;
  6122. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  6123. return $1;
  6124. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Class)})},
  6125. args: [],
  6126. 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: '''' ]",
  6127. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"],
  6128. referencedClasses: ["String"]
  6129. }),
  6130. globals.Class);
  6131. smalltalk.addMethod(
  6132. smalltalk.method({
  6133. selector: "isClass",
  6134. protocol: 'testing',
  6135. fn: function (){
  6136. var self=this;
  6137. return true;
  6138. },
  6139. args: [],
  6140. source: "isClass\x0a\x09^ true",
  6141. messageSends: [],
  6142. referencedClasses: []
  6143. }),
  6144. globals.Class);
  6145. smalltalk.addMethod(
  6146. smalltalk.method({
  6147. selector: "package",
  6148. protocol: 'accessing',
  6149. fn: function (){
  6150. var self=this;
  6151. return smalltalk.withContext(function($ctx1) {
  6152. var $1;
  6153. $1=self._basicAt_("pkg");
  6154. return $1;
  6155. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Class)})},
  6156. args: [],
  6157. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6158. messageSends: ["basicAt:"],
  6159. referencedClasses: []
  6160. }),
  6161. globals.Class);
  6162. smalltalk.addMethod(
  6163. smalltalk.method({
  6164. selector: "package:",
  6165. protocol: 'accessing',
  6166. fn: function (aPackage){
  6167. var self=this;
  6168. var oldPackage;
  6169. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6170. function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6171. return smalltalk.withContext(function($ctx1) {
  6172. var $2,$1,$3,$4,$5;
  6173. $2=self._package();
  6174. $ctx1.sendIdx["package"]=1;
  6175. $1=_st($2).__eq(aPackage);
  6176. if(smalltalk.assert($1)){
  6177. return self;
  6178. };
  6179. oldPackage=self._package();
  6180. self._basicAt_put_("pkg",aPackage);
  6181. $3=_st(oldPackage)._organization();
  6182. $ctx1.sendIdx["organization"]=1;
  6183. _st($3)._removeElement_(self);
  6184. _st(_st(aPackage)._organization())._addElement_(self);
  6185. $4=_st($ClassMoved())._new();
  6186. _st($4)._theClass_(self);
  6187. _st($4)._oldPackage_(oldPackage);
  6188. $5=_st($4)._yourself();
  6189. _st(_st($SystemAnnouncer())._current())._announce_($5);
  6190. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},globals.Class)})},
  6191. args: ["aPackage"],
  6192. 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)",
  6193. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"],
  6194. referencedClasses: ["SystemAnnouncer", "ClassMoved"]
  6195. }),
  6196. globals.Class);
  6197. smalltalk.addMethod(
  6198. smalltalk.method({
  6199. selector: "printOn:",
  6200. protocol: 'printing',
  6201. fn: function (aStream){
  6202. var self=this;
  6203. return smalltalk.withContext(function($ctx1) {
  6204. _st(aStream)._nextPutAll_(self._name());
  6205. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Class)})},
  6206. args: ["aStream"],
  6207. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6208. messageSends: ["nextPutAll:", "name"],
  6209. referencedClasses: []
  6210. }),
  6211. globals.Class);
  6212. smalltalk.addMethod(
  6213. smalltalk.method({
  6214. selector: "rename:",
  6215. protocol: 'accessing',
  6216. fn: function (aString){
  6217. var self=this;
  6218. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6219. return smalltalk.withContext(function($ctx1) {
  6220. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  6221. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},globals.Class)})},
  6222. args: ["aString"],
  6223. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6224. messageSends: ["renameClass:to:", "new"],
  6225. referencedClasses: ["ClassBuilder"]
  6226. }),
  6227. globals.Class);
  6228. smalltalk.addMethod(
  6229. smalltalk.method({
  6230. selector: "subclass:instanceVariableNames:",
  6231. protocol: 'class creation',
  6232. fn: function (aString,anotherString){
  6233. var self=this;
  6234. return smalltalk.withContext(function($ctx1) {
  6235. var $1;
  6236. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6237. return $1;
  6238. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.Class)})},
  6239. args: ["aString", "anotherString"],
  6240. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6241. messageSends: ["subclass:instanceVariableNames:package:"],
  6242. referencedClasses: []
  6243. }),
  6244. globals.Class);
  6245. smalltalk.addMethod(
  6246. smalltalk.method({
  6247. selector: "subclass:instanceVariableNames:category:",
  6248. protocol: 'class creation',
  6249. fn: function (aString,aString2,aString3){
  6250. var self=this;
  6251. return smalltalk.withContext(function($ctx1) {
  6252. var $1;
  6253. self._deprecatedAPI();
  6254. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6255. return $1;
  6256. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
  6257. args: ["aString", "aString2", "aString3"],
  6258. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6259. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6260. referencedClasses: []
  6261. }),
  6262. globals.Class);
  6263. smalltalk.addMethod(
  6264. smalltalk.method({
  6265. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6266. protocol: 'class creation',
  6267. fn: function (aString,aString2,classVars,pools,aString3){
  6268. var self=this;
  6269. return smalltalk.withContext(function($ctx1) {
  6270. var $1;
  6271. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6272. return $1;
  6273. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},globals.Class)})},
  6274. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6275. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6276. messageSends: ["subclass:instanceVariableNames:package:"],
  6277. referencedClasses: []
  6278. }),
  6279. globals.Class);
  6280. smalltalk.addMethod(
  6281. smalltalk.method({
  6282. selector: "subclass:instanceVariableNames:package:",
  6283. protocol: 'class creation',
  6284. fn: function (aString,aString2,aString3){
  6285. var self=this;
  6286. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6287. return smalltalk.withContext(function($ctx1) {
  6288. var $1;
  6289. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6290. return $1;
  6291. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
  6292. args: ["aString", "aString2", "aString3"],
  6293. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6294. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  6295. referencedClasses: ["ClassBuilder"]
  6296. }),
  6297. globals.Class);
  6298. smalltalk.addMethod(
  6299. smalltalk.method({
  6300. selector: "subclasses",
  6301. protocol: 'accessing',
  6302. fn: function (){
  6303. var self=this;
  6304. return smalltalk.withContext(function($ctx1) {
  6305. return self.subclasses._copy();
  6306. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Class)})},
  6307. args: [],
  6308. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6309. messageSends: [],
  6310. referencedClasses: []
  6311. }),
  6312. globals.Class);
  6313. smalltalk.addClass('Metaclass', globals.Behavior, [], 'Kernel-Classes');
  6314. 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.";
  6315. smalltalk.addMethod(
  6316. smalltalk.method({
  6317. selector: "asJavascript",
  6318. protocol: 'converting',
  6319. fn: function (){
  6320. var self=this;
  6321. return smalltalk.withContext(function($ctx1) {
  6322. var $1;
  6323. $1=_st("globals.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  6324. $ctx1.sendIdx[","]=1;
  6325. return $1;
  6326. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Metaclass)})},
  6327. args: [],
  6328. source: "asJavascript\x0a\x09^ 'globals.', self instanceClass name, '.klass'",
  6329. messageSends: [",", "name", "instanceClass"],
  6330. referencedClasses: []
  6331. }),
  6332. globals.Metaclass);
  6333. smalltalk.addMethod(
  6334. smalltalk.method({
  6335. selector: "definition",
  6336. protocol: 'accessing',
  6337. fn: function (){
  6338. var self=this;
  6339. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6340. return smalltalk.withContext(function($ctx1) {
  6341. var $2,$1;
  6342. $1=_st($String())._streamContents_((function(stream){
  6343. return smalltalk.withContext(function($ctx2) {
  6344. _st(stream)._nextPutAll_(self._asString());
  6345. $ctx2.sendIdx["nextPutAll:"]=1;
  6346. $2=_st(stream)._nextPutAll_(" instanceVariableNames: '");
  6347. $ctx2.sendIdx["nextPutAll:"]=2;
  6348. $2;
  6349. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  6350. return smalltalk.withContext(function($ctx3) {
  6351. return _st(stream)._nextPutAll_(each);
  6352. $ctx3.sendIdx["nextPutAll:"]=3;
  6353. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  6354. return smalltalk.withContext(function($ctx3) {
  6355. return _st(stream)._nextPutAll_(" ");
  6356. $ctx3.sendIdx["nextPutAll:"]=4;
  6357. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  6358. return _st(stream)._nextPutAll_("'");
  6359. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  6360. return $1;
  6361. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Metaclass)})},
  6362. args: [],
  6363. 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: '''' ]",
  6364. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  6365. referencedClasses: ["String"]
  6366. }),
  6367. globals.Metaclass);
  6368. smalltalk.addMethod(
  6369. smalltalk.method({
  6370. selector: "instanceClass",
  6371. protocol: 'accessing',
  6372. fn: function (){
  6373. var self=this;
  6374. return smalltalk.withContext(function($ctx1) {
  6375. return self.instanceClass;
  6376. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},globals.Metaclass)})},
  6377. args: [],
  6378. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6379. messageSends: [],
  6380. referencedClasses: []
  6381. }),
  6382. globals.Metaclass);
  6383. smalltalk.addMethod(
  6384. smalltalk.method({
  6385. selector: "instanceVariableNames:",
  6386. protocol: 'accessing',
  6387. fn: function (aCollection){
  6388. var self=this;
  6389. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6390. return smalltalk.withContext(function($ctx1) {
  6391. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6392. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},globals.Metaclass)})},
  6393. args: ["aCollection"],
  6394. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6395. messageSends: ["class:instanceVariableNames:", "new"],
  6396. referencedClasses: ["ClassBuilder"]
  6397. }),
  6398. globals.Metaclass);
  6399. smalltalk.addMethod(
  6400. smalltalk.method({
  6401. selector: "isMetaclass",
  6402. protocol: 'testing',
  6403. fn: function (){
  6404. var self=this;
  6405. return true;
  6406. },
  6407. args: [],
  6408. source: "isMetaclass\x0a\x09^ true",
  6409. messageSends: [],
  6410. referencedClasses: []
  6411. }),
  6412. globals.Metaclass);
  6413. smalltalk.addMethod(
  6414. smalltalk.method({
  6415. selector: "package",
  6416. protocol: 'accessing',
  6417. fn: function (){
  6418. var self=this;
  6419. return smalltalk.withContext(function($ctx1) {
  6420. var $1;
  6421. $1=_st(self._instanceClass())._package();
  6422. return $1;
  6423. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Metaclass)})},
  6424. args: [],
  6425. source: "package\x0a\x09^ self instanceClass package",
  6426. messageSends: ["package", "instanceClass"],
  6427. referencedClasses: []
  6428. }),
  6429. globals.Metaclass);
  6430. smalltalk.addMethod(
  6431. smalltalk.method({
  6432. selector: "printOn:",
  6433. protocol: 'printing',
  6434. fn: function (aStream){
  6435. var self=this;
  6436. return smalltalk.withContext(function($ctx1) {
  6437. var $1;
  6438. _st(aStream)._nextPutAll_(_st(self._instanceClass())._name());
  6439. $ctx1.sendIdx["nextPutAll:"]=1;
  6440. $1=_st(aStream)._nextPutAll_(" class");
  6441. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Metaclass)})},
  6442. args: ["aStream"],
  6443. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6444. messageSends: ["nextPutAll:", "name", "instanceClass"],
  6445. referencedClasses: []
  6446. }),
  6447. globals.Metaclass);
  6448. smalltalk.addMethod(
  6449. smalltalk.method({
  6450. selector: "subclasses",
  6451. protocol: 'accessing',
  6452. fn: function (){
  6453. var self=this;
  6454. return smalltalk.withContext(function($ctx1) {
  6455. var $1;
  6456. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  6457. return smalltalk.withContext(function($ctx2) {
  6458. return _st(_st(each)._isMetaclass())._not();
  6459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  6460. return smalltalk.withContext(function($ctx2) {
  6461. return _st(each)._theMetaClass();
  6462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  6463. return $1;
  6464. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Metaclass)})},
  6465. args: [],
  6466. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6467. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"],
  6468. referencedClasses: []
  6469. }),
  6470. globals.Metaclass);
  6471. smalltalk.addMethod(
  6472. smalltalk.method({
  6473. selector: "theMetaClass",
  6474. protocol: 'accessing',
  6475. fn: function (){
  6476. var self=this;
  6477. return self;
  6478. },
  6479. args: [],
  6480. source: "theMetaClass\x0a\x09^ self",
  6481. messageSends: [],
  6482. referencedClasses: []
  6483. }),
  6484. globals.Metaclass);
  6485. smalltalk.addMethod(
  6486. smalltalk.method({
  6487. selector: "theNonMetaClass",
  6488. protocol: 'accessing',
  6489. fn: function (){
  6490. var self=this;
  6491. return smalltalk.withContext(function($ctx1) {
  6492. var $1;
  6493. $1=self._instanceClass();
  6494. return $1;
  6495. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},globals.Metaclass)})},
  6496. args: [],
  6497. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6498. messageSends: ["instanceClass"],
  6499. referencedClasses: []
  6500. }),
  6501. globals.Metaclass);
  6502. smalltalk.addClass('ClassBuilder', globals.Object, [], 'Kernel-Classes');
  6503. 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:`.";
  6504. smalltalk.addMethod(
  6505. smalltalk.method({
  6506. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6507. protocol: 'class definition',
  6508. fn: function (aClass,className,aCollection,packageName){
  6509. var self=this;
  6510. var theClass,thePackage;
  6511. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6512. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  6513. return smalltalk.withContext(function($ctx1) {
  6514. var $1,$2,$3,$4;
  6515. theClass=_st(_st($Smalltalk())._globals())._at_(className);
  6516. thePackage=_st($Package())._named_(packageName);
  6517. $1=theClass;
  6518. if(($receiver = $1) == nil || $receiver == null){
  6519. $1;
  6520. } else {
  6521. _st(theClass)._package_(thePackage);
  6522. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  6523. if(! smalltalk.assert($2)){
  6524. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6525. return $3;
  6526. };
  6527. };
  6528. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6529. return $4;
  6530. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},globals.ClassBuilder)})},
  6531. args: ["aClass", "className", "aCollection", "packageName"],
  6532. 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",
  6533. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  6534. referencedClasses: ["Smalltalk", "Package"]
  6535. }),
  6536. globals.ClassBuilder);
  6537. smalltalk.addMethod(
  6538. smalltalk.method({
  6539. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6540. protocol: 'private',
  6541. fn: function (aClass,aString,aCollection,packageName){
  6542. var self=this;
  6543. return smalltalk.withContext(function($ctx1) {
  6544. smalltalk.addClass(aString, aClass, aCollection, packageName);
  6545. return globals[aString]
  6546. ;
  6547. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},globals.ClassBuilder)})},
  6548. args: ["aClass", "aString", "aCollection", "packageName"],
  6549. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return globals[aString]\x0a\x09>",
  6550. messageSends: [],
  6551. referencedClasses: []
  6552. }),
  6553. globals.ClassBuilder);
  6554. smalltalk.addMethod(
  6555. smalltalk.method({
  6556. selector: "basicClass:instanceVariableNames:",
  6557. protocol: 'private',
  6558. fn: function (aClass,aString){
  6559. var self=this;
  6560. return smalltalk.withContext(function($ctx1) {
  6561. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  6562. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  6563. args: ["aClass", "aString"],
  6564. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6565. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  6566. referencedClasses: []
  6567. }),
  6568. globals.ClassBuilder);
  6569. smalltalk.addMethod(
  6570. smalltalk.method({
  6571. selector: "basicClass:instanceVariables:",
  6572. protocol: 'private',
  6573. fn: function (aClass,aCollection){
  6574. var self=this;
  6575. return smalltalk.withContext(function($ctx1) {
  6576. var $1;
  6577. $1=_st(aClass)._isMetaclass();
  6578. if(! smalltalk.assert($1)){
  6579. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  6580. };
  6581. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  6582. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},globals.ClassBuilder)})},
  6583. args: ["aClass", "aCollection"],
  6584. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6585. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"],
  6586. referencedClasses: []
  6587. }),
  6588. globals.ClassBuilder);
  6589. smalltalk.addMethod(
  6590. smalltalk.method({
  6591. selector: "basicRemoveClass:",
  6592. protocol: 'private',
  6593. fn: function (aClass){
  6594. var self=this;
  6595. return smalltalk.withContext(function($ctx1) {
  6596. smalltalk.removeClass(aClass);
  6597. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},globals.ClassBuilder)})},
  6598. args: ["aClass"],
  6599. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  6600. messageSends: [],
  6601. referencedClasses: []
  6602. }),
  6603. globals.ClassBuilder);
  6604. smalltalk.addMethod(
  6605. smalltalk.method({
  6606. selector: "basicRenameClass:to:",
  6607. protocol: 'private',
  6608. fn: function (aClass,aString){
  6609. var self=this;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. globals[aString] = aClass;
  6612. delete globals[aClass.className];
  6613. aClass.className = aString;
  6614. ;
  6615. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  6616. args: ["aClass", "aString"],
  6617. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09\x09delete globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  6618. messageSends: [],
  6619. referencedClasses: []
  6620. }),
  6621. globals.ClassBuilder);
  6622. smalltalk.addMethod(
  6623. smalltalk.method({
  6624. selector: "basicSwapClassNames:with:",
  6625. protocol: 'private',
  6626. fn: function (aClass,anotherClass){
  6627. var self=this;
  6628. return smalltalk.withContext(function($ctx1) {
  6629. var tmp = aClass.className;
  6630. aClass.className = anotherClass.className;
  6631. anotherClass.className = tmp;
  6632. ;
  6633. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  6634. args: ["aClass", "anotherClass"],
  6635. 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>",
  6636. messageSends: [],
  6637. referencedClasses: []
  6638. }),
  6639. globals.ClassBuilder);
  6640. smalltalk.addMethod(
  6641. smalltalk.method({
  6642. selector: "class:instanceVariableNames:",
  6643. protocol: 'class definition',
  6644. fn: function (aClass,ivarNames){
  6645. var self=this;
  6646. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6647. function $ClassDefinitionChanged(){return globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  6648. return smalltalk.withContext(function($ctx1) {
  6649. var $1,$2;
  6650. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  6651. self._setupClass_(aClass);
  6652. $1=_st($ClassDefinitionChanged())._new();
  6653. _st($1)._theClass_(aClass);
  6654. $2=_st($1)._yourself();
  6655. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6656. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},globals.ClassBuilder)})},
  6657. args: ["aClass", "ivarNames"],
  6658. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  6659. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  6660. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"]
  6661. }),
  6662. globals.ClassBuilder);
  6663. smalltalk.addMethod(
  6664. smalltalk.method({
  6665. selector: "copyClass:named:",
  6666. protocol: 'copying',
  6667. fn: function (aClass,className){
  6668. var self=this;
  6669. var newClass;
  6670. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6671. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6672. return smalltalk.withContext(function($ctx1) {
  6673. var $1,$2,$3;
  6674. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6675. self._copyClass_to_(aClass,newClass);
  6676. $1=_st($ClassAdded())._new();
  6677. _st($1)._theClass_(newClass);
  6678. $2=_st($1)._yourself();
  6679. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6680. $3=newClass;
  6681. return $3;
  6682. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},globals.ClassBuilder)})},
  6683. args: ["aClass", "className"],
  6684. 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",
  6685. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"],
  6686. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  6687. }),
  6688. globals.ClassBuilder);
  6689. smalltalk.addMethod(
  6690. smalltalk.method({
  6691. selector: "copyClass:to:",
  6692. protocol: 'copying',
  6693. fn: function (aClass,anotherClass){
  6694. var self=this;
  6695. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6696. return smalltalk.withContext(function($ctx1) {
  6697. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  6698. _st(anotherClass)._comment_(_st(aClass)._comment());
  6699. $1=_st(aClass)._methodDictionary();
  6700. $ctx1.sendIdx["methodDictionary"]=1;
  6701. _st($1)._valuesDo_((function(each){
  6702. return smalltalk.withContext(function($ctx2) {
  6703. $2=_st($Compiler())._new();
  6704. $ctx2.sendIdx["new"]=1;
  6705. $3=_st(each)._source();
  6706. $ctx2.sendIdx["source"]=1;
  6707. $4=_st(each)._protocol();
  6708. $ctx2.sendIdx["protocol"]=1;
  6709. return _st($2)._install_forClass_protocol_($3,anotherClass,$4);
  6710. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  6711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6712. $ctx1.sendIdx["valuesDo:"]=1;
  6713. $5=_st(anotherClass)._class();
  6714. $ctx1.sendIdx["class"]=1;
  6715. $7=_st(aClass)._class();
  6716. $ctx1.sendIdx["class"]=2;
  6717. $6=_st($7)._instanceVariableNames();
  6718. self._basicClass_instanceVariables_($5,$6);
  6719. $9=_st(aClass)._class();
  6720. $ctx1.sendIdx["class"]=3;
  6721. $8=_st($9)._methodDictionary();
  6722. _st($8)._valuesDo_((function(each){
  6723. return smalltalk.withContext(function($ctx2) {
  6724. return _st(_st($Compiler())._new())._install_forClass_protocol_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._protocol());
  6725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  6726. self._setupClass_(anotherClass);
  6727. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  6728. args: ["aClass", "anotherClass"],
  6729. 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 ].\x0a\x0a\x09self setupClass: anotherClass",
  6730. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  6731. referencedClasses: ["Compiler"]
  6732. }),
  6733. globals.ClassBuilder);
  6734. smalltalk.addMethod(
  6735. smalltalk.method({
  6736. selector: "installMethod:forClass:protocol:",
  6737. protocol: 'method definition',
  6738. fn: function (aCompiledMethod,aBehavior,aString){
  6739. var self=this;
  6740. return smalltalk.withContext(function($ctx1) {
  6741. _st(aCompiledMethod)._protocol_(aString);
  6742. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  6743. self._setupClass_(aBehavior);
  6744. return aCompiledMethod;
  6745. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},globals.ClassBuilder)})},
  6746. args: ["aCompiledMethod", "aBehavior", "aString"],
  6747. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^ aCompiledMethod",
  6748. messageSends: ["protocol:", "addCompiledMethod:", "setupClass:"],
  6749. referencedClasses: []
  6750. }),
  6751. globals.ClassBuilder);
  6752. smalltalk.addMethod(
  6753. smalltalk.method({
  6754. selector: "instanceVariableNamesFor:",
  6755. protocol: 'accessing',
  6756. fn: function (aString){
  6757. var self=this;
  6758. return smalltalk.withContext(function($ctx1) {
  6759. var $1;
  6760. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  6761. return smalltalk.withContext(function($ctx2) {
  6762. return _st(each)._isEmpty();
  6763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6764. return $1;
  6765. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},globals.ClassBuilder)})},
  6766. args: ["aString"],
  6767. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  6768. messageSends: ["reject:", "tokenize:", "isEmpty"],
  6769. referencedClasses: []
  6770. }),
  6771. globals.ClassBuilder);
  6772. smalltalk.addMethod(
  6773. smalltalk.method({
  6774. selector: "migrateClass:superclass:",
  6775. protocol: 'class migration',
  6776. fn: function (aClass,anotherClass){
  6777. var self=this;
  6778. return smalltalk.withContext(function($ctx1) {
  6779. var $2,$1;
  6780. $2=_st(aClass)._name();
  6781. $ctx1.sendIdx["name"]=1;
  6782. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6783. return $1;
  6784. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  6785. args: ["aClass", "anotherClass"],
  6786. 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",
  6787. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  6788. referencedClasses: []
  6789. }),
  6790. globals.ClassBuilder);
  6791. smalltalk.addMethod(
  6792. smalltalk.method({
  6793. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  6794. protocol: 'class migration',
  6795. fn: function (className,aClass,aCollection,packageName){
  6796. var self=this;
  6797. var oldClass,newClass,tmp;
  6798. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6799. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6800. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6801. function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  6802. return smalltalk.withContext(function($ctx1) {
  6803. var $1,$2,$3,$4,$5,$6,$7,$8;
  6804. tmp="new*".__comma(className);
  6805. $ctx1.sendIdx[","]=1;
  6806. oldClass=_st(_st($Smalltalk())._globals())._at_(className);
  6807. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  6808. self._basicSwapClassNames_with_(oldClass,newClass);
  6809. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  6810. _st((function(){
  6811. return smalltalk.withContext(function($ctx2) {
  6812. return self._copyClass_to_(oldClass,newClass);
  6813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
  6814. return smalltalk.withContext(function($ctx2) {
  6815. self._basicSwapClassNames_with_(oldClass,newClass);
  6816. $1=self._basicRemoveClass_(newClass);
  6817. $ctx2.sendIdx["basicRemoveClass:"]=1;
  6818. $1;
  6819. return _st(exception)._signal();
  6820. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
  6821. self._rawRenameClass_to_(oldClass,tmp);
  6822. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  6823. $2=self._rawRenameClass_to_(newClass,className);
  6824. $3=_st(oldClass)._subclasses();
  6825. $4=(function(each){
  6826. return smalltalk.withContext(function($ctx2) {
  6827. return self._migrateClass_superclass_(each,newClass);
  6828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})});
  6829. $5=_st("Recompiling ".__comma(_st(newClass)._name())).__comma("...");
  6830. $ctx1.sendIdx[","]=2;
  6831. _st($3)._do_displayingProgress_($4,$5);
  6832. self._basicRemoveClass_(oldClass);
  6833. $6=_st($ClassMigrated())._new();
  6834. _st($6)._theClass_(newClass);
  6835. _st($6)._oldClass_(oldClass);
  6836. $7=_st($6)._yourself();
  6837. _st(_st($SystemAnnouncer())._current())._announce_($7);
  6838. $8=newClass;
  6839. return $8;
  6840. }, 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)})},
  6841. args: ["className", "aClass", "aCollection", "packageName"],
  6842. 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\x09exception signal ].\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\x09\x09displayingProgress: 'Recompiling ', newClass name, '...'.\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",
  6843. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:displayingProgress:", "subclasses", "migrateClass:superclass:", "name", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"],
  6844. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
  6845. }),
  6846. globals.ClassBuilder);
  6847. smalltalk.addMethod(
  6848. smalltalk.method({
  6849. selector: "rawRenameClass:to:",
  6850. protocol: 'private',
  6851. fn: function (aClass,aString){
  6852. var self=this;
  6853. return smalltalk.withContext(function($ctx1) {
  6854. globals[aString] = aClass;
  6855. ;
  6856. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  6857. args: ["aClass", "aString"],
  6858. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09>",
  6859. messageSends: [],
  6860. referencedClasses: []
  6861. }),
  6862. globals.ClassBuilder);
  6863. smalltalk.addMethod(
  6864. smalltalk.method({
  6865. selector: "renameClass:to:",
  6866. protocol: 'class migration',
  6867. fn: function (aClass,className){
  6868. var self=this;
  6869. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6870. function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  6871. return smalltalk.withContext(function($ctx1) {
  6872. var $1,$2;
  6873. self._basicRenameClass_to_(aClass,className);
  6874. _st(aClass)._recompile();
  6875. $1=_st($ClassRenamed())._new();
  6876. _st($1)._theClass_(aClass);
  6877. $2=_st($1)._yourself();
  6878. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6879. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},globals.ClassBuilder)})},
  6880. args: ["aClass", "className"],
  6881. 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)",
  6882. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"],
  6883. referencedClasses: ["SystemAnnouncer", "ClassRenamed"]
  6884. }),
  6885. globals.ClassBuilder);
  6886. smalltalk.addMethod(
  6887. smalltalk.method({
  6888. selector: "setupClass:",
  6889. protocol: 'public',
  6890. fn: function (aClass){
  6891. var self=this;
  6892. return smalltalk.withContext(function($ctx1) {
  6893. smalltalk.init(aClass);;
  6894. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},globals.ClassBuilder)})},
  6895. args: ["aClass"],
  6896. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  6897. messageSends: [],
  6898. referencedClasses: []
  6899. }),
  6900. globals.ClassBuilder);
  6901. smalltalk.addMethod(
  6902. smalltalk.method({
  6903. selector: "superclass:subclass:",
  6904. protocol: 'class definition',
  6905. fn: function (aClass,className){
  6906. var self=this;
  6907. return smalltalk.withContext(function($ctx1) {
  6908. var $1;
  6909. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  6910. return $1;
  6911. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},globals.ClassBuilder)})},
  6912. args: ["aClass", "className"],
  6913. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  6914. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6915. referencedClasses: []
  6916. }),
  6917. globals.ClassBuilder);
  6918. smalltalk.addMethod(
  6919. smalltalk.method({
  6920. selector: "superclass:subclass:instanceVariableNames:package:",
  6921. protocol: 'class definition',
  6922. fn: function (aClass,className,ivarNames,packageName){
  6923. var self=this;
  6924. var newClass;
  6925. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6926. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6927. return smalltalk.withContext(function($ctx1) {
  6928. var $1,$2,$3,$4,$5;
  6929. $1=self._instanceVariableNamesFor_(ivarNames);
  6930. if(($receiver = packageName) == nil || $receiver == null){
  6931. $2="unclassified";
  6932. } else {
  6933. $2=packageName;
  6934. };
  6935. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  6936. self._setupClass_(newClass);
  6937. $3=_st($ClassAdded())._new();
  6938. _st($3)._theClass_(newClass);
  6939. $4=_st($3)._yourself();
  6940. _st(_st($SystemAnnouncer())._current())._announce_($4);
  6941. $5=newClass;
  6942. return $5;
  6943. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},globals.ClassBuilder)})},
  6944. args: ["aClass", "className", "ivarNames", "packageName"],
  6945. 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\x09self setupClass: 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",
  6946. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  6947. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  6948. }),
  6949. globals.ClassBuilder);
  6950. smalltalk.addClass('ClassCategoryReader', globals.Object, ['class', 'category'], 'Kernel-Classes');
  6951. globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  6952. smalltalk.addMethod(
  6953. smalltalk.method({
  6954. selector: "class:category:",
  6955. protocol: 'accessing',
  6956. fn: function (aClass,aString){
  6957. var self=this;
  6958. self["@class"]=aClass;
  6959. self["@category"]=aString;
  6960. return self},
  6961. args: ["aClass", "aString"],
  6962. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6963. messageSends: [],
  6964. referencedClasses: []
  6965. }),
  6966. globals.ClassCategoryReader);
  6967. smalltalk.addMethod(
  6968. smalltalk.method({
  6969. selector: "compileMethod:",
  6970. protocol: 'private',
  6971. fn: function (aString){
  6972. var self=this;
  6973. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6974. return smalltalk.withContext(function($ctx1) {
  6975. _st(_st($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  6976. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},globals.ClassCategoryReader)})},
  6977. args: ["aString"],
  6978. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  6979. messageSends: ["install:forClass:protocol:", "new"],
  6980. referencedClasses: ["Compiler"]
  6981. }),
  6982. globals.ClassCategoryReader);
  6983. smalltalk.addMethod(
  6984. smalltalk.method({
  6985. selector: "initialize",
  6986. protocol: 'initialization',
  6987. fn: function (){
  6988. var self=this;
  6989. return smalltalk.withContext(function($ctx1) {
  6990. globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  6991. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCategoryReader)})},
  6992. args: [],
  6993. source: "initialize\x0a\x09super initialize.",
  6994. messageSends: ["initialize"],
  6995. referencedClasses: []
  6996. }),
  6997. globals.ClassCategoryReader);
  6998. smalltalk.addMethod(
  6999. smalltalk.method({
  7000. selector: "scanFrom:",
  7001. protocol: 'fileIn',
  7002. fn: function (aChunkParser){
  7003. var self=this;
  7004. var chunk;
  7005. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7006. return smalltalk.withContext(function($ctx1) {
  7007. _st((function(){
  7008. return smalltalk.withContext(function($ctx2) {
  7009. chunk=_st(aChunkParser)._nextChunk();
  7010. chunk;
  7011. return _st(chunk)._isEmpty();
  7012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  7013. return smalltalk.withContext(function($ctx2) {
  7014. return self._compileMethod_(chunk);
  7015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7016. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  7017. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCategoryReader)})},
  7018. args: ["aChunkParser"],
  7019. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
  7020. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
  7021. referencedClasses: ["ClassBuilder"]
  7022. }),
  7023. globals.ClassCategoryReader);
  7024. smalltalk.addClass('ClassCommentReader', globals.Object, ['class'], 'Kernel-Classes');
  7025. globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  7026. smalltalk.addMethod(
  7027. smalltalk.method({
  7028. selector: "class:",
  7029. protocol: 'accessing',
  7030. fn: function (aClass){
  7031. var self=this;
  7032. self["@class"]=aClass;
  7033. return self},
  7034. args: ["aClass"],
  7035. source: "class: aClass\x0a\x09class := aClass",
  7036. messageSends: [],
  7037. referencedClasses: []
  7038. }),
  7039. globals.ClassCommentReader);
  7040. smalltalk.addMethod(
  7041. smalltalk.method({
  7042. selector: "initialize",
  7043. protocol: 'initialization',
  7044. fn: function (){
  7045. var self=this;
  7046. return smalltalk.withContext(function($ctx1) {
  7047. globals.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  7048. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCommentReader)})},
  7049. args: [],
  7050. source: "initialize\x0a\x09super initialize.",
  7051. messageSends: ["initialize"],
  7052. referencedClasses: []
  7053. }),
  7054. globals.ClassCommentReader);
  7055. smalltalk.addMethod(
  7056. smalltalk.method({
  7057. selector: "scanFrom:",
  7058. protocol: 'fileIn',
  7059. fn: function (aChunkParser){
  7060. var self=this;
  7061. var chunk;
  7062. return smalltalk.withContext(function($ctx1) {
  7063. var $1;
  7064. chunk=_st(aChunkParser)._nextChunk();
  7065. $1=_st(chunk)._isEmpty();
  7066. if(! smalltalk.assert($1)){
  7067. self._setComment_(chunk);
  7068. };
  7069. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCommentReader)})},
  7070. args: ["aChunkParser"],
  7071. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  7072. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
  7073. referencedClasses: []
  7074. }),
  7075. globals.ClassCommentReader);
  7076. smalltalk.addMethod(
  7077. smalltalk.method({
  7078. selector: "setComment:",
  7079. protocol: 'private',
  7080. fn: function (aString){
  7081. var self=this;
  7082. return smalltalk.withContext(function($ctx1) {
  7083. _st(self["@class"])._comment_(aString);
  7084. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},globals.ClassCommentReader)})},
  7085. args: ["aString"],
  7086. source: "setComment: aString\x0a\x09class comment: aString",
  7087. messageSends: ["comment:"],
  7088. referencedClasses: []
  7089. }),
  7090. globals.ClassCommentReader);
  7091. smalltalk.addClass('ClassSorterNode', globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7092. globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  7093. smalltalk.addMethod(
  7094. smalltalk.method({
  7095. selector: "getNodesFrom:",
  7096. protocol: 'accessing',
  7097. fn: function (aCollection){
  7098. var self=this;
  7099. var children,others;
  7100. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7101. return smalltalk.withContext(function($ctx1) {
  7102. var $1;
  7103. children=[];
  7104. others=[];
  7105. _st(aCollection)._do_((function(each){
  7106. return smalltalk.withContext(function($ctx2) {
  7107. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  7108. if(smalltalk.assert($1)){
  7109. return _st(children)._add_(each);
  7110. $ctx2.sendIdx["add:"]=1;
  7111. } else {
  7112. return _st(others)._add_(each);
  7113. };
  7114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7115. self["@nodes"]=_st(children)._collect_((function(each){
  7116. return smalltalk.withContext(function($ctx2) {
  7117. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  7118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  7119. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},globals.ClassSorterNode)})},
  7120. args: ["aCollection"],
  7121. 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 ]",
  7122. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
  7123. referencedClasses: ["ClassSorterNode"]
  7124. }),
  7125. globals.ClassSorterNode);
  7126. smalltalk.addMethod(
  7127. smalltalk.method({
  7128. selector: "level",
  7129. protocol: 'accessing',
  7130. fn: function (){
  7131. var self=this;
  7132. var $1;
  7133. $1=self["@level"];
  7134. return $1;
  7135. },
  7136. args: [],
  7137. source: "level\x0a\x09^ level",
  7138. messageSends: [],
  7139. referencedClasses: []
  7140. }),
  7141. globals.ClassSorterNode);
  7142. smalltalk.addMethod(
  7143. smalltalk.method({
  7144. selector: "level:",
  7145. protocol: 'accessing',
  7146. fn: function (anInteger){
  7147. var self=this;
  7148. self["@level"]=anInteger;
  7149. return self},
  7150. args: ["anInteger"],
  7151. source: "level: anInteger\x0a\x09level := anInteger",
  7152. messageSends: [],
  7153. referencedClasses: []
  7154. }),
  7155. globals.ClassSorterNode);
  7156. smalltalk.addMethod(
  7157. smalltalk.method({
  7158. selector: "nodes",
  7159. protocol: 'accessing',
  7160. fn: function (){
  7161. var self=this;
  7162. var $1;
  7163. $1=self["@nodes"];
  7164. return $1;
  7165. },
  7166. args: [],
  7167. source: "nodes\x0a\x09^ nodes",
  7168. messageSends: [],
  7169. referencedClasses: []
  7170. }),
  7171. globals.ClassSorterNode);
  7172. smalltalk.addMethod(
  7173. smalltalk.method({
  7174. selector: "theClass",
  7175. protocol: 'accessing',
  7176. fn: function (){
  7177. var self=this;
  7178. var $1;
  7179. $1=self["@theClass"];
  7180. return $1;
  7181. },
  7182. args: [],
  7183. source: "theClass\x0a\x09^ theClass",
  7184. messageSends: [],
  7185. referencedClasses: []
  7186. }),
  7187. globals.ClassSorterNode);
  7188. smalltalk.addMethod(
  7189. smalltalk.method({
  7190. selector: "theClass:",
  7191. protocol: 'accessing',
  7192. fn: function (aClass){
  7193. var self=this;
  7194. self["@theClass"]=aClass;
  7195. return self},
  7196. args: ["aClass"],
  7197. source: "theClass: aClass\x0a\x09theClass := aClass",
  7198. messageSends: [],
  7199. referencedClasses: []
  7200. }),
  7201. globals.ClassSorterNode);
  7202. smalltalk.addMethod(
  7203. smalltalk.method({
  7204. selector: "traverseClassesWith:",
  7205. protocol: 'visiting',
  7206. fn: function (aCollection){
  7207. var self=this;
  7208. return smalltalk.withContext(function($ctx1) {
  7209. var $1,$3,$2;
  7210. $1=self._theClass();
  7211. $ctx1.sendIdx["theClass"]=1;
  7212. _st(aCollection)._add_($1);
  7213. _st(_st(self._nodes())._sorted_((function(a,b){
  7214. return smalltalk.withContext(function($ctx2) {
  7215. $3=_st(a)._theClass();
  7216. $ctx2.sendIdx["theClass"]=2;
  7217. $2=_st($3)._name();
  7218. $ctx2.sendIdx["name"]=1;
  7219. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  7220. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(aNode){
  7221. return smalltalk.withContext(function($ctx2) {
  7222. return _st(aNode)._traverseClassesWith_(aCollection);
  7223. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)})}));
  7224. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},globals.ClassSorterNode)})},
  7225. args: ["aCollection"],
  7226. 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 ].",
  7227. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
  7228. referencedClasses: []
  7229. }),
  7230. globals.ClassSorterNode);
  7231. smalltalk.addMethod(
  7232. smalltalk.method({
  7233. selector: "on:classes:level:",
  7234. protocol: 'instance creation',
  7235. fn: function (aClass,aCollection,anInteger){
  7236. var self=this;
  7237. return smalltalk.withContext(function($ctx1) {
  7238. var $2,$3,$1;
  7239. $2=self._new();
  7240. _st($2)._theClass_(aClass);
  7241. _st($2)._level_(anInteger);
  7242. _st($2)._getNodesFrom_(aCollection);
  7243. $3=_st($2)._yourself();
  7244. $1=$3;
  7245. return $1;
  7246. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},globals.ClassSorterNode.klass)})},
  7247. args: ["aClass", "aCollection", "anInteger"],
  7248. 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",
  7249. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  7250. referencedClasses: []
  7251. }),
  7252. globals.ClassSorterNode.klass);
  7253. });
  7254. define("amber_core/Kernel-Methods", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  7255. smalltalk.addPackage('Kernel-Methods');
  7256. smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7257. smalltalk.addClass('BlockClosure', globals.Object, [], 'Kernel-Methods');
  7258. 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 | ... ] `";
  7259. smalltalk.addMethod(
  7260. smalltalk.method({
  7261. selector: "applyTo:arguments:",
  7262. protocol: 'evaluating',
  7263. fn: function (anObject,aCollection){
  7264. var self=this;
  7265. return smalltalk.withContext(function($ctx1) {
  7266. return self.apply(anObject, aCollection);
  7267. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.BlockClosure)})},
  7268. args: ["anObject", "aCollection"],
  7269. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7270. messageSends: [],
  7271. referencedClasses: []
  7272. }),
  7273. globals.BlockClosure);
  7274. smalltalk.addMethod(
  7275. smalltalk.method({
  7276. selector: "asCompiledMethod:",
  7277. protocol: 'converting',
  7278. fn: function (aString){
  7279. var self=this;
  7280. return smalltalk.withContext(function($ctx1) {
  7281. return smalltalk.method({selector:aString, fn:self});;
  7282. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},globals.BlockClosure)})},
  7283. args: ["aString"],
  7284. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  7285. messageSends: [],
  7286. referencedClasses: []
  7287. }),
  7288. globals.BlockClosure);
  7289. smalltalk.addMethod(
  7290. smalltalk.method({
  7291. selector: "compiledSource",
  7292. protocol: 'accessing',
  7293. fn: function (){
  7294. var self=this;
  7295. return smalltalk.withContext(function($ctx1) {
  7296. return self.toString();
  7297. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},globals.BlockClosure)})},
  7298. args: [],
  7299. source: "compiledSource\x0a\x09<return self.toString()>",
  7300. messageSends: [],
  7301. referencedClasses: []
  7302. }),
  7303. globals.BlockClosure);
  7304. smalltalk.addMethod(
  7305. smalltalk.method({
  7306. selector: "currySelf",
  7307. protocol: 'converting',
  7308. fn: function (){
  7309. var self=this;
  7310. return smalltalk.withContext(function($ctx1) {
  7311. return function () {
  7312. var args = [ this ];
  7313. args.push.apply(args, arguments);
  7314. return self.apply(null, args);
  7315. }
  7316. ;
  7317. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.BlockClosure)})},
  7318. args: [],
  7319. 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>",
  7320. messageSends: [],
  7321. referencedClasses: []
  7322. }),
  7323. globals.BlockClosure);
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "ensure:",
  7327. protocol: 'evaluating',
  7328. fn: function (aBlock){
  7329. var self=this;
  7330. return smalltalk.withContext(function($ctx1) {
  7331. try{return self._value()}finally{aBlock._value()};
  7332. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},globals.BlockClosure)})},
  7333. args: ["aBlock"],
  7334. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7335. messageSends: [],
  7336. referencedClasses: []
  7337. }),
  7338. globals.BlockClosure);
  7339. smalltalk.addMethod(
  7340. smalltalk.method({
  7341. selector: "fork",
  7342. protocol: 'timeout/interval',
  7343. fn: function (){
  7344. var self=this;
  7345. function $ForkPool(){return globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7346. return smalltalk.withContext(function($ctx1) {
  7347. _st(_st($ForkPool())._default())._fork_(self);
  7348. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},globals.BlockClosure)})},
  7349. args: [],
  7350. source: "fork\x0a\x09ForkPool default fork: self",
  7351. messageSends: ["fork:", "default"],
  7352. referencedClasses: ["ForkPool"]
  7353. }),
  7354. globals.BlockClosure);
  7355. smalltalk.addMethod(
  7356. smalltalk.method({
  7357. selector: "new",
  7358. protocol: 'evaluating',
  7359. fn: function (){
  7360. var self=this;
  7361. return smalltalk.withContext(function($ctx1) {
  7362. return new self();
  7363. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.BlockClosure)})},
  7364. args: [],
  7365. 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()>",
  7366. messageSends: [],
  7367. referencedClasses: []
  7368. }),
  7369. globals.BlockClosure);
  7370. smalltalk.addMethod(
  7371. smalltalk.method({
  7372. selector: "newValue:",
  7373. protocol: 'evaluating',
  7374. fn: function (anObject){
  7375. var self=this;
  7376. return smalltalk.withContext(function($ctx1) {
  7377. var $1;
  7378. $1=self._newWithValues_([anObject]);
  7379. return $1;
  7380. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},globals.BlockClosure)})},
  7381. args: ["anObject"],
  7382. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7383. messageSends: ["newWithValues:"],
  7384. referencedClasses: []
  7385. }),
  7386. globals.BlockClosure);
  7387. smalltalk.addMethod(
  7388. smalltalk.method({
  7389. selector: "newValue:value:",
  7390. protocol: 'evaluating',
  7391. fn: function (anObject,anObject2){
  7392. var self=this;
  7393. return smalltalk.withContext(function($ctx1) {
  7394. var $1;
  7395. $1=self._newWithValues_([anObject,anObject2]);
  7396. return $1;
  7397. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},globals.BlockClosure)})},
  7398. args: ["anObject", "anObject2"],
  7399. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7400. messageSends: ["newWithValues:"],
  7401. referencedClasses: []
  7402. }),
  7403. globals.BlockClosure);
  7404. smalltalk.addMethod(
  7405. smalltalk.method({
  7406. selector: "newValue:value:value:",
  7407. protocol: 'evaluating',
  7408. fn: function (anObject,anObject2,anObject3){
  7409. var self=this;
  7410. return smalltalk.withContext(function($ctx1) {
  7411. var $1;
  7412. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7413. return $1;
  7414. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.BlockClosure)})},
  7415. args: ["anObject", "anObject2", "anObject3"],
  7416. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7417. messageSends: ["newWithValues:"],
  7418. referencedClasses: []
  7419. }),
  7420. globals.BlockClosure);
  7421. smalltalk.addMethod(
  7422. smalltalk.method({
  7423. selector: "newWithValues:",
  7424. protocol: 'evaluating',
  7425. fn: function (aCollection){
  7426. var self=this;
  7427. return smalltalk.withContext(function($ctx1) {
  7428. var object = Object.create(self.prototype);
  7429. var result = self.apply(object, aCollection);
  7430. return typeof result === "object" ? result : object;
  7431. ;
  7432. return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},globals.BlockClosure)})},
  7433. args: ["aCollection"],
  7434. 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>",
  7435. messageSends: [],
  7436. referencedClasses: []
  7437. }),
  7438. globals.BlockClosure);
  7439. smalltalk.addMethod(
  7440. smalltalk.method({
  7441. selector: "numArgs",
  7442. protocol: 'accessing',
  7443. fn: function (){
  7444. var self=this;
  7445. return smalltalk.withContext(function($ctx1) {
  7446. return self.length;
  7447. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.BlockClosure)})},
  7448. args: [],
  7449. source: "numArgs\x0a\x09<return self.length>",
  7450. messageSends: [],
  7451. referencedClasses: []
  7452. }),
  7453. globals.BlockClosure);
  7454. smalltalk.addMethod(
  7455. smalltalk.method({
  7456. selector: "on:do:",
  7457. protocol: 'error handling',
  7458. fn: function (anErrorClass,aBlock){
  7459. var self=this;
  7460. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7461. return smalltalk.withContext(function($ctx1) {
  7462. var $2,$1;
  7463. $1=self._try_catch_(self,(function(error){
  7464. var smalltalkError;
  7465. return smalltalk.withContext(function($ctx2) {
  7466. smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
  7467. smalltalkError;
  7468. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  7469. if(smalltalk.assert($2)){
  7470. return _st(aBlock)._value_(smalltalkError);
  7471. } else {
  7472. return _st(smalltalkError)._resignal();
  7473. };
  7474. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)})}));
  7475. return $1;
  7476. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},globals.BlockClosure)})},
  7477. args: ["anErrorClass", "aBlock"],
  7478. 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 try: self catch: [ :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 ] ]",
  7479. messageSends: ["try:catch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
  7480. referencedClasses: ["Smalltalk"]
  7481. }),
  7482. globals.BlockClosure);
  7483. smalltalk.addMethod(
  7484. smalltalk.method({
  7485. selector: "receiver",
  7486. protocol: 'accessing',
  7487. fn: function (){
  7488. var self=this;
  7489. return nil;
  7490. },
  7491. args: [],
  7492. source: "receiver\x0a\x09^ nil",
  7493. messageSends: [],
  7494. referencedClasses: []
  7495. }),
  7496. globals.BlockClosure);
  7497. smalltalk.addMethod(
  7498. smalltalk.method({
  7499. selector: "timeToRun",
  7500. protocol: 'evaluating',
  7501. fn: function (){
  7502. var self=this;
  7503. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  7504. return smalltalk.withContext(function($ctx1) {
  7505. var $1;
  7506. $1=_st($Date())._millisecondsToRun_(self);
  7507. return $1;
  7508. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},globals.BlockClosure)})},
  7509. args: [],
  7510. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7511. messageSends: ["millisecondsToRun:"],
  7512. referencedClasses: ["Date"]
  7513. }),
  7514. globals.BlockClosure);
  7515. smalltalk.addMethod(
  7516. smalltalk.method({
  7517. selector: "value",
  7518. protocol: 'evaluating',
  7519. fn: function (){
  7520. var self=this;
  7521. return smalltalk.withContext(function($ctx1) {
  7522. return self();;
  7523. return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.BlockClosure)})},
  7524. args: [],
  7525. source: "value\x0a\x09<return self();>",
  7526. messageSends: [],
  7527. referencedClasses: []
  7528. }),
  7529. globals.BlockClosure);
  7530. smalltalk.addMethod(
  7531. smalltalk.method({
  7532. selector: "value:",
  7533. protocol: 'evaluating',
  7534. fn: function (anArg){
  7535. var self=this;
  7536. return smalltalk.withContext(function($ctx1) {
  7537. return self(anArg);;
  7538. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},globals.BlockClosure)})},
  7539. args: ["anArg"],
  7540. source: "value: anArg\x0a\x09<return self(anArg);>",
  7541. messageSends: [],
  7542. referencedClasses: []
  7543. }),
  7544. globals.BlockClosure);
  7545. smalltalk.addMethod(
  7546. smalltalk.method({
  7547. selector: "value:value:",
  7548. protocol: 'evaluating',
  7549. fn: function (firstArg,secondArg){
  7550. var self=this;
  7551. return smalltalk.withContext(function($ctx1) {
  7552. return self(firstArg, secondArg);;
  7553. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},globals.BlockClosure)})},
  7554. args: ["firstArg", "secondArg"],
  7555. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7556. messageSends: [],
  7557. referencedClasses: []
  7558. }),
  7559. globals.BlockClosure);
  7560. smalltalk.addMethod(
  7561. smalltalk.method({
  7562. selector: "value:value:value:",
  7563. protocol: 'evaluating',
  7564. fn: function (firstArg,secondArg,thirdArg){
  7565. var self=this;
  7566. return smalltalk.withContext(function($ctx1) {
  7567. return self(firstArg, secondArg, thirdArg);;
  7568. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},globals.BlockClosure)})},
  7569. args: ["firstArg", "secondArg", "thirdArg"],
  7570. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7571. messageSends: [],
  7572. referencedClasses: []
  7573. }),
  7574. globals.BlockClosure);
  7575. smalltalk.addMethod(
  7576. smalltalk.method({
  7577. selector: "valueWithInterval:",
  7578. protocol: 'timeout/interval',
  7579. fn: function (aNumber){
  7580. var self=this;
  7581. return smalltalk.withContext(function($ctx1) {
  7582. var interval = setInterval(self, aNumber);
  7583. return globals.Timeout._on_(interval);
  7584. ;
  7585. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},globals.BlockClosure)})},
  7586. args: ["aNumber"],
  7587. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(interval);\x0a\x09>",
  7588. messageSends: [],
  7589. referencedClasses: []
  7590. }),
  7591. globals.BlockClosure);
  7592. smalltalk.addMethod(
  7593. smalltalk.method({
  7594. selector: "valueWithPossibleArguments:",
  7595. protocol: 'evaluating',
  7596. fn: function (aCollection){
  7597. var self=this;
  7598. return smalltalk.withContext(function($ctx1) {
  7599. return self.apply(null, aCollection);;
  7600. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.BlockClosure)})},
  7601. args: ["aCollection"],
  7602. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7603. messageSends: [],
  7604. referencedClasses: []
  7605. }),
  7606. globals.BlockClosure);
  7607. smalltalk.addMethod(
  7608. smalltalk.method({
  7609. selector: "valueWithTimeout:",
  7610. protocol: 'timeout/interval',
  7611. fn: function (aNumber){
  7612. var self=this;
  7613. return smalltalk.withContext(function($ctx1) {
  7614. var timeout = setTimeout(self, aNumber);
  7615. return globals.Timeout._on_(timeout);
  7616. ;
  7617. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},globals.BlockClosure)})},
  7618. args: ["aNumber"],
  7619. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(timeout);\x0a\x09>",
  7620. messageSends: [],
  7621. referencedClasses: []
  7622. }),
  7623. globals.BlockClosure);
  7624. smalltalk.addMethod(
  7625. smalltalk.method({
  7626. selector: "whileFalse",
  7627. protocol: 'controlling',
  7628. fn: function (){
  7629. var self=this;
  7630. return smalltalk.withContext(function($ctx1) {
  7631. self._whileFalse_((function(){
  7632. }));
  7633. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},globals.BlockClosure)})},
  7634. args: [],
  7635. source: "whileFalse\x0a\x09self whileFalse: []",
  7636. messageSends: ["whileFalse:"],
  7637. referencedClasses: []
  7638. }),
  7639. globals.BlockClosure);
  7640. smalltalk.addMethod(
  7641. smalltalk.method({
  7642. selector: "whileFalse:",
  7643. protocol: 'controlling',
  7644. fn: function (aBlock){
  7645. var self=this;
  7646. return smalltalk.withContext(function($ctx1) {
  7647. while(!smalltalk.assert(self._value())) {aBlock._value()};
  7648. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},globals.BlockClosure)})},
  7649. args: ["aBlock"],
  7650. source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  7651. messageSends: [],
  7652. referencedClasses: []
  7653. }),
  7654. globals.BlockClosure);
  7655. smalltalk.addMethod(
  7656. smalltalk.method({
  7657. selector: "whileTrue",
  7658. protocol: 'controlling',
  7659. fn: function (){
  7660. var self=this;
  7661. return smalltalk.withContext(function($ctx1) {
  7662. self._whileTrue_((function(){
  7663. }));
  7664. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},globals.BlockClosure)})},
  7665. args: [],
  7666. source: "whileTrue\x0a\x09self whileTrue: []",
  7667. messageSends: ["whileTrue:"],
  7668. referencedClasses: []
  7669. }),
  7670. globals.BlockClosure);
  7671. smalltalk.addMethod(
  7672. smalltalk.method({
  7673. selector: "whileTrue:",
  7674. protocol: 'controlling',
  7675. fn: function (aBlock){
  7676. var self=this;
  7677. return smalltalk.withContext(function($ctx1) {
  7678. while(smalltalk.assert(self._value())) {aBlock._value()};
  7679. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},globals.BlockClosure)})},
  7680. args: ["aBlock"],
  7681. source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  7682. messageSends: [],
  7683. referencedClasses: []
  7684. }),
  7685. globals.BlockClosure);
  7686. smalltalk.addClass('CompiledMethod', globals.Object, [], 'Kernel-Methods');
  7687. 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";
  7688. smalltalk.addMethod(
  7689. smalltalk.method({
  7690. selector: "arguments",
  7691. protocol: 'accessing',
  7692. fn: function (){
  7693. var self=this;
  7694. return smalltalk.withContext(function($ctx1) {
  7695. return self.args || [];
  7696. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.CompiledMethod)})},
  7697. args: [],
  7698. source: "arguments\x0a\x09<return self.args || []>",
  7699. messageSends: [],
  7700. referencedClasses: []
  7701. }),
  7702. globals.CompiledMethod);
  7703. smalltalk.addMethod(
  7704. smalltalk.method({
  7705. selector: "category",
  7706. protocol: 'accessing',
  7707. fn: function (){
  7708. var self=this;
  7709. return smalltalk.withContext(function($ctx1) {
  7710. var $1;
  7711. $1=self._protocol();
  7712. return $1;
  7713. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.CompiledMethod)})},
  7714. args: [],
  7715. source: "category\x0a\x09^ self protocol",
  7716. messageSends: ["protocol"],
  7717. referencedClasses: []
  7718. }),
  7719. globals.CompiledMethod);
  7720. smalltalk.addMethod(
  7721. smalltalk.method({
  7722. selector: "defaultProtocol",
  7723. protocol: 'defaults',
  7724. fn: function (){
  7725. var self=this;
  7726. return "as yet unclassified";
  7727. },
  7728. args: [],
  7729. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  7730. messageSends: [],
  7731. referencedClasses: []
  7732. }),
  7733. globals.CompiledMethod);
  7734. smalltalk.addMethod(
  7735. smalltalk.method({
  7736. selector: "fn",
  7737. protocol: 'accessing',
  7738. fn: function (){
  7739. var self=this;
  7740. return smalltalk.withContext(function($ctx1) {
  7741. var $1;
  7742. $1=self._basicAt_("fn");
  7743. return $1;
  7744. }, function($ctx1) {$ctx1.fill(self,"fn",{},globals.CompiledMethod)})},
  7745. args: [],
  7746. source: "fn\x0a\x09^ self basicAt: 'fn'",
  7747. messageSends: ["basicAt:"],
  7748. referencedClasses: []
  7749. }),
  7750. globals.CompiledMethod);
  7751. smalltalk.addMethod(
  7752. smalltalk.method({
  7753. selector: "fn:",
  7754. protocol: 'accessing',
  7755. fn: function (aBlock){
  7756. var self=this;
  7757. return smalltalk.withContext(function($ctx1) {
  7758. self._basicAt_put_("fn",aBlock);
  7759. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},globals.CompiledMethod)})},
  7760. args: ["aBlock"],
  7761. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  7762. messageSends: ["basicAt:put:"],
  7763. referencedClasses: []
  7764. }),
  7765. globals.CompiledMethod);
  7766. smalltalk.addMethod(
  7767. smalltalk.method({
  7768. selector: "isCompiledMethod",
  7769. protocol: 'testing',
  7770. fn: function (){
  7771. var self=this;
  7772. return true;
  7773. },
  7774. args: [],
  7775. source: "isCompiledMethod\x0a\x09^ true",
  7776. messageSends: [],
  7777. referencedClasses: []
  7778. }),
  7779. globals.CompiledMethod);
  7780. smalltalk.addMethod(
  7781. smalltalk.method({
  7782. selector: "isOverridden",
  7783. protocol: 'testing',
  7784. fn: function (){
  7785. var self=this;
  7786. var selector;
  7787. return smalltalk.withContext(function($ctx1) {
  7788. var $1;
  7789. var $early={};
  7790. try {
  7791. selector=self._selector();
  7792. _st(self._methodClass())._allSubclassesDo_((function(each){
  7793. return smalltalk.withContext(function($ctx2) {
  7794. $1=_st(each)._includesSelector_(selector);
  7795. if(smalltalk.assert($1)){
  7796. throw $early=[true];
  7797. };
  7798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7799. return false;
  7800. }
  7801. catch(e) {if(e===$early)return e[0]; throw e}
  7802. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},globals.CompiledMethod)})},
  7803. args: [],
  7804. 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",
  7805. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"],
  7806. referencedClasses: []
  7807. }),
  7808. globals.CompiledMethod);
  7809. smalltalk.addMethod(
  7810. smalltalk.method({
  7811. selector: "isOverride",
  7812. protocol: 'testing',
  7813. fn: function (){
  7814. var self=this;
  7815. var superclass;
  7816. return smalltalk.withContext(function($ctx1) {
  7817. var $1,$2,$3;
  7818. $1=self._methodClass();
  7819. $ctx1.sendIdx["methodClass"]=1;
  7820. superclass=_st($1)._superclass();
  7821. $ctx1.sendIdx["superclass"]=1;
  7822. $2=superclass;
  7823. if(($receiver = $2) == nil || $receiver == null){
  7824. return false;
  7825. } else {
  7826. $2;
  7827. };
  7828. $3=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  7829. return $3;
  7830. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},globals.CompiledMethod)})},
  7831. args: [],
  7832. 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",
  7833. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  7834. referencedClasses: []
  7835. }),
  7836. globals.CompiledMethod);
  7837. smalltalk.addMethod(
  7838. smalltalk.method({
  7839. selector: "messageSends",
  7840. protocol: 'accessing',
  7841. fn: function (){
  7842. var self=this;
  7843. return smalltalk.withContext(function($ctx1) {
  7844. var $1;
  7845. $1=self._basicAt_("messageSends");
  7846. return $1;
  7847. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.CompiledMethod)})},
  7848. args: [],
  7849. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  7850. messageSends: ["basicAt:"],
  7851. referencedClasses: []
  7852. }),
  7853. globals.CompiledMethod);
  7854. smalltalk.addMethod(
  7855. smalltalk.method({
  7856. selector: "methodClass",
  7857. protocol: 'accessing',
  7858. fn: function (){
  7859. var self=this;
  7860. return smalltalk.withContext(function($ctx1) {
  7861. var $1;
  7862. $1=self._basicAt_("methodClass");
  7863. return $1;
  7864. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},globals.CompiledMethod)})},
  7865. args: [],
  7866. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  7867. messageSends: ["basicAt:"],
  7868. referencedClasses: []
  7869. }),
  7870. globals.CompiledMethod);
  7871. smalltalk.addMethod(
  7872. smalltalk.method({
  7873. selector: "package",
  7874. protocol: 'accessing',
  7875. fn: function (){
  7876. var self=this;
  7877. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  7878. return smalltalk.withContext(function($ctx1) {
  7879. var $2,$1,$4,$3,$5;
  7880. $2=self._protocol();
  7881. $ctx1.sendIdx["protocol"]=1;
  7882. $1=_st($2)._beginsWith_("*");
  7883. if(! smalltalk.assert($1)){
  7884. $4=self._methodClass();
  7885. $ctx1.sendIdx["methodClass"]=1;
  7886. $3=_st($4)._package();
  7887. $ctx1.sendIdx["package"]=1;
  7888. return $3;
  7889. };
  7890. $5=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  7891. return smalltalk.withContext(function($ctx2) {
  7892. return _st(self._methodClass())._package();
  7893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7894. return $5;
  7895. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.CompiledMethod)})},
  7896. args: [],
  7897. 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 protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self methodClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ self methodClass package ]",
  7898. messageSends: ["ifFalse:", "beginsWith:", "protocol", "package", "methodClass", "named:ifAbsent:", "allButFirst"],
  7899. referencedClasses: ["Package"]
  7900. }),
  7901. globals.CompiledMethod);
  7902. smalltalk.addMethod(
  7903. smalltalk.method({
  7904. selector: "protocol",
  7905. protocol: 'accessing',
  7906. fn: function (){
  7907. var self=this;
  7908. return smalltalk.withContext(function($ctx1) {
  7909. var $2,$1;
  7910. $2=self._basicAt_("protocol");
  7911. if(($receiver = $2) == nil || $receiver == null){
  7912. $1=self._defaultProtocol();
  7913. } else {
  7914. $1=$2;
  7915. };
  7916. return $1;
  7917. }, function($ctx1) {$ctx1.fill(self,"protocol",{},globals.CompiledMethod)})},
  7918. args: [],
  7919. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  7920. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"],
  7921. referencedClasses: []
  7922. }),
  7923. globals.CompiledMethod);
  7924. smalltalk.addMethod(
  7925. smalltalk.method({
  7926. selector: "protocol:",
  7927. protocol: 'accessing',
  7928. fn: function (aString){
  7929. var self=this;
  7930. var oldProtocol;
  7931. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7932. function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  7933. return smalltalk.withContext(function($ctx1) {
  7934. var $1,$2,$3;
  7935. oldProtocol=self._protocol();
  7936. self._basicAt_put_("protocol",aString);
  7937. $1=_st($MethodMoved())._new();
  7938. _st($1)._method_(self);
  7939. _st($1)._oldProtocol_(oldProtocol);
  7940. $2=_st($1)._yourself();
  7941. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7942. $3=self._methodClass();
  7943. if(($receiver = $3) == nil || $receiver == null){
  7944. $3;
  7945. } else {
  7946. var methodClass;
  7947. methodClass=$receiver;
  7948. _st(_st(methodClass)._organization())._addElement_(aString);
  7949. _st(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  7950. };
  7951. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},globals.CompiledMethod)})},
  7952. args: ["aString"],
  7953. 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 ]",
  7954. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"],
  7955. referencedClasses: ["SystemAnnouncer", "MethodMoved"]
  7956. }),
  7957. globals.CompiledMethod);
  7958. smalltalk.addMethod(
  7959. smalltalk.method({
  7960. selector: "referencedClasses",
  7961. protocol: 'accessing',
  7962. fn: function (){
  7963. var self=this;
  7964. return smalltalk.withContext(function($ctx1) {
  7965. var $1;
  7966. $1=self._basicAt_("referencedClasses");
  7967. return $1;
  7968. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},globals.CompiledMethod)})},
  7969. args: [],
  7970. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  7971. messageSends: ["basicAt:"],
  7972. referencedClasses: []
  7973. }),
  7974. globals.CompiledMethod);
  7975. smalltalk.addMethod(
  7976. smalltalk.method({
  7977. selector: "selector",
  7978. protocol: 'accessing',
  7979. fn: function (){
  7980. var self=this;
  7981. return smalltalk.withContext(function($ctx1) {
  7982. var $1;
  7983. $1=self._basicAt_("selector");
  7984. return $1;
  7985. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.CompiledMethod)})},
  7986. args: [],
  7987. source: "selector\x0a\x09^ self basicAt: 'selector'",
  7988. messageSends: ["basicAt:"],
  7989. referencedClasses: []
  7990. }),
  7991. globals.CompiledMethod);
  7992. smalltalk.addMethod(
  7993. smalltalk.method({
  7994. selector: "selector:",
  7995. protocol: 'accessing',
  7996. fn: function (aString){
  7997. var self=this;
  7998. return smalltalk.withContext(function($ctx1) {
  7999. self._basicAt_put_("selector",aString);
  8000. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.CompiledMethod)})},
  8001. args: ["aString"],
  8002. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8003. messageSends: ["basicAt:put:"],
  8004. referencedClasses: []
  8005. }),
  8006. globals.CompiledMethod);
  8007. smalltalk.addMethod(
  8008. smalltalk.method({
  8009. selector: "sendTo:arguments:",
  8010. protocol: 'evaluating',
  8011. fn: function (anObject,aCollection){
  8012. var self=this;
  8013. return smalltalk.withContext(function($ctx1) {
  8014. var $1;
  8015. $1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
  8016. return $1;
  8017. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.CompiledMethod)})},
  8018. args: ["anObject", "aCollection"],
  8019. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8020. messageSends: ["applyTo:arguments:", "fn"],
  8021. referencedClasses: []
  8022. }),
  8023. globals.CompiledMethod);
  8024. smalltalk.addMethod(
  8025. smalltalk.method({
  8026. selector: "source",
  8027. protocol: 'accessing',
  8028. fn: function (){
  8029. var self=this;
  8030. return smalltalk.withContext(function($ctx1) {
  8031. var $2,$1;
  8032. $2=self._basicAt_("source");
  8033. if(($receiver = $2) == nil || $receiver == null){
  8034. $1="";
  8035. } else {
  8036. $1=$2;
  8037. };
  8038. return $1;
  8039. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.CompiledMethod)})},
  8040. args: [],
  8041. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8042. messageSends: ["ifNil:", "basicAt:"],
  8043. referencedClasses: []
  8044. }),
  8045. globals.CompiledMethod);
  8046. smalltalk.addMethod(
  8047. smalltalk.method({
  8048. selector: "source:",
  8049. protocol: 'accessing',
  8050. fn: function (aString){
  8051. var self=this;
  8052. return smalltalk.withContext(function($ctx1) {
  8053. self._basicAt_put_("source",aString);
  8054. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},globals.CompiledMethod)})},
  8055. args: ["aString"],
  8056. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8057. messageSends: ["basicAt:put:"],
  8058. referencedClasses: []
  8059. }),
  8060. globals.CompiledMethod);
  8061. smalltalk.addClass('ForkPool', globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8062. 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`";
  8063. smalltalk.addMethod(
  8064. smalltalk.method({
  8065. selector: "addWorker",
  8066. protocol: 'private',
  8067. fn: function (){
  8068. var self=this;
  8069. return smalltalk.withContext(function($ctx1) {
  8070. _st(self["@worker"])._valueWithTimeout_((0));
  8071. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  8072. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},globals.ForkPool)})},
  8073. args: [],
  8074. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8075. messageSends: ["valueWithTimeout:", "+"],
  8076. referencedClasses: []
  8077. }),
  8078. globals.ForkPool);
  8079. smalltalk.addMethod(
  8080. smalltalk.method({
  8081. selector: "defaultMaxPoolSize",
  8082. protocol: 'defaults',
  8083. fn: function (){
  8084. var self=this;
  8085. return smalltalk.withContext(function($ctx1) {
  8086. var $1;
  8087. $1=_st(self._class())._defaultMaxPoolSize();
  8088. return $1;
  8089. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},globals.ForkPool)})},
  8090. args: [],
  8091. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8092. messageSends: ["defaultMaxPoolSize", "class"],
  8093. referencedClasses: []
  8094. }),
  8095. globals.ForkPool);
  8096. smalltalk.addMethod(
  8097. smalltalk.method({
  8098. selector: "fork:",
  8099. protocol: 'actions',
  8100. fn: function (aBlock){
  8101. var self=this;
  8102. return smalltalk.withContext(function($ctx1) {
  8103. var $1;
  8104. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  8105. if(smalltalk.assert($1)){
  8106. self._addWorker();
  8107. };
  8108. _st(self["@queue"])._nextPut_(aBlock);
  8109. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},globals.ForkPool)})},
  8110. args: ["aBlock"],
  8111. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8112. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"],
  8113. referencedClasses: []
  8114. }),
  8115. globals.ForkPool);
  8116. smalltalk.addMethod(
  8117. smalltalk.method({
  8118. selector: "initialize",
  8119. protocol: 'initialization',
  8120. fn: function (){
  8121. var self=this;
  8122. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8123. return smalltalk.withContext(function($ctx1) {
  8124. globals.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []);
  8125. self["@poolSize"]=(0);
  8126. self["@queue"]=_st($Queue())._new();
  8127. self["@worker"]=self._makeWorker();
  8128. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ForkPool)})},
  8129. args: [],
  8130. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8131. messageSends: ["initialize", "new", "makeWorker"],
  8132. referencedClasses: ["Queue"]
  8133. }),
  8134. globals.ForkPool);
  8135. smalltalk.addMethod(
  8136. smalltalk.method({
  8137. selector: "makeWorker",
  8138. protocol: 'initialization',
  8139. fn: function (){
  8140. var self=this;
  8141. var sentinel;
  8142. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8143. return smalltalk.withContext(function($ctx1) {
  8144. var $2,$1;
  8145. sentinel=_st($Object())._new();
  8146. $1=(function(){
  8147. var block;
  8148. return smalltalk.withContext(function($ctx2) {
  8149. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  8150. self["@poolSize"];
  8151. block=_st(self["@queue"])._nextIfAbsent_((function(){
  8152. return sentinel;
  8153. }));
  8154. block;
  8155. $2=_st(block).__eq_eq(sentinel);
  8156. if(! smalltalk.assert($2)){
  8157. return _st((function(){
  8158. return smalltalk.withContext(function($ctx3) {
  8159. return _st(block)._value();
  8160. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))._ensure_((function(){
  8161. return smalltalk.withContext(function($ctx3) {
  8162. return self._addWorker();
  8163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  8164. };
  8165. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)})});
  8166. return $1;
  8167. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},globals.ForkPool)})},
  8168. args: [],
  8169. 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 ] ]]",
  8170. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"],
  8171. referencedClasses: ["Object"]
  8172. }),
  8173. globals.ForkPool);
  8174. smalltalk.addMethod(
  8175. smalltalk.method({
  8176. selector: "maxPoolSize",
  8177. protocol: 'accessing',
  8178. fn: function (){
  8179. var self=this;
  8180. return smalltalk.withContext(function($ctx1) {
  8181. var $2,$1;
  8182. $2=self["@maxPoolSize"];
  8183. if(($receiver = $2) == nil || $receiver == null){
  8184. $1=self._defaultMaxPoolSize();
  8185. } else {
  8186. $1=$2;
  8187. };
  8188. return $1;
  8189. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},globals.ForkPool)})},
  8190. args: [],
  8191. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8192. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  8193. referencedClasses: []
  8194. }),
  8195. globals.ForkPool);
  8196. smalltalk.addMethod(
  8197. smalltalk.method({
  8198. selector: "maxPoolSize:",
  8199. protocol: 'accessing',
  8200. fn: function (anInteger){
  8201. var self=this;
  8202. self["@maxPoolSize"]=anInteger;
  8203. return self},
  8204. args: ["anInteger"],
  8205. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8206. messageSends: [],
  8207. referencedClasses: []
  8208. }),
  8209. globals.ForkPool);
  8210. globals.ForkPool.klass.iVarNames = ['default'];
  8211. smalltalk.addMethod(
  8212. smalltalk.method({
  8213. selector: "default",
  8214. protocol: 'accessing',
  8215. fn: function (){
  8216. var self=this;
  8217. return smalltalk.withContext(function($ctx1) {
  8218. var $2,$1;
  8219. $2=self["@default"];
  8220. if(($receiver = $2) == nil || $receiver == null){
  8221. self["@default"]=self._new();
  8222. $1=self["@default"];
  8223. } else {
  8224. $1=$2;
  8225. };
  8226. return $1;
  8227. }, function($ctx1) {$ctx1.fill(self,"default",{},globals.ForkPool.klass)})},
  8228. args: [],
  8229. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8230. messageSends: ["ifNil:", "new"],
  8231. referencedClasses: []
  8232. }),
  8233. globals.ForkPool.klass);
  8234. smalltalk.addMethod(
  8235. smalltalk.method({
  8236. selector: "defaultMaxPoolSize",
  8237. protocol: 'accessing',
  8238. fn: function (){
  8239. var self=this;
  8240. return (100);
  8241. },
  8242. args: [],
  8243. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8244. messageSends: [],
  8245. referencedClasses: []
  8246. }),
  8247. globals.ForkPool.klass);
  8248. smalltalk.addMethod(
  8249. smalltalk.method({
  8250. selector: "resetDefault",
  8251. protocol: 'accessing',
  8252. fn: function (){
  8253. var self=this;
  8254. self["@default"]=nil;
  8255. return self},
  8256. args: [],
  8257. source: "resetDefault\x0a\x09default := nil",
  8258. messageSends: [],
  8259. referencedClasses: []
  8260. }),
  8261. globals.ForkPool.klass);
  8262. smalltalk.addClass('Message', globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8263. 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.";
  8264. smalltalk.addMethod(
  8265. smalltalk.method({
  8266. selector: "arguments",
  8267. protocol: 'accessing',
  8268. fn: function (){
  8269. var self=this;
  8270. var $1;
  8271. $1=self["@arguments"];
  8272. return $1;
  8273. },
  8274. args: [],
  8275. source: "arguments\x0a\x09^ arguments",
  8276. messageSends: [],
  8277. referencedClasses: []
  8278. }),
  8279. globals.Message);
  8280. smalltalk.addMethod(
  8281. smalltalk.method({
  8282. selector: "arguments:",
  8283. protocol: 'accessing',
  8284. fn: function (anArray){
  8285. var self=this;
  8286. self["@arguments"]=anArray;
  8287. return self},
  8288. args: ["anArray"],
  8289. source: "arguments: anArray\x0a\x09arguments := anArray",
  8290. messageSends: [],
  8291. referencedClasses: []
  8292. }),
  8293. globals.Message);
  8294. smalltalk.addMethod(
  8295. smalltalk.method({
  8296. selector: "printOn:",
  8297. protocol: 'printing',
  8298. fn: function (aStream){
  8299. var self=this;
  8300. return smalltalk.withContext(function($ctx1) {
  8301. var $1;
  8302. globals.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  8303. _st(aStream)._nextPutAll_("(");
  8304. $ctx1.sendIdx["nextPutAll:"]=1;
  8305. _st(aStream)._nextPutAll_(self._selector());
  8306. $ctx1.sendIdx["nextPutAll:"]=2;
  8307. $1=_st(aStream)._nextPutAll_(")");
  8308. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Message)})},
  8309. args: ["aStream"],
  8310. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8311. messageSends: ["printOn:", "nextPutAll:", "selector"],
  8312. referencedClasses: []
  8313. }),
  8314. globals.Message);
  8315. smalltalk.addMethod(
  8316. smalltalk.method({
  8317. selector: "selector",
  8318. protocol: 'accessing',
  8319. fn: function (){
  8320. var self=this;
  8321. var $1;
  8322. $1=self["@selector"];
  8323. return $1;
  8324. },
  8325. args: [],
  8326. source: "selector\x0a\x09^ selector",
  8327. messageSends: [],
  8328. referencedClasses: []
  8329. }),
  8330. globals.Message);
  8331. smalltalk.addMethod(
  8332. smalltalk.method({
  8333. selector: "selector:",
  8334. protocol: 'accessing',
  8335. fn: function (aString){
  8336. var self=this;
  8337. self["@selector"]=aString;
  8338. return self},
  8339. args: ["aString"],
  8340. source: "selector: aString\x0a\x09selector := aString",
  8341. messageSends: [],
  8342. referencedClasses: []
  8343. }),
  8344. globals.Message);
  8345. smalltalk.addMethod(
  8346. smalltalk.method({
  8347. selector: "sendTo:",
  8348. protocol: 'actions',
  8349. fn: function (anObject){
  8350. var self=this;
  8351. return smalltalk.withContext(function($ctx1) {
  8352. var $1;
  8353. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8354. return $1;
  8355. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},globals.Message)})},
  8356. args: ["anObject"],
  8357. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8358. messageSends: ["perform:withArguments:", "selector", "arguments"],
  8359. referencedClasses: []
  8360. }),
  8361. globals.Message);
  8362. smalltalk.addMethod(
  8363. smalltalk.method({
  8364. selector: "selector:arguments:",
  8365. protocol: 'instance creation',
  8366. fn: function (aString,anArray){
  8367. var self=this;
  8368. return smalltalk.withContext(function($ctx1) {
  8369. var $2,$3,$1;
  8370. $2=self._new();
  8371. _st($2)._selector_(aString);
  8372. _st($2)._arguments_(anArray);
  8373. $3=_st($2)._yourself();
  8374. $1=$3;
  8375. return $1;
  8376. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},globals.Message.klass)})},
  8377. args: ["aString", "anArray"],
  8378. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8379. messageSends: ["selector:", "new", "arguments:", "yourself"],
  8380. referencedClasses: []
  8381. }),
  8382. globals.Message.klass);
  8383. smalltalk.addClass('MessageSend', globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8384. 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.";
  8385. smalltalk.addMethod(
  8386. smalltalk.method({
  8387. selector: "arguments",
  8388. protocol: 'accessing',
  8389. fn: function (){
  8390. var self=this;
  8391. return smalltalk.withContext(function($ctx1) {
  8392. var $1;
  8393. $1=_st(self["@message"])._arguments();
  8394. return $1;
  8395. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MessageSend)})},
  8396. args: [],
  8397. source: "arguments\x0a\x09^ message arguments",
  8398. messageSends: ["arguments"],
  8399. referencedClasses: []
  8400. }),
  8401. globals.MessageSend);
  8402. smalltalk.addMethod(
  8403. smalltalk.method({
  8404. selector: "arguments:",
  8405. protocol: 'accessing',
  8406. fn: function (aCollection){
  8407. var self=this;
  8408. return smalltalk.withContext(function($ctx1) {
  8409. _st(self["@message"])._arguments_(aCollection);
  8410. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.MessageSend)})},
  8411. args: ["aCollection"],
  8412. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8413. messageSends: ["arguments:"],
  8414. referencedClasses: []
  8415. }),
  8416. globals.MessageSend);
  8417. smalltalk.addMethod(
  8418. smalltalk.method({
  8419. selector: "initialize",
  8420. protocol: 'initialization',
  8421. fn: function (){
  8422. var self=this;
  8423. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  8424. return smalltalk.withContext(function($ctx1) {
  8425. globals.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []);
  8426. self["@message"]=_st($Message())._new();
  8427. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MessageSend)})},
  8428. args: [],
  8429. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8430. messageSends: ["initialize", "new"],
  8431. referencedClasses: ["Message"]
  8432. }),
  8433. globals.MessageSend);
  8434. smalltalk.addMethod(
  8435. smalltalk.method({
  8436. selector: "printOn:",
  8437. protocol: 'printing',
  8438. fn: function (aStream){
  8439. var self=this;
  8440. return smalltalk.withContext(function($ctx1) {
  8441. var $1;
  8442. globals.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  8443. _st(aStream)._nextPutAll_("(");
  8444. $ctx1.sendIdx["nextPutAll:"]=1;
  8445. _st(aStream)._nextPutAll_(self._receiver());
  8446. $ctx1.sendIdx["nextPutAll:"]=2;
  8447. _st(aStream)._nextPutAll_(" >> ");
  8448. $ctx1.sendIdx["nextPutAll:"]=3;
  8449. _st(aStream)._nextPutAll_(self._selector());
  8450. $ctx1.sendIdx["nextPutAll:"]=4;
  8451. $1=_st(aStream)._nextPutAll_(")");
  8452. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MessageSend)})},
  8453. args: ["aStream"],
  8454. 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: ')'",
  8455. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
  8456. referencedClasses: []
  8457. }),
  8458. globals.MessageSend);
  8459. smalltalk.addMethod(
  8460. smalltalk.method({
  8461. selector: "receiver",
  8462. protocol: 'accessing',
  8463. fn: function (){
  8464. var self=this;
  8465. var $1;
  8466. $1=self["@receiver"];
  8467. return $1;
  8468. },
  8469. args: [],
  8470. source: "receiver\x0a\x09^ receiver",
  8471. messageSends: [],
  8472. referencedClasses: []
  8473. }),
  8474. globals.MessageSend);
  8475. smalltalk.addMethod(
  8476. smalltalk.method({
  8477. selector: "receiver:",
  8478. protocol: 'accessing',
  8479. fn: function (anObject){
  8480. var self=this;
  8481. self["@receiver"]=anObject;
  8482. return self},
  8483. args: ["anObject"],
  8484. source: "receiver: anObject\x0a\x09receiver := anObject",
  8485. messageSends: [],
  8486. referencedClasses: []
  8487. }),
  8488. globals.MessageSend);
  8489. smalltalk.addMethod(
  8490. smalltalk.method({
  8491. selector: "selector",
  8492. protocol: 'accessing',
  8493. fn: function (){
  8494. var self=this;
  8495. return smalltalk.withContext(function($ctx1) {
  8496. var $1;
  8497. $1=_st(self["@message"])._selector();
  8498. return $1;
  8499. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MessageSend)})},
  8500. args: [],
  8501. source: "selector\x0a\x09^ message selector",
  8502. messageSends: ["selector"],
  8503. referencedClasses: []
  8504. }),
  8505. globals.MessageSend);
  8506. smalltalk.addMethod(
  8507. smalltalk.method({
  8508. selector: "selector:",
  8509. protocol: 'accessing',
  8510. fn: function (aString){
  8511. var self=this;
  8512. return smalltalk.withContext(function($ctx1) {
  8513. _st(self["@message"])._selector_(aString);
  8514. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.MessageSend)})},
  8515. args: ["aString"],
  8516. source: "selector: aString\x0a\x09message selector: aString",
  8517. messageSends: ["selector:"],
  8518. referencedClasses: []
  8519. }),
  8520. globals.MessageSend);
  8521. smalltalk.addMethod(
  8522. smalltalk.method({
  8523. selector: "value",
  8524. protocol: 'evaluating',
  8525. fn: function (){
  8526. var self=this;
  8527. return smalltalk.withContext(function($ctx1) {
  8528. var $1;
  8529. $1=_st(self["@message"])._sendTo_(self._receiver());
  8530. return $1;
  8531. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.MessageSend)})},
  8532. args: [],
  8533. source: "value\x0a\x09^ message sendTo: self receiver",
  8534. messageSends: ["sendTo:", "receiver"],
  8535. referencedClasses: []
  8536. }),
  8537. globals.MessageSend);
  8538. smalltalk.addMethod(
  8539. smalltalk.method({
  8540. selector: "value:",
  8541. protocol: 'evaluating',
  8542. fn: function (anObject){
  8543. var self=this;
  8544. return smalltalk.withContext(function($ctx1) {
  8545. var $2,$3,$1;
  8546. $2=self["@message"];
  8547. _st($2)._arguments_([anObject]);
  8548. $3=_st($2)._sendTo_(self._receiver());
  8549. $1=$3;
  8550. return $1;
  8551. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.MessageSend)})},
  8552. args: ["anObject"],
  8553. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  8554. messageSends: ["arguments:", "sendTo:", "receiver"],
  8555. referencedClasses: []
  8556. }),
  8557. globals.MessageSend);
  8558. smalltalk.addMethod(
  8559. smalltalk.method({
  8560. selector: "value:value:",
  8561. protocol: 'evaluating',
  8562. fn: function (firstArgument,secondArgument){
  8563. var self=this;
  8564. return smalltalk.withContext(function($ctx1) {
  8565. var $2,$3,$1;
  8566. $2=self["@message"];
  8567. _st($2)._arguments_([firstArgument,secondArgument]);
  8568. $3=_st($2)._sendTo_(self._receiver());
  8569. $1=$3;
  8570. return $1;
  8571. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.MessageSend)})},
  8572. args: ["firstArgument", "secondArgument"],
  8573. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  8574. messageSends: ["arguments:", "sendTo:", "receiver"],
  8575. referencedClasses: []
  8576. }),
  8577. globals.MessageSend);
  8578. smalltalk.addMethod(
  8579. smalltalk.method({
  8580. selector: "value:value:value:",
  8581. protocol: 'evaluating',
  8582. fn: function (firstArgument,secondArgument,thirdArgument){
  8583. var self=this;
  8584. return smalltalk.withContext(function($ctx1) {
  8585. var $2,$3,$1;
  8586. $2=self["@message"];
  8587. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  8588. $3=_st($2)._sendTo_(self._receiver());
  8589. $1=$3;
  8590. return $1;
  8591. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.MessageSend)})},
  8592. args: ["firstArgument", "secondArgument", "thirdArgument"],
  8593. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  8594. messageSends: ["arguments:", "sendTo:", "receiver"],
  8595. referencedClasses: []
  8596. }),
  8597. globals.MessageSend);
  8598. smalltalk.addMethod(
  8599. smalltalk.method({
  8600. selector: "valueWithPossibleArguments:",
  8601. protocol: 'evaluating',
  8602. fn: function (aCollection){
  8603. var self=this;
  8604. return smalltalk.withContext(function($ctx1) {
  8605. var $1;
  8606. self._arguments_(aCollection);
  8607. $1=self._value();
  8608. return $1;
  8609. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.MessageSend)})},
  8610. args: ["aCollection"],
  8611. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  8612. messageSends: ["arguments:", "value"],
  8613. referencedClasses: []
  8614. }),
  8615. globals.MessageSend);
  8616. smalltalk.addClass('MethodContext', globals.Object, [], 'Kernel-Methods');
  8617. 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`.";
  8618. smalltalk.addMethod(
  8619. smalltalk.method({
  8620. selector: "asString",
  8621. protocol: 'converting',
  8622. fn: function (){
  8623. var self=this;
  8624. return smalltalk.withContext(function($ctx1) {
  8625. var $2,$3,$1;
  8626. $2=self._isBlockContext();
  8627. if(smalltalk.assert($2)){
  8628. $3="a block (in ".__comma(_st(self._methodContext())._asString());
  8629. $ctx1.sendIdx[","]=2;
  8630. $1=_st($3).__comma(")");
  8631. $ctx1.sendIdx[","]=1;
  8632. } else {
  8633. $1=_st(_st(_st(_st(self._receiver())._class())._name()).__comma(" >> ")).__comma(self._selector());
  8634. $ctx1.sendIdx[","]=3;
  8635. };
  8636. return $1;
  8637. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.MethodContext)})},
  8638. args: [],
  8639. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
  8640. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "name", "class", "receiver", "selector"],
  8641. referencedClasses: []
  8642. }),
  8643. globals.MethodContext);
  8644. smalltalk.addMethod(
  8645. smalltalk.method({
  8646. selector: "evaluatedSelector",
  8647. protocol: 'accessing',
  8648. fn: function (){
  8649. var self=this;
  8650. return smalltalk.withContext(function($ctx1) {
  8651. return self.evaluatedSelector;
  8652. return self}, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},globals.MethodContext)})},
  8653. args: [],
  8654. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  8655. messageSends: [],
  8656. referencedClasses: []
  8657. }),
  8658. globals.MethodContext);
  8659. smalltalk.addMethod(
  8660. smalltalk.method({
  8661. selector: "home",
  8662. protocol: 'accessing',
  8663. fn: function (){
  8664. var self=this;
  8665. return smalltalk.withContext(function($ctx1) {
  8666. return self.homeContext;
  8667. return self}, function($ctx1) {$ctx1.fill(self,"home",{},globals.MethodContext)})},
  8668. args: [],
  8669. source: "home\x0a\x09<return self.homeContext>",
  8670. messageSends: [],
  8671. referencedClasses: []
  8672. }),
  8673. globals.MethodContext);
  8674. smalltalk.addMethod(
  8675. smalltalk.method({
  8676. selector: "index",
  8677. protocol: 'accessing',
  8678. fn: function (){
  8679. var self=this;
  8680. return smalltalk.withContext(function($ctx1) {
  8681. return self.index || 0;
  8682. return self}, function($ctx1) {$ctx1.fill(self,"index",{},globals.MethodContext)})},
  8683. args: [],
  8684. source: "index\x0a\x09<return self.index || 0>",
  8685. messageSends: [],
  8686. referencedClasses: []
  8687. }),
  8688. globals.MethodContext);
  8689. smalltalk.addMethod(
  8690. smalltalk.method({
  8691. selector: "isBlockContext",
  8692. protocol: 'testing',
  8693. fn: function (){
  8694. var self=this;
  8695. return smalltalk.withContext(function($ctx1) {
  8696. var $1;
  8697. $1=_st(self._selector())._isNil();
  8698. return $1;
  8699. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},globals.MethodContext)})},
  8700. args: [],
  8701. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  8702. messageSends: ["isNil", "selector"],
  8703. referencedClasses: []
  8704. }),
  8705. globals.MethodContext);
  8706. smalltalk.addMethod(
  8707. smalltalk.method({
  8708. selector: "locals",
  8709. protocol: 'accessing',
  8710. fn: function (){
  8711. var self=this;
  8712. return smalltalk.withContext(function($ctx1) {
  8713. return self.locals || {};
  8714. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},globals.MethodContext)})},
  8715. args: [],
  8716. source: "locals\x0a\x09<return self.locals || {}>",
  8717. messageSends: [],
  8718. referencedClasses: []
  8719. }),
  8720. globals.MethodContext);
  8721. smalltalk.addMethod(
  8722. smalltalk.method({
  8723. selector: "method",
  8724. protocol: 'accessing',
  8725. fn: function (){
  8726. var self=this;
  8727. return smalltalk.withContext(function($ctx1) {
  8728. var $2,$5,$4,$3,$1;
  8729. $2=self._methodContext();
  8730. $ctx1.sendIdx["methodContext"]=1;
  8731. if(($receiver = $2) == nil || $receiver == null){
  8732. $1=$2;
  8733. } else {
  8734. $5=self._methodContext();
  8735. $ctx1.sendIdx["methodContext"]=2;
  8736. $4=_st($5)._receiver();
  8737. $3=_st($4)._class();
  8738. $1=_st($3)._lookupSelector_(_st(self._methodContext())._selector());
  8739. };
  8740. return $1;
  8741. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.MethodContext)})},
  8742. args: [],
  8743. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  8744. messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
  8745. referencedClasses: []
  8746. }),
  8747. globals.MethodContext);
  8748. smalltalk.addMethod(
  8749. smalltalk.method({
  8750. selector: "methodContext",
  8751. protocol: 'accessing',
  8752. fn: function (){
  8753. var self=this;
  8754. return smalltalk.withContext(function($ctx1) {
  8755. var $1,$3,$2;
  8756. $1=self._isBlockContext();
  8757. if(! smalltalk.assert($1)){
  8758. return self;
  8759. };
  8760. $3=self._outerContext();
  8761. if(($receiver = $3) == nil || $receiver == null){
  8762. $2=$3;
  8763. } else {
  8764. var outer;
  8765. outer=$receiver;
  8766. $2=_st(outer)._methodContext();
  8767. };
  8768. return $2;
  8769. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},globals.MethodContext)})},
  8770. args: [],
  8771. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  8772. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"],
  8773. referencedClasses: []
  8774. }),
  8775. globals.MethodContext);
  8776. smalltalk.addMethod(
  8777. smalltalk.method({
  8778. selector: "outerContext",
  8779. protocol: 'accessing',
  8780. fn: function (){
  8781. var self=this;
  8782. return smalltalk.withContext(function($ctx1) {
  8783. return self.outerContext || self.homeContext;
  8784. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},globals.MethodContext)})},
  8785. args: [],
  8786. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  8787. messageSends: [],
  8788. referencedClasses: []
  8789. }),
  8790. globals.MethodContext);
  8791. smalltalk.addMethod(
  8792. smalltalk.method({
  8793. selector: "printOn:",
  8794. protocol: 'printing',
  8795. fn: function (aStream){
  8796. var self=this;
  8797. return smalltalk.withContext(function($ctx1) {
  8798. var $1;
  8799. globals.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  8800. _st(aStream)._nextPutAll_("(");
  8801. $ctx1.sendIdx["nextPutAll:"]=1;
  8802. _st(aStream)._nextPutAll_(self._asString());
  8803. $ctx1.sendIdx["nextPutAll:"]=2;
  8804. $1=_st(aStream)._nextPutAll_(")");
  8805. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MethodContext)})},
  8806. args: ["aStream"],
  8807. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  8808. messageSends: ["printOn:", "nextPutAll:", "asString"],
  8809. referencedClasses: []
  8810. }),
  8811. globals.MethodContext);
  8812. smalltalk.addMethod(
  8813. smalltalk.method({
  8814. selector: "receiver",
  8815. protocol: 'accessing',
  8816. fn: function (){
  8817. var self=this;
  8818. return smalltalk.withContext(function($ctx1) {
  8819. return self.receiver;
  8820. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.MethodContext)})},
  8821. args: [],
  8822. source: "receiver\x0a\x09<return self.receiver>",
  8823. messageSends: [],
  8824. referencedClasses: []
  8825. }),
  8826. globals.MethodContext);
  8827. smalltalk.addMethod(
  8828. smalltalk.method({
  8829. selector: "selector",
  8830. protocol: 'accessing',
  8831. fn: function (){
  8832. var self=this;
  8833. return smalltalk.withContext(function($ctx1) {
  8834. if(self.selector) {
  8835. return smalltalk.convertSelector(self.selector);
  8836. } else {
  8837. return nil;
  8838. }
  8839. ;
  8840. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MethodContext)})},
  8841. args: [],
  8842. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  8843. messageSends: [],
  8844. referencedClasses: []
  8845. }),
  8846. globals.MethodContext);
  8847. smalltalk.addMethod(
  8848. smalltalk.method({
  8849. selector: "sendIndexAt:",
  8850. protocol: 'accessing',
  8851. fn: function (aSelector){
  8852. var self=this;
  8853. return smalltalk.withContext(function($ctx1) {
  8854. return self.sendIdx[aSelector] || 0;
  8855. return self}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},globals.MethodContext)})},
  8856. args: ["aSelector"],
  8857. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  8858. messageSends: [],
  8859. referencedClasses: []
  8860. }),
  8861. globals.MethodContext);
  8862. smalltalk.addMethod(
  8863. smalltalk.method({
  8864. selector: "sendIndexes",
  8865. protocol: 'accessing',
  8866. fn: function (){
  8867. var self=this;
  8868. return smalltalk.withContext(function($ctx1) {
  8869. return self.sendIdx;
  8870. return self}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.MethodContext)})},
  8871. args: [],
  8872. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  8873. messageSends: [],
  8874. referencedClasses: []
  8875. }),
  8876. globals.MethodContext);
  8877. smalltalk.addMethod(
  8878. smalltalk.method({
  8879. selector: "temps",
  8880. protocol: 'accessing',
  8881. fn: function (){
  8882. var self=this;
  8883. return smalltalk.withContext(function($ctx1) {
  8884. var $1;
  8885. self._deprecatedAPI();
  8886. $1=self._locals();
  8887. return $1;
  8888. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.MethodContext)})},
  8889. args: [],
  8890. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  8891. messageSends: ["deprecatedAPI", "locals"],
  8892. referencedClasses: []
  8893. }),
  8894. globals.MethodContext);
  8895. smalltalk.addClass('NativeFunction', globals.Object, [], 'Kernel-Methods');
  8896. 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' ]";
  8897. smalltalk.addMethod(
  8898. smalltalk.method({
  8899. selector: "constructor:",
  8900. protocol: 'instance creation',
  8901. fn: function (aString){
  8902. var self=this;
  8903. return smalltalk.withContext(function($ctx1) {
  8904. var native=eval(aString);
  8905. return new native();
  8906. ;
  8907. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},globals.NativeFunction.klass)})},
  8908. args: ["aString"],
  8909. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  8910. messageSends: [],
  8911. referencedClasses: []
  8912. }),
  8913. globals.NativeFunction.klass);
  8914. smalltalk.addMethod(
  8915. smalltalk.method({
  8916. selector: "constructor:value:",
  8917. protocol: 'instance creation',
  8918. fn: function (aString,anObject){
  8919. var self=this;
  8920. return smalltalk.withContext(function($ctx1) {
  8921. var native=eval(aString);
  8922. return new native(anObject);
  8923. ;
  8924. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},globals.NativeFunction.klass)})},
  8925. args: ["aString", "anObject"],
  8926. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  8927. messageSends: [],
  8928. referencedClasses: []
  8929. }),
  8930. globals.NativeFunction.klass);
  8931. smalltalk.addMethod(
  8932. smalltalk.method({
  8933. selector: "constructor:value:value:",
  8934. protocol: 'instance creation',
  8935. fn: function (aString,anObject,anObject2){
  8936. var self=this;
  8937. return smalltalk.withContext(function($ctx1) {
  8938. var native=eval(aString);
  8939. return new native(anObject,anObject2);
  8940. ;
  8941. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},globals.NativeFunction.klass)})},
  8942. args: ["aString", "anObject", "anObject2"],
  8943. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  8944. messageSends: [],
  8945. referencedClasses: []
  8946. }),
  8947. globals.NativeFunction.klass);
  8948. smalltalk.addMethod(
  8949. smalltalk.method({
  8950. selector: "constructor:value:value:value:",
  8951. protocol: 'instance creation',
  8952. fn: function (aString,anObject,anObject2,anObject3){
  8953. var self=this;
  8954. return smalltalk.withContext(function($ctx1) {
  8955. var native=eval(aString);
  8956. return new native(anObject,anObject2, anObject3);
  8957. ;
  8958. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.NativeFunction.klass)})},
  8959. args: ["aString", "anObject", "anObject2", "anObject3"],
  8960. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>",
  8961. messageSends: [],
  8962. referencedClasses: []
  8963. }),
  8964. globals.NativeFunction.klass);
  8965. smalltalk.addMethod(
  8966. smalltalk.method({
  8967. selector: "exists:",
  8968. protocol: 'testing',
  8969. fn: function (aString){
  8970. var self=this;
  8971. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  8972. return smalltalk.withContext(function($ctx1) {
  8973. var $1;
  8974. $1=_st($PlatformInterface())._existsGlobal_(aString);
  8975. return $1;
  8976. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},globals.NativeFunction.klass)})},
  8977. args: ["aString"],
  8978. source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString",
  8979. messageSends: ["existsGlobal:"],
  8980. referencedClasses: ["PlatformInterface"]
  8981. }),
  8982. globals.NativeFunction.klass);
  8983. smalltalk.addClass('Timeout', globals.Object, ['rawTimeout'], 'Kernel-Methods');
  8984. 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.";
  8985. smalltalk.addMethod(
  8986. smalltalk.method({
  8987. selector: "clearInterval",
  8988. protocol: 'timeout/interval',
  8989. fn: function (){
  8990. var self=this;
  8991. return smalltalk.withContext(function($ctx1) {
  8992. var interval = self["@rawTimeout"];
  8993. clearInterval(interval);
  8994. ;
  8995. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},globals.Timeout)})},
  8996. args: [],
  8997. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  8998. messageSends: [],
  8999. referencedClasses: []
  9000. }),
  9001. globals.Timeout);
  9002. smalltalk.addMethod(
  9003. smalltalk.method({
  9004. selector: "clearTimeout",
  9005. protocol: 'timeout/interval',
  9006. fn: function (){
  9007. var self=this;
  9008. return smalltalk.withContext(function($ctx1) {
  9009. var timeout = self["@rawTimeout"];
  9010. clearTimeout(timeout);
  9011. ;
  9012. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},globals.Timeout)})},
  9013. args: [],
  9014. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  9015. messageSends: [],
  9016. referencedClasses: []
  9017. }),
  9018. globals.Timeout);
  9019. smalltalk.addMethod(
  9020. smalltalk.method({
  9021. selector: "rawTimeout:",
  9022. protocol: 'accessing',
  9023. fn: function (anObject){
  9024. var self=this;
  9025. self["@rawTimeout"]=anObject;
  9026. return self},
  9027. args: ["anObject"],
  9028. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  9029. messageSends: [],
  9030. referencedClasses: []
  9031. }),
  9032. globals.Timeout);
  9033. smalltalk.addMethod(
  9034. smalltalk.method({
  9035. selector: "on:",
  9036. protocol: 'instance creation',
  9037. fn: function (anObject){
  9038. var self=this;
  9039. return smalltalk.withContext(function($ctx1) {
  9040. var $2,$3,$1;
  9041. $2=self._new();
  9042. _st($2)._rawTimeout_(anObject);
  9043. $3=_st($2)._yourself();
  9044. $1=$3;
  9045. return $1;
  9046. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},globals.Timeout.klass)})},
  9047. args: ["anObject"],
  9048. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  9049. messageSends: ["rawTimeout:", "new", "yourself"],
  9050. referencedClasses: []
  9051. }),
  9052. globals.Timeout.klass);
  9053. });
  9054. define("amber_core/Kernel-Collections", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  9055. smalltalk.addPackage('Kernel-Collections');
  9056. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9057. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  9058. 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:`";
  9059. smalltalk.addMethod(
  9060. smalltalk.method({
  9061. selector: "=",
  9062. protocol: 'comparing',
  9063. fn: function (anAssociation){
  9064. var self=this;
  9065. return smalltalk.withContext(function($ctx1) {
  9066. var $3,$2,$5,$4,$6,$1;
  9067. $3=self._class();
  9068. $ctx1.sendIdx["class"]=1;
  9069. $2=_st($3).__eq(_st(anAssociation)._class());
  9070. $ctx1.sendIdx["="]=1;
  9071. $1=_st($2)._and_((function(){
  9072. return smalltalk.withContext(function($ctx2) {
  9073. $5=self._key();
  9074. $ctx2.sendIdx["key"]=1;
  9075. $4=_st($5).__eq(_st(anAssociation)._key());
  9076. $ctx2.sendIdx["="]=2;
  9077. return _st($4)._and_((function(){
  9078. return smalltalk.withContext(function($ctx3) {
  9079. $6=self._value();
  9080. $ctx3.sendIdx["value"]=1;
  9081. return _st($6).__eq(_st(anAssociation)._value());
  9082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  9083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9084. $ctx1.sendIdx["and:"]=1;
  9085. return $1;
  9086. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)})},
  9087. args: ["anAssociation"],
  9088. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  9089. messageSends: ["and:", "=", "class", "key", "value"],
  9090. referencedClasses: []
  9091. }),
  9092. globals.Association);
  9093. smalltalk.addMethod(
  9094. smalltalk.method({
  9095. selector: "key",
  9096. protocol: 'accessing',
  9097. fn: function (){
  9098. var self=this;
  9099. var $1;
  9100. $1=self["@key"];
  9101. return $1;
  9102. },
  9103. args: [],
  9104. source: "key\x0a\x09^ key",
  9105. messageSends: [],
  9106. referencedClasses: []
  9107. }),
  9108. globals.Association);
  9109. smalltalk.addMethod(
  9110. smalltalk.method({
  9111. selector: "key:",
  9112. protocol: 'accessing',
  9113. fn: function (aKey){
  9114. var self=this;
  9115. self["@key"]=aKey;
  9116. return self},
  9117. args: ["aKey"],
  9118. source: "key: aKey\x0a\x09key := aKey",
  9119. messageSends: [],
  9120. referencedClasses: []
  9121. }),
  9122. globals.Association);
  9123. smalltalk.addMethod(
  9124. smalltalk.method({
  9125. selector: "printOn:",
  9126. protocol: 'printing',
  9127. fn: function (aStream){
  9128. var self=this;
  9129. return smalltalk.withContext(function($ctx1) {
  9130. _st(self._key())._printOn_(aStream);
  9131. $ctx1.sendIdx["printOn:"]=1;
  9132. _st(aStream)._nextPutAll_(" -> ");
  9133. _st(self._value())._printOn_(aStream);
  9134. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)})},
  9135. args: ["aStream"],
  9136. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  9137. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  9138. referencedClasses: []
  9139. }),
  9140. globals.Association);
  9141. smalltalk.addMethod(
  9142. smalltalk.method({
  9143. selector: "value",
  9144. protocol: 'accessing',
  9145. fn: function (){
  9146. var self=this;
  9147. var $1;
  9148. $1=self["@value"];
  9149. return $1;
  9150. },
  9151. args: [],
  9152. source: "value\x0a\x09^ value",
  9153. messageSends: [],
  9154. referencedClasses: []
  9155. }),
  9156. globals.Association);
  9157. smalltalk.addMethod(
  9158. smalltalk.method({
  9159. selector: "value:",
  9160. protocol: 'accessing',
  9161. fn: function (aValue){
  9162. var self=this;
  9163. self["@value"]=aValue;
  9164. return self},
  9165. args: ["aValue"],
  9166. source: "value: aValue\x0a\x09value := aValue",
  9167. messageSends: [],
  9168. referencedClasses: []
  9169. }),
  9170. globals.Association);
  9171. smalltalk.addMethod(
  9172. smalltalk.method({
  9173. selector: "key:value:",
  9174. protocol: 'instance creation',
  9175. fn: function (aKey,aValue){
  9176. var self=this;
  9177. return smalltalk.withContext(function($ctx1) {
  9178. var $2,$3,$1;
  9179. $2=self._new();
  9180. _st($2)._key_(aKey);
  9181. _st($2)._value_(aValue);
  9182. $3=_st($2)._yourself();
  9183. $1=$3;
  9184. return $1;
  9185. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)})},
  9186. args: ["aKey", "aValue"],
  9187. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  9188. messageSends: ["key:", "new", "value:", "yourself"],
  9189. referencedClasses: []
  9190. }),
  9191. globals.Association.klass);
  9192. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  9193. 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`.";
  9194. smalltalk.addMethod(
  9195. smalltalk.method({
  9196. selector: "bucketOfElement:",
  9197. protocol: 'accessing',
  9198. fn: function (anObject){
  9199. var self=this;
  9200. return smalltalk.withContext(function($ctx1) {
  9201. var hash = self['@hashBlock'](anObject);
  9202. if (!hash) return null;
  9203. var buckets = self['@buckets'],
  9204. bucket = buckets[hash];
  9205. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  9206. return bucket;
  9207. ;
  9208. return self}, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)})},
  9209. args: ["anObject"],
  9210. 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>",
  9211. messageSends: [],
  9212. referencedClasses: []
  9213. }),
  9214. globals.BucketStore);
  9215. smalltalk.addMethod(
  9216. smalltalk.method({
  9217. selector: "do:",
  9218. protocol: 'enumerating',
  9219. fn: function (aBlock){
  9220. var self=this;
  9221. return smalltalk.withContext(function($ctx1) {
  9222. var buckets = self['@buckets'];
  9223. var keys = Object.keys(buckets);
  9224. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  9225. ;
  9226. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)})},
  9227. args: ["aBlock"],
  9228. 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>",
  9229. messageSends: [],
  9230. referencedClasses: []
  9231. }),
  9232. globals.BucketStore);
  9233. smalltalk.addMethod(
  9234. smalltalk.method({
  9235. selector: "hashBlock:",
  9236. protocol: 'accessing',
  9237. fn: function (aBlock){
  9238. var self=this;
  9239. self["@hashBlock"]=aBlock;
  9240. return self},
  9241. args: ["aBlock"],
  9242. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  9243. messageSends: [],
  9244. referencedClasses: []
  9245. }),
  9246. globals.BucketStore);
  9247. smalltalk.addMethod(
  9248. smalltalk.method({
  9249. selector: "initialize",
  9250. protocol: 'initialization',
  9251. fn: function (){
  9252. var self=this;
  9253. return smalltalk.withContext(function($ctx1) {
  9254. globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []);
  9255. self._removeAll();
  9256. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)})},
  9257. args: [],
  9258. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  9259. messageSends: ["initialize", "removeAll"],
  9260. referencedClasses: []
  9261. }),
  9262. globals.BucketStore);
  9263. smalltalk.addMethod(
  9264. smalltalk.method({
  9265. selector: "newBucket",
  9266. protocol: 'private',
  9267. fn: function (){
  9268. var self=this;
  9269. return smalltalk.withContext(function($ctx1) {
  9270. self._subclassResponsibility();
  9271. return self}, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)})},
  9272. args: [],
  9273. source: "newBucket\x0a\x09self subclassResponsibility",
  9274. messageSends: ["subclassResponsibility"],
  9275. referencedClasses: []
  9276. }),
  9277. globals.BucketStore);
  9278. smalltalk.addMethod(
  9279. smalltalk.method({
  9280. selector: "removeAll",
  9281. protocol: 'adding/removing',
  9282. fn: function (){
  9283. var self=this;
  9284. return smalltalk.withContext(function($ctx1) {
  9285. self['@buckets'] = Object.create(null);;
  9286. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)})},
  9287. args: [],
  9288. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  9289. messageSends: [],
  9290. referencedClasses: []
  9291. }),
  9292. globals.BucketStore);
  9293. smalltalk.addMethod(
  9294. smalltalk.method({
  9295. selector: "hashBlock:",
  9296. protocol: 'instance creation',
  9297. fn: function (aBlock){
  9298. var self=this;
  9299. return smalltalk.withContext(function($ctx1) {
  9300. var $2,$3,$1;
  9301. $2=self._new();
  9302. _st($2)._hashBlock_(aBlock);
  9303. $3=_st($2)._yourself();
  9304. $1=$3;
  9305. return $1;
  9306. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)})},
  9307. args: ["aBlock"],
  9308. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  9309. messageSends: ["hashBlock:", "new", "yourself"],
  9310. referencedClasses: []
  9311. }),
  9312. globals.BucketStore.klass);
  9313. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  9314. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  9315. smalltalk.addMethod(
  9316. smalltalk.method({
  9317. selector: "newBucket",
  9318. protocol: 'private',
  9319. fn: function (){
  9320. var self=this;
  9321. var $1;
  9322. $1=[];
  9323. return $1;
  9324. },
  9325. args: [],
  9326. source: "newBucket\x0a\x09^ #()",
  9327. messageSends: [],
  9328. referencedClasses: []
  9329. }),
  9330. globals.ArrayBucketStore);
  9331. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  9332. 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.";
  9333. smalltalk.addMethod(
  9334. smalltalk.method({
  9335. selector: ",",
  9336. protocol: 'copying',
  9337. fn: function (aCollection){
  9338. var self=this;
  9339. return smalltalk.withContext(function($ctx1) {
  9340. var $2,$3,$1;
  9341. $2=self._copy();
  9342. _st($2)._addAll_(aCollection);
  9343. $3=_st($2)._yourself();
  9344. $1=$3;
  9345. return $1;
  9346. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)})},
  9347. args: ["aCollection"],
  9348. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9349. messageSends: ["addAll:", "copy", "yourself"],
  9350. referencedClasses: []
  9351. }),
  9352. globals.Collection);
  9353. smalltalk.addMethod(
  9354. smalltalk.method({
  9355. selector: "add:",
  9356. protocol: 'adding/removing',
  9357. fn: function (anObject){
  9358. var self=this;
  9359. return smalltalk.withContext(function($ctx1) {
  9360. self._subclassResponsibility();
  9361. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)})},
  9362. args: ["anObject"],
  9363. source: "add: anObject\x0a\x09self subclassResponsibility",
  9364. messageSends: ["subclassResponsibility"],
  9365. referencedClasses: []
  9366. }),
  9367. globals.Collection);
  9368. smalltalk.addMethod(
  9369. smalltalk.method({
  9370. selector: "addAll:",
  9371. protocol: 'adding/removing',
  9372. fn: function (aCollection){
  9373. var self=this;
  9374. return smalltalk.withContext(function($ctx1) {
  9375. _st(aCollection)._do_((function(each){
  9376. return smalltalk.withContext(function($ctx2) {
  9377. return self._add_(each);
  9378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9379. return aCollection;
  9380. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)})},
  9381. args: ["aCollection"],
  9382. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  9383. messageSends: ["do:", "add:"],
  9384. referencedClasses: []
  9385. }),
  9386. globals.Collection);
  9387. smalltalk.addMethod(
  9388. smalltalk.method({
  9389. selector: "allSatisfy:",
  9390. protocol: 'enumerating',
  9391. fn: function (aBlock){
  9392. var self=this;
  9393. return smalltalk.withContext(function($ctx1) {
  9394. var $1;
  9395. var $early={};
  9396. try {
  9397. self._do_((function(each){
  9398. return smalltalk.withContext(function($ctx2) {
  9399. $1=_st(aBlock)._value_(each);
  9400. if(! smalltalk.assert($1)){
  9401. throw $early=[false];
  9402. };
  9403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9404. return true;
  9405. }
  9406. catch(e) {if(e===$early)return e[0]; throw e}
  9407. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)})},
  9408. args: ["aBlock"],
  9409. 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",
  9410. messageSends: ["do:", "ifFalse:", "value:"],
  9411. referencedClasses: []
  9412. }),
  9413. globals.Collection);
  9414. smalltalk.addMethod(
  9415. smalltalk.method({
  9416. selector: "anyOne",
  9417. protocol: 'adding/removing',
  9418. fn: function (){
  9419. var self=this;
  9420. return smalltalk.withContext(function($ctx1) {
  9421. var $early={};
  9422. try {
  9423. self._ifEmpty_((function(){
  9424. return smalltalk.withContext(function($ctx2) {
  9425. return self._error_("Collection is empty");
  9426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9427. self._do_((function(each){
  9428. throw $early=[each];
  9429. }));
  9430. return self}
  9431. catch(e) {if(e===$early)return e[0]; throw e}
  9432. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)})},
  9433. args: [],
  9434. 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 ]",
  9435. messageSends: ["ifEmpty:", "error:", "do:"],
  9436. referencedClasses: []
  9437. }),
  9438. globals.Collection);
  9439. smalltalk.addMethod(
  9440. smalltalk.method({
  9441. selector: "anySatisfy:",
  9442. protocol: 'enumerating',
  9443. fn: function (aBlock){
  9444. var self=this;
  9445. return smalltalk.withContext(function($ctx1) {
  9446. var $1;
  9447. var $early={};
  9448. try {
  9449. self._do_((function(each){
  9450. return smalltalk.withContext(function($ctx2) {
  9451. $1=_st(aBlock)._value_(each);
  9452. if(smalltalk.assert($1)){
  9453. throw $early=[true];
  9454. };
  9455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9456. return false;
  9457. }
  9458. catch(e) {if(e===$early)return e[0]; throw e}
  9459. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)})},
  9460. args: ["aBlock"],
  9461. 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",
  9462. messageSends: ["do:", "ifTrue:", "value:"],
  9463. referencedClasses: []
  9464. }),
  9465. globals.Collection);
  9466. smalltalk.addMethod(
  9467. smalltalk.method({
  9468. selector: "asArray",
  9469. protocol: 'converting',
  9470. fn: function (){
  9471. var self=this;
  9472. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  9473. return smalltalk.withContext(function($ctx1) {
  9474. var $1;
  9475. $1=_st($Array())._withAll_(self);
  9476. return $1;
  9477. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)})},
  9478. args: [],
  9479. source: "asArray\x0a\x09^ Array withAll: self",
  9480. messageSends: ["withAll:"],
  9481. referencedClasses: ["Array"]
  9482. }),
  9483. globals.Collection);
  9484. smalltalk.addMethod(
  9485. smalltalk.method({
  9486. selector: "asJSON",
  9487. protocol: 'converting',
  9488. fn: function (){
  9489. var self=this;
  9490. return smalltalk.withContext(function($ctx1) {
  9491. var $1;
  9492. $1=_st(self._asArray())._collect_((function(each){
  9493. return smalltalk.withContext(function($ctx2) {
  9494. return _st(each)._asJSON();
  9495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9496. return $1;
  9497. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)})},
  9498. args: [],
  9499. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  9500. messageSends: ["collect:", "asArray", "asJSON"],
  9501. referencedClasses: []
  9502. }),
  9503. globals.Collection);
  9504. smalltalk.addMethod(
  9505. smalltalk.method({
  9506. selector: "asOrderedCollection",
  9507. protocol: 'converting',
  9508. fn: function (){
  9509. var self=this;
  9510. return smalltalk.withContext(function($ctx1) {
  9511. var $1;
  9512. $1=self._asArray();
  9513. return $1;
  9514. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)})},
  9515. args: [],
  9516. source: "asOrderedCollection\x0a\x09^ self asArray",
  9517. messageSends: ["asArray"],
  9518. referencedClasses: []
  9519. }),
  9520. globals.Collection);
  9521. smalltalk.addMethod(
  9522. smalltalk.method({
  9523. selector: "asSet",
  9524. protocol: 'converting',
  9525. fn: function (){
  9526. var self=this;
  9527. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  9528. return smalltalk.withContext(function($ctx1) {
  9529. var $1;
  9530. $1=_st($Set())._withAll_(self);
  9531. return $1;
  9532. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)})},
  9533. args: [],
  9534. source: "asSet\x0a\x09^ Set withAll: self",
  9535. messageSends: ["withAll:"],
  9536. referencedClasses: ["Set"]
  9537. }),
  9538. globals.Collection);
  9539. smalltalk.addMethod(
  9540. smalltalk.method({
  9541. selector: "collect:",
  9542. protocol: 'enumerating',
  9543. fn: function (aBlock){
  9544. var self=this;
  9545. var stream;
  9546. return smalltalk.withContext(function($ctx1) {
  9547. var $1;
  9548. stream=_st(_st(self._class())._new())._writeStream();
  9549. self._do_((function(each){
  9550. return smalltalk.withContext(function($ctx2) {
  9551. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  9552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9553. $1=_st(stream)._contents();
  9554. return $1;
  9555. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  9556. args: ["aBlock"],
  9557. 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",
  9558. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  9559. referencedClasses: []
  9560. }),
  9561. globals.Collection);
  9562. smalltalk.addMethod(
  9563. smalltalk.method({
  9564. selector: "contains:",
  9565. protocol: 'testing',
  9566. fn: function (aBlock){
  9567. var self=this;
  9568. return smalltalk.withContext(function($ctx1) {
  9569. var $1;
  9570. self._deprecatedAPI();
  9571. $1=self._anySatisfy_(aBlock);
  9572. return $1;
  9573. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)})},
  9574. args: ["aBlock"],
  9575. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  9576. messageSends: ["deprecatedAPI", "anySatisfy:"],
  9577. referencedClasses: []
  9578. }),
  9579. globals.Collection);
  9580. smalltalk.addMethod(
  9581. smalltalk.method({
  9582. selector: "copyWith:",
  9583. protocol: 'copying',
  9584. fn: function (anObject){
  9585. var self=this;
  9586. return smalltalk.withContext(function($ctx1) {
  9587. var $2,$3,$1;
  9588. $2=self._copy();
  9589. _st($2)._add_(anObject);
  9590. $3=_st($2)._yourself();
  9591. $1=$3;
  9592. return $1;
  9593. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)})},
  9594. args: ["anObject"],
  9595. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  9596. messageSends: ["add:", "copy", "yourself"],
  9597. referencedClasses: []
  9598. }),
  9599. globals.Collection);
  9600. smalltalk.addMethod(
  9601. smalltalk.method({
  9602. selector: "copyWithAll:",
  9603. protocol: 'copying',
  9604. fn: function (aCollection){
  9605. var self=this;
  9606. return smalltalk.withContext(function($ctx1) {
  9607. var $2,$3,$1;
  9608. $2=self._copy();
  9609. _st($2)._addAll_(aCollection);
  9610. $3=_st($2)._yourself();
  9611. $1=$3;
  9612. return $1;
  9613. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)})},
  9614. args: ["aCollection"],
  9615. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  9616. messageSends: ["addAll:", "copy", "yourself"],
  9617. referencedClasses: []
  9618. }),
  9619. globals.Collection);
  9620. smalltalk.addMethod(
  9621. smalltalk.method({
  9622. selector: "copyWithoutAll:",
  9623. protocol: 'copying',
  9624. fn: function (aCollection){
  9625. var self=this;
  9626. return smalltalk.withContext(function($ctx1) {
  9627. var $1;
  9628. $1=self._reject_((function(each){
  9629. return smalltalk.withContext(function($ctx2) {
  9630. return _st(aCollection)._includes_(each);
  9631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9632. return $1;
  9633. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)})},
  9634. args: ["aCollection"],
  9635. 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 ]",
  9636. messageSends: ["reject:", "includes:"],
  9637. referencedClasses: []
  9638. }),
  9639. globals.Collection);
  9640. smalltalk.addMethod(
  9641. smalltalk.method({
  9642. selector: "detect:",
  9643. protocol: 'enumerating',
  9644. fn: function (aBlock){
  9645. var self=this;
  9646. return smalltalk.withContext(function($ctx1) {
  9647. var $1;
  9648. $1=self._detect_ifNone_(aBlock,(function(){
  9649. return smalltalk.withContext(function($ctx2) {
  9650. return self._errorNotFound();
  9651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9652. return $1;
  9653. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)})},
  9654. args: ["aBlock"],
  9655. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  9656. messageSends: ["detect:ifNone:", "errorNotFound"],
  9657. referencedClasses: []
  9658. }),
  9659. globals.Collection);
  9660. smalltalk.addMethod(
  9661. smalltalk.method({
  9662. selector: "detect:ifNone:",
  9663. protocol: 'enumerating',
  9664. fn: function (aBlock,anotherBlock){
  9665. var self=this;
  9666. return smalltalk.withContext(function($ctx1) {
  9667. self._subclassResponsibility();
  9668. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  9669. args: ["aBlock", "anotherBlock"],
  9670. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  9671. messageSends: ["subclassResponsibility"],
  9672. referencedClasses: []
  9673. }),
  9674. globals.Collection);
  9675. smalltalk.addMethod(
  9676. smalltalk.method({
  9677. selector: "do:",
  9678. protocol: 'enumerating',
  9679. fn: function (aBlock){
  9680. var self=this;
  9681. return smalltalk.withContext(function($ctx1) {
  9682. self._subclassResponsibility();
  9683. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)})},
  9684. args: ["aBlock"],
  9685. source: "do: aBlock\x0a\x09self subclassResponsibility",
  9686. messageSends: ["subclassResponsibility"],
  9687. referencedClasses: []
  9688. }),
  9689. globals.Collection);
  9690. smalltalk.addMethod(
  9691. smalltalk.method({
  9692. selector: "do:separatedBy:",
  9693. protocol: 'enumerating',
  9694. fn: function (aBlock,anotherBlock){
  9695. var self=this;
  9696. var actionBeforeElement;
  9697. return smalltalk.withContext(function($ctx1) {
  9698. actionBeforeElement=(function(){
  9699. actionBeforeElement=anotherBlock;
  9700. return actionBeforeElement;
  9701. });
  9702. self._do_((function(each){
  9703. return smalltalk.withContext(function($ctx2) {
  9704. _st(actionBeforeElement)._value();
  9705. return _st(aBlock)._value_(each);
  9706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  9707. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)})},
  9708. args: ["aBlock", "anotherBlock"],
  9709. 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 ]",
  9710. messageSends: ["do:", "value", "value:"],
  9711. referencedClasses: []
  9712. }),
  9713. globals.Collection);
  9714. smalltalk.addMethod(
  9715. smalltalk.method({
  9716. selector: "errorNotFound",
  9717. protocol: 'error handling',
  9718. fn: function (){
  9719. var self=this;
  9720. return smalltalk.withContext(function($ctx1) {
  9721. self._error_("Object is not in the collection");
  9722. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)})},
  9723. args: [],
  9724. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  9725. messageSends: ["error:"],
  9726. referencedClasses: []
  9727. }),
  9728. globals.Collection);
  9729. smalltalk.addMethod(
  9730. smalltalk.method({
  9731. selector: "ifEmpty:",
  9732. protocol: 'testing',
  9733. fn: function (aBlock){
  9734. var self=this;
  9735. return smalltalk.withContext(function($ctx1) {
  9736. var $2,$1;
  9737. $2=self._isEmpty();
  9738. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  9739. return self;
  9740. }));
  9741. return $1;
  9742. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)})},
  9743. args: ["aBlock"],
  9744. 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 ]",
  9745. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  9746. referencedClasses: []
  9747. }),
  9748. globals.Collection);
  9749. smalltalk.addMethod(
  9750. smalltalk.method({
  9751. selector: "ifEmpty:ifNotEmpty:",
  9752. protocol: 'testing',
  9753. fn: function (aBlock,anotherBlock){
  9754. var self=this;
  9755. return smalltalk.withContext(function($ctx1) {
  9756. var $2,$1;
  9757. $2=self._isEmpty();
  9758. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  9759. return $1;
  9760. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  9761. args: ["aBlock", "anotherBlock"],
  9762. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  9763. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  9764. referencedClasses: []
  9765. }),
  9766. globals.Collection);
  9767. smalltalk.addMethod(
  9768. smalltalk.method({
  9769. selector: "ifNotEmpty:",
  9770. protocol: 'testing',
  9771. fn: function (aBlock){
  9772. var self=this;
  9773. return smalltalk.withContext(function($ctx1) {
  9774. var $2,$1;
  9775. $2=self._notEmpty();
  9776. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  9777. return self;
  9778. }));
  9779. return $1;
  9780. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)})},
  9781. args: ["aBlock"],
  9782. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  9783. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  9784. referencedClasses: []
  9785. }),
  9786. globals.Collection);
  9787. smalltalk.addMethod(
  9788. smalltalk.method({
  9789. selector: "ifNotEmpty:ifEmpty:",
  9790. protocol: 'testing',
  9791. fn: function (aBlock,anotherBlock){
  9792. var self=this;
  9793. return smalltalk.withContext(function($ctx1) {
  9794. var $2,$1;
  9795. $2=self._notEmpty();
  9796. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  9797. return $1;
  9798. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  9799. args: ["aBlock", "anotherBlock"],
  9800. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  9801. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  9802. referencedClasses: []
  9803. }),
  9804. globals.Collection);
  9805. smalltalk.addMethod(
  9806. smalltalk.method({
  9807. selector: "includes:",
  9808. protocol: 'testing',
  9809. fn: function (anObject){
  9810. var self=this;
  9811. return smalltalk.withContext(function($ctx1) {
  9812. var $1;
  9813. $1=self._anySatisfy_((function(each){
  9814. return smalltalk.withContext(function($ctx2) {
  9815. return _st(each).__eq(anObject);
  9816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9817. return $1;
  9818. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)})},
  9819. args: ["anObject"],
  9820. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  9821. messageSends: ["anySatisfy:", "="],
  9822. referencedClasses: []
  9823. }),
  9824. globals.Collection);
  9825. smalltalk.addMethod(
  9826. smalltalk.method({
  9827. selector: "inject:into:",
  9828. protocol: 'enumerating',
  9829. fn: function (anObject,aBlock){
  9830. var self=this;
  9831. var result;
  9832. return smalltalk.withContext(function($ctx1) {
  9833. var $1;
  9834. result=anObject;
  9835. self._do_((function(each){
  9836. return smalltalk.withContext(function($ctx2) {
  9837. result=_st(aBlock)._value_value_(result,each);
  9838. return result;
  9839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9840. $1=result;
  9841. return $1;
  9842. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)})},
  9843. args: ["anObject", "aBlock"],
  9844. 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",
  9845. messageSends: ["do:", "value:value:"],
  9846. referencedClasses: []
  9847. }),
  9848. globals.Collection);
  9849. smalltalk.addMethod(
  9850. smalltalk.method({
  9851. selector: "intersection:",
  9852. protocol: 'enumerating',
  9853. fn: function (aCollection){
  9854. var self=this;
  9855. var set,outputSet;
  9856. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  9857. return smalltalk.withContext(function($ctx1) {
  9858. var $2,$1,$3;
  9859. set=self._asSet();
  9860. outputSet=_st($Set())._new();
  9861. _st(aCollection)._do_((function(each){
  9862. return smalltalk.withContext(function($ctx2) {
  9863. $2=_st(set)._includes_(each);
  9864. $ctx2.sendIdx["includes:"]=1;
  9865. $1=_st($2)._and_((function(){
  9866. return smalltalk.withContext(function($ctx3) {
  9867. return _st(_st(outputSet)._includes_(each))._not();
  9868. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  9869. if(smalltalk.assert($1)){
  9870. return _st(outputSet)._add_(each);
  9871. };
  9872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9873. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  9874. return $3;
  9875. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)})},
  9876. args: ["aCollection"],
  9877. 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",
  9878. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"],
  9879. referencedClasses: ["Set"]
  9880. }),
  9881. globals.Collection);
  9882. smalltalk.addMethod(
  9883. smalltalk.method({
  9884. selector: "isEmpty",
  9885. protocol: 'testing',
  9886. fn: function (){
  9887. var self=this;
  9888. return smalltalk.withContext(function($ctx1) {
  9889. var $1;
  9890. $1=_st(self._size()).__eq((0));
  9891. return $1;
  9892. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)})},
  9893. args: [],
  9894. source: "isEmpty\x0a\x09^ self size = 0",
  9895. messageSends: ["=", "size"],
  9896. referencedClasses: []
  9897. }),
  9898. globals.Collection);
  9899. smalltalk.addMethod(
  9900. smalltalk.method({
  9901. selector: "noneSatisfy:",
  9902. protocol: 'enumerating',
  9903. fn: function (aBlock){
  9904. var self=this;
  9905. return smalltalk.withContext(function($ctx1) {
  9906. var $1;
  9907. var $early={};
  9908. try {
  9909. self._do_((function(item){
  9910. return smalltalk.withContext(function($ctx2) {
  9911. $1=_st(aBlock)._value_(item);
  9912. if(smalltalk.assert($1)){
  9913. throw $early=[false];
  9914. };
  9915. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)})}));
  9916. return true;
  9917. }
  9918. catch(e) {if(e===$early)return e[0]; throw e}
  9919. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)})},
  9920. args: ["aBlock"],
  9921. 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",
  9922. messageSends: ["do:", "ifTrue:", "value:"],
  9923. referencedClasses: []
  9924. }),
  9925. globals.Collection);
  9926. smalltalk.addMethod(
  9927. smalltalk.method({
  9928. selector: "notEmpty",
  9929. protocol: 'testing',
  9930. fn: function (){
  9931. var self=this;
  9932. return smalltalk.withContext(function($ctx1) {
  9933. var $1;
  9934. $1=_st(self._isEmpty())._not();
  9935. return $1;
  9936. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)})},
  9937. args: [],
  9938. source: "notEmpty\x0a\x09^ self isEmpty not",
  9939. messageSends: ["not", "isEmpty"],
  9940. referencedClasses: []
  9941. }),
  9942. globals.Collection);
  9943. smalltalk.addMethod(
  9944. smalltalk.method({
  9945. selector: "occurrencesOf:",
  9946. protocol: 'accessing',
  9947. fn: function (anObject){
  9948. var self=this;
  9949. var tally;
  9950. return smalltalk.withContext(function($ctx1) {
  9951. var $1,$2;
  9952. tally=(0);
  9953. self._do_((function(each){
  9954. return smalltalk.withContext(function($ctx2) {
  9955. $1=_st(anObject).__eq(each);
  9956. if(smalltalk.assert($1)){
  9957. tally=_st(tally).__plus((1));
  9958. return tally;
  9959. };
  9960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9961. $2=tally;
  9962. return $2;
  9963. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)})},
  9964. args: ["anObject"],
  9965. 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",
  9966. messageSends: ["do:", "ifTrue:", "=", "+"],
  9967. referencedClasses: []
  9968. }),
  9969. globals.Collection);
  9970. smalltalk.addMethod(
  9971. smalltalk.method({
  9972. selector: "putOn:",
  9973. protocol: 'streaming',
  9974. fn: function (aStream){
  9975. var self=this;
  9976. return smalltalk.withContext(function($ctx1) {
  9977. self._do_((function(each){
  9978. return smalltalk.withContext(function($ctx2) {
  9979. return _st(each)._putOn_(aStream);
  9980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9981. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)})},
  9982. args: ["aStream"],
  9983. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  9984. messageSends: ["do:", "putOn:"],
  9985. referencedClasses: []
  9986. }),
  9987. globals.Collection);
  9988. smalltalk.addMethod(
  9989. smalltalk.method({
  9990. selector: "reject:",
  9991. protocol: 'enumerating',
  9992. fn: function (aBlock){
  9993. var self=this;
  9994. return smalltalk.withContext(function($ctx1) {
  9995. var $1;
  9996. $1=self._select_((function(each){
  9997. return smalltalk.withContext(function($ctx2) {
  9998. return _st(_st(aBlock)._value_(each)).__eq(false);
  9999. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10000. return $1;
  10001. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)})},
  10002. args: ["aBlock"],
  10003. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  10004. messageSends: ["select:", "=", "value:"],
  10005. referencedClasses: []
  10006. }),
  10007. globals.Collection);
  10008. smalltalk.addMethod(
  10009. smalltalk.method({
  10010. selector: "remove:",
  10011. protocol: 'adding/removing',
  10012. fn: function (anObject){
  10013. var self=this;
  10014. return smalltalk.withContext(function($ctx1) {
  10015. var $1;
  10016. $1=self._remove_ifAbsent_(anObject,(function(){
  10017. return smalltalk.withContext(function($ctx2) {
  10018. return self._errorNotFound();
  10019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10020. return $1;
  10021. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)})},
  10022. args: ["anObject"],
  10023. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  10024. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  10025. referencedClasses: []
  10026. }),
  10027. globals.Collection);
  10028. smalltalk.addMethod(
  10029. smalltalk.method({
  10030. selector: "remove:ifAbsent:",
  10031. protocol: 'adding/removing',
  10032. fn: function (anObject,aBlock){
  10033. var self=this;
  10034. return smalltalk.withContext(function($ctx1) {
  10035. self._subclassResponsibility();
  10036. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)})},
  10037. args: ["anObject", "aBlock"],
  10038. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10039. messageSends: ["subclassResponsibility"],
  10040. referencedClasses: []
  10041. }),
  10042. globals.Collection);
  10043. smalltalk.addMethod(
  10044. smalltalk.method({
  10045. selector: "removeAll",
  10046. protocol: 'adding/removing',
  10047. fn: function (){
  10048. var self=this;
  10049. return smalltalk.withContext(function($ctx1) {
  10050. self._subclassResponsibility();
  10051. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)})},
  10052. args: [],
  10053. source: "removeAll\x0a\x09self subclassResponsibility",
  10054. messageSends: ["subclassResponsibility"],
  10055. referencedClasses: []
  10056. }),
  10057. globals.Collection);
  10058. smalltalk.addMethod(
  10059. smalltalk.method({
  10060. selector: "select:",
  10061. protocol: 'enumerating',
  10062. fn: function (aBlock){
  10063. var self=this;
  10064. var stream;
  10065. return smalltalk.withContext(function($ctx1) {
  10066. var $1,$2;
  10067. stream=_st(_st(self._class())._new())._writeStream();
  10068. self._do_((function(each){
  10069. return smalltalk.withContext(function($ctx2) {
  10070. $1=_st(aBlock)._value_(each);
  10071. if(smalltalk.assert($1)){
  10072. return _st(stream)._nextPut_(each);
  10073. };
  10074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10075. $2=_st(stream)._contents();
  10076. return $2;
  10077. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  10078. args: ["aBlock"],
  10079. 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",
  10080. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  10081. referencedClasses: []
  10082. }),
  10083. globals.Collection);
  10084. smalltalk.addMethod(
  10085. smalltalk.method({
  10086. selector: "select:thenCollect:",
  10087. protocol: 'enumerating',
  10088. fn: function (selectBlock,collectBlock){
  10089. var self=this;
  10090. var stream;
  10091. return smalltalk.withContext(function($ctx1) {
  10092. var $1,$2;
  10093. stream=_st(_st(self._class())._new())._writeStream();
  10094. self._do_((function(each){
  10095. return smalltalk.withContext(function($ctx2) {
  10096. $1=_st(selectBlock)._value_(each);
  10097. $ctx2.sendIdx["value:"]=1;
  10098. if(smalltalk.assert($1)){
  10099. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  10100. };
  10101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10102. $2=_st(stream)._contents();
  10103. return $2;
  10104. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)})},
  10105. args: ["selectBlock", "collectBlock"],
  10106. 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",
  10107. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  10108. referencedClasses: []
  10109. }),
  10110. globals.Collection);
  10111. smalltalk.addMethod(
  10112. smalltalk.method({
  10113. selector: "size",
  10114. protocol: 'accessing',
  10115. fn: function (){
  10116. var self=this;
  10117. return smalltalk.withContext(function($ctx1) {
  10118. self._subclassResponsibility();
  10119. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)})},
  10120. args: [],
  10121. source: "size\x0a\x09self subclassResponsibility",
  10122. messageSends: ["subclassResponsibility"],
  10123. referencedClasses: []
  10124. }),
  10125. globals.Collection);
  10126. smalltalk.addMethod(
  10127. smalltalk.method({
  10128. selector: "heliosClass",
  10129. protocol: 'helios',
  10130. fn: function (){
  10131. var self=this;
  10132. return "collection";
  10133. },
  10134. args: [],
  10135. source: "heliosClass\x0a\x09^ 'collection'",
  10136. messageSends: [],
  10137. referencedClasses: []
  10138. }),
  10139. globals.Collection.klass);
  10140. smalltalk.addMethod(
  10141. smalltalk.method({
  10142. selector: "new:",
  10143. protocol: 'instance creation',
  10144. fn: function (anInteger){
  10145. var self=this;
  10146. return smalltalk.withContext(function($ctx1) {
  10147. var $1;
  10148. $1=self._new();
  10149. return $1;
  10150. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)})},
  10151. args: ["anInteger"],
  10152. source: "new: anInteger\x0a\x09^ self new",
  10153. messageSends: ["new"],
  10154. referencedClasses: []
  10155. }),
  10156. globals.Collection.klass);
  10157. smalltalk.addMethod(
  10158. smalltalk.method({
  10159. selector: "with:",
  10160. protocol: 'instance creation',
  10161. fn: function (anObject){
  10162. var self=this;
  10163. return smalltalk.withContext(function($ctx1) {
  10164. var $2,$3,$1;
  10165. $2=self._new();
  10166. _st($2)._add_(anObject);
  10167. $3=_st($2)._yourself();
  10168. $1=$3;
  10169. return $1;
  10170. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)})},
  10171. args: ["anObject"],
  10172. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  10173. messageSends: ["add:", "new", "yourself"],
  10174. referencedClasses: []
  10175. }),
  10176. globals.Collection.klass);
  10177. smalltalk.addMethod(
  10178. smalltalk.method({
  10179. selector: "with:with:",
  10180. protocol: 'instance creation',
  10181. fn: function (anObject,anotherObject){
  10182. var self=this;
  10183. return smalltalk.withContext(function($ctx1) {
  10184. var $2,$3,$1;
  10185. $2=self._new();
  10186. _st($2)._add_(anObject);
  10187. $ctx1.sendIdx["add:"]=1;
  10188. _st($2)._add_(anotherObject);
  10189. $3=_st($2)._yourself();
  10190. $1=$3;
  10191. return $1;
  10192. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)})},
  10193. args: ["anObject", "anotherObject"],
  10194. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  10195. messageSends: ["add:", "new", "yourself"],
  10196. referencedClasses: []
  10197. }),
  10198. globals.Collection.klass);
  10199. smalltalk.addMethod(
  10200. smalltalk.method({
  10201. selector: "with:with:with:",
  10202. protocol: 'instance creation',
  10203. fn: function (firstObject,secondObject,thirdObject){
  10204. var self=this;
  10205. return smalltalk.withContext(function($ctx1) {
  10206. var $2,$3,$1;
  10207. $2=self._new();
  10208. _st($2)._add_(firstObject);
  10209. $ctx1.sendIdx["add:"]=1;
  10210. _st($2)._add_(secondObject);
  10211. $ctx1.sendIdx["add:"]=2;
  10212. _st($2)._add_(thirdObject);
  10213. $3=_st($2)._yourself();
  10214. $1=$3;
  10215. return $1;
  10216. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)})},
  10217. args: ["firstObject", "secondObject", "thirdObject"],
  10218. 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",
  10219. messageSends: ["add:", "new", "yourself"],
  10220. referencedClasses: []
  10221. }),
  10222. globals.Collection.klass);
  10223. smalltalk.addMethod(
  10224. smalltalk.method({
  10225. selector: "withAll:",
  10226. protocol: 'instance creation',
  10227. fn: function (aCollection){
  10228. var self=this;
  10229. return smalltalk.withContext(function($ctx1) {
  10230. var $2,$3,$1;
  10231. $2=self._new();
  10232. _st($2)._addAll_(aCollection);
  10233. $3=_st($2)._yourself();
  10234. $1=$3;
  10235. return $1;
  10236. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)})},
  10237. args: ["aCollection"],
  10238. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10239. messageSends: ["addAll:", "new", "yourself"],
  10240. referencedClasses: []
  10241. }),
  10242. globals.Collection.klass);
  10243. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  10244. 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.";
  10245. smalltalk.addMethod(
  10246. smalltalk.method({
  10247. selector: "at:",
  10248. protocol: 'accessing',
  10249. fn: function (anIndex){
  10250. var self=this;
  10251. return smalltalk.withContext(function($ctx1) {
  10252. var $1;
  10253. $1=self._at_ifAbsent_(anIndex,(function(){
  10254. return smalltalk.withContext(function($ctx2) {
  10255. return self._errorNotFound();
  10256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10257. return $1;
  10258. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)})},
  10259. args: ["anIndex"],
  10260. 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 ]",
  10261. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10262. referencedClasses: []
  10263. }),
  10264. globals.IndexableCollection);
  10265. smalltalk.addMethod(
  10266. smalltalk.method({
  10267. selector: "at:ifAbsent:",
  10268. protocol: 'accessing',
  10269. fn: function (anIndex,aBlock){
  10270. var self=this;
  10271. return smalltalk.withContext(function($ctx1) {
  10272. self._subclassResponsibility();
  10273. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  10274. args: ["anIndex", "aBlock"],
  10275. 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",
  10276. messageSends: ["subclassResponsibility"],
  10277. referencedClasses: []
  10278. }),
  10279. globals.IndexableCollection);
  10280. smalltalk.addMethod(
  10281. smalltalk.method({
  10282. selector: "at:ifAbsentPut:",
  10283. protocol: 'accessing',
  10284. fn: function (aKey,aBlock){
  10285. var self=this;
  10286. return smalltalk.withContext(function($ctx1) {
  10287. var $1;
  10288. $1=self._at_ifAbsent_(aKey,(function(){
  10289. return smalltalk.withContext(function($ctx2) {
  10290. return self._at_put_(aKey,_st(aBlock)._value());
  10291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10292. return $1;
  10293. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)})},
  10294. args: ["aKey", "aBlock"],
  10295. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  10296. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  10297. referencedClasses: []
  10298. }),
  10299. globals.IndexableCollection);
  10300. smalltalk.addMethod(
  10301. smalltalk.method({
  10302. selector: "at:ifPresent:",
  10303. protocol: 'accessing',
  10304. fn: function (anIndex,aBlock){
  10305. var self=this;
  10306. return smalltalk.withContext(function($ctx1) {
  10307. var $1;
  10308. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  10309. return nil;
  10310. }));
  10311. return $1;
  10312. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  10313. args: ["anIndex", "aBlock"],
  10314. 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 ]",
  10315. messageSends: ["at:ifPresent:ifAbsent:"],
  10316. referencedClasses: []
  10317. }),
  10318. globals.IndexableCollection);
  10319. smalltalk.addMethod(
  10320. smalltalk.method({
  10321. selector: "at:ifPresent:ifAbsent:",
  10322. protocol: 'accessing',
  10323. fn: function (anIndex,aBlock,anotherBlock){
  10324. var self=this;
  10325. return smalltalk.withContext(function($ctx1) {
  10326. self._subclassResponsibility();
  10327. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)})},
  10328. args: ["anIndex", "aBlock", "anotherBlock"],
  10329. 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",
  10330. messageSends: ["subclassResponsibility"],
  10331. referencedClasses: []
  10332. }),
  10333. globals.IndexableCollection);
  10334. smalltalk.addMethod(
  10335. smalltalk.method({
  10336. selector: "at:put:",
  10337. protocol: 'accessing',
  10338. fn: function (anIndex,anObject){
  10339. var self=this;
  10340. return smalltalk.withContext(function($ctx1) {
  10341. self._subclassResponsibility();
  10342. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)})},
  10343. args: ["anIndex", "anObject"],
  10344. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  10345. messageSends: ["subclassResponsibility"],
  10346. referencedClasses: []
  10347. }),
  10348. globals.IndexableCollection);
  10349. smalltalk.addMethod(
  10350. smalltalk.method({
  10351. selector: "indexOf:",
  10352. protocol: 'accessing',
  10353. fn: function (anObject){
  10354. var self=this;
  10355. return smalltalk.withContext(function($ctx1) {
  10356. var $1;
  10357. $1=self._indexOf_ifAbsent_(anObject,(function(){
  10358. return smalltalk.withContext(function($ctx2) {
  10359. return self._errorNotFound();
  10360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10361. return $1;
  10362. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)})},
  10363. args: ["anObject"],
  10364. 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 ]",
  10365. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10366. referencedClasses: []
  10367. }),
  10368. globals.IndexableCollection);
  10369. smalltalk.addMethod(
  10370. smalltalk.method({
  10371. selector: "indexOf:ifAbsent:",
  10372. protocol: 'accessing',
  10373. fn: function (anObject,aBlock){
  10374. var self=this;
  10375. return smalltalk.withContext(function($ctx1) {
  10376. self._subclassResponsibility();
  10377. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)})},
  10378. args: ["anObject", "aBlock"],
  10379. 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",
  10380. messageSends: ["subclassResponsibility"],
  10381. referencedClasses: []
  10382. }),
  10383. globals.IndexableCollection);
  10384. smalltalk.addMethod(
  10385. smalltalk.method({
  10386. selector: "with:do:",
  10387. protocol: 'enumarating',
  10388. fn: function (anotherCollection,aBlock){
  10389. var self=this;
  10390. return smalltalk.withContext(function($ctx1) {
  10391. self._withIndexDo_((function(each,index){
  10392. return smalltalk.withContext(function($ctx2) {
  10393. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  10394. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  10395. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)})},
  10396. args: ["anotherCollection", "aBlock"],
  10397. 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) ]",
  10398. messageSends: ["withIndexDo:", "value:value:", "at:"],
  10399. referencedClasses: []
  10400. }),
  10401. globals.IndexableCollection);
  10402. smalltalk.addMethod(
  10403. smalltalk.method({
  10404. selector: "withIndexDo:",
  10405. protocol: 'enumarating',
  10406. fn: function (aBlock){
  10407. var self=this;
  10408. return smalltalk.withContext(function($ctx1) {
  10409. self._subclassResponsibility();
  10410. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)})},
  10411. args: ["aBlock"],
  10412. 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",
  10413. messageSends: ["subclassResponsibility"],
  10414. referencedClasses: []
  10415. }),
  10416. globals.IndexableCollection);
  10417. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  10418. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  10419. smalltalk.addMethod(
  10420. smalltalk.method({
  10421. selector: "=",
  10422. protocol: 'comparing',
  10423. fn: function (anAssocitativeCollection){
  10424. var self=this;
  10425. return smalltalk.withContext(function($ctx1) {
  10426. var $2,$1,$4,$3,$6,$5;
  10427. $2=self._class();
  10428. $ctx1.sendIdx["class"]=1;
  10429. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  10430. $ctx1.sendIdx["="]=1;
  10431. if(! smalltalk.assert($1)){
  10432. return false;
  10433. };
  10434. $4=self._size();
  10435. $ctx1.sendIdx["size"]=1;
  10436. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  10437. $ctx1.sendIdx["="]=2;
  10438. if(! smalltalk.assert($3)){
  10439. return false;
  10440. };
  10441. $6=self._associations();
  10442. $ctx1.sendIdx["associations"]=1;
  10443. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  10444. return $5;
  10445. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)})},
  10446. args: ["anAssocitativeCollection"],
  10447. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  10448. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  10449. referencedClasses: []
  10450. }),
  10451. globals.AssociativeCollection);
  10452. smalltalk.addMethod(
  10453. smalltalk.method({
  10454. selector: "add:",
  10455. protocol: 'adding/removing',
  10456. fn: function (anAssociation){
  10457. var self=this;
  10458. return smalltalk.withContext(function($ctx1) {
  10459. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  10460. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)})},
  10461. args: ["anAssociation"],
  10462. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  10463. messageSends: ["at:put:", "key", "value"],
  10464. referencedClasses: []
  10465. }),
  10466. globals.AssociativeCollection);
  10467. smalltalk.addMethod(
  10468. smalltalk.method({
  10469. selector: "addAll:",
  10470. protocol: 'adding/removing',
  10471. fn: function (anAssociativeCollection){
  10472. var self=this;
  10473. return smalltalk.withContext(function($ctx1) {
  10474. globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]);
  10475. return anAssociativeCollection;
  10476. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)})},
  10477. args: ["anAssociativeCollection"],
  10478. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  10479. messageSends: ["addAll:", "associations"],
  10480. referencedClasses: []
  10481. }),
  10482. globals.AssociativeCollection);
  10483. smalltalk.addMethod(
  10484. smalltalk.method({
  10485. selector: "asDictionary",
  10486. protocol: 'converting',
  10487. fn: function (){
  10488. var self=this;
  10489. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  10490. return smalltalk.withContext(function($ctx1) {
  10491. var $1;
  10492. $1=_st($Dictionary())._from_(self._associations());
  10493. return $1;
  10494. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)})},
  10495. args: [],
  10496. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  10497. messageSends: ["from:", "associations"],
  10498. referencedClasses: ["Dictionary"]
  10499. }),
  10500. globals.AssociativeCollection);
  10501. smalltalk.addMethod(
  10502. smalltalk.method({
  10503. selector: "asHashedCollection",
  10504. protocol: 'converting',
  10505. fn: function (){
  10506. var self=this;
  10507. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10508. return smalltalk.withContext(function($ctx1) {
  10509. var $1;
  10510. $1=_st($HashedCollection())._from_(self._associations());
  10511. return $1;
  10512. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)})},
  10513. args: [],
  10514. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  10515. messageSends: ["from:", "associations"],
  10516. referencedClasses: ["HashedCollection"]
  10517. }),
  10518. globals.AssociativeCollection);
  10519. smalltalk.addMethod(
  10520. smalltalk.method({
  10521. selector: "asJSON",
  10522. protocol: 'converting',
  10523. fn: function (){
  10524. var self=this;
  10525. var hash;
  10526. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10527. return smalltalk.withContext(function($ctx1) {
  10528. var $1;
  10529. hash=_st($HashedCollection())._new();
  10530. self._keysAndValuesDo_((function(key,value){
  10531. return smalltalk.withContext(function($ctx2) {
  10532. return _st(hash)._at_put_(key,_st(value)._asJSON());
  10533. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10534. $1=hash;
  10535. return $1;
  10536. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)})},
  10537. args: [],
  10538. 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",
  10539. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"],
  10540. referencedClasses: ["HashedCollection"]
  10541. }),
  10542. globals.AssociativeCollection);
  10543. smalltalk.addMethod(
  10544. smalltalk.method({
  10545. selector: "associations",
  10546. protocol: 'accessing',
  10547. fn: function (){
  10548. var self=this;
  10549. var associations;
  10550. return smalltalk.withContext(function($ctx1) {
  10551. var $1;
  10552. associations=[];
  10553. self._associationsDo_((function(each){
  10554. return smalltalk.withContext(function($ctx2) {
  10555. return _st(associations)._add_(each);
  10556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10557. $1=associations;
  10558. return $1;
  10559. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)})},
  10560. args: [],
  10561. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  10562. messageSends: ["associationsDo:", "add:"],
  10563. referencedClasses: []
  10564. }),
  10565. globals.AssociativeCollection);
  10566. smalltalk.addMethod(
  10567. smalltalk.method({
  10568. selector: "associationsDo:",
  10569. protocol: 'enumerating',
  10570. fn: function (aBlock){
  10571. var self=this;
  10572. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  10573. return smalltalk.withContext(function($ctx1) {
  10574. self._keysAndValuesDo_((function(key,value){
  10575. return smalltalk.withContext(function($ctx2) {
  10576. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  10577. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10578. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  10579. args: ["aBlock"],
  10580. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  10581. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  10582. referencedClasses: ["Association"]
  10583. }),
  10584. globals.AssociativeCollection);
  10585. smalltalk.addMethod(
  10586. smalltalk.method({
  10587. selector: "at:ifPresent:ifAbsent:",
  10588. protocol: 'accessing',
  10589. fn: function (aKey,aBlock,anotherBlock){
  10590. var self=this;
  10591. return smalltalk.withContext(function($ctx1) {
  10592. var $2,$1;
  10593. $2=self._includesKey_(aKey);
  10594. if(smalltalk.assert($2)){
  10595. $1=_st(aBlock)._value_(self._at_(aKey));
  10596. } else {
  10597. $1=_st(anotherBlock)._value();
  10598. };
  10599. return $1;
  10600. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  10601. args: ["aKey", "aBlock", "anotherBlock"],
  10602. 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 ]",
  10603. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"],
  10604. referencedClasses: []
  10605. }),
  10606. globals.AssociativeCollection);
  10607. smalltalk.addMethod(
  10608. smalltalk.method({
  10609. selector: "collect:",
  10610. protocol: 'enumerating',
  10611. fn: function (aBlock){
  10612. var self=this;
  10613. var newDict;
  10614. return smalltalk.withContext(function($ctx1) {
  10615. var $1;
  10616. newDict=_st(self._class())._new();
  10617. self._keysAndValuesDo_((function(key,value){
  10618. return smalltalk.withContext(function($ctx2) {
  10619. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  10620. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10621. $1=newDict;
  10622. return $1;
  10623. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  10624. args: ["aBlock"],
  10625. 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",
  10626. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  10627. referencedClasses: []
  10628. }),
  10629. globals.AssociativeCollection);
  10630. smalltalk.addMethod(
  10631. smalltalk.method({
  10632. selector: "deepCopy",
  10633. protocol: 'copying',
  10634. fn: function (){
  10635. var self=this;
  10636. var copy;
  10637. return smalltalk.withContext(function($ctx1) {
  10638. var $1;
  10639. copy=_st(self._class())._new();
  10640. self._keysAndValuesDo_((function(key,value){
  10641. return smalltalk.withContext(function($ctx2) {
  10642. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  10643. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10644. $1=copy;
  10645. return $1;
  10646. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)})},
  10647. args: [],
  10648. 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",
  10649. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  10650. referencedClasses: []
  10651. }),
  10652. globals.AssociativeCollection);
  10653. smalltalk.addMethod(
  10654. smalltalk.method({
  10655. selector: "detect:ifNone:",
  10656. protocol: 'enumerating',
  10657. fn: function (aBlock,anotherBlock){
  10658. var self=this;
  10659. return smalltalk.withContext(function($ctx1) {
  10660. var $1;
  10661. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  10662. return $1;
  10663. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  10664. args: ["aBlock", "anotherBlock"],
  10665. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  10666. messageSends: ["detect:ifNone:", "values"],
  10667. referencedClasses: []
  10668. }),
  10669. globals.AssociativeCollection);
  10670. smalltalk.addMethod(
  10671. smalltalk.method({
  10672. selector: "do:",
  10673. protocol: 'enumerating',
  10674. fn: function (aBlock){
  10675. var self=this;
  10676. return smalltalk.withContext(function($ctx1) {
  10677. self._valuesDo_(aBlock);
  10678. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)})},
  10679. args: ["aBlock"],
  10680. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  10681. messageSends: ["valuesDo:"],
  10682. referencedClasses: []
  10683. }),
  10684. globals.AssociativeCollection);
  10685. smalltalk.addMethod(
  10686. smalltalk.method({
  10687. selector: "includes:",
  10688. protocol: 'enumerating',
  10689. fn: function (anObject){
  10690. var self=this;
  10691. return smalltalk.withContext(function($ctx1) {
  10692. var $1;
  10693. $1=_st(self._values())._includes_(anObject);
  10694. return $1;
  10695. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)})},
  10696. args: ["anObject"],
  10697. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  10698. messageSends: ["includes:", "values"],
  10699. referencedClasses: []
  10700. }),
  10701. globals.AssociativeCollection);
  10702. smalltalk.addMethod(
  10703. smalltalk.method({
  10704. selector: "includesKey:",
  10705. protocol: 'testing',
  10706. fn: function (aKey){
  10707. var self=this;
  10708. return smalltalk.withContext(function($ctx1) {
  10709. self._subclassResponsibility();
  10710. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)})},
  10711. args: ["aKey"],
  10712. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  10713. messageSends: ["subclassResponsibility"],
  10714. referencedClasses: []
  10715. }),
  10716. globals.AssociativeCollection);
  10717. smalltalk.addMethod(
  10718. smalltalk.method({
  10719. selector: "indexOf:ifAbsent:",
  10720. protocol: 'accessing',
  10721. fn: function (anObject,aBlock){
  10722. var self=this;
  10723. return smalltalk.withContext(function($ctx1) {
  10724. var $1;
  10725. $1=_st(self._keys())._detect_ifNone_((function(each){
  10726. return smalltalk.withContext(function($ctx2) {
  10727. return _st(self._at_(each)).__eq(anObject);
  10728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),aBlock);
  10729. return $1;
  10730. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  10731. args: ["anObject", "aBlock"],
  10732. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  10733. messageSends: ["detect:ifNone:", "keys", "=", "at:"],
  10734. referencedClasses: []
  10735. }),
  10736. globals.AssociativeCollection);
  10737. smalltalk.addMethod(
  10738. smalltalk.method({
  10739. selector: "keyAtValue:",
  10740. protocol: 'accessing',
  10741. fn: function (anObject){
  10742. var self=this;
  10743. return smalltalk.withContext(function($ctx1) {
  10744. var $1;
  10745. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  10746. return smalltalk.withContext(function($ctx2) {
  10747. return self._errorNotFound();
  10748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10749. return $1;
  10750. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)})},
  10751. args: ["anObject"],
  10752. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  10753. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"],
  10754. referencedClasses: []
  10755. }),
  10756. globals.AssociativeCollection);
  10757. smalltalk.addMethod(
  10758. smalltalk.method({
  10759. selector: "keyAtValue:ifAbsent:",
  10760. protocol: 'accessing',
  10761. fn: function (anObject,aBlock){
  10762. var self=this;
  10763. return smalltalk.withContext(function($ctx1) {
  10764. var $1;
  10765. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  10766. return $1;
  10767. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  10768. args: ["anObject", "aBlock"],
  10769. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  10770. messageSends: ["indexOf:ifAbsent:"],
  10771. referencedClasses: []
  10772. }),
  10773. globals.AssociativeCollection);
  10774. smalltalk.addMethod(
  10775. smalltalk.method({
  10776. selector: "keys",
  10777. protocol: 'accessing',
  10778. fn: function (){
  10779. var self=this;
  10780. return smalltalk.withContext(function($ctx1) {
  10781. self._subclassResponsibility();
  10782. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)})},
  10783. args: [],
  10784. source: "keys\x0a\x09self subclassResponsibility",
  10785. messageSends: ["subclassResponsibility"],
  10786. referencedClasses: []
  10787. }),
  10788. globals.AssociativeCollection);
  10789. smalltalk.addMethod(
  10790. smalltalk.method({
  10791. selector: "keysAndValuesDo:",
  10792. protocol: 'enumerating',
  10793. fn: function (aBlock){
  10794. var self=this;
  10795. return smalltalk.withContext(function($ctx1) {
  10796. self._keysDo_((function(each){
  10797. return smalltalk.withContext(function($ctx2) {
  10798. return _st(aBlock)._value_value_(each,self._at_(each));
  10799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10800. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  10801. args: ["aBlock"],
  10802. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  10803. messageSends: ["keysDo:", "value:value:", "at:"],
  10804. referencedClasses: []
  10805. }),
  10806. globals.AssociativeCollection);
  10807. smalltalk.addMethod(
  10808. smalltalk.method({
  10809. selector: "keysDo:",
  10810. protocol: 'enumerating',
  10811. fn: function (aBlock){
  10812. var self=this;
  10813. return smalltalk.withContext(function($ctx1) {
  10814. self._subclassResponsibility();
  10815. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  10816. args: ["aBlock"],
  10817. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  10818. messageSends: ["subclassResponsibility"],
  10819. referencedClasses: []
  10820. }),
  10821. globals.AssociativeCollection);
  10822. smalltalk.addMethod(
  10823. smalltalk.method({
  10824. selector: "printOn:",
  10825. protocol: 'printing',
  10826. fn: function (aStream){
  10827. var self=this;
  10828. return smalltalk.withContext(function($ctx1) {
  10829. globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  10830. $ctx1.sendIdx["printOn:"]=1;
  10831. _st(aStream)._nextPutAll_(" (");
  10832. $ctx1.sendIdx["nextPutAll:"]=1;
  10833. _st(self._associations())._do_separatedBy_((function(each){
  10834. return smalltalk.withContext(function($ctx2) {
  10835. return _st(each)._printOn_(aStream);
  10836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  10837. return smalltalk.withContext(function($ctx2) {
  10838. return _st(aStream)._nextPutAll_(" , ");
  10839. $ctx2.sendIdx["nextPutAll:"]=2;
  10840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  10841. _st(aStream)._nextPutAll_(")");
  10842. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)})},
  10843. args: ["aStream"],
  10844. 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: ')'",
  10845. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  10846. referencedClasses: []
  10847. }),
  10848. globals.AssociativeCollection);
  10849. smalltalk.addMethod(
  10850. smalltalk.method({
  10851. selector: "remove:ifAbsent:",
  10852. protocol: 'adding/removing',
  10853. fn: function (aKey,aBlock){
  10854. var self=this;
  10855. return smalltalk.withContext(function($ctx1) {
  10856. var $1;
  10857. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  10858. return $1;
  10859. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  10860. args: ["aKey", "aBlock"],
  10861. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  10862. messageSends: ["removeKey:ifAbsent:"],
  10863. referencedClasses: []
  10864. }),
  10865. globals.AssociativeCollection);
  10866. smalltalk.addMethod(
  10867. smalltalk.method({
  10868. selector: "removeAll",
  10869. protocol: 'adding/removing',
  10870. fn: function (){
  10871. var self=this;
  10872. return smalltalk.withContext(function($ctx1) {
  10873. var $1;
  10874. $1=_st(self._keys())._do_((function(each){
  10875. return smalltalk.withContext(function($ctx2) {
  10876. return self._removeKey_(each);
  10877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10878. return $1;
  10879. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)})},
  10880. args: [],
  10881. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  10882. messageSends: ["do:", "keys", "removeKey:"],
  10883. referencedClasses: []
  10884. }),
  10885. globals.AssociativeCollection);
  10886. smalltalk.addMethod(
  10887. smalltalk.method({
  10888. selector: "removeKey:",
  10889. protocol: 'adding/removing',
  10890. fn: function (aKey){
  10891. var self=this;
  10892. return smalltalk.withContext(function($ctx1) {
  10893. var $1;
  10894. $1=self._remove_(aKey);
  10895. return $1;
  10896. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)})},
  10897. args: ["aKey"],
  10898. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  10899. messageSends: ["remove:"],
  10900. referencedClasses: []
  10901. }),
  10902. globals.AssociativeCollection);
  10903. smalltalk.addMethod(
  10904. smalltalk.method({
  10905. selector: "removeKey:ifAbsent:",
  10906. protocol: 'adding/removing',
  10907. fn: function (aKey,aBlock){
  10908. var self=this;
  10909. return smalltalk.withContext(function($ctx1) {
  10910. self._subclassResponsibility();
  10911. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  10912. args: ["aKey", "aBlock"],
  10913. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10914. messageSends: ["subclassResponsibility"],
  10915. referencedClasses: []
  10916. }),
  10917. globals.AssociativeCollection);
  10918. smalltalk.addMethod(
  10919. smalltalk.method({
  10920. selector: "select:",
  10921. protocol: 'enumerating',
  10922. fn: function (aBlock){
  10923. var self=this;
  10924. var newDict;
  10925. return smalltalk.withContext(function($ctx1) {
  10926. var $1,$2;
  10927. newDict=_st(self._class())._new();
  10928. self._keysAndValuesDo_((function(key,value){
  10929. return smalltalk.withContext(function($ctx2) {
  10930. $1=_st(aBlock)._value_(value);
  10931. if(smalltalk.assert($1)){
  10932. return _st(newDict)._at_put_(key,value);
  10933. };
  10934. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10935. $2=newDict;
  10936. return $2;
  10937. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  10938. args: ["aBlock"],
  10939. 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",
  10940. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
  10941. referencedClasses: []
  10942. }),
  10943. globals.AssociativeCollection);
  10944. smalltalk.addMethod(
  10945. smalltalk.method({
  10946. selector: "shallowCopy",
  10947. protocol: 'copying',
  10948. fn: function (){
  10949. var self=this;
  10950. var copy;
  10951. return smalltalk.withContext(function($ctx1) {
  10952. var $1;
  10953. copy=_st(self._class())._new();
  10954. self._keysAndValuesDo_((function(key,value){
  10955. return smalltalk.withContext(function($ctx2) {
  10956. return _st(copy)._at_put_(key,value);
  10957. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10958. $1=copy;
  10959. return $1;
  10960. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)})},
  10961. args: [],
  10962. 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",
  10963. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  10964. referencedClasses: []
  10965. }),
  10966. globals.AssociativeCollection);
  10967. smalltalk.addMethod(
  10968. smalltalk.method({
  10969. selector: "size",
  10970. protocol: 'accessing',
  10971. fn: function (){
  10972. var self=this;
  10973. return smalltalk.withContext(function($ctx1) {
  10974. var $1;
  10975. $1=_st(self._keys())._size();
  10976. return $1;
  10977. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)})},
  10978. args: [],
  10979. source: "size\x0a\x09^ self keys size",
  10980. messageSends: ["size", "keys"],
  10981. referencedClasses: []
  10982. }),
  10983. globals.AssociativeCollection);
  10984. smalltalk.addMethod(
  10985. smalltalk.method({
  10986. selector: "values",
  10987. protocol: 'accessing',
  10988. fn: function (){
  10989. var self=this;
  10990. return smalltalk.withContext(function($ctx1) {
  10991. self._subclassResponsibility();
  10992. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)})},
  10993. args: [],
  10994. source: "values\x0a\x09self subclassResponsibility",
  10995. messageSends: ["subclassResponsibility"],
  10996. referencedClasses: []
  10997. }),
  10998. globals.AssociativeCollection);
  10999. smalltalk.addMethod(
  11000. smalltalk.method({
  11001. selector: "valuesDo:",
  11002. protocol: 'enumerating',
  11003. fn: function (aBlock){
  11004. var self=this;
  11005. return smalltalk.withContext(function($ctx1) {
  11006. self._subclassResponsibility();
  11007. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11008. args: ["aBlock"],
  11009. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  11010. messageSends: ["subclassResponsibility"],
  11011. referencedClasses: []
  11012. }),
  11013. globals.AssociativeCollection);
  11014. smalltalk.addMethod(
  11015. smalltalk.method({
  11016. selector: "withIndexDo:",
  11017. protocol: 'enumerating',
  11018. fn: function (aBlock){
  11019. var self=this;
  11020. return smalltalk.withContext(function($ctx1) {
  11021. self._keysAndValuesDo_((function(key,value){
  11022. return smalltalk.withContext(function($ctx2) {
  11023. return _st(aBlock)._value_value_(value,key);
  11024. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11025. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11026. args: ["aBlock"],
  11027. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  11028. messageSends: ["keysAndValuesDo:", "value:value:"],
  11029. referencedClasses: []
  11030. }),
  11031. globals.AssociativeCollection);
  11032. smalltalk.addMethod(
  11033. smalltalk.method({
  11034. selector: "from:",
  11035. protocol: 'instance creation',
  11036. fn: function (aCollection){
  11037. var self=this;
  11038. var newCollection;
  11039. return smalltalk.withContext(function($ctx1) {
  11040. var $1;
  11041. newCollection=self._new();
  11042. _st(aCollection)._do_((function(each){
  11043. return smalltalk.withContext(function($ctx2) {
  11044. return _st(newCollection)._add_(each);
  11045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  11046. $1=newCollection;
  11047. return $1;
  11048. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  11049. args: ["aCollection"],
  11050. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  11051. messageSends: ["new", "do:", "add:"],
  11052. referencedClasses: []
  11053. }),
  11054. globals.AssociativeCollection.klass);
  11055. smalltalk.addMethod(
  11056. smalltalk.method({
  11057. selector: "fromPairs:",
  11058. protocol: 'instance creation',
  11059. fn: function (aCollection){
  11060. var self=this;
  11061. return smalltalk.withContext(function($ctx1) {
  11062. var $1;
  11063. $1=self._from_(aCollection);
  11064. return $1;
  11065. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)})},
  11066. args: ["aCollection"],
  11067. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  11068. messageSends: ["from:"],
  11069. referencedClasses: []
  11070. }),
  11071. globals.AssociativeCollection.klass);
  11072. smalltalk.addMethod(
  11073. smalltalk.method({
  11074. selector: "newFromPairs:",
  11075. protocol: 'instance creation',
  11076. fn: function (aCollection){
  11077. var self=this;
  11078. var newCollection;
  11079. return smalltalk.withContext(function($ctx1) {
  11080. var $2,$1,$3,$4,$5;
  11081. $2=_st(aCollection)._size();
  11082. $ctx1.sendIdx["size"]=1;
  11083. $1=_st($2)._even();
  11084. if(! smalltalk.assert($1)){
  11085. self._error_("#newFromPairs only accepts arrays of an even length");
  11086. };
  11087. newCollection=self._new();
  11088. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  11089. return smalltalk.withContext(function($ctx2) {
  11090. $3=newCollection;
  11091. $4=_st(aCollection)._at_(each);
  11092. $ctx2.sendIdx["at:"]=1;
  11093. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  11094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  11095. $5=newCollection;
  11096. return $5;
  11097. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  11098. args: ["aCollection"],
  11099. 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",
  11100. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"],
  11101. referencedClasses: []
  11102. }),
  11103. globals.AssociativeCollection.klass);
  11104. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  11105. 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.";
  11106. smalltalk.addMethod(
  11107. smalltalk.method({
  11108. selector: "at:ifAbsent:",
  11109. protocol: 'accessing',
  11110. fn: function (aKey,aBlock){
  11111. var self=this;
  11112. return smalltalk.withContext(function($ctx1) {
  11113. var index = self._positionOfKey_(aKey);
  11114. return index >=0 ? self['@values'][index] : aBlock._value();
  11115. ;
  11116. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  11117. args: ["aKey", "aBlock"],
  11118. 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>",
  11119. messageSends: [],
  11120. referencedClasses: []
  11121. }),
  11122. globals.Dictionary);
  11123. smalltalk.addMethod(
  11124. smalltalk.method({
  11125. selector: "at:put:",
  11126. protocol: 'accessing',
  11127. fn: function (aKey,aValue){
  11128. var self=this;
  11129. return smalltalk.withContext(function($ctx1) {
  11130. var index = self._positionOfKey_(aKey);
  11131. if(index === -1) {
  11132. var keys = self['@keys'];
  11133. index = keys.length;
  11134. keys.push(aKey);
  11135. }
  11136. return self['@values'][index] = aValue;
  11137. ;
  11138. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)})},
  11139. args: ["aKey", "aValue"],
  11140. 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>",
  11141. messageSends: [],
  11142. referencedClasses: []
  11143. }),
  11144. globals.Dictionary);
  11145. smalltalk.addMethod(
  11146. smalltalk.method({
  11147. selector: "includesKey:",
  11148. protocol: 'testing',
  11149. fn: function (aKey){
  11150. var self=this;
  11151. return smalltalk.withContext(function($ctx1) {
  11152. return self._positionOfKey_(aKey) >= 0; ;
  11153. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)})},
  11154. args: ["aKey"],
  11155. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  11156. messageSends: [],
  11157. referencedClasses: []
  11158. }),
  11159. globals.Dictionary);
  11160. smalltalk.addMethod(
  11161. smalltalk.method({
  11162. selector: "indexOf:ifAbsent:",
  11163. protocol: 'accessing',
  11164. fn: function (anObject,aBlock){
  11165. var self=this;
  11166. var index;
  11167. return smalltalk.withContext(function($ctx1) {
  11168. var $2,$1;
  11169. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  11170. return (0);
  11171. }));
  11172. $2=_st(index).__eq((0));
  11173. if(smalltalk.assert($2)){
  11174. $1=_st(aBlock)._value();
  11175. } else {
  11176. $1=_st(self["@keys"])._at_(index);
  11177. };
  11178. return $1;
  11179. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)})},
  11180. args: ["anObject", "aBlock"],
  11181. 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 ]",
  11182. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"],
  11183. referencedClasses: []
  11184. }),
  11185. globals.Dictionary);
  11186. smalltalk.addMethod(
  11187. smalltalk.method({
  11188. selector: "initialize",
  11189. protocol: 'initialization',
  11190. fn: function (){
  11191. var self=this;
  11192. return smalltalk.withContext(function($ctx1) {
  11193. globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []);
  11194. self["@keys"]=[];
  11195. self["@values"]=[];
  11196. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)})},
  11197. args: [],
  11198. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  11199. messageSends: ["initialize"],
  11200. referencedClasses: []
  11201. }),
  11202. globals.Dictionary);
  11203. smalltalk.addMethod(
  11204. smalltalk.method({
  11205. selector: "keys",
  11206. protocol: 'accessing',
  11207. fn: function (){
  11208. var self=this;
  11209. return smalltalk.withContext(function($ctx1) {
  11210. var $1;
  11211. $1=_st(self["@keys"])._copy();
  11212. return $1;
  11213. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)})},
  11214. args: [],
  11215. source: "keys\x0a\x09^ keys copy",
  11216. messageSends: ["copy"],
  11217. referencedClasses: []
  11218. }),
  11219. globals.Dictionary);
  11220. smalltalk.addMethod(
  11221. smalltalk.method({
  11222. selector: "keysAndValuesDo:",
  11223. protocol: 'enumerating',
  11224. fn: function (aBlock){
  11225. var self=this;
  11226. return smalltalk.withContext(function($ctx1) {
  11227. var $1;
  11228. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  11229. return $1;
  11230. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  11231. args: ["aBlock"],
  11232. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  11233. messageSends: ["with:do:"],
  11234. referencedClasses: []
  11235. }),
  11236. globals.Dictionary);
  11237. smalltalk.addMethod(
  11238. smalltalk.method({
  11239. selector: "keysDo:",
  11240. protocol: 'enumerating',
  11241. fn: function (aBlock){
  11242. var self=this;
  11243. return smalltalk.withContext(function($ctx1) {
  11244. var $1;
  11245. $1=_st(self["@keys"])._do_(aBlock);
  11246. return $1;
  11247. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)})},
  11248. args: ["aBlock"],
  11249. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  11250. messageSends: ["do:"],
  11251. referencedClasses: []
  11252. }),
  11253. globals.Dictionary);
  11254. smalltalk.addMethod(
  11255. smalltalk.method({
  11256. selector: "positionOfKey:",
  11257. protocol: 'private',
  11258. fn: function (anObject){
  11259. var self=this;
  11260. return smalltalk.withContext(function($ctx1) {
  11261. var keys = self['@keys'];
  11262. for(var i=0;i<keys.length;i++){
  11263. if(keys[i].__eq(anObject)) { return i;}
  11264. }
  11265. return -1;
  11266. ;
  11267. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)})},
  11268. args: ["anObject"],
  11269. 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>",
  11270. messageSends: [],
  11271. referencedClasses: []
  11272. }),
  11273. globals.Dictionary);
  11274. smalltalk.addMethod(
  11275. smalltalk.method({
  11276. selector: "removeAll",
  11277. protocol: 'adding/removing',
  11278. fn: function (){
  11279. var self=this;
  11280. return smalltalk.withContext(function($ctx1) {
  11281. _st(self["@keys"])._removeAll();
  11282. $ctx1.sendIdx["removeAll"]=1;
  11283. _st(self["@values"])._removeAll();
  11284. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)})},
  11285. args: [],
  11286. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  11287. messageSends: ["removeAll"],
  11288. referencedClasses: []
  11289. }),
  11290. globals.Dictionary);
  11291. smalltalk.addMethod(
  11292. smalltalk.method({
  11293. selector: "removeKey:ifAbsent:",
  11294. protocol: 'adding/removing',
  11295. fn: function (aKey,aBlock){
  11296. var self=this;
  11297. return smalltalk.withContext(function($ctx1) {
  11298. var index = self._positionOfKey_(aKey);
  11299. if(index === -1) {
  11300. return aBlock._value()
  11301. } else {
  11302. var keys = self['@keys'], values = self['@values'];
  11303. var value = values[index], l = keys.length;
  11304. keys[index] = keys[l-1];
  11305. keys.pop();
  11306. values[index] = values[l-1];
  11307. values.pop();
  11308. return value;
  11309. }
  11310. ;
  11311. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  11312. args: ["aKey", "aBlock"],
  11313. 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>",
  11314. messageSends: [],
  11315. referencedClasses: []
  11316. }),
  11317. globals.Dictionary);
  11318. smalltalk.addMethod(
  11319. smalltalk.method({
  11320. selector: "values",
  11321. protocol: 'accessing',
  11322. fn: function (){
  11323. var self=this;
  11324. var $1;
  11325. $1=self["@values"];
  11326. return $1;
  11327. },
  11328. args: [],
  11329. source: "values\x0a\x09^ values",
  11330. messageSends: [],
  11331. referencedClasses: []
  11332. }),
  11333. globals.Dictionary);
  11334. smalltalk.addMethod(
  11335. smalltalk.method({
  11336. selector: "valuesDo:",
  11337. protocol: 'enumerating',
  11338. fn: function (aBlock){
  11339. var self=this;
  11340. return smalltalk.withContext(function($ctx1) {
  11341. var $1;
  11342. $1=_st(self["@values"])._do_(aBlock);
  11343. return $1;
  11344. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  11345. args: ["aBlock"],
  11346. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  11347. messageSends: ["do:"],
  11348. referencedClasses: []
  11349. }),
  11350. globals.Dictionary);
  11351. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  11352. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  11353. smalltalk.addMethod(
  11354. smalltalk.method({
  11355. selector: "at:ifAbsent:",
  11356. protocol: 'accessing',
  11357. fn: function (aKey,aBlock){
  11358. var self=this;
  11359. return smalltalk.withContext(function($ctx1) {
  11360. var $2,$1;
  11361. $2=self._includesKey_(aKey);
  11362. if(smalltalk.assert($2)){
  11363. $1=self._basicAt_(aKey);
  11364. } else {
  11365. $1=_st(aBlock)._value();
  11366. };
  11367. return $1;
  11368. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  11369. args: ["aKey", "aBlock"],
  11370. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  11371. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"],
  11372. referencedClasses: []
  11373. }),
  11374. globals.HashedCollection);
  11375. smalltalk.addMethod(
  11376. smalltalk.method({
  11377. selector: "at:put:",
  11378. protocol: 'accessing',
  11379. fn: function (aKey,aValue){
  11380. var self=this;
  11381. return smalltalk.withContext(function($ctx1) {
  11382. var $1;
  11383. $1=self._basicAt_put_(aKey,aValue);
  11384. return $1;
  11385. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)})},
  11386. args: ["aKey", "aValue"],
  11387. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  11388. messageSends: ["basicAt:put:"],
  11389. referencedClasses: []
  11390. }),
  11391. globals.HashedCollection);
  11392. smalltalk.addMethod(
  11393. smalltalk.method({
  11394. selector: "includesKey:",
  11395. protocol: 'testing',
  11396. fn: function (aKey){
  11397. var self=this;
  11398. return smalltalk.withContext(function($ctx1) {
  11399. return self.hasOwnProperty(aKey);
  11400. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)})},
  11401. args: ["aKey"],
  11402. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  11403. messageSends: [],
  11404. referencedClasses: []
  11405. }),
  11406. globals.HashedCollection);
  11407. smalltalk.addMethod(
  11408. smalltalk.method({
  11409. selector: "keys",
  11410. protocol: 'accessing',
  11411. fn: function (){
  11412. var self=this;
  11413. return smalltalk.withContext(function($ctx1) {
  11414. return Object.keys(self);
  11415. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)})},
  11416. args: [],
  11417. source: "keys\x0a\x09<return Object.keys(self)>",
  11418. messageSends: [],
  11419. referencedClasses: []
  11420. }),
  11421. globals.HashedCollection);
  11422. smalltalk.addMethod(
  11423. smalltalk.method({
  11424. selector: "keysDo:",
  11425. protocol: 'enumerating',
  11426. fn: function (aBlock){
  11427. var self=this;
  11428. return smalltalk.withContext(function($ctx1) {
  11429. _st(self._keys())._do_(aBlock);
  11430. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)})},
  11431. args: ["aBlock"],
  11432. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  11433. messageSends: ["do:", "keys"],
  11434. referencedClasses: []
  11435. }),
  11436. globals.HashedCollection);
  11437. smalltalk.addMethod(
  11438. smalltalk.method({
  11439. selector: "removeKey:ifAbsent:",
  11440. protocol: 'adding/removing',
  11441. fn: function (aKey,aBlock){
  11442. var self=this;
  11443. return smalltalk.withContext(function($ctx1) {
  11444. var $1;
  11445. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  11446. return smalltalk.withContext(function($ctx2) {
  11447. self._basicDelete_(aKey);
  11448. return removed;
  11449. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)})}),(function(){
  11450. return smalltalk.withContext(function($ctx2) {
  11451. return _st(aBlock)._value();
  11452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  11453. return $1;
  11454. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  11455. args: ["aKey", "aBlock"],
  11456. 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 ]",
  11457. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"],
  11458. referencedClasses: []
  11459. }),
  11460. globals.HashedCollection);
  11461. smalltalk.addMethod(
  11462. smalltalk.method({
  11463. selector: "values",
  11464. protocol: 'accessing',
  11465. fn: function (){
  11466. var self=this;
  11467. return smalltalk.withContext(function($ctx1) {
  11468. return self._keys().map(function(key){
  11469. return self._at_(key);
  11470. });
  11471. ;
  11472. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)})},
  11473. args: [],
  11474. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  11475. messageSends: [],
  11476. referencedClasses: []
  11477. }),
  11478. globals.HashedCollection);
  11479. smalltalk.addMethod(
  11480. smalltalk.method({
  11481. selector: "valuesDo:",
  11482. protocol: 'enumerating',
  11483. fn: function (aBlock){
  11484. var self=this;
  11485. return smalltalk.withContext(function($ctx1) {
  11486. _st(self._values())._do_(aBlock);
  11487. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)})},
  11488. args: ["aBlock"],
  11489. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  11490. messageSends: ["do:", "values"],
  11491. referencedClasses: []
  11492. }),
  11493. globals.HashedCollection);
  11494. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  11495. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  11496. smalltalk.addMethod(
  11497. smalltalk.method({
  11498. selector: "=",
  11499. protocol: 'comparing',
  11500. fn: function (aCollection){
  11501. var self=this;
  11502. return smalltalk.withContext(function($ctx1) {
  11503. var $3,$2,$4,$1,$5;
  11504. var $early={};
  11505. try {
  11506. $3=self._class();
  11507. $ctx1.sendIdx["class"]=1;
  11508. $2=_st($3).__eq(_st(aCollection)._class());
  11509. $ctx1.sendIdx["="]=1;
  11510. $1=_st($2)._and_((function(){
  11511. return smalltalk.withContext(function($ctx2) {
  11512. $4=self._size();
  11513. $ctx2.sendIdx["size"]=1;
  11514. return _st($4).__eq(_st(aCollection)._size());
  11515. $ctx2.sendIdx["="]=2;
  11516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  11517. if(! smalltalk.assert($1)){
  11518. return false;
  11519. };
  11520. self._withIndexDo_((function(each,i){
  11521. return smalltalk.withContext(function($ctx2) {
  11522. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  11523. if(! smalltalk.assert($5)){
  11524. throw $early=[false];
  11525. };
  11526. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  11527. return true;
  11528. }
  11529. catch(e) {if(e===$early)return e[0]; throw e}
  11530. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)})},
  11531. args: ["aCollection"],
  11532. 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",
  11533. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
  11534. referencedClasses: []
  11535. }),
  11536. globals.SequenceableCollection);
  11537. smalltalk.addMethod(
  11538. smalltalk.method({
  11539. selector: "addLast:",
  11540. protocol: 'adding/removing',
  11541. fn: function (anObject){
  11542. var self=this;
  11543. return smalltalk.withContext(function($ctx1) {
  11544. self._add_(anObject);
  11545. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)})},
  11546. args: ["anObject"],
  11547. source: "addLast: anObject\x0a\x09self add: anObject",
  11548. messageSends: ["add:"],
  11549. referencedClasses: []
  11550. }),
  11551. globals.SequenceableCollection);
  11552. smalltalk.addMethod(
  11553. smalltalk.method({
  11554. selector: "allButFirst",
  11555. protocol: 'accessing',
  11556. fn: function (){
  11557. var self=this;
  11558. return smalltalk.withContext(function($ctx1) {
  11559. var $1;
  11560. $1=self._copyFrom_to_((2),self._size());
  11561. return $1;
  11562. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)})},
  11563. args: [],
  11564. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  11565. messageSends: ["copyFrom:to:", "size"],
  11566. referencedClasses: []
  11567. }),
  11568. globals.SequenceableCollection);
  11569. smalltalk.addMethod(
  11570. smalltalk.method({
  11571. selector: "allButLast",
  11572. protocol: 'accessing',
  11573. fn: function (){
  11574. var self=this;
  11575. return smalltalk.withContext(function($ctx1) {
  11576. var $1;
  11577. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  11578. return $1;
  11579. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)})},
  11580. args: [],
  11581. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  11582. messageSends: ["copyFrom:to:", "-", "size"],
  11583. referencedClasses: []
  11584. }),
  11585. globals.SequenceableCollection);
  11586. smalltalk.addMethod(
  11587. smalltalk.method({
  11588. selector: "atRandom",
  11589. protocol: 'accessing',
  11590. fn: function (){
  11591. var self=this;
  11592. return smalltalk.withContext(function($ctx1) {
  11593. var $1;
  11594. $1=self._at_(_st(self._size())._atRandom());
  11595. return $1;
  11596. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)})},
  11597. args: [],
  11598. source: "atRandom\x0a\x09^ self at: self size atRandom",
  11599. messageSends: ["at:", "atRandom", "size"],
  11600. referencedClasses: []
  11601. }),
  11602. globals.SequenceableCollection);
  11603. smalltalk.addMethod(
  11604. smalltalk.method({
  11605. selector: "beginsWith:",
  11606. protocol: 'testing',
  11607. fn: function (prefix){
  11608. var self=this;
  11609. return smalltalk.withContext(function($ctx1) {
  11610. var $2,$3,$1,$4;
  11611. $2=self._size();
  11612. $ctx1.sendIdx["size"]=1;
  11613. $3=_st(prefix)._size();
  11614. $ctx1.sendIdx["size"]=2;
  11615. $1=_st($2).__lt($3);
  11616. if(smalltalk.assert($1)){
  11617. return false;
  11618. };
  11619. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  11620. return $4;
  11621. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)})},
  11622. args: ["prefix"],
  11623. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  11624. messageSends: ["ifTrue:", "<", "size", "=", "first:"],
  11625. referencedClasses: []
  11626. }),
  11627. globals.SequenceableCollection);
  11628. smalltalk.addMethod(
  11629. smalltalk.method({
  11630. selector: "copyFrom:to:",
  11631. protocol: 'copying',
  11632. fn: function (anIndex,anotherIndex){
  11633. var self=this;
  11634. var range,newCollection;
  11635. return smalltalk.withContext(function($ctx1) {
  11636. var $1;
  11637. range=_st(anIndex)._to_(anotherIndex);
  11638. newCollection=_st(self._class())._new_(_st(range)._size());
  11639. _st(range)._withIndexDo_((function(each,i){
  11640. return smalltalk.withContext(function($ctx2) {
  11641. return _st(newCollection)._at_put_(i,self._at_(each));
  11642. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  11643. $1=newCollection;
  11644. return $1;
  11645. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)})},
  11646. args: ["anIndex", "anotherIndex"],
  11647. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  11648. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
  11649. referencedClasses: []
  11650. }),
  11651. globals.SequenceableCollection);
  11652. smalltalk.addMethod(
  11653. smalltalk.method({
  11654. selector: "deepCopy",
  11655. protocol: 'copying',
  11656. fn: function (){
  11657. var self=this;
  11658. var newCollection;
  11659. return smalltalk.withContext(function($ctx1) {
  11660. var $1;
  11661. newCollection=_st(self._class())._new_(self._size());
  11662. self._withIndexDo_((function(each,index){
  11663. return smalltalk.withContext(function($ctx2) {
  11664. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  11665. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  11666. $1=newCollection;
  11667. return $1;
  11668. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  11669. args: [],
  11670. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  11671. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
  11672. referencedClasses: []
  11673. }),
  11674. globals.SequenceableCollection);
  11675. smalltalk.addMethod(
  11676. smalltalk.method({
  11677. selector: "detect:ifNone:",
  11678. protocol: 'enumerating',
  11679. fn: function (aBlock,anotherBlock){
  11680. var self=this;
  11681. return smalltalk.withContext(function($ctx1) {
  11682. self = self._numericallyIndexable();
  11683. for(var i = 0; i < self.length; i++)
  11684. if(aBlock._value_(self[i]))
  11685. return self[i];
  11686. return anotherBlock._value();
  11687. ;
  11688. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)})},
  11689. args: ["aBlock", "anotherBlock"],
  11690. 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>",
  11691. messageSends: [],
  11692. referencedClasses: []
  11693. }),
  11694. globals.SequenceableCollection);
  11695. smalltalk.addMethod(
  11696. smalltalk.method({
  11697. selector: "do:",
  11698. protocol: 'enumerating',
  11699. fn: function (aBlock){
  11700. var self=this;
  11701. return smalltalk.withContext(function($ctx1) {
  11702. self = self._numericallyIndexable();
  11703. for(var i=0; i < self.length; i++) {
  11704. aBlock._value_(self[i]);
  11705. }
  11706. ;
  11707. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)})},
  11708. args: ["aBlock"],
  11709. 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>",
  11710. messageSends: [],
  11711. referencedClasses: []
  11712. }),
  11713. globals.SequenceableCollection);
  11714. smalltalk.addMethod(
  11715. smalltalk.method({
  11716. selector: "endsWith:",
  11717. protocol: 'testing',
  11718. fn: function (suffix){
  11719. var self=this;
  11720. return smalltalk.withContext(function($ctx1) {
  11721. var $2,$3,$1,$4;
  11722. $2=self._size();
  11723. $ctx1.sendIdx["size"]=1;
  11724. $3=_st(suffix)._size();
  11725. $ctx1.sendIdx["size"]=2;
  11726. $1=_st($2).__lt($3);
  11727. if(smalltalk.assert($1)){
  11728. return false;
  11729. };
  11730. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  11731. return $4;
  11732. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)})},
  11733. args: ["suffix"],
  11734. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  11735. messageSends: ["ifTrue:", "<", "size", "=", "last:"],
  11736. referencedClasses: []
  11737. }),
  11738. globals.SequenceableCollection);
  11739. smalltalk.addMethod(
  11740. smalltalk.method({
  11741. selector: "first",
  11742. protocol: 'accessing',
  11743. fn: function (){
  11744. var self=this;
  11745. return smalltalk.withContext(function($ctx1) {
  11746. var $1;
  11747. $1=self._at_((1));
  11748. return $1;
  11749. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)})},
  11750. args: [],
  11751. source: "first\x0a\x09^ self at: 1",
  11752. messageSends: ["at:"],
  11753. referencedClasses: []
  11754. }),
  11755. globals.SequenceableCollection);
  11756. smalltalk.addMethod(
  11757. smalltalk.method({
  11758. selector: "first:",
  11759. protocol: 'accessing',
  11760. fn: function (aNumber){
  11761. var self=this;
  11762. return smalltalk.withContext(function($ctx1) {
  11763. var $1,$2;
  11764. $1=_st(self._size()).__lt(aNumber);
  11765. if(smalltalk.assert($1)){
  11766. self._error_("Invalid number of elements");
  11767. };
  11768. $2=self._copyFrom_to_((1),aNumber);
  11769. return $2;
  11770. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)})},
  11771. args: ["aNumber"],
  11772. 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",
  11773. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"],
  11774. referencedClasses: []
  11775. }),
  11776. globals.SequenceableCollection);
  11777. smalltalk.addMethod(
  11778. smalltalk.method({
  11779. selector: "fourth",
  11780. protocol: 'accessing',
  11781. fn: function (){
  11782. var self=this;
  11783. return smalltalk.withContext(function($ctx1) {
  11784. var $1;
  11785. $1=self._at_((4));
  11786. return $1;
  11787. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)})},
  11788. args: [],
  11789. source: "fourth\x0a\x09^ self at: 4",
  11790. messageSends: ["at:"],
  11791. referencedClasses: []
  11792. }),
  11793. globals.SequenceableCollection);
  11794. smalltalk.addMethod(
  11795. smalltalk.method({
  11796. selector: "includes:",
  11797. protocol: 'testing',
  11798. fn: function (anObject){
  11799. var self=this;
  11800. return smalltalk.withContext(function($ctx1) {
  11801. var $1;
  11802. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  11803. return nil;
  11804. })))._notNil();
  11805. return $1;
  11806. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)})},
  11807. args: ["anObject"],
  11808. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  11809. messageSends: ["notNil", "indexOf:ifAbsent:"],
  11810. referencedClasses: []
  11811. }),
  11812. globals.SequenceableCollection);
  11813. smalltalk.addMethod(
  11814. smalltalk.method({
  11815. selector: "indexOf:ifAbsent:",
  11816. protocol: 'accessing',
  11817. fn: function (anObject,aBlock){
  11818. var self=this;
  11819. return smalltalk.withContext(function($ctx1) {
  11820. self = self._numericallyIndexable();
  11821. for(var i=0; i < self.length; i++) {
  11822. if(_st(self[i]).__eq(anObject)) {return i+1}
  11823. };
  11824. return aBlock._value();
  11825. ;
  11826. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)})},
  11827. args: ["anObject", "aBlock"],
  11828. 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(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  11829. messageSends: [],
  11830. referencedClasses: []
  11831. }),
  11832. globals.SequenceableCollection);
  11833. smalltalk.addMethod(
  11834. smalltalk.method({
  11835. selector: "indexOf:startingAt:",
  11836. protocol: 'accessing',
  11837. fn: function (anObject,start){
  11838. var self=this;
  11839. return smalltalk.withContext(function($ctx1) {
  11840. var $1;
  11841. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  11842. return (0);
  11843. }));
  11844. return $1;
  11845. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)})},
  11846. args: ["anObject", "start"],
  11847. 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 ]",
  11848. messageSends: ["indexOf:startingAt:ifAbsent:"],
  11849. referencedClasses: []
  11850. }),
  11851. globals.SequenceableCollection);
  11852. smalltalk.addMethod(
  11853. smalltalk.method({
  11854. selector: "indexOf:startingAt:ifAbsent:",
  11855. protocol: 'accessing',
  11856. fn: function (anObject,start,aBlock){
  11857. var self=this;
  11858. return smalltalk.withContext(function($ctx1) {
  11859. self = self._numericallyIndexable();
  11860. for(var i=start - 1; i < self.length; i++){
  11861. if(_st(self[i]).__eq(anObject)) {return i+1}
  11862. }
  11863. return aBlock._value();
  11864. ;
  11865. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)})},
  11866. args: ["anObject", "start", "aBlock"],
  11867. 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(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  11868. messageSends: [],
  11869. referencedClasses: []
  11870. }),
  11871. globals.SequenceableCollection);
  11872. smalltalk.addMethod(
  11873. smalltalk.method({
  11874. selector: "last",
  11875. protocol: 'accessing',
  11876. fn: function (){
  11877. var self=this;
  11878. return smalltalk.withContext(function($ctx1) {
  11879. var $1;
  11880. $1=self._at_(self._size());
  11881. return $1;
  11882. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)})},
  11883. args: [],
  11884. source: "last\x0a\x09^ self at: self size",
  11885. messageSends: ["at:", "size"],
  11886. referencedClasses: []
  11887. }),
  11888. globals.SequenceableCollection);
  11889. smalltalk.addMethod(
  11890. smalltalk.method({
  11891. selector: "last:",
  11892. protocol: 'accessing',
  11893. fn: function (aNumber){
  11894. var self=this;
  11895. return smalltalk.withContext(function($ctx1) {
  11896. var $2,$1,$6,$5,$4,$3;
  11897. $2=self._size();
  11898. $ctx1.sendIdx["size"]=1;
  11899. $1=_st($2).__lt(aNumber);
  11900. if(smalltalk.assert($1)){
  11901. self._error_("Invalid number of elements");
  11902. };
  11903. $6=self._size();
  11904. $ctx1.sendIdx["size"]=2;
  11905. $5=_st($6).__minus(aNumber);
  11906. $4=_st($5).__plus((1));
  11907. $3=self._copyFrom_to_($4,self._size());
  11908. return $3;
  11909. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)})},
  11910. args: ["aNumber"],
  11911. 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",
  11912. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"],
  11913. referencedClasses: []
  11914. }),
  11915. globals.SequenceableCollection);
  11916. smalltalk.addMethod(
  11917. smalltalk.method({
  11918. selector: "newStream",
  11919. protocol: 'streaming',
  11920. fn: function (){
  11921. var self=this;
  11922. return smalltalk.withContext(function($ctx1) {
  11923. var $1;
  11924. $1=_st(self._streamClass())._on_(self);
  11925. return $1;
  11926. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)})},
  11927. args: [],
  11928. source: "newStream\x0a\x09^ self streamClass on: self",
  11929. messageSends: ["on:", "streamClass"],
  11930. referencedClasses: []
  11931. }),
  11932. globals.SequenceableCollection);
  11933. smalltalk.addMethod(
  11934. smalltalk.method({
  11935. selector: "numericallyIndexable",
  11936. protocol: 'private',
  11937. fn: function (){
  11938. var self=this;
  11939. return smalltalk.withContext(function($ctx1) {
  11940. self._subclassResponsibility();
  11941. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)})},
  11942. args: [],
  11943. 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",
  11944. messageSends: ["subclassResponsibility"],
  11945. referencedClasses: []
  11946. }),
  11947. globals.SequenceableCollection);
  11948. smalltalk.addMethod(
  11949. smalltalk.method({
  11950. selector: "readStream",
  11951. protocol: 'streaming',
  11952. fn: function (){
  11953. var self=this;
  11954. return smalltalk.withContext(function($ctx1) {
  11955. var $1;
  11956. $1=self._stream();
  11957. return $1;
  11958. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)})},
  11959. args: [],
  11960. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  11961. messageSends: ["stream"],
  11962. referencedClasses: []
  11963. }),
  11964. globals.SequenceableCollection);
  11965. smalltalk.addMethod(
  11966. smalltalk.method({
  11967. selector: "removeLast",
  11968. protocol: 'adding/removing',
  11969. fn: function (){
  11970. var self=this;
  11971. return smalltalk.withContext(function($ctx1) {
  11972. var $1;
  11973. $1=self._remove_(self._last());
  11974. return $1;
  11975. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)})},
  11976. args: [],
  11977. source: "removeLast\x0a\x09^ self remove: self last",
  11978. messageSends: ["remove:", "last"],
  11979. referencedClasses: []
  11980. }),
  11981. globals.SequenceableCollection);
  11982. smalltalk.addMethod(
  11983. smalltalk.method({
  11984. selector: "reversed",
  11985. protocol: 'converting',
  11986. fn: function (){
  11987. var self=this;
  11988. return smalltalk.withContext(function($ctx1) {
  11989. self._subclassResponsibility();
  11990. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)})},
  11991. args: [],
  11992. source: "reversed\x0a\x09self subclassResponsibility",
  11993. messageSends: ["subclassResponsibility"],
  11994. referencedClasses: []
  11995. }),
  11996. globals.SequenceableCollection);
  11997. smalltalk.addMethod(
  11998. smalltalk.method({
  11999. selector: "second",
  12000. protocol: 'accessing',
  12001. fn: function (){
  12002. var self=this;
  12003. return smalltalk.withContext(function($ctx1) {
  12004. var $1;
  12005. $1=self._at_((2));
  12006. return $1;
  12007. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)})},
  12008. args: [],
  12009. source: "second\x0a\x09^ self at: 2",
  12010. messageSends: ["at:"],
  12011. referencedClasses: []
  12012. }),
  12013. globals.SequenceableCollection);
  12014. smalltalk.addMethod(
  12015. smalltalk.method({
  12016. selector: "shallowCopy",
  12017. protocol: 'copying',
  12018. fn: function (){
  12019. var self=this;
  12020. var newCollection;
  12021. return smalltalk.withContext(function($ctx1) {
  12022. var $1;
  12023. newCollection=_st(self._class())._new_(self._size());
  12024. self._withIndexDo_((function(each,index){
  12025. return smalltalk.withContext(function($ctx2) {
  12026. return _st(newCollection)._at_put_(index,each);
  12027. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  12028. $1=newCollection;
  12029. return $1;
  12030. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  12031. args: [],
  12032. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  12033. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  12034. referencedClasses: []
  12035. }),
  12036. globals.SequenceableCollection);
  12037. smalltalk.addMethod(
  12038. smalltalk.method({
  12039. selector: "stream",
  12040. protocol: 'streaming',
  12041. fn: function (){
  12042. var self=this;
  12043. return smalltalk.withContext(function($ctx1) {
  12044. var $1;
  12045. $1=self._newStream();
  12046. return $1;
  12047. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)})},
  12048. args: [],
  12049. source: "stream\x0a\x09^ self newStream",
  12050. messageSends: ["newStream"],
  12051. referencedClasses: []
  12052. }),
  12053. globals.SequenceableCollection);
  12054. smalltalk.addMethod(
  12055. smalltalk.method({
  12056. selector: "streamClass",
  12057. protocol: 'streaming',
  12058. fn: function (){
  12059. var self=this;
  12060. return smalltalk.withContext(function($ctx1) {
  12061. var $1;
  12062. $1=_st(self._class())._streamClass();
  12063. return $1;
  12064. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)})},
  12065. args: [],
  12066. source: "streamClass\x0a\x09^ self class streamClass",
  12067. messageSends: ["streamClass", "class"],
  12068. referencedClasses: []
  12069. }),
  12070. globals.SequenceableCollection);
  12071. smalltalk.addMethod(
  12072. smalltalk.method({
  12073. selector: "third",
  12074. protocol: 'accessing',
  12075. fn: function (){
  12076. var self=this;
  12077. return smalltalk.withContext(function($ctx1) {
  12078. var $1;
  12079. $1=self._at_((3));
  12080. return $1;
  12081. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)})},
  12082. args: [],
  12083. source: "third\x0a\x09^ self at: 3",
  12084. messageSends: ["at:"],
  12085. referencedClasses: []
  12086. }),
  12087. globals.SequenceableCollection);
  12088. smalltalk.addMethod(
  12089. smalltalk.method({
  12090. selector: "with:do:",
  12091. protocol: 'enumerating',
  12092. fn: function (anotherCollection,aBlock){
  12093. var self=this;
  12094. return smalltalk.withContext(function($ctx1) {
  12095. self = self._numericallyIndexable();
  12096. anotherCollection = anotherCollection._numericallyIndexable();
  12097. for(var i=0; i<self.length; i++) {
  12098. aBlock._value_value_(self[i], anotherCollection[i]);
  12099. }
  12100. ;
  12101. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)})},
  12102. args: ["anotherCollection", "aBlock"],
  12103. 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>",
  12104. messageSends: [],
  12105. referencedClasses: []
  12106. }),
  12107. globals.SequenceableCollection);
  12108. smalltalk.addMethod(
  12109. smalltalk.method({
  12110. selector: "withIndexDo:",
  12111. protocol: 'enumerating',
  12112. fn: function (aBlock){
  12113. var self=this;
  12114. return smalltalk.withContext(function($ctx1) {
  12115. self = self._numericallyIndexable();
  12116. for(var i=0; i < self.length; i++) {
  12117. aBlock._value_value_(self[i], i+1);
  12118. }
  12119. ;
  12120. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)})},
  12121. args: ["aBlock"],
  12122. 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>",
  12123. messageSends: [],
  12124. referencedClasses: []
  12125. }),
  12126. globals.SequenceableCollection);
  12127. smalltalk.addMethod(
  12128. smalltalk.method({
  12129. selector: "writeStream",
  12130. protocol: 'streaming',
  12131. fn: function (){
  12132. var self=this;
  12133. return smalltalk.withContext(function($ctx1) {
  12134. var $1;
  12135. $1=self._stream();
  12136. return $1;
  12137. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)})},
  12138. args: [],
  12139. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  12140. messageSends: ["stream"],
  12141. referencedClasses: []
  12142. }),
  12143. globals.SequenceableCollection);
  12144. smalltalk.addMethod(
  12145. smalltalk.method({
  12146. selector: "streamClass",
  12147. protocol: 'accessing',
  12148. fn: function (){
  12149. var self=this;
  12150. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  12151. return $Stream();
  12152. },
  12153. args: [],
  12154. source: "streamClass\x0a\x09\x09^ Stream",
  12155. messageSends: [],
  12156. referencedClasses: ["Stream"]
  12157. }),
  12158. globals.SequenceableCollection.klass);
  12159. smalltalk.addMethod(
  12160. smalltalk.method({
  12161. selector: "streamContents:",
  12162. protocol: 'streaming',
  12163. fn: function (aBlock){
  12164. var self=this;
  12165. var stream;
  12166. return smalltalk.withContext(function($ctx1) {
  12167. var $1;
  12168. stream=_st(self._streamClass())._on_(self._new());
  12169. _st(aBlock)._value_(stream);
  12170. $1=_st(stream)._contents();
  12171. return $1;
  12172. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)})},
  12173. args: ["aBlock"],
  12174. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  12175. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  12176. referencedClasses: []
  12177. }),
  12178. globals.SequenceableCollection.klass);
  12179. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  12180. 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`.";
  12181. smalltalk.addMethod(
  12182. smalltalk.method({
  12183. selector: "add:",
  12184. protocol: 'adding/removing',
  12185. fn: function (anObject){
  12186. var self=this;
  12187. return smalltalk.withContext(function($ctx1) {
  12188. self.push(anObject); return anObject;;
  12189. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)})},
  12190. args: ["anObject"],
  12191. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  12192. messageSends: [],
  12193. referencedClasses: []
  12194. }),
  12195. globals.Array);
  12196. smalltalk.addMethod(
  12197. smalltalk.method({
  12198. selector: "addFirst:",
  12199. protocol: 'adding/removing',
  12200. fn: function (anObject){
  12201. var self=this;
  12202. return smalltalk.withContext(function($ctx1) {
  12203. self.unshift(anObject); return anObject;;
  12204. return self}, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)})},
  12205. args: ["anObject"],
  12206. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  12207. messageSends: [],
  12208. referencedClasses: []
  12209. }),
  12210. globals.Array);
  12211. smalltalk.addMethod(
  12212. smalltalk.method({
  12213. selector: "asJavascript",
  12214. protocol: 'converting',
  12215. fn: function (){
  12216. var self=this;
  12217. return smalltalk.withContext(function($ctx1) {
  12218. var $1;
  12219. $1=_st("[".__comma(_st(self._collect_((function(each){
  12220. return smalltalk.withContext(function($ctx2) {
  12221. return _st(each)._asJavascript();
  12222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._join_(", "))).__comma("]");
  12223. $ctx1.sendIdx[","]=1;
  12224. return $1;
  12225. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)})},
  12226. args: [],
  12227. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  12228. messageSends: [",", "join:", "collect:", "asJavascript"],
  12229. referencedClasses: []
  12230. }),
  12231. globals.Array);
  12232. smalltalk.addMethod(
  12233. smalltalk.method({
  12234. selector: "at:ifAbsent:",
  12235. protocol: 'accessing',
  12236. fn: function (anIndex,aBlock){
  12237. var self=this;
  12238. return smalltalk.withContext(function($ctx1) {
  12239. return anIndex >= 1 && anIndex <= self.length
  12240. ? self[anIndex - 1]
  12241. : aBlock._value()
  12242. ;
  12243. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)})},
  12244. args: ["anIndex", "aBlock"],
  12245. 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>",
  12246. messageSends: [],
  12247. referencedClasses: []
  12248. }),
  12249. globals.Array);
  12250. smalltalk.addMethod(
  12251. smalltalk.method({
  12252. selector: "at:ifPresent:ifAbsent:",
  12253. protocol: 'accessing',
  12254. fn: function (anIndex,aBlock,anotherBlock){
  12255. var self=this;
  12256. return smalltalk.withContext(function($ctx1) {
  12257. return anIndex >= 1 && anIndex <= self.length
  12258. ? aBlock._value_(self[anIndex - 1])
  12259. : anotherBlock._value()
  12260. ;
  12261. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)})},
  12262. args: ["anIndex", "aBlock", "anotherBlock"],
  12263. 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>",
  12264. messageSends: [],
  12265. referencedClasses: []
  12266. }),
  12267. globals.Array);
  12268. smalltalk.addMethod(
  12269. smalltalk.method({
  12270. selector: "at:put:",
  12271. protocol: 'accessing',
  12272. fn: function (anIndex,anObject){
  12273. var self=this;
  12274. return smalltalk.withContext(function($ctx1) {
  12275. return self[anIndex - 1] = anObject;
  12276. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)})},
  12277. args: ["anIndex", "anObject"],
  12278. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  12279. messageSends: [],
  12280. referencedClasses: []
  12281. }),
  12282. globals.Array);
  12283. smalltalk.addMethod(
  12284. smalltalk.method({
  12285. selector: "collect:",
  12286. protocol: 'enumerating',
  12287. fn: function (aBlock){
  12288. var self=this;
  12289. return smalltalk.withContext(function($ctx1) {
  12290. return self.map(function(each) {return aBlock._value_(each)});
  12291. return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)})},
  12292. args: ["aBlock"],
  12293. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  12294. messageSends: [],
  12295. referencedClasses: []
  12296. }),
  12297. globals.Array);
  12298. smalltalk.addMethod(
  12299. smalltalk.method({
  12300. selector: "join:",
  12301. protocol: 'enumerating',
  12302. fn: function (aString){
  12303. var self=this;
  12304. return smalltalk.withContext(function($ctx1) {
  12305. return self.join(aString);
  12306. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)})},
  12307. args: ["aString"],
  12308. source: "join: aString\x0a\x09<return self.join(aString)>",
  12309. messageSends: [],
  12310. referencedClasses: []
  12311. }),
  12312. globals.Array);
  12313. smalltalk.addMethod(
  12314. smalltalk.method({
  12315. selector: "numericallyIndexable",
  12316. protocol: 'private',
  12317. fn: function (){
  12318. var self=this;
  12319. return self;
  12320. },
  12321. args: [],
  12322. source: "numericallyIndexable\x0a\x09^ self",
  12323. messageSends: [],
  12324. referencedClasses: []
  12325. }),
  12326. globals.Array);
  12327. smalltalk.addMethod(
  12328. smalltalk.method({
  12329. selector: "printOn:",
  12330. protocol: 'printing',
  12331. fn: function (aStream){
  12332. var self=this;
  12333. return smalltalk.withContext(function($ctx1) {
  12334. globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  12335. $ctx1.sendIdx["printOn:"]=1;
  12336. _st(aStream)._nextPutAll_(" (");
  12337. $ctx1.sendIdx["nextPutAll:"]=1;
  12338. self._do_separatedBy_((function(each){
  12339. return smalltalk.withContext(function($ctx2) {
  12340. return _st(each)._printOn_(aStream);
  12341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  12342. return smalltalk.withContext(function($ctx2) {
  12343. return _st(aStream)._nextPutAll_(" ");
  12344. $ctx2.sendIdx["nextPutAll:"]=2;
  12345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  12346. _st(aStream)._nextPutAll_(")");
  12347. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)})},
  12348. args: ["aStream"],
  12349. 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: ')'",
  12350. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  12351. referencedClasses: []
  12352. }),
  12353. globals.Array);
  12354. smalltalk.addMethod(
  12355. smalltalk.method({
  12356. selector: "remove:ifAbsent:",
  12357. protocol: 'adding/removing',
  12358. fn: function (anObject,aBlock){
  12359. var self=this;
  12360. var index;
  12361. return smalltalk.withContext(function($ctx1) {
  12362. var $2,$1;
  12363. index=self._indexOf_ifAbsent_(anObject,(function(){
  12364. return (0);
  12365. }));
  12366. $2=_st(index).__eq((0));
  12367. if(smalltalk.assert($2)){
  12368. $1=_st(aBlock)._value();
  12369. } else {
  12370. self._removeIndex_(index);
  12371. $1=anObject;
  12372. };
  12373. return $1;
  12374. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)})},
  12375. args: ["anObject", "aBlock"],
  12376. 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 ]",
  12377. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"],
  12378. referencedClasses: []
  12379. }),
  12380. globals.Array);
  12381. smalltalk.addMethod(
  12382. smalltalk.method({
  12383. selector: "removeAll",
  12384. protocol: 'adding/removing',
  12385. fn: function (){
  12386. var self=this;
  12387. return smalltalk.withContext(function($ctx1) {
  12388. self.length = 0;
  12389. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)})},
  12390. args: [],
  12391. source: "removeAll\x0a\x09<self.length = 0>",
  12392. messageSends: [],
  12393. referencedClasses: []
  12394. }),
  12395. globals.Array);
  12396. smalltalk.addMethod(
  12397. smalltalk.method({
  12398. selector: "removeFrom:to:",
  12399. protocol: 'adding/removing',
  12400. fn: function (aNumber,anotherNumber){
  12401. var self=this;
  12402. return smalltalk.withContext(function($ctx1) {
  12403. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  12404. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)})},
  12405. args: ["aNumber", "anotherNumber"],
  12406. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  12407. messageSends: [],
  12408. referencedClasses: []
  12409. }),
  12410. globals.Array);
  12411. smalltalk.addMethod(
  12412. smalltalk.method({
  12413. selector: "removeIndex:",
  12414. protocol: 'adding/removing',
  12415. fn: function (anInteger){
  12416. var self=this;
  12417. return smalltalk.withContext(function($ctx1) {
  12418. self.splice(anInteger - 1, 1);
  12419. return self}, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)})},
  12420. args: ["anInteger"],
  12421. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  12422. messageSends: [],
  12423. referencedClasses: []
  12424. }),
  12425. globals.Array);
  12426. smalltalk.addMethod(
  12427. smalltalk.method({
  12428. selector: "removeLast",
  12429. protocol: 'adding/removing',
  12430. fn: function (){
  12431. var self=this;
  12432. return smalltalk.withContext(function($ctx1) {
  12433. return self.pop();;
  12434. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)})},
  12435. args: [],
  12436. source: "removeLast\x0a\x09<return self.pop();>",
  12437. messageSends: [],
  12438. referencedClasses: []
  12439. }),
  12440. globals.Array);
  12441. smalltalk.addMethod(
  12442. smalltalk.method({
  12443. selector: "reversed",
  12444. protocol: 'converting',
  12445. fn: function (){
  12446. var self=this;
  12447. return smalltalk.withContext(function($ctx1) {
  12448. return self._copy().reverse();
  12449. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)})},
  12450. args: [],
  12451. source: "reversed\x0a\x09<return self._copy().reverse()>",
  12452. messageSends: [],
  12453. referencedClasses: []
  12454. }),
  12455. globals.Array);
  12456. smalltalk.addMethod(
  12457. smalltalk.method({
  12458. selector: "select:",
  12459. protocol: 'enumerating',
  12460. fn: function (aBlock){
  12461. var self=this;
  12462. return smalltalk.withContext(function($ctx1) {
  12463. var result = self.klass._new();
  12464. for(var i=0; i<self.length; i++) {
  12465. if(aBlock._value_(self[i])) {
  12466. result.push(self[i]);
  12467. }
  12468. }
  12469. return result;
  12470. ;
  12471. return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)})},
  12472. args: ["aBlock"],
  12473. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  12474. messageSends: [],
  12475. referencedClasses: []
  12476. }),
  12477. globals.Array);
  12478. smalltalk.addMethod(
  12479. smalltalk.method({
  12480. selector: "size",
  12481. protocol: 'accessing',
  12482. fn: function (){
  12483. var self=this;
  12484. return smalltalk.withContext(function($ctx1) {
  12485. return self.length;
  12486. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)})},
  12487. args: [],
  12488. source: "size\x0a\x09<return self.length>",
  12489. messageSends: [],
  12490. referencedClasses: []
  12491. }),
  12492. globals.Array);
  12493. smalltalk.addMethod(
  12494. smalltalk.method({
  12495. selector: "sort",
  12496. protocol: 'enumerating',
  12497. fn: function (){
  12498. var self=this;
  12499. return smalltalk.withContext(function($ctx1) {
  12500. var $1;
  12501. $1=self._sort_((function(a,b){
  12502. return smalltalk.withContext(function($ctx2) {
  12503. return _st(a).__lt(b);
  12504. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  12505. return $1;
  12506. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)})},
  12507. args: [],
  12508. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  12509. messageSends: ["sort:", "<"],
  12510. referencedClasses: []
  12511. }),
  12512. globals.Array);
  12513. smalltalk.addMethod(
  12514. smalltalk.method({
  12515. selector: "sort:",
  12516. protocol: 'enumerating',
  12517. fn: function (aBlock){
  12518. var self=this;
  12519. return smalltalk.withContext(function($ctx1) {
  12520. return self.sort(function(a, b) {
  12521. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  12522. })
  12523. ;
  12524. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)})},
  12525. args: ["aBlock"],
  12526. 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>",
  12527. messageSends: [],
  12528. referencedClasses: []
  12529. }),
  12530. globals.Array);
  12531. smalltalk.addMethod(
  12532. smalltalk.method({
  12533. selector: "sorted",
  12534. protocol: 'enumerating',
  12535. fn: function (){
  12536. var self=this;
  12537. return smalltalk.withContext(function($ctx1) {
  12538. var $1;
  12539. $1=_st(self._copy())._sort();
  12540. return $1;
  12541. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)})},
  12542. args: [],
  12543. source: "sorted\x0a\x09^ self copy sort",
  12544. messageSends: ["sort", "copy"],
  12545. referencedClasses: []
  12546. }),
  12547. globals.Array);
  12548. smalltalk.addMethod(
  12549. smalltalk.method({
  12550. selector: "sorted:",
  12551. protocol: 'enumerating',
  12552. fn: function (aBlock){
  12553. var self=this;
  12554. return smalltalk.withContext(function($ctx1) {
  12555. var $1;
  12556. $1=_st(self._copy())._sort_(aBlock);
  12557. return $1;
  12558. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)})},
  12559. args: ["aBlock"],
  12560. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  12561. messageSends: ["sort:", "copy"],
  12562. referencedClasses: []
  12563. }),
  12564. globals.Array);
  12565. smalltalk.addMethod(
  12566. smalltalk.method({
  12567. selector: "new:",
  12568. protocol: 'instance creation',
  12569. fn: function (anInteger){
  12570. var self=this;
  12571. return smalltalk.withContext(function($ctx1) {
  12572. return new Array(anInteger);
  12573. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)})},
  12574. args: ["anInteger"],
  12575. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  12576. messageSends: [],
  12577. referencedClasses: []
  12578. }),
  12579. globals.Array.klass);
  12580. smalltalk.addMethod(
  12581. smalltalk.method({
  12582. selector: "with:",
  12583. protocol: 'instance creation',
  12584. fn: function (anObject){
  12585. var self=this;
  12586. return smalltalk.withContext(function($ctx1) {
  12587. var $2,$3,$1;
  12588. $2=self._new_((1));
  12589. _st($2)._at_put_((1),anObject);
  12590. $3=_st($2)._yourself();
  12591. $1=$3;
  12592. return $1;
  12593. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)})},
  12594. args: ["anObject"],
  12595. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  12596. messageSends: ["at:put:", "new:", "yourself"],
  12597. referencedClasses: []
  12598. }),
  12599. globals.Array.klass);
  12600. smalltalk.addMethod(
  12601. smalltalk.method({
  12602. selector: "with:with:",
  12603. protocol: 'instance creation',
  12604. fn: function (anObject,anObject2){
  12605. var self=this;
  12606. return smalltalk.withContext(function($ctx1) {
  12607. var $2,$3,$1;
  12608. $2=self._new_((2));
  12609. _st($2)._at_put_((1),anObject);
  12610. $ctx1.sendIdx["at:put:"]=1;
  12611. _st($2)._at_put_((2),anObject2);
  12612. $3=_st($2)._yourself();
  12613. $1=$3;
  12614. return $1;
  12615. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)})},
  12616. args: ["anObject", "anObject2"],
  12617. 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",
  12618. messageSends: ["at:put:", "new:", "yourself"],
  12619. referencedClasses: []
  12620. }),
  12621. globals.Array.klass);
  12622. smalltalk.addMethod(
  12623. smalltalk.method({
  12624. selector: "with:with:with:",
  12625. protocol: 'instance creation',
  12626. fn: function (anObject,anObject2,anObject3){
  12627. var self=this;
  12628. return smalltalk.withContext(function($ctx1) {
  12629. var $2,$3,$1;
  12630. $2=self._new_((3));
  12631. _st($2)._at_put_((1),anObject);
  12632. $ctx1.sendIdx["at:put:"]=1;
  12633. _st($2)._at_put_((2),anObject2);
  12634. $ctx1.sendIdx["at:put:"]=2;
  12635. _st($2)._at_put_((3),anObject3);
  12636. $3=_st($2)._yourself();
  12637. $1=$3;
  12638. return $1;
  12639. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)})},
  12640. args: ["anObject", "anObject2", "anObject3"],
  12641. 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",
  12642. messageSends: ["at:put:", "new:", "yourself"],
  12643. referencedClasses: []
  12644. }),
  12645. globals.Array.klass);
  12646. smalltalk.addMethod(
  12647. smalltalk.method({
  12648. selector: "withAll:",
  12649. protocol: 'instance creation',
  12650. fn: function (aCollection){
  12651. var self=this;
  12652. var instance,index;
  12653. return smalltalk.withContext(function($ctx1) {
  12654. var $1;
  12655. index=(1);
  12656. instance=self._new_(_st(aCollection)._size());
  12657. _st(aCollection)._do_((function(each){
  12658. return smalltalk.withContext(function($ctx2) {
  12659. _st(instance)._at_put_(index,each);
  12660. index=_st(index).__plus((1));
  12661. return index;
  12662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  12663. $1=instance;
  12664. return $1;
  12665. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)})},
  12666. args: ["aCollection"],
  12667. 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",
  12668. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  12669. referencedClasses: []
  12670. }),
  12671. globals.Array.klass);
  12672. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  12673. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  12674. smalltalk.addMethod(
  12675. smalltalk.method({
  12676. selector: ",",
  12677. protocol: 'copying',
  12678. fn: function (aString){
  12679. var self=this;
  12680. return smalltalk.withContext(function($ctx1) {
  12681. var $2,$1;
  12682. $2=self._asString();
  12683. $ctx1.sendIdx["asString"]=1;
  12684. $1=_st($2).__comma(_st(aString)._asString());
  12685. return $1;
  12686. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)})},
  12687. args: ["aString"],
  12688. source: ", aString\x0a\x09^ self asString, aString asString",
  12689. messageSends: [",", "asString"],
  12690. referencedClasses: []
  12691. }),
  12692. globals.CharacterArray);
  12693. smalltalk.addMethod(
  12694. smalltalk.method({
  12695. selector: "add:",
  12696. protocol: 'adding/removing',
  12697. fn: function (anObject){
  12698. var self=this;
  12699. return smalltalk.withContext(function($ctx1) {
  12700. self._errorReadOnly();
  12701. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)})},
  12702. args: ["anObject"],
  12703. source: "add: anObject\x0a\x09self errorReadOnly",
  12704. messageSends: ["errorReadOnly"],
  12705. referencedClasses: []
  12706. }),
  12707. globals.CharacterArray);
  12708. smalltalk.addMethod(
  12709. smalltalk.method({
  12710. selector: "asLowercase",
  12711. protocol: 'converting',
  12712. fn: function (){
  12713. var self=this;
  12714. return smalltalk.withContext(function($ctx1) {
  12715. var $1;
  12716. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  12717. return $1;
  12718. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)})},
  12719. args: [],
  12720. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  12721. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  12722. referencedClasses: []
  12723. }),
  12724. globals.CharacterArray);
  12725. smalltalk.addMethod(
  12726. smalltalk.method({
  12727. selector: "asNumber",
  12728. protocol: 'converting',
  12729. fn: function (){
  12730. var self=this;
  12731. return smalltalk.withContext(function($ctx1) {
  12732. var $1;
  12733. $1=_st(self._asString())._asNumber();
  12734. return $1;
  12735. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)})},
  12736. args: [],
  12737. source: "asNumber\x0a\x09^ self asString asNumber",
  12738. messageSends: ["asNumber", "asString"],
  12739. referencedClasses: []
  12740. }),
  12741. globals.CharacterArray);
  12742. smalltalk.addMethod(
  12743. smalltalk.method({
  12744. selector: "asString",
  12745. protocol: 'converting',
  12746. fn: function (){
  12747. var self=this;
  12748. return smalltalk.withContext(function($ctx1) {
  12749. var $1;
  12750. $1=self._subclassResponsibility();
  12751. return $1;
  12752. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)})},
  12753. args: [],
  12754. source: "asString\x0a\x09^ self subclassResponsibility",
  12755. messageSends: ["subclassResponsibility"],
  12756. referencedClasses: []
  12757. }),
  12758. globals.CharacterArray);
  12759. smalltalk.addMethod(
  12760. smalltalk.method({
  12761. selector: "asSymbol",
  12762. protocol: 'converting',
  12763. fn: function (){
  12764. var self=this;
  12765. return smalltalk.withContext(function($ctx1) {
  12766. var $1;
  12767. $1=self._asString();
  12768. return $1;
  12769. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)})},
  12770. args: [],
  12771. source: "asSymbol\x0a\x09^ self asString",
  12772. messageSends: ["asString"],
  12773. referencedClasses: []
  12774. }),
  12775. globals.CharacterArray);
  12776. smalltalk.addMethod(
  12777. smalltalk.method({
  12778. selector: "asUppercase",
  12779. protocol: 'converting',
  12780. fn: function (){
  12781. var self=this;
  12782. return smalltalk.withContext(function($ctx1) {
  12783. var $1;
  12784. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  12785. return $1;
  12786. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)})},
  12787. args: [],
  12788. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  12789. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  12790. referencedClasses: []
  12791. }),
  12792. globals.CharacterArray);
  12793. smalltalk.addMethod(
  12794. smalltalk.method({
  12795. selector: "at:put:",
  12796. protocol: 'accessing',
  12797. fn: function (anIndex,anObject){
  12798. var self=this;
  12799. return smalltalk.withContext(function($ctx1) {
  12800. self._errorReadOnly();
  12801. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)})},
  12802. args: ["anIndex", "anObject"],
  12803. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  12804. messageSends: ["errorReadOnly"],
  12805. referencedClasses: []
  12806. }),
  12807. globals.CharacterArray);
  12808. smalltalk.addMethod(
  12809. smalltalk.method({
  12810. selector: "errorReadOnly",
  12811. protocol: 'error handling',
  12812. fn: function (){
  12813. var self=this;
  12814. return smalltalk.withContext(function($ctx1) {
  12815. self._error_("Object is read-only");
  12816. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)})},
  12817. args: [],
  12818. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  12819. messageSends: ["error:"],
  12820. referencedClasses: []
  12821. }),
  12822. globals.CharacterArray);
  12823. smalltalk.addMethod(
  12824. smalltalk.method({
  12825. selector: "printOn:",
  12826. protocol: 'printing',
  12827. fn: function (aStream){
  12828. var self=this;
  12829. return smalltalk.withContext(function($ctx1) {
  12830. _st(self._asString())._printOn_(aStream);
  12831. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)})},
  12832. args: ["aStream"],
  12833. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  12834. messageSends: ["printOn:", "asString"],
  12835. referencedClasses: []
  12836. }),
  12837. globals.CharacterArray);
  12838. smalltalk.addMethod(
  12839. smalltalk.method({
  12840. selector: "putOn:",
  12841. protocol: 'streaming',
  12842. fn: function (aStream){
  12843. var self=this;
  12844. return smalltalk.withContext(function($ctx1) {
  12845. _st(aStream)._nextPutString_(self);
  12846. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)})},
  12847. args: ["aStream"],
  12848. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  12849. messageSends: ["nextPutString:"],
  12850. referencedClasses: []
  12851. }),
  12852. globals.CharacterArray);
  12853. smalltalk.addMethod(
  12854. smalltalk.method({
  12855. selector: "remove:",
  12856. protocol: 'adding/removing',
  12857. fn: function (anObject){
  12858. var self=this;
  12859. return smalltalk.withContext(function($ctx1) {
  12860. self._errorReadOnly();
  12861. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)})},
  12862. args: ["anObject"],
  12863. source: "remove: anObject\x0a\x09self errorReadOnly",
  12864. messageSends: ["errorReadOnly"],
  12865. referencedClasses: []
  12866. }),
  12867. globals.CharacterArray);
  12868. smalltalk.addMethod(
  12869. smalltalk.method({
  12870. selector: "fromString:",
  12871. protocol: 'instance creation',
  12872. fn: function (aString){
  12873. var self=this;
  12874. return smalltalk.withContext(function($ctx1) {
  12875. self._subclassResponsibility();
  12876. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)})},
  12877. args: ["aString"],
  12878. source: "fromString: aString\x0a\x09self subclassResponsibility",
  12879. messageSends: ["subclassResponsibility"],
  12880. referencedClasses: []
  12881. }),
  12882. globals.CharacterArray.klass);
  12883. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  12884. 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 >> #,`";
  12885. smalltalk.addMethod(
  12886. smalltalk.method({
  12887. selector: ",",
  12888. protocol: 'copying',
  12889. fn: function (aString){
  12890. var self=this;
  12891. return smalltalk.withContext(function($ctx1) {
  12892. return String(self) + aString;
  12893. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)})},
  12894. args: ["aString"],
  12895. source: ", aString\x0a\x09<return String(self) + aString>",
  12896. messageSends: [],
  12897. referencedClasses: []
  12898. }),
  12899. globals.String);
  12900. smalltalk.addMethod(
  12901. smalltalk.method({
  12902. selector: "<",
  12903. protocol: 'comparing',
  12904. fn: function (aString){
  12905. var self=this;
  12906. return smalltalk.withContext(function($ctx1) {
  12907. return String(self) < aString._asString();
  12908. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)})},
  12909. args: ["aString"],
  12910. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  12911. messageSends: [],
  12912. referencedClasses: []
  12913. }),
  12914. globals.String);
  12915. smalltalk.addMethod(
  12916. smalltalk.method({
  12917. selector: "<=",
  12918. protocol: 'comparing',
  12919. fn: function (aString){
  12920. var self=this;
  12921. return smalltalk.withContext(function($ctx1) {
  12922. return String(self) <= aString._asString();
  12923. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)})},
  12924. args: ["aString"],
  12925. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  12926. messageSends: [],
  12927. referencedClasses: []
  12928. }),
  12929. globals.String);
  12930. smalltalk.addMethod(
  12931. smalltalk.method({
  12932. selector: "=",
  12933. protocol: 'comparing',
  12934. fn: function (aString){
  12935. var self=this;
  12936. return smalltalk.withContext(function($ctx1) {
  12937. return aString != null &&
  12938. typeof aString._isString === "function" &&
  12939. aString._isString() &&
  12940. String(self) === String(aString)
  12941. ;
  12942. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)})},
  12943. args: ["aString"],
  12944. source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
  12945. messageSends: [],
  12946. referencedClasses: []
  12947. }),
  12948. globals.String);
  12949. smalltalk.addMethod(
  12950. smalltalk.method({
  12951. selector: "==",
  12952. protocol: 'comparing',
  12953. fn: function (aString){
  12954. var self=this;
  12955. return smalltalk.withContext(function($ctx1) {
  12956. var $1;
  12957. $1=self.__eq(aString);
  12958. return $1;
  12959. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)})},
  12960. args: ["aString"],
  12961. source: "== aString\x0a\x09^ self = aString",
  12962. messageSends: ["="],
  12963. referencedClasses: []
  12964. }),
  12965. globals.String);
  12966. smalltalk.addMethod(
  12967. smalltalk.method({
  12968. selector: ">",
  12969. protocol: 'comparing',
  12970. fn: function (aString){
  12971. var self=this;
  12972. return smalltalk.withContext(function($ctx1) {
  12973. return String(self) > aString._asString();
  12974. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)})},
  12975. args: ["aString"],
  12976. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  12977. messageSends: [],
  12978. referencedClasses: []
  12979. }),
  12980. globals.String);
  12981. smalltalk.addMethod(
  12982. smalltalk.method({
  12983. selector: ">=",
  12984. protocol: 'comparing',
  12985. fn: function (aString){
  12986. var self=this;
  12987. return smalltalk.withContext(function($ctx1) {
  12988. return String(self) >= aString._asString();
  12989. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)})},
  12990. args: ["aString"],
  12991. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  12992. messageSends: [],
  12993. referencedClasses: []
  12994. }),
  12995. globals.String);
  12996. smalltalk.addMethod(
  12997. smalltalk.method({
  12998. selector: "asJSON",
  12999. protocol: 'converting',
  13000. fn: function (){
  13001. var self=this;
  13002. return self;
  13003. },
  13004. args: [],
  13005. source: "asJSON\x0a\x09^ self",
  13006. messageSends: [],
  13007. referencedClasses: []
  13008. }),
  13009. globals.String);
  13010. smalltalk.addMethod(
  13011. smalltalk.method({
  13012. selector: "asJavascript",
  13013. protocol: 'converting',
  13014. fn: function (){
  13015. var self=this;
  13016. return smalltalk.withContext(function($ctx1) {
  13017. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  13018. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  13019. else
  13020. return "\"" + self + "\"";
  13021. ;
  13022. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)})},
  13023. args: [],
  13024. 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>",
  13025. messageSends: [],
  13026. referencedClasses: []
  13027. }),
  13028. globals.String);
  13029. smalltalk.addMethod(
  13030. smalltalk.method({
  13031. selector: "asLowercase",
  13032. protocol: 'converting',
  13033. fn: function (){
  13034. var self=this;
  13035. return smalltalk.withContext(function($ctx1) {
  13036. return self.toLowerCase();
  13037. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)})},
  13038. args: [],
  13039. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  13040. messageSends: [],
  13041. referencedClasses: []
  13042. }),
  13043. globals.String);
  13044. smalltalk.addMethod(
  13045. smalltalk.method({
  13046. selector: "asMutator",
  13047. protocol: 'converting',
  13048. fn: function (){
  13049. var self=this;
  13050. return smalltalk.withContext(function($ctx1) {
  13051. var $1,$2;
  13052. $1=_st(self._last()).__eq(":");
  13053. if(! smalltalk.assert($1)){
  13054. $2=self.__comma(":");
  13055. return $2;
  13056. };
  13057. return self;
  13058. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)})},
  13059. args: [],
  13060. 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",
  13061. messageSends: ["ifFalse:", "=", "last", ","],
  13062. referencedClasses: []
  13063. }),
  13064. globals.String);
  13065. smalltalk.addMethod(
  13066. smalltalk.method({
  13067. selector: "asNumber",
  13068. protocol: 'converting',
  13069. fn: function (){
  13070. var self=this;
  13071. return smalltalk.withContext(function($ctx1) {
  13072. return Number(self);
  13073. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)})},
  13074. args: [],
  13075. source: "asNumber\x0a\x09<return Number(self)>",
  13076. messageSends: [],
  13077. referencedClasses: []
  13078. }),
  13079. globals.String);
  13080. smalltalk.addMethod(
  13081. smalltalk.method({
  13082. selector: "asRegexp",
  13083. protocol: 'converting',
  13084. fn: function (){
  13085. var self=this;
  13086. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13087. return smalltalk.withContext(function($ctx1) {
  13088. var $1;
  13089. $1=_st($RegularExpression())._fromString_(self);
  13090. return $1;
  13091. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)})},
  13092. args: [],
  13093. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  13094. messageSends: ["fromString:"],
  13095. referencedClasses: ["RegularExpression"]
  13096. }),
  13097. globals.String);
  13098. smalltalk.addMethod(
  13099. smalltalk.method({
  13100. selector: "asSelector",
  13101. protocol: 'converting',
  13102. fn: function (){
  13103. var self=this;
  13104. return smalltalk.withContext(function($ctx1) {
  13105. return smalltalk.selector(self);
  13106. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)})},
  13107. args: [],
  13108. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  13109. messageSends: [],
  13110. referencedClasses: []
  13111. }),
  13112. globals.String);
  13113. smalltalk.addMethod(
  13114. smalltalk.method({
  13115. selector: "asString",
  13116. protocol: 'converting',
  13117. fn: function (){
  13118. var self=this;
  13119. return self;
  13120. },
  13121. args: [],
  13122. source: "asString\x0a\x09^ self",
  13123. messageSends: [],
  13124. referencedClasses: []
  13125. }),
  13126. globals.String);
  13127. smalltalk.addMethod(
  13128. smalltalk.method({
  13129. selector: "asSymbol",
  13130. protocol: 'converting',
  13131. fn: function (){
  13132. var self=this;
  13133. return self;
  13134. },
  13135. args: [],
  13136. source: "asSymbol\x0a\x09^ self",
  13137. messageSends: [],
  13138. referencedClasses: []
  13139. }),
  13140. globals.String);
  13141. smalltalk.addMethod(
  13142. smalltalk.method({
  13143. selector: "asUppercase",
  13144. protocol: 'converting',
  13145. fn: function (){
  13146. var self=this;
  13147. return smalltalk.withContext(function($ctx1) {
  13148. return self.toUpperCase();
  13149. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)})},
  13150. args: [],
  13151. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  13152. messageSends: [],
  13153. referencedClasses: []
  13154. }),
  13155. globals.String);
  13156. smalltalk.addMethod(
  13157. smalltalk.method({
  13158. selector: "asciiValue",
  13159. protocol: 'accessing',
  13160. fn: function (){
  13161. var self=this;
  13162. return smalltalk.withContext(function($ctx1) {
  13163. return self.charCodeAt(0);;
  13164. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)})},
  13165. args: [],
  13166. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  13167. messageSends: [],
  13168. referencedClasses: []
  13169. }),
  13170. globals.String);
  13171. smalltalk.addMethod(
  13172. smalltalk.method({
  13173. selector: "at:ifAbsent:",
  13174. protocol: 'accessing',
  13175. fn: function (anIndex,aBlock){
  13176. var self=this;
  13177. return smalltalk.withContext(function($ctx1) {
  13178. return String(self)[anIndex - 1] || aBlock._value();
  13179. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)})},
  13180. args: ["anIndex", "aBlock"],
  13181. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  13182. messageSends: [],
  13183. referencedClasses: []
  13184. }),
  13185. globals.String);
  13186. smalltalk.addMethod(
  13187. smalltalk.method({
  13188. selector: "at:ifPresent:ifAbsent:",
  13189. protocol: 'accessing',
  13190. fn: function (anIndex,aBlock,anotherBlock){
  13191. var self=this;
  13192. return smalltalk.withContext(function($ctx1) {
  13193. var result = String(self)[anIndex - 1];
  13194. return result ? aBlock._value_(result) : anotherBlock._value();
  13195. ;
  13196. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)})},
  13197. args: ["anIndex", "aBlock", "anotherBlock"],
  13198. 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>",
  13199. messageSends: [],
  13200. referencedClasses: []
  13201. }),
  13202. globals.String);
  13203. smalltalk.addMethod(
  13204. smalltalk.method({
  13205. selector: "capitalized",
  13206. protocol: 'converting',
  13207. fn: function (){
  13208. var self=this;
  13209. return smalltalk.withContext(function($ctx1) {
  13210. var $2,$1;
  13211. $2=self._isEmpty();
  13212. if(smalltalk.assert($2)){
  13213. $1=self;
  13214. } else {
  13215. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  13216. };
  13217. return $1;
  13218. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)})},
  13219. args: [],
  13220. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  13221. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"],
  13222. referencedClasses: []
  13223. }),
  13224. globals.String);
  13225. smalltalk.addMethod(
  13226. smalltalk.method({
  13227. selector: "charCodeAt:",
  13228. protocol: 'accessing',
  13229. fn: function (anInteger){
  13230. var self=this;
  13231. return smalltalk.withContext(function($ctx1) {
  13232. return self.charCodeAt(anInteger - 1);
  13233. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)})},
  13234. args: ["anInteger"],
  13235. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  13236. messageSends: [],
  13237. referencedClasses: []
  13238. }),
  13239. globals.String);
  13240. smalltalk.addMethod(
  13241. smalltalk.method({
  13242. selector: "copyFrom:to:",
  13243. protocol: 'copying',
  13244. fn: function (anIndex,anotherIndex){
  13245. var self=this;
  13246. return smalltalk.withContext(function($ctx1) {
  13247. return self.substring(anIndex - 1, anotherIndex);
  13248. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)})},
  13249. args: ["anIndex", "anotherIndex"],
  13250. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  13251. messageSends: [],
  13252. referencedClasses: []
  13253. }),
  13254. globals.String);
  13255. smalltalk.addMethod(
  13256. smalltalk.method({
  13257. selector: "crlfSanitized",
  13258. protocol: 'converting',
  13259. fn: function (){
  13260. var self=this;
  13261. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13262. return smalltalk.withContext(function($ctx1) {
  13263. var $1;
  13264. $1=_st(self._lines())._join_(_st($String())._lf());
  13265. return $1;
  13266. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)})},
  13267. args: [],
  13268. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  13269. messageSends: ["join:", "lines", "lf"],
  13270. referencedClasses: ["String"]
  13271. }),
  13272. globals.String);
  13273. smalltalk.addMethod(
  13274. smalltalk.method({
  13275. selector: "deepCopy",
  13276. protocol: 'copying',
  13277. fn: function (){
  13278. var self=this;
  13279. return smalltalk.withContext(function($ctx1) {
  13280. var $1;
  13281. $1=self._shallowCopy();
  13282. return $1;
  13283. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)})},
  13284. args: [],
  13285. source: "deepCopy\x0a\x09^ self shallowCopy",
  13286. messageSends: ["shallowCopy"],
  13287. referencedClasses: []
  13288. }),
  13289. globals.String);
  13290. smalltalk.addMethod(
  13291. smalltalk.method({
  13292. selector: "escaped",
  13293. protocol: 'converting',
  13294. fn: function (){
  13295. var self=this;
  13296. return smalltalk.withContext(function($ctx1) {
  13297. return escape(self);
  13298. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)})},
  13299. args: [],
  13300. source: "escaped\x0a\x09<return escape(self)>",
  13301. messageSends: [],
  13302. referencedClasses: []
  13303. }),
  13304. globals.String);
  13305. smalltalk.addMethod(
  13306. smalltalk.method({
  13307. selector: "identityHash",
  13308. protocol: 'accessing',
  13309. fn: function (){
  13310. var self=this;
  13311. return smalltalk.withContext(function($ctx1) {
  13312. var $1;
  13313. $1=self.__comma("s");
  13314. return $1;
  13315. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)})},
  13316. args: [],
  13317. source: "identityHash\x0a\x09^ self, 's'",
  13318. messageSends: [","],
  13319. referencedClasses: []
  13320. }),
  13321. globals.String);
  13322. smalltalk.addMethod(
  13323. smalltalk.method({
  13324. selector: "includesSubString:",
  13325. protocol: 'testing',
  13326. fn: function (subString){
  13327. var self=this;
  13328. return smalltalk.withContext(function($ctx1) {
  13329. return self.indexOf(subString) != -1;
  13330. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)})},
  13331. args: ["subString"],
  13332. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  13333. messageSends: [],
  13334. referencedClasses: []
  13335. }),
  13336. globals.String);
  13337. smalltalk.addMethod(
  13338. smalltalk.method({
  13339. selector: "isCapitalized",
  13340. protocol: 'testing',
  13341. fn: function (){
  13342. var self=this;
  13343. return smalltalk.withContext(function($ctx1) {
  13344. var $3,$2,$1;
  13345. $3=self._first();
  13346. $ctx1.sendIdx["first"]=1;
  13347. $2=_st($3)._asUppercase();
  13348. $1=_st($2).__eq_eq(self._first());
  13349. return $1;
  13350. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)})},
  13351. args: [],
  13352. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  13353. messageSends: ["==", "asUppercase", "first"],
  13354. referencedClasses: []
  13355. }),
  13356. globals.String);
  13357. smalltalk.addMethod(
  13358. smalltalk.method({
  13359. selector: "isImmutable",
  13360. protocol: 'testing',
  13361. fn: function (){
  13362. var self=this;
  13363. return true;
  13364. },
  13365. args: [],
  13366. source: "isImmutable\x0a\x09^ true",
  13367. messageSends: [],
  13368. referencedClasses: []
  13369. }),
  13370. globals.String);
  13371. smalltalk.addMethod(
  13372. smalltalk.method({
  13373. selector: "isString",
  13374. protocol: 'testing',
  13375. fn: function (){
  13376. var self=this;
  13377. return true;
  13378. },
  13379. args: [],
  13380. source: "isString\x0a\x09^ true",
  13381. messageSends: [],
  13382. referencedClasses: []
  13383. }),
  13384. globals.String);
  13385. smalltalk.addMethod(
  13386. smalltalk.method({
  13387. selector: "isVowel",
  13388. protocol: 'testing',
  13389. fn: function (){
  13390. var self=this;
  13391. return smalltalk.withContext(function($ctx1) {
  13392. var $1;
  13393. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  13394. return smalltalk.withContext(function($ctx2) {
  13395. return "aeiou"._includes_(self._asLowercase());
  13396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13397. return $1;
  13398. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)})},
  13399. args: [],
  13400. 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 ]",
  13401. messageSends: ["and:", "=", "size", "includes:", "asLowercase"],
  13402. referencedClasses: []
  13403. }),
  13404. globals.String);
  13405. smalltalk.addMethod(
  13406. smalltalk.method({
  13407. selector: "join:",
  13408. protocol: 'split join',
  13409. fn: function (aCollection){
  13410. var self=this;
  13411. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13412. return smalltalk.withContext(function($ctx1) {
  13413. var $1;
  13414. $1=_st($String())._streamContents_((function(stream){
  13415. return smalltalk.withContext(function($ctx2) {
  13416. return _st(aCollection)._do_separatedBy_((function(each){
  13417. return smalltalk.withContext(function($ctx3) {
  13418. return _st(stream)._nextPutAll_(_st(each)._asString());
  13419. $ctx3.sendIdx["nextPutAll:"]=1;
  13420. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  13421. return smalltalk.withContext(function($ctx3) {
  13422. return _st(stream)._nextPutAll_(self);
  13423. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  13424. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  13425. return $1;
  13426. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)})},
  13427. args: ["aCollection"],
  13428. 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 ]]",
  13429. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  13430. referencedClasses: ["String"]
  13431. }),
  13432. globals.String);
  13433. smalltalk.addMethod(
  13434. smalltalk.method({
  13435. selector: "lineIndicesDo:",
  13436. protocol: 'split join',
  13437. fn: function (aBlock){
  13438. var self=this;
  13439. var cr,lf,start,sz,nextLF,nextCR;
  13440. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13441. return smalltalk.withContext(function($ctx1) {
  13442. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  13443. var $early={};
  13444. try {
  13445. start=(1);
  13446. sz=self._size();
  13447. cr=_st($String())._cr();
  13448. nextCR=self._indexOf_startingAt_(cr,(1));
  13449. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  13450. lf=_st($String())._lf();
  13451. nextLF=self._indexOf_startingAt_(lf,(1));
  13452. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  13453. _st((function(){
  13454. return smalltalk.withContext(function($ctx2) {
  13455. return _st(start).__lt_eq(sz);
  13456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  13457. return smalltalk.withContext(function($ctx2) {
  13458. $2=_st(nextLF).__eq((0));
  13459. $ctx2.sendIdx["="]=1;
  13460. $1=_st($2)._and_((function(){
  13461. return smalltalk.withContext(function($ctx3) {
  13462. return _st(nextCR).__eq((0));
  13463. $ctx3.sendIdx["="]=2;
  13464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  13465. $ctx2.sendIdx["and:"]=1;
  13466. if(smalltalk.assert($1)){
  13467. _st(aBlock)._value_value_value_(start,sz,sz);
  13468. $ctx2.sendIdx["value:value:value:"]=1;
  13469. throw $early=[self];
  13470. };
  13471. $4=_st(nextCR).__eq((0));
  13472. $ctx2.sendIdx["="]=3;
  13473. $3=_st($4)._or_((function(){
  13474. return smalltalk.withContext(function($ctx3) {
  13475. $5=(0).__lt(nextLF);
  13476. $ctx3.sendIdx["<"]=1;
  13477. return _st($5)._and_((function(){
  13478. return smalltalk.withContext(function($ctx4) {
  13479. return _st(nextLF).__lt(nextCR);
  13480. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  13481. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  13482. if(smalltalk.assert($3)){
  13483. $6=start;
  13484. $7=_st(nextLF).__minus((1));
  13485. $ctx2.sendIdx["-"]=1;
  13486. _st(aBlock)._value_value_value_($6,$7,nextLF);
  13487. $ctx2.sendIdx["value:value:value:"]=2;
  13488. start=(1).__plus(nextLF);
  13489. $ctx2.sendIdx["+"]=1;
  13490. start;
  13491. nextLF=self._indexOf_startingAt_(lf,start);
  13492. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  13493. return nextLF;
  13494. } else {
  13495. $9=(1).__plus(nextCR);
  13496. $ctx2.sendIdx["+"]=2;
  13497. $8=_st($9).__eq(nextLF);
  13498. if(smalltalk.assert($8)){
  13499. $10=start;
  13500. $11=_st(nextCR).__minus((1));
  13501. $ctx2.sendIdx["-"]=2;
  13502. _st(aBlock)._value_value_value_($10,$11,nextLF);
  13503. $ctx2.sendIdx["value:value:value:"]=3;
  13504. start=(1).__plus(nextLF);
  13505. $ctx2.sendIdx["+"]=3;
  13506. start;
  13507. nextCR=self._indexOf_startingAt_(cr,start);
  13508. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  13509. nextCR;
  13510. nextLF=self._indexOf_startingAt_(lf,start);
  13511. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  13512. return nextLF;
  13513. } else {
  13514. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  13515. start=(1).__plus(nextCR);
  13516. start;
  13517. nextCR=self._indexOf_startingAt_(cr,start);
  13518. return nextCR;
  13519. };
  13520. };
  13521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  13522. return self}
  13523. catch(e) {if(e===$early)return e[0]; throw e}
  13524. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)})},
  13525. args: ["aBlock"],
  13526. 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 ] ]]",
  13527. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  13528. referencedClasses: ["String"]
  13529. }),
  13530. globals.String);
  13531. smalltalk.addMethod(
  13532. smalltalk.method({
  13533. selector: "lineNumber:",
  13534. protocol: 'split join',
  13535. fn: function (anIndex){
  13536. var self=this;
  13537. var lineCount;
  13538. return smalltalk.withContext(function($ctx1) {
  13539. var $2,$1,$3;
  13540. var $early={};
  13541. try {
  13542. lineCount=(0);
  13543. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13544. return smalltalk.withContext(function($ctx2) {
  13545. lineCount=_st(lineCount).__plus((1));
  13546. $2=lineCount;
  13547. $1=_st($2).__eq(anIndex);
  13548. if(smalltalk.assert($1)){
  13549. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  13550. throw $early=[$3];
  13551. };
  13552. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  13553. return nil;
  13554. }
  13555. catch(e) {if(e===$early)return e[0]; throw e}
  13556. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)})},
  13557. args: ["anIndex"],
  13558. 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",
  13559. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  13560. referencedClasses: []
  13561. }),
  13562. globals.String);
  13563. smalltalk.addMethod(
  13564. smalltalk.method({
  13565. selector: "lines",
  13566. protocol: 'split join',
  13567. fn: function (){
  13568. var self=this;
  13569. var lines;
  13570. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  13571. return smalltalk.withContext(function($ctx1) {
  13572. var $1;
  13573. lines=_st($Array())._new();
  13574. self._linesDo_((function(aLine){
  13575. return smalltalk.withContext(function($ctx2) {
  13576. return _st(lines)._add_(aLine);
  13577. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)})}));
  13578. $1=lines;
  13579. return $1;
  13580. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)})},
  13581. args: [],
  13582. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  13583. messageSends: ["new", "linesDo:", "add:"],
  13584. referencedClasses: ["Array"]
  13585. }),
  13586. globals.String);
  13587. smalltalk.addMethod(
  13588. smalltalk.method({
  13589. selector: "linesDo:",
  13590. protocol: 'split join',
  13591. fn: function (aBlock){
  13592. var self=this;
  13593. return smalltalk.withContext(function($ctx1) {
  13594. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13595. return smalltalk.withContext(function($ctx2) {
  13596. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  13597. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  13598. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)})},
  13599. args: ["aBlock"],
  13600. 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 lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  13601. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  13602. referencedClasses: []
  13603. }),
  13604. globals.String);
  13605. smalltalk.addMethod(
  13606. smalltalk.method({
  13607. selector: "match:",
  13608. protocol: 'regular expressions',
  13609. fn: function (aRegexp){
  13610. var self=this;
  13611. return smalltalk.withContext(function($ctx1) {
  13612. return self.search(aRegexp) != -1;
  13613. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)})},
  13614. args: ["aRegexp"],
  13615. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  13616. messageSends: [],
  13617. referencedClasses: []
  13618. }),
  13619. globals.String);
  13620. smalltalk.addMethod(
  13621. smalltalk.method({
  13622. selector: "matchesOf:",
  13623. protocol: 'regular expressions',
  13624. fn: function (aRegularExpression){
  13625. var self=this;
  13626. return smalltalk.withContext(function($ctx1) {
  13627. return self.match(aRegularExpression);
  13628. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)})},
  13629. args: ["aRegularExpression"],
  13630. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  13631. messageSends: [],
  13632. referencedClasses: []
  13633. }),
  13634. globals.String);
  13635. smalltalk.addMethod(
  13636. smalltalk.method({
  13637. selector: "numericallyIndexable",
  13638. protocol: 'private',
  13639. fn: function (){
  13640. var self=this;
  13641. return smalltalk.withContext(function($ctx1) {
  13642. return String(self);
  13643. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)})},
  13644. args: [],
  13645. source: "numericallyIndexable\x0a\x09<return String(self)>",
  13646. messageSends: [],
  13647. referencedClasses: []
  13648. }),
  13649. globals.String);
  13650. smalltalk.addMethod(
  13651. smalltalk.method({
  13652. selector: "printNl",
  13653. protocol: 'printing',
  13654. fn: function (){
  13655. var self=this;
  13656. return smalltalk.withContext(function($ctx1) {
  13657. console.log(self);
  13658. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)})},
  13659. args: [],
  13660. source: "printNl\x0a\x09<console.log(self)>",
  13661. messageSends: [],
  13662. referencedClasses: []
  13663. }),
  13664. globals.String);
  13665. smalltalk.addMethod(
  13666. smalltalk.method({
  13667. selector: "printOn:",
  13668. protocol: 'printing',
  13669. fn: function (aStream){
  13670. var self=this;
  13671. return smalltalk.withContext(function($ctx1) {
  13672. var $1;
  13673. _st(aStream)._nextPutAll_("'");
  13674. $ctx1.sendIdx["nextPutAll:"]=1;
  13675. _st(aStream)._nextPutAll_(self);
  13676. $ctx1.sendIdx["nextPutAll:"]=2;
  13677. $1=_st(aStream)._nextPutAll_("'");
  13678. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)})},
  13679. args: ["aStream"],
  13680. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  13681. messageSends: ["nextPutAll:"],
  13682. referencedClasses: []
  13683. }),
  13684. globals.String);
  13685. smalltalk.addMethod(
  13686. smalltalk.method({
  13687. selector: "replace:with:",
  13688. protocol: 'regular expressions',
  13689. fn: function (aString,anotherString){
  13690. var self=this;
  13691. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13692. return smalltalk.withContext(function($ctx1) {
  13693. var $1;
  13694. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  13695. return $1;
  13696. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)})},
  13697. args: ["aString", "anotherString"],
  13698. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  13699. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  13700. referencedClasses: ["RegularExpression"]
  13701. }),
  13702. globals.String);
  13703. smalltalk.addMethod(
  13704. smalltalk.method({
  13705. selector: "replaceRegexp:with:",
  13706. protocol: 'regular expressions',
  13707. fn: function (aRegexp,aString){
  13708. var self=this;
  13709. return smalltalk.withContext(function($ctx1) {
  13710. return self.replace(aRegexp, aString);
  13711. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)})},
  13712. args: ["aRegexp", "aString"],
  13713. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  13714. messageSends: [],
  13715. referencedClasses: []
  13716. }),
  13717. globals.String);
  13718. smalltalk.addMethod(
  13719. smalltalk.method({
  13720. selector: "reversed",
  13721. protocol: 'converting',
  13722. fn: function (){
  13723. var self=this;
  13724. return smalltalk.withContext(function($ctx1) {
  13725. return self.split("").reverse().join("");
  13726. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)})},
  13727. args: [],
  13728. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  13729. messageSends: [],
  13730. referencedClasses: []
  13731. }),
  13732. globals.String);
  13733. smalltalk.addMethod(
  13734. smalltalk.method({
  13735. selector: "shallowCopy",
  13736. protocol: 'copying',
  13737. fn: function (){
  13738. var self=this;
  13739. return smalltalk.withContext(function($ctx1) {
  13740. var $1;
  13741. $1=_st(self._class())._fromString_(self);
  13742. return $1;
  13743. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)})},
  13744. args: [],
  13745. source: "shallowCopy\x0a\x09^ self class fromString: self",
  13746. messageSends: ["fromString:", "class"],
  13747. referencedClasses: []
  13748. }),
  13749. globals.String);
  13750. smalltalk.addMethod(
  13751. smalltalk.method({
  13752. selector: "size",
  13753. protocol: 'accessing',
  13754. fn: function (){
  13755. var self=this;
  13756. return smalltalk.withContext(function($ctx1) {
  13757. return self.length;
  13758. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)})},
  13759. args: [],
  13760. source: "size\x0a\x09<return self.length>",
  13761. messageSends: [],
  13762. referencedClasses: []
  13763. }),
  13764. globals.String);
  13765. smalltalk.addMethod(
  13766. smalltalk.method({
  13767. selector: "subStrings:",
  13768. protocol: 'split join',
  13769. fn: function (aString){
  13770. var self=this;
  13771. return smalltalk.withContext(function($ctx1) {
  13772. var $1;
  13773. $1=self._tokenize_(aString);
  13774. return $1;
  13775. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)})},
  13776. args: ["aString"],
  13777. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  13778. messageSends: ["tokenize:"],
  13779. referencedClasses: []
  13780. }),
  13781. globals.String);
  13782. smalltalk.addMethod(
  13783. smalltalk.method({
  13784. selector: "tokenize:",
  13785. protocol: 'split join',
  13786. fn: function (aString){
  13787. var self=this;
  13788. return smalltalk.withContext(function($ctx1) {
  13789. return self.split(aString);
  13790. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)})},
  13791. args: ["aString"],
  13792. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  13793. messageSends: [],
  13794. referencedClasses: []
  13795. }),
  13796. globals.String);
  13797. smalltalk.addMethod(
  13798. smalltalk.method({
  13799. selector: "trimBoth",
  13800. protocol: 'regular expressions',
  13801. fn: function (){
  13802. var self=this;
  13803. return smalltalk.withContext(function($ctx1) {
  13804. var $1;
  13805. $1=self._trimBoth_("\x5cs");
  13806. return $1;
  13807. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)})},
  13808. args: [],
  13809. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  13810. messageSends: ["trimBoth:"],
  13811. referencedClasses: []
  13812. }),
  13813. globals.String);
  13814. smalltalk.addMethod(
  13815. smalltalk.method({
  13816. selector: "trimBoth:",
  13817. protocol: 'regular expressions',
  13818. fn: function (separators){
  13819. var self=this;
  13820. return smalltalk.withContext(function($ctx1) {
  13821. var $1;
  13822. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  13823. return $1;
  13824. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)})},
  13825. args: ["separators"],
  13826. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  13827. messageSends: ["trimRight:", "trimLeft:"],
  13828. referencedClasses: []
  13829. }),
  13830. globals.String);
  13831. smalltalk.addMethod(
  13832. smalltalk.method({
  13833. selector: "trimLeft",
  13834. protocol: 'regular expressions',
  13835. fn: function (){
  13836. var self=this;
  13837. return smalltalk.withContext(function($ctx1) {
  13838. var $1;
  13839. $1=self._trimLeft_("\x5cs");
  13840. return $1;
  13841. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)})},
  13842. args: [],
  13843. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  13844. messageSends: ["trimLeft:"],
  13845. referencedClasses: []
  13846. }),
  13847. globals.String);
  13848. smalltalk.addMethod(
  13849. smalltalk.method({
  13850. selector: "trimLeft:",
  13851. protocol: 'regular expressions',
  13852. fn: function (separators){
  13853. var self=this;
  13854. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13855. return smalltalk.withContext(function($ctx1) {
  13856. var $3,$2,$1;
  13857. $3=_st("^[".__comma(separators)).__comma("]+");
  13858. $ctx1.sendIdx[","]=1;
  13859. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  13860. $1=self._replaceRegexp_with_($2,"");
  13861. return $1;
  13862. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)})},
  13863. args: ["separators"],
  13864. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  13865. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13866. referencedClasses: ["RegularExpression"]
  13867. }),
  13868. globals.String);
  13869. smalltalk.addMethod(
  13870. smalltalk.method({
  13871. selector: "trimRight",
  13872. protocol: 'regular expressions',
  13873. fn: function (){
  13874. var self=this;
  13875. return smalltalk.withContext(function($ctx1) {
  13876. var $1;
  13877. $1=self._trimRight_("\x5cs");
  13878. return $1;
  13879. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)})},
  13880. args: [],
  13881. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  13882. messageSends: ["trimRight:"],
  13883. referencedClasses: []
  13884. }),
  13885. globals.String);
  13886. smalltalk.addMethod(
  13887. smalltalk.method({
  13888. selector: "trimRight:",
  13889. protocol: 'regular expressions',
  13890. fn: function (separators){
  13891. var self=this;
  13892. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13893. return smalltalk.withContext(function($ctx1) {
  13894. var $3,$2,$1;
  13895. $3=_st("[".__comma(separators)).__comma("]+$");
  13896. $ctx1.sendIdx[","]=1;
  13897. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  13898. $1=self._replaceRegexp_with_($2,"");
  13899. return $1;
  13900. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)})},
  13901. args: ["separators"],
  13902. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  13903. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13904. referencedClasses: ["RegularExpression"]
  13905. }),
  13906. globals.String);
  13907. smalltalk.addMethod(
  13908. smalltalk.method({
  13909. selector: "unescaped",
  13910. protocol: 'converting',
  13911. fn: function (){
  13912. var self=this;
  13913. return smalltalk.withContext(function($ctx1) {
  13914. return unescape(self);
  13915. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)})},
  13916. args: [],
  13917. source: "unescaped\x0a\x09<return unescape(self)>",
  13918. messageSends: [],
  13919. referencedClasses: []
  13920. }),
  13921. globals.String);
  13922. smalltalk.addMethod(
  13923. smalltalk.method({
  13924. selector: "uriComponentDecoded",
  13925. protocol: 'converting',
  13926. fn: function (){
  13927. var self=this;
  13928. return smalltalk.withContext(function($ctx1) {
  13929. return decodeURIComponent(self);
  13930. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)})},
  13931. args: [],
  13932. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  13933. messageSends: [],
  13934. referencedClasses: []
  13935. }),
  13936. globals.String);
  13937. smalltalk.addMethod(
  13938. smalltalk.method({
  13939. selector: "uriComponentEncoded",
  13940. protocol: 'converting',
  13941. fn: function (){
  13942. var self=this;
  13943. return smalltalk.withContext(function($ctx1) {
  13944. return encodeURIComponent(self);
  13945. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)})},
  13946. args: [],
  13947. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  13948. messageSends: [],
  13949. referencedClasses: []
  13950. }),
  13951. globals.String);
  13952. smalltalk.addMethod(
  13953. smalltalk.method({
  13954. selector: "uriDecoded",
  13955. protocol: 'converting',
  13956. fn: function (){
  13957. var self=this;
  13958. return smalltalk.withContext(function($ctx1) {
  13959. return decodeURI(self);
  13960. return self}, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)})},
  13961. args: [],
  13962. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  13963. messageSends: [],
  13964. referencedClasses: []
  13965. }),
  13966. globals.String);
  13967. smalltalk.addMethod(
  13968. smalltalk.method({
  13969. selector: "uriEncoded",
  13970. protocol: 'converting',
  13971. fn: function (){
  13972. var self=this;
  13973. return smalltalk.withContext(function($ctx1) {
  13974. return encodeURI(self);
  13975. return self}, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)})},
  13976. args: [],
  13977. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  13978. messageSends: [],
  13979. referencedClasses: []
  13980. }),
  13981. globals.String);
  13982. smalltalk.addMethod(
  13983. smalltalk.method({
  13984. selector: "cr",
  13985. protocol: 'accessing',
  13986. fn: function (){
  13987. var self=this;
  13988. return smalltalk.withContext(function($ctx1) {
  13989. return '\r';
  13990. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)})},
  13991. args: [],
  13992. source: "cr\x0a\x09<return '\x5cr'>",
  13993. messageSends: [],
  13994. referencedClasses: []
  13995. }),
  13996. globals.String.klass);
  13997. smalltalk.addMethod(
  13998. smalltalk.method({
  13999. selector: "crlf",
  14000. protocol: 'accessing',
  14001. fn: function (){
  14002. var self=this;
  14003. return smalltalk.withContext(function($ctx1) {
  14004. return '\r\n';
  14005. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)})},
  14006. args: [],
  14007. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  14008. messageSends: [],
  14009. referencedClasses: []
  14010. }),
  14011. globals.String.klass);
  14012. smalltalk.addMethod(
  14013. smalltalk.method({
  14014. selector: "esc",
  14015. protocol: 'accessing',
  14016. fn: function (){
  14017. var self=this;
  14018. return smalltalk.withContext(function($ctx1) {
  14019. var $1;
  14020. $1=self._fromCharCode_((27));
  14021. return $1;
  14022. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)})},
  14023. args: [],
  14024. source: "esc\x0a\x09^ self fromCharCode: 27",
  14025. messageSends: ["fromCharCode:"],
  14026. referencedClasses: []
  14027. }),
  14028. globals.String.klass);
  14029. smalltalk.addMethod(
  14030. smalltalk.method({
  14031. selector: "fromCharCode:",
  14032. protocol: 'instance creation',
  14033. fn: function (anInteger){
  14034. var self=this;
  14035. return smalltalk.withContext(function($ctx1) {
  14036. return String.fromCharCode(anInteger);
  14037. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)})},
  14038. args: ["anInteger"],
  14039. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  14040. messageSends: [],
  14041. referencedClasses: []
  14042. }),
  14043. globals.String.klass);
  14044. smalltalk.addMethod(
  14045. smalltalk.method({
  14046. selector: "fromString:",
  14047. protocol: 'instance creation',
  14048. fn: function (aString){
  14049. var self=this;
  14050. return smalltalk.withContext(function($ctx1) {
  14051. return String(aString);
  14052. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)})},
  14053. args: ["aString"],
  14054. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  14055. messageSends: [],
  14056. referencedClasses: []
  14057. }),
  14058. globals.String.klass);
  14059. smalltalk.addMethod(
  14060. smalltalk.method({
  14061. selector: "lf",
  14062. protocol: 'accessing',
  14063. fn: function (){
  14064. var self=this;
  14065. return smalltalk.withContext(function($ctx1) {
  14066. return '\n';
  14067. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)})},
  14068. args: [],
  14069. source: "lf\x0a\x09<return '\x5cn'>",
  14070. messageSends: [],
  14071. referencedClasses: []
  14072. }),
  14073. globals.String.klass);
  14074. smalltalk.addMethod(
  14075. smalltalk.method({
  14076. selector: "random",
  14077. protocol: 'random',
  14078. fn: function (){
  14079. var self=this;
  14080. return smalltalk.withContext(function($ctx1) {
  14081. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  14082. return self}, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)})},
  14083. args: [],
  14084. 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);>",
  14085. messageSends: [],
  14086. referencedClasses: []
  14087. }),
  14088. globals.String.klass);
  14089. smalltalk.addMethod(
  14090. smalltalk.method({
  14091. selector: "randomNotIn:",
  14092. protocol: 'random',
  14093. fn: function (aString){
  14094. var self=this;
  14095. var result;
  14096. return smalltalk.withContext(function($ctx1) {
  14097. var $1;
  14098. _st((function(){
  14099. return smalltalk.withContext(function($ctx2) {
  14100. result=self._random();
  14101. result;
  14102. return _st(aString)._includesSubString_(result);
  14103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue();
  14104. $1=result;
  14105. return $1;
  14106. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)})},
  14107. args: ["aString"],
  14108. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  14109. messageSends: ["whileTrue", "random", "includesSubString:"],
  14110. referencedClasses: []
  14111. }),
  14112. globals.String.klass);
  14113. smalltalk.addMethod(
  14114. smalltalk.method({
  14115. selector: "space",
  14116. protocol: 'accessing',
  14117. fn: function (){
  14118. var self=this;
  14119. return smalltalk.withContext(function($ctx1) {
  14120. return ' ';
  14121. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)})},
  14122. args: [],
  14123. source: "space\x0a\x09<return ' '>",
  14124. messageSends: [],
  14125. referencedClasses: []
  14126. }),
  14127. globals.String.klass);
  14128. smalltalk.addMethod(
  14129. smalltalk.method({
  14130. selector: "streamClass",
  14131. protocol: 'accessing',
  14132. fn: function (){
  14133. var self=this;
  14134. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  14135. return $StringStream();
  14136. },
  14137. args: [],
  14138. source: "streamClass\x0a\x09\x09^ StringStream",
  14139. messageSends: [],
  14140. referencedClasses: ["StringStream"]
  14141. }),
  14142. globals.String.klass);
  14143. smalltalk.addMethod(
  14144. smalltalk.method({
  14145. selector: "tab",
  14146. protocol: 'accessing',
  14147. fn: function (){
  14148. var self=this;
  14149. return smalltalk.withContext(function($ctx1) {
  14150. return '\t';
  14151. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)})},
  14152. args: [],
  14153. source: "tab\x0a\x09<return '\x5ct'>",
  14154. messageSends: [],
  14155. referencedClasses: []
  14156. }),
  14157. globals.String.klass);
  14158. smalltalk.addMethod(
  14159. smalltalk.method({
  14160. selector: "value:",
  14161. protocol: 'instance creation',
  14162. fn: function (aUTFCharCode){
  14163. var self=this;
  14164. return smalltalk.withContext(function($ctx1) {
  14165. return String.fromCharCode(aUTFCharCode);;
  14166. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)})},
  14167. args: ["aUTFCharCode"],
  14168. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  14169. messageSends: [],
  14170. referencedClasses: []
  14171. }),
  14172. globals.String.klass);
  14173. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  14174. 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`.";
  14175. smalltalk.addMethod(
  14176. smalltalk.method({
  14177. selector: "=",
  14178. protocol: 'comparing',
  14179. fn: function (aCollection){
  14180. var self=this;
  14181. return smalltalk.withContext(function($ctx1) {
  14182. var $2,$1,$4,$3,$5;
  14183. var $early={};
  14184. try {
  14185. $2=self._class();
  14186. $ctx1.sendIdx["class"]=1;
  14187. $1=_st($2).__eq(_st(aCollection)._class());
  14188. $ctx1.sendIdx["="]=1;
  14189. if(! smalltalk.assert($1)){
  14190. return false;
  14191. };
  14192. $4=self._size();
  14193. $ctx1.sendIdx["size"]=1;
  14194. $3=_st($4).__eq(_st(aCollection)._size());
  14195. if(! smalltalk.assert($3)){
  14196. return false;
  14197. };
  14198. self._do_((function(each){
  14199. return smalltalk.withContext(function($ctx2) {
  14200. $5=_st(aCollection)._includes_(each);
  14201. if(! smalltalk.assert($5)){
  14202. throw $early=[false];
  14203. };
  14204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  14205. return true;
  14206. }
  14207. catch(e) {if(e===$early)return e[0]; throw e}
  14208. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)})},
  14209. args: ["aCollection"],
  14210. 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",
  14211. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  14212. referencedClasses: []
  14213. }),
  14214. globals.Set);
  14215. smalltalk.addMethod(
  14216. smalltalk.method({
  14217. selector: "add:",
  14218. protocol: 'adding/removing',
  14219. fn: function (anObject){
  14220. var self=this;
  14221. var bucket;
  14222. return smalltalk.withContext(function($ctx1) {
  14223. var $2,$1;
  14224. bucket=self._bucketsOfElement_(anObject);
  14225. $2=_st(bucket)._second();
  14226. if(($receiver = $2) == nil || $receiver == null){
  14227. var object,slowBucket;
  14228. object=_st(bucket)._first();
  14229. $ctx1.sendIdx["first"]=1;
  14230. object;
  14231. slowBucket=_st(bucket)._third();
  14232. slowBucket;
  14233. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  14234. return smalltalk.withContext(function($ctx2) {
  14235. _st(slowBucket)._add_(object);
  14236. self["@size"]=_st(self["@size"]).__plus((1));
  14237. return self["@size"];
  14238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14239. $1=object;
  14240. } else {
  14241. var primitiveBucket;
  14242. primitiveBucket=$receiver;
  14243. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  14244. };
  14245. return $1;
  14246. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)})},
  14247. args: ["anObject"],
  14248. 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 ]",
  14249. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"],
  14250. referencedClasses: []
  14251. }),
  14252. globals.Set);
  14253. smalltalk.addMethod(
  14254. smalltalk.method({
  14255. selector: "add:in:",
  14256. protocol: 'private',
  14257. fn: function (anObject,anotherObject){
  14258. var self=this;
  14259. return smalltalk.withContext(function($ctx1) {
  14260. if (anObject in anotherObject.store) { return false; }
  14261. self['@size']++;
  14262. return anotherObject.store[anObject] = true;
  14263. ;
  14264. return self}, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  14265. args: ["anObject", "anotherObject"],
  14266. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  14267. messageSends: [],
  14268. referencedClasses: []
  14269. }),
  14270. globals.Set);
  14271. smalltalk.addMethod(
  14272. smalltalk.method({
  14273. selector: "bucketsOfElement:",
  14274. protocol: 'private',
  14275. fn: function (anObject){
  14276. var self=this;
  14277. return smalltalk.withContext(function($ctx1) {
  14278. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  14279. if ((type = typeof prim) === "object") {
  14280. if (anObject !== nil) {
  14281. bucket = null;
  14282. self['@slowBucketStores'].some(function (store) {
  14283. return bucket = store._bucketOfElement_(anObject);
  14284. });
  14285. return [ anObject, null, bucket || self['@defaultBucket'] ];
  14286. }
  14287. // include nil to well-known objects under 'boolean' fastBucket
  14288. prim = null;
  14289. type = 'boolean';
  14290. }
  14291. return [ prim, self['@fastBuckets'][type] ];
  14292. ;
  14293. return self}, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)})},
  14294. args: ["anObject"],
  14295. 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\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  14296. messageSends: [],
  14297. referencedClasses: []
  14298. }),
  14299. globals.Set);
  14300. smalltalk.addMethod(
  14301. smalltalk.method({
  14302. selector: "classNameOf:",
  14303. protocol: 'private',
  14304. fn: function (anObject){
  14305. var self=this;
  14306. return smalltalk.withContext(function($ctx1) {
  14307. return anObject.klass && anObject.klass.className;
  14308. return self}, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)})},
  14309. args: ["anObject"],
  14310. 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 && anObject.klass.className>",
  14311. messageSends: [],
  14312. referencedClasses: []
  14313. }),
  14314. globals.Set);
  14315. smalltalk.addMethod(
  14316. smalltalk.method({
  14317. selector: "collect:",
  14318. protocol: 'enumerating',
  14319. fn: function (aBlock){
  14320. var self=this;
  14321. var collection;
  14322. return smalltalk.withContext(function($ctx1) {
  14323. var $1;
  14324. collection=_st(self._class())._new();
  14325. self._do_((function(each){
  14326. return smalltalk.withContext(function($ctx2) {
  14327. return _st(collection)._add_(_st(aBlock)._value_(each));
  14328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14329. $1=collection;
  14330. return $1;
  14331. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)})},
  14332. args: ["aBlock"],
  14333. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  14334. messageSends: ["new", "class", "do:", "add:", "value:"],
  14335. referencedClasses: []
  14336. }),
  14337. globals.Set);
  14338. smalltalk.addMethod(
  14339. smalltalk.method({
  14340. selector: "detect:ifNone:",
  14341. protocol: 'enumerating',
  14342. fn: function (aBlock,anotherBlock){
  14343. var self=this;
  14344. return smalltalk.withContext(function($ctx1) {
  14345. var $1,$2;
  14346. var $early={};
  14347. try {
  14348. self._do_((function(each){
  14349. return smalltalk.withContext(function($ctx2) {
  14350. $1=_st(aBlock)._value_(each);
  14351. if(smalltalk.assert($1)){
  14352. throw $early=[each];
  14353. };
  14354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14355. $2=_st(anotherBlock)._value();
  14356. return $2;
  14357. }
  14358. catch(e) {if(e===$early)return e[0]; throw e}
  14359. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)})},
  14360. args: ["aBlock", "anotherBlock"],
  14361. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  14362. messageSends: ["do:", "ifTrue:", "value:", "value"],
  14363. referencedClasses: []
  14364. }),
  14365. globals.Set);
  14366. smalltalk.addMethod(
  14367. smalltalk.method({
  14368. selector: "do:",
  14369. protocol: 'enumerating',
  14370. fn: function (aBlock){
  14371. var self=this;
  14372. return smalltalk.withContext(function($ctx1) {
  14373. var el, keys, i;
  14374. el = self['@fastBuckets'];
  14375. keys = Object.keys(el);
  14376. for (i = 0; i < keys.length; ++i) {
  14377. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  14378. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  14379. else { store._do_(aBlock); }
  14380. }
  14381. el = self['@slowBucketStores'];
  14382. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  14383. self['@defaultBucket']._do_(aBlock);
  14384. ;
  14385. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)})},
  14386. args: ["aBlock"],
  14387. 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>",
  14388. messageSends: [],
  14389. referencedClasses: []
  14390. }),
  14391. globals.Set);
  14392. smalltalk.addMethod(
  14393. smalltalk.method({
  14394. selector: "includes:",
  14395. protocol: 'testing',
  14396. fn: function (anObject){
  14397. var self=this;
  14398. var bucket;
  14399. return smalltalk.withContext(function($ctx1) {
  14400. var $2,$3,$4,$1;
  14401. bucket=self._bucketsOfElement_(anObject);
  14402. $2=_st(bucket)._second();
  14403. if(($receiver = $2) == nil || $receiver == null){
  14404. $3=_st(bucket)._third();
  14405. $4=_st(bucket)._first();
  14406. $ctx1.sendIdx["first"]=1;
  14407. $1=_st($3)._includes_($4);
  14408. } else {
  14409. var primitiveBucket;
  14410. primitiveBucket=$receiver;
  14411. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  14412. };
  14413. return $1;
  14414. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)})},
  14415. args: ["anObject"],
  14416. 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 ]",
  14417. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"],
  14418. referencedClasses: []
  14419. }),
  14420. globals.Set);
  14421. smalltalk.addMethod(
  14422. smalltalk.method({
  14423. selector: "includes:in:",
  14424. protocol: 'private',
  14425. fn: function (anObject,anotherObject){
  14426. var self=this;
  14427. return smalltalk.withContext(function($ctx1) {
  14428. return anObject in anotherObject.store;
  14429. return self}, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  14430. args: ["anObject", "anotherObject"],
  14431. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  14432. messageSends: [],
  14433. referencedClasses: []
  14434. }),
  14435. globals.Set);
  14436. smalltalk.addMethod(
  14437. smalltalk.method({
  14438. selector: "initialize",
  14439. protocol: 'initialization',
  14440. fn: function (){
  14441. var self=this;
  14442. return smalltalk.withContext(function($ctx1) {
  14443. var $1;
  14444. globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []);
  14445. self["@defaultBucket"]=[];
  14446. self._initializeSlowBucketStores();
  14447. $1=self._removeAll();
  14448. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)})},
  14449. args: [],
  14450. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  14451. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"],
  14452. referencedClasses: []
  14453. }),
  14454. globals.Set);
  14455. smalltalk.addMethod(
  14456. smalltalk.method({
  14457. selector: "initializeSlowBucketStores",
  14458. protocol: 'initialization',
  14459. fn: function (){
  14460. var self=this;
  14461. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  14462. return smalltalk.withContext(function($ctx1) {
  14463. var $1;
  14464. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  14465. return smalltalk.withContext(function($ctx2) {
  14466. return self._classNameOf_(x);
  14467. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  14468. $ctx1.sendIdx["hashBlock:"]=1;
  14469. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  14470. return smalltalk.withContext(function($ctx2) {
  14471. return self._jsConstructorNameOf_(x);
  14472. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))];
  14473. return self}, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)})},
  14474. args: [],
  14475. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  14476. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"],
  14477. referencedClasses: ["ArrayBucketStore"]
  14478. }),
  14479. globals.Set);
  14480. smalltalk.addMethod(
  14481. smalltalk.method({
  14482. selector: "jsConstructorNameOf:",
  14483. protocol: 'private',
  14484. fn: function (anObject){
  14485. var self=this;
  14486. return smalltalk.withContext(function($ctx1) {
  14487. return anObject.constructor && anObject.constructor.name;
  14488. return self}, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)})},
  14489. args: ["anObject"],
  14490. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  14491. messageSends: [],
  14492. referencedClasses: []
  14493. }),
  14494. globals.Set);
  14495. smalltalk.addMethod(
  14496. smalltalk.method({
  14497. selector: "printOn:",
  14498. protocol: 'printing',
  14499. fn: function (aStream){
  14500. var self=this;
  14501. return smalltalk.withContext(function($ctx1) {
  14502. globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  14503. $ctx1.sendIdx["printOn:"]=1;
  14504. _st(aStream)._nextPutAll_(" (");
  14505. $ctx1.sendIdx["nextPutAll:"]=1;
  14506. self._do_separatedBy_((function(each){
  14507. return smalltalk.withContext(function($ctx2) {
  14508. return _st(each)._printOn_(aStream);
  14509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  14510. return smalltalk.withContext(function($ctx2) {
  14511. return _st(aStream)._nextPutAll_(" ");
  14512. $ctx2.sendIdx["nextPutAll:"]=2;
  14513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14514. _st(aStream)._nextPutAll_(")");
  14515. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)})},
  14516. args: ["aStream"],
  14517. 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: ')'",
  14518. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  14519. referencedClasses: []
  14520. }),
  14521. globals.Set);
  14522. smalltalk.addMethod(
  14523. smalltalk.method({
  14524. selector: "remove:ifAbsent:",
  14525. protocol: 'adding/removing',
  14526. fn: function (anObject,aBlock){
  14527. var self=this;
  14528. var bucket;
  14529. return smalltalk.withContext(function($ctx1) {
  14530. var $2,$3,$4,$5,$1;
  14531. var $early={};
  14532. try {
  14533. bucket=self._bucketsOfElement_(anObject);
  14534. $2=_st(bucket)._second();
  14535. if(($receiver = $2) == nil || $receiver == null){
  14536. $3=_st(bucket)._third();
  14537. $4=_st(bucket)._first();
  14538. $ctx1.sendIdx["first"]=1;
  14539. _st($3)._remove_ifAbsent_($4,(function(){
  14540. return smalltalk.withContext(function($ctx2) {
  14541. $5=_st(aBlock)._value();
  14542. throw $early=[$5];
  14543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14544. self["@size"]=_st(self["@size"]).__minus((1));
  14545. $1=self["@size"];
  14546. } else {
  14547. var primitiveBucket;
  14548. primitiveBucket=$receiver;
  14549. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  14550. };
  14551. return $1;
  14552. }
  14553. catch(e) {if(e===$early)return e[0]; throw e}
  14554. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)})},
  14555. args: ["anObject", "aBlock"],
  14556. 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 ]",
  14557. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"],
  14558. referencedClasses: []
  14559. }),
  14560. globals.Set);
  14561. smalltalk.addMethod(
  14562. smalltalk.method({
  14563. selector: "remove:in:",
  14564. protocol: 'private',
  14565. fn: function (anObject,anotherObject){
  14566. var self=this;
  14567. return smalltalk.withContext(function($ctx1) {
  14568. if (delete anotherObject.store[anObject]) self['@size']--;
  14569. return self}, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  14570. args: ["anObject", "anotherObject"],
  14571. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  14572. messageSends: [],
  14573. referencedClasses: []
  14574. }),
  14575. globals.Set);
  14576. smalltalk.addMethod(
  14577. smalltalk.method({
  14578. selector: "removeAll",
  14579. protocol: 'adding/removing',
  14580. fn: function (){
  14581. var self=this;
  14582. return smalltalk.withContext(function($ctx1) {
  14583. self['@fastBuckets'] = {
  14584. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  14585. 'number': { store: Object.create(null), fn: Number },
  14586. 'string': { store: Object.create(null) }
  14587. };
  14588. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  14589. self['@defaultBucket']._removeAll();
  14590. self['@size'] = 0;
  14591. ;
  14592. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)})},
  14593. args: [],
  14594. 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>",
  14595. messageSends: [],
  14596. referencedClasses: []
  14597. }),
  14598. globals.Set);
  14599. smalltalk.addMethod(
  14600. smalltalk.method({
  14601. selector: "select:",
  14602. protocol: 'enumerating',
  14603. fn: function (aBlock){
  14604. var self=this;
  14605. var collection;
  14606. return smalltalk.withContext(function($ctx1) {
  14607. var $1,$2;
  14608. collection=_st(self._class())._new();
  14609. self._do_((function(each){
  14610. return smalltalk.withContext(function($ctx2) {
  14611. $1=_st(aBlock)._value_(each);
  14612. if(smalltalk.assert($1)){
  14613. return _st(collection)._add_(each);
  14614. };
  14615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14616. $2=collection;
  14617. return $2;
  14618. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)})},
  14619. args: ["aBlock"],
  14620. 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",
  14621. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  14622. referencedClasses: []
  14623. }),
  14624. globals.Set);
  14625. smalltalk.addMethod(
  14626. smalltalk.method({
  14627. selector: "size",
  14628. protocol: 'accessing',
  14629. fn: function (){
  14630. var self=this;
  14631. var $1;
  14632. $1=self["@size"];
  14633. return $1;
  14634. },
  14635. args: [],
  14636. source: "size\x0a\x09^ size",
  14637. messageSends: [],
  14638. referencedClasses: []
  14639. }),
  14640. globals.Set);
  14641. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  14642. 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.";
  14643. smalltalk.addMethod(
  14644. smalltalk.method({
  14645. selector: "initialize",
  14646. protocol: 'initialization',
  14647. fn: function (){
  14648. var self=this;
  14649. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14650. return smalltalk.withContext(function($ctx1) {
  14651. globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []);
  14652. self["@read"]=_st($OrderedCollection())._new();
  14653. $ctx1.sendIdx["new"]=1;
  14654. self["@write"]=_st($OrderedCollection())._new();
  14655. self["@readIndex"]=(1);
  14656. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)})},
  14657. args: [],
  14658. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14659. messageSends: ["initialize", "new"],
  14660. referencedClasses: ["OrderedCollection"]
  14661. }),
  14662. globals.Queue);
  14663. smalltalk.addMethod(
  14664. smalltalk.method({
  14665. selector: "next",
  14666. protocol: 'accessing',
  14667. fn: function (){
  14668. var self=this;
  14669. return smalltalk.withContext(function($ctx1) {
  14670. var $1;
  14671. $1=self._nextIfAbsent_((function(){
  14672. return smalltalk.withContext(function($ctx2) {
  14673. return self._error_("Cannot read from empty Queue.");
  14674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  14675. return $1;
  14676. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)})},
  14677. args: [],
  14678. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14679. messageSends: ["nextIfAbsent:", "error:"],
  14680. referencedClasses: []
  14681. }),
  14682. globals.Queue);
  14683. smalltalk.addMethod(
  14684. smalltalk.method({
  14685. selector: "nextIfAbsent:",
  14686. protocol: 'accessing',
  14687. fn: function (aBlock){
  14688. var self=this;
  14689. var result;
  14690. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14691. return smalltalk.withContext(function($ctx1) {
  14692. var $1,$2,$3,$4;
  14693. var $early={};
  14694. try {
  14695. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  14696. return smalltalk.withContext(function($ctx2) {
  14697. $1=_st(self["@write"])._isEmpty();
  14698. if(smalltalk.assert($1)){
  14699. $2=_st(self["@readIndex"]).__gt((1));
  14700. if(smalltalk.assert($2)){
  14701. self["@read"]=[];
  14702. self["@read"];
  14703. self["@readIndex"]=(1);
  14704. self["@readIndex"];
  14705. };
  14706. $3=_st(aBlock)._value();
  14707. throw $early=[$3];
  14708. };
  14709. self["@read"]=self["@write"];
  14710. self["@read"];
  14711. self["@readIndex"]=(1);
  14712. self["@readIndex"];
  14713. self["@write"]=_st($OrderedCollection())._new();
  14714. self["@write"];
  14715. return _st(self["@read"])._first();
  14716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  14717. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  14718. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  14719. $4=result;
  14720. return $4;
  14721. }
  14722. catch(e) {if(e===$early)return e[0]; throw e}
  14723. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)})},
  14724. args: ["aBlock"],
  14725. 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",
  14726. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"],
  14727. referencedClasses: ["OrderedCollection"]
  14728. }),
  14729. globals.Queue);
  14730. smalltalk.addMethod(
  14731. smalltalk.method({
  14732. selector: "nextPut:",
  14733. protocol: 'accessing',
  14734. fn: function (anObject){
  14735. var self=this;
  14736. return smalltalk.withContext(function($ctx1) {
  14737. _st(self["@write"])._add_(anObject);
  14738. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)})},
  14739. args: ["anObject"],
  14740. source: "nextPut: anObject\x0a\x09write add: anObject",
  14741. messageSends: ["add:"],
  14742. referencedClasses: []
  14743. }),
  14744. globals.Queue);
  14745. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  14746. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14747. smalltalk.addMethod(
  14748. smalltalk.method({
  14749. selector: "compile:",
  14750. protocol: 'evaluating',
  14751. fn: function (aString){
  14752. var self=this;
  14753. return smalltalk.withContext(function($ctx1) {
  14754. return self.compile(aString);
  14755. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)})},
  14756. args: ["aString"],
  14757. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  14758. messageSends: [],
  14759. referencedClasses: []
  14760. }),
  14761. globals.RegularExpression);
  14762. smalltalk.addMethod(
  14763. smalltalk.method({
  14764. selector: "exec:",
  14765. protocol: 'evaluating',
  14766. fn: function (aString){
  14767. var self=this;
  14768. return smalltalk.withContext(function($ctx1) {
  14769. return self.exec(aString) || nil;
  14770. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)})},
  14771. args: ["aString"],
  14772. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  14773. messageSends: [],
  14774. referencedClasses: []
  14775. }),
  14776. globals.RegularExpression);
  14777. smalltalk.addMethod(
  14778. smalltalk.method({
  14779. selector: "test:",
  14780. protocol: 'evaluating',
  14781. fn: function (aString){
  14782. var self=this;
  14783. return smalltalk.withContext(function($ctx1) {
  14784. return self.test(aString);
  14785. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)})},
  14786. args: ["aString"],
  14787. source: "test: aString\x0a\x09<return self.test(aString)>",
  14788. messageSends: [],
  14789. referencedClasses: []
  14790. }),
  14791. globals.RegularExpression);
  14792. smalltalk.addMethod(
  14793. smalltalk.method({
  14794. selector: "fromString:",
  14795. protocol: 'instance creation',
  14796. fn: function (aString){
  14797. var self=this;
  14798. return smalltalk.withContext(function($ctx1) {
  14799. var $1;
  14800. $1=self._fromString_flag_(aString,"");
  14801. return $1;
  14802. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)})},
  14803. args: ["aString"],
  14804. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14805. messageSends: ["fromString:flag:"],
  14806. referencedClasses: []
  14807. }),
  14808. globals.RegularExpression.klass);
  14809. smalltalk.addMethod(
  14810. smalltalk.method({
  14811. selector: "fromString:flag:",
  14812. protocol: 'instance creation',
  14813. fn: function (aString,anotherString){
  14814. var self=this;
  14815. return smalltalk.withContext(function($ctx1) {
  14816. return new RegExp(aString, anotherString);
  14817. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)})},
  14818. args: ["aString", "anotherString"],
  14819. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  14820. messageSends: [],
  14821. referencedClasses: []
  14822. }),
  14823. globals.RegularExpression.klass);
  14824. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  14825. 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.";
  14826. smalltalk.addMethod(
  14827. smalltalk.method({
  14828. selector: "<<",
  14829. protocol: 'writing',
  14830. fn: function (anObject){
  14831. var self=this;
  14832. return smalltalk.withContext(function($ctx1) {
  14833. self._write_(anObject);
  14834. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)})},
  14835. args: ["anObject"],
  14836. source: "<< anObject\x0a\x09self write: anObject",
  14837. messageSends: ["write:"],
  14838. referencedClasses: []
  14839. }),
  14840. globals.Stream);
  14841. smalltalk.addMethod(
  14842. smalltalk.method({
  14843. selector: "atEnd",
  14844. protocol: 'testing',
  14845. fn: function (){
  14846. var self=this;
  14847. return smalltalk.withContext(function($ctx1) {
  14848. var $1;
  14849. $1=_st(self._position()).__eq(self._size());
  14850. return $1;
  14851. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)})},
  14852. args: [],
  14853. source: "atEnd\x0a\x09^ self position = self size",
  14854. messageSends: ["=", "position", "size"],
  14855. referencedClasses: []
  14856. }),
  14857. globals.Stream);
  14858. smalltalk.addMethod(
  14859. smalltalk.method({
  14860. selector: "atStart",
  14861. protocol: 'testing',
  14862. fn: function (){
  14863. var self=this;
  14864. return smalltalk.withContext(function($ctx1) {
  14865. var $1;
  14866. $1=_st(self._position()).__eq((0));
  14867. return $1;
  14868. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)})},
  14869. args: [],
  14870. source: "atStart\x0a\x09^ self position = 0",
  14871. messageSends: ["=", "position"],
  14872. referencedClasses: []
  14873. }),
  14874. globals.Stream);
  14875. smalltalk.addMethod(
  14876. smalltalk.method({
  14877. selector: "close",
  14878. protocol: 'actions',
  14879. fn: function (){
  14880. var self=this;
  14881. return self},
  14882. args: [],
  14883. source: "close",
  14884. messageSends: [],
  14885. referencedClasses: []
  14886. }),
  14887. globals.Stream);
  14888. smalltalk.addMethod(
  14889. smalltalk.method({
  14890. selector: "collection",
  14891. protocol: 'accessing',
  14892. fn: function (){
  14893. var self=this;
  14894. var $1;
  14895. $1=self["@collection"];
  14896. return $1;
  14897. },
  14898. args: [],
  14899. source: "collection\x0a\x09^ collection",
  14900. messageSends: [],
  14901. referencedClasses: []
  14902. }),
  14903. globals.Stream);
  14904. smalltalk.addMethod(
  14905. smalltalk.method({
  14906. selector: "contents",
  14907. protocol: 'accessing',
  14908. fn: function (){
  14909. var self=this;
  14910. return smalltalk.withContext(function($ctx1) {
  14911. var $1;
  14912. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  14913. return $1;
  14914. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)})},
  14915. args: [],
  14916. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  14917. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  14918. referencedClasses: []
  14919. }),
  14920. globals.Stream);
  14921. smalltalk.addMethod(
  14922. smalltalk.method({
  14923. selector: "do:",
  14924. protocol: 'enumerating',
  14925. fn: function (aBlock){
  14926. var self=this;
  14927. return smalltalk.withContext(function($ctx1) {
  14928. _st((function(){
  14929. return smalltalk.withContext(function($ctx2) {
  14930. return self._atEnd();
  14931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  14932. return smalltalk.withContext(function($ctx2) {
  14933. return _st(aBlock)._value_(self._next());
  14934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14935. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)})},
  14936. args: ["aBlock"],
  14937. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  14938. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  14939. referencedClasses: []
  14940. }),
  14941. globals.Stream);
  14942. smalltalk.addMethod(
  14943. smalltalk.method({
  14944. selector: "flush",
  14945. protocol: 'actions',
  14946. fn: function (){
  14947. var self=this;
  14948. return self},
  14949. args: [],
  14950. source: "flush",
  14951. messageSends: [],
  14952. referencedClasses: []
  14953. }),
  14954. globals.Stream);
  14955. smalltalk.addMethod(
  14956. smalltalk.method({
  14957. selector: "isEmpty",
  14958. protocol: 'testing',
  14959. fn: function (){
  14960. var self=this;
  14961. return smalltalk.withContext(function($ctx1) {
  14962. var $1;
  14963. $1=_st(self._size()).__eq((0));
  14964. return $1;
  14965. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)})},
  14966. args: [],
  14967. source: "isEmpty\x0a\x09^ self size = 0",
  14968. messageSends: ["=", "size"],
  14969. referencedClasses: []
  14970. }),
  14971. globals.Stream);
  14972. smalltalk.addMethod(
  14973. smalltalk.method({
  14974. selector: "next",
  14975. protocol: 'reading',
  14976. fn: function (){
  14977. var self=this;
  14978. return smalltalk.withContext(function($ctx1) {
  14979. var $2,$4,$3,$1;
  14980. $2=self._atEnd();
  14981. if(smalltalk.assert($2)){
  14982. $1=nil;
  14983. } else {
  14984. $4=self._position();
  14985. $ctx1.sendIdx["position"]=1;
  14986. $3=_st($4).__plus((1));
  14987. self._position_($3);
  14988. $1=_st(self["@collection"])._at_(self._position());
  14989. };
  14990. return $1;
  14991. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)})},
  14992. args: [],
  14993. 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 ]",
  14994. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  14995. referencedClasses: []
  14996. }),
  14997. globals.Stream);
  14998. smalltalk.addMethod(
  14999. smalltalk.method({
  15000. selector: "next:",
  15001. protocol: 'reading',
  15002. fn: function (anInteger){
  15003. var self=this;
  15004. var tempCollection;
  15005. return smalltalk.withContext(function($ctx1) {
  15006. var $1,$2;
  15007. tempCollection=_st(_st(self._collection())._class())._new();
  15008. _st(anInteger)._timesRepeat_((function(){
  15009. return smalltalk.withContext(function($ctx2) {
  15010. $1=self._atEnd();
  15011. if(! smalltalk.assert($1)){
  15012. return _st(tempCollection)._add_(self._next());
  15013. };
  15014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15015. $2=tempCollection;
  15016. return $2;
  15017. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)})},
  15018. args: ["anInteger"],
  15019. 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",
  15020. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  15021. referencedClasses: []
  15022. }),
  15023. globals.Stream);
  15024. smalltalk.addMethod(
  15025. smalltalk.method({
  15026. selector: "nextPut:",
  15027. protocol: 'writing',
  15028. fn: function (anObject){
  15029. var self=this;
  15030. return smalltalk.withContext(function($ctx1) {
  15031. var $2,$1,$3,$4;
  15032. $2=self._position();
  15033. $ctx1.sendIdx["position"]=1;
  15034. $1=_st($2).__plus((1));
  15035. self._position_($1);
  15036. $3=self._collection();
  15037. $4=self._position();
  15038. $ctx1.sendIdx["position"]=2;
  15039. _st($3)._at_put_($4,anObject);
  15040. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15041. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)})},
  15042. args: ["anObject"],
  15043. 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)",
  15044. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  15045. referencedClasses: []
  15046. }),
  15047. globals.Stream);
  15048. smalltalk.addMethod(
  15049. smalltalk.method({
  15050. selector: "nextPutAll:",
  15051. protocol: 'writing',
  15052. fn: function (aCollection){
  15053. var self=this;
  15054. return smalltalk.withContext(function($ctx1) {
  15055. _st(aCollection)._do_((function(each){
  15056. return smalltalk.withContext(function($ctx2) {
  15057. return self._nextPut_(each);
  15058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15059. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)})},
  15060. args: ["aCollection"],
  15061. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  15062. messageSends: ["do:", "nextPut:"],
  15063. referencedClasses: []
  15064. }),
  15065. globals.Stream);
  15066. smalltalk.addMethod(
  15067. smalltalk.method({
  15068. selector: "nextPutString:",
  15069. protocol: 'writing',
  15070. fn: function (aString){
  15071. var self=this;
  15072. return smalltalk.withContext(function($ctx1) {
  15073. self._nextPut_(aString);
  15074. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)})},
  15075. args: ["aString"],
  15076. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  15077. messageSends: ["nextPut:"],
  15078. referencedClasses: []
  15079. }),
  15080. globals.Stream);
  15081. smalltalk.addMethod(
  15082. smalltalk.method({
  15083. selector: "peek",
  15084. protocol: 'reading',
  15085. fn: function (){
  15086. var self=this;
  15087. return smalltalk.withContext(function($ctx1) {
  15088. var $2,$1;
  15089. $2=self._atEnd();
  15090. if(! smalltalk.assert($2)){
  15091. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  15092. };
  15093. return $1;
  15094. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)})},
  15095. args: [],
  15096. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  15097. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  15098. referencedClasses: []
  15099. }),
  15100. globals.Stream);
  15101. smalltalk.addMethod(
  15102. smalltalk.method({
  15103. selector: "position",
  15104. protocol: 'accessing',
  15105. fn: function (){
  15106. var self=this;
  15107. return smalltalk.withContext(function($ctx1) {
  15108. var $2,$1;
  15109. $2=self["@position"];
  15110. if(($receiver = $2) == nil || $receiver == null){
  15111. self["@position"]=(0);
  15112. $1=self["@position"];
  15113. } else {
  15114. $1=$2;
  15115. };
  15116. return $1;
  15117. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)})},
  15118. args: [],
  15119. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  15120. messageSends: ["ifNil:"],
  15121. referencedClasses: []
  15122. }),
  15123. globals.Stream);
  15124. smalltalk.addMethod(
  15125. smalltalk.method({
  15126. selector: "position:",
  15127. protocol: 'accessing',
  15128. fn: function (anInteger){
  15129. var self=this;
  15130. self["@position"]=anInteger;
  15131. return self},
  15132. args: ["anInteger"],
  15133. source: "position: anInteger\x0a\x09position := anInteger",
  15134. messageSends: [],
  15135. referencedClasses: []
  15136. }),
  15137. globals.Stream);
  15138. smalltalk.addMethod(
  15139. smalltalk.method({
  15140. selector: "reset",
  15141. protocol: 'actions',
  15142. fn: function (){
  15143. var self=this;
  15144. return smalltalk.withContext(function($ctx1) {
  15145. self._position_((0));
  15146. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)})},
  15147. args: [],
  15148. source: "reset\x0a\x09self position: 0",
  15149. messageSends: ["position:"],
  15150. referencedClasses: []
  15151. }),
  15152. globals.Stream);
  15153. smalltalk.addMethod(
  15154. smalltalk.method({
  15155. selector: "resetContents",
  15156. protocol: 'actions',
  15157. fn: function (){
  15158. var self=this;
  15159. return smalltalk.withContext(function($ctx1) {
  15160. self._reset();
  15161. self._setStreamSize_((0));
  15162. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)})},
  15163. args: [],
  15164. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  15165. messageSends: ["reset", "setStreamSize:"],
  15166. referencedClasses: []
  15167. }),
  15168. globals.Stream);
  15169. smalltalk.addMethod(
  15170. smalltalk.method({
  15171. selector: "setCollection:",
  15172. protocol: 'accessing',
  15173. fn: function (aCollection){
  15174. var self=this;
  15175. self["@collection"]=aCollection;
  15176. return self},
  15177. args: ["aCollection"],
  15178. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  15179. messageSends: [],
  15180. referencedClasses: []
  15181. }),
  15182. globals.Stream);
  15183. smalltalk.addMethod(
  15184. smalltalk.method({
  15185. selector: "setStreamSize:",
  15186. protocol: 'accessing',
  15187. fn: function (anInteger){
  15188. var self=this;
  15189. self["@streamSize"]=anInteger;
  15190. return self},
  15191. args: ["anInteger"],
  15192. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  15193. messageSends: [],
  15194. referencedClasses: []
  15195. }),
  15196. globals.Stream);
  15197. smalltalk.addMethod(
  15198. smalltalk.method({
  15199. selector: "setToEnd",
  15200. protocol: 'positioning',
  15201. fn: function (){
  15202. var self=this;
  15203. return smalltalk.withContext(function($ctx1) {
  15204. self._position_(self._size());
  15205. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)})},
  15206. args: [],
  15207. source: "setToEnd\x0a\x09self position: self size",
  15208. messageSends: ["position:", "size"],
  15209. referencedClasses: []
  15210. }),
  15211. globals.Stream);
  15212. smalltalk.addMethod(
  15213. smalltalk.method({
  15214. selector: "size",
  15215. protocol: 'accessing',
  15216. fn: function (){
  15217. var self=this;
  15218. return smalltalk.withContext(function($ctx1) {
  15219. var $1;
  15220. $1=self._streamSize();
  15221. return $1;
  15222. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)})},
  15223. args: [],
  15224. source: "size\x0a\x09^ self streamSize",
  15225. messageSends: ["streamSize"],
  15226. referencedClasses: []
  15227. }),
  15228. globals.Stream);
  15229. smalltalk.addMethod(
  15230. smalltalk.method({
  15231. selector: "skip:",
  15232. protocol: 'positioning',
  15233. fn: function (anInteger){
  15234. var self=this;
  15235. return smalltalk.withContext(function($ctx1) {
  15236. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  15237. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)})},
  15238. args: ["anInteger"],
  15239. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  15240. messageSends: ["position:", "min:max:", "+", "position", "size"],
  15241. referencedClasses: []
  15242. }),
  15243. globals.Stream);
  15244. smalltalk.addMethod(
  15245. smalltalk.method({
  15246. selector: "streamSize",
  15247. protocol: 'accessing',
  15248. fn: function (){
  15249. var self=this;
  15250. var $1;
  15251. $1=self["@streamSize"];
  15252. return $1;
  15253. },
  15254. args: [],
  15255. source: "streamSize\x0a\x09^ streamSize",
  15256. messageSends: [],
  15257. referencedClasses: []
  15258. }),
  15259. globals.Stream);
  15260. smalltalk.addMethod(
  15261. smalltalk.method({
  15262. selector: "write:",
  15263. protocol: 'writing',
  15264. fn: function (anObject){
  15265. var self=this;
  15266. return smalltalk.withContext(function($ctx1) {
  15267. _st(anObject)._putOn_(self);
  15268. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)})},
  15269. args: ["anObject"],
  15270. source: "write: anObject\x0a\x09anObject putOn: self",
  15271. messageSends: ["putOn:"],
  15272. referencedClasses: []
  15273. }),
  15274. globals.Stream);
  15275. smalltalk.addMethod(
  15276. smalltalk.method({
  15277. selector: "on:",
  15278. protocol: 'instance creation',
  15279. fn: function (aCollection){
  15280. var self=this;
  15281. return smalltalk.withContext(function($ctx1) {
  15282. var $2,$3,$1;
  15283. $2=self._new();
  15284. _st($2)._setCollection_(aCollection);
  15285. _st($2)._setStreamSize_(_st(aCollection)._size());
  15286. $3=_st($2)._yourself();
  15287. $1=$3;
  15288. return $1;
  15289. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)})},
  15290. args: ["aCollection"],
  15291. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  15292. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  15293. referencedClasses: []
  15294. }),
  15295. globals.Stream.klass);
  15296. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  15297. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  15298. smalltalk.addMethod(
  15299. smalltalk.method({
  15300. selector: "cr",
  15301. protocol: 'writing',
  15302. fn: function (){
  15303. var self=this;
  15304. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15305. return smalltalk.withContext(function($ctx1) {
  15306. var $1;
  15307. $1=self._nextPutAll_(_st($String())._cr());
  15308. return $1;
  15309. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)})},
  15310. args: [],
  15311. source: "cr\x0a\x09^ self nextPutAll: String cr",
  15312. messageSends: ["nextPutAll:", "cr"],
  15313. referencedClasses: ["String"]
  15314. }),
  15315. globals.StringStream);
  15316. smalltalk.addMethod(
  15317. smalltalk.method({
  15318. selector: "crlf",
  15319. protocol: 'writing',
  15320. fn: function (){
  15321. var self=this;
  15322. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15323. return smalltalk.withContext(function($ctx1) {
  15324. var $1;
  15325. $1=self._nextPutAll_(_st($String())._crlf());
  15326. return $1;
  15327. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)})},
  15328. args: [],
  15329. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  15330. messageSends: ["nextPutAll:", "crlf"],
  15331. referencedClasses: ["String"]
  15332. }),
  15333. globals.StringStream);
  15334. smalltalk.addMethod(
  15335. smalltalk.method({
  15336. selector: "lf",
  15337. protocol: 'writing',
  15338. fn: function (){
  15339. var self=this;
  15340. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15341. return smalltalk.withContext(function($ctx1) {
  15342. var $1;
  15343. $1=self._nextPutAll_(_st($String())._lf());
  15344. return $1;
  15345. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)})},
  15346. args: [],
  15347. source: "lf\x0a\x09^ self nextPutAll: String lf",
  15348. messageSends: ["nextPutAll:", "lf"],
  15349. referencedClasses: ["String"]
  15350. }),
  15351. globals.StringStream);
  15352. smalltalk.addMethod(
  15353. smalltalk.method({
  15354. selector: "next:",
  15355. protocol: 'reading',
  15356. fn: function (anInteger){
  15357. var self=this;
  15358. var tempCollection;
  15359. return smalltalk.withContext(function($ctx1) {
  15360. var $1,$2;
  15361. tempCollection=_st(_st(self._collection())._class())._new();
  15362. _st(anInteger)._timesRepeat_((function(){
  15363. return smalltalk.withContext(function($ctx2) {
  15364. $1=self._atEnd();
  15365. if(! smalltalk.assert($1)){
  15366. tempCollection=_st(tempCollection).__comma(self._next());
  15367. return tempCollection;
  15368. };
  15369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15370. $2=tempCollection;
  15371. return $2;
  15372. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)})},
  15373. args: ["anInteger"],
  15374. 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",
  15375. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  15376. referencedClasses: []
  15377. }),
  15378. globals.StringStream);
  15379. smalltalk.addMethod(
  15380. smalltalk.method({
  15381. selector: "nextPut:",
  15382. protocol: 'writing',
  15383. fn: function (aString){
  15384. var self=this;
  15385. return smalltalk.withContext(function($ctx1) {
  15386. self._nextPutAll_(aString);
  15387. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)})},
  15388. args: ["aString"],
  15389. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  15390. messageSends: ["nextPutAll:"],
  15391. referencedClasses: []
  15392. }),
  15393. globals.StringStream);
  15394. smalltalk.addMethod(
  15395. smalltalk.method({
  15396. selector: "nextPutAll:",
  15397. protocol: 'writing',
  15398. fn: function (aString){
  15399. var self=this;
  15400. var pre,post;
  15401. return smalltalk.withContext(function($ctx1) {
  15402. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  15403. $1=self._atEnd();
  15404. if(smalltalk.assert($1)){
  15405. $3=self._collection();
  15406. $ctx1.sendIdx["collection"]=1;
  15407. $2=_st($3).__comma(aString);
  15408. $ctx1.sendIdx[","]=1;
  15409. self._setCollection_($2);
  15410. $ctx1.sendIdx["setCollection:"]=1;
  15411. } else {
  15412. $4=self._collection();
  15413. $ctx1.sendIdx["collection"]=2;
  15414. $5=self._position();
  15415. $ctx1.sendIdx["position"]=1;
  15416. pre=_st($4)._copyFrom_to_((1),$5);
  15417. $ctx1.sendIdx["copyFrom:to:"]=1;
  15418. pre;
  15419. $6=self._collection();
  15420. $ctx1.sendIdx["collection"]=3;
  15421. $9=self._position();
  15422. $ctx1.sendIdx["position"]=2;
  15423. $8=_st($9).__plus((1));
  15424. $ctx1.sendIdx["+"]=2;
  15425. $10=_st(aString)._size();
  15426. $ctx1.sendIdx["size"]=1;
  15427. $7=_st($8).__plus($10);
  15428. $ctx1.sendIdx["+"]=1;
  15429. $11=_st(self._collection())._size();
  15430. $ctx1.sendIdx["size"]=2;
  15431. post=_st($6)._copyFrom_to_($7,$11);
  15432. post;
  15433. $12=_st(_st(pre).__comma(aString)).__comma(post);
  15434. $ctx1.sendIdx[","]=2;
  15435. self._setCollection_($12);
  15436. };
  15437. $14=self._position();
  15438. $ctx1.sendIdx["position"]=3;
  15439. $13=_st($14).__plus(_st(aString)._size());
  15440. self._position_($13);
  15441. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15442. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)})},
  15443. args: ["aString"],
  15444. 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)",
  15445. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  15446. referencedClasses: []
  15447. }),
  15448. globals.StringStream);
  15449. smalltalk.addMethod(
  15450. smalltalk.method({
  15451. selector: "nextPutString:",
  15452. protocol: 'writing',
  15453. fn: function (aString){
  15454. var self=this;
  15455. return smalltalk.withContext(function($ctx1) {
  15456. self._nextPutAll_(aString);
  15457. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)})},
  15458. args: ["aString"],
  15459. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  15460. messageSends: ["nextPutAll:"],
  15461. referencedClasses: []
  15462. }),
  15463. globals.StringStream);
  15464. smalltalk.addMethod(
  15465. smalltalk.method({
  15466. selector: "space",
  15467. protocol: 'writing',
  15468. fn: function (){
  15469. var self=this;
  15470. return smalltalk.withContext(function($ctx1) {
  15471. self._nextPut_(" ");
  15472. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)})},
  15473. args: [],
  15474. source: "space\x0a\x09self nextPut: ' '",
  15475. messageSends: ["nextPut:"],
  15476. referencedClasses: []
  15477. }),
  15478. globals.StringStream);
  15479. smalltalk.addMethod(
  15480. smalltalk.method({
  15481. selector: "tab",
  15482. protocol: 'writing',
  15483. fn: function (){
  15484. var self=this;
  15485. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15486. return smalltalk.withContext(function($ctx1) {
  15487. var $1;
  15488. $1=self._nextPutAll_(_st($String())._tab());
  15489. return $1;
  15490. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)})},
  15491. args: [],
  15492. source: "tab\x0a\x09^ self nextPutAll: String tab",
  15493. messageSends: ["nextPutAll:", "tab"],
  15494. referencedClasses: ["String"]
  15495. }),
  15496. globals.StringStream);
  15497. });
  15498. define("amber_core/Kernel-Infrastructure", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st, globals){
  15499. smalltalk.addPackage('Kernel-Infrastructure');
  15500. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  15501. smalltalk.addClass('ConsoleErrorHandler', globals.Object, [], 'Kernel-Infrastructure');
  15502. globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  15503. smalltalk.addMethod(
  15504. smalltalk.method({
  15505. selector: "handleError:",
  15506. protocol: 'error handling',
  15507. fn: function (anError){
  15508. var self=this;
  15509. return smalltalk.withContext(function($ctx1) {
  15510. var $1;
  15511. $1=_st(anError)._context();
  15512. $ctx1.sendIdx["context"]=1;
  15513. if(($receiver = $1) == nil || $receiver == null){
  15514. $1;
  15515. } else {
  15516. self._logErrorContext_(_st(anError)._context());
  15517. };
  15518. self._logError_(anError);
  15519. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ConsoleErrorHandler)})},
  15520. args: ["anError"],
  15521. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  15522. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
  15523. referencedClasses: []
  15524. }),
  15525. globals.ConsoleErrorHandler);
  15526. smalltalk.addMethod(
  15527. smalltalk.method({
  15528. selector: "log:",
  15529. protocol: 'private',
  15530. fn: function (aString){
  15531. var self=this;
  15532. return smalltalk.withContext(function($ctx1) {
  15533. _st(console)._log_(aString);
  15534. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},globals.ConsoleErrorHandler)})},
  15535. args: ["aString"],
  15536. source: "log: aString\x0a\x09console log: aString",
  15537. messageSends: ["log:"],
  15538. referencedClasses: []
  15539. }),
  15540. globals.ConsoleErrorHandler);
  15541. smalltalk.addMethod(
  15542. smalltalk.method({
  15543. selector: "logContext:",
  15544. protocol: 'private',
  15545. fn: function (aContext){
  15546. var self=this;
  15547. return smalltalk.withContext(function($ctx1) {
  15548. var $1;
  15549. $1=_st(aContext)._home();
  15550. $ctx1.sendIdx["home"]=1;
  15551. if(($receiver = $1) == nil || $receiver == null){
  15552. $1;
  15553. } else {
  15554. self._logContext_(_st(aContext)._home());
  15555. };
  15556. self._log_(_st(aContext)._asString());
  15557. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
  15558. args: ["aContext"],
  15559. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  15560. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"],
  15561. referencedClasses: []
  15562. }),
  15563. globals.ConsoleErrorHandler);
  15564. smalltalk.addMethod(
  15565. smalltalk.method({
  15566. selector: "logError:",
  15567. protocol: 'private',
  15568. fn: function (anError){
  15569. var self=this;
  15570. return smalltalk.withContext(function($ctx1) {
  15571. self._log_(_st(anError)._messageText());
  15572. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},globals.ConsoleErrorHandler)})},
  15573. args: ["anError"],
  15574. source: "logError: anError\x0a\x09self log: anError messageText",
  15575. messageSends: ["log:", "messageText"],
  15576. referencedClasses: []
  15577. }),
  15578. globals.ConsoleErrorHandler);
  15579. smalltalk.addMethod(
  15580. smalltalk.method({
  15581. selector: "logErrorContext:",
  15582. protocol: 'private',
  15583. fn: function (aContext){
  15584. var self=this;
  15585. return smalltalk.withContext(function($ctx1) {
  15586. var $1;
  15587. if(($receiver = aContext) == nil || $receiver == null){
  15588. aContext;
  15589. } else {
  15590. $1=_st(aContext)._home();
  15591. $ctx1.sendIdx["home"]=1;
  15592. if(($receiver = $1) == nil || $receiver == null){
  15593. $1;
  15594. } else {
  15595. self._logContext_(_st(aContext)._home());
  15596. };
  15597. };
  15598. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
  15599. args: ["aContext"],
  15600. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  15601. messageSends: ["ifNotNil:", "home", "logContext:"],
  15602. referencedClasses: []
  15603. }),
  15604. globals.ConsoleErrorHandler);
  15605. globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  15606. smalltalk.addMethod(
  15607. smalltalk.method({
  15608. selector: "initialize",
  15609. protocol: 'initialization',
  15610. fn: function (){
  15611. var self=this;
  15612. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  15613. return smalltalk.withContext(function($ctx1) {
  15614. _st($ErrorHandler())._registerIfNone_(self._new());
  15615. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleErrorHandler.klass)})},
  15616. args: [],
  15617. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  15618. messageSends: ["registerIfNone:", "new"],
  15619. referencedClasses: ["ErrorHandler"]
  15620. }),
  15621. globals.ConsoleErrorHandler.klass);
  15622. smalltalk.addClass('InterfacingObject', globals.Object, [], 'Kernel-Infrastructure');
  15623. 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 }.";
  15624. smalltalk.addMethod(
  15625. smalltalk.method({
  15626. selector: "ajax:",
  15627. protocol: 'actions',
  15628. fn: function (anObject){
  15629. var self=this;
  15630. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  15631. return smalltalk.withContext(function($ctx1) {
  15632. var $1;
  15633. $1=_st($PlatformInterface())._ajax_(anObject);
  15634. return $1;
  15635. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.InterfacingObject)})},
  15636. args: ["anObject"],
  15637. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  15638. messageSends: ["ajax:"],
  15639. referencedClasses: ["PlatformInterface"]
  15640. }),
  15641. globals.InterfacingObject);
  15642. smalltalk.addMethod(
  15643. smalltalk.method({
  15644. selector: "alert:",
  15645. protocol: 'actions',
  15646. fn: function (aString){
  15647. var self=this;
  15648. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  15649. return smalltalk.withContext(function($ctx1) {
  15650. var $1;
  15651. $1=_st($PlatformInterface())._alert_(aString);
  15652. return $1;
  15653. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.InterfacingObject)})},
  15654. args: ["aString"],
  15655. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  15656. messageSends: ["alert:"],
  15657. referencedClasses: ["PlatformInterface"]
  15658. }),
  15659. globals.InterfacingObject);
  15660. smalltalk.addMethod(
  15661. smalltalk.method({
  15662. selector: "confirm:",
  15663. protocol: 'actions',
  15664. fn: function (aString){
  15665. var self=this;
  15666. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  15667. return smalltalk.withContext(function($ctx1) {
  15668. var $1;
  15669. $1=_st($PlatformInterface())._confirm_(aString);
  15670. return $1;
  15671. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.InterfacingObject)})},
  15672. args: ["aString"],
  15673. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  15674. messageSends: ["confirm:"],
  15675. referencedClasses: ["PlatformInterface"]
  15676. }),
  15677. globals.InterfacingObject);
  15678. smalltalk.addMethod(
  15679. smalltalk.method({
  15680. selector: "prompt:",
  15681. protocol: 'actions',
  15682. fn: function (aString){
  15683. var self=this;
  15684. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  15685. return smalltalk.withContext(function($ctx1) {
  15686. var $1;
  15687. $1=_st($PlatformInterface())._prompt_(aString);
  15688. return $1;
  15689. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.InterfacingObject)})},
  15690. args: ["aString"],
  15691. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  15692. messageSends: ["prompt:"],
  15693. referencedClasses: ["PlatformInterface"]
  15694. }),
  15695. globals.InterfacingObject);
  15696. smalltalk.addClass('Environment', globals.InterfacingObject, [], 'Kernel-Infrastructure');
  15697. 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.";
  15698. smalltalk.addMethod(
  15699. smalltalk.method({
  15700. selector: "addInstVarNamed:to:",
  15701. protocol: 'compiling',
  15702. fn: function (aString,aClass){
  15703. var self=this;
  15704. return smalltalk.withContext(function($ctx1) {
  15705. var $1,$2,$3,$4,$5;
  15706. $1=self._classBuilder();
  15707. $2=_st(aClass)._superclass();
  15708. $3=_st(aClass)._name();
  15709. $ctx1.sendIdx["name"]=1;
  15710. $4=_st(_st(aClass)._instanceVariableNames())._copy();
  15711. _st($4)._add_(aString);
  15712. $5=_st($4)._yourself();
  15713. _st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
  15714. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},globals.Environment)})},
  15715. args: ["aString", "aClass"],
  15716. 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",
  15717. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
  15718. referencedClasses: []
  15719. }),
  15720. globals.Environment);
  15721. smalltalk.addMethod(
  15722. smalltalk.method({
  15723. selector: "allSelectors",
  15724. protocol: 'accessing',
  15725. fn: function (){
  15726. var self=this;
  15727. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15728. return smalltalk.withContext(function($ctx1) {
  15729. var $1;
  15730. $1=_st(_st($Smalltalk())._vm())._allSelectors();
  15731. return $1;
  15732. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Environment)})},
  15733. args: [],
  15734. source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
  15735. messageSends: ["allSelectors", "vm"],
  15736. referencedClasses: ["Smalltalk"]
  15737. }),
  15738. globals.Environment);
  15739. smalltalk.addMethod(
  15740. smalltalk.method({
  15741. selector: "availableClassNames",
  15742. protocol: 'accessing',
  15743. fn: function (){
  15744. var self=this;
  15745. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15746. return smalltalk.withContext(function($ctx1) {
  15747. var $1;
  15748. $1=_st(_st($Smalltalk())._classes())._collect_((function(each){
  15749. return smalltalk.withContext(function($ctx2) {
  15750. return _st(each)._name();
  15751. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15752. return $1;
  15753. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.Environment)})},
  15754. args: [],
  15755. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  15756. messageSends: ["collect:", "classes", "name"],
  15757. referencedClasses: ["Smalltalk"]
  15758. }),
  15759. globals.Environment);
  15760. smalltalk.addMethod(
  15761. smalltalk.method({
  15762. selector: "availablePackageNames",
  15763. protocol: 'accessing',
  15764. fn: function (){
  15765. var self=this;
  15766. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15767. return smalltalk.withContext(function($ctx1) {
  15768. var $1;
  15769. $1=_st(_st($Smalltalk())._packages())._collect_((function(each){
  15770. return smalltalk.withContext(function($ctx2) {
  15771. return _st(each)._name();
  15772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15773. return $1;
  15774. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.Environment)})},
  15775. args: [],
  15776. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  15777. messageSends: ["collect:", "packages", "name"],
  15778. referencedClasses: ["Smalltalk"]
  15779. }),
  15780. globals.Environment);
  15781. smalltalk.addMethod(
  15782. smalltalk.method({
  15783. selector: "availableProtocolsFor:",
  15784. protocol: 'accessing',
  15785. fn: function (aClass){
  15786. var self=this;
  15787. var protocols;
  15788. return smalltalk.withContext(function($ctx1) {
  15789. var $1,$2;
  15790. protocols=_st(aClass)._protocols();
  15791. $1=_st(aClass)._superclass();
  15792. $ctx1.sendIdx["superclass"]=1;
  15793. if(($receiver = $1) == nil || $receiver == null){
  15794. $1;
  15795. } else {
  15796. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  15797. };
  15798. $2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
  15799. return $2;
  15800. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},globals.Environment)})},
  15801. args: ["aClass"],
  15802. 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",
  15803. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"],
  15804. referencedClasses: []
  15805. }),
  15806. globals.Environment);
  15807. smalltalk.addMethod(
  15808. smalltalk.method({
  15809. selector: "classBuilder",
  15810. protocol: 'accessing',
  15811. fn: function (){
  15812. var self=this;
  15813. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  15814. return smalltalk.withContext(function($ctx1) {
  15815. var $1;
  15816. $1=_st($ClassBuilder())._new();
  15817. return $1;
  15818. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},globals.Environment)})},
  15819. args: [],
  15820. source: "classBuilder\x0a\x09^ ClassBuilder new",
  15821. messageSends: ["new"],
  15822. referencedClasses: ["ClassBuilder"]
  15823. }),
  15824. globals.Environment);
  15825. smalltalk.addMethod(
  15826. smalltalk.method({
  15827. selector: "classNamed:",
  15828. protocol: 'accessing',
  15829. fn: function (aString){
  15830. var self=this;
  15831. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15832. return smalltalk.withContext(function($ctx1) {
  15833. var $2,$1;
  15834. $2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
  15835. if(($receiver = $2) == nil || $receiver == null){
  15836. $1=self._error_("Invalid class name");
  15837. } else {
  15838. $1=$2;
  15839. };
  15840. return $1;
  15841. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},globals.Environment)})},
  15842. args: ["aString"],
  15843. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  15844. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"],
  15845. referencedClasses: ["Smalltalk"]
  15846. }),
  15847. globals.Environment);
  15848. smalltalk.addMethod(
  15849. smalltalk.method({
  15850. selector: "classes",
  15851. protocol: 'accessing',
  15852. fn: function (){
  15853. var self=this;
  15854. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15855. return smalltalk.withContext(function($ctx1) {
  15856. var $1;
  15857. $1=_st($Smalltalk())._classes();
  15858. return $1;
  15859. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Environment)})},
  15860. args: [],
  15861. source: "classes\x0a\x09^ Smalltalk classes",
  15862. messageSends: ["classes"],
  15863. referencedClasses: ["Smalltalk"]
  15864. }),
  15865. globals.Environment);
  15866. smalltalk.addMethod(
  15867. smalltalk.method({
  15868. selector: "commitPackage:",
  15869. protocol: 'actions',
  15870. fn: function (aPackage){
  15871. var self=this;
  15872. return smalltalk.withContext(function($ctx1) {
  15873. _st(aPackage)._commit();
  15874. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},globals.Environment)})},
  15875. args: ["aPackage"],
  15876. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  15877. messageSends: ["commit"],
  15878. referencedClasses: []
  15879. }),
  15880. globals.Environment);
  15881. smalltalk.addMethod(
  15882. smalltalk.method({
  15883. selector: "compileClassComment:for:",
  15884. protocol: 'compiling',
  15885. fn: function (aString,aClass){
  15886. var self=this;
  15887. return smalltalk.withContext(function($ctx1) {
  15888. _st(aClass)._comment_(aString);
  15889. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},globals.Environment)})},
  15890. args: ["aString", "aClass"],
  15891. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  15892. messageSends: ["comment:"],
  15893. referencedClasses: []
  15894. }),
  15895. globals.Environment);
  15896. smalltalk.addMethod(
  15897. smalltalk.method({
  15898. selector: "compileClassDefinition:",
  15899. protocol: 'compiling',
  15900. fn: function (aString){
  15901. var self=this;
  15902. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  15903. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  15904. return smalltalk.withContext(function($ctx1) {
  15905. _st((function(){
  15906. return smalltalk.withContext(function($ctx2) {
  15907. return self._eval_on_(aString,_st($DoIt())._new());
  15908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  15909. return smalltalk.withContext(function($ctx2) {
  15910. return self._alert_(_st(error)._messageText());
  15911. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  15912. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.Environment)})},
  15913. args: ["aString"],
  15914. source: "compileClassDefinition: aString\x0a\x09[ self eval: aString on: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  15915. messageSends: ["on:do:", "eval:on:", "new", "alert:", "messageText"],
  15916. referencedClasses: ["DoIt", "Error"]
  15917. }),
  15918. globals.Environment);
  15919. smalltalk.addMethod(
  15920. smalltalk.method({
  15921. selector: "compileMethod:for:protocol:",
  15922. protocol: 'compiling',
  15923. fn: function (sourceCode,class_,protocol){
  15924. var self=this;
  15925. return smalltalk.withContext(function($ctx1) {
  15926. var $1;
  15927. $1=_st(class_)._compile_protocol_(sourceCode,protocol);
  15928. return $1;
  15929. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},globals.Environment)})},
  15930. args: ["sourceCode", "class", "protocol"],
  15931. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  15932. messageSends: ["compile:protocol:"],
  15933. referencedClasses: []
  15934. }),
  15935. globals.Environment);
  15936. smalltalk.addMethod(
  15937. smalltalk.method({
  15938. selector: "copyClass:to:",
  15939. protocol: 'actions',
  15940. fn: function (aClass,aClassName){
  15941. var self=this;
  15942. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15943. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  15944. return smalltalk.withContext(function($ctx1) {
  15945. var $1,$2;
  15946. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  15947. if(($receiver = $1) == nil || $receiver == null){
  15948. $1;
  15949. } else {
  15950. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  15951. $ctx1.sendIdx[","]=1;
  15952. self._error_($2);
  15953. };
  15954. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  15955. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
  15956. args: ["aClass", "aClassName"],
  15957. 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",
  15958. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"],
  15959. referencedClasses: ["Smalltalk", "ClassBuilder"]
  15960. }),
  15961. globals.Environment);
  15962. smalltalk.addMethod(
  15963. smalltalk.method({
  15964. selector: "doItReceiver",
  15965. protocol: 'accessing',
  15966. fn: function (){
  15967. var self=this;
  15968. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  15969. return smalltalk.withContext(function($ctx1) {
  15970. var $1;
  15971. $1=_st($DoIt())._new();
  15972. return $1;
  15973. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},globals.Environment)})},
  15974. args: [],
  15975. source: "doItReceiver\x0a\x09^ DoIt new",
  15976. messageSends: ["new"],
  15977. referencedClasses: ["DoIt"]
  15978. }),
  15979. globals.Environment);
  15980. smalltalk.addMethod(
  15981. smalltalk.method({
  15982. selector: "eval:on:",
  15983. protocol: 'evaluating',
  15984. fn: function (aString,aReceiver){
  15985. var self=this;
  15986. var compiler;
  15987. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  15988. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  15989. return smalltalk.withContext(function($ctx1) {
  15990. var $1,$2;
  15991. var $early={};
  15992. try {
  15993. compiler=_st($Compiler())._new();
  15994. _st((function(){
  15995. return smalltalk.withContext(function($ctx2) {
  15996. return _st(compiler)._parseExpression_(aString);
  15997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  15998. return smalltalk.withContext(function($ctx2) {
  15999. $1=self._alert_(_st(ex)._messageText());
  16000. throw $early=[$1];
  16001. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  16002. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  16003. return $2;
  16004. }
  16005. catch(e) {if(e===$early)return e[0]; throw e}
  16006. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},globals.Environment)})},
  16007. args: ["aString", "aReceiver"],
  16008. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ self alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  16009. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
  16010. referencedClasses: ["Compiler", "Error"]
  16011. }),
  16012. globals.Environment);
  16013. smalltalk.addMethod(
  16014. smalltalk.method({
  16015. selector: "evaluate:on:do:",
  16016. protocol: 'error handling',
  16017. fn: function (aBlock,anErrorClass,exceptionBlock){
  16018. var self=this;
  16019. return smalltalk.withContext(function($ctx1) {
  16020. var $1;
  16021. self._try_catch_(aBlock,(function(exception){
  16022. return smalltalk.withContext(function($ctx2) {
  16023. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  16024. if(smalltalk.assert($1)){
  16025. return _st(exceptionBlock)._value_(exception);
  16026. } else {
  16027. return _st(exception)._signal();
  16028. };
  16029. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
  16030. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},globals.Environment)})},
  16031. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  16032. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  16033. messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
  16034. referencedClasses: []
  16035. }),
  16036. globals.Environment);
  16037. smalltalk.addMethod(
  16038. smalltalk.method({
  16039. selector: "inspect:",
  16040. protocol: 'actions',
  16041. fn: function (anObject){
  16042. var self=this;
  16043. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  16044. return smalltalk.withContext(function($ctx1) {
  16045. _st($Inspector())._inspect_(anObject);
  16046. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Environment)})},
  16047. args: ["anObject"],
  16048. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  16049. messageSends: ["inspect:"],
  16050. referencedClasses: ["Inspector"]
  16051. }),
  16052. globals.Environment);
  16053. smalltalk.addMethod(
  16054. smalltalk.method({
  16055. selector: "interpret:inContext:",
  16056. protocol: 'evaluating',
  16057. fn: function (aString,anAIContext){
  16058. var self=this;
  16059. var compiler,ast;
  16060. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  16061. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  16062. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  16063. return smalltalk.withContext(function($ctx1) {
  16064. var $1,$2;
  16065. var $early={};
  16066. try {
  16067. compiler=_st($Compiler())._new();
  16068. _st((function(){
  16069. return smalltalk.withContext(function($ctx2) {
  16070. ast=_st(compiler)._parseExpression_(aString);
  16071. return ast;
  16072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  16073. return smalltalk.withContext(function($ctx2) {
  16074. $1=self._alert_(_st(ex)._messageText());
  16075. throw $early=[$1];
  16076. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  16077. _st(_st($SemanticAnalyzer())._on_(_st(_st(anAIContext)._receiver())._class()))._visit_(ast);
  16078. $2=_st(anAIContext)._evaluateNode_(ast);
  16079. return $2;
  16080. }
  16081. catch(e) {if(e===$early)return e[0]; throw e}
  16082. }, function($ctx1) {$ctx1.fill(self,"interpret:inContext:",{aString:aString,anAIContext:anAIContext,compiler:compiler,ast:ast},globals.Environment)})},
  16083. args: ["aString", "anAIContext"],
  16084. source: "interpret: aString inContext: anAIContext\x0a\x09\x22Similar to #eval:on:, 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 `anAIContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ self alert: ex messageText ].\x0a\x09(SemanticAnalyzer on: anAIContext receiver class)\x0a\x09\x09visit: ast.\x0a\x09^ anAIContext evaluateNode: ast",
  16085. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "visit:", "on:", "class", "receiver", "evaluateNode:"],
  16086. referencedClasses: ["Compiler", "Error", "SemanticAnalyzer"]
  16087. }),
  16088. globals.Environment);
  16089. smalltalk.addMethod(
  16090. smalltalk.method({
  16091. selector: "moveClass:toPackage:",
  16092. protocol: 'actions',
  16093. fn: function (aClass,aPackageName){
  16094. var self=this;
  16095. var package_;
  16096. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  16097. return smalltalk.withContext(function($ctx1) {
  16098. var $1,$2;
  16099. package_=_st($Package())._named_(aPackageName);
  16100. $1=package_;
  16101. if(($receiver = $1) == nil || $receiver == null){
  16102. self._error_("Invalid package name");
  16103. } else {
  16104. $1;
  16105. };
  16106. $2=_st(package_).__eq_eq(_st(aClass)._package());
  16107. if(smalltalk.assert($2)){
  16108. return self;
  16109. };
  16110. _st(aClass)._package_(package_);
  16111. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)})},
  16112. args: ["aClass", "aPackageName"],
  16113. 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",
  16114. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  16115. referencedClasses: ["Package"]
  16116. }),
  16117. globals.Environment);
  16118. smalltalk.addMethod(
  16119. smalltalk.method({
  16120. selector: "moveMethod:toClass:",
  16121. protocol: 'actions',
  16122. fn: function (aMethod,aClassName){
  16123. var self=this;
  16124. var destinationClass;
  16125. return smalltalk.withContext(function($ctx1) {
  16126. var $2,$3,$1;
  16127. destinationClass=self._classNamed_(aClassName);
  16128. $2=destinationClass;
  16129. $3=_st(aMethod)._methodClass();
  16130. $ctx1.sendIdx["methodClass"]=1;
  16131. $1=_st($2).__eq_eq($3);
  16132. if(smalltalk.assert($1)){
  16133. return self;
  16134. };
  16135. _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
  16136. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  16137. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)})},
  16138. args: ["aMethod", "aClassName"],
  16139. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  16140. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
  16141. referencedClasses: []
  16142. }),
  16143. globals.Environment);
  16144. smalltalk.addMethod(
  16145. smalltalk.method({
  16146. selector: "moveMethod:toProtocol:",
  16147. protocol: 'actions',
  16148. fn: function (aMethod,aProtocol){
  16149. var self=this;
  16150. return smalltalk.withContext(function($ctx1) {
  16151. _st(aMethod)._protocol_(aProtocol);
  16152. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)})},
  16153. args: ["aMethod", "aProtocol"],
  16154. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  16155. messageSends: ["protocol:"],
  16156. referencedClasses: []
  16157. }),
  16158. globals.Environment);
  16159. smalltalk.addMethod(
  16160. smalltalk.method({
  16161. selector: "packages",
  16162. protocol: 'accessing',
  16163. fn: function (){
  16164. var self=this;
  16165. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16166. return smalltalk.withContext(function($ctx1) {
  16167. var $1;
  16168. $1=_st($Smalltalk())._packages();
  16169. return $1;
  16170. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)})},
  16171. args: [],
  16172. source: "packages\x0a\x09^ Smalltalk packages",
  16173. messageSends: ["packages"],
  16174. referencedClasses: ["Smalltalk"]
  16175. }),
  16176. globals.Environment);
  16177. smalltalk.addMethod(
  16178. smalltalk.method({
  16179. selector: "registerErrorHandler:",
  16180. protocol: 'services',
  16181. fn: function (anErrorHandler){
  16182. var self=this;
  16183. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  16184. return smalltalk.withContext(function($ctx1) {
  16185. _st($ErrorHandler())._register_(anErrorHandler);
  16186. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)})},
  16187. args: ["anErrorHandler"],
  16188. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  16189. messageSends: ["register:"],
  16190. referencedClasses: ["ErrorHandler"]
  16191. }),
  16192. globals.Environment);
  16193. smalltalk.addMethod(
  16194. smalltalk.method({
  16195. selector: "registerInspector:",
  16196. protocol: 'services',
  16197. fn: function (anInspector){
  16198. var self=this;
  16199. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  16200. return smalltalk.withContext(function($ctx1) {
  16201. _st($Inspector())._register_(anInspector);
  16202. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)})},
  16203. args: ["anInspector"],
  16204. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  16205. messageSends: ["register:"],
  16206. referencedClasses: ["Inspector"]
  16207. }),
  16208. globals.Environment);
  16209. smalltalk.addMethod(
  16210. smalltalk.method({
  16211. selector: "registerProgressHandler:",
  16212. protocol: 'services',
  16213. fn: function (aProgressHandler){
  16214. var self=this;
  16215. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  16216. return smalltalk.withContext(function($ctx1) {
  16217. _st($ProgressHandler())._register_(aProgressHandler);
  16218. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)})},
  16219. args: ["aProgressHandler"],
  16220. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  16221. messageSends: ["register:"],
  16222. referencedClasses: ["ProgressHandler"]
  16223. }),
  16224. globals.Environment);
  16225. smalltalk.addMethod(
  16226. smalltalk.method({
  16227. selector: "registerTranscript:",
  16228. protocol: 'services',
  16229. fn: function (aTranscript){
  16230. var self=this;
  16231. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  16232. return smalltalk.withContext(function($ctx1) {
  16233. _st($Transcript())._register_(aTranscript);
  16234. return self}, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)})},
  16235. args: ["aTranscript"],
  16236. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  16237. messageSends: ["register:"],
  16238. referencedClasses: ["Transcript"]
  16239. }),
  16240. globals.Environment);
  16241. smalltalk.addMethod(
  16242. smalltalk.method({
  16243. selector: "removeClass:",
  16244. protocol: 'actions',
  16245. fn: function (aClass){
  16246. var self=this;
  16247. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16248. return smalltalk.withContext(function($ctx1) {
  16249. _st($Smalltalk())._removeClass_(aClass);
  16250. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)})},
  16251. args: ["aClass"],
  16252. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  16253. messageSends: ["removeClass:"],
  16254. referencedClasses: ["Smalltalk"]
  16255. }),
  16256. globals.Environment);
  16257. smalltalk.addMethod(
  16258. smalltalk.method({
  16259. selector: "removeMethod:",
  16260. protocol: 'actions',
  16261. fn: function (aMethod){
  16262. var self=this;
  16263. return smalltalk.withContext(function($ctx1) {
  16264. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  16265. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)})},
  16266. args: ["aMethod"],
  16267. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  16268. messageSends: ["removeCompiledMethod:", "methodClass"],
  16269. referencedClasses: []
  16270. }),
  16271. globals.Environment);
  16272. smalltalk.addMethod(
  16273. smalltalk.method({
  16274. selector: "removeProtocol:from:",
  16275. protocol: 'actions',
  16276. fn: function (aString,aClass){
  16277. var self=this;
  16278. return smalltalk.withContext(function($ctx1) {
  16279. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  16280. return smalltalk.withContext(function($ctx2) {
  16281. return _st(aClass)._removeCompiledMethod_(each);
  16282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16283. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)})},
  16284. args: ["aString", "aClass"],
  16285. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  16286. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"],
  16287. referencedClasses: []
  16288. }),
  16289. globals.Environment);
  16290. smalltalk.addMethod(
  16291. smalltalk.method({
  16292. selector: "renameClass:to:",
  16293. protocol: 'actions',
  16294. fn: function (aClass,aClassName){
  16295. var self=this;
  16296. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16297. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  16298. return smalltalk.withContext(function($ctx1) {
  16299. var $1,$2;
  16300. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  16301. if(($receiver = $1) == nil || $receiver == null){
  16302. $1;
  16303. } else {
  16304. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  16305. $ctx1.sendIdx[","]=1;
  16306. self._error_($2);
  16307. };
  16308. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  16309. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
  16310. args: ["aClass", "aClassName"],
  16311. 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",
  16312. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"],
  16313. referencedClasses: ["Smalltalk", "ClassBuilder"]
  16314. }),
  16315. globals.Environment);
  16316. smalltalk.addMethod(
  16317. smalltalk.method({
  16318. selector: "renameProtocol:to:in:",
  16319. protocol: 'actions',
  16320. fn: function (aString,anotherString,aClass){
  16321. var self=this;
  16322. return smalltalk.withContext(function($ctx1) {
  16323. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  16324. return smalltalk.withContext(function($ctx2) {
  16325. return _st(each)._protocol_(anotherString);
  16326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16327. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)})},
  16328. args: ["aString", "anotherString", "aClass"],
  16329. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  16330. messageSends: ["do:", "methodsInProtocol:", "protocol:"],
  16331. referencedClasses: []
  16332. }),
  16333. globals.Environment);
  16334. smalltalk.addMethod(
  16335. smalltalk.method({
  16336. selector: "setClassCommentOf:to:",
  16337. protocol: 'actions',
  16338. fn: function (aClass,aString){
  16339. var self=this;
  16340. return smalltalk.withContext(function($ctx1) {
  16341. _st(aClass)._comment_(aString);
  16342. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)})},
  16343. args: ["aClass", "aString"],
  16344. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  16345. messageSends: ["comment:"],
  16346. referencedClasses: []
  16347. }),
  16348. globals.Environment);
  16349. smalltalk.addMethod(
  16350. smalltalk.method({
  16351. selector: "systemAnnouncer",
  16352. protocol: 'accessing',
  16353. fn: function (){
  16354. var self=this;
  16355. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16356. return smalltalk.withContext(function($ctx1) {
  16357. var $1;
  16358. $1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  16359. return $1;
  16360. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)})},
  16361. args: [],
  16362. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  16363. messageSends: ["current", "at:", "globals"],
  16364. referencedClasses: ["Smalltalk"]
  16365. }),
  16366. globals.Environment);
  16367. smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  16368. 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`.";
  16369. smalltalk.addMethod(
  16370. smalltalk.method({
  16371. selector: "=",
  16372. protocol: 'comparing',
  16373. fn: function (anObject){
  16374. var self=this;
  16375. return smalltalk.withContext(function($ctx1) {
  16376. var $2,$1,$3;
  16377. $2=_st(anObject)._class();
  16378. $ctx1.sendIdx["class"]=1;
  16379. $1=_st($2).__eq_eq(self._class());
  16380. if(! smalltalk.assert($1)){
  16381. return false;
  16382. };
  16383. $3=self._compareJSObjectWith_(_st(anObject)._jsObject());
  16384. return $3;
  16385. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)})},
  16386. args: ["anObject"],
  16387. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
  16388. messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"],
  16389. referencedClasses: []
  16390. }),
  16391. globals.JSObjectProxy);
  16392. smalltalk.addMethod(
  16393. smalltalk.method({
  16394. selector: "addObjectVariablesTo:",
  16395. protocol: 'proxy',
  16396. fn: function (aDictionary){
  16397. var self=this;
  16398. return smalltalk.withContext(function($ctx1) {
  16399. for(var i in self['@jsObject']) {
  16400. aDictionary._at_put_(i, self['@jsObject'][i]);
  16401. }
  16402. ;
  16403. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)})},
  16404. args: ["aDictionary"],
  16405. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
  16406. messageSends: [],
  16407. referencedClasses: []
  16408. }),
  16409. globals.JSObjectProxy);
  16410. smalltalk.addMethod(
  16411. smalltalk.method({
  16412. selector: "asJSON",
  16413. protocol: 'enumerating',
  16414. fn: function (){
  16415. var self=this;
  16416. var $1;
  16417. $1=self["@jsObject"];
  16418. return $1;
  16419. },
  16420. args: [],
  16421. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  16422. messageSends: [],
  16423. referencedClasses: []
  16424. }),
  16425. globals.JSObjectProxy);
  16426. smalltalk.addMethod(
  16427. smalltalk.method({
  16428. selector: "at:",
  16429. protocol: 'accessing',
  16430. fn: function (aString){
  16431. var self=this;
  16432. return smalltalk.withContext(function($ctx1) {
  16433. return self['@jsObject'][aString];
  16434. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)})},
  16435. args: ["aString"],
  16436. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  16437. messageSends: [],
  16438. referencedClasses: []
  16439. }),
  16440. globals.JSObjectProxy);
  16441. smalltalk.addMethod(
  16442. smalltalk.method({
  16443. selector: "at:ifAbsent:",
  16444. protocol: 'accessing',
  16445. fn: function (aString,aBlock){
  16446. var self=this;
  16447. return smalltalk.withContext(function($ctx1) {
  16448. var obj = self['@jsObject'];
  16449. return aString in obj ? obj[aString] : aBlock._value();
  16450. ;
  16451. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  16452. args: ["aString", "aBlock"],
  16453. 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>",
  16454. messageSends: [],
  16455. referencedClasses: []
  16456. }),
  16457. globals.JSObjectProxy);
  16458. smalltalk.addMethod(
  16459. smalltalk.method({
  16460. selector: "at:ifPresent:",
  16461. protocol: 'accessing',
  16462. fn: function (aString,aBlock){
  16463. var self=this;
  16464. return smalltalk.withContext(function($ctx1) {
  16465. var obj = self['@jsObject'];
  16466. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  16467. ;
  16468. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  16469. args: ["aString", "aBlock"],
  16470. 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>",
  16471. messageSends: [],
  16472. referencedClasses: []
  16473. }),
  16474. globals.JSObjectProxy);
  16475. smalltalk.addMethod(
  16476. smalltalk.method({
  16477. selector: "at:ifPresent:ifAbsent:",
  16478. protocol: 'accessing',
  16479. fn: function (aString,aBlock,anotherBlock){
  16480. var self=this;
  16481. return smalltalk.withContext(function($ctx1) {
  16482. var obj = self['@jsObject'];
  16483. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  16484. ;
  16485. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)})},
  16486. args: ["aString", "aBlock", "anotherBlock"],
  16487. 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>",
  16488. messageSends: [],
  16489. referencedClasses: []
  16490. }),
  16491. globals.JSObjectProxy);
  16492. smalltalk.addMethod(
  16493. smalltalk.method({
  16494. selector: "at:put:",
  16495. protocol: 'accessing',
  16496. fn: function (aString,anObject){
  16497. var self=this;
  16498. return smalltalk.withContext(function($ctx1) {
  16499. return self['@jsObject'][aString] = anObject;
  16500. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)})},
  16501. args: ["aString", "anObject"],
  16502. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  16503. messageSends: [],
  16504. referencedClasses: []
  16505. }),
  16506. globals.JSObjectProxy);
  16507. smalltalk.addMethod(
  16508. smalltalk.method({
  16509. selector: "compareJSObjectWith:",
  16510. protocol: 'private',
  16511. fn: function (aJSObject){
  16512. var self=this;
  16513. return smalltalk.withContext(function($ctx1) {
  16514. return self["@jsObject"] === aJSObject;
  16515. return self}, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)})},
  16516. args: ["aJSObject"],
  16517. source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
  16518. messageSends: [],
  16519. referencedClasses: []
  16520. }),
  16521. globals.JSObjectProxy);
  16522. smalltalk.addMethod(
  16523. smalltalk.method({
  16524. selector: "doesNotUnderstand:",
  16525. protocol: 'proxy',
  16526. fn: function (aMessage){
  16527. var self=this;
  16528. return smalltalk.withContext(function($ctx1) {
  16529. var $2,$1;
  16530. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  16531. if(($receiver = $2) == nil || $receiver == null){
  16532. $1=globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  16533. } else {
  16534. var jsSelector;
  16535. jsSelector=$receiver;
  16536. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  16537. };
  16538. return $1;
  16539. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)})},
  16540. args: ["aMessage"],
  16541. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
  16542. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
  16543. referencedClasses: []
  16544. }),
  16545. globals.JSObjectProxy);
  16546. smalltalk.addMethod(
  16547. smalltalk.method({
  16548. selector: "forwardMessage:withArguments:",
  16549. protocol: 'proxy',
  16550. fn: function (aString,anArray){
  16551. var self=this;
  16552. return smalltalk.withContext(function($ctx1) {
  16553. return smalltalk.send(self._jsObject(), aString, anArray);
  16554. ;
  16555. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)})},
  16556. args: ["aString", "anArray"],
  16557. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  16558. messageSends: [],
  16559. referencedClasses: []
  16560. }),
  16561. globals.JSObjectProxy);
  16562. smalltalk.addMethod(
  16563. smalltalk.method({
  16564. selector: "inspectOn:",
  16565. protocol: 'proxy',
  16566. fn: function (anInspector){
  16567. var self=this;
  16568. var variables;
  16569. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  16570. return smalltalk.withContext(function($ctx1) {
  16571. variables=_st($Dictionary())._new();
  16572. _st(variables)._at_put_("#self",self._jsObject());
  16573. _st(anInspector)._setLabel_(self._printString());
  16574. self._addObjectVariablesTo_(variables);
  16575. _st(anInspector)._setVariables_(variables);
  16576. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)})},
  16577. args: ["anInspector"],
  16578. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
  16579. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  16580. referencedClasses: ["Dictionary"]
  16581. }),
  16582. globals.JSObjectProxy);
  16583. smalltalk.addMethod(
  16584. smalltalk.method({
  16585. selector: "jsObject",
  16586. protocol: 'accessing',
  16587. fn: function (){
  16588. var self=this;
  16589. var $1;
  16590. $1=self["@jsObject"];
  16591. return $1;
  16592. },
  16593. args: [],
  16594. source: "jsObject\x0a\x09^ jsObject",
  16595. messageSends: [],
  16596. referencedClasses: []
  16597. }),
  16598. globals.JSObjectProxy);
  16599. smalltalk.addMethod(
  16600. smalltalk.method({
  16601. selector: "jsObject:",
  16602. protocol: 'accessing',
  16603. fn: function (aJSObject){
  16604. var self=this;
  16605. self["@jsObject"]=aJSObject;
  16606. return self},
  16607. args: ["aJSObject"],
  16608. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  16609. messageSends: [],
  16610. referencedClasses: []
  16611. }),
  16612. globals.JSObjectProxy);
  16613. smalltalk.addMethod(
  16614. smalltalk.method({
  16615. selector: "keysAndValuesDo:",
  16616. protocol: 'enumerating',
  16617. fn: function (aBlock){
  16618. var self=this;
  16619. return smalltalk.withContext(function($ctx1) {
  16620. var o = self['@jsObject'];
  16621. for(var i in o) {
  16622. aBlock._value_value_(i, o[i]);
  16623. }
  16624. ;
  16625. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)})},
  16626. args: ["aBlock"],
  16627. 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>",
  16628. messageSends: [],
  16629. referencedClasses: []
  16630. }),
  16631. globals.JSObjectProxy);
  16632. smalltalk.addMethod(
  16633. smalltalk.method({
  16634. selector: "lookupProperty:",
  16635. protocol: 'accessing',
  16636. fn: function (aString){
  16637. var self=this;
  16638. return smalltalk.withContext(function($ctx1) {
  16639. return aString in self._jsObject() ? aString : nil;
  16640. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)})},
  16641. args: ["aString"],
  16642. source: "lookupProperty: aString\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 self._jsObject() ? aString : nil>",
  16643. messageSends: [],
  16644. referencedClasses: []
  16645. }),
  16646. globals.JSObjectProxy);
  16647. smalltalk.addMethod(
  16648. smalltalk.method({
  16649. selector: "printOn:",
  16650. protocol: 'printing',
  16651. fn: function (aStream){
  16652. var self=this;
  16653. return smalltalk.withContext(function($ctx1) {
  16654. _st(aStream)._nextPutAll_(self._printString());
  16655. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)})},
  16656. args: ["aStream"],
  16657. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  16658. messageSends: ["nextPutAll:", "printString"],
  16659. referencedClasses: []
  16660. }),
  16661. globals.JSObjectProxy);
  16662. smalltalk.addMethod(
  16663. smalltalk.method({
  16664. selector: "printString",
  16665. protocol: 'printing',
  16666. fn: function (){
  16667. var self=this;
  16668. return smalltalk.withContext(function($ctx1) {
  16669. var js = self['@jsObject'];
  16670. return js.toString
  16671. ? js.toString()
  16672. : Object.prototype.toString.call(js)
  16673. ;
  16674. return self}, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)})},
  16675. args: [],
  16676. 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>",
  16677. messageSends: [],
  16678. referencedClasses: []
  16679. }),
  16680. globals.JSObjectProxy);
  16681. smalltalk.addMethod(
  16682. smalltalk.method({
  16683. selector: "on:",
  16684. protocol: 'instance creation',
  16685. fn: function (aJSObject){
  16686. var self=this;
  16687. return smalltalk.withContext(function($ctx1) {
  16688. var $2,$3,$1;
  16689. $2=self._new();
  16690. _st($2)._jsObject_(aJSObject);
  16691. $3=_st($2)._yourself();
  16692. $1=$3;
  16693. return $1;
  16694. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)})},
  16695. args: ["aJSObject"],
  16696. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  16697. messageSends: ["jsObject:", "new", "yourself"],
  16698. referencedClasses: []
  16699. }),
  16700. globals.JSObjectProxy.klass);
  16701. smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
  16702. globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  16703. smalltalk.addMethod(
  16704. smalltalk.method({
  16705. selector: "do:on:displaying:",
  16706. protocol: 'progress handling',
  16707. fn: function (aBlock,aCollection,aString){
  16708. var self=this;
  16709. return smalltalk.withContext(function($ctx1) {
  16710. _st(aCollection)._do_(aBlock);
  16711. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)})},
  16712. args: ["aBlock", "aCollection", "aString"],
  16713. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  16714. messageSends: ["do:"],
  16715. referencedClasses: []
  16716. }),
  16717. globals.NullProgressHandler);
  16718. globals.NullProgressHandler.klass.iVarNames = ['current'];
  16719. smalltalk.addMethod(
  16720. smalltalk.method({
  16721. selector: "initialize",
  16722. protocol: 'initialization',
  16723. fn: function (){
  16724. var self=this;
  16725. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  16726. return smalltalk.withContext(function($ctx1) {
  16727. _st($ProgressHandler())._registerIfNone_(self._new());
  16728. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)})},
  16729. args: [],
  16730. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  16731. messageSends: ["registerIfNone:", "new"],
  16732. referencedClasses: ["ProgressHandler"]
  16733. }),
  16734. globals.NullProgressHandler.klass);
  16735. smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
  16736. globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  16737. smalltalk.addMethod(
  16738. smalltalk.method({
  16739. selector: "addElement:",
  16740. protocol: 'accessing',
  16741. fn: function (anObject){
  16742. var self=this;
  16743. return smalltalk.withContext(function($ctx1) {
  16744. self.elements.addElement(anObject);
  16745. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)})},
  16746. args: ["anObject"],
  16747. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  16748. messageSends: [],
  16749. referencedClasses: []
  16750. }),
  16751. globals.Organizer);
  16752. smalltalk.addMethod(
  16753. smalltalk.method({
  16754. selector: "elements",
  16755. protocol: 'accessing',
  16756. fn: function (){
  16757. var self=this;
  16758. return smalltalk.withContext(function($ctx1) {
  16759. var $1;
  16760. $1=_st(self._basicAt_("elements"))._copy();
  16761. return $1;
  16762. }, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)})},
  16763. args: [],
  16764. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  16765. messageSends: ["copy", "basicAt:"],
  16766. referencedClasses: []
  16767. }),
  16768. globals.Organizer);
  16769. smalltalk.addMethod(
  16770. smalltalk.method({
  16771. selector: "removeElement:",
  16772. protocol: 'accessing',
  16773. fn: function (anObject){
  16774. var self=this;
  16775. return smalltalk.withContext(function($ctx1) {
  16776. self.elements.removeElement(anObject);
  16777. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)})},
  16778. args: ["anObject"],
  16779. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  16780. messageSends: [],
  16781. referencedClasses: []
  16782. }),
  16783. globals.Organizer);
  16784. smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  16785. globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  16786. smalltalk.addMethod(
  16787. smalltalk.method({
  16788. selector: "addElement:",
  16789. protocol: 'accessing',
  16790. fn: function (aString){
  16791. var self=this;
  16792. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  16793. function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  16794. return smalltalk.withContext(function($ctx1) {
  16795. var $1,$2;
  16796. globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]);
  16797. $1=_st($ProtocolAdded())._new();
  16798. _st($1)._protocol_(aString);
  16799. _st($1)._theClass_(self._theClass());
  16800. $2=_st($1)._yourself();
  16801. _st(_st($SystemAnnouncer())._current())._announce_($2);
  16802. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)})},
  16803. args: ["aString"],
  16804. 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)",
  16805. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  16806. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
  16807. }),
  16808. globals.ClassOrganizer);
  16809. smalltalk.addMethod(
  16810. smalltalk.method({
  16811. selector: "removeElement:",
  16812. protocol: 'accessing',
  16813. fn: function (aString){
  16814. var self=this;
  16815. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  16816. function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  16817. return smalltalk.withContext(function($ctx1) {
  16818. var $1,$2;
  16819. globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]);
  16820. $1=_st($ProtocolRemoved())._new();
  16821. _st($1)._protocol_(aString);
  16822. _st($1)._theClass_(self._theClass());
  16823. $2=_st($1)._yourself();
  16824. _st(_st($SystemAnnouncer())._current())._announce_($2);
  16825. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)})},
  16826. args: ["aString"],
  16827. 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)",
  16828. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  16829. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
  16830. }),
  16831. globals.ClassOrganizer);
  16832. smalltalk.addMethod(
  16833. smalltalk.method({
  16834. selector: "theClass",
  16835. protocol: 'accessing',
  16836. fn: function (){
  16837. var self=this;
  16838. return smalltalk.withContext(function($ctx1) {
  16839. return self.theClass ;
  16840. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)})},
  16841. args: [],
  16842. source: "theClass\x0a\x09< return self.theClass >",
  16843. messageSends: [],
  16844. referencedClasses: []
  16845. }),
  16846. globals.ClassOrganizer);
  16847. smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  16848. globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  16849. smalltalk.addClass('Package', globals.Object, ['transport'], 'Kernel-Infrastructure');
  16850. 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'";
  16851. smalltalk.addMethod(
  16852. smalltalk.method({
  16853. selector: "basicTransport",
  16854. protocol: 'accessing',
  16855. fn: function (){
  16856. var self=this;
  16857. return smalltalk.withContext(function($ctx1) {
  16858. return self.transport;
  16859. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)})},
  16860. args: [],
  16861. 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>",
  16862. messageSends: [],
  16863. referencedClasses: []
  16864. }),
  16865. globals.Package);
  16866. smalltalk.addMethod(
  16867. smalltalk.method({
  16868. selector: "classTemplate",
  16869. protocol: 'accessing',
  16870. fn: function (){
  16871. var self=this;
  16872. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  16873. return smalltalk.withContext(function($ctx1) {
  16874. var $3,$4,$2,$5,$6,$7,$1;
  16875. $1=_st($String())._streamContents_((function(stream){
  16876. return smalltalk.withContext(function($ctx2) {
  16877. _st(stream)._nextPutAll_("Object");
  16878. $ctx2.sendIdx["nextPutAll:"]=1;
  16879. _st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  16880. $ctx2.sendIdx["nextPutAll:"]=2;
  16881. $3=_st($String())._lf();
  16882. $ctx2.sendIdx["lf"]=1;
  16883. $4=_st($String())._tab();
  16884. $ctx2.sendIdx["tab"]=1;
  16885. $2=_st($3).__comma($4);
  16886. $ctx2.sendIdx[","]=1;
  16887. _st(stream)._nextPutAll_($2);
  16888. $ctx2.sendIdx["nextPutAll:"]=3;
  16889. $5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
  16890. $ctx2.sendIdx["nextPutAll:"]=4;
  16891. $5;
  16892. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  16893. $ctx2.sendIdx[","]=2;
  16894. _st(stream)._nextPutAll_($6);
  16895. $ctx2.sendIdx["nextPutAll:"]=5;
  16896. _st(stream)._nextPutAll_("package: '");
  16897. $ctx2.sendIdx["nextPutAll:"]=6;
  16898. _st(stream)._nextPutAll_(self._name());
  16899. $ctx2.sendIdx["nextPutAll:"]=7;
  16900. $7=_st(stream)._nextPutAll_("'");
  16901. return $7;
  16902. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  16903. return $1;
  16904. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)})},
  16905. args: [],
  16906. 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: '''' ]",
  16907. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"],
  16908. referencedClasses: ["String"]
  16909. }),
  16910. globals.Package);
  16911. smalltalk.addMethod(
  16912. smalltalk.method({
  16913. selector: "classes",
  16914. protocol: 'classes',
  16915. fn: function (){
  16916. var self=this;
  16917. return smalltalk.withContext(function($ctx1) {
  16918. var $1;
  16919. $1=_st(self._organization())._elements();
  16920. return $1;
  16921. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)})},
  16922. args: [],
  16923. source: "classes\x0a\x09^ self organization elements",
  16924. messageSends: ["elements", "organization"],
  16925. referencedClasses: []
  16926. }),
  16927. globals.Package);
  16928. smalltalk.addMethod(
  16929. smalltalk.method({
  16930. selector: "definition",
  16931. protocol: 'accessing',
  16932. fn: function (){
  16933. var self=this;
  16934. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  16935. return smalltalk.withContext(function($ctx1) {
  16936. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  16937. $1=_st($String())._streamContents_((function(stream){
  16938. return smalltalk.withContext(function($ctx2) {
  16939. $2=_st(self._class())._name();
  16940. $ctx2.sendIdx["name"]=1;
  16941. _st(stream)._nextPutAll_($2);
  16942. $ctx2.sendIdx["nextPutAll:"]=1;
  16943. $4=_st($String())._lf();
  16944. $ctx2.sendIdx["lf"]=1;
  16945. $5=_st($String())._tab();
  16946. $ctx2.sendIdx["tab"]=1;
  16947. $3=_st($4).__comma($5);
  16948. $ctx2.sendIdx[","]=1;
  16949. _st(stream)._nextPutAll_($3);
  16950. $ctx2.sendIdx["nextPutAll:"]=2;
  16951. _st(stream)._nextPutAll_(" named: ");
  16952. $ctx2.sendIdx["nextPutAll:"]=3;
  16953. $7="'".__comma(self._name());
  16954. $ctx2.sendIdx[","]=3;
  16955. $6=_st($7).__comma("'");
  16956. $ctx2.sendIdx[","]=2;
  16957. _st(stream)._nextPutAll_($6);
  16958. $ctx2.sendIdx["nextPutAll:"]=4;
  16959. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  16960. $ctx2.sendIdx[","]=4;
  16961. _st(stream)._nextPutAll_($8);
  16962. $ctx2.sendIdx["nextPutAll:"]=5;
  16963. _st(stream)._nextPutAll_(" transport: (");
  16964. $ctx2.sendIdx["nextPutAll:"]=6;
  16965. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  16966. return $9;
  16967. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  16968. return $1;
  16969. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)})},
  16970. args: [],
  16971. 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: ' transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  16972. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"],
  16973. referencedClasses: ["String"]
  16974. }),
  16975. globals.Package);
  16976. smalltalk.addMethod(
  16977. smalltalk.method({
  16978. selector: "isPackage",
  16979. protocol: 'testing',
  16980. fn: function (){
  16981. var self=this;
  16982. return true;
  16983. },
  16984. args: [],
  16985. source: "isPackage\x0a\x09^ true",
  16986. messageSends: [],
  16987. referencedClasses: []
  16988. }),
  16989. globals.Package);
  16990. smalltalk.addMethod(
  16991. smalltalk.method({
  16992. selector: "loadDependencies",
  16993. protocol: 'dependencies',
  16994. fn: function (){
  16995. var self=this;
  16996. var classes,packages;
  16997. return smalltalk.withContext(function($ctx1) {
  16998. var $2,$3,$1;
  16999. classes=self._loadDependencyClasses();
  17000. $2=_st(_st(classes)._collect_((function(each){
  17001. return smalltalk.withContext(function($ctx2) {
  17002. return _st(each)._package();
  17003. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  17004. _st($2)._remove_ifAbsent_(self,(function(){
  17005. }));
  17006. $3=_st($2)._yourself();
  17007. $1=$3;
  17008. return $1;
  17009. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)})},
  17010. args: [],
  17011. 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",
  17012. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
  17013. referencedClasses: []
  17014. }),
  17015. globals.Package);
  17016. smalltalk.addMethod(
  17017. smalltalk.method({
  17018. selector: "loadDependencyClasses",
  17019. protocol: 'dependencies',
  17020. fn: function (){
  17021. var self=this;
  17022. var starCategoryName;
  17023. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17024. return smalltalk.withContext(function($ctx1) {
  17025. var $4,$3,$2,$6,$5,$7,$1;
  17026. starCategoryName="*".__comma(self._name());
  17027. $ctx1.sendIdx[","]=1;
  17028. $4=self._classes();
  17029. $ctx1.sendIdx["classes"]=1;
  17030. $3=_st($4)._collect_((function(each){
  17031. return smalltalk.withContext(function($ctx2) {
  17032. return _st(each)._superclass();
  17033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17034. $2=_st($3)._asSet();
  17035. _st($2)._remove_ifAbsent_(nil,(function(){
  17036. }));
  17037. _st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
  17038. return smalltalk.withContext(function($ctx2) {
  17039. $6=_st(each)._protocols();
  17040. $ctx2.sendIdx["protocols"]=1;
  17041. $5=_st($6).__comma(_st(_st(each)._class())._protocols());
  17042. return _st($5)._includes_(starCategoryName);
  17043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
  17044. $7=_st($2)._yourself();
  17045. $1=$7;
  17046. return $1;
  17047. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)})},
  17048. args: [],
  17049. 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",
  17050. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"],
  17051. referencedClasses: ["Smalltalk"]
  17052. }),
  17053. globals.Package);
  17054. smalltalk.addMethod(
  17055. smalltalk.method({
  17056. selector: "name",
  17057. protocol: 'accessing',
  17058. fn: function (){
  17059. var self=this;
  17060. return smalltalk.withContext(function($ctx1) {
  17061. return self.pkgName;
  17062. return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)})},
  17063. args: [],
  17064. source: "name\x0a\x09<return self.pkgName>",
  17065. messageSends: [],
  17066. referencedClasses: []
  17067. }),
  17068. globals.Package);
  17069. smalltalk.addMethod(
  17070. smalltalk.method({
  17071. selector: "name:",
  17072. protocol: 'accessing',
  17073. fn: function (aString){
  17074. var self=this;
  17075. return smalltalk.withContext(function($ctx1) {
  17076. self.pkgName = aString;
  17077. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)})},
  17078. args: ["aString"],
  17079. source: "name: aString\x0a\x09<self.pkgName = aString>",
  17080. messageSends: [],
  17081. referencedClasses: []
  17082. }),
  17083. globals.Package);
  17084. smalltalk.addMethod(
  17085. smalltalk.method({
  17086. selector: "organization",
  17087. protocol: 'accessing',
  17088. fn: function (){
  17089. var self=this;
  17090. return smalltalk.withContext(function($ctx1) {
  17091. var $1;
  17092. $1=self._basicAt_("organization");
  17093. return $1;
  17094. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)})},
  17095. args: [],
  17096. source: "organization\x0a\x09^ self basicAt: 'organization'",
  17097. messageSends: ["basicAt:"],
  17098. referencedClasses: []
  17099. }),
  17100. globals.Package);
  17101. smalltalk.addMethod(
  17102. smalltalk.method({
  17103. selector: "printOn:",
  17104. protocol: 'printing',
  17105. fn: function (aStream){
  17106. var self=this;
  17107. return smalltalk.withContext(function($ctx1) {
  17108. var $1;
  17109. globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  17110. _st(aStream)._nextPutAll_(" (");
  17111. $ctx1.sendIdx["nextPutAll:"]=1;
  17112. _st(aStream)._nextPutAll_(self._name());
  17113. $ctx1.sendIdx["nextPutAll:"]=2;
  17114. $1=_st(aStream)._nextPutAll_(")");
  17115. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)})},
  17116. args: ["aStream"],
  17117. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  17118. messageSends: ["printOn:", "nextPutAll:", "name"],
  17119. referencedClasses: []
  17120. }),
  17121. globals.Package);
  17122. smalltalk.addMethod(
  17123. smalltalk.method({
  17124. selector: "setupClasses",
  17125. protocol: 'classes',
  17126. fn: function (){
  17127. var self=this;
  17128. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  17129. return smalltalk.withContext(function($ctx1) {
  17130. var $1,$2;
  17131. $1=self._classes();
  17132. _st($1)._do_((function(each){
  17133. return smalltalk.withContext(function($ctx2) {
  17134. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  17135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17136. $ctx1.sendIdx["do:"]=1;
  17137. $2=_st($1)._do_((function(each){
  17138. return smalltalk.withContext(function($ctx2) {
  17139. return _st(each)._initialize();
  17140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  17141. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)})},
  17142. args: [],
  17143. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  17144. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
  17145. referencedClasses: ["ClassBuilder"]
  17146. }),
  17147. globals.Package);
  17148. smalltalk.addMethod(
  17149. smalltalk.method({
  17150. selector: "sortedClasses",
  17151. protocol: 'classes',
  17152. fn: function (){
  17153. var self=this;
  17154. return smalltalk.withContext(function($ctx1) {
  17155. var $1;
  17156. $1=_st(self._class())._sortedClasses_(self._classes());
  17157. return $1;
  17158. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)})},
  17159. args: [],
  17160. 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",
  17161. messageSends: ["sortedClasses:", "class", "classes"],
  17162. referencedClasses: []
  17163. }),
  17164. globals.Package);
  17165. smalltalk.addMethod(
  17166. smalltalk.method({
  17167. selector: "transport",
  17168. protocol: 'accessing',
  17169. fn: function (){
  17170. var self=this;
  17171. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  17172. return smalltalk.withContext(function($ctx1) {
  17173. var $2,$3,$4,$1;
  17174. $2=self["@transport"];
  17175. if(($receiver = $2) == nil || $receiver == null){
  17176. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  17177. _st($3)._package_(self);
  17178. $4=_st($3)._yourself();
  17179. self["@transport"]=$4;
  17180. $1=self["@transport"];
  17181. } else {
  17182. $1=$2;
  17183. };
  17184. return $1;
  17185. }, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)})},
  17186. args: [],
  17187. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  17188. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
  17189. referencedClasses: ["PackageTransport"]
  17190. }),
  17191. globals.Package);
  17192. smalltalk.addMethod(
  17193. smalltalk.method({
  17194. selector: "transport:",
  17195. protocol: 'accessing',
  17196. fn: function (aPackageTransport){
  17197. var self=this;
  17198. return smalltalk.withContext(function($ctx1) {
  17199. self["@transport"]=aPackageTransport;
  17200. _st(aPackageTransport)._package_(self);
  17201. return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)})},
  17202. args: ["aPackageTransport"],
  17203. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  17204. messageSends: ["package:"],
  17205. referencedClasses: []
  17206. }),
  17207. globals.Package);
  17208. globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  17209. smalltalk.addMethod(
  17210. smalltalk.method({
  17211. selector: "named:",
  17212. protocol: 'accessing',
  17213. fn: function (aPackageName){
  17214. var self=this;
  17215. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17216. return smalltalk.withContext(function($ctx1) {
  17217. var $1;
  17218. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  17219. return smalltalk.withContext(function($ctx2) {
  17220. return _st($Smalltalk())._createPackage_(aPackageName);
  17221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  17222. return $1;
  17223. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)})},
  17224. args: ["aPackageName"],
  17225. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  17226. messageSends: ["packageAt:ifAbsent:", "createPackage:"],
  17227. referencedClasses: ["Smalltalk"]
  17228. }),
  17229. globals.Package.klass);
  17230. smalltalk.addMethod(
  17231. smalltalk.method({
  17232. selector: "named:ifAbsent:",
  17233. protocol: 'accessing',
  17234. fn: function (aPackageName,aBlock){
  17235. var self=this;
  17236. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17237. return smalltalk.withContext(function($ctx1) {
  17238. var $1;
  17239. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  17240. return $1;
  17241. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)})},
  17242. args: ["aPackageName", "aBlock"],
  17243. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  17244. messageSends: ["packageAt:ifAbsent:"],
  17245. referencedClasses: ["Smalltalk"]
  17246. }),
  17247. globals.Package.klass);
  17248. smalltalk.addMethod(
  17249. smalltalk.method({
  17250. selector: "named:transport:",
  17251. protocol: 'accessing',
  17252. fn: function (aPackageName,aTransport){
  17253. var self=this;
  17254. var package_;
  17255. return smalltalk.withContext(function($ctx1) {
  17256. var $1;
  17257. package_=self._named_(aPackageName);
  17258. _st(package_)._transport_(aTransport);
  17259. $1=package_;
  17260. return $1;
  17261. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)})},
  17262. args: ["aPackageName", "aTransport"],
  17263. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  17264. messageSends: ["named:", "transport:"],
  17265. referencedClasses: []
  17266. }),
  17267. globals.Package.klass);
  17268. smalltalk.addMethod(
  17269. smalltalk.method({
  17270. selector: "sortedClasses:",
  17271. protocol: 'sorting',
  17272. fn: function (classes){
  17273. var self=this;
  17274. var children,others,nodes,expandedClasses;
  17275. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  17276. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  17277. return smalltalk.withContext(function($ctx1) {
  17278. var $1,$3,$2,$4;
  17279. children=[];
  17280. others=[];
  17281. _st(classes)._do_((function(each){
  17282. return smalltalk.withContext(function($ctx2) {
  17283. $1=_st(classes)._includes_(_st(each)._superclass());
  17284. if(smalltalk.assert($1)){
  17285. return _st(others)._add_(each);
  17286. } else {
  17287. return _st(children)._add_(each);
  17288. $ctx2.sendIdx["add:"]=1;
  17289. };
  17290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17291. $ctx1.sendIdx["do:"]=1;
  17292. nodes=_st(children)._collect_((function(each){
  17293. return smalltalk.withContext(function($ctx2) {
  17294. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  17295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  17296. nodes=_st(nodes)._sorted_((function(a,b){
  17297. return smalltalk.withContext(function($ctx2) {
  17298. $3=_st(a)._theClass();
  17299. $ctx2.sendIdx["theClass"]=1;
  17300. $2=_st($3)._name();
  17301. $ctx2.sendIdx["name"]=1;
  17302. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  17303. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
  17304. expandedClasses=_st($Array())._new();
  17305. _st(nodes)._do_((function(aNode){
  17306. return smalltalk.withContext(function($ctx2) {
  17307. return _st(aNode)._traverseClassesWith_(expandedClasses);
  17308. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
  17309. $4=expandedClasses;
  17310. return $4;
  17311. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)})},
  17312. args: ["classes"],
  17313. 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",
  17314. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  17315. referencedClasses: ["ClassSorterNode", "Array"]
  17316. }),
  17317. globals.Package.klass);
  17318. smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
  17319. globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  17320. globals.PlatformInterface.klass.iVarNames = ['worker'];
  17321. smalltalk.addMethod(
  17322. smalltalk.method({
  17323. selector: "ajax:",
  17324. protocol: 'actions',
  17325. fn: function (anObject){
  17326. var self=this;
  17327. return smalltalk.withContext(function($ctx1) {
  17328. var $2,$1;
  17329. $2=self["@worker"];
  17330. if(($receiver = $2) == nil || $receiver == null){
  17331. $1=self._error_("ajax: not available");
  17332. } else {
  17333. $1=_st(self["@worker"])._ajax_(anObject);
  17334. };
  17335. return $1;
  17336. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)})},
  17337. args: ["anObject"],
  17338. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  17339. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
  17340. referencedClasses: []
  17341. }),
  17342. globals.PlatformInterface.klass);
  17343. smalltalk.addMethod(
  17344. smalltalk.method({
  17345. selector: "alert:",
  17346. protocol: 'actions',
  17347. fn: function (aString){
  17348. var self=this;
  17349. return smalltalk.withContext(function($ctx1) {
  17350. var $2,$1;
  17351. $2=self["@worker"];
  17352. if(($receiver = $2) == nil || $receiver == null){
  17353. $1=self._error_("alert: not available");
  17354. } else {
  17355. $1=_st(self["@worker"])._alert_(aString);
  17356. };
  17357. return $1;
  17358. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)})},
  17359. args: ["aString"],
  17360. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  17361. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
  17362. referencedClasses: []
  17363. }),
  17364. globals.PlatformInterface.klass);
  17365. smalltalk.addMethod(
  17366. smalltalk.method({
  17367. selector: "confirm:",
  17368. protocol: 'actions',
  17369. fn: function (aString){
  17370. var self=this;
  17371. return smalltalk.withContext(function($ctx1) {
  17372. var $2,$1;
  17373. $2=self["@worker"];
  17374. if(($receiver = $2) == nil || $receiver == null){
  17375. $1=self._error_("confirm: not available");
  17376. } else {
  17377. $1=_st(self["@worker"])._confirm_(aString);
  17378. };
  17379. return $1;
  17380. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)})},
  17381. args: ["aString"],
  17382. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  17383. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
  17384. referencedClasses: []
  17385. }),
  17386. globals.PlatformInterface.klass);
  17387. smalltalk.addMethod(
  17388. smalltalk.method({
  17389. selector: "existsGlobal:",
  17390. protocol: 'actions',
  17391. fn: function (aString){
  17392. var self=this;
  17393. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  17394. return smalltalk.withContext(function($ctx1) {
  17395. var $1;
  17396. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  17397. return true;
  17398. }),(function(){
  17399. return false;
  17400. }));
  17401. return $1;
  17402. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)})},
  17403. args: ["aString"],
  17404. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  17405. messageSends: ["at:ifPresent:ifAbsent:", "globals"],
  17406. referencedClasses: ["PlatformInterface"]
  17407. }),
  17408. globals.PlatformInterface.klass);
  17409. smalltalk.addMethod(
  17410. smalltalk.method({
  17411. selector: "globals",
  17412. protocol: 'accessing',
  17413. fn: function (){
  17414. var self=this;
  17415. return smalltalk.withContext(function($ctx1) {
  17416. return (new Function('return this'))();;
  17417. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)})},
  17418. args: [],
  17419. source: "globals\x0a\x09<return (new Function('return this'))();>",
  17420. messageSends: [],
  17421. referencedClasses: []
  17422. }),
  17423. globals.PlatformInterface.klass);
  17424. smalltalk.addMethod(
  17425. smalltalk.method({
  17426. selector: "initialize",
  17427. protocol: 'initialization',
  17428. fn: function (){
  17429. var self=this;
  17430. var candidate;
  17431. function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  17432. return smalltalk.withContext(function($ctx1) {
  17433. var $1;
  17434. globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  17435. if(($receiver = $BrowserInterface()) == nil || $receiver == null){
  17436. $BrowserInterface();
  17437. } else {
  17438. candidate=_st($BrowserInterface())._new();
  17439. candidate;
  17440. $1=_st(candidate)._isAvailable();
  17441. if(smalltalk.assert($1)){
  17442. self._setWorker_(candidate);
  17443. return self;
  17444. };
  17445. };
  17446. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)})},
  17447. args: [],
  17448. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
  17449. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
  17450. referencedClasses: ["BrowserInterface"]
  17451. }),
  17452. globals.PlatformInterface.klass);
  17453. smalltalk.addMethod(
  17454. smalltalk.method({
  17455. selector: "prompt:",
  17456. protocol: 'actions',
  17457. fn: function (aString){
  17458. var self=this;
  17459. return smalltalk.withContext(function($ctx1) {
  17460. var $2,$1;
  17461. $2=self["@worker"];
  17462. if(($receiver = $2) == nil || $receiver == null){
  17463. $1=self._error_("prompt: not available");
  17464. } else {
  17465. $1=_st(self["@worker"])._prompt_(aString);
  17466. };
  17467. return $1;
  17468. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)})},
  17469. args: ["aString"],
  17470. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  17471. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
  17472. referencedClasses: []
  17473. }),
  17474. globals.PlatformInterface.klass);
  17475. smalltalk.addMethod(
  17476. smalltalk.method({
  17477. selector: "setWorker:",
  17478. protocol: 'accessing',
  17479. fn: function (anObject){
  17480. var self=this;
  17481. self["@worker"]=anObject;
  17482. return self},
  17483. args: ["anObject"],
  17484. source: "setWorker: anObject\x0a\x09worker := anObject",
  17485. messageSends: [],
  17486. referencedClasses: []
  17487. }),
  17488. globals.PlatformInterface.klass);
  17489. smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
  17490. 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.";
  17491. globals.Service.klass.iVarNames = ['current'];
  17492. smalltalk.addMethod(
  17493. smalltalk.method({
  17494. selector: "current",
  17495. protocol: 'accessing',
  17496. fn: function (){
  17497. var self=this;
  17498. var $1;
  17499. $1=self["@current"];
  17500. return $1;
  17501. },
  17502. args: [],
  17503. source: "current\x0a\x09^ current",
  17504. messageSends: [],
  17505. referencedClasses: []
  17506. }),
  17507. globals.Service.klass);
  17508. smalltalk.addMethod(
  17509. smalltalk.method({
  17510. selector: "new",
  17511. protocol: 'instance creation',
  17512. fn: function (){
  17513. var self=this;
  17514. return smalltalk.withContext(function($ctx1) {
  17515. self._shouldNotImplement();
  17516. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)})},
  17517. args: [],
  17518. source: "new\x0a\x09self shouldNotImplement",
  17519. messageSends: ["shouldNotImplement"],
  17520. referencedClasses: []
  17521. }),
  17522. globals.Service.klass);
  17523. smalltalk.addMethod(
  17524. smalltalk.method({
  17525. selector: "register:",
  17526. protocol: 'registration',
  17527. fn: function (anObject){
  17528. var self=this;
  17529. self["@current"]=anObject;
  17530. return self},
  17531. args: ["anObject"],
  17532. source: "register: anObject\x0a\x09current := anObject",
  17533. messageSends: [],
  17534. referencedClasses: []
  17535. }),
  17536. globals.Service.klass);
  17537. smalltalk.addMethod(
  17538. smalltalk.method({
  17539. selector: "registerIfNone:",
  17540. protocol: 'registration',
  17541. fn: function (anObject){
  17542. var self=this;
  17543. return smalltalk.withContext(function($ctx1) {
  17544. var $1;
  17545. $1=self._current();
  17546. if(($receiver = $1) == nil || $receiver == null){
  17547. self._register_(anObject);
  17548. } else {
  17549. $1;
  17550. };
  17551. return self}, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)})},
  17552. args: ["anObject"],
  17553. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  17554. messageSends: ["ifNil:", "current", "register:"],
  17555. referencedClasses: []
  17556. }),
  17557. globals.Service.klass);
  17558. smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
  17559. 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.";
  17560. smalltalk.addMethod(
  17561. smalltalk.method({
  17562. selector: "handleError:",
  17563. protocol: 'error handling',
  17564. fn: function (anError){
  17565. var self=this;
  17566. return smalltalk.withContext(function($ctx1) {
  17567. _st(self._current())._handleError_(anError);
  17568. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)})},
  17569. args: ["anError"],
  17570. source: "handleError: anError\x0a\x09self current handleError: anError",
  17571. messageSends: ["handleError:", "current"],
  17572. referencedClasses: []
  17573. }),
  17574. globals.ErrorHandler.klass);
  17575. smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
  17576. globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  17577. smalltalk.addMethod(
  17578. smalltalk.method({
  17579. selector: "inspect:",
  17580. protocol: 'inspecting',
  17581. fn: function (anObject){
  17582. var self=this;
  17583. return smalltalk.withContext(function($ctx1) {
  17584. var $1;
  17585. $1=_st(self._current())._inspect_(anObject);
  17586. return $1;
  17587. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)})},
  17588. args: ["anObject"],
  17589. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  17590. messageSends: ["inspect:", "current"],
  17591. referencedClasses: []
  17592. }),
  17593. globals.Inspector.klass);
  17594. smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
  17595. 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`.";
  17596. smalltalk.addMethod(
  17597. smalltalk.method({
  17598. selector: "do:on:displaying:",
  17599. protocol: 'progress handling',
  17600. fn: function (aBlock,aCollection,aString){
  17601. var self=this;
  17602. return smalltalk.withContext(function($ctx1) {
  17603. _st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  17604. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)})},
  17605. args: ["aBlock", "aCollection", "aString"],
  17606. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  17607. messageSends: ["do:on:displaying:", "current"],
  17608. referencedClasses: []
  17609. }),
  17610. globals.ProgressHandler.klass);
  17611. smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
  17612. 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.";
  17613. smalltalk.addMethod(
  17614. smalltalk.method({
  17615. selector: "clear",
  17616. protocol: 'printing',
  17617. fn: function (){
  17618. var self=this;
  17619. return smalltalk.withContext(function($ctx1) {
  17620. _st(self._current())._clear();
  17621. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)})},
  17622. args: [],
  17623. source: "clear\x0a\x09self current clear",
  17624. messageSends: ["clear", "current"],
  17625. referencedClasses: []
  17626. }),
  17627. globals.Transcript.klass);
  17628. smalltalk.addMethod(
  17629. smalltalk.method({
  17630. selector: "cr",
  17631. protocol: 'printing',
  17632. fn: function (){
  17633. var self=this;
  17634. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  17635. return smalltalk.withContext(function($ctx1) {
  17636. _st(self._current())._show_(_st($String())._cr());
  17637. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)})},
  17638. args: [],
  17639. source: "cr\x0a\x09self current show: String cr",
  17640. messageSends: ["show:", "current", "cr"],
  17641. referencedClasses: ["String"]
  17642. }),
  17643. globals.Transcript.klass);
  17644. smalltalk.addMethod(
  17645. smalltalk.method({
  17646. selector: "inspect:",
  17647. protocol: 'printing',
  17648. fn: function (anObject){
  17649. var self=this;
  17650. return smalltalk.withContext(function($ctx1) {
  17651. self._show_(anObject);
  17652. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)})},
  17653. args: ["anObject"],
  17654. source: "inspect: anObject\x0a\x09self show: anObject",
  17655. messageSends: ["show:"],
  17656. referencedClasses: []
  17657. }),
  17658. globals.Transcript.klass);
  17659. smalltalk.addMethod(
  17660. smalltalk.method({
  17661. selector: "open",
  17662. protocol: 'instance creation',
  17663. fn: function (){
  17664. var self=this;
  17665. return smalltalk.withContext(function($ctx1) {
  17666. _st(self._current())._open();
  17667. return self}, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)})},
  17668. args: [],
  17669. source: "open\x0a\x09self current open",
  17670. messageSends: ["open", "current"],
  17671. referencedClasses: []
  17672. }),
  17673. globals.Transcript.klass);
  17674. smalltalk.addMethod(
  17675. smalltalk.method({
  17676. selector: "show:",
  17677. protocol: 'printing',
  17678. fn: function (anObject){
  17679. var self=this;
  17680. return smalltalk.withContext(function($ctx1) {
  17681. _st(self._current())._show_(anObject);
  17682. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)})},
  17683. args: ["anObject"],
  17684. source: "show: anObject\x0a\x09self current show: anObject",
  17685. messageSends: ["show:", "current"],
  17686. referencedClasses: []
  17687. }),
  17688. globals.Transcript.klass);
  17689. smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  17690. globals.Setting.comment="I represent a setting accessible via `Smalltalk settings`.\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: 'defaultValue'`.";
  17691. smalltalk.addMethod(
  17692. smalltalk.method({
  17693. selector: "defaultValue",
  17694. protocol: 'accessing',
  17695. fn: function (){
  17696. var self=this;
  17697. var $1;
  17698. $1=self["@defaultValue"];
  17699. return $1;
  17700. },
  17701. args: [],
  17702. source: "defaultValue\x0a\x09^ defaultValue",
  17703. messageSends: [],
  17704. referencedClasses: []
  17705. }),
  17706. globals.Setting);
  17707. smalltalk.addMethod(
  17708. smalltalk.method({
  17709. selector: "defaultValue:",
  17710. protocol: 'accessing',
  17711. fn: function (anObject){
  17712. var self=this;
  17713. self["@defaultValue"]=anObject;
  17714. return self},
  17715. args: ["anObject"],
  17716. source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
  17717. messageSends: [],
  17718. referencedClasses: []
  17719. }),
  17720. globals.Setting);
  17721. smalltalk.addMethod(
  17722. smalltalk.method({
  17723. selector: "key",
  17724. protocol: 'accessing',
  17725. fn: function (){
  17726. var self=this;
  17727. var $1;
  17728. $1=self["@key"];
  17729. return $1;
  17730. },
  17731. args: [],
  17732. source: "key\x0a\x09^ key",
  17733. messageSends: [],
  17734. referencedClasses: []
  17735. }),
  17736. globals.Setting);
  17737. smalltalk.addMethod(
  17738. smalltalk.method({
  17739. selector: "key:",
  17740. protocol: 'accessing',
  17741. fn: function (anObject){
  17742. var self=this;
  17743. self["@key"]=anObject;
  17744. return self},
  17745. args: ["anObject"],
  17746. source: "key: anObject\x0a\x09key := anObject",
  17747. messageSends: [],
  17748. referencedClasses: []
  17749. }),
  17750. globals.Setting);
  17751. smalltalk.addMethod(
  17752. smalltalk.method({
  17753. selector: "value",
  17754. protocol: 'accessing',
  17755. fn: function (){
  17756. var self=this;
  17757. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17758. return smalltalk.withContext(function($ctx1) {
  17759. var $1;
  17760. $1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  17761. return smalltalk.withContext(function($ctx2) {
  17762. return self._defaultValue();
  17763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  17764. return $1;
  17765. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)})},
  17766. args: [],
  17767. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  17768. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"],
  17769. referencedClasses: ["Smalltalk"]
  17770. }),
  17771. globals.Setting);
  17772. smalltalk.addMethod(
  17773. smalltalk.method({
  17774. selector: "value:",
  17775. protocol: 'accessing',
  17776. fn: function (aString){
  17777. var self=this;
  17778. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17779. return smalltalk.withContext(function($ctx1) {
  17780. var $1;
  17781. $1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
  17782. return $1;
  17783. }, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)})},
  17784. args: ["aString"],
  17785. source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
  17786. messageSends: ["at:put:", "settings", "key"],
  17787. referencedClasses: ["Smalltalk"]
  17788. }),
  17789. globals.Setting);
  17790. smalltalk.addMethod(
  17791. smalltalk.method({
  17792. selector: "at:ifAbsent:",
  17793. protocol: 'instance creation',
  17794. fn: function (aString,anotherString){
  17795. var self=this;
  17796. return smalltalk.withContext(function($ctx1) {
  17797. var $2,$3,$1;
  17798. $2=globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []);
  17799. _st($2)._key_(aString);
  17800. _st($2)._defaultValue_(anotherString);
  17801. $3=_st($2)._yourself();
  17802. $1=$3;
  17803. return $1;
  17804. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)})},
  17805. args: ["aString", "anotherString"],
  17806. source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
  17807. messageSends: ["key:", "new", "defaultValue:", "yourself"],
  17808. referencedClasses: []
  17809. }),
  17810. globals.Setting.klass);
  17811. smalltalk.addMethod(
  17812. smalltalk.method({
  17813. selector: "new",
  17814. protocol: 'instance creation',
  17815. fn: function (){
  17816. var self=this;
  17817. return smalltalk.withContext(function($ctx1) {
  17818. self._shouldNotImplement();
  17819. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)})},
  17820. args: [],
  17821. source: "new\x0a\x09self shouldNotImplement",
  17822. messageSends: ["shouldNotImplement"],
  17823. referencedClasses: []
  17824. }),
  17825. globals.Setting.klass);
  17826. smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
  17827. globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `smalltalk` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\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- `#at:` answers a specific 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.";
  17828. smalltalk.addMethod(
  17829. smalltalk.method({
  17830. selector: "addGlobalJsVariable:",
  17831. protocol: 'globals',
  17832. fn: function (aString){
  17833. var self=this;
  17834. return smalltalk.withContext(function($ctx1) {
  17835. _st(self._globalJsVariables())._add_(aString);
  17836. return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  17837. args: ["aString"],
  17838. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  17839. messageSends: ["add:", "globalJsVariables"],
  17840. referencedClasses: []
  17841. }),
  17842. globals.SmalltalkImage);
  17843. smalltalk.addMethod(
  17844. smalltalk.method({
  17845. selector: "amdRequire",
  17846. protocol: 'accessing amd',
  17847. fn: function (){
  17848. var self=this;
  17849. return smalltalk.withContext(function($ctx1) {
  17850. var $1;
  17851. $1=_st(self._vm())._at_("amdRequire");
  17852. return $1;
  17853. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)})},
  17854. args: [],
  17855. source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
  17856. messageSends: ["at:", "vm"],
  17857. referencedClasses: []
  17858. }),
  17859. globals.SmalltalkImage);
  17860. smalltalk.addMethod(
  17861. smalltalk.method({
  17862. selector: "asSmalltalkException:",
  17863. protocol: 'error handling',
  17864. fn: function (anObject){
  17865. var self=this;
  17866. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  17867. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  17868. return smalltalk.withContext(function($ctx1) {
  17869. var $2,$1;
  17870. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  17871. return smalltalk.withContext(function($ctx2) {
  17872. return _st(anObject)._isKindOf_($Error());
  17873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  17874. if(smalltalk.assert($2)){
  17875. $1=anObject;
  17876. } else {
  17877. $1=_st($JavaScriptException())._on_(anObject);
  17878. };
  17879. return $1;
  17880. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)})},
  17881. args: ["anObject"],
  17882. 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 ]",
  17883. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
  17884. referencedClasses: ["Error", "JavaScriptException"]
  17885. }),
  17886. globals.SmalltalkImage);
  17887. smalltalk.addMethod(
  17888. smalltalk.method({
  17889. selector: "at:",
  17890. protocol: 'accessing',
  17891. fn: function (aString){
  17892. var self=this;
  17893. return smalltalk.withContext(function($ctx1) {
  17894. var $1;
  17895. self._deprecatedAPI();
  17896. $1=_st(self._globals())._at_(aString);
  17897. return $1;
  17898. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)})},
  17899. args: ["aString"],
  17900. source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
  17901. messageSends: ["deprecatedAPI", "at:", "globals"],
  17902. referencedClasses: []
  17903. }),
  17904. globals.SmalltalkImage);
  17905. smalltalk.addMethod(
  17906. smalltalk.method({
  17907. selector: "at:ifAbsent:",
  17908. protocol: 'accessing',
  17909. fn: function (aKey,aBlock){
  17910. var self=this;
  17911. return smalltalk.withContext(function($ctx1) {
  17912. var $2,$1;
  17913. $2=self._includesKey_(aKey);
  17914. if(smalltalk.assert($2)){
  17915. $1=self._at_(aKey);
  17916. } else {
  17917. $1=_st(aBlock)._value();
  17918. };
  17919. return $1;
  17920. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)})},
  17921. args: ["aKey", "aBlock"],
  17922. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  17923. messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
  17924. referencedClasses: []
  17925. }),
  17926. globals.SmalltalkImage);
  17927. smalltalk.addMethod(
  17928. smalltalk.method({
  17929. selector: "at:put:",
  17930. protocol: 'accessing',
  17931. fn: function (aString,anObject){
  17932. var self=this;
  17933. return smalltalk.withContext(function($ctx1) {
  17934. var $1;
  17935. self._deprecatedAPI();
  17936. $1=_st(self._globals())._at_put_(aString,anObject);
  17937. return $1;
  17938. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)})},
  17939. args: ["aString", "anObject"],
  17940. source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
  17941. messageSends: ["deprecatedAPI", "at:put:", "globals"],
  17942. referencedClasses: []
  17943. }),
  17944. globals.SmalltalkImage);
  17945. smalltalk.addMethod(
  17946. smalltalk.method({
  17947. selector: "basicCreatePackage:",
  17948. protocol: 'private',
  17949. fn: function (packageName){
  17950. var self=this;
  17951. return smalltalk.withContext(function($ctx1) {
  17952. return smalltalk.addPackage(packageName);
  17953. return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  17954. args: ["packageName"],
  17955. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  17956. messageSends: [],
  17957. referencedClasses: []
  17958. }),
  17959. globals.SmalltalkImage);
  17960. smalltalk.addMethod(
  17961. smalltalk.method({
  17962. selector: "basicParse:",
  17963. protocol: 'private',
  17964. fn: function (aString){
  17965. var self=this;
  17966. function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  17967. return smalltalk.withContext(function($ctx1) {
  17968. var $1;
  17969. $1=_st($SmalltalkParser())._parse_(aString);
  17970. return $1;
  17971. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)})},
  17972. args: ["aString"],
  17973. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  17974. messageSends: ["parse:"],
  17975. referencedClasses: ["SmalltalkParser"]
  17976. }),
  17977. globals.SmalltalkImage);
  17978. smalltalk.addMethod(
  17979. smalltalk.method({
  17980. selector: "classes",
  17981. protocol: 'classes',
  17982. fn: function (){
  17983. var self=this;
  17984. return smalltalk.withContext(function($ctx1) {
  17985. return smalltalk.classes();
  17986. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)})},
  17987. args: [],
  17988. source: "classes\x0a\x09<return smalltalk.classes()>",
  17989. messageSends: [],
  17990. referencedClasses: []
  17991. }),
  17992. globals.SmalltalkImage);
  17993. smalltalk.addMethod(
  17994. smalltalk.method({
  17995. selector: "createPackage:",
  17996. protocol: 'packages',
  17997. fn: function (packageName){
  17998. var self=this;
  17999. var package_,announcement;
  18000. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18001. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18002. return smalltalk.withContext(function($ctx1) {
  18003. var $1,$2,$3;
  18004. package_=self._basicCreatePackage_(packageName);
  18005. $1=_st($PackageAdded())._new();
  18006. _st($1)._package_(package_);
  18007. $2=_st($1)._yourself();
  18008. announcement=$2;
  18009. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  18010. $3=package_;
  18011. return $3;
  18012. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)})},
  18013. args: ["packageName"],
  18014. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  18015. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
  18016. referencedClasses: ["PackageAdded", "SystemAnnouncer"]
  18017. }),
  18018. globals.SmalltalkImage);
  18019. smalltalk.addMethod(
  18020. smalltalk.method({
  18021. selector: "createPackage:properties:",
  18022. protocol: 'private',
  18023. fn: function (packageName,aDict){
  18024. var self=this;
  18025. return smalltalk.withContext(function($ctx1) {
  18026. var $1,$2;
  18027. self._deprecatedAPI();
  18028. $1=_st(aDict)._isEmpty();
  18029. if(! smalltalk.assert($1)){
  18030. self._error_("createPackage:properties: called with nonempty properties");
  18031. };
  18032. $2=self._createPackage_(packageName);
  18033. return $2;
  18034. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)})},
  18035. args: ["packageName", "aDict"],
  18036. source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
  18037. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
  18038. referencedClasses: []
  18039. }),
  18040. globals.SmalltalkImage);
  18041. smalltalk.addMethod(
  18042. smalltalk.method({
  18043. selector: "current",
  18044. protocol: 'accessing',
  18045. fn: function (){
  18046. var self=this;
  18047. return smalltalk.withContext(function($ctx1) {
  18048. self._deprecatedAPI();
  18049. return self;
  18050. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)})},
  18051. args: [],
  18052. source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
  18053. messageSends: ["deprecatedAPI"],
  18054. referencedClasses: []
  18055. }),
  18056. globals.SmalltalkImage);
  18057. smalltalk.addMethod(
  18058. smalltalk.method({
  18059. selector: "defaultAmdNamespace",
  18060. protocol: 'accessing amd',
  18061. fn: function (){
  18062. var self=this;
  18063. return smalltalk.withContext(function($ctx1) {
  18064. var $1;
  18065. $1="transport.defaultAmdNamespace"._settingValue();
  18066. return $1;
  18067. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)})},
  18068. args: [],
  18069. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  18070. messageSends: ["settingValue"],
  18071. referencedClasses: []
  18072. }),
  18073. globals.SmalltalkImage);
  18074. smalltalk.addMethod(
  18075. smalltalk.method({
  18076. selector: "defaultAmdNamespace:",
  18077. protocol: 'accessing amd',
  18078. fn: function (aString){
  18079. var self=this;
  18080. return smalltalk.withContext(function($ctx1) {
  18081. "transport.defaultAmdNamespace"._settingValue_(aString);
  18082. return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)})},
  18083. args: ["aString"],
  18084. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  18085. messageSends: ["settingValue:"],
  18086. referencedClasses: []
  18087. }),
  18088. globals.SmalltalkImage);
  18089. smalltalk.addMethod(
  18090. smalltalk.method({
  18091. selector: "deleteClass:",
  18092. protocol: 'private',
  18093. fn: function (aClass){
  18094. var self=this;
  18095. return smalltalk.withContext(function($ctx1) {
  18096. smalltalk.removeClass(aClass);
  18097. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)})},
  18098. args: ["aClass"],
  18099. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
  18100. messageSends: [],
  18101. referencedClasses: []
  18102. }),
  18103. globals.SmalltalkImage);
  18104. smalltalk.addMethod(
  18105. smalltalk.method({
  18106. selector: "deleteGlobalJsVariable:",
  18107. protocol: 'globals',
  18108. fn: function (aString){
  18109. var self=this;
  18110. return smalltalk.withContext(function($ctx1) {
  18111. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  18112. }));
  18113. return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  18114. args: ["aString"],
  18115. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  18116. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  18117. referencedClasses: []
  18118. }),
  18119. globals.SmalltalkImage);
  18120. smalltalk.addMethod(
  18121. smalltalk.method({
  18122. selector: "deletePackage:",
  18123. protocol: 'private',
  18124. fn: function (packageName){
  18125. var self=this;
  18126. return smalltalk.withContext(function($ctx1) {
  18127. delete smalltalk.packages[packageName];
  18128. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  18129. args: ["packageName"],
  18130. 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 smalltalk.packages[packageName]>",
  18131. messageSends: [],
  18132. referencedClasses: []
  18133. }),
  18134. globals.SmalltalkImage);
  18135. smalltalk.addMethod(
  18136. smalltalk.method({
  18137. selector: "globalJsVariables",
  18138. protocol: 'globals',
  18139. fn: function (){
  18140. var self=this;
  18141. return smalltalk.withContext(function($ctx1) {
  18142. return smalltalk.globalJsVariables;
  18143. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)})},
  18144. args: [],
  18145. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
  18146. messageSends: [],
  18147. referencedClasses: []
  18148. }),
  18149. globals.SmalltalkImage);
  18150. smalltalk.addMethod(
  18151. smalltalk.method({
  18152. selector: "globals",
  18153. protocol: 'accessing',
  18154. fn: function (){
  18155. var self=this;
  18156. return smalltalk.withContext(function($ctx1) {
  18157. return globals;
  18158. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)})},
  18159. args: [],
  18160. source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
  18161. messageSends: [],
  18162. referencedClasses: []
  18163. }),
  18164. globals.SmalltalkImage);
  18165. smalltalk.addMethod(
  18166. smalltalk.method({
  18167. selector: "includesKey:",
  18168. protocol: 'accessing',
  18169. fn: function (aKey){
  18170. var self=this;
  18171. return smalltalk.withContext(function($ctx1) {
  18172. return smalltalk.hasOwnProperty(aKey);
  18173. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)})},
  18174. args: ["aKey"],
  18175. source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
  18176. messageSends: [],
  18177. referencedClasses: []
  18178. }),
  18179. globals.SmalltalkImage);
  18180. smalltalk.addMethod(
  18181. smalltalk.method({
  18182. selector: "isSmalltalkObject:",
  18183. protocol: 'testing',
  18184. fn: function (anObject){
  18185. var self=this;
  18186. return smalltalk.withContext(function($ctx1) {
  18187. return typeof anObject.klass !== 'undefined';
  18188. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)})},
  18189. args: ["anObject"],
  18190. 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 typeof anObject.klass !== 'undefined'>",
  18191. messageSends: [],
  18192. referencedClasses: []
  18193. }),
  18194. globals.SmalltalkImage);
  18195. smalltalk.addMethod(
  18196. smalltalk.method({
  18197. selector: "packageAt:",
  18198. protocol: 'packages',
  18199. fn: function (packageName){
  18200. var self=this;
  18201. return smalltalk.withContext(function($ctx1) {
  18202. return smalltalk.packages[packageName];
  18203. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)})},
  18204. args: ["packageName"],
  18205. source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
  18206. messageSends: [],
  18207. referencedClasses: []
  18208. }),
  18209. globals.SmalltalkImage);
  18210. smalltalk.addMethod(
  18211. smalltalk.method({
  18212. selector: "packageAt:ifAbsent:",
  18213. protocol: 'packages',
  18214. fn: function (packageName,aBlock){
  18215. var self=this;
  18216. return smalltalk.withContext(function($ctx1) {
  18217. var $2,$1;
  18218. $2=self._packageAt_(packageName);
  18219. $1=_st($2)._ifNil_(aBlock);
  18220. return $1;
  18221. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)})},
  18222. args: ["packageName", "aBlock"],
  18223. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  18224. messageSends: ["ifNil:", "packageAt:"],
  18225. referencedClasses: []
  18226. }),
  18227. globals.SmalltalkImage);
  18228. smalltalk.addMethod(
  18229. smalltalk.method({
  18230. selector: "packages",
  18231. protocol: 'packages',
  18232. fn: function (){
  18233. var self=this;
  18234. return smalltalk.withContext(function($ctx1) {
  18235. return Object.keys(smalltalk.packages).map(function(k) {
  18236. return smalltalk.packages[k];
  18237. })
  18238. ;
  18239. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)})},
  18240. args: [],
  18241. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys(smalltalk.packages).map(function(k) {\x0a\x09\x09\x09return smalltalk.packages[k];\x0a\x09\x09})\x0a\x09>",
  18242. messageSends: [],
  18243. referencedClasses: []
  18244. }),
  18245. globals.SmalltalkImage);
  18246. smalltalk.addMethod(
  18247. smalltalk.method({
  18248. selector: "parse:",
  18249. protocol: 'accessing',
  18250. fn: function (aString){
  18251. var self=this;
  18252. var result;
  18253. return smalltalk.withContext(function($ctx1) {
  18254. var $2,$3,$1;
  18255. self._try_catch_((function(){
  18256. return smalltalk.withContext(function($ctx2) {
  18257. result=self._basicParse_(aString);
  18258. return result;
  18259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(ex){
  18260. return smalltalk.withContext(function($ctx2) {
  18261. return _st(self._parseError_parsing_(ex,aString))._signal();
  18262. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  18263. $2=result;
  18264. _st($2)._source_(aString);
  18265. $3=_st($2)._yourself();
  18266. $1=$3;
  18267. return $1;
  18268. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)})},
  18269. args: ["aString"],
  18270. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [ result := self basicParse: aString ] \x0a\x09\x09catch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  18271. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  18272. referencedClasses: []
  18273. }),
  18274. globals.SmalltalkImage);
  18275. smalltalk.addMethod(
  18276. smalltalk.method({
  18277. selector: "parseError:parsing:",
  18278. protocol: 'error handling',
  18279. fn: function (anException,aString){
  18280. var self=this;
  18281. function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  18282. return smalltalk.withContext(function($ctx1) {
  18283. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  18284. $2=_st($ParseError())._new();
  18285. $8=_st(anException)._basicAt_("line");
  18286. $ctx1.sendIdx["basicAt:"]=1;
  18287. $7="Parse error on line ".__comma($8);
  18288. $6=_st($7).__comma(" column ");
  18289. $ctx1.sendIdx[","]=4;
  18290. $9=_st(anException)._basicAt_("column");
  18291. $ctx1.sendIdx["basicAt:"]=2;
  18292. $5=_st($6).__comma($9);
  18293. $ctx1.sendIdx[","]=3;
  18294. $4=_st($5).__comma(" : Unexpected character ");
  18295. $ctx1.sendIdx[","]=2;
  18296. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  18297. $ctx1.sendIdx[","]=1;
  18298. $1=_st($2)._messageText_($3);
  18299. return $1;
  18300. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)})},
  18301. args: ["anException", "aString"],
  18302. 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')",
  18303. messageSends: ["messageText:", "new", ",", "basicAt:"],
  18304. referencedClasses: ["ParseError"]
  18305. }),
  18306. globals.SmalltalkImage);
  18307. smalltalk.addMethod(
  18308. smalltalk.method({
  18309. selector: "pseudoVariableNames",
  18310. protocol: 'accessing',
  18311. fn: function (){
  18312. var self=this;
  18313. var $1;
  18314. $1=["self", "super", "nil", "true", "false", "thisContext"];
  18315. return $1;
  18316. },
  18317. args: [],
  18318. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  18319. messageSends: [],
  18320. referencedClasses: []
  18321. }),
  18322. globals.SmalltalkImage);
  18323. smalltalk.addMethod(
  18324. smalltalk.method({
  18325. selector: "readJSObject:",
  18326. protocol: 'accessing',
  18327. fn: function (anObject){
  18328. var self=this;
  18329. return smalltalk.withContext(function($ctx1) {
  18330. return smalltalk.readJSObject(anObject);
  18331. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)})},
  18332. args: ["anObject"],
  18333. source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
  18334. messageSends: [],
  18335. referencedClasses: []
  18336. }),
  18337. globals.SmalltalkImage);
  18338. smalltalk.addMethod(
  18339. smalltalk.method({
  18340. selector: "removeClass:",
  18341. protocol: 'classes',
  18342. fn: function (aClass){
  18343. var self=this;
  18344. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18345. function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  18346. return smalltalk.withContext(function($ctx1) {
  18347. var $1,$2,$3;
  18348. $1=_st(aClass)._isMetaclass();
  18349. if(smalltalk.assert($1)){
  18350. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  18351. };
  18352. self._deleteClass_(aClass);
  18353. $2=_st($ClassRemoved())._new();
  18354. _st($2)._theClass_(aClass);
  18355. $3=_st($2)._yourself();
  18356. _st(_st($SystemAnnouncer())._current())._announce_($3);
  18357. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)})},
  18358. args: ["aClass"],
  18359. 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)",
  18360. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
  18361. referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
  18362. }),
  18363. globals.SmalltalkImage);
  18364. smalltalk.addMethod(
  18365. smalltalk.method({
  18366. selector: "removePackage:",
  18367. protocol: 'packages',
  18368. fn: function (packageName){
  18369. var self=this;
  18370. var pkg;
  18371. return smalltalk.withContext(function($ctx1) {
  18372. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  18373. return smalltalk.withContext(function($ctx2) {
  18374. return self._error_("Missing package: ".__comma(packageName));
  18375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  18376. _st(_st(pkg)._classes())._do_((function(each){
  18377. return smalltalk.withContext(function($ctx2) {
  18378. return self._removeClass_(each);
  18379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  18380. self._deletePackage_(packageName);
  18381. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)})},
  18382. args: ["packageName"],
  18383. 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",
  18384. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  18385. referencedClasses: []
  18386. }),
  18387. globals.SmalltalkImage);
  18388. smalltalk.addMethod(
  18389. smalltalk.method({
  18390. selector: "renamePackage:to:",
  18391. protocol: 'packages',
  18392. fn: function (packageName,newName){
  18393. var self=this;
  18394. var pkg;
  18395. return smalltalk.withContext(function($ctx1) {
  18396. var $1,$2;
  18397. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  18398. return smalltalk.withContext(function($ctx2) {
  18399. $1="Missing package: ".__comma(packageName);
  18400. $ctx2.sendIdx[","]=1;
  18401. return self._error_($1);
  18402. $ctx2.sendIdx["error:"]=1;
  18403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  18404. $2=self._packageAt_(newName);
  18405. if(($receiver = $2) == nil || $receiver == null){
  18406. $2;
  18407. } else {
  18408. self._error_("Already exists a package called: ".__comma(newName));
  18409. };
  18410. _st(self._at_("packages"))._at_put_(newName,pkg);
  18411. _st(pkg)._name_(newName);
  18412. self._deletePackage_(packageName);
  18413. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)})},
  18414. args: ["packageName", "newName"],
  18415. 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\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  18416. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
  18417. referencedClasses: []
  18418. }),
  18419. globals.SmalltalkImage);
  18420. smalltalk.addMethod(
  18421. smalltalk.method({
  18422. selector: "reservedWords",
  18423. protocol: 'accessing',
  18424. fn: function (){
  18425. var self=this;
  18426. return smalltalk.withContext(function($ctx1) {
  18427. return smalltalk.reservedWords;
  18428. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)})},
  18429. args: [],
  18430. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
  18431. messageSends: [],
  18432. referencedClasses: []
  18433. }),
  18434. globals.SmalltalkImage);
  18435. smalltalk.addMethod(
  18436. smalltalk.method({
  18437. selector: "settings",
  18438. protocol: 'accessing',
  18439. fn: function (){
  18440. var self=this;
  18441. function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  18442. return $SmalltalkSettings();
  18443. },
  18444. args: [],
  18445. source: "settings\x0a\x09^ SmalltalkSettings",
  18446. messageSends: [],
  18447. referencedClasses: ["SmalltalkSettings"]
  18448. }),
  18449. globals.SmalltalkImage);
  18450. smalltalk.addMethod(
  18451. smalltalk.method({
  18452. selector: "version",
  18453. protocol: 'accessing',
  18454. fn: function (){
  18455. var self=this;
  18456. return "0.13.0-pre";
  18457. },
  18458. args: [],
  18459. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  18460. messageSends: [],
  18461. referencedClasses: []
  18462. }),
  18463. globals.SmalltalkImage);
  18464. smalltalk.addMethod(
  18465. smalltalk.method({
  18466. selector: "vm",
  18467. protocol: 'accessing',
  18468. fn: function (){
  18469. var self=this;
  18470. return smalltalk.withContext(function($ctx1) {
  18471. return smalltalk;
  18472. return self}, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)})},
  18473. args: [],
  18474. source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
  18475. messageSends: [],
  18476. referencedClasses: []
  18477. }),
  18478. globals.SmalltalkImage);
  18479. globals.SmalltalkImage.klass.iVarNames = ['current'];
  18480. smalltalk.addMethod(
  18481. smalltalk.method({
  18482. selector: "current",
  18483. protocol: 'instance creation',
  18484. fn: function (){
  18485. var self=this;
  18486. return smalltalk.withContext(function($ctx1) {
  18487. var $2,$1;
  18488. $2=self["@current"];
  18489. if(($receiver = $2) == nil || $receiver == null){
  18490. self["@current"]=globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []);
  18491. $1=self["@current"];
  18492. } else {
  18493. self._deprecatedAPI();
  18494. $1=self["@current"];
  18495. };
  18496. return $1;
  18497. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)})},
  18498. args: [],
  18499. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  18500. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"],
  18501. referencedClasses: []
  18502. }),
  18503. globals.SmalltalkImage.klass);
  18504. smalltalk.addMethod(
  18505. smalltalk.method({
  18506. selector: "initialize",
  18507. protocol: 'initialization',
  18508. fn: function (){
  18509. var self=this;
  18510. return smalltalk.withContext(function($ctx1) {
  18511. _st(globals)._at_put_("Smalltalk",self._current());
  18512. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)})},
  18513. args: [],
  18514. source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
  18515. messageSends: ["at:put:", "current"],
  18516. referencedClasses: []
  18517. }),
  18518. globals.SmalltalkImage.klass);
  18519. smalltalk.addMethod(
  18520. smalltalk.method({
  18521. selector: "new",
  18522. protocol: 'instance creation',
  18523. fn: function (){
  18524. var self=this;
  18525. return smalltalk.withContext(function($ctx1) {
  18526. self._shouldNotImplement();
  18527. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)})},
  18528. args: [],
  18529. source: "new\x0a\x09self shouldNotImplement",
  18530. messageSends: ["shouldNotImplement"],
  18531. referencedClasses: []
  18532. }),
  18533. globals.SmalltalkImage.klass);
  18534. smalltalk.addMethod(
  18535. smalltalk.method({
  18536. selector: "do:displayingProgress:",
  18537. protocol: '*Kernel-Infrastructure',
  18538. fn: function (aBlock,aString){
  18539. var self=this;
  18540. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  18541. return smalltalk.withContext(function($ctx1) {
  18542. _st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  18543. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)})},
  18544. args: ["aBlock", "aString"],
  18545. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  18546. messageSends: ["do:on:displaying:"],
  18547. referencedClasses: ["ProgressHandler"]
  18548. }),
  18549. globals.SequenceableCollection);
  18550. smalltalk.addMethod(
  18551. smalltalk.method({
  18552. selector: "asJavaScriptSelector",
  18553. protocol: '*Kernel-Infrastructure',
  18554. fn: function (){
  18555. var self=this;
  18556. return smalltalk.withContext(function($ctx1) {
  18557. var $1;
  18558. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  18559. return $1;
  18560. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)})},
  18561. args: [],
  18562. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  18563. messageSends: ["replace:with:"],
  18564. referencedClasses: []
  18565. }),
  18566. globals.String);
  18567. smalltalk.addMethod(
  18568. smalltalk.method({
  18569. selector: "asSetting",
  18570. protocol: '*Kernel-Infrastructure',
  18571. fn: function (){
  18572. var self=this;
  18573. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  18574. return smalltalk.withContext(function($ctx1) {
  18575. var $1;
  18576. $1=_st($Setting())._at_ifAbsent_(self,nil);
  18577. return $1;
  18578. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)})},
  18579. args: [],
  18580. source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
  18581. messageSends: ["at:ifAbsent:"],
  18582. referencedClasses: ["Setting"]
  18583. }),
  18584. globals.String);
  18585. smalltalk.addMethod(
  18586. smalltalk.method({
  18587. selector: "asSettingIfAbsent:",
  18588. protocol: '*Kernel-Infrastructure',
  18589. fn: function (aString){
  18590. var self=this;
  18591. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  18592. return smalltalk.withContext(function($ctx1) {
  18593. var $1;
  18594. $1=_st($Setting())._at_ifAbsent_(self,aString);
  18595. return $1;
  18596. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)})},
  18597. args: ["aString"],
  18598. source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
  18599. messageSends: ["at:ifAbsent:"],
  18600. referencedClasses: ["Setting"]
  18601. }),
  18602. globals.String);
  18603. smalltalk.addMethod(
  18604. smalltalk.method({
  18605. selector: "settingValue",
  18606. protocol: '*Kernel-Infrastructure',
  18607. fn: function (){
  18608. var self=this;
  18609. return smalltalk.withContext(function($ctx1) {
  18610. var $1;
  18611. $1=_st(self._asSetting())._value();
  18612. return $1;
  18613. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)})},
  18614. args: [],
  18615. source: "settingValue\x0a\x09^ self asSetting value",
  18616. messageSends: ["value", "asSetting"],
  18617. referencedClasses: []
  18618. }),
  18619. globals.String);
  18620. smalltalk.addMethod(
  18621. smalltalk.method({
  18622. selector: "settingValue:",
  18623. protocol: '*Kernel-Infrastructure',
  18624. fn: function (aString){
  18625. var self=this;
  18626. return smalltalk.withContext(function($ctx1) {
  18627. var $1;
  18628. $1=_st(self._asSetting())._value_(aString);
  18629. return $1;
  18630. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)})},
  18631. args: ["aString"],
  18632. source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
  18633. messageSends: ["value:", "asSetting"],
  18634. referencedClasses: []
  18635. }),
  18636. globals.String);
  18637. smalltalk.addMethod(
  18638. smalltalk.method({
  18639. selector: "settingValueIfAbsent:",
  18640. protocol: '*Kernel-Infrastructure',
  18641. fn: function (aString){
  18642. var self=this;
  18643. return smalltalk.withContext(function($ctx1) {
  18644. var $1;
  18645. $1=_st(self._asSettingIfAbsent_(aString))._value();
  18646. return $1;
  18647. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)})},
  18648. args: ["aString"],
  18649. source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
  18650. messageSends: ["value", "asSettingIfAbsent:"],
  18651. referencedClasses: []
  18652. }),
  18653. globals.String);
  18654. });
  18655. define("amber_core/Kernel-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  18656. smalltalk.addPackage('Kernel-Exceptions');
  18657. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18658. smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
  18659. 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.";
  18660. smalltalk.addMethod(
  18661. smalltalk.method({
  18662. selector: "context",
  18663. protocol: 'accessing',
  18664. fn: function (){
  18665. var self=this;
  18666. return smalltalk.withContext(function($ctx1) {
  18667. return self.context;
  18668. return self}, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)})},
  18669. args: [],
  18670. source: "context\x0a\x09<return self.context>",
  18671. messageSends: [],
  18672. referencedClasses: []
  18673. }),
  18674. globals.Error);
  18675. smalltalk.addMethod(
  18676. smalltalk.method({
  18677. selector: "initialize",
  18678. protocol: 'initialization',
  18679. fn: function (){
  18680. var self=this;
  18681. return smalltalk.withContext(function($ctx1) {
  18682. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  18683. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)})},
  18684. args: [],
  18685. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  18686. messageSends: ["messageText:", ",", "name", "class"],
  18687. referencedClasses: []
  18688. }),
  18689. globals.Error);
  18690. smalltalk.addMethod(
  18691. smalltalk.method({
  18692. selector: "isSmalltalkError",
  18693. protocol: 'testing',
  18694. fn: function (){
  18695. var self=this;
  18696. return smalltalk.withContext(function($ctx1) {
  18697. return self.smalltalkError === true;
  18698. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)})},
  18699. args: [],
  18700. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  18701. messageSends: [],
  18702. referencedClasses: []
  18703. }),
  18704. globals.Error);
  18705. smalltalk.addMethod(
  18706. smalltalk.method({
  18707. selector: "jsStack",
  18708. protocol: 'accessing',
  18709. fn: function (){
  18710. var self=this;
  18711. return smalltalk.withContext(function($ctx1) {
  18712. return self.stack;
  18713. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)})},
  18714. args: [],
  18715. source: "jsStack\x0a\x09<return self.stack>",
  18716. messageSends: [],
  18717. referencedClasses: []
  18718. }),
  18719. globals.Error);
  18720. smalltalk.addMethod(
  18721. smalltalk.method({
  18722. selector: "messageText",
  18723. protocol: 'accessing',
  18724. fn: function (){
  18725. var self=this;
  18726. var $1;
  18727. $1=self["@messageText"];
  18728. return $1;
  18729. },
  18730. args: [],
  18731. source: "messageText\x0a\x09^ messageText",
  18732. messageSends: [],
  18733. referencedClasses: []
  18734. }),
  18735. globals.Error);
  18736. smalltalk.addMethod(
  18737. smalltalk.method({
  18738. selector: "messageText:",
  18739. protocol: 'accessing',
  18740. fn: function (aString){
  18741. var self=this;
  18742. self["@messageText"]=aString;
  18743. return self},
  18744. args: ["aString"],
  18745. source: "messageText: aString\x0a\x09messageText := aString",
  18746. messageSends: [],
  18747. referencedClasses: []
  18748. }),
  18749. globals.Error);
  18750. smalltalk.addMethod(
  18751. smalltalk.method({
  18752. selector: "resignal",
  18753. protocol: 'signaling',
  18754. fn: function (){
  18755. var self=this;
  18756. return smalltalk.withContext(function($ctx1) {
  18757. throw(self);
  18758. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)})},
  18759. args: [],
  18760. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<throw(self)>",
  18761. messageSends: [],
  18762. referencedClasses: []
  18763. }),
  18764. globals.Error);
  18765. smalltalk.addMethod(
  18766. smalltalk.method({
  18767. selector: "signal",
  18768. protocol: 'signaling',
  18769. fn: function (){
  18770. var self=this;
  18771. return smalltalk.withContext(function($ctx1) {
  18772. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  18773. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)})},
  18774. args: [],
  18775. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  18776. messageSends: [],
  18777. referencedClasses: []
  18778. }),
  18779. globals.Error);
  18780. smalltalk.addMethod(
  18781. smalltalk.method({
  18782. selector: "signal:",
  18783. protocol: 'signaling',
  18784. fn: function (aString){
  18785. var self=this;
  18786. return smalltalk.withContext(function($ctx1) {
  18787. self._messageText_(aString);
  18788. self._signal();
  18789. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)})},
  18790. args: ["aString"],
  18791. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  18792. messageSends: ["messageText:", "signal"],
  18793. referencedClasses: []
  18794. }),
  18795. globals.Error);
  18796. smalltalk.addMethod(
  18797. smalltalk.method({
  18798. selector: "heliosClass",
  18799. protocol: 'helios',
  18800. fn: function (){
  18801. var self=this;
  18802. return "exception";
  18803. },
  18804. args: [],
  18805. source: "heliosClass\x0a\x09^ 'exception'",
  18806. messageSends: [],
  18807. referencedClasses: []
  18808. }),
  18809. globals.Error.klass);
  18810. smalltalk.addMethod(
  18811. smalltalk.method({
  18812. selector: "signal",
  18813. protocol: 'instance creation',
  18814. fn: function (){
  18815. var self=this;
  18816. return smalltalk.withContext(function($ctx1) {
  18817. var $1;
  18818. $1=_st(self._new())._signal();
  18819. return $1;
  18820. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)})},
  18821. args: [],
  18822. source: "signal\x0a\x09^ self new signal",
  18823. messageSends: ["signal", "new"],
  18824. referencedClasses: []
  18825. }),
  18826. globals.Error.klass);
  18827. smalltalk.addMethod(
  18828. smalltalk.method({
  18829. selector: "signal:",
  18830. protocol: 'instance creation',
  18831. fn: function (aString){
  18832. var self=this;
  18833. return smalltalk.withContext(function($ctx1) {
  18834. var $1;
  18835. $1=_st(self._new())._signal_(aString);
  18836. return $1;
  18837. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)})},
  18838. args: ["aString"],
  18839. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  18840. messageSends: ["signal:", "new"],
  18841. referencedClasses: []
  18842. }),
  18843. globals.Error.klass);
  18844. smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
  18845. 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:`";
  18846. smalltalk.addMethod(
  18847. smalltalk.method({
  18848. selector: "context:",
  18849. protocol: 'accessing',
  18850. fn: function (aMethodContext){
  18851. var self=this;
  18852. return smalltalk.withContext(function($ctx1) {
  18853. self.context = aMethodContext;
  18854. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)})},
  18855. args: ["aMethodContext"],
  18856. 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>",
  18857. messageSends: [],
  18858. referencedClasses: []
  18859. }),
  18860. globals.JavaScriptException);
  18861. smalltalk.addMethod(
  18862. smalltalk.method({
  18863. selector: "exception",
  18864. protocol: 'accessing',
  18865. fn: function (){
  18866. var self=this;
  18867. var $1;
  18868. $1=self["@exception"];
  18869. return $1;
  18870. },
  18871. args: [],
  18872. source: "exception\x0a\x09^ exception",
  18873. messageSends: [],
  18874. referencedClasses: []
  18875. }),
  18876. globals.JavaScriptException);
  18877. smalltalk.addMethod(
  18878. smalltalk.method({
  18879. selector: "exception:",
  18880. protocol: 'accessing',
  18881. fn: function (anException){
  18882. var self=this;
  18883. self["@exception"]=anException;
  18884. return self},
  18885. args: ["anException"],
  18886. source: "exception: anException\x0a\x09exception := anException",
  18887. messageSends: [],
  18888. referencedClasses: []
  18889. }),
  18890. globals.JavaScriptException);
  18891. smalltalk.addMethod(
  18892. smalltalk.method({
  18893. selector: "messageText",
  18894. protocol: 'accessing',
  18895. fn: function (){
  18896. var self=this;
  18897. return smalltalk.withContext(function($ctx1) {
  18898. return 'JavaScript exception: ' + self["@exception"].toString();
  18899. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)})},
  18900. args: [],
  18901. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  18902. messageSends: [],
  18903. referencedClasses: []
  18904. }),
  18905. globals.JavaScriptException);
  18906. smalltalk.addMethod(
  18907. smalltalk.method({
  18908. selector: "on:",
  18909. protocol: 'instance creation',
  18910. fn: function (anException){
  18911. var self=this;
  18912. return smalltalk.withContext(function($ctx1) {
  18913. var $2,$3,$1;
  18914. $2=self._new();
  18915. _st($2)._exception_(anException);
  18916. $3=_st($2)._yourself();
  18917. $1=$3;
  18918. return $1;
  18919. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)})},
  18920. args: ["anException"],
  18921. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  18922. messageSends: ["exception:", "new", "yourself"],
  18923. referencedClasses: []
  18924. }),
  18925. globals.JavaScriptException.klass);
  18926. smalltalk.addMethod(
  18927. smalltalk.method({
  18928. selector: "on:context:",
  18929. protocol: 'instance creation',
  18930. fn: function (anException,aMethodContext){
  18931. var self=this;
  18932. return smalltalk.withContext(function($ctx1) {
  18933. var $2,$3,$1;
  18934. $2=self._new();
  18935. _st($2)._exception_(anException);
  18936. _st($2)._context_(aMethodContext);
  18937. $3=_st($2)._yourself();
  18938. $1=$3;
  18939. return $1;
  18940. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)})},
  18941. args: ["anException", "aMethodContext"],
  18942. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  18943. messageSends: ["exception:", "new", "context:", "yourself"],
  18944. referencedClasses: []
  18945. }),
  18946. globals.JavaScriptException.klass);
  18947. smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  18948. globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  18949. smalltalk.addMethod(
  18950. smalltalk.method({
  18951. selector: "message",
  18952. protocol: 'accessing',
  18953. fn: function (){
  18954. var self=this;
  18955. var $1;
  18956. $1=self["@message"];
  18957. return $1;
  18958. },
  18959. args: [],
  18960. source: "message\x0a\x09^ message",
  18961. messageSends: [],
  18962. referencedClasses: []
  18963. }),
  18964. globals.MessageNotUnderstood);
  18965. smalltalk.addMethod(
  18966. smalltalk.method({
  18967. selector: "message:",
  18968. protocol: 'accessing',
  18969. fn: function (aMessage){
  18970. var self=this;
  18971. self["@message"]=aMessage;
  18972. return self},
  18973. args: ["aMessage"],
  18974. source: "message: aMessage\x0a\x09message := aMessage",
  18975. messageSends: [],
  18976. referencedClasses: []
  18977. }),
  18978. globals.MessageNotUnderstood);
  18979. smalltalk.addMethod(
  18980. smalltalk.method({
  18981. selector: "messageText",
  18982. protocol: 'accessing',
  18983. fn: function (){
  18984. var self=this;
  18985. return smalltalk.withContext(function($ctx1) {
  18986. var $1;
  18987. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  18988. $ctx1.sendIdx[","]=1;
  18989. return $1;
  18990. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)})},
  18991. args: [],
  18992. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  18993. messageSends: [",", "asString", "receiver", "selector", "message"],
  18994. referencedClasses: []
  18995. }),
  18996. globals.MessageNotUnderstood);
  18997. smalltalk.addMethod(
  18998. smalltalk.method({
  18999. selector: "receiver",
  19000. protocol: 'accessing',
  19001. fn: function (){
  19002. var self=this;
  19003. var $1;
  19004. $1=self["@receiver"];
  19005. return $1;
  19006. },
  19007. args: [],
  19008. source: "receiver\x0a\x09^ receiver",
  19009. messageSends: [],
  19010. referencedClasses: []
  19011. }),
  19012. globals.MessageNotUnderstood);
  19013. smalltalk.addMethod(
  19014. smalltalk.method({
  19015. selector: "receiver:",
  19016. protocol: 'accessing',
  19017. fn: function (anObject){
  19018. var self=this;
  19019. self["@receiver"]=anObject;
  19020. return self},
  19021. args: ["anObject"],
  19022. source: "receiver: anObject\x0a\x09receiver := anObject",
  19023. messageSends: [],
  19024. referencedClasses: []
  19025. }),
  19026. globals.MessageNotUnderstood);
  19027. smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
  19028. globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  19029. smalltalk.addMethod(
  19030. smalltalk.method({
  19031. selector: "object",
  19032. protocol: 'accessing',
  19033. fn: function (){
  19034. var self=this;
  19035. var $1;
  19036. $1=self["@object"];
  19037. return $1;
  19038. },
  19039. args: [],
  19040. source: "object\x0a\x09^ object",
  19041. messageSends: [],
  19042. referencedClasses: []
  19043. }),
  19044. globals.NonBooleanReceiver);
  19045. smalltalk.addMethod(
  19046. smalltalk.method({
  19047. selector: "object:",
  19048. protocol: 'accessing',
  19049. fn: function (anObject){
  19050. var self=this;
  19051. self["@object"]=anObject;
  19052. return self},
  19053. args: ["anObject"],
  19054. source: "object: anObject\x0a\x09object := anObject",
  19055. messageSends: [],
  19056. referencedClasses: []
  19057. }),
  19058. globals.NonBooleanReceiver);
  19059. });
  19060. define("amber_core/Kernel-Transcript", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  19061. smalltalk.addPackage('Kernel-Transcript');
  19062. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19063. smalltalk.addClass('ConsoleTranscript', globals.Object, ['textarea'], 'Kernel-Transcript');
  19064. globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  19065. smalltalk.addMethod(
  19066. smalltalk.method({
  19067. selector: "clear",
  19068. protocol: 'printing',
  19069. fn: function (){
  19070. var self=this;
  19071. return self},
  19072. args: [],
  19073. source: "clear\x0a\x09\x22no op\x22",
  19074. messageSends: [],
  19075. referencedClasses: []
  19076. }),
  19077. globals.ConsoleTranscript);
  19078. smalltalk.addMethod(
  19079. smalltalk.method({
  19080. selector: "cr",
  19081. protocol: 'printing',
  19082. fn: function (){
  19083. var self=this;
  19084. return self},
  19085. args: [],
  19086. source: "cr\x0a\x09\x22no op\x22",
  19087. messageSends: [],
  19088. referencedClasses: []
  19089. }),
  19090. globals.ConsoleTranscript);
  19091. smalltalk.addMethod(
  19092. smalltalk.method({
  19093. selector: "open",
  19094. protocol: 'actions',
  19095. fn: function (){
  19096. var self=this;
  19097. return self},
  19098. args: [],
  19099. source: "open",
  19100. messageSends: [],
  19101. referencedClasses: []
  19102. }),
  19103. globals.ConsoleTranscript);
  19104. smalltalk.addMethod(
  19105. smalltalk.method({
  19106. selector: "show:",
  19107. protocol: 'printing',
  19108. fn: function (anObject){
  19109. var self=this;
  19110. return smalltalk.withContext(function($ctx1) {
  19111. console.log(String(_st(anObject)._asString()));
  19112. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)})},
  19113. args: ["anObject"],
  19114. 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(_st(anObject)._asString()))>",
  19115. messageSends: [],
  19116. referencedClasses: []
  19117. }),
  19118. globals.ConsoleTranscript);
  19119. smalltalk.addMethod(
  19120. smalltalk.method({
  19121. selector: "initialize",
  19122. protocol: 'initialization',
  19123. fn: function (){
  19124. var self=this;
  19125. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  19126. return smalltalk.withContext(function($ctx1) {
  19127. _st($Transcript())._registerIfNone_(self._new());
  19128. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)})},
  19129. args: [],
  19130. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  19131. messageSends: ["registerIfNone:", "new"],
  19132. referencedClasses: ["Transcript"]
  19133. }),
  19134. globals.ConsoleTranscript.klass);
  19135. });
  19136. define("amber_core/Kernel-Announcements", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  19137. smalltalk.addPackage('Kernel-Announcements');
  19138. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19139. smalltalk.addClass('AnnouncementSubscription', globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  19140. globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  19141. smalltalk.addMethod(
  19142. smalltalk.method({
  19143. selector: "announcementClass",
  19144. protocol: 'accessing',
  19145. fn: function (){
  19146. var self=this;
  19147. var $1;
  19148. $1=self["@announcementClass"];
  19149. return $1;
  19150. },
  19151. args: [],
  19152. source: "announcementClass\x0a\x09^ announcementClass",
  19153. messageSends: [],
  19154. referencedClasses: []
  19155. }),
  19156. globals.AnnouncementSubscription);
  19157. smalltalk.addMethod(
  19158. smalltalk.method({
  19159. selector: "announcementClass:",
  19160. protocol: 'accessing',
  19161. fn: function (aClass){
  19162. var self=this;
  19163. self["@announcementClass"]=aClass;
  19164. return self},
  19165. args: ["aClass"],
  19166. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  19167. messageSends: [],
  19168. referencedClasses: []
  19169. }),
  19170. globals.AnnouncementSubscription);
  19171. smalltalk.addMethod(
  19172. smalltalk.method({
  19173. selector: "block",
  19174. protocol: 'accessing',
  19175. fn: function (){
  19176. var self=this;
  19177. return smalltalk.withContext(function($ctx1) {
  19178. var $1;
  19179. self._deprecatedAPI();
  19180. $1=self._valuable();
  19181. return $1;
  19182. }, function($ctx1) {$ctx1.fill(self,"block",{},globals.AnnouncementSubscription)})},
  19183. args: [],
  19184. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  19185. messageSends: ["deprecatedAPI", "valuable"],
  19186. referencedClasses: []
  19187. }),
  19188. globals.AnnouncementSubscription);
  19189. smalltalk.addMethod(
  19190. smalltalk.method({
  19191. selector: "block:",
  19192. protocol: 'accessing',
  19193. fn: function (aValuable){
  19194. var self=this;
  19195. return smalltalk.withContext(function($ctx1) {
  19196. self._deprecatedAPI();
  19197. self._valuable_(aValuable);
  19198. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},globals.AnnouncementSubscription)})},
  19199. args: ["aValuable"],
  19200. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  19201. messageSends: ["deprecatedAPI", "valuable:"],
  19202. referencedClasses: []
  19203. }),
  19204. globals.AnnouncementSubscription);
  19205. smalltalk.addMethod(
  19206. smalltalk.method({
  19207. selector: "deliver:",
  19208. protocol: 'announcing',
  19209. fn: function (anAnnouncement){
  19210. var self=this;
  19211. return smalltalk.withContext(function($ctx1) {
  19212. var $1;
  19213. $1=self._handlesAnnouncement_(anAnnouncement);
  19214. if(smalltalk.assert($1)){
  19215. _st(self._valuable())._value_(anAnnouncement);
  19216. };
  19217. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
  19218. args: ["anAnnouncement"],
  19219. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  19220. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"],
  19221. referencedClasses: []
  19222. }),
  19223. globals.AnnouncementSubscription);
  19224. smalltalk.addMethod(
  19225. smalltalk.method({
  19226. selector: "handlesAnnouncement:",
  19227. protocol: 'announcing',
  19228. fn: function (anAnnouncement){
  19229. var self=this;
  19230. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19231. return smalltalk.withContext(function($ctx1) {
  19232. var $3,$4,$2,$1;
  19233. $3=_st($Smalltalk())._globals();
  19234. $ctx1.sendIdx["globals"]=1;
  19235. $4=_st(self._announcementClass())._name();
  19236. $ctx1.sendIdx["name"]=1;
  19237. $2=_st($3)._at_($4);
  19238. $ctx1.sendIdx["at:"]=1;
  19239. if(($receiver = $2) == nil || $receiver == null){
  19240. return false;
  19241. } else {
  19242. var class_;
  19243. class_=$receiver;
  19244. $1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  19245. };
  19246. return $1;
  19247. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
  19248. args: ["anAnnouncement"],
  19249. 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 ]",
  19250. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
  19251. referencedClasses: ["Smalltalk"]
  19252. }),
  19253. globals.AnnouncementSubscription);
  19254. smalltalk.addMethod(
  19255. smalltalk.method({
  19256. selector: "receiver",
  19257. protocol: 'accessing',
  19258. fn: function (){
  19259. var self=this;
  19260. return smalltalk.withContext(function($ctx1) {
  19261. var $1;
  19262. $1=_st(self._valuable())._receiver();
  19263. return $1;
  19264. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AnnouncementSubscription)})},
  19265. args: [],
  19266. source: "receiver\x0a\x09^ self valuable receiver",
  19267. messageSends: ["receiver", "valuable"],
  19268. referencedClasses: []
  19269. }),
  19270. globals.AnnouncementSubscription);
  19271. smalltalk.addMethod(
  19272. smalltalk.method({
  19273. selector: "valuable",
  19274. protocol: 'accessing',
  19275. fn: function (){
  19276. var self=this;
  19277. var $1;
  19278. $1=self["@valuable"];
  19279. return $1;
  19280. },
  19281. args: [],
  19282. source: "valuable\x0a\x09^ valuable",
  19283. messageSends: [],
  19284. referencedClasses: []
  19285. }),
  19286. globals.AnnouncementSubscription);
  19287. smalltalk.addMethod(
  19288. smalltalk.method({
  19289. selector: "valuable:",
  19290. protocol: 'accessing',
  19291. fn: function (aValuable){
  19292. var self=this;
  19293. self["@valuable"]=aValuable;
  19294. return self},
  19295. args: ["aValuable"],
  19296. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  19297. messageSends: [],
  19298. referencedClasses: []
  19299. }),
  19300. globals.AnnouncementSubscription);
  19301. smalltalk.addClass('Announcer', globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  19302. 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' ].";
  19303. smalltalk.addMethod(
  19304. smalltalk.method({
  19305. selector: "announce:",
  19306. protocol: 'announcing',
  19307. fn: function (anAnnouncement){
  19308. var self=this;
  19309. return smalltalk.withContext(function($ctx1) {
  19310. _st(self["@subscriptions"])._do_((function(each){
  19311. return smalltalk.withContext(function($ctx2) {
  19312. return _st(each)._deliver_(anAnnouncement);
  19313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  19314. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},globals.Announcer)})},
  19315. args: ["anAnnouncement"],
  19316. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  19317. messageSends: ["do:", "deliver:"],
  19318. referencedClasses: []
  19319. }),
  19320. globals.Announcer);
  19321. smalltalk.addMethod(
  19322. smalltalk.method({
  19323. selector: "initialize",
  19324. protocol: 'initialization',
  19325. fn: function (){
  19326. var self=this;
  19327. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  19328. return smalltalk.withContext(function($ctx1) {
  19329. globals.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []);
  19330. self["@subscriptions"]=_st($OrderedCollection())._new();
  19331. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Announcer)})},
  19332. args: [],
  19333. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  19334. messageSends: ["initialize", "new"],
  19335. referencedClasses: ["OrderedCollection"]
  19336. }),
  19337. globals.Announcer);
  19338. smalltalk.addMethod(
  19339. smalltalk.method({
  19340. selector: "on:do:",
  19341. protocol: 'subscribing',
  19342. fn: function (aClass,aBlock){
  19343. var self=this;
  19344. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  19345. return smalltalk.withContext(function($ctx1) {
  19346. var $1,$2;
  19347. $1=_st($AnnouncementSubscription())._new();
  19348. _st($1)._valuable_(aBlock);
  19349. _st($1)._announcementClass_(aClass);
  19350. $2=_st($1)._yourself();
  19351. _st(self["@subscriptions"])._add_($2);
  19352. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},globals.Announcer)})},
  19353. args: ["aClass", "aBlock"],
  19354. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  19355. messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
  19356. referencedClasses: ["AnnouncementSubscription"]
  19357. }),
  19358. globals.Announcer);
  19359. smalltalk.addMethod(
  19360. smalltalk.method({
  19361. selector: "on:doOnce:",
  19362. protocol: 'subscribing',
  19363. fn: function (aClass,aBlock){
  19364. var self=this;
  19365. var subscription;
  19366. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  19367. return smalltalk.withContext(function($ctx1) {
  19368. var $1,$2;
  19369. $1=_st($AnnouncementSubscription())._new();
  19370. _st($1)._announcementClass_(aClass);
  19371. $2=_st($1)._yourself();
  19372. subscription=$2;
  19373. _st(subscription)._valuable_((function(ann){
  19374. return smalltalk.withContext(function($ctx2) {
  19375. _st(self["@subscriptions"])._remove_(subscription);
  19376. return _st(aBlock)._value_(ann);
  19377. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)})}));
  19378. _st(self["@subscriptions"])._add_(subscription);
  19379. return self}, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},globals.Announcer)})},
  19380. args: ["aClass", "aBlock"],
  19381. 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",
  19382. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"],
  19383. referencedClasses: ["AnnouncementSubscription"]
  19384. }),
  19385. globals.Announcer);
  19386. smalltalk.addMethod(
  19387. smalltalk.method({
  19388. selector: "on:send:to:",
  19389. protocol: 'subscribing',
  19390. fn: function (aClass,aSelector,anObject){
  19391. var self=this;
  19392. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  19393. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  19394. return smalltalk.withContext(function($ctx1) {
  19395. var $1,$3,$4,$6,$7,$5,$8,$2;
  19396. $1=self["@subscriptions"];
  19397. $3=_st($AnnouncementSubscription())._new();
  19398. $ctx1.sendIdx["new"]=1;
  19399. $4=$3;
  19400. $6=_st($MessageSend())._new();
  19401. _st($6)._receiver_(anObject);
  19402. _st($6)._selector_(aSelector);
  19403. $7=_st($6)._yourself();
  19404. $ctx1.sendIdx["yourself"]=1;
  19405. $5=$7;
  19406. _st($4)._valuable_($5);
  19407. _st($3)._announcementClass_(aClass);
  19408. $8=_st($3)._yourself();
  19409. $2=$8;
  19410. _st($1)._add_($2);
  19411. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},globals.Announcer)})},
  19412. args: ["aClass", "aSelector", "anObject"],
  19413. 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)",
  19414. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"],
  19415. referencedClasses: ["AnnouncementSubscription", "MessageSend"]
  19416. }),
  19417. globals.Announcer);
  19418. smalltalk.addMethod(
  19419. smalltalk.method({
  19420. selector: "unsubscribe:",
  19421. protocol: 'subscribing',
  19422. fn: function (anObject){
  19423. var self=this;
  19424. return smalltalk.withContext(function($ctx1) {
  19425. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  19426. return smalltalk.withContext(function($ctx2) {
  19427. return _st(_st(each)._receiver()).__eq(anObject);
  19428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  19429. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},globals.Announcer)})},
  19430. args: ["anObject"],
  19431. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  19432. messageSends: ["reject:", "=", "receiver"],
  19433. referencedClasses: []
  19434. }),
  19435. globals.Announcer);
  19436. smalltalk.addClass('SystemAnnouncer', globals.Announcer, [], 'Kernel-Announcements');
  19437. 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`";
  19438. globals.SystemAnnouncer.klass.iVarNames = ['current'];
  19439. smalltalk.addMethod(
  19440. smalltalk.method({
  19441. selector: "current",
  19442. protocol: 'accessing',
  19443. fn: function (){
  19444. var self=this;
  19445. return smalltalk.withContext(function($ctx1) {
  19446. var $2,$1;
  19447. $2=self["@current"];
  19448. if(($receiver = $2) == nil || $receiver == null){
  19449. self["@current"]=globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []);
  19450. $1=self["@current"];
  19451. } else {
  19452. $1=$2;
  19453. };
  19454. return $1;
  19455. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SystemAnnouncer.klass)})},
  19456. args: [],
  19457. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  19458. messageSends: ["ifNil:", "new"],
  19459. referencedClasses: []
  19460. }),
  19461. globals.SystemAnnouncer.klass);
  19462. smalltalk.addMethod(
  19463. smalltalk.method({
  19464. selector: "new",
  19465. protocol: 'instance creation',
  19466. fn: function (){
  19467. var self=this;
  19468. return smalltalk.withContext(function($ctx1) {
  19469. self._shouldNotImplement();
  19470. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SystemAnnouncer.klass)})},
  19471. args: [],
  19472. source: "new\x0a\x09self shouldNotImplement",
  19473. messageSends: ["shouldNotImplement"],
  19474. referencedClasses: []
  19475. }),
  19476. globals.SystemAnnouncer.klass);
  19477. smalltalk.addClass('SystemAnnouncement', globals.Object, [], 'Kernel-Announcements');
  19478. globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  19479. smalltalk.addMethod(
  19480. smalltalk.method({
  19481. selector: "heliosClass",
  19482. protocol: 'helios',
  19483. fn: function (){
  19484. var self=this;
  19485. return "announcement";
  19486. },
  19487. args: [],
  19488. source: "heliosClass\x0a\x09^ 'announcement'",
  19489. messageSends: [],
  19490. referencedClasses: []
  19491. }),
  19492. globals.SystemAnnouncement.klass);
  19493. smalltalk.addClass('ClassAnnouncement', globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  19494. globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  19495. smalltalk.addMethod(
  19496. smalltalk.method({
  19497. selector: "theClass",
  19498. protocol: 'accessing',
  19499. fn: function (){
  19500. var self=this;
  19501. var $1;
  19502. $1=self["@theClass"];
  19503. return $1;
  19504. },
  19505. args: [],
  19506. source: "theClass\x0a\x09^ theClass",
  19507. messageSends: [],
  19508. referencedClasses: []
  19509. }),
  19510. globals.ClassAnnouncement);
  19511. smalltalk.addMethod(
  19512. smalltalk.method({
  19513. selector: "theClass:",
  19514. protocol: 'accessing',
  19515. fn: function (aClass){
  19516. var self=this;
  19517. self["@theClass"]=aClass;
  19518. return self},
  19519. args: ["aClass"],
  19520. source: "theClass: aClass\x0a\x09theClass := aClass",
  19521. messageSends: [],
  19522. referencedClasses: []
  19523. }),
  19524. globals.ClassAnnouncement);
  19525. smalltalk.addClass('ClassAdded', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  19526. globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  19527. smalltalk.addClass('ClassCommentChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  19528. globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  19529. smalltalk.addClass('ClassDefinitionChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  19530. globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  19531. smalltalk.addClass('ClassMigrated', globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  19532. globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  19533. smalltalk.addMethod(
  19534. smalltalk.method({
  19535. selector: "oldClass",
  19536. protocol: 'accessing',
  19537. fn: function (){
  19538. var self=this;
  19539. var $1;
  19540. $1=self["@oldClass"];
  19541. return $1;
  19542. },
  19543. args: [],
  19544. source: "oldClass\x0a\x09^ oldClass",
  19545. messageSends: [],
  19546. referencedClasses: []
  19547. }),
  19548. globals.ClassMigrated);
  19549. smalltalk.addMethod(
  19550. smalltalk.method({
  19551. selector: "oldClass:",
  19552. protocol: 'accessing',
  19553. fn: function (aClass){
  19554. var self=this;
  19555. self["@oldClass"]=aClass;
  19556. return self},
  19557. args: ["aClass"],
  19558. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  19559. messageSends: [],
  19560. referencedClasses: []
  19561. }),
  19562. globals.ClassMigrated);
  19563. smalltalk.addClass('ClassMoved', globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  19564. globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  19565. smalltalk.addMethod(
  19566. smalltalk.method({
  19567. selector: "oldPackage",
  19568. protocol: 'accessing',
  19569. fn: function (){
  19570. var self=this;
  19571. var $1;
  19572. $1=self["@oldPackage"];
  19573. return $1;
  19574. },
  19575. args: [],
  19576. source: "oldPackage\x0a\x09^ oldPackage",
  19577. messageSends: [],
  19578. referencedClasses: []
  19579. }),
  19580. globals.ClassMoved);
  19581. smalltalk.addMethod(
  19582. smalltalk.method({
  19583. selector: "oldPackage:",
  19584. protocol: 'accessing',
  19585. fn: function (aPackage){
  19586. var self=this;
  19587. self["@oldPackage"]=aPackage;
  19588. return self},
  19589. args: ["aPackage"],
  19590. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  19591. messageSends: [],
  19592. referencedClasses: []
  19593. }),
  19594. globals.ClassMoved);
  19595. smalltalk.addClass('ClassRemoved', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  19596. globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  19597. smalltalk.addClass('ClassRenamed', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  19598. globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  19599. smalltalk.addClass('MethodAnnouncement', globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  19600. globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  19601. smalltalk.addMethod(
  19602. smalltalk.method({
  19603. selector: "method",
  19604. protocol: 'accessing',
  19605. fn: function (){
  19606. var self=this;
  19607. var $1;
  19608. $1=self["@method"];
  19609. return $1;
  19610. },
  19611. args: [],
  19612. source: "method\x0a\x09^ method",
  19613. messageSends: [],
  19614. referencedClasses: []
  19615. }),
  19616. globals.MethodAnnouncement);
  19617. smalltalk.addMethod(
  19618. smalltalk.method({
  19619. selector: "method:",
  19620. protocol: 'accessing',
  19621. fn: function (aCompiledMethod){
  19622. var self=this;
  19623. self["@method"]=aCompiledMethod;
  19624. return self},
  19625. args: ["aCompiledMethod"],
  19626. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  19627. messageSends: [],
  19628. referencedClasses: []
  19629. }),
  19630. globals.MethodAnnouncement);
  19631. smalltalk.addClass('MethodAdded', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  19632. globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  19633. smalltalk.addClass('MethodModified', globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  19634. 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.";
  19635. smalltalk.addMethod(
  19636. smalltalk.method({
  19637. selector: "oldMethod",
  19638. protocol: 'accessing',
  19639. fn: function (){
  19640. var self=this;
  19641. var $1;
  19642. $1=self["@oldMethod"];
  19643. return $1;
  19644. },
  19645. args: [],
  19646. source: "oldMethod\x0a\x09^ oldMethod",
  19647. messageSends: [],
  19648. referencedClasses: []
  19649. }),
  19650. globals.MethodModified);
  19651. smalltalk.addMethod(
  19652. smalltalk.method({
  19653. selector: "oldMethod:",
  19654. protocol: 'accessing',
  19655. fn: function (aMethod){
  19656. var self=this;
  19657. self["@oldMethod"]=aMethod;
  19658. return self},
  19659. args: ["aMethod"],
  19660. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  19661. messageSends: [],
  19662. referencedClasses: []
  19663. }),
  19664. globals.MethodModified);
  19665. smalltalk.addClass('MethodMoved', globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  19666. 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.";
  19667. smalltalk.addMethod(
  19668. smalltalk.method({
  19669. selector: "oldProtocol",
  19670. protocol: 'accessing',
  19671. fn: function (){
  19672. var self=this;
  19673. var $1;
  19674. $1=self["@oldProtocol"];
  19675. return $1;
  19676. },
  19677. args: [],
  19678. source: "oldProtocol\x0a\x09^ oldProtocol",
  19679. messageSends: [],
  19680. referencedClasses: []
  19681. }),
  19682. globals.MethodMoved);
  19683. smalltalk.addMethod(
  19684. smalltalk.method({
  19685. selector: "oldProtocol:",
  19686. protocol: 'accessing',
  19687. fn: function (aString){
  19688. var self=this;
  19689. self["@oldProtocol"]=aString;
  19690. return self},
  19691. args: ["aString"],
  19692. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  19693. messageSends: [],
  19694. referencedClasses: []
  19695. }),
  19696. globals.MethodMoved);
  19697. smalltalk.addClass('MethodRemoved', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  19698. globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  19699. smalltalk.addClass('PackageAnnouncement', globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  19700. globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  19701. smalltalk.addMethod(
  19702. smalltalk.method({
  19703. selector: "package",
  19704. protocol: 'accessing',
  19705. fn: function (){
  19706. var self=this;
  19707. var $1;
  19708. $1=self["@package"];
  19709. return $1;
  19710. },
  19711. args: [],
  19712. source: "package\x0a\x09^ package",
  19713. messageSends: [],
  19714. referencedClasses: []
  19715. }),
  19716. globals.PackageAnnouncement);
  19717. smalltalk.addMethod(
  19718. smalltalk.method({
  19719. selector: "package:",
  19720. protocol: 'accessing',
  19721. fn: function (aPackage){
  19722. var self=this;
  19723. self["@package"]=aPackage;
  19724. return self},
  19725. args: ["aPackage"],
  19726. source: "package: aPackage\x0a\x09package := aPackage",
  19727. messageSends: [],
  19728. referencedClasses: []
  19729. }),
  19730. globals.PackageAnnouncement);
  19731. smalltalk.addClass('PackageAdded', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  19732. globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  19733. smalltalk.addClass('PackageRemoved', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  19734. globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  19735. smalltalk.addClass('ProtocolAnnouncement', globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  19736. globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  19737. smalltalk.addMethod(
  19738. smalltalk.method({
  19739. selector: "protocol",
  19740. protocol: 'accessing',
  19741. fn: function (){
  19742. var self=this;
  19743. var $1;
  19744. $1=self["@protocol"];
  19745. return $1;
  19746. },
  19747. args: [],
  19748. source: "protocol\x0a\x09^ protocol",
  19749. messageSends: [],
  19750. referencedClasses: []
  19751. }),
  19752. globals.ProtocolAnnouncement);
  19753. smalltalk.addMethod(
  19754. smalltalk.method({
  19755. selector: "protocol:",
  19756. protocol: 'accessing',
  19757. fn: function (aString){
  19758. var self=this;
  19759. self["@protocol"]=aString;
  19760. return self},
  19761. args: ["aString"],
  19762. source: "protocol: aString\x0a\x09protocol := aString",
  19763. messageSends: [],
  19764. referencedClasses: []
  19765. }),
  19766. globals.ProtocolAnnouncement);
  19767. smalltalk.addMethod(
  19768. smalltalk.method({
  19769. selector: "theClass",
  19770. protocol: 'accessing',
  19771. fn: function (){
  19772. var self=this;
  19773. var $1;
  19774. $1=self["@theClass"];
  19775. return $1;
  19776. },
  19777. args: [],
  19778. source: "theClass\x0a\x09^ theClass",
  19779. messageSends: [],
  19780. referencedClasses: []
  19781. }),
  19782. globals.ProtocolAnnouncement);
  19783. smalltalk.addMethod(
  19784. smalltalk.method({
  19785. selector: "theClass:",
  19786. protocol: 'accessing',
  19787. fn: function (aClass){
  19788. var self=this;
  19789. self["@theClass"]=aClass;
  19790. return self},
  19791. args: ["aClass"],
  19792. source: "theClass: aClass\x0a\x09theClass := aClass",
  19793. messageSends: [],
  19794. referencedClasses: []
  19795. }),
  19796. globals.ProtocolAnnouncement);
  19797. smalltalk.addClass('ProtocolAdded', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  19798. globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  19799. smalltalk.addClass('ProtocolRemoved', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  19800. globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  19801. });
  19802. define("amber_core/Compiler-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  19803. smalltalk.addPackage('Compiler-Exceptions');
  19804. smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19805. smalltalk.addClass('CompilerError', globals.Error, [], 'Compiler-Exceptions');
  19806. globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  19807. smalltalk.addClass('ParseError', globals.CompilerError, [], 'Compiler-Exceptions');
  19808. globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19809. smalltalk.addClass('SemanticError', globals.CompilerError, [], 'Compiler-Exceptions');
  19810. 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";
  19811. smalltalk.addClass('InliningError', globals.SemanticError, [], 'Compiler-Exceptions');
  19812. globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  19813. smalltalk.addClass('InvalidAssignmentError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  19814. globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  19815. smalltalk.addMethod(
  19816. smalltalk.method({
  19817. selector: "messageText",
  19818. protocol: 'accessing',
  19819. fn: function (){
  19820. var self=this;
  19821. return smalltalk.withContext(function($ctx1) {
  19822. var $1;
  19823. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  19824. return $1;
  19825. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.InvalidAssignmentError)})},
  19826. args: [],
  19827. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  19828. messageSends: [",", "variableName"],
  19829. referencedClasses: []
  19830. }),
  19831. globals.InvalidAssignmentError);
  19832. smalltalk.addMethod(
  19833. smalltalk.method({
  19834. selector: "variableName",
  19835. protocol: 'accessing',
  19836. fn: function (){
  19837. var self=this;
  19838. var $1;
  19839. $1=self["@variableName"];
  19840. return $1;
  19841. },
  19842. args: [],
  19843. source: "variableName\x0a\x09^ variableName",
  19844. messageSends: [],
  19845. referencedClasses: []
  19846. }),
  19847. globals.InvalidAssignmentError);
  19848. smalltalk.addMethod(
  19849. smalltalk.method({
  19850. selector: "variableName:",
  19851. protocol: 'accessing',
  19852. fn: function (aString){
  19853. var self=this;
  19854. self["@variableName"]=aString;
  19855. return self},
  19856. args: ["aString"],
  19857. source: "variableName: aString\x0a\x09variableName := aString",
  19858. messageSends: [],
  19859. referencedClasses: []
  19860. }),
  19861. globals.InvalidAssignmentError);
  19862. smalltalk.addClass('ShadowingVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  19863. 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.";
  19864. smalltalk.addMethod(
  19865. smalltalk.method({
  19866. selector: "messageText",
  19867. protocol: 'accessing',
  19868. fn: function (){
  19869. var self=this;
  19870. return smalltalk.withContext(function($ctx1) {
  19871. var $1;
  19872. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  19873. $ctx1.sendIdx[","]=1;
  19874. return $1;
  19875. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.ShadowingVariableError)})},
  19876. args: [],
  19877. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  19878. messageSends: [",", "variableName"],
  19879. referencedClasses: []
  19880. }),
  19881. globals.ShadowingVariableError);
  19882. smalltalk.addMethod(
  19883. smalltalk.method({
  19884. selector: "variableName",
  19885. protocol: 'accessing',
  19886. fn: function (){
  19887. var self=this;
  19888. var $1;
  19889. $1=self["@variableName"];
  19890. return $1;
  19891. },
  19892. args: [],
  19893. source: "variableName\x0a\x09^ variableName",
  19894. messageSends: [],
  19895. referencedClasses: []
  19896. }),
  19897. globals.ShadowingVariableError);
  19898. smalltalk.addMethod(
  19899. smalltalk.method({
  19900. selector: "variableName:",
  19901. protocol: 'accessing',
  19902. fn: function (aString){
  19903. var self=this;
  19904. self["@variableName"]=aString;
  19905. return self},
  19906. args: ["aString"],
  19907. source: "variableName: aString\x0a\x09variableName := aString",
  19908. messageSends: [],
  19909. referencedClasses: []
  19910. }),
  19911. globals.ShadowingVariableError);
  19912. smalltalk.addClass('UnknownVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  19913. 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.";
  19914. smalltalk.addMethod(
  19915. smalltalk.method({
  19916. selector: "messageText",
  19917. protocol: 'accessing',
  19918. fn: function (){
  19919. var self=this;
  19920. return smalltalk.withContext(function($ctx1) {
  19921. var $1;
  19922. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  19923. $ctx1.sendIdx[","]=1;
  19924. return $1;
  19925. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.UnknownVariableError)})},
  19926. args: [],
  19927. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  19928. messageSends: [",", "variableName"],
  19929. referencedClasses: []
  19930. }),
  19931. globals.UnknownVariableError);
  19932. smalltalk.addMethod(
  19933. smalltalk.method({
  19934. selector: "variableName",
  19935. protocol: 'accessing',
  19936. fn: function (){
  19937. var self=this;
  19938. var $1;
  19939. $1=self["@variableName"];
  19940. return $1;
  19941. },
  19942. args: [],
  19943. source: "variableName\x0a\x09^ variableName",
  19944. messageSends: [],
  19945. referencedClasses: []
  19946. }),
  19947. globals.UnknownVariableError);
  19948. smalltalk.addMethod(
  19949. smalltalk.method({
  19950. selector: "variableName:",
  19951. protocol: 'accessing',
  19952. fn: function (aString){
  19953. var self=this;
  19954. self["@variableName"]=aString;
  19955. return self},
  19956. args: ["aString"],
  19957. source: "variableName: aString\x0a\x09variableName := aString",
  19958. messageSends: [],
  19959. referencedClasses: []
  19960. }),
  19961. globals.UnknownVariableError);
  19962. smalltalk.addClass('RethrowErrorHandler', globals.Object, [], 'Compiler-Exceptions');
  19963. 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.";
  19964. smalltalk.addMethod(
  19965. smalltalk.method({
  19966. selector: "basicSignal:",
  19967. protocol: 'error handling',
  19968. fn: function (anError){
  19969. var self=this;
  19970. return smalltalk.withContext(function($ctx1) {
  19971. throw anError;
  19972. return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},globals.RethrowErrorHandler)})},
  19973. args: ["anError"],
  19974. source: "basicSignal: anError\x0a <throw anError>",
  19975. messageSends: [],
  19976. referencedClasses: []
  19977. }),
  19978. globals.RethrowErrorHandler);
  19979. smalltalk.addMethod(
  19980. smalltalk.method({
  19981. selector: "handleError:",
  19982. protocol: 'error handling',
  19983. fn: function (anError){
  19984. var self=this;
  19985. return smalltalk.withContext(function($ctx1) {
  19986. globals.RethrowErrorHandler.superclass.fn.prototype._handleError_.apply(_st(self), [anError]);
  19987. self._basicSignal_(anError);
  19988. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.RethrowErrorHandler)})},
  19989. args: ["anError"],
  19990. source: "handleError: anError\x0a super handleError: anError.\x0a self basicSignal: anError",
  19991. messageSends: ["handleError:", "basicSignal:"],
  19992. referencedClasses: []
  19993. }),
  19994. globals.RethrowErrorHandler);
  19995. });
  19996. define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st, globals){
  19997. smalltalk.addPackage('Compiler-Core');
  19998. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19999. smalltalk.addClass('AbstractCodeGenerator', globals.Object, ['currentClass', 'source'], 'Compiler-Core');
  20000. globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  20001. smalltalk.addMethod(
  20002. smalltalk.method({
  20003. selector: "classNameFor:",
  20004. protocol: 'accessing',
  20005. fn: function (aClass){
  20006. var self=this;
  20007. return smalltalk.withContext(function($ctx1) {
  20008. var $2,$3,$4,$1;
  20009. $2=_st(aClass)._isMetaclass();
  20010. if(smalltalk.assert($2)){
  20011. $3=_st(_st(aClass)._instanceClass())._name();
  20012. $ctx1.sendIdx["name"]=1;
  20013. $1=_st($3).__comma(".klass");
  20014. } else {
  20015. $4=_st(aClass)._isNil();
  20016. if(smalltalk.assert($4)){
  20017. $1="nil";
  20018. } else {
  20019. $1=_st(aClass)._name();
  20020. };
  20021. };
  20022. return $1;
  20023. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractCodeGenerator)})},
  20024. args: ["aClass"],
  20025. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  20026. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  20027. referencedClasses: []
  20028. }),
  20029. globals.AbstractCodeGenerator);
  20030. smalltalk.addMethod(
  20031. smalltalk.method({
  20032. selector: "compileNode:",
  20033. protocol: 'compiling',
  20034. fn: function (aNode){
  20035. var self=this;
  20036. return smalltalk.withContext(function($ctx1) {
  20037. self._subclassResponsibility();
  20038. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},globals.AbstractCodeGenerator)})},
  20039. args: ["aNode"],
  20040. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  20041. messageSends: ["subclassResponsibility"],
  20042. referencedClasses: []
  20043. }),
  20044. globals.AbstractCodeGenerator);
  20045. smalltalk.addMethod(
  20046. smalltalk.method({
  20047. selector: "currentClass",
  20048. protocol: 'accessing',
  20049. fn: function (){
  20050. var self=this;
  20051. var $1;
  20052. $1=self["@currentClass"];
  20053. return $1;
  20054. },
  20055. args: [],
  20056. source: "currentClass\x0a\x09^ currentClass",
  20057. messageSends: [],
  20058. referencedClasses: []
  20059. }),
  20060. globals.AbstractCodeGenerator);
  20061. smalltalk.addMethod(
  20062. smalltalk.method({
  20063. selector: "currentClass:",
  20064. protocol: 'accessing',
  20065. fn: function (aClass){
  20066. var self=this;
  20067. self["@currentClass"]=aClass;
  20068. return self},
  20069. args: ["aClass"],
  20070. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  20071. messageSends: [],
  20072. referencedClasses: []
  20073. }),
  20074. globals.AbstractCodeGenerator);
  20075. smalltalk.addMethod(
  20076. smalltalk.method({
  20077. selector: "pseudoVariables",
  20078. protocol: 'accessing',
  20079. fn: function (){
  20080. var self=this;
  20081. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20082. return smalltalk.withContext(function($ctx1) {
  20083. var $1;
  20084. $1=_st($Smalltalk())._pseudoVariableNames();
  20085. return $1;
  20086. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},globals.AbstractCodeGenerator)})},
  20087. args: [],
  20088. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  20089. messageSends: ["pseudoVariableNames"],
  20090. referencedClasses: ["Smalltalk"]
  20091. }),
  20092. globals.AbstractCodeGenerator);
  20093. smalltalk.addMethod(
  20094. smalltalk.method({
  20095. selector: "source",
  20096. protocol: 'accessing',
  20097. fn: function (){
  20098. var self=this;
  20099. return smalltalk.withContext(function($ctx1) {
  20100. var $2,$1;
  20101. $2=self["@source"];
  20102. if(($receiver = $2) == nil || $receiver == null){
  20103. $1="";
  20104. } else {
  20105. $1=$2;
  20106. };
  20107. return $1;
  20108. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.AbstractCodeGenerator)})},
  20109. args: [],
  20110. source: "source\x0a\x09^ source ifNil: [ '' ]",
  20111. messageSends: ["ifNil:"],
  20112. referencedClasses: []
  20113. }),
  20114. globals.AbstractCodeGenerator);
  20115. smalltalk.addMethod(
  20116. smalltalk.method({
  20117. selector: "source:",
  20118. protocol: 'accessing',
  20119. fn: function (aString){
  20120. var self=this;
  20121. self["@source"]=aString;
  20122. return self},
  20123. args: ["aString"],
  20124. source: "source: aString\x0a\x09source := aString",
  20125. messageSends: [],
  20126. referencedClasses: []
  20127. }),
  20128. globals.AbstractCodeGenerator);
  20129. smalltalk.addClass('CodeGenerator', globals.AbstractCodeGenerator, [], 'Compiler-Core');
  20130. 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.";
  20131. smalltalk.addMethod(
  20132. smalltalk.method({
  20133. selector: "compileNode:",
  20134. protocol: 'compiling',
  20135. fn: function (aNode){
  20136. var self=this;
  20137. var ir,stream;
  20138. return smalltalk.withContext(function($ctx1) {
  20139. var $2,$3,$1;
  20140. _st(self._semanticAnalyzer())._visit_(aNode);
  20141. $ctx1.sendIdx["visit:"]=1;
  20142. ir=_st(self._translator())._visit_(aNode);
  20143. $ctx1.sendIdx["visit:"]=2;
  20144. $2=self._irTranslator();
  20145. _st($2)._currentClass_(self._currentClass());
  20146. _st($2)._visit_(ir);
  20147. $3=_st($2)._contents();
  20148. $1=$3;
  20149. return $1;
  20150. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.CodeGenerator)})},
  20151. args: ["aNode"],
  20152. 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",
  20153. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"],
  20154. referencedClasses: []
  20155. }),
  20156. globals.CodeGenerator);
  20157. smalltalk.addMethod(
  20158. smalltalk.method({
  20159. selector: "irTranslator",
  20160. protocol: 'compiling',
  20161. fn: function (){
  20162. var self=this;
  20163. function $IRJSTranslator(){return globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  20164. return smalltalk.withContext(function($ctx1) {
  20165. var $1;
  20166. $1=_st($IRJSTranslator())._new();
  20167. return $1;
  20168. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.CodeGenerator)})},
  20169. args: [],
  20170. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  20171. messageSends: ["new"],
  20172. referencedClasses: ["IRJSTranslator"]
  20173. }),
  20174. globals.CodeGenerator);
  20175. smalltalk.addMethod(
  20176. smalltalk.method({
  20177. selector: "semanticAnalyzer",
  20178. protocol: 'compiling',
  20179. fn: function (){
  20180. var self=this;
  20181. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  20182. return smalltalk.withContext(function($ctx1) {
  20183. var $1;
  20184. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  20185. return $1;
  20186. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},globals.CodeGenerator)})},
  20187. args: [],
  20188. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  20189. messageSends: ["on:", "currentClass"],
  20190. referencedClasses: ["SemanticAnalyzer"]
  20191. }),
  20192. globals.CodeGenerator);
  20193. smalltalk.addMethod(
  20194. smalltalk.method({
  20195. selector: "translator",
  20196. protocol: 'compiling',
  20197. fn: function (){
  20198. var self=this;
  20199. function $IRASTTranslator(){return globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  20200. return smalltalk.withContext(function($ctx1) {
  20201. var $2,$3,$1;
  20202. $2=_st($IRASTTranslator())._new();
  20203. _st($2)._source_(self._source());
  20204. _st($2)._theClass_(self._currentClass());
  20205. $3=_st($2)._yourself();
  20206. $1=$3;
  20207. return $1;
  20208. }, function($ctx1) {$ctx1.fill(self,"translator",{},globals.CodeGenerator)})},
  20209. args: [],
  20210. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  20211. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"],
  20212. referencedClasses: ["IRASTTranslator"]
  20213. }),
  20214. globals.CodeGenerator);
  20215. smalltalk.addClass('Compiler', globals.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  20216. 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`";
  20217. smalltalk.addMethod(
  20218. smalltalk.method({
  20219. selector: "codeGeneratorClass",
  20220. protocol: 'accessing',
  20221. fn: function (){
  20222. var self=this;
  20223. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  20224. return smalltalk.withContext(function($ctx1) {
  20225. var $2,$1;
  20226. $2=self["@codeGeneratorClass"];
  20227. if(($receiver = $2) == nil || $receiver == null){
  20228. $1=$InliningCodeGenerator();
  20229. } else {
  20230. $1=$2;
  20231. };
  20232. return $1;
  20233. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},globals.Compiler)})},
  20234. args: [],
  20235. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  20236. messageSends: ["ifNil:"],
  20237. referencedClasses: ["InliningCodeGenerator"]
  20238. }),
  20239. globals.Compiler);
  20240. smalltalk.addMethod(
  20241. smalltalk.method({
  20242. selector: "codeGeneratorClass:",
  20243. protocol: 'accessing',
  20244. fn: function (aClass){
  20245. var self=this;
  20246. self["@codeGeneratorClass"]=aClass;
  20247. return self},
  20248. args: ["aClass"],
  20249. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  20250. messageSends: [],
  20251. referencedClasses: []
  20252. }),
  20253. globals.Compiler);
  20254. smalltalk.addMethod(
  20255. smalltalk.method({
  20256. selector: "compile:",
  20257. protocol: 'compiling',
  20258. fn: function (aString){
  20259. var self=this;
  20260. return smalltalk.withContext(function($ctx1) {
  20261. var $1;
  20262. $1=self._compileNode_(self._parse_(aString));
  20263. return $1;
  20264. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Compiler)})},
  20265. args: ["aString"],
  20266. source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
  20267. messageSends: ["compileNode:", "parse:"],
  20268. referencedClasses: []
  20269. }),
  20270. globals.Compiler);
  20271. smalltalk.addMethod(
  20272. smalltalk.method({
  20273. selector: "compile:forClass:",
  20274. protocol: 'compiling',
  20275. fn: function (aString,aClass){
  20276. var self=this;
  20277. return smalltalk.withContext(function($ctx1) {
  20278. var $1;
  20279. self._currentClass_(aClass);
  20280. self._source_(aString);
  20281. $1=self._compile_(aString);
  20282. return $1;
  20283. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},globals.Compiler)})},
  20284. args: ["aString", "aClass"],
  20285. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
  20286. messageSends: ["currentClass:", "source:", "compile:"],
  20287. referencedClasses: []
  20288. }),
  20289. globals.Compiler);
  20290. smalltalk.addMethod(
  20291. smalltalk.method({
  20292. selector: "compileExpression:",
  20293. protocol: 'compiling',
  20294. fn: function (aString){
  20295. var self=this;
  20296. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  20297. return smalltalk.withContext(function($ctx1) {
  20298. var $1,$2;
  20299. self._currentClass_($DoIt());
  20300. $1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  20301. $ctx1.sendIdx[","]=1;
  20302. self._source_($1);
  20303. $2=self._compileNode_(self._parse_(self._source()));
  20304. return $2;
  20305. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},globals.Compiler)})},
  20306. args: ["aString"],
  20307. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  20308. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  20309. referencedClasses: ["DoIt"]
  20310. }),
  20311. globals.Compiler);
  20312. smalltalk.addMethod(
  20313. smalltalk.method({
  20314. selector: "compileExpression:on:",
  20315. protocol: 'compiling',
  20316. fn: function (aString,anObject){
  20317. var self=this;
  20318. return smalltalk.withContext(function($ctx1) {
  20319. var $1,$2;
  20320. self._currentClass_(_st(anObject)._class());
  20321. $1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  20322. $ctx1.sendIdx[","]=1;
  20323. self._source_($1);
  20324. $2=self._compileNode_(self._parse_(self._source()));
  20325. return $2;
  20326. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},globals.Compiler)})},
  20327. args: ["aString", "anObject"],
  20328. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  20329. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  20330. referencedClasses: []
  20331. }),
  20332. globals.Compiler);
  20333. smalltalk.addMethod(
  20334. smalltalk.method({
  20335. selector: "compileNode:",
  20336. protocol: 'compiling',
  20337. fn: function (aNode){
  20338. var self=this;
  20339. var generator,result;
  20340. return smalltalk.withContext(function($ctx1) {
  20341. var $1,$2,$3;
  20342. generator=_st(self._codeGeneratorClass())._new();
  20343. $1=generator;
  20344. _st($1)._source_(self._source());
  20345. $2=_st($1)._currentClass_(self._currentClass());
  20346. result=_st(generator)._compileNode_(aNode);
  20347. self._unknownVariables_([]);
  20348. $3=result;
  20349. return $3;
  20350. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},globals.Compiler)})},
  20351. args: ["aNode"],
  20352. 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\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  20353. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  20354. referencedClasses: []
  20355. }),
  20356. globals.Compiler);
  20357. smalltalk.addMethod(
  20358. smalltalk.method({
  20359. selector: "currentClass",
  20360. protocol: 'accessing',
  20361. fn: function (){
  20362. var self=this;
  20363. var $1;
  20364. $1=self["@currentClass"];
  20365. return $1;
  20366. },
  20367. args: [],
  20368. source: "currentClass\x0a\x09^ currentClass",
  20369. messageSends: [],
  20370. referencedClasses: []
  20371. }),
  20372. globals.Compiler);
  20373. smalltalk.addMethod(
  20374. smalltalk.method({
  20375. selector: "currentClass:",
  20376. protocol: 'accessing',
  20377. fn: function (aClass){
  20378. var self=this;
  20379. self["@currentClass"]=aClass;
  20380. return self},
  20381. args: ["aClass"],
  20382. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  20383. messageSends: [],
  20384. referencedClasses: []
  20385. }),
  20386. globals.Compiler);
  20387. smalltalk.addMethod(
  20388. smalltalk.method({
  20389. selector: "eval:",
  20390. protocol: 'compiling',
  20391. fn: function (aString){
  20392. var self=this;
  20393. return smalltalk.withContext(function($ctx1) {
  20394. return eval(aString);
  20395. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},globals.Compiler)})},
  20396. args: ["aString"],
  20397. source: "eval: aString\x0a\x09<return eval(aString)>",
  20398. messageSends: [],
  20399. referencedClasses: []
  20400. }),
  20401. globals.Compiler);
  20402. smalltalk.addMethod(
  20403. smalltalk.method({
  20404. selector: "evaluateExpression:",
  20405. protocol: 'compiling',
  20406. fn: function (aString){
  20407. var self=this;
  20408. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  20409. return smalltalk.withContext(function($ctx1) {
  20410. var $1;
  20411. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  20412. return $1;
  20413. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},globals.Compiler)})},
  20414. args: ["aString"],
  20415. 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",
  20416. messageSends: ["evaluateExpression:on:", "new"],
  20417. referencedClasses: ["DoIt"]
  20418. }),
  20419. globals.Compiler);
  20420. smalltalk.addMethod(
  20421. smalltalk.method({
  20422. selector: "evaluateExpression:on:",
  20423. protocol: 'compiling',
  20424. fn: function (aString,anObject){
  20425. var self=this;
  20426. var result,method;
  20427. return smalltalk.withContext(function($ctx1) {
  20428. var $1,$2;
  20429. method=self._eval_(self._compileExpression_on_(aString,anObject));
  20430. _st(method)._protocol_("xxxDoIt");
  20431. $1=_st(anObject)._class();
  20432. $ctx1.sendIdx["class"]=1;
  20433. _st($1)._addCompiledMethod_(method);
  20434. result=_st(anObject)._xxxDoIt();
  20435. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  20436. $2=result;
  20437. return $2;
  20438. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},globals.Compiler)})},
  20439. args: ["aString", "anObject"],
  20440. 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",
  20441. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  20442. referencedClasses: []
  20443. }),
  20444. globals.Compiler);
  20445. smalltalk.addMethod(
  20446. smalltalk.method({
  20447. selector: "install:forClass:protocol:",
  20448. protocol: 'compiling',
  20449. fn: function (aString,aBehavior,anotherString){
  20450. var self=this;
  20451. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  20452. return smalltalk.withContext(function($ctx1) {
  20453. var $1;
  20454. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  20455. return $1;
  20456. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},globals.Compiler)})},
  20457. args: ["aString", "aBehavior", "anotherString"],
  20458. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  20459. messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"],
  20460. referencedClasses: ["ClassBuilder"]
  20461. }),
  20462. globals.Compiler);
  20463. smalltalk.addMethod(
  20464. smalltalk.method({
  20465. selector: "parse:",
  20466. protocol: 'compiling',
  20467. fn: function (aString){
  20468. var self=this;
  20469. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20470. return smalltalk.withContext(function($ctx1) {
  20471. var $1;
  20472. $1=_st($Smalltalk())._parse_(aString);
  20473. return $1;
  20474. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.Compiler)})},
  20475. args: ["aString"],
  20476. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  20477. messageSends: ["parse:"],
  20478. referencedClasses: ["Smalltalk"]
  20479. }),
  20480. globals.Compiler);
  20481. smalltalk.addMethod(
  20482. smalltalk.method({
  20483. selector: "parseExpression:",
  20484. protocol: 'compiling',
  20485. fn: function (aString){
  20486. var self=this;
  20487. return smalltalk.withContext(function($ctx1) {
  20488. var $2,$1;
  20489. $2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  20490. $ctx1.sendIdx[","]=1;
  20491. $1=self._parse_($2);
  20492. return $1;
  20493. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},globals.Compiler)})},
  20494. args: ["aString"],
  20495. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  20496. messageSends: ["parse:", ","],
  20497. referencedClasses: []
  20498. }),
  20499. globals.Compiler);
  20500. smalltalk.addMethod(
  20501. smalltalk.method({
  20502. selector: "recompile:",
  20503. protocol: 'compiling',
  20504. fn: function (aClass){
  20505. var self=this;
  20506. return smalltalk.withContext(function($ctx1) {
  20507. var $1;
  20508. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  20509. return smalltalk.withContext(function($ctx2) {
  20510. return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
  20511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  20512. $1=_st(aClass)._isMetaclass();
  20513. if(! smalltalk.assert($1)){
  20514. self._recompile_(_st(aClass)._class());
  20515. };
  20516. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler)})},
  20517. args: ["aClass"],
  20518. 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 ]",
  20519. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"],
  20520. referencedClasses: []
  20521. }),
  20522. globals.Compiler);
  20523. smalltalk.addMethod(
  20524. smalltalk.method({
  20525. selector: "recompileAll",
  20526. protocol: 'compiling',
  20527. fn: function (){
  20528. var self=this;
  20529. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20530. return smalltalk.withContext(function($ctx1) {
  20531. _st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
  20532. return smalltalk.withContext(function($ctx2) {
  20533. return self._recompile_(each);
  20534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
  20535. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler)})},
  20536. args: [],
  20537. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  20538. messageSends: ["do:displayingProgress:", "classes", "recompile:"],
  20539. referencedClasses: ["Smalltalk"]
  20540. }),
  20541. globals.Compiler);
  20542. smalltalk.addMethod(
  20543. smalltalk.method({
  20544. selector: "source",
  20545. protocol: 'accessing',
  20546. fn: function (){
  20547. var self=this;
  20548. return smalltalk.withContext(function($ctx1) {
  20549. var $2,$1;
  20550. $2=self["@source"];
  20551. if(($receiver = $2) == nil || $receiver == null){
  20552. $1="";
  20553. } else {
  20554. $1=$2;
  20555. };
  20556. return $1;
  20557. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Compiler)})},
  20558. args: [],
  20559. source: "source\x0a\x09^ source ifNil: [ '' ]",
  20560. messageSends: ["ifNil:"],
  20561. referencedClasses: []
  20562. }),
  20563. globals.Compiler);
  20564. smalltalk.addMethod(
  20565. smalltalk.method({
  20566. selector: "source:",
  20567. protocol: 'accessing',
  20568. fn: function (aString){
  20569. var self=this;
  20570. self["@source"]=aString;
  20571. return self},
  20572. args: ["aString"],
  20573. source: "source: aString\x0a\x09source := aString",
  20574. messageSends: [],
  20575. referencedClasses: []
  20576. }),
  20577. globals.Compiler);
  20578. smalltalk.addMethod(
  20579. smalltalk.method({
  20580. selector: "unknownVariables",
  20581. protocol: 'accessing',
  20582. fn: function (){
  20583. var self=this;
  20584. var $1;
  20585. $1=self["@unknownVariables"];
  20586. return $1;
  20587. },
  20588. args: [],
  20589. source: "unknownVariables\x0a\x09^ unknownVariables",
  20590. messageSends: [],
  20591. referencedClasses: []
  20592. }),
  20593. globals.Compiler);
  20594. smalltalk.addMethod(
  20595. smalltalk.method({
  20596. selector: "unknownVariables:",
  20597. protocol: 'accessing',
  20598. fn: function (aCollection){
  20599. var self=this;
  20600. self["@unknownVariables"]=aCollection;
  20601. return self},
  20602. args: ["aCollection"],
  20603. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  20604. messageSends: [],
  20605. referencedClasses: []
  20606. }),
  20607. globals.Compiler);
  20608. smalltalk.addMethod(
  20609. smalltalk.method({
  20610. selector: "recompile:",
  20611. protocol: 'compiling',
  20612. fn: function (aClass){
  20613. var self=this;
  20614. return smalltalk.withContext(function($ctx1) {
  20615. _st(self._new())._recompile_(aClass);
  20616. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler.klass)})},
  20617. args: ["aClass"],
  20618. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  20619. messageSends: ["recompile:", "new"],
  20620. referencedClasses: []
  20621. }),
  20622. globals.Compiler.klass);
  20623. smalltalk.addMethod(
  20624. smalltalk.method({
  20625. selector: "recompileAll",
  20626. protocol: 'compiling',
  20627. fn: function (){
  20628. var self=this;
  20629. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20630. return smalltalk.withContext(function($ctx1) {
  20631. _st(_st($Smalltalk())._classes())._do_((function(each){
  20632. return smalltalk.withContext(function($ctx2) {
  20633. return self._recompile_(each);
  20634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  20635. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler.klass)})},
  20636. args: [],
  20637. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  20638. messageSends: ["do:", "classes", "recompile:"],
  20639. referencedClasses: ["Smalltalk"]
  20640. }),
  20641. globals.Compiler.klass);
  20642. smalltalk.addClass('DoIt', globals.Object, [], 'Compiler-Core');
  20643. globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  20644. smalltalk.addMethod(
  20645. smalltalk.method({
  20646. selector: "foo",
  20647. protocol: 'tests',
  20648. fn: function (){
  20649. var self=this;
  20650. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  20651. return smalltalk.withContext(function($ctx1) {
  20652. var $2,$3,$1;
  20653. $2=_st($Array())._new();
  20654. _st($2)._add_((3));
  20655. $ctx1.sendIdx["add:"]=1;
  20656. _st($2)._add_((4));
  20657. $3=_st($2)._yourself();
  20658. $1=$3;
  20659. return $1;
  20660. }, function($ctx1) {$ctx1.fill(self,"foo",{},globals.DoIt)})},
  20661. args: [],
  20662. source: "foo ^ Array new add: 3; add: 4; yourself",
  20663. messageSends: ["add:", "new", "yourself"],
  20664. referencedClasses: ["Array"]
  20665. }),
  20666. globals.DoIt);
  20667. smalltalk.addClass('NodeVisitor', globals.Object, [], 'Compiler-Core');
  20668. globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  20669. smalltalk.addMethod(
  20670. smalltalk.method({
  20671. selector: "visit:",
  20672. protocol: 'visiting',
  20673. fn: function (aNode){
  20674. var self=this;
  20675. return smalltalk.withContext(function($ctx1) {
  20676. var $1;
  20677. $1=_st(aNode)._accept_(self);
  20678. return $1;
  20679. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.NodeVisitor)})},
  20680. args: ["aNode"],
  20681. source: "visit: aNode\x0a\x09^ aNode accept: self",
  20682. messageSends: ["accept:"],
  20683. referencedClasses: []
  20684. }),
  20685. globals.NodeVisitor);
  20686. smalltalk.addMethod(
  20687. smalltalk.method({
  20688. selector: "visitAll:",
  20689. protocol: 'visiting',
  20690. fn: function (aCollection){
  20691. var self=this;
  20692. return smalltalk.withContext(function($ctx1) {
  20693. var $1;
  20694. $1=_st(aCollection)._collect_((function(each){
  20695. return smalltalk.withContext(function($ctx2) {
  20696. return self._visit_(each);
  20697. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  20698. return $1;
  20699. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},globals.NodeVisitor)})},
  20700. args: ["aCollection"],
  20701. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20702. messageSends: ["collect:", "visit:"],
  20703. referencedClasses: []
  20704. }),
  20705. globals.NodeVisitor);
  20706. smalltalk.addMethod(
  20707. smalltalk.method({
  20708. selector: "visitAssignmentNode:",
  20709. protocol: 'visiting',
  20710. fn: function (aNode){
  20711. var self=this;
  20712. return smalltalk.withContext(function($ctx1) {
  20713. var $1;
  20714. $1=self._visitNode_(aNode);
  20715. return $1;
  20716. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.NodeVisitor)})},
  20717. args: ["aNode"],
  20718. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  20719. messageSends: ["visitNode:"],
  20720. referencedClasses: []
  20721. }),
  20722. globals.NodeVisitor);
  20723. smalltalk.addMethod(
  20724. smalltalk.method({
  20725. selector: "visitBlockNode:",
  20726. protocol: 'visiting',
  20727. fn: function (aNode){
  20728. var self=this;
  20729. return smalltalk.withContext(function($ctx1) {
  20730. var $1;
  20731. $1=self._visitNode_(aNode);
  20732. return $1;
  20733. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.NodeVisitor)})},
  20734. args: ["aNode"],
  20735. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  20736. messageSends: ["visitNode:"],
  20737. referencedClasses: []
  20738. }),
  20739. globals.NodeVisitor);
  20740. smalltalk.addMethod(
  20741. smalltalk.method({
  20742. selector: "visitBlockSequenceNode:",
  20743. protocol: 'visiting',
  20744. fn: function (aNode){
  20745. var self=this;
  20746. return smalltalk.withContext(function($ctx1) {
  20747. var $1;
  20748. $1=self._visitSequenceNode_(aNode);
  20749. return $1;
  20750. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
  20751. args: ["aNode"],
  20752. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  20753. messageSends: ["visitSequenceNode:"],
  20754. referencedClasses: []
  20755. }),
  20756. globals.NodeVisitor);
  20757. smalltalk.addMethod(
  20758. smalltalk.method({
  20759. selector: "visitCascadeNode:",
  20760. protocol: 'visiting',
  20761. fn: function (aNode){
  20762. var self=this;
  20763. return smalltalk.withContext(function($ctx1) {
  20764. var $1;
  20765. $1=self._visitNode_(aNode);
  20766. return $1;
  20767. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.NodeVisitor)})},
  20768. args: ["aNode"],
  20769. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  20770. messageSends: ["visitNode:"],
  20771. referencedClasses: []
  20772. }),
  20773. globals.NodeVisitor);
  20774. smalltalk.addMethod(
  20775. smalltalk.method({
  20776. selector: "visitDynamicArrayNode:",
  20777. protocol: 'visiting',
  20778. fn: function (aNode){
  20779. var self=this;
  20780. return smalltalk.withContext(function($ctx1) {
  20781. var $1;
  20782. $1=self._visitNode_(aNode);
  20783. return $1;
  20784. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},globals.NodeVisitor)})},
  20785. args: ["aNode"],
  20786. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  20787. messageSends: ["visitNode:"],
  20788. referencedClasses: []
  20789. }),
  20790. globals.NodeVisitor);
  20791. smalltalk.addMethod(
  20792. smalltalk.method({
  20793. selector: "visitDynamicDictionaryNode:",
  20794. protocol: 'visiting',
  20795. fn: function (aNode){
  20796. var self=this;
  20797. return smalltalk.withContext(function($ctx1) {
  20798. var $1;
  20799. $1=self._visitNode_(aNode);
  20800. return $1;
  20801. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},globals.NodeVisitor)})},
  20802. args: ["aNode"],
  20803. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  20804. messageSends: ["visitNode:"],
  20805. referencedClasses: []
  20806. }),
  20807. globals.NodeVisitor);
  20808. smalltalk.addMethod(
  20809. smalltalk.method({
  20810. selector: "visitJSStatementNode:",
  20811. protocol: 'visiting',
  20812. fn: function (aNode){
  20813. var self=this;
  20814. return smalltalk.withContext(function($ctx1) {
  20815. var $1;
  20816. $1=self._visitNode_(aNode);
  20817. return $1;
  20818. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.NodeVisitor)})},
  20819. args: ["aNode"],
  20820. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  20821. messageSends: ["visitNode:"],
  20822. referencedClasses: []
  20823. }),
  20824. globals.NodeVisitor);
  20825. smalltalk.addMethod(
  20826. smalltalk.method({
  20827. selector: "visitMethodNode:",
  20828. protocol: 'visiting',
  20829. fn: function (aNode){
  20830. var self=this;
  20831. return smalltalk.withContext(function($ctx1) {
  20832. var $1;
  20833. $1=self._visitNode_(aNode);
  20834. return $1;
  20835. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.NodeVisitor)})},
  20836. args: ["aNode"],
  20837. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  20838. messageSends: ["visitNode:"],
  20839. referencedClasses: []
  20840. }),
  20841. globals.NodeVisitor);
  20842. smalltalk.addMethod(
  20843. smalltalk.method({
  20844. selector: "visitNode:",
  20845. protocol: 'visiting',
  20846. fn: function (aNode){
  20847. var self=this;
  20848. return smalltalk.withContext(function($ctx1) {
  20849. var $1;
  20850. $1=self._visitAll_(_st(aNode)._nodes());
  20851. return $1;
  20852. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},globals.NodeVisitor)})},
  20853. args: ["aNode"],
  20854. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  20855. messageSends: ["visitAll:", "nodes"],
  20856. referencedClasses: []
  20857. }),
  20858. globals.NodeVisitor);
  20859. smalltalk.addMethod(
  20860. smalltalk.method({
  20861. selector: "visitReturnNode:",
  20862. protocol: 'visiting',
  20863. fn: function (aNode){
  20864. var self=this;
  20865. return smalltalk.withContext(function($ctx1) {
  20866. var $1;
  20867. $1=self._visitNode_(aNode);
  20868. return $1;
  20869. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.NodeVisitor)})},
  20870. args: ["aNode"],
  20871. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  20872. messageSends: ["visitNode:"],
  20873. referencedClasses: []
  20874. }),
  20875. globals.NodeVisitor);
  20876. smalltalk.addMethod(
  20877. smalltalk.method({
  20878. selector: "visitSendNode:",
  20879. protocol: 'visiting',
  20880. fn: function (aNode){
  20881. var self=this;
  20882. return smalltalk.withContext(function($ctx1) {
  20883. var $1;
  20884. $1=self._visitNode_(aNode);
  20885. return $1;
  20886. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.NodeVisitor)})},
  20887. args: ["aNode"],
  20888. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  20889. messageSends: ["visitNode:"],
  20890. referencedClasses: []
  20891. }),
  20892. globals.NodeVisitor);
  20893. smalltalk.addMethod(
  20894. smalltalk.method({
  20895. selector: "visitSequenceNode:",
  20896. protocol: 'visiting',
  20897. fn: function (aNode){
  20898. var self=this;
  20899. return smalltalk.withContext(function($ctx1) {
  20900. var $1;
  20901. $1=self._visitNode_(aNode);
  20902. return $1;
  20903. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
  20904. args: ["aNode"],
  20905. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  20906. messageSends: ["visitNode:"],
  20907. referencedClasses: []
  20908. }),
  20909. globals.NodeVisitor);
  20910. smalltalk.addMethod(
  20911. smalltalk.method({
  20912. selector: "visitValueNode:",
  20913. protocol: 'visiting',
  20914. fn: function (aNode){
  20915. var self=this;
  20916. return smalltalk.withContext(function($ctx1) {
  20917. var $1;
  20918. $1=self._visitNode_(aNode);
  20919. return $1;
  20920. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.NodeVisitor)})},
  20921. args: ["aNode"],
  20922. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  20923. messageSends: ["visitNode:"],
  20924. referencedClasses: []
  20925. }),
  20926. globals.NodeVisitor);
  20927. smalltalk.addMethod(
  20928. smalltalk.method({
  20929. selector: "visitVariableNode:",
  20930. protocol: 'visiting',
  20931. fn: function (aNode){
  20932. var self=this;
  20933. return smalltalk.withContext(function($ctx1) {
  20934. var $1;
  20935. $1=self._visitNode_(aNode);
  20936. return $1;
  20937. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.NodeVisitor)})},
  20938. args: ["aNode"],
  20939. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  20940. messageSends: ["visitNode:"],
  20941. referencedClasses: []
  20942. }),
  20943. globals.NodeVisitor);
  20944. smalltalk.addMethod(
  20945. smalltalk.method({
  20946. selector: "asVariableName",
  20947. protocol: '*Compiler-Core',
  20948. fn: function (){
  20949. var self=this;
  20950. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20951. return smalltalk.withContext(function($ctx1) {
  20952. var $2,$1;
  20953. $2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
  20954. if(smalltalk.assert($2)){
  20955. $1=self.__comma("_");
  20956. } else {
  20957. $1=self;
  20958. };
  20959. return $1;
  20960. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},globals.String)})},
  20961. args: [],
  20962. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  20963. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","],
  20964. referencedClasses: ["Smalltalk"]
  20965. }),
  20966. globals.String);
  20967. });
  20968. define("amber_core/Compiler-AST", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st, globals){
  20969. smalltalk.addPackage('Compiler-AST');
  20970. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20971. smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  20972. 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.";
  20973. smalltalk.addMethod(
  20974. smalltalk.method({
  20975. selector: "accept:",
  20976. protocol: 'visiting',
  20977. fn: function (aVisitor){
  20978. var self=this;
  20979. return smalltalk.withContext(function($ctx1) {
  20980. var $1;
  20981. $1=_st(aVisitor)._visitNode_(self);
  20982. return $1;
  20983. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)})},
  20984. args: ["aVisitor"],
  20985. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  20986. messageSends: ["visitNode:"],
  20987. referencedClasses: []
  20988. }),
  20989. globals.Node);
  20990. smalltalk.addMethod(
  20991. smalltalk.method({
  20992. selector: "addNode:",
  20993. protocol: 'accessing',
  20994. fn: function (aNode){
  20995. var self=this;
  20996. return smalltalk.withContext(function($ctx1) {
  20997. _st(self._nodes())._add_(aNode);
  20998. _st(aNode)._parent_(self);
  20999. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)})},
  21000. args: ["aNode"],
  21001. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  21002. messageSends: ["add:", "nodes", "parent:"],
  21003. referencedClasses: []
  21004. }),
  21005. globals.Node);
  21006. smalltalk.addMethod(
  21007. smalltalk.method({
  21008. selector: "isAssignmentNode",
  21009. protocol: 'testing',
  21010. fn: function (){
  21011. var self=this;
  21012. return false;
  21013. },
  21014. args: [],
  21015. source: "isAssignmentNode\x0a\x09^ false",
  21016. messageSends: [],
  21017. referencedClasses: []
  21018. }),
  21019. globals.Node);
  21020. smalltalk.addMethod(
  21021. smalltalk.method({
  21022. selector: "isBlockNode",
  21023. protocol: 'testing',
  21024. fn: function (){
  21025. var self=this;
  21026. return false;
  21027. },
  21028. args: [],
  21029. source: "isBlockNode\x0a\x09^ false",
  21030. messageSends: [],
  21031. referencedClasses: []
  21032. }),
  21033. globals.Node);
  21034. smalltalk.addMethod(
  21035. smalltalk.method({
  21036. selector: "isBlockSequenceNode",
  21037. protocol: 'testing',
  21038. fn: function (){
  21039. var self=this;
  21040. return false;
  21041. },
  21042. args: [],
  21043. source: "isBlockSequenceNode\x0a\x09^ false",
  21044. messageSends: [],
  21045. referencedClasses: []
  21046. }),
  21047. globals.Node);
  21048. smalltalk.addMethod(
  21049. smalltalk.method({
  21050. selector: "isCascadeNode",
  21051. protocol: 'testing',
  21052. fn: function (){
  21053. var self=this;
  21054. return false;
  21055. },
  21056. args: [],
  21057. source: "isCascadeNode\x0a\x09^ false",
  21058. messageSends: [],
  21059. referencedClasses: []
  21060. }),
  21061. globals.Node);
  21062. smalltalk.addMethod(
  21063. smalltalk.method({
  21064. selector: "isImmutable",
  21065. protocol: 'testing',
  21066. fn: function (){
  21067. var self=this;
  21068. return false;
  21069. },
  21070. args: [],
  21071. source: "isImmutable\x0a\x09^ false",
  21072. messageSends: [],
  21073. referencedClasses: []
  21074. }),
  21075. globals.Node);
  21076. smalltalk.addMethod(
  21077. smalltalk.method({
  21078. selector: "isJSStatementNode",
  21079. protocol: 'testing',
  21080. fn: function (){
  21081. var self=this;
  21082. return false;
  21083. },
  21084. args: [],
  21085. source: "isJSStatementNode\x0a\x09^ false",
  21086. messageSends: [],
  21087. referencedClasses: []
  21088. }),
  21089. globals.Node);
  21090. smalltalk.addMethod(
  21091. smalltalk.method({
  21092. selector: "isLastChild",
  21093. protocol: 'testing',
  21094. fn: function (){
  21095. var self=this;
  21096. return smalltalk.withContext(function($ctx1) {
  21097. var $1;
  21098. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  21099. return $1;
  21100. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)})},
  21101. args: [],
  21102. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  21103. messageSends: ["=", "last", "nodes", "parent"],
  21104. referencedClasses: []
  21105. }),
  21106. globals.Node);
  21107. smalltalk.addMethod(
  21108. smalltalk.method({
  21109. selector: "isNode",
  21110. protocol: 'testing',
  21111. fn: function (){
  21112. var self=this;
  21113. return true;
  21114. },
  21115. args: [],
  21116. source: "isNode\x0a\x09^ true",
  21117. messageSends: [],
  21118. referencedClasses: []
  21119. }),
  21120. globals.Node);
  21121. smalltalk.addMethod(
  21122. smalltalk.method({
  21123. selector: "isReferenced",
  21124. protocol: 'testing',
  21125. fn: function (){
  21126. var self=this;
  21127. return smalltalk.withContext(function($ctx1) {
  21128. var $4,$3,$2,$1;
  21129. $4=self._parent();
  21130. $ctx1.sendIdx["parent"]=1;
  21131. $3=_st($4)._isSequenceNode();
  21132. $2=_st($3)._or_((function(){
  21133. return smalltalk.withContext(function($ctx2) {
  21134. return _st(self._parent())._isAssignmentNode();
  21135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21136. $1=_st($2)._not();
  21137. return $1;
  21138. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)})},
  21139. args: [],
  21140. 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",
  21141. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"],
  21142. referencedClasses: []
  21143. }),
  21144. globals.Node);
  21145. smalltalk.addMethod(
  21146. smalltalk.method({
  21147. selector: "isReturnNode",
  21148. protocol: 'testing',
  21149. fn: function (){
  21150. var self=this;
  21151. return false;
  21152. },
  21153. args: [],
  21154. source: "isReturnNode\x0a\x09^ false",
  21155. messageSends: [],
  21156. referencedClasses: []
  21157. }),
  21158. globals.Node);
  21159. smalltalk.addMethod(
  21160. smalltalk.method({
  21161. selector: "isSendNode",
  21162. protocol: 'testing',
  21163. fn: function (){
  21164. var self=this;
  21165. return false;
  21166. },
  21167. args: [],
  21168. source: "isSendNode\x0a\x09^ false",
  21169. messageSends: [],
  21170. referencedClasses: []
  21171. }),
  21172. globals.Node);
  21173. smalltalk.addMethod(
  21174. smalltalk.method({
  21175. selector: "isSequenceNode",
  21176. protocol: 'testing',
  21177. fn: function (){
  21178. var self=this;
  21179. return false;
  21180. },
  21181. args: [],
  21182. source: "isSequenceNode\x0a\x09^ false",
  21183. messageSends: [],
  21184. referencedClasses: []
  21185. }),
  21186. globals.Node);
  21187. smalltalk.addMethod(
  21188. smalltalk.method({
  21189. selector: "isValueNode",
  21190. protocol: 'testing',
  21191. fn: function (){
  21192. var self=this;
  21193. return false;
  21194. },
  21195. args: [],
  21196. source: "isValueNode\x0a\x09^ false",
  21197. messageSends: [],
  21198. referencedClasses: []
  21199. }),
  21200. globals.Node);
  21201. smalltalk.addMethod(
  21202. smalltalk.method({
  21203. selector: "isVariableNode",
  21204. protocol: 'testing',
  21205. fn: function (){
  21206. var self=this;
  21207. return false;
  21208. },
  21209. args: [],
  21210. source: "isVariableNode\x0a\x09^ false",
  21211. messageSends: [],
  21212. referencedClasses: []
  21213. }),
  21214. globals.Node);
  21215. smalltalk.addMethod(
  21216. smalltalk.method({
  21217. selector: "method",
  21218. protocol: 'accessing',
  21219. fn: function (){
  21220. var self=this;
  21221. return smalltalk.withContext(function($ctx1) {
  21222. var $2,$1;
  21223. $2=self._parent();
  21224. if(($receiver = $2) == nil || $receiver == null){
  21225. $1=$2;
  21226. } else {
  21227. var node;
  21228. node=$receiver;
  21229. $1=_st(node)._method();
  21230. };
  21231. return $1;
  21232. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)})},
  21233. args: [],
  21234. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  21235. messageSends: ["ifNotNil:", "parent", "method"],
  21236. referencedClasses: []
  21237. }),
  21238. globals.Node);
  21239. smalltalk.addMethod(
  21240. smalltalk.method({
  21241. selector: "nextChild",
  21242. protocol: 'accessing',
  21243. fn: function (){
  21244. var self=this;
  21245. return smalltalk.withContext(function($ctx1) {
  21246. var $3,$2,$1;
  21247. $3=self._nodes();
  21248. $ctx1.sendIdx["nodes"]=1;
  21249. $2=_st($3)._isEmpty();
  21250. if(smalltalk.assert($2)){
  21251. $1=self;
  21252. } else {
  21253. $1=_st(_st(self._nodes())._first())._nextChild();
  21254. };
  21255. return $1;
  21256. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)})},
  21257. args: [],
  21258. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  21259. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"],
  21260. referencedClasses: []
  21261. }),
  21262. globals.Node);
  21263. smalltalk.addMethod(
  21264. smalltalk.method({
  21265. selector: "nextNode",
  21266. protocol: 'accessing',
  21267. fn: function (){
  21268. var self=this;
  21269. return smalltalk.withContext(function($ctx1) {
  21270. var $2,$1;
  21271. $2=self._parent();
  21272. if(($receiver = $2) == nil || $receiver == null){
  21273. $1=$2;
  21274. } else {
  21275. var node;
  21276. node=$receiver;
  21277. $1=_st(node)._nextNode_(self);
  21278. };
  21279. return $1;
  21280. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)})},
  21281. args: [],
  21282. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  21283. messageSends: ["ifNotNil:", "parent", "nextNode:"],
  21284. referencedClasses: []
  21285. }),
  21286. globals.Node);
  21287. smalltalk.addMethod(
  21288. smalltalk.method({
  21289. selector: "nextNode:",
  21290. protocol: 'accessing',
  21291. fn: function (aNode){
  21292. var self=this;
  21293. var next;
  21294. return smalltalk.withContext(function($ctx1) {
  21295. var $1,$2;
  21296. var $early={};
  21297. try {
  21298. $1=self._nodes();
  21299. $ctx1.sendIdx["nodes"]=1;
  21300. next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  21301. throw $early=[self];
  21302. }));
  21303. $2=_st(next)._nextChild();
  21304. return $2;
  21305. }
  21306. catch(e) {if(e===$early)return e[0]; throw e}
  21307. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)})},
  21308. args: ["aNode"],
  21309. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  21310. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"],
  21311. referencedClasses: []
  21312. }),
  21313. globals.Node);
  21314. smalltalk.addMethod(
  21315. smalltalk.method({
  21316. selector: "nodes",
  21317. protocol: 'accessing',
  21318. fn: function (){
  21319. var self=this;
  21320. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  21321. return smalltalk.withContext(function($ctx1) {
  21322. var $2,$1;
  21323. $2=self["@nodes"];
  21324. if(($receiver = $2) == nil || $receiver == null){
  21325. self["@nodes"]=_st($Array())._new();
  21326. $1=self["@nodes"];
  21327. } else {
  21328. $1=$2;
  21329. };
  21330. return $1;
  21331. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)})},
  21332. args: [],
  21333. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  21334. messageSends: ["ifNil:", "new"],
  21335. referencedClasses: ["Array"]
  21336. }),
  21337. globals.Node);
  21338. smalltalk.addMethod(
  21339. smalltalk.method({
  21340. selector: "nodes:",
  21341. protocol: 'building',
  21342. fn: function (aCollection){
  21343. var self=this;
  21344. return smalltalk.withContext(function($ctx1) {
  21345. self["@nodes"]=aCollection;
  21346. _st(aCollection)._do_((function(each){
  21347. return smalltalk.withContext(function($ctx2) {
  21348. return _st(each)._parent_(self);
  21349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21350. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)})},
  21351. args: ["aCollection"],
  21352. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  21353. messageSends: ["do:", "parent:"],
  21354. referencedClasses: []
  21355. }),
  21356. globals.Node);
  21357. smalltalk.addMethod(
  21358. smalltalk.method({
  21359. selector: "parent",
  21360. protocol: 'accessing',
  21361. fn: function (){
  21362. var self=this;
  21363. var $1;
  21364. $1=self["@parent"];
  21365. return $1;
  21366. },
  21367. args: [],
  21368. source: "parent\x0a\x09^ parent",
  21369. messageSends: [],
  21370. referencedClasses: []
  21371. }),
  21372. globals.Node);
  21373. smalltalk.addMethod(
  21374. smalltalk.method({
  21375. selector: "parent:",
  21376. protocol: 'accessing',
  21377. fn: function (aNode){
  21378. var self=this;
  21379. self["@parent"]=aNode;
  21380. return self},
  21381. args: ["aNode"],
  21382. source: "parent: aNode\x0a\x09parent := aNode",
  21383. messageSends: [],
  21384. referencedClasses: []
  21385. }),
  21386. globals.Node);
  21387. smalltalk.addMethod(
  21388. smalltalk.method({
  21389. selector: "position",
  21390. protocol: 'accessing',
  21391. fn: function (){
  21392. var self=this;
  21393. return smalltalk.withContext(function($ctx1) {
  21394. var $2,$3,$1;
  21395. $2=self["@position"];
  21396. if(($receiver = $2) == nil || $receiver == null){
  21397. $3=self._parent();
  21398. if(($receiver = $3) == nil || $receiver == null){
  21399. $1=$3;
  21400. } else {
  21401. var node;
  21402. node=$receiver;
  21403. $1=_st(node)._position();
  21404. };
  21405. } else {
  21406. $1=$2;
  21407. };
  21408. return $1;
  21409. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)})},
  21410. args: [],
  21411. 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 ] ]",
  21412. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"],
  21413. referencedClasses: []
  21414. }),
  21415. globals.Node);
  21416. smalltalk.addMethod(
  21417. smalltalk.method({
  21418. selector: "position:",
  21419. protocol: 'accessing',
  21420. fn: function (aPosition){
  21421. var self=this;
  21422. self["@position"]=aPosition;
  21423. return self},
  21424. args: ["aPosition"],
  21425. source: "position: aPosition\x0a\x09position := aPosition",
  21426. messageSends: [],
  21427. referencedClasses: []
  21428. }),
  21429. globals.Node);
  21430. smalltalk.addMethod(
  21431. smalltalk.method({
  21432. selector: "positionEnd",
  21433. protocol: 'accessing',
  21434. fn: function (){
  21435. var self=this;
  21436. return smalltalk.withContext(function($ctx1) {
  21437. var $2,$7,$6,$5,$4,$3,$1;
  21438. $2=self._positionStart();
  21439. $7=self._source();
  21440. $ctx1.sendIdx["source"]=1;
  21441. $6=_st($7)._lines();
  21442. $ctx1.sendIdx["lines"]=1;
  21443. $5=_st($6)._size();
  21444. $ctx1.sendIdx["size"]=1;
  21445. $4=_st($5).__minus((1));
  21446. $ctx1.sendIdx["-"]=1;
  21447. $3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
  21448. $1=_st($2).__plus($3);
  21449. return $1;
  21450. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)})},
  21451. args: [],
  21452. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  21453. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"],
  21454. referencedClasses: []
  21455. }),
  21456. globals.Node);
  21457. smalltalk.addMethod(
  21458. smalltalk.method({
  21459. selector: "positionStart",
  21460. protocol: 'accessing',
  21461. fn: function (){
  21462. var self=this;
  21463. return smalltalk.withContext(function($ctx1) {
  21464. var $1;
  21465. $1=self._position();
  21466. return $1;
  21467. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)})},
  21468. args: [],
  21469. source: "positionStart\x0a\x09^ self position",
  21470. messageSends: ["position"],
  21471. referencedClasses: []
  21472. }),
  21473. globals.Node);
  21474. smalltalk.addMethod(
  21475. smalltalk.method({
  21476. selector: "postCopy",
  21477. protocol: 'copying',
  21478. fn: function (){
  21479. var self=this;
  21480. return smalltalk.withContext(function($ctx1) {
  21481. globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []);
  21482. _st(self._nodes())._do_((function(each){
  21483. return smalltalk.withContext(function($ctx2) {
  21484. return _st(each)._parent_(self);
  21485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21486. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)})},
  21487. args: [],
  21488. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  21489. messageSends: ["postCopy", "do:", "nodes", "parent:"],
  21490. referencedClasses: []
  21491. }),
  21492. globals.Node);
  21493. smalltalk.addMethod(
  21494. smalltalk.method({
  21495. selector: "requiresSmalltalkContext",
  21496. protocol: 'testing',
  21497. fn: function (){
  21498. var self=this;
  21499. return smalltalk.withContext(function($ctx1) {
  21500. var $1;
  21501. $1=_st(_st(self._nodes())._detect_ifNone_((function(each){
  21502. return smalltalk.withContext(function($ctx2) {
  21503. return _st(each)._requiresSmalltalkContext();
  21504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  21505. return nil;
  21506. })))._notNil();
  21507. return $1;
  21508. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)})},
  21509. args: [],
  21510. 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",
  21511. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"],
  21512. referencedClasses: []
  21513. }),
  21514. globals.Node);
  21515. smalltalk.addMethod(
  21516. smalltalk.method({
  21517. selector: "shouldBeAliased",
  21518. protocol: 'accessing',
  21519. fn: function (){
  21520. var self=this;
  21521. return smalltalk.withContext(function($ctx1) {
  21522. var $2,$1;
  21523. $2=self["@shouldBeAliased"];
  21524. if(($receiver = $2) == nil || $receiver == null){
  21525. $1=false;
  21526. } else {
  21527. $1=$2;
  21528. };
  21529. return $1;
  21530. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)})},
  21531. args: [],
  21532. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  21533. messageSends: ["ifNil:"],
  21534. referencedClasses: []
  21535. }),
  21536. globals.Node);
  21537. smalltalk.addMethod(
  21538. smalltalk.method({
  21539. selector: "shouldBeAliased:",
  21540. protocol: 'accessing',
  21541. fn: function (aBoolean){
  21542. var self=this;
  21543. self["@shouldBeAliased"]=aBoolean;
  21544. return self},
  21545. args: ["aBoolean"],
  21546. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  21547. messageSends: [],
  21548. referencedClasses: []
  21549. }),
  21550. globals.Node);
  21551. smalltalk.addMethod(
  21552. smalltalk.method({
  21553. selector: "shouldBeInlined",
  21554. protocol: 'accessing',
  21555. fn: function (){
  21556. var self=this;
  21557. return smalltalk.withContext(function($ctx1) {
  21558. var $2,$1;
  21559. $2=self["@shouldBeInlined"];
  21560. if(($receiver = $2) == nil || $receiver == null){
  21561. $1=false;
  21562. } else {
  21563. $1=$2;
  21564. };
  21565. return $1;
  21566. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)})},
  21567. args: [],
  21568. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  21569. messageSends: ["ifNil:"],
  21570. referencedClasses: []
  21571. }),
  21572. globals.Node);
  21573. smalltalk.addMethod(
  21574. smalltalk.method({
  21575. selector: "shouldBeInlined:",
  21576. protocol: 'accessing',
  21577. fn: function (aBoolean){
  21578. var self=this;
  21579. self["@shouldBeInlined"]=aBoolean;
  21580. return self},
  21581. args: ["aBoolean"],
  21582. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  21583. messageSends: [],
  21584. referencedClasses: []
  21585. }),
  21586. globals.Node);
  21587. smalltalk.addMethod(
  21588. smalltalk.method({
  21589. selector: "size",
  21590. protocol: 'accessing',
  21591. fn: function (){
  21592. var self=this;
  21593. return smalltalk.withContext(function($ctx1) {
  21594. var $1;
  21595. $1=_st(self._source())._size();
  21596. return $1;
  21597. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)})},
  21598. args: [],
  21599. source: "size\x0a\x09^ self source size",
  21600. messageSends: ["size", "source"],
  21601. referencedClasses: []
  21602. }),
  21603. globals.Node);
  21604. smalltalk.addMethod(
  21605. smalltalk.method({
  21606. selector: "source",
  21607. protocol: 'accessing',
  21608. fn: function (){
  21609. var self=this;
  21610. return smalltalk.withContext(function($ctx1) {
  21611. var $2,$1;
  21612. $2=self["@source"];
  21613. if(($receiver = $2) == nil || $receiver == null){
  21614. $1="";
  21615. } else {
  21616. $1=$2;
  21617. };
  21618. return $1;
  21619. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)})},
  21620. args: [],
  21621. source: "source\x0a\x09^ source ifNil: [ '' ]",
  21622. messageSends: ["ifNil:"],
  21623. referencedClasses: []
  21624. }),
  21625. globals.Node);
  21626. smalltalk.addMethod(
  21627. smalltalk.method({
  21628. selector: "source:",
  21629. protocol: 'accessing',
  21630. fn: function (aString){
  21631. var self=this;
  21632. self["@source"]=aString;
  21633. return self},
  21634. args: ["aString"],
  21635. source: "source: aString\x0a\x09source := aString",
  21636. messageSends: [],
  21637. referencedClasses: []
  21638. }),
  21639. globals.Node);
  21640. smalltalk.addMethod(
  21641. smalltalk.method({
  21642. selector: "stopOnStepping",
  21643. protocol: 'testing',
  21644. fn: function (){
  21645. var self=this;
  21646. return false;
  21647. },
  21648. args: [],
  21649. source: "stopOnStepping\x0a\x09^ false",
  21650. messageSends: [],
  21651. referencedClasses: []
  21652. }),
  21653. globals.Node);
  21654. smalltalk.addMethod(
  21655. smalltalk.method({
  21656. selector: "subtreeNeedsAliasing",
  21657. protocol: 'testing',
  21658. fn: function (){
  21659. var self=this;
  21660. return smalltalk.withContext(function($ctx1) {
  21661. var $1;
  21662. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  21663. return smalltalk.withContext(function($ctx2) {
  21664. return self._shouldBeInlined();
  21665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
  21666. return smalltalk.withContext(function($ctx2) {
  21667. return _st(self._nodes())._anySatisfy_((function(each){
  21668. return smalltalk.withContext(function($ctx3) {
  21669. return _st(each)._subtreeNeedsAliasing();
  21670. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  21671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  21672. $ctx1.sendIdx["or:"]=1;
  21673. return $1;
  21674. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)})},
  21675. args: [],
  21676. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  21677. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"],
  21678. referencedClasses: []
  21679. }),
  21680. globals.Node);
  21681. smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
  21682. globals.AssignmentNode.comment="I represent an assignment node.";
  21683. smalltalk.addMethod(
  21684. smalltalk.method({
  21685. selector: "accept:",
  21686. protocol: 'visiting',
  21687. fn: function (aVisitor){
  21688. var self=this;
  21689. return smalltalk.withContext(function($ctx1) {
  21690. var $1;
  21691. $1=_st(aVisitor)._visitAssignmentNode_(self);
  21692. return $1;
  21693. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)})},
  21694. args: ["aVisitor"],
  21695. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  21696. messageSends: ["visitAssignmentNode:"],
  21697. referencedClasses: []
  21698. }),
  21699. globals.AssignmentNode);
  21700. smalltalk.addMethod(
  21701. smalltalk.method({
  21702. selector: "isAssignmentNode",
  21703. protocol: 'testing',
  21704. fn: function (){
  21705. var self=this;
  21706. return true;
  21707. },
  21708. args: [],
  21709. source: "isAssignmentNode\x0a\x09^ true",
  21710. messageSends: [],
  21711. referencedClasses: []
  21712. }),
  21713. globals.AssignmentNode);
  21714. smalltalk.addMethod(
  21715. smalltalk.method({
  21716. selector: "left",
  21717. protocol: 'accessing',
  21718. fn: function (){
  21719. var self=this;
  21720. var $1;
  21721. $1=self["@left"];
  21722. return $1;
  21723. },
  21724. args: [],
  21725. source: "left\x0a\x09^ left",
  21726. messageSends: [],
  21727. referencedClasses: []
  21728. }),
  21729. globals.AssignmentNode);
  21730. smalltalk.addMethod(
  21731. smalltalk.method({
  21732. selector: "left:",
  21733. protocol: 'accessing',
  21734. fn: function (aNode){
  21735. var self=this;
  21736. return smalltalk.withContext(function($ctx1) {
  21737. self["@left"]=aNode;
  21738. _st(aNode)._parent_(self);
  21739. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)})},
  21740. args: ["aNode"],
  21741. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  21742. messageSends: ["parent:"],
  21743. referencedClasses: []
  21744. }),
  21745. globals.AssignmentNode);
  21746. smalltalk.addMethod(
  21747. smalltalk.method({
  21748. selector: "nodes",
  21749. protocol: 'accessing',
  21750. fn: function (){
  21751. var self=this;
  21752. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  21753. return smalltalk.withContext(function($ctx1) {
  21754. var $1;
  21755. $1=_st($Array())._with_with_(self._left(),self._right());
  21756. return $1;
  21757. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)})},
  21758. args: [],
  21759. source: "nodes\x0a\x09^ Array with: self left with: self right",
  21760. messageSends: ["with:with:", "left", "right"],
  21761. referencedClasses: ["Array"]
  21762. }),
  21763. globals.AssignmentNode);
  21764. smalltalk.addMethod(
  21765. smalltalk.method({
  21766. selector: "right",
  21767. protocol: 'accessing',
  21768. fn: function (){
  21769. var self=this;
  21770. var $1;
  21771. $1=self["@right"];
  21772. return $1;
  21773. },
  21774. args: [],
  21775. source: "right\x0a\x09^ right",
  21776. messageSends: [],
  21777. referencedClasses: []
  21778. }),
  21779. globals.AssignmentNode);
  21780. smalltalk.addMethod(
  21781. smalltalk.method({
  21782. selector: "right:",
  21783. protocol: 'accessing',
  21784. fn: function (aNode){
  21785. var self=this;
  21786. return smalltalk.withContext(function($ctx1) {
  21787. self["@right"]=aNode;
  21788. _st(aNode)._parent_(self);
  21789. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)})},
  21790. args: ["aNode"],
  21791. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  21792. messageSends: ["parent:"],
  21793. referencedClasses: []
  21794. }),
  21795. globals.AssignmentNode);
  21796. smalltalk.addMethod(
  21797. smalltalk.method({
  21798. selector: "shouldBeAliased",
  21799. protocol: 'testing',
  21800. fn: function (){
  21801. var self=this;
  21802. return smalltalk.withContext(function($ctx1) {
  21803. var $1;
  21804. $1=_st(globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []))._or_((function(){
  21805. return smalltalk.withContext(function($ctx2) {
  21806. return self._isReferenced();
  21807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21808. return $1;
  21809. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)})},
  21810. args: [],
  21811. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  21812. messageSends: ["or:", "shouldBeAliased", "isReferenced"],
  21813. referencedClasses: []
  21814. }),
  21815. globals.AssignmentNode);
  21816. smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  21817. globals.BlockNode.comment="I represent an block closure node.";
  21818. smalltalk.addMethod(
  21819. smalltalk.method({
  21820. selector: "accept:",
  21821. protocol: 'visiting',
  21822. fn: function (aVisitor){
  21823. var self=this;
  21824. return smalltalk.withContext(function($ctx1) {
  21825. var $1;
  21826. $1=_st(aVisitor)._visitBlockNode_(self);
  21827. return $1;
  21828. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)})},
  21829. args: ["aVisitor"],
  21830. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  21831. messageSends: ["visitBlockNode:"],
  21832. referencedClasses: []
  21833. }),
  21834. globals.BlockNode);
  21835. smalltalk.addMethod(
  21836. smalltalk.method({
  21837. selector: "isBlockNode",
  21838. protocol: 'testing',
  21839. fn: function (){
  21840. var self=this;
  21841. return true;
  21842. },
  21843. args: [],
  21844. source: "isBlockNode\x0a\x09^ true",
  21845. messageSends: [],
  21846. referencedClasses: []
  21847. }),
  21848. globals.BlockNode);
  21849. smalltalk.addMethod(
  21850. smalltalk.method({
  21851. selector: "nextChild",
  21852. protocol: 'accessing',
  21853. fn: function (){
  21854. var self=this;
  21855. return self;
  21856. },
  21857. args: [],
  21858. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  21859. messageSends: [],
  21860. referencedClasses: []
  21861. }),
  21862. globals.BlockNode);
  21863. smalltalk.addMethod(
  21864. smalltalk.method({
  21865. selector: "nextNode:",
  21866. protocol: 'accessing',
  21867. fn: function (aNode){
  21868. var self=this;
  21869. return self;
  21870. },
  21871. args: ["aNode"],
  21872. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  21873. messageSends: [],
  21874. referencedClasses: []
  21875. }),
  21876. globals.BlockNode);
  21877. smalltalk.addMethod(
  21878. smalltalk.method({
  21879. selector: "parameters",
  21880. protocol: 'accessing',
  21881. fn: function (){
  21882. var self=this;
  21883. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  21884. return smalltalk.withContext(function($ctx1) {
  21885. var $2,$1;
  21886. $2=self["@parameters"];
  21887. if(($receiver = $2) == nil || $receiver == null){
  21888. self["@parameters"]=_st($Array())._new();
  21889. $1=self["@parameters"];
  21890. } else {
  21891. $1=$2;
  21892. };
  21893. return $1;
  21894. }, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)})},
  21895. args: [],
  21896. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  21897. messageSends: ["ifNil:", "new"],
  21898. referencedClasses: ["Array"]
  21899. }),
  21900. globals.BlockNode);
  21901. smalltalk.addMethod(
  21902. smalltalk.method({
  21903. selector: "parameters:",
  21904. protocol: 'accessing',
  21905. fn: function (aCollection){
  21906. var self=this;
  21907. self["@parameters"]=aCollection;
  21908. return self},
  21909. args: ["aCollection"],
  21910. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  21911. messageSends: [],
  21912. referencedClasses: []
  21913. }),
  21914. globals.BlockNode);
  21915. smalltalk.addMethod(
  21916. smalltalk.method({
  21917. selector: "scope",
  21918. protocol: 'accessing',
  21919. fn: function (){
  21920. var self=this;
  21921. var $1;
  21922. $1=self["@scope"];
  21923. return $1;
  21924. },
  21925. args: [],
  21926. source: "scope\x0a\x09^ scope",
  21927. messageSends: [],
  21928. referencedClasses: []
  21929. }),
  21930. globals.BlockNode);
  21931. smalltalk.addMethod(
  21932. smalltalk.method({
  21933. selector: "scope:",
  21934. protocol: 'accessing',
  21935. fn: function (aLexicalScope){
  21936. var self=this;
  21937. self["@scope"]=aLexicalScope;
  21938. return self},
  21939. args: ["aLexicalScope"],
  21940. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  21941. messageSends: [],
  21942. referencedClasses: []
  21943. }),
  21944. globals.BlockNode);
  21945. smalltalk.addMethod(
  21946. smalltalk.method({
  21947. selector: "subtreeNeedsAliasing",
  21948. protocol: 'testing',
  21949. fn: function (){
  21950. var self=this;
  21951. return smalltalk.withContext(function($ctx1) {
  21952. var $1;
  21953. $1=_st(self._shouldBeAliased())._or_((function(){
  21954. return smalltalk.withContext(function($ctx2) {
  21955. return self._shouldBeInlined();
  21956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21957. return $1;
  21958. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)})},
  21959. args: [],
  21960. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  21961. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"],
  21962. referencedClasses: []
  21963. }),
  21964. globals.BlockNode);
  21965. smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
  21966. globals.CascadeNode.comment="I represent an cascade node.";
  21967. smalltalk.addMethod(
  21968. smalltalk.method({
  21969. selector: "accept:",
  21970. protocol: 'visiting',
  21971. fn: function (aVisitor){
  21972. var self=this;
  21973. return smalltalk.withContext(function($ctx1) {
  21974. var $1;
  21975. $1=_st(aVisitor)._visitCascadeNode_(self);
  21976. return $1;
  21977. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)})},
  21978. args: ["aVisitor"],
  21979. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  21980. messageSends: ["visitCascadeNode:"],
  21981. referencedClasses: []
  21982. }),
  21983. globals.CascadeNode);
  21984. smalltalk.addMethod(
  21985. smalltalk.method({
  21986. selector: "isCascadeNode",
  21987. protocol: 'testing',
  21988. fn: function (){
  21989. var self=this;
  21990. return true;
  21991. },
  21992. args: [],
  21993. source: "isCascadeNode\x0a\x09^ true",
  21994. messageSends: [],
  21995. referencedClasses: []
  21996. }),
  21997. globals.CascadeNode);
  21998. smalltalk.addMethod(
  21999. smalltalk.method({
  22000. selector: "receiver",
  22001. protocol: 'accessing',
  22002. fn: function (){
  22003. var self=this;
  22004. var $1;
  22005. $1=self["@receiver"];
  22006. return $1;
  22007. },
  22008. args: [],
  22009. source: "receiver\x0a\x09^ receiver",
  22010. messageSends: [],
  22011. referencedClasses: []
  22012. }),
  22013. globals.CascadeNode);
  22014. smalltalk.addMethod(
  22015. smalltalk.method({
  22016. selector: "receiver:",
  22017. protocol: 'accessing',
  22018. fn: function (aNode){
  22019. var self=this;
  22020. self["@receiver"]=aNode;
  22021. return self},
  22022. args: ["aNode"],
  22023. source: "receiver: aNode\x0a\x09receiver := aNode",
  22024. messageSends: [],
  22025. referencedClasses: []
  22026. }),
  22027. globals.CascadeNode);
  22028. smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
  22029. globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  22030. smalltalk.addMethod(
  22031. smalltalk.method({
  22032. selector: "accept:",
  22033. protocol: 'visiting',
  22034. fn: function (aVisitor){
  22035. var self=this;
  22036. return smalltalk.withContext(function($ctx1) {
  22037. var $1;
  22038. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  22039. return $1;
  22040. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)})},
  22041. args: ["aVisitor"],
  22042. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  22043. messageSends: ["visitDynamicArrayNode:"],
  22044. referencedClasses: []
  22045. }),
  22046. globals.DynamicArrayNode);
  22047. smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
  22048. globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  22049. smalltalk.addMethod(
  22050. smalltalk.method({
  22051. selector: "accept:",
  22052. protocol: 'visiting',
  22053. fn: function (aVisitor){
  22054. var self=this;
  22055. return smalltalk.withContext(function($ctx1) {
  22056. var $1;
  22057. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  22058. return $1;
  22059. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)})},
  22060. args: ["aVisitor"],
  22061. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  22062. messageSends: ["visitDynamicDictionaryNode:"],
  22063. referencedClasses: []
  22064. }),
  22065. globals.DynamicDictionaryNode);
  22066. smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
  22067. globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  22068. smalltalk.addMethod(
  22069. smalltalk.method({
  22070. selector: "accept:",
  22071. protocol: 'visiting',
  22072. fn: function (aVisitor){
  22073. var self=this;
  22074. return smalltalk.withContext(function($ctx1) {
  22075. var $1;
  22076. $1=_st(aVisitor)._visitJSStatementNode_(self);
  22077. return $1;
  22078. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)})},
  22079. args: ["aVisitor"],
  22080. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  22081. messageSends: ["visitJSStatementNode:"],
  22082. referencedClasses: []
  22083. }),
  22084. globals.JSStatementNode);
  22085. smalltalk.addMethod(
  22086. smalltalk.method({
  22087. selector: "isJSStatementNode",
  22088. protocol: 'testing',
  22089. fn: function (){
  22090. var self=this;
  22091. return true;
  22092. },
  22093. args: [],
  22094. source: "isJSStatementNode\x0a\x09^ true",
  22095. messageSends: [],
  22096. referencedClasses: []
  22097. }),
  22098. globals.JSStatementNode);
  22099. smalltalk.addMethod(
  22100. smalltalk.method({
  22101. selector: "requiresSmalltalkContext",
  22102. protocol: 'testing',
  22103. fn: function (){
  22104. var self=this;
  22105. return true;
  22106. },
  22107. args: [],
  22108. source: "requiresSmalltalkContext\x0a\x09^ true",
  22109. messageSends: [],
  22110. referencedClasses: []
  22111. }),
  22112. globals.JSStatementNode);
  22113. smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  22114. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  22115. smalltalk.addMethod(
  22116. smalltalk.method({
  22117. selector: "accept:",
  22118. protocol: 'visiting',
  22119. fn: function (aVisitor){
  22120. var self=this;
  22121. return smalltalk.withContext(function($ctx1) {
  22122. var $1;
  22123. $1=_st(aVisitor)._visitMethodNode_(self);
  22124. return $1;
  22125. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)})},
  22126. args: ["aVisitor"],
  22127. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  22128. messageSends: ["visitMethodNode:"],
  22129. referencedClasses: []
  22130. }),
  22131. globals.MethodNode);
  22132. smalltalk.addMethod(
  22133. smalltalk.method({
  22134. selector: "arguments",
  22135. protocol: 'accessing',
  22136. fn: function (){
  22137. var self=this;
  22138. return smalltalk.withContext(function($ctx1) {
  22139. var $2,$1;
  22140. $2=self["@arguments"];
  22141. if(($receiver = $2) == nil || $receiver == null){
  22142. $1=[];
  22143. } else {
  22144. $1=$2;
  22145. };
  22146. return $1;
  22147. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)})},
  22148. args: [],
  22149. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  22150. messageSends: ["ifNil:"],
  22151. referencedClasses: []
  22152. }),
  22153. globals.MethodNode);
  22154. smalltalk.addMethod(
  22155. smalltalk.method({
  22156. selector: "arguments:",
  22157. protocol: 'accessing',
  22158. fn: function (aCollection){
  22159. var self=this;
  22160. self["@arguments"]=aCollection;
  22161. return self},
  22162. args: ["aCollection"],
  22163. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  22164. messageSends: [],
  22165. referencedClasses: []
  22166. }),
  22167. globals.MethodNode);
  22168. smalltalk.addMethod(
  22169. smalltalk.method({
  22170. selector: "classReferences",
  22171. protocol: 'accessing',
  22172. fn: function (){
  22173. var self=this;
  22174. var $1;
  22175. $1=self["@classReferences"];
  22176. return $1;
  22177. },
  22178. args: [],
  22179. source: "classReferences\x0a\x09^ classReferences",
  22180. messageSends: [],
  22181. referencedClasses: []
  22182. }),
  22183. globals.MethodNode);
  22184. smalltalk.addMethod(
  22185. smalltalk.method({
  22186. selector: "classReferences:",
  22187. protocol: 'accessing',
  22188. fn: function (aCollection){
  22189. var self=this;
  22190. self["@classReferences"]=aCollection;
  22191. return self},
  22192. args: ["aCollection"],
  22193. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  22194. messageSends: [],
  22195. referencedClasses: []
  22196. }),
  22197. globals.MethodNode);
  22198. smalltalk.addMethod(
  22199. smalltalk.method({
  22200. selector: "messageSends",
  22201. protocol: 'accessing',
  22202. fn: function (){
  22203. var self=this;
  22204. return smalltalk.withContext(function($ctx1) {
  22205. var $1;
  22206. $1=_st(self._sendIndexes())._keys();
  22207. return $1;
  22208. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)})},
  22209. args: [],
  22210. source: "messageSends\x0a\x09^ self sendIndexes keys",
  22211. messageSends: ["keys", "sendIndexes"],
  22212. referencedClasses: []
  22213. }),
  22214. globals.MethodNode);
  22215. smalltalk.addMethod(
  22216. smalltalk.method({
  22217. selector: "method",
  22218. protocol: 'accessing',
  22219. fn: function (){
  22220. var self=this;
  22221. return self;
  22222. },
  22223. args: [],
  22224. source: "method\x0a\x09^ self",
  22225. messageSends: [],
  22226. referencedClasses: []
  22227. }),
  22228. globals.MethodNode);
  22229. smalltalk.addMethod(
  22230. smalltalk.method({
  22231. selector: "scope",
  22232. protocol: 'accessing',
  22233. fn: function (){
  22234. var self=this;
  22235. var $1;
  22236. $1=self["@scope"];
  22237. return $1;
  22238. },
  22239. args: [],
  22240. source: "scope\x0a\x09^ scope",
  22241. messageSends: [],
  22242. referencedClasses: []
  22243. }),
  22244. globals.MethodNode);
  22245. smalltalk.addMethod(
  22246. smalltalk.method({
  22247. selector: "scope:",
  22248. protocol: 'accessing',
  22249. fn: function (aMethodScope){
  22250. var self=this;
  22251. self["@scope"]=aMethodScope;
  22252. return self},
  22253. args: ["aMethodScope"],
  22254. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  22255. messageSends: [],
  22256. referencedClasses: []
  22257. }),
  22258. globals.MethodNode);
  22259. smalltalk.addMethod(
  22260. smalltalk.method({
  22261. selector: "selector",
  22262. protocol: 'accessing',
  22263. fn: function (){
  22264. var self=this;
  22265. var $1;
  22266. $1=self["@selector"];
  22267. return $1;
  22268. },
  22269. args: [],
  22270. source: "selector\x0a\x09^ selector",
  22271. messageSends: [],
  22272. referencedClasses: []
  22273. }),
  22274. globals.MethodNode);
  22275. smalltalk.addMethod(
  22276. smalltalk.method({
  22277. selector: "selector:",
  22278. protocol: 'accessing',
  22279. fn: function (aString){
  22280. var self=this;
  22281. self["@selector"]=aString;
  22282. return self},
  22283. args: ["aString"],
  22284. source: "selector: aString\x0a\x09selector := aString",
  22285. messageSends: [],
  22286. referencedClasses: []
  22287. }),
  22288. globals.MethodNode);
  22289. smalltalk.addMethod(
  22290. smalltalk.method({
  22291. selector: "sendIndexes",
  22292. protocol: 'accessing',
  22293. fn: function (){
  22294. var self=this;
  22295. var $1;
  22296. $1=self["@sendIndexes"];
  22297. return $1;
  22298. },
  22299. args: [],
  22300. source: "sendIndexes\x0a\x09^ sendIndexes",
  22301. messageSends: [],
  22302. referencedClasses: []
  22303. }),
  22304. globals.MethodNode);
  22305. smalltalk.addMethod(
  22306. smalltalk.method({
  22307. selector: "sendIndexes:",
  22308. protocol: 'accessing',
  22309. fn: function (aDictionary){
  22310. var self=this;
  22311. self["@sendIndexes"]=aDictionary;
  22312. return self},
  22313. args: ["aDictionary"],
  22314. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  22315. messageSends: [],
  22316. referencedClasses: []
  22317. }),
  22318. globals.MethodNode);
  22319. smalltalk.addMethod(
  22320. smalltalk.method({
  22321. selector: "source",
  22322. protocol: 'accessing',
  22323. fn: function (){
  22324. var self=this;
  22325. var $1;
  22326. $1=self["@source"];
  22327. return $1;
  22328. },
  22329. args: [],
  22330. source: "source\x0a\x09^ source",
  22331. messageSends: [],
  22332. referencedClasses: []
  22333. }),
  22334. globals.MethodNode);
  22335. smalltalk.addMethod(
  22336. smalltalk.method({
  22337. selector: "source:",
  22338. protocol: 'accessing',
  22339. fn: function (aString){
  22340. var self=this;
  22341. self["@source"]=aString;
  22342. return self},
  22343. args: ["aString"],
  22344. source: "source: aString\x0a\x09source := aString",
  22345. messageSends: [],
  22346. referencedClasses: []
  22347. }),
  22348. globals.MethodNode);
  22349. smalltalk.addMethod(
  22350. smalltalk.method({
  22351. selector: "superSends",
  22352. protocol: 'accessing',
  22353. fn: function (){
  22354. var self=this;
  22355. var $1;
  22356. $1=self["@superSends"];
  22357. return $1;
  22358. },
  22359. args: [],
  22360. source: "superSends\x0a\x09^ superSends",
  22361. messageSends: [],
  22362. referencedClasses: []
  22363. }),
  22364. globals.MethodNode);
  22365. smalltalk.addMethod(
  22366. smalltalk.method({
  22367. selector: "superSends:",
  22368. protocol: 'accessing',
  22369. fn: function (aCollection){
  22370. var self=this;
  22371. self["@superSends"]=aCollection;
  22372. return self},
  22373. args: ["aCollection"],
  22374. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  22375. messageSends: [],
  22376. referencedClasses: []
  22377. }),
  22378. globals.MethodNode);
  22379. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  22380. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  22381. smalltalk.addMethod(
  22382. smalltalk.method({
  22383. selector: "accept:",
  22384. protocol: 'visiting',
  22385. fn: function (aVisitor){
  22386. var self=this;
  22387. return smalltalk.withContext(function($ctx1) {
  22388. var $1;
  22389. $1=_st(aVisitor)._visitReturnNode_(self);
  22390. return $1;
  22391. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
  22392. args: ["aVisitor"],
  22393. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  22394. messageSends: ["visitReturnNode:"],
  22395. referencedClasses: []
  22396. }),
  22397. globals.ReturnNode);
  22398. smalltalk.addMethod(
  22399. smalltalk.method({
  22400. selector: "isReturnNode",
  22401. protocol: 'testing',
  22402. fn: function (){
  22403. var self=this;
  22404. return true;
  22405. },
  22406. args: [],
  22407. source: "isReturnNode\x0a\x09^ true",
  22408. messageSends: [],
  22409. referencedClasses: []
  22410. }),
  22411. globals.ReturnNode);
  22412. smalltalk.addMethod(
  22413. smalltalk.method({
  22414. selector: "nonLocalReturn",
  22415. protocol: 'testing',
  22416. fn: function (){
  22417. var self=this;
  22418. return smalltalk.withContext(function($ctx1) {
  22419. var $1;
  22420. $1=_st(_st(self._scope())._isMethodScope())._not();
  22421. return $1;
  22422. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
  22423. args: [],
  22424. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  22425. messageSends: ["not", "isMethodScope", "scope"],
  22426. referencedClasses: []
  22427. }),
  22428. globals.ReturnNode);
  22429. smalltalk.addMethod(
  22430. smalltalk.method({
  22431. selector: "scope",
  22432. protocol: 'accessing',
  22433. fn: function (){
  22434. var self=this;
  22435. var $1;
  22436. $1=self["@scope"];
  22437. return $1;
  22438. },
  22439. args: [],
  22440. source: "scope\x0a\x09^ scope",
  22441. messageSends: [],
  22442. referencedClasses: []
  22443. }),
  22444. globals.ReturnNode);
  22445. smalltalk.addMethod(
  22446. smalltalk.method({
  22447. selector: "scope:",
  22448. protocol: 'accessing',
  22449. fn: function (aLexicalScope){
  22450. var self=this;
  22451. self["@scope"]=aLexicalScope;
  22452. return self},
  22453. args: ["aLexicalScope"],
  22454. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  22455. messageSends: [],
  22456. referencedClasses: []
  22457. }),
  22458. globals.ReturnNode);
  22459. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  22460. globals.SendNode.comment="I represent an message send node.";
  22461. smalltalk.addMethod(
  22462. smalltalk.method({
  22463. selector: "accept:",
  22464. protocol: 'visiting',
  22465. fn: function (aVisitor){
  22466. var self=this;
  22467. return smalltalk.withContext(function($ctx1) {
  22468. var $1;
  22469. $1=_st(aVisitor)._visitSendNode_(self);
  22470. return $1;
  22471. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
  22472. args: ["aVisitor"],
  22473. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  22474. messageSends: ["visitSendNode:"],
  22475. referencedClasses: []
  22476. }),
  22477. globals.SendNode);
  22478. smalltalk.addMethod(
  22479. smalltalk.method({
  22480. selector: "arguments",
  22481. protocol: 'accessing',
  22482. fn: function (){
  22483. var self=this;
  22484. return smalltalk.withContext(function($ctx1) {
  22485. var $2,$1;
  22486. $2=self["@arguments"];
  22487. if(($receiver = $2) == nil || $receiver == null){
  22488. self["@arguments"]=[];
  22489. $1=self["@arguments"];
  22490. } else {
  22491. $1=$2;
  22492. };
  22493. return $1;
  22494. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
  22495. args: [],
  22496. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  22497. messageSends: ["ifNil:"],
  22498. referencedClasses: []
  22499. }),
  22500. globals.SendNode);
  22501. smalltalk.addMethod(
  22502. smalltalk.method({
  22503. selector: "arguments:",
  22504. protocol: 'accessing',
  22505. fn: function (aCollection){
  22506. var self=this;
  22507. return smalltalk.withContext(function($ctx1) {
  22508. self["@arguments"]=aCollection;
  22509. _st(aCollection)._do_((function(each){
  22510. return smalltalk.withContext(function($ctx2) {
  22511. return _st(each)._parent_(self);
  22512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22513. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
  22514. args: ["aCollection"],
  22515. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  22516. messageSends: ["do:", "parent:"],
  22517. referencedClasses: []
  22518. }),
  22519. globals.SendNode);
  22520. smalltalk.addMethod(
  22521. smalltalk.method({
  22522. selector: "cascadeNodeWithMessages:",
  22523. protocol: 'accessing',
  22524. fn: function (aCollection){
  22525. var self=this;
  22526. var first;
  22527. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  22528. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  22529. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  22530. return smalltalk.withContext(function($ctx1) {
  22531. var $1,$2,$4,$5,$3;
  22532. $1=_st($SendNode())._new();
  22533. $ctx1.sendIdx["new"]=1;
  22534. _st($1)._selector_(self._selector());
  22535. _st($1)._arguments_(self._arguments());
  22536. $2=_st($1)._yourself();
  22537. $ctx1.sendIdx["yourself"]=1;
  22538. first=$2;
  22539. $4=_st($CascadeNode())._new();
  22540. _st($4)._receiver_(self._receiver());
  22541. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  22542. $5=_st($4)._yourself();
  22543. $3=$5;
  22544. return $3;
  22545. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
  22546. args: ["aCollection"],
  22547. 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",
  22548. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  22549. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  22550. }),
  22551. globals.SendNode);
  22552. smalltalk.addMethod(
  22553. smalltalk.method({
  22554. selector: "index",
  22555. protocol: 'accessing',
  22556. fn: function (){
  22557. var self=this;
  22558. var $1;
  22559. $1=self["@index"];
  22560. return $1;
  22561. },
  22562. args: [],
  22563. source: "index\x0a\x09^ index",
  22564. messageSends: [],
  22565. referencedClasses: []
  22566. }),
  22567. globals.SendNode);
  22568. smalltalk.addMethod(
  22569. smalltalk.method({
  22570. selector: "index:",
  22571. protocol: 'accessing',
  22572. fn: function (anInteger){
  22573. var self=this;
  22574. self["@index"]=anInteger;
  22575. return self},
  22576. args: ["anInteger"],
  22577. source: "index: anInteger\x0a\x09index := anInteger",
  22578. messageSends: [],
  22579. referencedClasses: []
  22580. }),
  22581. globals.SendNode);
  22582. smalltalk.addMethod(
  22583. smalltalk.method({
  22584. selector: "isCascadeSendNode",
  22585. protocol: 'testing',
  22586. fn: function (){
  22587. var self=this;
  22588. return smalltalk.withContext(function($ctx1) {
  22589. var $1;
  22590. $1=_st(self._parent())._isCascadeNode();
  22591. return $1;
  22592. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
  22593. args: [],
  22594. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  22595. messageSends: ["isCascadeNode", "parent"],
  22596. referencedClasses: []
  22597. }),
  22598. globals.SendNode);
  22599. smalltalk.addMethod(
  22600. smalltalk.method({
  22601. selector: "isSendNode",
  22602. protocol: 'testing',
  22603. fn: function (){
  22604. var self=this;
  22605. return true;
  22606. },
  22607. args: [],
  22608. source: "isSendNode\x0a\x09^ true",
  22609. messageSends: [],
  22610. referencedClasses: []
  22611. }),
  22612. globals.SendNode);
  22613. smalltalk.addMethod(
  22614. smalltalk.method({
  22615. selector: "nodes",
  22616. protocol: 'accessing',
  22617. fn: function (){
  22618. var self=this;
  22619. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  22620. return smalltalk.withContext(function($ctx1) {
  22621. var $1,$3,$2,$5,$6,$4;
  22622. $1=self._receiver();
  22623. $ctx1.sendIdx["receiver"]=1;
  22624. if(($receiver = $1) == nil || $receiver == null){
  22625. $3=self._arguments();
  22626. $ctx1.sendIdx["arguments"]=1;
  22627. $2=_st($3)._copy();
  22628. return $2;
  22629. } else {
  22630. $1;
  22631. };
  22632. $5=_st($Array())._with_(self._receiver());
  22633. _st($5)._addAll_(self._arguments());
  22634. $6=_st($5)._yourself();
  22635. $4=$6;
  22636. return $4;
  22637. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
  22638. args: [],
  22639. 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",
  22640. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  22641. referencedClasses: ["Array"]
  22642. }),
  22643. globals.SendNode);
  22644. smalltalk.addMethod(
  22645. smalltalk.method({
  22646. selector: "receiver",
  22647. protocol: 'accessing',
  22648. fn: function (){
  22649. var self=this;
  22650. var $1;
  22651. $1=self["@receiver"];
  22652. return $1;
  22653. },
  22654. args: [],
  22655. source: "receiver\x0a\x09^ receiver",
  22656. messageSends: [],
  22657. referencedClasses: []
  22658. }),
  22659. globals.SendNode);
  22660. smalltalk.addMethod(
  22661. smalltalk.method({
  22662. selector: "receiver:",
  22663. protocol: 'accessing',
  22664. fn: function (aNode){
  22665. var self=this;
  22666. return smalltalk.withContext(function($ctx1) {
  22667. var $1;
  22668. self["@receiver"]=aNode;
  22669. $1=_st(aNode)._isNode();
  22670. if(smalltalk.assert($1)){
  22671. _st(aNode)._parent_(self);
  22672. };
  22673. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
  22674. args: ["aNode"],
  22675. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  22676. messageSends: ["ifTrue:", "isNode", "parent:"],
  22677. referencedClasses: []
  22678. }),
  22679. globals.SendNode);
  22680. smalltalk.addMethod(
  22681. smalltalk.method({
  22682. selector: "requiresSmalltalkContext",
  22683. protocol: 'testing',
  22684. fn: function (){
  22685. var self=this;
  22686. return true;
  22687. },
  22688. args: [],
  22689. source: "requiresSmalltalkContext\x0a\x09^ true",
  22690. messageSends: [],
  22691. referencedClasses: []
  22692. }),
  22693. globals.SendNode);
  22694. smalltalk.addMethod(
  22695. smalltalk.method({
  22696. selector: "selector",
  22697. protocol: 'accessing',
  22698. fn: function (){
  22699. var self=this;
  22700. var $1;
  22701. $1=self["@selector"];
  22702. return $1;
  22703. },
  22704. args: [],
  22705. source: "selector\x0a\x09^ selector",
  22706. messageSends: [],
  22707. referencedClasses: []
  22708. }),
  22709. globals.SendNode);
  22710. smalltalk.addMethod(
  22711. smalltalk.method({
  22712. selector: "selector:",
  22713. protocol: 'accessing',
  22714. fn: function (aString){
  22715. var self=this;
  22716. self["@selector"]=aString;
  22717. return self},
  22718. args: ["aString"],
  22719. source: "selector: aString\x0a\x09selector := aString",
  22720. messageSends: [],
  22721. referencedClasses: []
  22722. }),
  22723. globals.SendNode);
  22724. smalltalk.addMethod(
  22725. smalltalk.method({
  22726. selector: "shouldBeAliased",
  22727. protocol: 'testing',
  22728. fn: function (){
  22729. var self=this;
  22730. var sends;
  22731. return smalltalk.withContext(function($ctx1) {
  22732. var $1;
  22733. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  22734. $1=_st(globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []))._or_((function(){
  22735. return smalltalk.withContext(function($ctx2) {
  22736. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  22737. return smalltalk.withContext(function($ctx3) {
  22738. return _st(self._index()).__lt(sends);
  22739. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._and_((function(){
  22740. return smalltalk.withContext(function($ctx3) {
  22741. return self._isReferenced();
  22742. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  22743. $ctx2.sendIdx["and:"]=1;
  22744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  22745. return $1;
  22746. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
  22747. args: [],
  22748. 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\x09(sends > 1 and: [ self index < sends ]) and: [ self isReferenced ] ]",
  22749. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", ">", "<", "index", "isReferenced"],
  22750. referencedClasses: []
  22751. }),
  22752. globals.SendNode);
  22753. smalltalk.addMethod(
  22754. smalltalk.method({
  22755. selector: "stopOnStepping",
  22756. protocol: 'testing',
  22757. fn: function (){
  22758. var self=this;
  22759. return true;
  22760. },
  22761. args: [],
  22762. source: "stopOnStepping\x0a\x09^ true",
  22763. messageSends: [],
  22764. referencedClasses: []
  22765. }),
  22766. globals.SendNode);
  22767. smalltalk.addMethod(
  22768. smalltalk.method({
  22769. selector: "superSend",
  22770. protocol: 'accessing',
  22771. fn: function (){
  22772. var self=this;
  22773. return smalltalk.withContext(function($ctx1) {
  22774. var $2,$1;
  22775. $2=self["@superSend"];
  22776. if(($receiver = $2) == nil || $receiver == null){
  22777. $1=false;
  22778. } else {
  22779. $1=$2;
  22780. };
  22781. return $1;
  22782. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
  22783. args: [],
  22784. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  22785. messageSends: ["ifNil:"],
  22786. referencedClasses: []
  22787. }),
  22788. globals.SendNode);
  22789. smalltalk.addMethod(
  22790. smalltalk.method({
  22791. selector: "superSend:",
  22792. protocol: 'accessing',
  22793. fn: function (aBoolean){
  22794. var self=this;
  22795. self["@superSend"]=aBoolean;
  22796. return self},
  22797. args: ["aBoolean"],
  22798. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  22799. messageSends: [],
  22800. referencedClasses: []
  22801. }),
  22802. globals.SendNode);
  22803. smalltalk.addMethod(
  22804. smalltalk.method({
  22805. selector: "valueForReceiver:",
  22806. protocol: 'accessing',
  22807. fn: function (anObject){
  22808. var self=this;
  22809. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  22810. return smalltalk.withContext(function($ctx1) {
  22811. var $2,$3,$5,$4,$6,$1;
  22812. $2=_st($SendNode())._new();
  22813. _st($2)._position_(self._position());
  22814. _st($2)._source_(self._source());
  22815. $3=$2;
  22816. $5=self._receiver();
  22817. $ctx1.sendIdx["receiver"]=1;
  22818. if(($receiver = $5) == nil || $receiver == null){
  22819. $4=anObject;
  22820. } else {
  22821. $4=_st(self._receiver())._valueForReceiver_(anObject);
  22822. };
  22823. _st($3)._receiver_($4);
  22824. _st($2)._selector_(self._selector());
  22825. _st($2)._arguments_(self._arguments());
  22826. $6=_st($2)._yourself();
  22827. $1=$6;
  22828. return $1;
  22829. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
  22830. args: ["anObject"],
  22831. 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",
  22832. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  22833. referencedClasses: ["SendNode"]
  22834. }),
  22835. globals.SendNode);
  22836. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  22837. 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).";
  22838. smalltalk.addMethod(
  22839. smalltalk.method({
  22840. selector: "accept:",
  22841. protocol: 'visiting',
  22842. fn: function (aVisitor){
  22843. var self=this;
  22844. return smalltalk.withContext(function($ctx1) {
  22845. var $1;
  22846. $1=_st(aVisitor)._visitSequenceNode_(self);
  22847. return $1;
  22848. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
  22849. args: ["aVisitor"],
  22850. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  22851. messageSends: ["visitSequenceNode:"],
  22852. referencedClasses: []
  22853. }),
  22854. globals.SequenceNode);
  22855. smalltalk.addMethod(
  22856. smalltalk.method({
  22857. selector: "asBlockSequenceNode",
  22858. protocol: 'converting',
  22859. fn: function (){
  22860. var self=this;
  22861. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  22862. return smalltalk.withContext(function($ctx1) {
  22863. var $2,$3,$1;
  22864. $2=_st($BlockSequenceNode())._new();
  22865. _st($2)._position_(self._position());
  22866. _st($2)._source_(self._source());
  22867. _st($2)._nodes_(self._nodes());
  22868. _st($2)._temps_(self._temps());
  22869. $3=_st($2)._yourself();
  22870. $1=$3;
  22871. return $1;
  22872. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
  22873. args: [],
  22874. 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",
  22875. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
  22876. referencedClasses: ["BlockSequenceNode"]
  22877. }),
  22878. globals.SequenceNode);
  22879. smalltalk.addMethod(
  22880. smalltalk.method({
  22881. selector: "isSequenceNode",
  22882. protocol: 'testing',
  22883. fn: function (){
  22884. var self=this;
  22885. return true;
  22886. },
  22887. args: [],
  22888. source: "isSequenceNode\x0a\x09^ true",
  22889. messageSends: [],
  22890. referencedClasses: []
  22891. }),
  22892. globals.SequenceNode);
  22893. smalltalk.addMethod(
  22894. smalltalk.method({
  22895. selector: "scope",
  22896. protocol: 'accessing',
  22897. fn: function (){
  22898. var self=this;
  22899. var $1;
  22900. $1=self["@scope"];
  22901. return $1;
  22902. },
  22903. args: [],
  22904. source: "scope\x0a\x09^ scope",
  22905. messageSends: [],
  22906. referencedClasses: []
  22907. }),
  22908. globals.SequenceNode);
  22909. smalltalk.addMethod(
  22910. smalltalk.method({
  22911. selector: "scope:",
  22912. protocol: 'accessing',
  22913. fn: function (aLexicalScope){
  22914. var self=this;
  22915. self["@scope"]=aLexicalScope;
  22916. return self},
  22917. args: ["aLexicalScope"],
  22918. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  22919. messageSends: [],
  22920. referencedClasses: []
  22921. }),
  22922. globals.SequenceNode);
  22923. smalltalk.addMethod(
  22924. smalltalk.method({
  22925. selector: "temps",
  22926. protocol: 'accessing',
  22927. fn: function (){
  22928. var self=this;
  22929. return smalltalk.withContext(function($ctx1) {
  22930. var $2,$1;
  22931. $2=self["@temps"];
  22932. if(($receiver = $2) == nil || $receiver == null){
  22933. $1=[];
  22934. } else {
  22935. $1=$2;
  22936. };
  22937. return $1;
  22938. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
  22939. args: [],
  22940. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  22941. messageSends: ["ifNil:"],
  22942. referencedClasses: []
  22943. }),
  22944. globals.SequenceNode);
  22945. smalltalk.addMethod(
  22946. smalltalk.method({
  22947. selector: "temps:",
  22948. protocol: 'accessing',
  22949. fn: function (aCollection){
  22950. var self=this;
  22951. self["@temps"]=aCollection;
  22952. return self},
  22953. args: ["aCollection"],
  22954. source: "temps: aCollection\x0a\x09temps := aCollection",
  22955. messageSends: [],
  22956. referencedClasses: []
  22957. }),
  22958. globals.SequenceNode);
  22959. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  22960. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  22961. smalltalk.addMethod(
  22962. smalltalk.method({
  22963. selector: "accept:",
  22964. protocol: 'visiting',
  22965. fn: function (aVisitor){
  22966. var self=this;
  22967. return smalltalk.withContext(function($ctx1) {
  22968. var $1;
  22969. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  22970. return $1;
  22971. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
  22972. args: ["aVisitor"],
  22973. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  22974. messageSends: ["visitBlockSequenceNode:"],
  22975. referencedClasses: []
  22976. }),
  22977. globals.BlockSequenceNode);
  22978. smalltalk.addMethod(
  22979. smalltalk.method({
  22980. selector: "isBlockSequenceNode",
  22981. protocol: 'testing',
  22982. fn: function (){
  22983. var self=this;
  22984. return true;
  22985. },
  22986. args: [],
  22987. source: "isBlockSequenceNode\x0a\x09^ true",
  22988. messageSends: [],
  22989. referencedClasses: []
  22990. }),
  22991. globals.BlockSequenceNode);
  22992. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  22993. globals.ValueNode.comment="I represent a value node.";
  22994. smalltalk.addMethod(
  22995. smalltalk.method({
  22996. selector: "accept:",
  22997. protocol: 'visiting',
  22998. fn: function (aVisitor){
  22999. var self=this;
  23000. return smalltalk.withContext(function($ctx1) {
  23001. var $1;
  23002. $1=_st(aVisitor)._visitValueNode_(self);
  23003. return $1;
  23004. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
  23005. args: ["aVisitor"],
  23006. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  23007. messageSends: ["visitValueNode:"],
  23008. referencedClasses: []
  23009. }),
  23010. globals.ValueNode);
  23011. smalltalk.addMethod(
  23012. smalltalk.method({
  23013. selector: "isImmutable",
  23014. protocol: 'testing',
  23015. fn: function (){
  23016. var self=this;
  23017. return smalltalk.withContext(function($ctx1) {
  23018. var $1;
  23019. $1=_st(self._value())._isImmutable();
  23020. return $1;
  23021. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
  23022. args: [],
  23023. source: "isImmutable\x0a\x09^ self value isImmutable",
  23024. messageSends: ["isImmutable", "value"],
  23025. referencedClasses: []
  23026. }),
  23027. globals.ValueNode);
  23028. smalltalk.addMethod(
  23029. smalltalk.method({
  23030. selector: "isValueNode",
  23031. protocol: 'testing',
  23032. fn: function (){
  23033. var self=this;
  23034. return true;
  23035. },
  23036. args: [],
  23037. source: "isValueNode\x0a\x09^ true",
  23038. messageSends: [],
  23039. referencedClasses: []
  23040. }),
  23041. globals.ValueNode);
  23042. smalltalk.addMethod(
  23043. smalltalk.method({
  23044. selector: "value",
  23045. protocol: 'accessing',
  23046. fn: function (){
  23047. var self=this;
  23048. var $1;
  23049. $1=self["@value"];
  23050. return $1;
  23051. },
  23052. args: [],
  23053. source: "value\x0a\x09^ value",
  23054. messageSends: [],
  23055. referencedClasses: []
  23056. }),
  23057. globals.ValueNode);
  23058. smalltalk.addMethod(
  23059. smalltalk.method({
  23060. selector: "value:",
  23061. protocol: 'accessing',
  23062. fn: function (anObject){
  23063. var self=this;
  23064. self["@value"]=anObject;
  23065. return self},
  23066. args: ["anObject"],
  23067. source: "value: anObject\x0a\x09value := anObject",
  23068. messageSends: [],
  23069. referencedClasses: []
  23070. }),
  23071. globals.ValueNode);
  23072. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  23073. globals.VariableNode.comment="I represent an variable node.";
  23074. smalltalk.addMethod(
  23075. smalltalk.method({
  23076. selector: "accept:",
  23077. protocol: 'visiting',
  23078. fn: function (aVisitor){
  23079. var self=this;
  23080. return smalltalk.withContext(function($ctx1) {
  23081. var $1;
  23082. $1=_st(aVisitor)._visitVariableNode_(self);
  23083. return $1;
  23084. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
  23085. args: ["aVisitor"],
  23086. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  23087. messageSends: ["visitVariableNode:"],
  23088. referencedClasses: []
  23089. }),
  23090. globals.VariableNode);
  23091. smalltalk.addMethod(
  23092. smalltalk.method({
  23093. selector: "alias",
  23094. protocol: 'accessing',
  23095. fn: function (){
  23096. var self=this;
  23097. return smalltalk.withContext(function($ctx1) {
  23098. var $1;
  23099. $1=_st(self._binding())._alias();
  23100. return $1;
  23101. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
  23102. args: [],
  23103. source: "alias\x0a\x09^ self binding alias",
  23104. messageSends: ["alias", "binding"],
  23105. referencedClasses: []
  23106. }),
  23107. globals.VariableNode);
  23108. smalltalk.addMethod(
  23109. smalltalk.method({
  23110. selector: "assigned",
  23111. protocol: 'accessing',
  23112. fn: function (){
  23113. var self=this;
  23114. return smalltalk.withContext(function($ctx1) {
  23115. var $2,$1;
  23116. $2=self["@assigned"];
  23117. if(($receiver = $2) == nil || $receiver == null){
  23118. $1=false;
  23119. } else {
  23120. $1=$2;
  23121. };
  23122. return $1;
  23123. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
  23124. args: [],
  23125. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  23126. messageSends: ["ifNil:"],
  23127. referencedClasses: []
  23128. }),
  23129. globals.VariableNode);
  23130. smalltalk.addMethod(
  23131. smalltalk.method({
  23132. selector: "assigned:",
  23133. protocol: 'accessing',
  23134. fn: function (aBoolean){
  23135. var self=this;
  23136. self["@assigned"]=aBoolean;
  23137. return self},
  23138. args: ["aBoolean"],
  23139. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  23140. messageSends: [],
  23141. referencedClasses: []
  23142. }),
  23143. globals.VariableNode);
  23144. smalltalk.addMethod(
  23145. smalltalk.method({
  23146. selector: "beAssigned",
  23147. protocol: 'accessing',
  23148. fn: function (){
  23149. var self=this;
  23150. return smalltalk.withContext(function($ctx1) {
  23151. _st(self._binding())._validateAssignment();
  23152. self["@assigned"]=true;
  23153. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
  23154. args: [],
  23155. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  23156. messageSends: ["validateAssignment", "binding"],
  23157. referencedClasses: []
  23158. }),
  23159. globals.VariableNode);
  23160. smalltalk.addMethod(
  23161. smalltalk.method({
  23162. selector: "binding",
  23163. protocol: 'accessing',
  23164. fn: function (){
  23165. var self=this;
  23166. var $1;
  23167. $1=self["@binding"];
  23168. return $1;
  23169. },
  23170. args: [],
  23171. source: "binding\x0a\x09^ binding",
  23172. messageSends: [],
  23173. referencedClasses: []
  23174. }),
  23175. globals.VariableNode);
  23176. smalltalk.addMethod(
  23177. smalltalk.method({
  23178. selector: "binding:",
  23179. protocol: 'accessing',
  23180. fn: function (aScopeVar){
  23181. var self=this;
  23182. self["@binding"]=aScopeVar;
  23183. return self},
  23184. args: ["aScopeVar"],
  23185. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  23186. messageSends: [],
  23187. referencedClasses: []
  23188. }),
  23189. globals.VariableNode);
  23190. smalltalk.addMethod(
  23191. smalltalk.method({
  23192. selector: "isArgument",
  23193. protocol: 'testing',
  23194. fn: function (){
  23195. var self=this;
  23196. return smalltalk.withContext(function($ctx1) {
  23197. var $1;
  23198. $1=_st(self._binding())._isArgVar();
  23199. return $1;
  23200. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
  23201. args: [],
  23202. source: "isArgument\x0a\x09^ self binding isArgVar",
  23203. messageSends: ["isArgVar", "binding"],
  23204. referencedClasses: []
  23205. }),
  23206. globals.VariableNode);
  23207. smalltalk.addMethod(
  23208. smalltalk.method({
  23209. selector: "isImmutable",
  23210. protocol: 'testing',
  23211. fn: function (){
  23212. var self=this;
  23213. return smalltalk.withContext(function($ctx1) {
  23214. var $1;
  23215. $1=_st(self._binding())._isImmutable();
  23216. return $1;
  23217. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
  23218. args: [],
  23219. source: "isImmutable\x0a\x09^ self binding isImmutable",
  23220. messageSends: ["isImmutable", "binding"],
  23221. referencedClasses: []
  23222. }),
  23223. globals.VariableNode);
  23224. smalltalk.addMethod(
  23225. smalltalk.method({
  23226. selector: "isVariableNode",
  23227. protocol: 'testing',
  23228. fn: function (){
  23229. var self=this;
  23230. return true;
  23231. },
  23232. args: [],
  23233. source: "isVariableNode\x0a\x09^ true",
  23234. messageSends: [],
  23235. referencedClasses: []
  23236. }),
  23237. globals.VariableNode);
  23238. smalltalk.addMethod(
  23239. smalltalk.method({
  23240. selector: "ast",
  23241. protocol: '*Compiler-AST',
  23242. fn: function (){
  23243. var self=this;
  23244. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23245. return smalltalk.withContext(function($ctx1) {
  23246. var $1,$2;
  23247. $1=self._source();
  23248. $ctx1.sendIdx["source"]=1;
  23249. _st($1)._ifEmpty_((function(){
  23250. return smalltalk.withContext(function($ctx2) {
  23251. return self._error_("Method source is empty");
  23252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23253. $2=_st($Smalltalk())._parse_(self._source());
  23254. return $2;
  23255. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
  23256. args: [],
  23257. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  23258. messageSends: ["ifEmpty:", "source", "error:", "parse:"],
  23259. referencedClasses: ["Smalltalk"]
  23260. }),
  23261. globals.CompiledMethod);
  23262. smalltalk.addMethod(
  23263. smalltalk.method({
  23264. selector: "isNode",
  23265. protocol: '*Compiler-AST',
  23266. fn: function (){
  23267. var self=this;
  23268. return false;
  23269. },
  23270. args: [],
  23271. source: "isNode\x0a\x09^ false",
  23272. messageSends: [],
  23273. referencedClasses: []
  23274. }),
  23275. globals.Object);
  23276. });
  23277. define("amber_core/Compiler-IR", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st, globals){
  23278. smalltalk.addPackage('Compiler-IR');
  23279. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23280. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  23281. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  23282. smalltalk.addMethod(
  23283. smalltalk.method({
  23284. selector: "alias:",
  23285. protocol: 'visiting',
  23286. fn: function (aNode){
  23287. var self=this;
  23288. var variable;
  23289. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  23290. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  23291. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  23292. return smalltalk.withContext(function($ctx1) {
  23293. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  23294. $1=_st(aNode)._isImmutable();
  23295. if(smalltalk.assert($1)){
  23296. $2=self._visit_(aNode);
  23297. $ctx1.sendIdx["visit:"]=1;
  23298. return $2;
  23299. };
  23300. $3=_st($IRVariable())._new();
  23301. $ctx1.sendIdx["new"]=1;
  23302. $4=$3;
  23303. $6=_st($AliasVar())._new();
  23304. $ctx1.sendIdx["new"]=2;
  23305. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  23306. _st($4)._variable_($5);
  23307. $7=_st($3)._yourself();
  23308. $ctx1.sendIdx["yourself"]=1;
  23309. variable=$7;
  23310. $8=self._sequence();
  23311. $10=_st($IRAssignment())._new();
  23312. _st($10)._add_(variable);
  23313. $ctx1.sendIdx["add:"]=2;
  23314. _st($10)._add_(self._visit_(aNode));
  23315. $ctx1.sendIdx["add:"]=3;
  23316. $11=_st($10)._yourself();
  23317. $9=$11;
  23318. _st($8)._add_($9);
  23319. $ctx1.sendIdx["add:"]=1;
  23320. _st(_st(self._method())._internalVariables())._add_(variable);
  23321. $12=variable;
  23322. return $12;
  23323. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)})},
  23324. args: ["aNode"],
  23325. 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",
  23326. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
  23327. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
  23328. }),
  23329. globals.IRASTTranslator);
  23330. smalltalk.addMethod(
  23331. smalltalk.method({
  23332. selector: "aliasTemporally:",
  23333. protocol: 'visiting',
  23334. fn: function (aCollection){
  23335. var self=this;
  23336. var threshold,result;
  23337. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  23338. return smalltalk.withContext(function($ctx1) {
  23339. var $1,$2,$4,$3,$5;
  23340. threshold=(0);
  23341. _st(aCollection)._withIndexDo_((function(each,i){
  23342. return smalltalk.withContext(function($ctx2) {
  23343. $1=_st(each)._subtreeNeedsAliasing();
  23344. if(smalltalk.assert($1)){
  23345. threshold=i;
  23346. return threshold;
  23347. };
  23348. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  23349. $ctx1.sendIdx["withIndexDo:"]=1;
  23350. result=_st($OrderedCollection())._new();
  23351. _st(aCollection)._withIndexDo_((function(each,i){
  23352. return smalltalk.withContext(function($ctx2) {
  23353. $2=result;
  23354. $4=_st(i).__lt_eq(threshold);
  23355. if(smalltalk.assert($4)){
  23356. $3=self._alias_(each);
  23357. } else {
  23358. $3=self._visit_(each);
  23359. };
  23360. return _st($2)._add_($3);
  23361. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  23362. $5=result;
  23363. return $5;
  23364. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)})},
  23365. args: ["aCollection"],
  23366. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/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",
  23367. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
  23368. referencedClasses: ["OrderedCollection"]
  23369. }),
  23370. globals.IRASTTranslator);
  23371. smalltalk.addMethod(
  23372. smalltalk.method({
  23373. selector: "method",
  23374. protocol: 'accessing',
  23375. fn: function (){
  23376. var self=this;
  23377. var $1;
  23378. $1=self["@method"];
  23379. return $1;
  23380. },
  23381. args: [],
  23382. source: "method\x0a\x09^ method",
  23383. messageSends: [],
  23384. referencedClasses: []
  23385. }),
  23386. globals.IRASTTranslator);
  23387. smalltalk.addMethod(
  23388. smalltalk.method({
  23389. selector: "method:",
  23390. protocol: 'accessing',
  23391. fn: function (anIRMethod){
  23392. var self=this;
  23393. self["@method"]=anIRMethod;
  23394. return self},
  23395. args: ["anIRMethod"],
  23396. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  23397. messageSends: [],
  23398. referencedClasses: []
  23399. }),
  23400. globals.IRASTTranslator);
  23401. smalltalk.addMethod(
  23402. smalltalk.method({
  23403. selector: "nextAlias",
  23404. protocol: 'accessing',
  23405. fn: function (){
  23406. var self=this;
  23407. return smalltalk.withContext(function($ctx1) {
  23408. var $1,$2;
  23409. $1=self["@nextAlias"];
  23410. if(($receiver = $1) == nil || $receiver == null){
  23411. self["@nextAlias"]=(0);
  23412. self["@nextAlias"];
  23413. } else {
  23414. $1;
  23415. };
  23416. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  23417. $2=_st(self["@nextAlias"])._asString();
  23418. return $2;
  23419. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)})},
  23420. args: [],
  23421. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  23422. messageSends: ["ifNil:", "+", "asString"],
  23423. referencedClasses: []
  23424. }),
  23425. globals.IRASTTranslator);
  23426. smalltalk.addMethod(
  23427. smalltalk.method({
  23428. selector: "sequence",
  23429. protocol: 'accessing',
  23430. fn: function (){
  23431. var self=this;
  23432. var $1;
  23433. $1=self["@sequence"];
  23434. return $1;
  23435. },
  23436. args: [],
  23437. source: "sequence\x0a\x09^ sequence",
  23438. messageSends: [],
  23439. referencedClasses: []
  23440. }),
  23441. globals.IRASTTranslator);
  23442. smalltalk.addMethod(
  23443. smalltalk.method({
  23444. selector: "sequence:",
  23445. protocol: 'accessing',
  23446. fn: function (anIRSequence){
  23447. var self=this;
  23448. self["@sequence"]=anIRSequence;
  23449. return self},
  23450. args: ["anIRSequence"],
  23451. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  23452. messageSends: [],
  23453. referencedClasses: []
  23454. }),
  23455. globals.IRASTTranslator);
  23456. smalltalk.addMethod(
  23457. smalltalk.method({
  23458. selector: "source",
  23459. protocol: 'accessing',
  23460. fn: function (){
  23461. var self=this;
  23462. var $1;
  23463. $1=self["@source"];
  23464. return $1;
  23465. },
  23466. args: [],
  23467. source: "source\x0a\x09^ source",
  23468. messageSends: [],
  23469. referencedClasses: []
  23470. }),
  23471. globals.IRASTTranslator);
  23472. smalltalk.addMethod(
  23473. smalltalk.method({
  23474. selector: "source:",
  23475. protocol: 'accessing',
  23476. fn: function (aString){
  23477. var self=this;
  23478. self["@source"]=aString;
  23479. return self},
  23480. args: ["aString"],
  23481. source: "source: aString\x0a\x09source := aString",
  23482. messageSends: [],
  23483. referencedClasses: []
  23484. }),
  23485. globals.IRASTTranslator);
  23486. smalltalk.addMethod(
  23487. smalltalk.method({
  23488. selector: "theClass",
  23489. protocol: 'accessing',
  23490. fn: function (){
  23491. var self=this;
  23492. var $1;
  23493. $1=self["@theClass"];
  23494. return $1;
  23495. },
  23496. args: [],
  23497. source: "theClass\x0a\x09^ theClass",
  23498. messageSends: [],
  23499. referencedClasses: []
  23500. }),
  23501. globals.IRASTTranslator);
  23502. smalltalk.addMethod(
  23503. smalltalk.method({
  23504. selector: "theClass:",
  23505. protocol: 'accessing',
  23506. fn: function (aClass){
  23507. var self=this;
  23508. self["@theClass"]=aClass;
  23509. return self},
  23510. args: ["aClass"],
  23511. source: "theClass: aClass\x0a\x09theClass := aClass",
  23512. messageSends: [],
  23513. referencedClasses: []
  23514. }),
  23515. globals.IRASTTranslator);
  23516. smalltalk.addMethod(
  23517. smalltalk.method({
  23518. selector: "visitAssignmentNode:",
  23519. protocol: 'visiting',
  23520. fn: function (aNode){
  23521. var self=this;
  23522. var left,right,assignment;
  23523. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  23524. return smalltalk.withContext(function($ctx1) {
  23525. var $1,$3,$4,$2,$5;
  23526. right=self._visit_(_st(aNode)._right());
  23527. $ctx1.sendIdx["visit:"]=1;
  23528. left=self._visit_(_st(aNode)._left());
  23529. $1=self._sequence();
  23530. $3=_st($IRAssignment())._new();
  23531. _st($3)._add_(left);
  23532. $ctx1.sendIdx["add:"]=2;
  23533. _st($3)._add_(right);
  23534. $4=_st($3)._yourself();
  23535. $2=$4;
  23536. _st($1)._add_($2);
  23537. $ctx1.sendIdx["add:"]=1;
  23538. $5=left;
  23539. return $5;
  23540. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)})},
  23541. args: ["aNode"],
  23542. 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",
  23543. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
  23544. referencedClasses: ["IRAssignment"]
  23545. }),
  23546. globals.IRASTTranslator);
  23547. smalltalk.addMethod(
  23548. smalltalk.method({
  23549. selector: "visitBlockNode:",
  23550. protocol: 'visiting',
  23551. fn: function (aNode){
  23552. var self=this;
  23553. var closure;
  23554. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  23555. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  23556. return smalltalk.withContext(function($ctx1) {
  23557. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  23558. $1=_st($IRClosure())._new();
  23559. $ctx1.sendIdx["new"]=1;
  23560. _st($1)._arguments_(_st(aNode)._parameters());
  23561. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  23562. $2=$1;
  23563. $3=_st(aNode)._scope();
  23564. $ctx1.sendIdx["scope"]=1;
  23565. _st($2)._scope_($3);
  23566. $ctx1.sendIdx["scope:"]=1;
  23567. $4=_st($1)._yourself();
  23568. $ctx1.sendIdx["yourself"]=1;
  23569. closure=$4;
  23570. $6=_st(aNode)._scope();
  23571. $ctx1.sendIdx["scope"]=2;
  23572. $5=_st($6)._temps();
  23573. _st($5)._do_((function(each){
  23574. return smalltalk.withContext(function($ctx2) {
  23575. $7=_st($IRTempDeclaration())._new();
  23576. _st($7)._name_(_st(each)._name());
  23577. _st($7)._scope_(_st(aNode)._scope());
  23578. $8=_st($7)._yourself();
  23579. return _st(closure)._add_($8);
  23580. $ctx2.sendIdx["add:"]=1;
  23581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23582. $ctx1.sendIdx["do:"]=1;
  23583. _st(_st(aNode)._nodes())._do_((function(each){
  23584. return smalltalk.withContext(function($ctx2) {
  23585. return _st(closure)._add_(self._visit_(each));
  23586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  23587. $9=closure;
  23588. return $9;
  23589. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)})},
  23590. args: ["aNode"],
  23591. 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",
  23592. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  23593. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  23594. }),
  23595. globals.IRASTTranslator);
  23596. smalltalk.addMethod(
  23597. smalltalk.method({
  23598. selector: "visitBlockSequenceNode:",
  23599. protocol: 'visiting',
  23600. fn: function (aNode){
  23601. var self=this;
  23602. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  23603. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  23604. return smalltalk.withContext(function($ctx1) {
  23605. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  23606. $2=_st($IRBlockSequence())._new();
  23607. $ctx1.sendIdx["new"]=1;
  23608. $1=self._withSequence_do_($2,(function(){
  23609. return smalltalk.withContext(function($ctx2) {
  23610. $3=_st(aNode)._nodes();
  23611. $ctx2.sendIdx["nodes"]=1;
  23612. return _st($3)._ifNotEmpty_((function(){
  23613. return smalltalk.withContext(function($ctx3) {
  23614. $5=_st(aNode)._nodes();
  23615. $ctx3.sendIdx["nodes"]=2;
  23616. $4=_st($5)._allButLast();
  23617. _st($4)._do_((function(each){
  23618. return smalltalk.withContext(function($ctx4) {
  23619. $6=self._sequence();
  23620. $ctx4.sendIdx["sequence"]=1;
  23621. $7=self._visitOrAlias_(each);
  23622. $ctx4.sendIdx["visitOrAlias:"]=1;
  23623. return _st($6)._add_($7);
  23624. $ctx4.sendIdx["add:"]=1;
  23625. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  23626. $10=_st(aNode)._nodes();
  23627. $ctx3.sendIdx["nodes"]=3;
  23628. $9=_st($10)._last();
  23629. $ctx3.sendIdx["last"]=1;
  23630. $8=_st($9)._isReturnNode();
  23631. if(smalltalk.assert($8)){
  23632. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  23633. } else {
  23634. $11=self._sequence();
  23635. $ctx3.sendIdx["sequence"]=2;
  23636. $13=_st($IRBlockReturn())._new();
  23637. $14=$13;
  23638. $17=_st(aNode)._nodes();
  23639. $ctx3.sendIdx["nodes"]=4;
  23640. $16=_st($17)._last();
  23641. $ctx3.sendIdx["last"]=2;
  23642. $15=self._visitOrAlias_($16);
  23643. $ctx3.sendIdx["visitOrAlias:"]=2;
  23644. _st($14)._add_($15);
  23645. $ctx3.sendIdx["add:"]=3;
  23646. $18=_st($13)._yourself();
  23647. $12=$18;
  23648. return _st($11)._add_($12);
  23649. $ctx3.sendIdx["add:"]=2;
  23650. };
  23651. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  23652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23653. return $1;
  23654. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  23655. args: ["aNode"],
  23656. 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) ] ]]",
  23657. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  23658. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  23659. }),
  23660. globals.IRASTTranslator);
  23661. smalltalk.addMethod(
  23662. smalltalk.method({
  23663. selector: "visitCascadeNode:",
  23664. protocol: 'visiting',
  23665. fn: function (aNode){
  23666. var self=this;
  23667. var alias,receiver;
  23668. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  23669. return smalltalk.withContext(function($ctx1) {
  23670. var $2,$1,$3,$5,$4,$6;
  23671. $2=_st(aNode)._receiver();
  23672. $ctx1.sendIdx["receiver"]=1;
  23673. $1=_st($2)._isImmutable();
  23674. if(smalltalk.assert($1)){
  23675. receiver=_st(aNode)._receiver();
  23676. $ctx1.sendIdx["receiver"]=2;
  23677. receiver;
  23678. } else {
  23679. alias=self._alias_(_st(aNode)._receiver());
  23680. $ctx1.sendIdx["alias:"]=1;
  23681. alias;
  23682. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  23683. receiver;
  23684. };
  23685. $3=_st(aNode)._nodes();
  23686. $ctx1.sendIdx["nodes"]=1;
  23687. _st($3)._do_((function(each){
  23688. return smalltalk.withContext(function($ctx2) {
  23689. return _st(each)._receiver_(receiver);
  23690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  23691. $ctx1.sendIdx["do:"]=1;
  23692. $5=_st(aNode)._nodes();
  23693. $ctx1.sendIdx["nodes"]=2;
  23694. $4=_st($5)._allButLast();
  23695. _st($4)._do_((function(each){
  23696. return smalltalk.withContext(function($ctx2) {
  23697. return _st(self._sequence())._add_(self._visit_(each));
  23698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  23699. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  23700. return $6;
  23701. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)})},
  23702. args: ["aNode"],
  23703. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  23704. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"],
  23705. referencedClasses: ["VariableNode"]
  23706. }),
  23707. globals.IRASTTranslator);
  23708. smalltalk.addMethod(
  23709. smalltalk.method({
  23710. selector: "visitDynamicArrayNode:",
  23711. protocol: 'visiting',
  23712. fn: function (aNode){
  23713. var self=this;
  23714. var array;
  23715. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  23716. return smalltalk.withContext(function($ctx1) {
  23717. var $1;
  23718. array=_st($IRDynamicArray())._new();
  23719. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  23720. return smalltalk.withContext(function($ctx2) {
  23721. return _st(array)._add_(each);
  23722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23723. $1=array;
  23724. return $1;
  23725. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)})},
  23726. args: ["aNode"],
  23727. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  23728. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  23729. referencedClasses: ["IRDynamicArray"]
  23730. }),
  23731. globals.IRASTTranslator);
  23732. smalltalk.addMethod(
  23733. smalltalk.method({
  23734. selector: "visitDynamicDictionaryNode:",
  23735. protocol: 'visiting',
  23736. fn: function (aNode){
  23737. var self=this;
  23738. var dictionary;
  23739. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  23740. return smalltalk.withContext(function($ctx1) {
  23741. var $1;
  23742. dictionary=_st($IRDynamicDictionary())._new();
  23743. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  23744. return smalltalk.withContext(function($ctx2) {
  23745. return _st(dictionary)._add_(each);
  23746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23747. $1=dictionary;
  23748. return $1;
  23749. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)})},
  23750. args: ["aNode"],
  23751. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  23752. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  23753. referencedClasses: ["IRDynamicDictionary"]
  23754. }),
  23755. globals.IRASTTranslator);
  23756. smalltalk.addMethod(
  23757. smalltalk.method({
  23758. selector: "visitJSStatementNode:",
  23759. protocol: 'visiting',
  23760. fn: function (aNode){
  23761. var self=this;
  23762. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  23763. return smalltalk.withContext(function($ctx1) {
  23764. var $2,$3,$1;
  23765. $2=_st($IRVerbatim())._new();
  23766. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  23767. $3=_st($2)._yourself();
  23768. $1=$3;
  23769. return $1;
  23770. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)})},
  23771. args: ["aNode"],
  23772. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  23773. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
  23774. referencedClasses: ["IRVerbatim"]
  23775. }),
  23776. globals.IRASTTranslator);
  23777. smalltalk.addMethod(
  23778. smalltalk.method({
  23779. selector: "visitMethodNode:",
  23780. protocol: 'visiting',
  23781. fn: function (aNode){
  23782. var self=this;
  23783. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  23784. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  23785. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  23786. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  23787. return smalltalk.withContext(function($ctx1) {
  23788. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$18,$19,$17,$20,$21,$22;
  23789. $2=_st($IRMethod())._new();
  23790. $ctx1.sendIdx["new"]=1;
  23791. _st($2)._source_(_st(self._source())._crlfSanitized());
  23792. _st($2)._theClass_(self._theClass());
  23793. _st($2)._arguments_(_st(aNode)._arguments());
  23794. _st($2)._selector_(_st(aNode)._selector());
  23795. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  23796. _st($2)._superSends_(_st(aNode)._superSends());
  23797. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  23798. _st($2)._classReferences_(_st(aNode)._classReferences());
  23799. $3=$2;
  23800. $4=_st(aNode)._scope();
  23801. $ctx1.sendIdx["scope"]=1;
  23802. _st($3)._scope_($4);
  23803. $ctx1.sendIdx["scope:"]=1;
  23804. $5=_st($2)._yourself();
  23805. $ctx1.sendIdx["yourself"]=1;
  23806. $1=$5;
  23807. self._method_($1);
  23808. $7=_st(aNode)._scope();
  23809. $ctx1.sendIdx["scope"]=2;
  23810. $6=_st($7)._temps();
  23811. _st($6)._do_((function(each){
  23812. return smalltalk.withContext(function($ctx2) {
  23813. $8=self._method();
  23814. $ctx2.sendIdx["method"]=1;
  23815. $10=_st($IRTempDeclaration())._new();
  23816. $ctx2.sendIdx["new"]=2;
  23817. _st($10)._name_(_st(each)._name());
  23818. $11=$10;
  23819. $12=_st(aNode)._scope();
  23820. $ctx2.sendIdx["scope"]=3;
  23821. _st($11)._scope_($12);
  23822. $13=_st($10)._yourself();
  23823. $ctx2.sendIdx["yourself"]=2;
  23824. $9=$13;
  23825. return _st($8)._add_($9);
  23826. $ctx2.sendIdx["add:"]=1;
  23827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23828. $ctx1.sendIdx["do:"]=1;
  23829. _st(_st(aNode)._nodes())._do_((function(each){
  23830. return smalltalk.withContext(function($ctx2) {
  23831. $14=self._method();
  23832. $ctx2.sendIdx["method"]=2;
  23833. return _st($14)._add_(self._visit_(each));
  23834. $ctx2.sendIdx["add:"]=2;
  23835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  23836. $16=_st(aNode)._scope();
  23837. $ctx1.sendIdx["scope"]=4;
  23838. $15=_st($16)._hasLocalReturn();
  23839. if(! smalltalk.assert($15)){
  23840. $18=self._method();
  23841. $ctx1.sendIdx["method"]=3;
  23842. $19=_st($IRReturn())._new();
  23843. $ctx1.sendIdx["new"]=3;
  23844. $17=_st($18)._add_($19);
  23845. $20=_st($IRVariable())._new();
  23846. _st($20)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  23847. $21=_st($20)._yourself();
  23848. _st($17)._add_($21);
  23849. $ctx1.sendIdx["add:"]=3;
  23850. };
  23851. $22=self._method();
  23852. return $22;
  23853. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)})},
  23854. args: ["aNode"],
  23855. 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\x09superSends: aNode superSends;\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: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
  23856. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  23857. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  23858. }),
  23859. globals.IRASTTranslator);
  23860. smalltalk.addMethod(
  23861. smalltalk.method({
  23862. selector: "visitOrAlias:",
  23863. protocol: 'visiting',
  23864. fn: function (aNode){
  23865. var self=this;
  23866. return smalltalk.withContext(function($ctx1) {
  23867. var $2,$1;
  23868. $2=_st(aNode)._shouldBeAliased();
  23869. if(smalltalk.assert($2)){
  23870. $1=self._alias_(aNode);
  23871. } else {
  23872. $1=self._visit_(aNode);
  23873. };
  23874. return $1;
  23875. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)})},
  23876. args: ["aNode"],
  23877. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  23878. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"],
  23879. referencedClasses: []
  23880. }),
  23881. globals.IRASTTranslator);
  23882. smalltalk.addMethod(
  23883. smalltalk.method({
  23884. selector: "visitReturnNode:",
  23885. protocol: 'visiting',
  23886. fn: function (aNode){
  23887. var self=this;
  23888. var return_;
  23889. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  23890. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  23891. return smalltalk.withContext(function($ctx1) {
  23892. var $1,$2;
  23893. $1=_st(aNode)._nonLocalReturn();
  23894. if(smalltalk.assert($1)){
  23895. return_=_st($IRNonLocalReturn())._new();
  23896. $ctx1.sendIdx["new"]=1;
  23897. } else {
  23898. return_=_st($IRReturn())._new();
  23899. };
  23900. _st(return_)._scope_(_st(aNode)._scope());
  23901. _st(_st(aNode)._nodes())._do_((function(each){
  23902. return smalltalk.withContext(function($ctx2) {
  23903. return _st(return_)._add_(self._alias_(each));
  23904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  23905. $2=return_;
  23906. return $2;
  23907. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)})},
  23908. args: ["aNode"],
  23909. 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 alias: each) ].\x0a\x09^ return",
  23910. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
  23911. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  23912. }),
  23913. globals.IRASTTranslator);
  23914. smalltalk.addMethod(
  23915. smalltalk.method({
  23916. selector: "visitSendNode:",
  23917. protocol: 'visiting',
  23918. fn: function (aNode){
  23919. var self=this;
  23920. var send,all,receiver,arguments;
  23921. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  23922. return smalltalk.withContext(function($ctx1) {
  23923. var $1,$2,$3,$4;
  23924. send=_st($IRSend())._new();
  23925. $1=send;
  23926. _st($1)._selector_(_st(aNode)._selector());
  23927. $2=_st($1)._index_(_st(aNode)._index());
  23928. $3=_st(aNode)._superSend();
  23929. if(smalltalk.assert($3)){
  23930. _st(send)._classSend_(_st(self._theClass())._superclass());
  23931. };
  23932. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  23933. receiver=_st(all)._first();
  23934. arguments=_st(all)._allButFirst();
  23935. _st(send)._add_(receiver);
  23936. $ctx1.sendIdx["add:"]=1;
  23937. _st(arguments)._do_((function(each){
  23938. return smalltalk.withContext(function($ctx2) {
  23939. return _st(send)._add_(each);
  23940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  23941. $4=send;
  23942. return $4;
  23943. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)})},
  23944. args: ["aNode"],
  23945. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  23946. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
  23947. referencedClasses: ["IRSend"]
  23948. }),
  23949. globals.IRASTTranslator);
  23950. smalltalk.addMethod(
  23951. smalltalk.method({
  23952. selector: "visitSequenceNode:",
  23953. protocol: 'visiting',
  23954. fn: function (aNode){
  23955. var self=this;
  23956. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  23957. return smalltalk.withContext(function($ctx1) {
  23958. var $2,$1;
  23959. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  23960. return smalltalk.withContext(function($ctx2) {
  23961. return _st(_st(aNode)._nodes())._do_((function(each){
  23962. var instruction;
  23963. return smalltalk.withContext(function($ctx3) {
  23964. instruction=self._visitOrAlias_(each);
  23965. instruction;
  23966. $2=_st(instruction)._isVariable();
  23967. if(! smalltalk.assert($2)){
  23968. return _st(self._sequence())._add_(instruction);
  23969. };
  23970. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)})}));
  23971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23972. return $1;
  23973. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  23974. args: ["aNode"],
  23975. 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 ] ]]",
  23976. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"],
  23977. referencedClasses: ["IRSequence"]
  23978. }),
  23979. globals.IRASTTranslator);
  23980. smalltalk.addMethod(
  23981. smalltalk.method({
  23982. selector: "visitValueNode:",
  23983. protocol: 'visiting',
  23984. fn: function (aNode){
  23985. var self=this;
  23986. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  23987. return smalltalk.withContext(function($ctx1) {
  23988. var $2,$3,$1;
  23989. $2=_st($IRValue())._new();
  23990. _st($2)._value_(_st(aNode)._value());
  23991. $3=_st($2)._yourself();
  23992. $1=$3;
  23993. return $1;
  23994. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)})},
  23995. args: ["aNode"],
  23996. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  23997. messageSends: ["value:", "new", "value", "yourself"],
  23998. referencedClasses: ["IRValue"]
  23999. }),
  24000. globals.IRASTTranslator);
  24001. smalltalk.addMethod(
  24002. smalltalk.method({
  24003. selector: "visitVariableNode:",
  24004. protocol: 'visiting',
  24005. fn: function (aNode){
  24006. var self=this;
  24007. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  24008. return smalltalk.withContext(function($ctx1) {
  24009. var $2,$3,$1;
  24010. $2=_st($IRVariable())._new();
  24011. _st($2)._variable_(_st(aNode)._binding());
  24012. $3=_st($2)._yourself();
  24013. $1=$3;
  24014. return $1;
  24015. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)})},
  24016. args: ["aNode"],
  24017. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  24018. messageSends: ["variable:", "new", "binding", "yourself"],
  24019. referencedClasses: ["IRVariable"]
  24020. }),
  24021. globals.IRASTTranslator);
  24022. smalltalk.addMethod(
  24023. smalltalk.method({
  24024. selector: "withSequence:do:",
  24025. protocol: 'accessing',
  24026. fn: function (aSequence,aBlock){
  24027. var self=this;
  24028. var outerSequence;
  24029. return smalltalk.withContext(function($ctx1) {
  24030. outerSequence=self._sequence();
  24031. self._sequence_(aSequence);
  24032. $ctx1.sendIdx["sequence:"]=1;
  24033. _st(aBlock)._value();
  24034. self._sequence_(outerSequence);
  24035. return aSequence;
  24036. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)})},
  24037. args: ["aSequence", "aBlock"],
  24038. 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",
  24039. messageSends: ["sequence", "sequence:", "value"],
  24040. referencedClasses: []
  24041. }),
  24042. globals.IRASTTranslator);
  24043. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  24044. 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.";
  24045. smalltalk.addMethod(
  24046. smalltalk.method({
  24047. selector: "accept:",
  24048. protocol: 'visiting',
  24049. fn: function (aVisitor){
  24050. var self=this;
  24051. return smalltalk.withContext(function($ctx1) {
  24052. var $1;
  24053. $1=_st(aVisitor)._visitIRInstruction_(self);
  24054. return $1;
  24055. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)})},
  24056. args: ["aVisitor"],
  24057. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  24058. messageSends: ["visitIRInstruction:"],
  24059. referencedClasses: []
  24060. }),
  24061. globals.IRInstruction);
  24062. smalltalk.addMethod(
  24063. smalltalk.method({
  24064. selector: "add:",
  24065. protocol: 'building',
  24066. fn: function (anObject){
  24067. var self=this;
  24068. return smalltalk.withContext(function($ctx1) {
  24069. var $1;
  24070. _st(anObject)._parent_(self);
  24071. $1=_st(self._instructions())._add_(anObject);
  24072. return $1;
  24073. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)})},
  24074. args: ["anObject"],
  24075. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  24076. messageSends: ["parent:", "add:", "instructions"],
  24077. referencedClasses: []
  24078. }),
  24079. globals.IRInstruction);
  24080. smalltalk.addMethod(
  24081. smalltalk.method({
  24082. selector: "canBeAssigned",
  24083. protocol: 'testing',
  24084. fn: function (){
  24085. var self=this;
  24086. return true;
  24087. },
  24088. args: [],
  24089. source: "canBeAssigned\x0a\x09^ true",
  24090. messageSends: [],
  24091. referencedClasses: []
  24092. }),
  24093. globals.IRInstruction);
  24094. smalltalk.addMethod(
  24095. smalltalk.method({
  24096. selector: "instructions",
  24097. protocol: 'accessing',
  24098. fn: function (){
  24099. var self=this;
  24100. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  24101. return smalltalk.withContext(function($ctx1) {
  24102. var $2,$1;
  24103. $2=self["@instructions"];
  24104. if(($receiver = $2) == nil || $receiver == null){
  24105. self["@instructions"]=_st($OrderedCollection())._new();
  24106. $1=self["@instructions"];
  24107. } else {
  24108. $1=$2;
  24109. };
  24110. return $1;
  24111. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)})},
  24112. args: [],
  24113. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  24114. messageSends: ["ifNil:", "new"],
  24115. referencedClasses: ["OrderedCollection"]
  24116. }),
  24117. globals.IRInstruction);
  24118. smalltalk.addMethod(
  24119. smalltalk.method({
  24120. selector: "isClosure",
  24121. protocol: 'testing',
  24122. fn: function (){
  24123. var self=this;
  24124. return false;
  24125. },
  24126. args: [],
  24127. source: "isClosure\x0a\x09^ false",
  24128. messageSends: [],
  24129. referencedClasses: []
  24130. }),
  24131. globals.IRInstruction);
  24132. smalltalk.addMethod(
  24133. smalltalk.method({
  24134. selector: "isInlined",
  24135. protocol: 'testing',
  24136. fn: function (){
  24137. var self=this;
  24138. return false;
  24139. },
  24140. args: [],
  24141. source: "isInlined\x0a\x09^ false",
  24142. messageSends: [],
  24143. referencedClasses: []
  24144. }),
  24145. globals.IRInstruction);
  24146. smalltalk.addMethod(
  24147. smalltalk.method({
  24148. selector: "isLocalReturn",
  24149. protocol: 'testing',
  24150. fn: function (){
  24151. var self=this;
  24152. return false;
  24153. },
  24154. args: [],
  24155. source: "isLocalReturn\x0a\x09^ false",
  24156. messageSends: [],
  24157. referencedClasses: []
  24158. }),
  24159. globals.IRInstruction);
  24160. smalltalk.addMethod(
  24161. smalltalk.method({
  24162. selector: "isMethod",
  24163. protocol: 'testing',
  24164. fn: function (){
  24165. var self=this;
  24166. return false;
  24167. },
  24168. args: [],
  24169. source: "isMethod\x0a\x09^ false",
  24170. messageSends: [],
  24171. referencedClasses: []
  24172. }),
  24173. globals.IRInstruction);
  24174. smalltalk.addMethod(
  24175. smalltalk.method({
  24176. selector: "isReturn",
  24177. protocol: 'testing',
  24178. fn: function (){
  24179. var self=this;
  24180. return false;
  24181. },
  24182. args: [],
  24183. source: "isReturn\x0a\x09^ false",
  24184. messageSends: [],
  24185. referencedClasses: []
  24186. }),
  24187. globals.IRInstruction);
  24188. smalltalk.addMethod(
  24189. smalltalk.method({
  24190. selector: "isSend",
  24191. protocol: 'testing',
  24192. fn: function (){
  24193. var self=this;
  24194. return false;
  24195. },
  24196. args: [],
  24197. source: "isSend\x0a\x09^ false",
  24198. messageSends: [],
  24199. referencedClasses: []
  24200. }),
  24201. globals.IRInstruction);
  24202. smalltalk.addMethod(
  24203. smalltalk.method({
  24204. selector: "isSequence",
  24205. protocol: 'testing',
  24206. fn: function (){
  24207. var self=this;
  24208. return false;
  24209. },
  24210. args: [],
  24211. source: "isSequence\x0a\x09^ false",
  24212. messageSends: [],
  24213. referencedClasses: []
  24214. }),
  24215. globals.IRInstruction);
  24216. smalltalk.addMethod(
  24217. smalltalk.method({
  24218. selector: "isTempDeclaration",
  24219. protocol: 'testing',
  24220. fn: function (){
  24221. var self=this;
  24222. return false;
  24223. },
  24224. args: [],
  24225. source: "isTempDeclaration\x0a\x09^ false",
  24226. messageSends: [],
  24227. referencedClasses: []
  24228. }),
  24229. globals.IRInstruction);
  24230. smalltalk.addMethod(
  24231. smalltalk.method({
  24232. selector: "isVariable",
  24233. protocol: 'testing',
  24234. fn: function (){
  24235. var self=this;
  24236. return false;
  24237. },
  24238. args: [],
  24239. source: "isVariable\x0a\x09^ false",
  24240. messageSends: [],
  24241. referencedClasses: []
  24242. }),
  24243. globals.IRInstruction);
  24244. smalltalk.addMethod(
  24245. smalltalk.method({
  24246. selector: "method",
  24247. protocol: 'accessing',
  24248. fn: function (){
  24249. var self=this;
  24250. return smalltalk.withContext(function($ctx1) {
  24251. var $1;
  24252. $1=_st(self._parent())._method();
  24253. return $1;
  24254. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)})},
  24255. args: [],
  24256. source: "method\x0a\x09^ self parent method",
  24257. messageSends: ["method", "parent"],
  24258. referencedClasses: []
  24259. }),
  24260. globals.IRInstruction);
  24261. smalltalk.addMethod(
  24262. smalltalk.method({
  24263. selector: "needsBoxingAsReceiver",
  24264. protocol: 'testing',
  24265. fn: function (){
  24266. var self=this;
  24267. return true;
  24268. },
  24269. args: [],
  24270. source: "needsBoxingAsReceiver\x0a\x09^ true",
  24271. messageSends: [],
  24272. referencedClasses: []
  24273. }),
  24274. globals.IRInstruction);
  24275. smalltalk.addMethod(
  24276. smalltalk.method({
  24277. selector: "parent",
  24278. protocol: 'accessing',
  24279. fn: function (){
  24280. var self=this;
  24281. var $1;
  24282. $1=self["@parent"];
  24283. return $1;
  24284. },
  24285. args: [],
  24286. source: "parent\x0a\x09^ parent",
  24287. messageSends: [],
  24288. referencedClasses: []
  24289. }),
  24290. globals.IRInstruction);
  24291. smalltalk.addMethod(
  24292. smalltalk.method({
  24293. selector: "parent:",
  24294. protocol: 'accessing',
  24295. fn: function (anIRInstruction){
  24296. var self=this;
  24297. self["@parent"]=anIRInstruction;
  24298. return self},
  24299. args: ["anIRInstruction"],
  24300. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  24301. messageSends: [],
  24302. referencedClasses: []
  24303. }),
  24304. globals.IRInstruction);
  24305. smalltalk.addMethod(
  24306. smalltalk.method({
  24307. selector: "remove",
  24308. protocol: 'building',
  24309. fn: function (){
  24310. var self=this;
  24311. return smalltalk.withContext(function($ctx1) {
  24312. _st(self._parent())._remove_(self);
  24313. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)})},
  24314. args: [],
  24315. source: "remove\x0a\x09self parent remove: self",
  24316. messageSends: ["remove:", "parent"],
  24317. referencedClasses: []
  24318. }),
  24319. globals.IRInstruction);
  24320. smalltalk.addMethod(
  24321. smalltalk.method({
  24322. selector: "remove:",
  24323. protocol: 'building',
  24324. fn: function (anIRInstruction){
  24325. var self=this;
  24326. return smalltalk.withContext(function($ctx1) {
  24327. _st(self._instructions())._remove_(anIRInstruction);
  24328. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  24329. args: ["anIRInstruction"],
  24330. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  24331. messageSends: ["remove:", "instructions"],
  24332. referencedClasses: []
  24333. }),
  24334. globals.IRInstruction);
  24335. smalltalk.addMethod(
  24336. smalltalk.method({
  24337. selector: "replace:with:",
  24338. protocol: 'building',
  24339. fn: function (anIRInstruction,anotherIRInstruction){
  24340. var self=this;
  24341. return smalltalk.withContext(function($ctx1) {
  24342. var $1;
  24343. _st(anotherIRInstruction)._parent_(self);
  24344. $1=self._instructions();
  24345. $ctx1.sendIdx["instructions"]=1;
  24346. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  24347. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)})},
  24348. args: ["anIRInstruction", "anotherIRInstruction"],
  24349. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  24350. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  24351. referencedClasses: []
  24352. }),
  24353. globals.IRInstruction);
  24354. smalltalk.addMethod(
  24355. smalltalk.method({
  24356. selector: "replaceWith:",
  24357. protocol: 'building',
  24358. fn: function (anIRInstruction){
  24359. var self=this;
  24360. return smalltalk.withContext(function($ctx1) {
  24361. _st(self._parent())._replace_with_(self,anIRInstruction);
  24362. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  24363. args: ["anIRInstruction"],
  24364. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  24365. messageSends: ["replace:with:", "parent"],
  24366. referencedClasses: []
  24367. }),
  24368. globals.IRInstruction);
  24369. smalltalk.addMethod(
  24370. smalltalk.method({
  24371. selector: "scope",
  24372. protocol: 'accessing',
  24373. fn: function (){
  24374. var self=this;
  24375. return smalltalk.withContext(function($ctx1) {
  24376. var $2,$1;
  24377. $2=self._parent();
  24378. if(($receiver = $2) == nil || $receiver == null){
  24379. $1=$2;
  24380. } else {
  24381. var node;
  24382. node=$receiver;
  24383. $1=_st(node)._scope();
  24384. };
  24385. return $1;
  24386. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)})},
  24387. args: [],
  24388. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  24389. messageSends: ["ifNotNil:", "parent", "scope"],
  24390. referencedClasses: []
  24391. }),
  24392. globals.IRInstruction);
  24393. smalltalk.addMethod(
  24394. smalltalk.method({
  24395. selector: "on:",
  24396. protocol: 'instance creation',
  24397. fn: function (aBuilder){
  24398. var self=this;
  24399. return smalltalk.withContext(function($ctx1) {
  24400. var $2,$3,$1;
  24401. $2=self._new();
  24402. _st($2)._builder_(aBuilder);
  24403. $3=_st($2)._yourself();
  24404. $1=$3;
  24405. return $1;
  24406. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)})},
  24407. args: ["aBuilder"],
  24408. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  24409. messageSends: ["builder:", "new", "yourself"],
  24410. referencedClasses: []
  24411. }),
  24412. globals.IRInstruction.klass);
  24413. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  24414. smalltalk.addMethod(
  24415. smalltalk.method({
  24416. selector: "accept:",
  24417. protocol: 'visiting',
  24418. fn: function (aVisitor){
  24419. var self=this;
  24420. return smalltalk.withContext(function($ctx1) {
  24421. var $1;
  24422. $1=_st(aVisitor)._visitIRAssignment_(self);
  24423. return $1;
  24424. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)})},
  24425. args: ["aVisitor"],
  24426. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  24427. messageSends: ["visitIRAssignment:"],
  24428. referencedClasses: []
  24429. }),
  24430. globals.IRAssignment);
  24431. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  24432. smalltalk.addMethod(
  24433. smalltalk.method({
  24434. selector: "accept:",
  24435. protocol: 'visiting',
  24436. fn: function (aVisitor){
  24437. var self=this;
  24438. return smalltalk.withContext(function($ctx1) {
  24439. var $1;
  24440. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  24441. return $1;
  24442. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)})},
  24443. args: ["aVisitor"],
  24444. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  24445. messageSends: ["visitIRDynamicArray:"],
  24446. referencedClasses: []
  24447. }),
  24448. globals.IRDynamicArray);
  24449. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  24450. smalltalk.addMethod(
  24451. smalltalk.method({
  24452. selector: "accept:",
  24453. protocol: 'visiting',
  24454. fn: function (aVisitor){
  24455. var self=this;
  24456. return smalltalk.withContext(function($ctx1) {
  24457. var $1;
  24458. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  24459. return $1;
  24460. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)})},
  24461. args: ["aVisitor"],
  24462. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  24463. messageSends: ["visitIRDynamicDictionary:"],
  24464. referencedClasses: []
  24465. }),
  24466. globals.IRDynamicDictionary);
  24467. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  24468. smalltalk.addMethod(
  24469. smalltalk.method({
  24470. selector: "scope",
  24471. protocol: 'accessing',
  24472. fn: function (){
  24473. var self=this;
  24474. var $1;
  24475. $1=self["@scope"];
  24476. return $1;
  24477. },
  24478. args: [],
  24479. source: "scope\x0a\x09^ scope",
  24480. messageSends: [],
  24481. referencedClasses: []
  24482. }),
  24483. globals.IRScopedInstruction);
  24484. smalltalk.addMethod(
  24485. smalltalk.method({
  24486. selector: "scope:",
  24487. protocol: 'accessing',
  24488. fn: function (aScope){
  24489. var self=this;
  24490. self["@scope"]=aScope;
  24491. return self},
  24492. args: ["aScope"],
  24493. source: "scope: aScope\x0a\x09scope := aScope",
  24494. messageSends: [],
  24495. referencedClasses: []
  24496. }),
  24497. globals.IRScopedInstruction);
  24498. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  24499. smalltalk.addMethod(
  24500. smalltalk.method({
  24501. selector: "arguments",
  24502. protocol: 'accessing',
  24503. fn: function (){
  24504. var self=this;
  24505. return smalltalk.withContext(function($ctx1) {
  24506. var $2,$1;
  24507. $2=self["@arguments"];
  24508. if(($receiver = $2) == nil || $receiver == null){
  24509. $1=[];
  24510. } else {
  24511. $1=$2;
  24512. };
  24513. return $1;
  24514. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)})},
  24515. args: [],
  24516. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  24517. messageSends: ["ifNil:"],
  24518. referencedClasses: []
  24519. }),
  24520. globals.IRClosureInstruction);
  24521. smalltalk.addMethod(
  24522. smalltalk.method({
  24523. selector: "arguments:",
  24524. protocol: 'accessing',
  24525. fn: function (aCollection){
  24526. var self=this;
  24527. self["@arguments"]=aCollection;
  24528. return self},
  24529. args: ["aCollection"],
  24530. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  24531. messageSends: [],
  24532. referencedClasses: []
  24533. }),
  24534. globals.IRClosureInstruction);
  24535. smalltalk.addMethod(
  24536. smalltalk.method({
  24537. selector: "locals",
  24538. protocol: 'accessing',
  24539. fn: function (){
  24540. var self=this;
  24541. return smalltalk.withContext(function($ctx1) {
  24542. var $2,$3,$1;
  24543. $2=_st(self._arguments())._copy();
  24544. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  24545. return smalltalk.withContext(function($ctx2) {
  24546. return _st(each)._name();
  24547. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  24548. $3=_st($2)._yourself();
  24549. $1=$3;
  24550. return $1;
  24551. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)})},
  24552. args: [],
  24553. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  24554. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
  24555. referencedClasses: []
  24556. }),
  24557. globals.IRClosureInstruction);
  24558. smalltalk.addMethod(
  24559. smalltalk.method({
  24560. selector: "requiresSmalltalkContext",
  24561. protocol: 'accessing',
  24562. fn: function (){
  24563. var self=this;
  24564. return smalltalk.withContext(function($ctx1) {
  24565. var $2,$1;
  24566. $2=self["@requiresSmalltalkContext"];
  24567. if(($receiver = $2) == nil || $receiver == null){
  24568. $1=false;
  24569. } else {
  24570. $1=$2;
  24571. };
  24572. return $1;
  24573. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)})},
  24574. args: [],
  24575. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  24576. messageSends: ["ifNil:"],
  24577. referencedClasses: []
  24578. }),
  24579. globals.IRClosureInstruction);
  24580. smalltalk.addMethod(
  24581. smalltalk.method({
  24582. selector: "requiresSmalltalkContext:",
  24583. protocol: 'accessing',
  24584. fn: function (anObject){
  24585. var self=this;
  24586. self["@requiresSmalltalkContext"]=anObject;
  24587. return self},
  24588. args: ["anObject"],
  24589. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  24590. messageSends: [],
  24591. referencedClasses: []
  24592. }),
  24593. globals.IRClosureInstruction);
  24594. smalltalk.addMethod(
  24595. smalltalk.method({
  24596. selector: "scope:",
  24597. protocol: 'accessing',
  24598. fn: function (aScope){
  24599. var self=this;
  24600. return smalltalk.withContext(function($ctx1) {
  24601. globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]);
  24602. _st(aScope)._instruction_(self);
  24603. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)})},
  24604. args: ["aScope"],
  24605. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  24606. messageSends: ["scope:", "instruction:"],
  24607. referencedClasses: []
  24608. }),
  24609. globals.IRClosureInstruction);
  24610. smalltalk.addMethod(
  24611. smalltalk.method({
  24612. selector: "tempDeclarations",
  24613. protocol: 'accessing',
  24614. fn: function (){
  24615. var self=this;
  24616. return smalltalk.withContext(function($ctx1) {
  24617. var $1;
  24618. $1=_st(self._instructions())._select_((function(each){
  24619. return smalltalk.withContext(function($ctx2) {
  24620. return _st(each)._isTempDeclaration();
  24621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  24622. return $1;
  24623. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)})},
  24624. args: [],
  24625. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  24626. messageSends: ["select:", "instructions", "isTempDeclaration"],
  24627. referencedClasses: []
  24628. }),
  24629. globals.IRClosureInstruction);
  24630. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  24631. smalltalk.addMethod(
  24632. smalltalk.method({
  24633. selector: "accept:",
  24634. protocol: 'visiting',
  24635. fn: function (aVisitor){
  24636. var self=this;
  24637. return smalltalk.withContext(function($ctx1) {
  24638. var $1;
  24639. $1=_st(aVisitor)._visitIRClosure_(self);
  24640. return $1;
  24641. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)})},
  24642. args: ["aVisitor"],
  24643. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  24644. messageSends: ["visitIRClosure:"],
  24645. referencedClasses: []
  24646. }),
  24647. globals.IRClosure);
  24648. smalltalk.addMethod(
  24649. smalltalk.method({
  24650. selector: "isClosure",
  24651. protocol: 'testing',
  24652. fn: function (){
  24653. var self=this;
  24654. return true;
  24655. },
  24656. args: [],
  24657. source: "isClosure\x0a\x09^ true",
  24658. messageSends: [],
  24659. referencedClasses: []
  24660. }),
  24661. globals.IRClosure);
  24662. smalltalk.addMethod(
  24663. smalltalk.method({
  24664. selector: "sequence",
  24665. protocol: 'accessing',
  24666. fn: function (){
  24667. var self=this;
  24668. return smalltalk.withContext(function($ctx1) {
  24669. var $1;
  24670. $1=_st(self._instructions())._last();
  24671. return $1;
  24672. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)})},
  24673. args: [],
  24674. source: "sequence\x0a\x09^ self instructions last",
  24675. messageSends: ["last", "instructions"],
  24676. referencedClasses: []
  24677. }),
  24678. globals.IRClosure);
  24679. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  24680. globals.IRMethod.comment="I am a method instruction";
  24681. smalltalk.addMethod(
  24682. smalltalk.method({
  24683. selector: "accept:",
  24684. protocol: 'visiting',
  24685. fn: function (aVisitor){
  24686. var self=this;
  24687. return smalltalk.withContext(function($ctx1) {
  24688. var $1;
  24689. $1=_st(aVisitor)._visitIRMethod_(self);
  24690. return $1;
  24691. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)})},
  24692. args: ["aVisitor"],
  24693. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  24694. messageSends: ["visitIRMethod:"],
  24695. referencedClasses: []
  24696. }),
  24697. globals.IRMethod);
  24698. smalltalk.addMethod(
  24699. smalltalk.method({
  24700. selector: "classReferences",
  24701. protocol: 'accessing',
  24702. fn: function (){
  24703. var self=this;
  24704. var $1;
  24705. $1=self["@classReferences"];
  24706. return $1;
  24707. },
  24708. args: [],
  24709. source: "classReferences\x0a\x09^ classReferences",
  24710. messageSends: [],
  24711. referencedClasses: []
  24712. }),
  24713. globals.IRMethod);
  24714. smalltalk.addMethod(
  24715. smalltalk.method({
  24716. selector: "classReferences:",
  24717. protocol: 'accessing',
  24718. fn: function (aCollection){
  24719. var self=this;
  24720. self["@classReferences"]=aCollection;
  24721. return self},
  24722. args: ["aCollection"],
  24723. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  24724. messageSends: [],
  24725. referencedClasses: []
  24726. }),
  24727. globals.IRMethod);
  24728. smalltalk.addMethod(
  24729. smalltalk.method({
  24730. selector: "internalVariables",
  24731. protocol: 'accessing',
  24732. fn: function (){
  24733. var self=this;
  24734. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  24735. return smalltalk.withContext(function($ctx1) {
  24736. var $2,$1;
  24737. $2=self["@internalVariables"];
  24738. if(($receiver = $2) == nil || $receiver == null){
  24739. self["@internalVariables"]=_st($Set())._new();
  24740. $1=self["@internalVariables"];
  24741. } else {
  24742. $1=$2;
  24743. };
  24744. return $1;
  24745. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)})},
  24746. args: [],
  24747. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  24748. messageSends: ["ifNil:", "new"],
  24749. referencedClasses: ["Set"]
  24750. }),
  24751. globals.IRMethod);
  24752. smalltalk.addMethod(
  24753. smalltalk.method({
  24754. selector: "isMethod",
  24755. protocol: 'accessing',
  24756. fn: function (){
  24757. var self=this;
  24758. return true;
  24759. },
  24760. args: [],
  24761. source: "isMethod\x0a\x09^ true",
  24762. messageSends: [],
  24763. referencedClasses: []
  24764. }),
  24765. globals.IRMethod);
  24766. smalltalk.addMethod(
  24767. smalltalk.method({
  24768. selector: "messageSends",
  24769. protocol: 'accessing',
  24770. fn: function (){
  24771. var self=this;
  24772. return smalltalk.withContext(function($ctx1) {
  24773. var $1;
  24774. $1=_st(self._sendIndexes())._keys();
  24775. return $1;
  24776. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)})},
  24777. args: [],
  24778. source: "messageSends\x0a\x09^ self sendIndexes keys",
  24779. messageSends: ["keys", "sendIndexes"],
  24780. referencedClasses: []
  24781. }),
  24782. globals.IRMethod);
  24783. smalltalk.addMethod(
  24784. smalltalk.method({
  24785. selector: "method",
  24786. protocol: 'accessing',
  24787. fn: function (){
  24788. var self=this;
  24789. return self;
  24790. },
  24791. args: [],
  24792. source: "method\x0a\x09^ self",
  24793. messageSends: [],
  24794. referencedClasses: []
  24795. }),
  24796. globals.IRMethod);
  24797. smalltalk.addMethod(
  24798. smalltalk.method({
  24799. selector: "selector",
  24800. protocol: 'accessing',
  24801. fn: function (){
  24802. var self=this;
  24803. var $1;
  24804. $1=self["@selector"];
  24805. return $1;
  24806. },
  24807. args: [],
  24808. source: "selector\x0a\x09^ selector",
  24809. messageSends: [],
  24810. referencedClasses: []
  24811. }),
  24812. globals.IRMethod);
  24813. smalltalk.addMethod(
  24814. smalltalk.method({
  24815. selector: "selector:",
  24816. protocol: 'accessing',
  24817. fn: function (aString){
  24818. var self=this;
  24819. self["@selector"]=aString;
  24820. return self},
  24821. args: ["aString"],
  24822. source: "selector: aString\x0a\x09selector := aString",
  24823. messageSends: [],
  24824. referencedClasses: []
  24825. }),
  24826. globals.IRMethod);
  24827. smalltalk.addMethod(
  24828. smalltalk.method({
  24829. selector: "sendIndexes",
  24830. protocol: 'accessing',
  24831. fn: function (){
  24832. var self=this;
  24833. var $1;
  24834. $1=self["@sendIndexes"];
  24835. return $1;
  24836. },
  24837. args: [],
  24838. source: "sendIndexes\x0a\x09^ sendIndexes",
  24839. messageSends: [],
  24840. referencedClasses: []
  24841. }),
  24842. globals.IRMethod);
  24843. smalltalk.addMethod(
  24844. smalltalk.method({
  24845. selector: "sendIndexes:",
  24846. protocol: 'accessing',
  24847. fn: function (aDictionary){
  24848. var self=this;
  24849. self["@sendIndexes"]=aDictionary;
  24850. return self},
  24851. args: ["aDictionary"],
  24852. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  24853. messageSends: [],
  24854. referencedClasses: []
  24855. }),
  24856. globals.IRMethod);
  24857. smalltalk.addMethod(
  24858. smalltalk.method({
  24859. selector: "source",
  24860. protocol: 'accessing',
  24861. fn: function (){
  24862. var self=this;
  24863. var $1;
  24864. $1=self["@source"];
  24865. return $1;
  24866. },
  24867. args: [],
  24868. source: "source\x0a\x09^ source",
  24869. messageSends: [],
  24870. referencedClasses: []
  24871. }),
  24872. globals.IRMethod);
  24873. smalltalk.addMethod(
  24874. smalltalk.method({
  24875. selector: "source:",
  24876. protocol: 'accessing',
  24877. fn: function (aString){
  24878. var self=this;
  24879. self["@source"]=aString;
  24880. return self},
  24881. args: ["aString"],
  24882. source: "source: aString\x0a\x09source := aString",
  24883. messageSends: [],
  24884. referencedClasses: []
  24885. }),
  24886. globals.IRMethod);
  24887. smalltalk.addMethod(
  24888. smalltalk.method({
  24889. selector: "superSends",
  24890. protocol: 'accessing',
  24891. fn: function (){
  24892. var self=this;
  24893. var $1;
  24894. $1=self["@superSends"];
  24895. return $1;
  24896. },
  24897. args: [],
  24898. source: "superSends\x0a\x09^ superSends",
  24899. messageSends: [],
  24900. referencedClasses: []
  24901. }),
  24902. globals.IRMethod);
  24903. smalltalk.addMethod(
  24904. smalltalk.method({
  24905. selector: "superSends:",
  24906. protocol: 'accessing',
  24907. fn: function (aCollection){
  24908. var self=this;
  24909. self["@superSends"]=aCollection;
  24910. return self},
  24911. args: ["aCollection"],
  24912. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  24913. messageSends: [],
  24914. referencedClasses: []
  24915. }),
  24916. globals.IRMethod);
  24917. smalltalk.addMethod(
  24918. smalltalk.method({
  24919. selector: "theClass",
  24920. protocol: 'accessing',
  24921. fn: function (){
  24922. var self=this;
  24923. var $1;
  24924. $1=self["@theClass"];
  24925. return $1;
  24926. },
  24927. args: [],
  24928. source: "theClass\x0a\x09^ theClass",
  24929. messageSends: [],
  24930. referencedClasses: []
  24931. }),
  24932. globals.IRMethod);
  24933. smalltalk.addMethod(
  24934. smalltalk.method({
  24935. selector: "theClass:",
  24936. protocol: 'accessing',
  24937. fn: function (aClass){
  24938. var self=this;
  24939. self["@theClass"]=aClass;
  24940. return self},
  24941. args: ["aClass"],
  24942. source: "theClass: aClass\x0a\x09theClass := aClass",
  24943. messageSends: [],
  24944. referencedClasses: []
  24945. }),
  24946. globals.IRMethod);
  24947. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  24948. globals.IRReturn.comment="I am a local return instruction.";
  24949. smalltalk.addMethod(
  24950. smalltalk.method({
  24951. selector: "accept:",
  24952. protocol: 'visiting',
  24953. fn: function (aVisitor){
  24954. var self=this;
  24955. return smalltalk.withContext(function($ctx1) {
  24956. var $1;
  24957. $1=_st(aVisitor)._visitIRReturn_(self);
  24958. return $1;
  24959. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)})},
  24960. args: ["aVisitor"],
  24961. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  24962. messageSends: ["visitIRReturn:"],
  24963. referencedClasses: []
  24964. }),
  24965. globals.IRReturn);
  24966. smalltalk.addMethod(
  24967. smalltalk.method({
  24968. selector: "canBeAssigned",
  24969. protocol: 'testing',
  24970. fn: function (){
  24971. var self=this;
  24972. return false;
  24973. },
  24974. args: [],
  24975. source: "canBeAssigned\x0a\x09^ false",
  24976. messageSends: [],
  24977. referencedClasses: []
  24978. }),
  24979. globals.IRReturn);
  24980. smalltalk.addMethod(
  24981. smalltalk.method({
  24982. selector: "isBlockReturn",
  24983. protocol: 'testing',
  24984. fn: function (){
  24985. var self=this;
  24986. return false;
  24987. },
  24988. args: [],
  24989. source: "isBlockReturn\x0a\x09^ false",
  24990. messageSends: [],
  24991. referencedClasses: []
  24992. }),
  24993. globals.IRReturn);
  24994. smalltalk.addMethod(
  24995. smalltalk.method({
  24996. selector: "isLocalReturn",
  24997. protocol: 'testing',
  24998. fn: function (){
  24999. var self=this;
  25000. return true;
  25001. },
  25002. args: [],
  25003. source: "isLocalReturn\x0a\x09^ true",
  25004. messageSends: [],
  25005. referencedClasses: []
  25006. }),
  25007. globals.IRReturn);
  25008. smalltalk.addMethod(
  25009. smalltalk.method({
  25010. selector: "isNonLocalReturn",
  25011. protocol: 'testing',
  25012. fn: function (){
  25013. var self=this;
  25014. return smalltalk.withContext(function($ctx1) {
  25015. var $1;
  25016. $1=_st(self._isLocalReturn())._not();
  25017. return $1;
  25018. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)})},
  25019. args: [],
  25020. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  25021. messageSends: ["not", "isLocalReturn"],
  25022. referencedClasses: []
  25023. }),
  25024. globals.IRReturn);
  25025. smalltalk.addMethod(
  25026. smalltalk.method({
  25027. selector: "isReturn",
  25028. protocol: 'testing',
  25029. fn: function (){
  25030. var self=this;
  25031. return true;
  25032. },
  25033. args: [],
  25034. source: "isReturn\x0a\x09^ true",
  25035. messageSends: [],
  25036. referencedClasses: []
  25037. }),
  25038. globals.IRReturn);
  25039. smalltalk.addMethod(
  25040. smalltalk.method({
  25041. selector: "scope",
  25042. protocol: 'accessing',
  25043. fn: function (){
  25044. var self=this;
  25045. return smalltalk.withContext(function($ctx1) {
  25046. var $2,$1;
  25047. $2=self["@scope"];
  25048. if(($receiver = $2) == nil || $receiver == null){
  25049. $1=_st(self._parent())._scope();
  25050. } else {
  25051. $1=$2;
  25052. };
  25053. return $1;
  25054. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)})},
  25055. args: [],
  25056. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  25057. messageSends: ["ifNil:", "scope", "parent"],
  25058. referencedClasses: []
  25059. }),
  25060. globals.IRReturn);
  25061. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  25062. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  25063. smalltalk.addMethod(
  25064. smalltalk.method({
  25065. selector: "accept:",
  25066. protocol: 'visiting',
  25067. fn: function (aVisitor){
  25068. var self=this;
  25069. return smalltalk.withContext(function($ctx1) {
  25070. var $1;
  25071. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  25072. return $1;
  25073. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)})},
  25074. args: ["aVisitor"],
  25075. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  25076. messageSends: ["visitIRBlockReturn:"],
  25077. referencedClasses: []
  25078. }),
  25079. globals.IRBlockReturn);
  25080. smalltalk.addMethod(
  25081. smalltalk.method({
  25082. selector: "isBlockReturn",
  25083. protocol: 'testing',
  25084. fn: function (){
  25085. var self=this;
  25086. return true;
  25087. },
  25088. args: [],
  25089. source: "isBlockReturn\x0a\x09^ true",
  25090. messageSends: [],
  25091. referencedClasses: []
  25092. }),
  25093. globals.IRBlockReturn);
  25094. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  25095. 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.";
  25096. smalltalk.addMethod(
  25097. smalltalk.method({
  25098. selector: "accept:",
  25099. protocol: 'visiting',
  25100. fn: function (aVisitor){
  25101. var self=this;
  25102. return smalltalk.withContext(function($ctx1) {
  25103. var $1;
  25104. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  25105. return $1;
  25106. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)})},
  25107. args: ["aVisitor"],
  25108. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  25109. messageSends: ["visitIRNonLocalReturn:"],
  25110. referencedClasses: []
  25111. }),
  25112. globals.IRNonLocalReturn);
  25113. smalltalk.addMethod(
  25114. smalltalk.method({
  25115. selector: "isLocalReturn",
  25116. protocol: 'testing',
  25117. fn: function (){
  25118. var self=this;
  25119. return false;
  25120. },
  25121. args: [],
  25122. source: "isLocalReturn\x0a\x09^ false",
  25123. messageSends: [],
  25124. referencedClasses: []
  25125. }),
  25126. globals.IRNonLocalReturn);
  25127. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  25128. smalltalk.addMethod(
  25129. smalltalk.method({
  25130. selector: "accept:",
  25131. protocol: 'visiting',
  25132. fn: function (aVisitor){
  25133. var self=this;
  25134. return smalltalk.withContext(function($ctx1) {
  25135. var $1;
  25136. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  25137. return $1;
  25138. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)})},
  25139. args: ["aVisitor"],
  25140. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  25141. messageSends: ["visitIRTempDeclaration:"],
  25142. referencedClasses: []
  25143. }),
  25144. globals.IRTempDeclaration);
  25145. smalltalk.addMethod(
  25146. smalltalk.method({
  25147. selector: "isTempDeclaration",
  25148. protocol: 'testing',
  25149. fn: function (){
  25150. var self=this;
  25151. return true;
  25152. },
  25153. args: [],
  25154. source: "isTempDeclaration\x0a\x09^ true",
  25155. messageSends: [],
  25156. referencedClasses: []
  25157. }),
  25158. globals.IRTempDeclaration);
  25159. smalltalk.addMethod(
  25160. smalltalk.method({
  25161. selector: "name",
  25162. protocol: 'accessing',
  25163. fn: function (){
  25164. var self=this;
  25165. var $1;
  25166. $1=self["@name"];
  25167. return $1;
  25168. },
  25169. args: [],
  25170. source: "name\x0a\x09^ name",
  25171. messageSends: [],
  25172. referencedClasses: []
  25173. }),
  25174. globals.IRTempDeclaration);
  25175. smalltalk.addMethod(
  25176. smalltalk.method({
  25177. selector: "name:",
  25178. protocol: 'accessing',
  25179. fn: function (aString){
  25180. var self=this;
  25181. self["@name"]=aString;
  25182. return self},
  25183. args: ["aString"],
  25184. source: "name: aString\x0a\x09name := aString",
  25185. messageSends: [],
  25186. referencedClasses: []
  25187. }),
  25188. globals.IRTempDeclaration);
  25189. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  25190. globals.IRSend.comment="I am a message send instruction.";
  25191. smalltalk.addMethod(
  25192. smalltalk.method({
  25193. selector: "accept:",
  25194. protocol: 'visiting',
  25195. fn: function (aVisitor){
  25196. var self=this;
  25197. return smalltalk.withContext(function($ctx1) {
  25198. var $1;
  25199. $1=_st(aVisitor)._visitIRSend_(self);
  25200. return $1;
  25201. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)})},
  25202. args: ["aVisitor"],
  25203. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  25204. messageSends: ["visitIRSend:"],
  25205. referencedClasses: []
  25206. }),
  25207. globals.IRSend);
  25208. smalltalk.addMethod(
  25209. smalltalk.method({
  25210. selector: "classSend",
  25211. protocol: 'accessing',
  25212. fn: function (){
  25213. var self=this;
  25214. var $1;
  25215. $1=self["@classSend"];
  25216. return $1;
  25217. },
  25218. args: [],
  25219. source: "classSend\x0a\x09^ classSend",
  25220. messageSends: [],
  25221. referencedClasses: []
  25222. }),
  25223. globals.IRSend);
  25224. smalltalk.addMethod(
  25225. smalltalk.method({
  25226. selector: "classSend:",
  25227. protocol: 'accessing',
  25228. fn: function (aClass){
  25229. var self=this;
  25230. self["@classSend"]=aClass;
  25231. return self},
  25232. args: ["aClass"],
  25233. source: "classSend: aClass\x0a\x09classSend := aClass",
  25234. messageSends: [],
  25235. referencedClasses: []
  25236. }),
  25237. globals.IRSend);
  25238. smalltalk.addMethod(
  25239. smalltalk.method({
  25240. selector: "index",
  25241. protocol: 'accessing',
  25242. fn: function (){
  25243. var self=this;
  25244. var $1;
  25245. $1=self["@index"];
  25246. return $1;
  25247. },
  25248. args: [],
  25249. source: "index\x0a\x09^ index",
  25250. messageSends: [],
  25251. referencedClasses: []
  25252. }),
  25253. globals.IRSend);
  25254. smalltalk.addMethod(
  25255. smalltalk.method({
  25256. selector: "index:",
  25257. protocol: 'accessing',
  25258. fn: function (anInteger){
  25259. var self=this;
  25260. self["@index"]=anInteger;
  25261. return self},
  25262. args: ["anInteger"],
  25263. source: "index: anInteger\x0a\x09index := anInteger",
  25264. messageSends: [],
  25265. referencedClasses: []
  25266. }),
  25267. globals.IRSend);
  25268. smalltalk.addMethod(
  25269. smalltalk.method({
  25270. selector: "isSend",
  25271. protocol: 'testing',
  25272. fn: function (){
  25273. var self=this;
  25274. return true;
  25275. },
  25276. args: [],
  25277. source: "isSend\x0a\x09^ true",
  25278. messageSends: [],
  25279. referencedClasses: []
  25280. }),
  25281. globals.IRSend);
  25282. smalltalk.addMethod(
  25283. smalltalk.method({
  25284. selector: "selector",
  25285. protocol: 'accessing',
  25286. fn: function (){
  25287. var self=this;
  25288. var $1;
  25289. $1=self["@selector"];
  25290. return $1;
  25291. },
  25292. args: [],
  25293. source: "selector\x0a\x09^ selector",
  25294. messageSends: [],
  25295. referencedClasses: []
  25296. }),
  25297. globals.IRSend);
  25298. smalltalk.addMethod(
  25299. smalltalk.method({
  25300. selector: "selector:",
  25301. protocol: 'accessing',
  25302. fn: function (aString){
  25303. var self=this;
  25304. self["@selector"]=aString;
  25305. return self},
  25306. args: ["aString"],
  25307. source: "selector: aString\x0a\x09selector := aString",
  25308. messageSends: [],
  25309. referencedClasses: []
  25310. }),
  25311. globals.IRSend);
  25312. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  25313. smalltalk.addMethod(
  25314. smalltalk.method({
  25315. selector: "accept:",
  25316. protocol: 'visiting',
  25317. fn: function (aVisitor){
  25318. var self=this;
  25319. return smalltalk.withContext(function($ctx1) {
  25320. var $1;
  25321. $1=_st(aVisitor)._visitIRSequence_(self);
  25322. return $1;
  25323. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)})},
  25324. args: ["aVisitor"],
  25325. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  25326. messageSends: ["visitIRSequence:"],
  25327. referencedClasses: []
  25328. }),
  25329. globals.IRSequence);
  25330. smalltalk.addMethod(
  25331. smalltalk.method({
  25332. selector: "isSequence",
  25333. protocol: 'testing',
  25334. fn: function (){
  25335. var self=this;
  25336. return true;
  25337. },
  25338. args: [],
  25339. source: "isSequence\x0a\x09^ true",
  25340. messageSends: [],
  25341. referencedClasses: []
  25342. }),
  25343. globals.IRSequence);
  25344. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  25345. smalltalk.addMethod(
  25346. smalltalk.method({
  25347. selector: "accept:",
  25348. protocol: 'visiting',
  25349. fn: function (aVisitor){
  25350. var self=this;
  25351. return smalltalk.withContext(function($ctx1) {
  25352. var $1;
  25353. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  25354. return $1;
  25355. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)})},
  25356. args: ["aVisitor"],
  25357. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  25358. messageSends: ["visitIRBlockSequence:"],
  25359. referencedClasses: []
  25360. }),
  25361. globals.IRBlockSequence);
  25362. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  25363. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  25364. smalltalk.addMethod(
  25365. smalltalk.method({
  25366. selector: "accept:",
  25367. protocol: 'visiting',
  25368. fn: function (aVisitor){
  25369. var self=this;
  25370. return smalltalk.withContext(function($ctx1) {
  25371. var $1;
  25372. $1=_st(aVisitor)._visitIRValue_(self);
  25373. return $1;
  25374. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)})},
  25375. args: ["aVisitor"],
  25376. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  25377. messageSends: ["visitIRValue:"],
  25378. referencedClasses: []
  25379. }),
  25380. globals.IRValue);
  25381. smalltalk.addMethod(
  25382. smalltalk.method({
  25383. selector: "needsBoxingAsReceiver",
  25384. protocol: 'testing',
  25385. fn: function (){
  25386. var self=this;
  25387. return false;
  25388. },
  25389. args: [],
  25390. source: "needsBoxingAsReceiver\x0a\x09^ false",
  25391. messageSends: [],
  25392. referencedClasses: []
  25393. }),
  25394. globals.IRValue);
  25395. smalltalk.addMethod(
  25396. smalltalk.method({
  25397. selector: "value",
  25398. protocol: 'accessing',
  25399. fn: function (){
  25400. var self=this;
  25401. var $1;
  25402. $1=self["@value"];
  25403. return $1;
  25404. },
  25405. args: [],
  25406. source: "value\x0a\x09^ value",
  25407. messageSends: [],
  25408. referencedClasses: []
  25409. }),
  25410. globals.IRValue);
  25411. smalltalk.addMethod(
  25412. smalltalk.method({
  25413. selector: "value:",
  25414. protocol: 'accessing',
  25415. fn: function (aString){
  25416. var self=this;
  25417. self["@value"]=aString;
  25418. return self},
  25419. args: ["aString"],
  25420. source: "value: aString\x0a\x09value := aString",
  25421. messageSends: [],
  25422. referencedClasses: []
  25423. }),
  25424. globals.IRValue);
  25425. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  25426. globals.IRVariable.comment="I am a variable instruction.";
  25427. smalltalk.addMethod(
  25428. smalltalk.method({
  25429. selector: "accept:",
  25430. protocol: 'visiting',
  25431. fn: function (aVisitor){
  25432. var self=this;
  25433. return smalltalk.withContext(function($ctx1) {
  25434. var $1;
  25435. $1=_st(aVisitor)._visitIRVariable_(self);
  25436. return $1;
  25437. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)})},
  25438. args: ["aVisitor"],
  25439. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  25440. messageSends: ["visitIRVariable:"],
  25441. referencedClasses: []
  25442. }),
  25443. globals.IRVariable);
  25444. smalltalk.addMethod(
  25445. smalltalk.method({
  25446. selector: "isVariable",
  25447. protocol: 'testing',
  25448. fn: function (){
  25449. var self=this;
  25450. return true;
  25451. },
  25452. args: [],
  25453. source: "isVariable\x0a\x09^ true",
  25454. messageSends: [],
  25455. referencedClasses: []
  25456. }),
  25457. globals.IRVariable);
  25458. smalltalk.addMethod(
  25459. smalltalk.method({
  25460. selector: "needsBoxingAsReceiver",
  25461. protocol: 'testing',
  25462. fn: function (){
  25463. var self=this;
  25464. return smalltalk.withContext(function($ctx1) {
  25465. var $1;
  25466. $1=_st(_st(self._variable())._isPseudoVar())._not();
  25467. return $1;
  25468. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)})},
  25469. args: [],
  25470. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  25471. messageSends: ["not", "isPseudoVar", "variable"],
  25472. referencedClasses: []
  25473. }),
  25474. globals.IRVariable);
  25475. smalltalk.addMethod(
  25476. smalltalk.method({
  25477. selector: "variable",
  25478. protocol: 'accessing',
  25479. fn: function (){
  25480. var self=this;
  25481. var $1;
  25482. $1=self["@variable"];
  25483. return $1;
  25484. },
  25485. args: [],
  25486. source: "variable\x0a\x09^ variable",
  25487. messageSends: [],
  25488. referencedClasses: []
  25489. }),
  25490. globals.IRVariable);
  25491. smalltalk.addMethod(
  25492. smalltalk.method({
  25493. selector: "variable:",
  25494. protocol: 'accessing',
  25495. fn: function (aScopeVariable){
  25496. var self=this;
  25497. self["@variable"]=aScopeVariable;
  25498. return self},
  25499. args: ["aScopeVariable"],
  25500. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  25501. messageSends: [],
  25502. referencedClasses: []
  25503. }),
  25504. globals.IRVariable);
  25505. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  25506. smalltalk.addMethod(
  25507. smalltalk.method({
  25508. selector: "accept:",
  25509. protocol: 'visiting',
  25510. fn: function (aVisitor){
  25511. var self=this;
  25512. return smalltalk.withContext(function($ctx1) {
  25513. var $1;
  25514. $1=_st(aVisitor)._visitIRVerbatim_(self);
  25515. return $1;
  25516. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)})},
  25517. args: ["aVisitor"],
  25518. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  25519. messageSends: ["visitIRVerbatim:"],
  25520. referencedClasses: []
  25521. }),
  25522. globals.IRVerbatim);
  25523. smalltalk.addMethod(
  25524. smalltalk.method({
  25525. selector: "source",
  25526. protocol: 'accessing',
  25527. fn: function (){
  25528. var self=this;
  25529. var $1;
  25530. $1=self["@source"];
  25531. return $1;
  25532. },
  25533. args: [],
  25534. source: "source\x0a\x09^ source",
  25535. messageSends: [],
  25536. referencedClasses: []
  25537. }),
  25538. globals.IRVerbatim);
  25539. smalltalk.addMethod(
  25540. smalltalk.method({
  25541. selector: "source:",
  25542. protocol: 'accessing',
  25543. fn: function (aString){
  25544. var self=this;
  25545. self["@source"]=aString;
  25546. return self},
  25547. args: ["aString"],
  25548. source: "source: aString\x0a\x09source := aString",
  25549. messageSends: [],
  25550. referencedClasses: []
  25551. }),
  25552. globals.IRVerbatim);
  25553. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  25554. smalltalk.addMethod(
  25555. smalltalk.method({
  25556. selector: "visit:",
  25557. protocol: 'visiting',
  25558. fn: function (anIRInstruction){
  25559. var self=this;
  25560. return smalltalk.withContext(function($ctx1) {
  25561. var $1;
  25562. $1=_st(anIRInstruction)._accept_(self);
  25563. return $1;
  25564. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  25565. args: ["anIRInstruction"],
  25566. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  25567. messageSends: ["accept:"],
  25568. referencedClasses: []
  25569. }),
  25570. globals.IRVisitor);
  25571. smalltalk.addMethod(
  25572. smalltalk.method({
  25573. selector: "visitIRAssignment:",
  25574. protocol: 'visiting',
  25575. fn: function (anIRAssignment){
  25576. var self=this;
  25577. return smalltalk.withContext(function($ctx1) {
  25578. var $1;
  25579. $1=self._visitIRInstruction_(anIRAssignment);
  25580. return $1;
  25581. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)})},
  25582. args: ["anIRAssignment"],
  25583. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  25584. messageSends: ["visitIRInstruction:"],
  25585. referencedClasses: []
  25586. }),
  25587. globals.IRVisitor);
  25588. smalltalk.addMethod(
  25589. smalltalk.method({
  25590. selector: "visitIRBlockReturn:",
  25591. protocol: 'visiting',
  25592. fn: function (anIRBlockReturn){
  25593. var self=this;
  25594. return smalltalk.withContext(function($ctx1) {
  25595. var $1;
  25596. $1=self._visitIRReturn_(anIRBlockReturn);
  25597. return $1;
  25598. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)})},
  25599. args: ["anIRBlockReturn"],
  25600. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  25601. messageSends: ["visitIRReturn:"],
  25602. referencedClasses: []
  25603. }),
  25604. globals.IRVisitor);
  25605. smalltalk.addMethod(
  25606. smalltalk.method({
  25607. selector: "visitIRBlockSequence:",
  25608. protocol: 'visiting',
  25609. fn: function (anIRBlockSequence){
  25610. var self=this;
  25611. return smalltalk.withContext(function($ctx1) {
  25612. var $1;
  25613. $1=self._visitIRSequence_(anIRBlockSequence);
  25614. return $1;
  25615. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)})},
  25616. args: ["anIRBlockSequence"],
  25617. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  25618. messageSends: ["visitIRSequence:"],
  25619. referencedClasses: []
  25620. }),
  25621. globals.IRVisitor);
  25622. smalltalk.addMethod(
  25623. smalltalk.method({
  25624. selector: "visitIRClosure:",
  25625. protocol: 'visiting',
  25626. fn: function (anIRClosure){
  25627. var self=this;
  25628. return smalltalk.withContext(function($ctx1) {
  25629. var $1;
  25630. $1=self._visitIRInstruction_(anIRClosure);
  25631. return $1;
  25632. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)})},
  25633. args: ["anIRClosure"],
  25634. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  25635. messageSends: ["visitIRInstruction:"],
  25636. referencedClasses: []
  25637. }),
  25638. globals.IRVisitor);
  25639. smalltalk.addMethod(
  25640. smalltalk.method({
  25641. selector: "visitIRDynamicArray:",
  25642. protocol: 'visiting',
  25643. fn: function (anIRDynamicArray){
  25644. var self=this;
  25645. return smalltalk.withContext(function($ctx1) {
  25646. var $1;
  25647. $1=self._visitIRInstruction_(anIRDynamicArray);
  25648. return $1;
  25649. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)})},
  25650. args: ["anIRDynamicArray"],
  25651. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  25652. messageSends: ["visitIRInstruction:"],
  25653. referencedClasses: []
  25654. }),
  25655. globals.IRVisitor);
  25656. smalltalk.addMethod(
  25657. smalltalk.method({
  25658. selector: "visitIRDynamicDictionary:",
  25659. protocol: 'visiting',
  25660. fn: function (anIRDynamicDictionary){
  25661. var self=this;
  25662. return smalltalk.withContext(function($ctx1) {
  25663. var $1;
  25664. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  25665. return $1;
  25666. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)})},
  25667. args: ["anIRDynamicDictionary"],
  25668. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  25669. messageSends: ["visitIRInstruction:"],
  25670. referencedClasses: []
  25671. }),
  25672. globals.IRVisitor);
  25673. smalltalk.addMethod(
  25674. smalltalk.method({
  25675. selector: "visitIRInlinedClosure:",
  25676. protocol: 'visiting',
  25677. fn: function (anIRInlinedClosure){
  25678. var self=this;
  25679. return smalltalk.withContext(function($ctx1) {
  25680. var $1;
  25681. $1=self._visitIRClosure_(anIRInlinedClosure);
  25682. return $1;
  25683. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)})},
  25684. args: ["anIRInlinedClosure"],
  25685. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  25686. messageSends: ["visitIRClosure:"],
  25687. referencedClasses: []
  25688. }),
  25689. globals.IRVisitor);
  25690. smalltalk.addMethod(
  25691. smalltalk.method({
  25692. selector: "visitIRInlinedSequence:",
  25693. protocol: 'visiting',
  25694. fn: function (anIRInlinedSequence){
  25695. var self=this;
  25696. return smalltalk.withContext(function($ctx1) {
  25697. var $1;
  25698. $1=self._visitIRSequence_(anIRInlinedSequence);
  25699. return $1;
  25700. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)})},
  25701. args: ["anIRInlinedSequence"],
  25702. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  25703. messageSends: ["visitIRSequence:"],
  25704. referencedClasses: []
  25705. }),
  25706. globals.IRVisitor);
  25707. smalltalk.addMethod(
  25708. smalltalk.method({
  25709. selector: "visitIRInstruction:",
  25710. protocol: 'visiting',
  25711. fn: function (anIRInstruction){
  25712. var self=this;
  25713. return smalltalk.withContext(function($ctx1) {
  25714. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  25715. return smalltalk.withContext(function($ctx2) {
  25716. return self._visit_(each);
  25717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25718. return anIRInstruction;
  25719. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  25720. args: ["anIRInstruction"],
  25721. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  25722. messageSends: ["do:", "instructions", "visit:"],
  25723. referencedClasses: []
  25724. }),
  25725. globals.IRVisitor);
  25726. smalltalk.addMethod(
  25727. smalltalk.method({
  25728. selector: "visitIRMethod:",
  25729. protocol: 'visiting',
  25730. fn: function (anIRMethod){
  25731. var self=this;
  25732. return smalltalk.withContext(function($ctx1) {
  25733. var $1;
  25734. $1=self._visitIRInstruction_(anIRMethod);
  25735. return $1;
  25736. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)})},
  25737. args: ["anIRMethod"],
  25738. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  25739. messageSends: ["visitIRInstruction:"],
  25740. referencedClasses: []
  25741. }),
  25742. globals.IRVisitor);
  25743. smalltalk.addMethod(
  25744. smalltalk.method({
  25745. selector: "visitIRNonLocalReturn:",
  25746. protocol: 'visiting',
  25747. fn: function (anIRNonLocalReturn){
  25748. var self=this;
  25749. return smalltalk.withContext(function($ctx1) {
  25750. var $1;
  25751. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  25752. return $1;
  25753. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)})},
  25754. args: ["anIRNonLocalReturn"],
  25755. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  25756. messageSends: ["visitIRInstruction:"],
  25757. referencedClasses: []
  25758. }),
  25759. globals.IRVisitor);
  25760. smalltalk.addMethod(
  25761. smalltalk.method({
  25762. selector: "visitIRNonLocalReturnHandling:",
  25763. protocol: 'visiting',
  25764. fn: function (anIRNonLocalReturnHandling){
  25765. var self=this;
  25766. return smalltalk.withContext(function($ctx1) {
  25767. var $1;
  25768. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  25769. return $1;
  25770. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)})},
  25771. args: ["anIRNonLocalReturnHandling"],
  25772. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  25773. messageSends: ["visitIRInstruction:"],
  25774. referencedClasses: []
  25775. }),
  25776. globals.IRVisitor);
  25777. smalltalk.addMethod(
  25778. smalltalk.method({
  25779. selector: "visitIRReturn:",
  25780. protocol: 'visiting',
  25781. fn: function (anIRReturn){
  25782. var self=this;
  25783. return smalltalk.withContext(function($ctx1) {
  25784. var $1;
  25785. $1=self._visitIRInstruction_(anIRReturn);
  25786. return $1;
  25787. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)})},
  25788. args: ["anIRReturn"],
  25789. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  25790. messageSends: ["visitIRInstruction:"],
  25791. referencedClasses: []
  25792. }),
  25793. globals.IRVisitor);
  25794. smalltalk.addMethod(
  25795. smalltalk.method({
  25796. selector: "visitIRSend:",
  25797. protocol: 'visiting',
  25798. fn: function (anIRSend){
  25799. var self=this;
  25800. return smalltalk.withContext(function($ctx1) {
  25801. var $1;
  25802. $1=self._visitIRInstruction_(anIRSend);
  25803. return $1;
  25804. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)})},
  25805. args: ["anIRSend"],
  25806. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  25807. messageSends: ["visitIRInstruction:"],
  25808. referencedClasses: []
  25809. }),
  25810. globals.IRVisitor);
  25811. smalltalk.addMethod(
  25812. smalltalk.method({
  25813. selector: "visitIRSequence:",
  25814. protocol: 'visiting',
  25815. fn: function (anIRSequence){
  25816. var self=this;
  25817. return smalltalk.withContext(function($ctx1) {
  25818. var $1;
  25819. $1=self._visitIRInstruction_(anIRSequence);
  25820. return $1;
  25821. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)})},
  25822. args: ["anIRSequence"],
  25823. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  25824. messageSends: ["visitIRInstruction:"],
  25825. referencedClasses: []
  25826. }),
  25827. globals.IRVisitor);
  25828. smalltalk.addMethod(
  25829. smalltalk.method({
  25830. selector: "visitIRTempDeclaration:",
  25831. protocol: 'visiting',
  25832. fn: function (anIRTempDeclaration){
  25833. var self=this;
  25834. return smalltalk.withContext(function($ctx1) {
  25835. var $1;
  25836. $1=self._visitIRInstruction_(anIRTempDeclaration);
  25837. return $1;
  25838. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)})},
  25839. args: ["anIRTempDeclaration"],
  25840. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  25841. messageSends: ["visitIRInstruction:"],
  25842. referencedClasses: []
  25843. }),
  25844. globals.IRVisitor);
  25845. smalltalk.addMethod(
  25846. smalltalk.method({
  25847. selector: "visitIRValue:",
  25848. protocol: 'visiting',
  25849. fn: function (anIRValue){
  25850. var self=this;
  25851. return smalltalk.withContext(function($ctx1) {
  25852. var $1;
  25853. $1=self._visitIRInstruction_(anIRValue);
  25854. return $1;
  25855. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)})},
  25856. args: ["anIRValue"],
  25857. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  25858. messageSends: ["visitIRInstruction:"],
  25859. referencedClasses: []
  25860. }),
  25861. globals.IRVisitor);
  25862. smalltalk.addMethod(
  25863. smalltalk.method({
  25864. selector: "visitIRVariable:",
  25865. protocol: 'visiting',
  25866. fn: function (anIRVariable){
  25867. var self=this;
  25868. return smalltalk.withContext(function($ctx1) {
  25869. var $1;
  25870. $1=self._visitIRInstruction_(anIRVariable);
  25871. return $1;
  25872. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)})},
  25873. args: ["anIRVariable"],
  25874. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  25875. messageSends: ["visitIRInstruction:"],
  25876. referencedClasses: []
  25877. }),
  25878. globals.IRVisitor);
  25879. smalltalk.addMethod(
  25880. smalltalk.method({
  25881. selector: "visitIRVerbatim:",
  25882. protocol: 'visiting',
  25883. fn: function (anIRVerbatim){
  25884. var self=this;
  25885. return smalltalk.withContext(function($ctx1) {
  25886. var $1;
  25887. $1=self._visitIRInstruction_(anIRVerbatim);
  25888. return $1;
  25889. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)})},
  25890. args: ["anIRVerbatim"],
  25891. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  25892. messageSends: ["visitIRInstruction:"],
  25893. referencedClasses: []
  25894. }),
  25895. globals.IRVisitor);
  25896. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  25897. smalltalk.addMethod(
  25898. smalltalk.method({
  25899. selector: "contents",
  25900. protocol: 'accessing',
  25901. fn: function (){
  25902. var self=this;
  25903. return smalltalk.withContext(function($ctx1) {
  25904. var $1;
  25905. $1=_st(self._stream())._contents();
  25906. return $1;
  25907. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)})},
  25908. args: [],
  25909. source: "contents\x0a\x09^ self stream contents",
  25910. messageSends: ["contents", "stream"],
  25911. referencedClasses: []
  25912. }),
  25913. globals.IRJSTranslator);
  25914. smalltalk.addMethod(
  25915. smalltalk.method({
  25916. selector: "currentClass",
  25917. protocol: 'accessing',
  25918. fn: function (){
  25919. var self=this;
  25920. var $1;
  25921. $1=self["@currentClass"];
  25922. return $1;
  25923. },
  25924. args: [],
  25925. source: "currentClass\x0a\x09^ currentClass",
  25926. messageSends: [],
  25927. referencedClasses: []
  25928. }),
  25929. globals.IRJSTranslator);
  25930. smalltalk.addMethod(
  25931. smalltalk.method({
  25932. selector: "currentClass:",
  25933. protocol: 'accessing',
  25934. fn: function (aClass){
  25935. var self=this;
  25936. self["@currentClass"]=aClass;
  25937. return self},
  25938. args: ["aClass"],
  25939. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  25940. messageSends: [],
  25941. referencedClasses: []
  25942. }),
  25943. globals.IRJSTranslator);
  25944. smalltalk.addMethod(
  25945. smalltalk.method({
  25946. selector: "initialize",
  25947. protocol: 'initialization',
  25948. fn: function (){
  25949. var self=this;
  25950. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  25951. return smalltalk.withContext(function($ctx1) {
  25952. globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []);
  25953. self["@stream"]=_st($JSStream())._new();
  25954. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)})},
  25955. args: [],
  25956. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  25957. messageSends: ["initialize", "new"],
  25958. referencedClasses: ["JSStream"]
  25959. }),
  25960. globals.IRJSTranslator);
  25961. smalltalk.addMethod(
  25962. smalltalk.method({
  25963. selector: "stream",
  25964. protocol: 'accessing',
  25965. fn: function (){
  25966. var self=this;
  25967. var $1;
  25968. $1=self["@stream"];
  25969. return $1;
  25970. },
  25971. args: [],
  25972. source: "stream\x0a\x09^ stream",
  25973. messageSends: [],
  25974. referencedClasses: []
  25975. }),
  25976. globals.IRJSTranslator);
  25977. smalltalk.addMethod(
  25978. smalltalk.method({
  25979. selector: "stream:",
  25980. protocol: 'accessing',
  25981. fn: function (aStream){
  25982. var self=this;
  25983. self["@stream"]=aStream;
  25984. return self},
  25985. args: ["aStream"],
  25986. source: "stream: aStream\x0a\x09stream := aStream",
  25987. messageSends: [],
  25988. referencedClasses: []
  25989. }),
  25990. globals.IRJSTranslator);
  25991. smalltalk.addMethod(
  25992. smalltalk.method({
  25993. selector: "visitIRAssignment:",
  25994. protocol: 'visiting',
  25995. fn: function (anIRAssignment){
  25996. var self=this;
  25997. return smalltalk.withContext(function($ctx1) {
  25998. var $2,$1;
  25999. $2=_st(anIRAssignment)._instructions();
  26000. $ctx1.sendIdx["instructions"]=1;
  26001. $1=_st($2)._first();
  26002. self._visit_($1);
  26003. $ctx1.sendIdx["visit:"]=1;
  26004. _st(self._stream())._nextPutAssignment();
  26005. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  26006. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)})},
  26007. args: ["anIRAssignment"],
  26008. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  26009. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  26010. referencedClasses: []
  26011. }),
  26012. globals.IRJSTranslator);
  26013. smalltalk.addMethod(
  26014. smalltalk.method({
  26015. selector: "visitIRClosure:",
  26016. protocol: 'visiting',
  26017. fn: function (anIRClosure){
  26018. var self=this;
  26019. return smalltalk.withContext(function($ctx1) {
  26020. var $1,$2;
  26021. $1=self._stream();
  26022. $ctx1.sendIdx["stream"]=1;
  26023. _st($1)._nextPutClosureWith_arguments_((function(){
  26024. return smalltalk.withContext(function($ctx2) {
  26025. $2=self._stream();
  26026. $ctx2.sendIdx["stream"]=2;
  26027. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  26028. return smalltalk.withContext(function($ctx3) {
  26029. return _st(_st(each)._name())._asVariableName();
  26030. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})})));
  26031. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  26032. return smalltalk.withContext(function($ctx3) {
  26033. return globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]);
  26034. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  26035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),_st(anIRClosure)._arguments());
  26036. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)})},
  26037. args: ["anIRClosure"],
  26038. 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",
  26039. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  26040. referencedClasses: []
  26041. }),
  26042. globals.IRJSTranslator);
  26043. smalltalk.addMethod(
  26044. smalltalk.method({
  26045. selector: "visitIRDynamicArray:",
  26046. protocol: 'visiting',
  26047. fn: function (anIRDynamicArray){
  26048. var self=this;
  26049. return smalltalk.withContext(function($ctx1) {
  26050. var $1;
  26051. $1=self._stream();
  26052. $ctx1.sendIdx["stream"]=1;
  26053. _st($1)._nextPutAll_("[");
  26054. $ctx1.sendIdx["nextPutAll:"]=1;
  26055. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  26056. return smalltalk.withContext(function($ctx2) {
  26057. return self._visit_(each);
  26058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26059. return smalltalk.withContext(function($ctx2) {
  26060. return _st(self._stream())._nextPutAll_(",");
  26061. $ctx2.sendIdx["nextPutAll:"]=2;
  26062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26063. _st(self["@stream"])._nextPutAll_("]");
  26064. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)})},
  26065. args: ["anIRDynamicArray"],
  26066. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  26067. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  26068. referencedClasses: []
  26069. }),
  26070. globals.IRJSTranslator);
  26071. smalltalk.addMethod(
  26072. smalltalk.method({
  26073. selector: "visitIRDynamicDictionary:",
  26074. protocol: 'visiting',
  26075. fn: function (anIRDynamicDictionary){
  26076. var self=this;
  26077. return smalltalk.withContext(function($ctx1) {
  26078. var $1,$2;
  26079. $1=self._stream();
  26080. $ctx1.sendIdx["stream"]=1;
  26081. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  26082. $ctx1.sendIdx["nextPutAll:"]=1;
  26083. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  26084. return smalltalk.withContext(function($ctx2) {
  26085. return self._visit_(each);
  26086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26087. return smalltalk.withContext(function($ctx2) {
  26088. $2=self._stream();
  26089. $ctx2.sendIdx["stream"]=2;
  26090. return _st($2)._nextPutAll_(",");
  26091. $ctx2.sendIdx["nextPutAll:"]=2;
  26092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26093. _st(self._stream())._nextPutAll_("])");
  26094. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)})},
  26095. args: ["anIRDynamicDictionary"],
  26096. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  26097. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  26098. referencedClasses: []
  26099. }),
  26100. globals.IRJSTranslator);
  26101. smalltalk.addMethod(
  26102. smalltalk.method({
  26103. selector: "visitIRMethod:",
  26104. protocol: 'visiting',
  26105. fn: function (anIRMethod){
  26106. var self=this;
  26107. return smalltalk.withContext(function($ctx1) {
  26108. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  26109. $1=self._stream();
  26110. $ctx1.sendIdx["stream"]=1;
  26111. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  26112. return smalltalk.withContext(function($ctx2) {
  26113. $2=self._stream();
  26114. $ctx2.sendIdx["stream"]=2;
  26115. return _st($2)._nextPutFunctionWith_arguments_((function(){
  26116. return smalltalk.withContext(function($ctx3) {
  26117. $3=self._stream();
  26118. $ctx3.sendIdx["stream"]=3;
  26119. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  26120. return smalltalk.withContext(function($ctx4) {
  26121. return _st(_st(each)._name())._asVariableName();
  26122. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  26123. $ctx3.sendIdx["collect:"]=1;
  26124. _st($3)._nextPutVars_($4);
  26125. $ctx3.sendIdx["nextPutVars:"]=1;
  26126. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  26127. return smalltalk.withContext(function($ctx4) {
  26128. $5=self._stream();
  26129. $ctx4.sendIdx["stream"]=4;
  26130. return _st($5)._nextPutClassRefFunction_(each);
  26131. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})}));
  26132. $6=self._stream();
  26133. $ctx3.sendIdx["stream"]=5;
  26134. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  26135. return smalltalk.withContext(function($ctx4) {
  26136. $8=_st(anIRMethod)._internalVariables();
  26137. $ctx4.sendIdx["internalVariables"]=1;
  26138. $7=_st($8)._notEmpty();
  26139. if(smalltalk.assert($7)){
  26140. $9=self._stream();
  26141. $ctx4.sendIdx["stream"]=6;
  26142. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asArray())._collect_((function(each){
  26143. return smalltalk.withContext(function($ctx5) {
  26144. return _st(_st(each)._variable())._alias();
  26145. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)})})));
  26146. };
  26147. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  26148. if(smalltalk.assert($10)){
  26149. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  26150. return smalltalk.withContext(function($ctx5) {
  26151. return globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  26152. $ctx5.sendIdx["visitIRMethod:"]=1;
  26153. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  26154. } else {
  26155. return globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  26156. };
  26157. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
  26158. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),_st(anIRMethod)._arguments());
  26159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26160. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)})},
  26161. args: ["anIRMethod"],
  26162. 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\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\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 asArray 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 ]",
  26163. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asArray", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  26164. referencedClasses: []
  26165. }),
  26166. globals.IRJSTranslator);
  26167. smalltalk.addMethod(
  26168. smalltalk.method({
  26169. selector: "visitIRNonLocalReturn:",
  26170. protocol: 'visiting',
  26171. fn: function (anIRNonLocalReturn){
  26172. var self=this;
  26173. return smalltalk.withContext(function($ctx1) {
  26174. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  26175. return smalltalk.withContext(function($ctx2) {
  26176. return globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  26177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26178. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)})},
  26179. args: ["anIRNonLocalReturn"],
  26180. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  26181. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  26182. referencedClasses: []
  26183. }),
  26184. globals.IRJSTranslator);
  26185. smalltalk.addMethod(
  26186. smalltalk.method({
  26187. selector: "visitIRReturn:",
  26188. protocol: 'visiting',
  26189. fn: function (anIRReturn){
  26190. var self=this;
  26191. return smalltalk.withContext(function($ctx1) {
  26192. _st(self._stream())._nextPutReturnWith_((function(){
  26193. return smalltalk.withContext(function($ctx2) {
  26194. return globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  26195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26196. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)})},
  26197. args: ["anIRReturn"],
  26198. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  26199. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  26200. referencedClasses: []
  26201. }),
  26202. globals.IRJSTranslator);
  26203. smalltalk.addMethod(
  26204. smalltalk.method({
  26205. selector: "visitIRSend:",
  26206. protocol: 'visiting',
  26207. fn: function (anIRSend){
  26208. var self=this;
  26209. var sends;
  26210. return smalltalk.withContext(function($ctx1) {
  26211. var $1,$2;
  26212. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  26213. $1=_st(anIRSend)._classSend();
  26214. if(($receiver = $1) == nil || $receiver == null){
  26215. self._visitSend_(anIRSend);
  26216. } else {
  26217. self._visitSuperSend_(anIRSend);
  26218. };
  26219. $2=_st(_st(sends).__gt((1)))._and_((function(){
  26220. return smalltalk.withContext(function($ctx2) {
  26221. return _st(_st(anIRSend)._index()).__lt(sends);
  26222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  26223. if(smalltalk.assert($2)){
  26224. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  26225. };
  26226. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)})},
  26227. args: ["anIRSend"],
  26228. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  26229. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"],
  26230. referencedClasses: []
  26231. }),
  26232. globals.IRJSTranslator);
  26233. smalltalk.addMethod(
  26234. smalltalk.method({
  26235. selector: "visitIRSequence:",
  26236. protocol: 'visiting',
  26237. fn: function (anIRSequence){
  26238. var self=this;
  26239. return smalltalk.withContext(function($ctx1) {
  26240. var $1;
  26241. $1=self._stream();
  26242. $ctx1.sendIdx["stream"]=1;
  26243. _st($1)._nextPutSequenceWith_((function(){
  26244. return smalltalk.withContext(function($ctx2) {
  26245. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  26246. return smalltalk.withContext(function($ctx3) {
  26247. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  26248. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  26249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26250. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)})},
  26251. args: ["anIRSequence"],
  26252. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  26253. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  26254. referencedClasses: []
  26255. }),
  26256. globals.IRJSTranslator);
  26257. smalltalk.addMethod(
  26258. smalltalk.method({
  26259. selector: "visitIRTempDeclaration:",
  26260. protocol: 'visiting',
  26261. fn: function (anIRTempDeclaration){
  26262. var self=this;
  26263. return self},
  26264. args: ["anIRTempDeclaration"],
  26265. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  26266. messageSends: [],
  26267. referencedClasses: []
  26268. }),
  26269. globals.IRJSTranslator);
  26270. smalltalk.addMethod(
  26271. smalltalk.method({
  26272. selector: "visitIRValue:",
  26273. protocol: 'visiting',
  26274. fn: function (anIRValue){
  26275. var self=this;
  26276. return smalltalk.withContext(function($ctx1) {
  26277. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  26278. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)})},
  26279. args: ["anIRValue"],
  26280. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  26281. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  26282. referencedClasses: []
  26283. }),
  26284. globals.IRJSTranslator);
  26285. smalltalk.addMethod(
  26286. smalltalk.method({
  26287. selector: "visitIRVariable:",
  26288. protocol: 'visiting',
  26289. fn: function (anIRVariable){
  26290. var self=this;
  26291. return smalltalk.withContext(function($ctx1) {
  26292. var $3,$2,$1,$4;
  26293. $3=_st(anIRVariable)._variable();
  26294. $ctx1.sendIdx["variable"]=1;
  26295. $2=_st($3)._name();
  26296. $1=_st($2).__eq("thisContext");
  26297. if(smalltalk.assert($1)){
  26298. $4=self._stream();
  26299. $ctx1.sendIdx["stream"]=1;
  26300. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  26301. $ctx1.sendIdx["nextPutAll:"]=1;
  26302. } else {
  26303. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  26304. };
  26305. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)})},
  26306. args: ["anIRVariable"],
  26307. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  26308. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
  26309. referencedClasses: []
  26310. }),
  26311. globals.IRJSTranslator);
  26312. smalltalk.addMethod(
  26313. smalltalk.method({
  26314. selector: "visitIRVerbatim:",
  26315. protocol: 'visiting',
  26316. fn: function (anIRVerbatim){
  26317. var self=this;
  26318. return smalltalk.withContext(function($ctx1) {
  26319. var $1;
  26320. $1=self._stream();
  26321. $ctx1.sendIdx["stream"]=1;
  26322. _st($1)._nextPutStatementWith_((function(){
  26323. return smalltalk.withContext(function($ctx2) {
  26324. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  26325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26326. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)})},
  26327. args: ["anIRVerbatim"],
  26328. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  26329. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  26330. referencedClasses: []
  26331. }),
  26332. globals.IRJSTranslator);
  26333. smalltalk.addMethod(
  26334. smalltalk.method({
  26335. selector: "visitReceiver:",
  26336. protocol: 'visiting',
  26337. fn: function (anIRInstruction){
  26338. var self=this;
  26339. return smalltalk.withContext(function($ctx1) {
  26340. var $1,$2,$3;
  26341. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  26342. if(! smalltalk.assert($1)){
  26343. $2=self._visit_(anIRInstruction);
  26344. $ctx1.sendIdx["visit:"]=1;
  26345. return $2;
  26346. };
  26347. $3=self._stream();
  26348. $ctx1.sendIdx["stream"]=1;
  26349. _st($3)._nextPutAll_("_st(");
  26350. $ctx1.sendIdx["nextPutAll:"]=1;
  26351. self._visit_(anIRInstruction);
  26352. _st(self._stream())._nextPutAll_(")");
  26353. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)})},
  26354. args: ["anIRInstruction"],
  26355. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  26356. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
  26357. referencedClasses: []
  26358. }),
  26359. globals.IRJSTranslator);
  26360. smalltalk.addMethod(
  26361. smalltalk.method({
  26362. selector: "visitSend:",
  26363. protocol: 'visiting',
  26364. fn: function (anIRSend){
  26365. var self=this;
  26366. return smalltalk.withContext(function($ctx1) {
  26367. var $2,$1,$3,$4,$5;
  26368. $2=_st(anIRSend)._instructions();
  26369. $ctx1.sendIdx["instructions"]=1;
  26370. $1=_st($2)._first();
  26371. self._visitReceiver_($1);
  26372. $3=self._stream();
  26373. $ctx1.sendIdx["stream"]=1;
  26374. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("(");
  26375. $ctx1.sendIdx[","]=1;
  26376. _st($3)._nextPutAll_($4);
  26377. $ctx1.sendIdx["nextPutAll:"]=1;
  26378. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  26379. return smalltalk.withContext(function($ctx2) {
  26380. return self._visit_(each);
  26381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26382. return smalltalk.withContext(function($ctx2) {
  26383. $5=self._stream();
  26384. $ctx2.sendIdx["stream"]=2;
  26385. return _st($5)._nextPutAll_(",");
  26386. $ctx2.sendIdx["nextPutAll:"]=2;
  26387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26388. _st(self._stream())._nextPutAll_(")");
  26389. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  26390. args: ["anIRSend"],
  26391. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asSelector, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  26392. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "visit:"],
  26393. referencedClasses: []
  26394. }),
  26395. globals.IRJSTranslator);
  26396. smalltalk.addMethod(
  26397. smalltalk.method({
  26398. selector: "visitSuperSend:",
  26399. protocol: 'visiting',
  26400. fn: function (anIRSend){
  26401. var self=this;
  26402. return smalltalk.withContext(function($ctx1) {
  26403. var $1,$2,$4,$3,$5,$6;
  26404. $1=self._stream();
  26405. $ctx1.sendIdx["stream"]=1;
  26406. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  26407. $ctx1.sendIdx["nextPutAll:"]=1;
  26408. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  26409. $ctx1.sendIdx["nextPutAll:"]=2;
  26410. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
  26411. $ctx1.sendIdx["nextPutAll:"]=3;
  26412. $2=_st($1)._nextPutAll_("_st(");
  26413. $ctx1.sendIdx["nextPutAll:"]=4;
  26414. $4=_st(anIRSend)._instructions();
  26415. $ctx1.sendIdx["instructions"]=1;
  26416. $3=_st($4)._first();
  26417. self._visit_($3);
  26418. $ctx1.sendIdx["visit:"]=1;
  26419. $5=self._stream();
  26420. $ctx1.sendIdx["stream"]=2;
  26421. _st($5)._nextPutAll_("), [");
  26422. $ctx1.sendIdx["nextPutAll:"]=5;
  26423. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  26424. return smalltalk.withContext(function($ctx2) {
  26425. return self._visit_(each);
  26426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26427. return smalltalk.withContext(function($ctx2) {
  26428. $6=self._stream();
  26429. $ctx2.sendIdx["stream"]=3;
  26430. return _st($6)._nextPutAll_(",");
  26431. $ctx2.sendIdx["nextPutAll:"]=6;
  26432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26433. _st(self._stream())._nextPutAll_("])");
  26434. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  26435. args: ["anIRSend"],
  26436. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  26437. messageSends: ["nextPutAll:", "stream", "asJavascript", "currentClass", ",", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"],
  26438. referencedClasses: []
  26439. }),
  26440. globals.IRJSTranslator);
  26441. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  26442. smalltalk.addMethod(
  26443. smalltalk.method({
  26444. selector: "contents",
  26445. protocol: 'accessing',
  26446. fn: function (){
  26447. var self=this;
  26448. return smalltalk.withContext(function($ctx1) {
  26449. var $1;
  26450. $1=_st(self["@stream"])._contents();
  26451. return $1;
  26452. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)})},
  26453. args: [],
  26454. source: "contents\x0a\x09^ stream contents",
  26455. messageSends: ["contents"],
  26456. referencedClasses: []
  26457. }),
  26458. globals.JSStream);
  26459. smalltalk.addMethod(
  26460. smalltalk.method({
  26461. selector: "initialize",
  26462. protocol: 'initialization',
  26463. fn: function (){
  26464. var self=this;
  26465. return smalltalk.withContext(function($ctx1) {
  26466. globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []);
  26467. self["@stream"]=""._writeStream();
  26468. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)})},
  26469. args: [],
  26470. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  26471. messageSends: ["initialize", "writeStream"],
  26472. referencedClasses: []
  26473. }),
  26474. globals.JSStream);
  26475. smalltalk.addMethod(
  26476. smalltalk.method({
  26477. selector: "lf",
  26478. protocol: 'streaming',
  26479. fn: function (){
  26480. var self=this;
  26481. return smalltalk.withContext(function($ctx1) {
  26482. _st(self["@stream"])._lf();
  26483. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)})},
  26484. args: [],
  26485. source: "lf\x0a\x09stream lf",
  26486. messageSends: ["lf"],
  26487. referencedClasses: []
  26488. }),
  26489. globals.JSStream);
  26490. smalltalk.addMethod(
  26491. smalltalk.method({
  26492. selector: "nextPut:",
  26493. protocol: 'streaming',
  26494. fn: function (aString){
  26495. var self=this;
  26496. return smalltalk.withContext(function($ctx1) {
  26497. _st(self["@stream"])._nextPut_(aString);
  26498. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)})},
  26499. args: ["aString"],
  26500. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  26501. messageSends: ["nextPut:"],
  26502. referencedClasses: []
  26503. }),
  26504. globals.JSStream);
  26505. smalltalk.addMethod(
  26506. smalltalk.method({
  26507. selector: "nextPutAll:",
  26508. protocol: 'streaming',
  26509. fn: function (aString){
  26510. var self=this;
  26511. return smalltalk.withContext(function($ctx1) {
  26512. _st(self["@stream"])._nextPutAll_(aString);
  26513. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)})},
  26514. args: ["aString"],
  26515. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  26516. messageSends: ["nextPutAll:"],
  26517. referencedClasses: []
  26518. }),
  26519. globals.JSStream);
  26520. smalltalk.addMethod(
  26521. smalltalk.method({
  26522. selector: "nextPutAssignment",
  26523. protocol: 'streaming',
  26524. fn: function (){
  26525. var self=this;
  26526. return smalltalk.withContext(function($ctx1) {
  26527. _st(self["@stream"])._nextPutAll_("=");
  26528. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)})},
  26529. args: [],
  26530. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  26531. messageSends: ["nextPutAll:"],
  26532. referencedClasses: []
  26533. }),
  26534. globals.JSStream);
  26535. smalltalk.addMethod(
  26536. smalltalk.method({
  26537. selector: "nextPutBlockContextFor:during:",
  26538. protocol: 'streaming',
  26539. fn: function (anIRClosure,aBlock){
  26540. var self=this;
  26541. return smalltalk.withContext(function($ctx1) {
  26542. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$24,$23,$22,$21,$20,$19,$18;
  26543. $1=_st(anIRClosure)._requiresSmalltalkContext();
  26544. if(! smalltalk.assert($1)){
  26545. $2=_st(aBlock)._value();
  26546. $ctx1.sendIdx["value"]=1;
  26547. return $2;
  26548. };
  26549. $6=_st(anIRClosure)._scope();
  26550. $ctx1.sendIdx["scope"]=1;
  26551. $5=_st($6)._alias();
  26552. $ctx1.sendIdx["alias"]=1;
  26553. $4="return smalltalk.withContext(function(".__comma($5);
  26554. $ctx1.sendIdx[","]=2;
  26555. $3=_st($4).__comma(") {");
  26556. $ctx1.sendIdx[","]=1;
  26557. self._nextPutAll_($3);
  26558. $ctx1.sendIdx["nextPutAll:"]=1;
  26559. $7=self._lf();
  26560. _st(aBlock)._value();
  26561. $11=_st(anIRClosure)._scope();
  26562. $ctx1.sendIdx["scope"]=2;
  26563. $10=_st($11)._alias();
  26564. $ctx1.sendIdx["alias"]=2;
  26565. $9="}, function(".__comma($10);
  26566. $ctx1.sendIdx[","]=4;
  26567. $8=_st($9).__comma(") {");
  26568. $ctx1.sendIdx[","]=3;
  26569. self._nextPutAll_($8);
  26570. $ctx1.sendIdx["nextPutAll:"]=2;
  26571. $15=_st(anIRClosure)._scope();
  26572. $ctx1.sendIdx["scope"]=3;
  26573. $14=_st($15)._alias();
  26574. $ctx1.sendIdx["alias"]=3;
  26575. $13=_st($14).__comma(".fillBlock({");
  26576. $ctx1.sendIdx[","]=5;
  26577. $12=self._nextPutAll_($13);
  26578. $ctx1.sendIdx["nextPutAll:"]=3;
  26579. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  26580. return smalltalk.withContext(function($ctx2) {
  26581. $16=_st(each)._asVariableName();
  26582. $ctx2.sendIdx["asVariableName"]=1;
  26583. self._nextPutAll_($16);
  26584. $ctx2.sendIdx["nextPutAll:"]=4;
  26585. self._nextPutAll_(":");
  26586. $ctx2.sendIdx["nextPutAll:"]=5;
  26587. $17=self._nextPutAll_(_st(each)._asVariableName());
  26588. $ctx2.sendIdx["nextPutAll:"]=6;
  26589. return $17;
  26590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  26591. return smalltalk.withContext(function($ctx2) {
  26592. return self._nextPutAll_(",");
  26593. $ctx2.sendIdx["nextPutAll:"]=7;
  26594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  26595. self._nextPutAll_("},");
  26596. $ctx1.sendIdx["nextPutAll:"]=8;
  26597. $24=_st(anIRClosure)._scope();
  26598. $ctx1.sendIdx["scope"]=4;
  26599. $23=_st($24)._outerScope();
  26600. $22=_st($23)._alias();
  26601. $21=_st($22).__comma(",");
  26602. $20=_st($21).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  26603. $ctx1.sendIdx[","]=7;
  26604. $19=_st($20).__comma(")})");
  26605. $ctx1.sendIdx[","]=6;
  26606. $18=self._nextPutAll_($19);
  26607. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)})},
  26608. args: ["anIRClosure", "aBlock"],
  26609. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\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, ')})'",
  26610. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
  26611. referencedClasses: []
  26612. }),
  26613. globals.JSStream);
  26614. smalltalk.addMethod(
  26615. smalltalk.method({
  26616. selector: "nextPutClassRefFunction:",
  26617. protocol: 'streaming',
  26618. fn: function (aString){
  26619. var self=this;
  26620. return smalltalk.withContext(function($ctx1) {
  26621. var $1,$2;
  26622. $1=self["@stream"];
  26623. _st($1)._nextPutAll_("function $");
  26624. $ctx1.sendIdx["nextPutAll:"]=1;
  26625. _st($1)._nextPutAll_(aString);
  26626. $ctx1.sendIdx["nextPutAll:"]=2;
  26627. _st($1)._nextPutAll_("(){return globals.");
  26628. $ctx1.sendIdx["nextPutAll:"]=3;
  26629. _st($1)._nextPutAll_(aString);
  26630. $ctx1.sendIdx["nextPutAll:"]=4;
  26631. _st($1)._nextPutAll_("||(typeof ");
  26632. $ctx1.sendIdx["nextPutAll:"]=5;
  26633. _st($1)._nextPutAll_(aString);
  26634. $ctx1.sendIdx["nextPutAll:"]=6;
  26635. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  26636. $ctx1.sendIdx["nextPutAll:"]=7;
  26637. _st($1)._nextPutAll_(aString);
  26638. $ctx1.sendIdx["nextPutAll:"]=8;
  26639. _st($1)._nextPutAll_(")}");
  26640. $2=_st($1)._lf();
  26641. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)})},
  26642. args: ["aString"],
  26643. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  26644. messageSends: ["nextPutAll:", "lf"],
  26645. referencedClasses: []
  26646. }),
  26647. globals.JSStream);
  26648. smalltalk.addMethod(
  26649. smalltalk.method({
  26650. selector: "nextPutClosureWith:arguments:",
  26651. protocol: 'streaming',
  26652. fn: function (aBlock,anArray){
  26653. var self=this;
  26654. return smalltalk.withContext(function($ctx1) {
  26655. var $1,$2;
  26656. _st(self["@stream"])._nextPutAll_("(function(");
  26657. $ctx1.sendIdx["nextPutAll:"]=1;
  26658. _st(anArray)._do_separatedBy_((function(each){
  26659. return smalltalk.withContext(function($ctx2) {
  26660. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  26661. $ctx2.sendIdx["nextPutAll:"]=2;
  26662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26663. return smalltalk.withContext(function($ctx2) {
  26664. return _st(self["@stream"])._nextPut_(",");
  26665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26666. $1=self["@stream"];
  26667. _st($1)._nextPutAll_("){");
  26668. $ctx1.sendIdx["nextPutAll:"]=3;
  26669. $2=_st($1)._lf();
  26670. _st(aBlock)._value();
  26671. _st(self["@stream"])._nextPutAll_("})");
  26672. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
  26673. args: ["aBlock", "anArray"],
  26674. 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 nextPutAll: '})'",
  26675. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  26676. referencedClasses: []
  26677. }),
  26678. globals.JSStream);
  26679. smalltalk.addMethod(
  26680. smalltalk.method({
  26681. selector: "nextPutContextFor:during:",
  26682. protocol: 'streaming',
  26683. fn: function (aMethod,aBlock){
  26684. var self=this;
  26685. return smalltalk.withContext(function($ctx1) {
  26686. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  26687. $1=_st(aMethod)._requiresSmalltalkContext();
  26688. if(! smalltalk.assert($1)){
  26689. $2=_st(aBlock)._value();
  26690. $ctx1.sendIdx["value"]=1;
  26691. return $2;
  26692. };
  26693. $6=_st(aMethod)._scope();
  26694. $ctx1.sendIdx["scope"]=1;
  26695. $5=_st($6)._alias();
  26696. $ctx1.sendIdx["alias"]=1;
  26697. $4="return smalltalk.withContext(function(".__comma($5);
  26698. $ctx1.sendIdx[","]=2;
  26699. $3=_st($4).__comma(") { ");
  26700. $ctx1.sendIdx[","]=1;
  26701. self._nextPutAll_($3);
  26702. $ctx1.sendIdx["nextPutAll:"]=1;
  26703. $7=self._lf();
  26704. _st(aBlock)._value();
  26705. $12=_st(aMethod)._scope();
  26706. $ctx1.sendIdx["scope"]=2;
  26707. $11=_st($12)._alias();
  26708. $ctx1.sendIdx["alias"]=2;
  26709. $10="}, function(".__comma($11);
  26710. $ctx1.sendIdx[","]=5;
  26711. $9=_st($10).__comma(") {");
  26712. $ctx1.sendIdx[","]=4;
  26713. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  26714. $ctx1.sendIdx[","]=3;
  26715. self._nextPutAll_($8);
  26716. $ctx1.sendIdx["nextPutAll:"]=2;
  26717. $16=_st(_st(aMethod)._selector())._asJavascript();
  26718. $ctx1.sendIdx["asJavascript"]=1;
  26719. $15=".fill(self,".__comma($16);
  26720. $14=_st($15).__comma(",{");
  26721. $ctx1.sendIdx[","]=6;
  26722. $13=self._nextPutAll_($14);
  26723. $ctx1.sendIdx["nextPutAll:"]=3;
  26724. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  26725. return smalltalk.withContext(function($ctx2) {
  26726. $17=_st(each)._asVariableName();
  26727. $ctx2.sendIdx["asVariableName"]=1;
  26728. self._nextPutAll_($17);
  26729. $ctx2.sendIdx["nextPutAll:"]=4;
  26730. self._nextPutAll_(":");
  26731. $ctx2.sendIdx["nextPutAll:"]=5;
  26732. $18=self._nextPutAll_(_st(each)._asVariableName());
  26733. $ctx2.sendIdx["nextPutAll:"]=6;
  26734. return $18;
  26735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  26736. return smalltalk.withContext(function($ctx2) {
  26737. return self._nextPutAll_(",");
  26738. $ctx2.sendIdx["nextPutAll:"]=7;
  26739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  26740. self._nextPutAll_("},");
  26741. $ctx1.sendIdx["nextPutAll:"]=8;
  26742. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  26743. $ctx1.sendIdx["nextPutAll:"]=9;
  26744. $19=self._nextPutAll_(")})");
  26745. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
  26746. args: ["aMethod", "aBlock"],
  26747. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\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: ')})'",
  26748. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
  26749. referencedClasses: []
  26750. }),
  26751. globals.JSStream);
  26752. smalltalk.addMethod(
  26753. smalltalk.method({
  26754. selector: "nextPutFunctionWith:arguments:",
  26755. protocol: 'streaming',
  26756. fn: function (aBlock,anArray){
  26757. var self=this;
  26758. return smalltalk.withContext(function($ctx1) {
  26759. var $1,$2,$3,$4;
  26760. _st(self["@stream"])._nextPutAll_("fn: function(");
  26761. $ctx1.sendIdx["nextPutAll:"]=1;
  26762. _st(anArray)._do_separatedBy_((function(each){
  26763. return smalltalk.withContext(function($ctx2) {
  26764. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  26765. $ctx2.sendIdx["nextPutAll:"]=2;
  26766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  26767. return smalltalk.withContext(function($ctx2) {
  26768. return _st(self["@stream"])._nextPut_(",");
  26769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26770. $1=self["@stream"];
  26771. _st($1)._nextPutAll_("){");
  26772. $ctx1.sendIdx["nextPutAll:"]=3;
  26773. $2=_st($1)._lf();
  26774. $ctx1.sendIdx["lf"]=1;
  26775. $3=self["@stream"];
  26776. _st($3)._nextPutAll_("var self=this;");
  26777. $ctx1.sendIdx["nextPutAll:"]=4;
  26778. $4=_st($3)._lf();
  26779. _st(aBlock)._value();
  26780. _st(self["@stream"])._nextPutAll_("}");
  26781. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
  26782. args: ["aBlock", "anArray"],
  26783. 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 nextPutAll: '}'",
  26784. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  26785. referencedClasses: []
  26786. }),
  26787. globals.JSStream);
  26788. smalltalk.addMethod(
  26789. smalltalk.method({
  26790. selector: "nextPutIf:with:",
  26791. protocol: 'streaming',
  26792. fn: function (aBlock,anotherBlock){
  26793. var self=this;
  26794. return smalltalk.withContext(function($ctx1) {
  26795. var $1,$2;
  26796. _st(self["@stream"])._nextPutAll_("if(");
  26797. $ctx1.sendIdx["nextPutAll:"]=1;
  26798. _st(aBlock)._value();
  26799. $ctx1.sendIdx["value"]=1;
  26800. $1=self["@stream"];
  26801. _st($1)._nextPutAll_("){");
  26802. $ctx1.sendIdx["nextPutAll:"]=2;
  26803. $2=_st($1)._lf();
  26804. _st(anotherBlock)._value();
  26805. _st(self["@stream"])._nextPutAll_("}");
  26806. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)})},
  26807. args: ["aBlock", "anotherBlock"],
  26808. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  26809. messageSends: ["nextPutAll:", "value", "lf"],
  26810. referencedClasses: []
  26811. }),
  26812. globals.JSStream);
  26813. smalltalk.addMethod(
  26814. smalltalk.method({
  26815. selector: "nextPutIfElse:with:with:",
  26816. protocol: 'streaming',
  26817. fn: function (aBlock,ifBlock,elseBlock){
  26818. var self=this;
  26819. return smalltalk.withContext(function($ctx1) {
  26820. var $1,$2,$3,$4;
  26821. _st(self["@stream"])._nextPutAll_("if(");
  26822. $ctx1.sendIdx["nextPutAll:"]=1;
  26823. _st(aBlock)._value();
  26824. $ctx1.sendIdx["value"]=1;
  26825. $1=self["@stream"];
  26826. _st($1)._nextPutAll_("){");
  26827. $ctx1.sendIdx["nextPutAll:"]=2;
  26828. $2=_st($1)._lf();
  26829. $ctx1.sendIdx["lf"]=1;
  26830. _st(ifBlock)._value();
  26831. $ctx1.sendIdx["value"]=2;
  26832. $3=self["@stream"];
  26833. _st($3)._nextPutAll_("} else {");
  26834. $ctx1.sendIdx["nextPutAll:"]=3;
  26835. $4=_st($3)._lf();
  26836. _st(elseBlock)._value();
  26837. _st(self["@stream"])._nextPutAll_("}");
  26838. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)})},
  26839. args: ["aBlock", "ifBlock", "elseBlock"],
  26840. source: "nextPutIfElse: aBlock with: ifBlock with: 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: '}'",
  26841. messageSends: ["nextPutAll:", "value", "lf"],
  26842. referencedClasses: []
  26843. }),
  26844. globals.JSStream);
  26845. smalltalk.addMethod(
  26846. smalltalk.method({
  26847. selector: "nextPutMethodDeclaration:with:",
  26848. protocol: 'streaming',
  26849. fn: function (aMethod,aBlock){
  26850. var self=this;
  26851. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  26852. return smalltalk.withContext(function($ctx1) {
  26853. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  26854. $1=self["@stream"];
  26855. _st($1)._nextPutAll_("smalltalk.method({");
  26856. $ctx1.sendIdx["nextPutAll:"]=1;
  26857. _st($1)._lf();
  26858. $ctx1.sendIdx["lf"]=1;
  26859. $2=$1;
  26860. $5=_st(_st(aMethod)._selector())._asJavascript();
  26861. $ctx1.sendIdx["asJavascript"]=1;
  26862. $4="selector: ".__comma($5);
  26863. $ctx1.sendIdx[","]=2;
  26864. $3=_st($4).__comma(",");
  26865. $ctx1.sendIdx[","]=1;
  26866. _st($2)._nextPutAll_($3);
  26867. $ctx1.sendIdx["nextPutAll:"]=2;
  26868. _st($1)._lf();
  26869. $ctx1.sendIdx["lf"]=2;
  26870. $6=$1;
  26871. $9=_st(_st(aMethod)._source())._asJavascript();
  26872. $ctx1.sendIdx["asJavascript"]=2;
  26873. $8="source: ".__comma($9);
  26874. $ctx1.sendIdx[","]=4;
  26875. $7=_st($8).__comma(",");
  26876. $ctx1.sendIdx[","]=3;
  26877. _st($6)._nextPutAll_($7);
  26878. $ctx1.sendIdx["nextPutAll:"]=3;
  26879. $10=_st($1)._lf();
  26880. $ctx1.sendIdx["lf"]=3;
  26881. _st(aBlock)._value();
  26882. $ctx1.sendIdx["value"]=1;
  26883. $11=self["@stream"];
  26884. $12=$11;
  26885. $15=_st($String())._lf();
  26886. $ctx1.sendIdx["lf"]=4;
  26887. $14=",".__comma($15);
  26888. $ctx1.sendIdx[","]=6;
  26889. $13=_st($14).__comma("messageSends: ");
  26890. $ctx1.sendIdx[","]=5;
  26891. _st($12)._nextPutAll_($13);
  26892. $ctx1.sendIdx["nextPutAll:"]=4;
  26893. $16=$11;
  26894. $19=_st(_st(aMethod)._messageSends())._asArray();
  26895. $ctx1.sendIdx["asArray"]=1;
  26896. $18=_st($19)._asJavascript();
  26897. $ctx1.sendIdx["asJavascript"]=3;
  26898. $17=_st($18).__comma(",");
  26899. $ctx1.sendIdx[","]=7;
  26900. _st($16)._nextPutAll_($17);
  26901. $ctx1.sendIdx["nextPutAll:"]=5;
  26902. _st($11)._lf();
  26903. $ctx1.sendIdx["lf"]=5;
  26904. $20=$11;
  26905. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  26906. return smalltalk.withContext(function($ctx2) {
  26907. return _st(each)._value();
  26908. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asArray())._asJavascript();
  26909. $ctx1.sendIdx["asJavascript"]=4;
  26910. $22="args: ".__comma($23);
  26911. $21=_st($22).__comma(",");
  26912. $ctx1.sendIdx[","]=8;
  26913. _st($20)._nextPutAll_($21);
  26914. $ctx1.sendIdx["nextPutAll:"]=6;
  26915. _st($11)._lf();
  26916. $24=_st($11)._nextPutAll_("referencedClasses: [");
  26917. $ctx1.sendIdx["nextPutAll:"]=7;
  26918. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  26919. return smalltalk.withContext(function($ctx2) {
  26920. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  26921. $ctx2.sendIdx["nextPutAll:"]=8;
  26922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  26923. return smalltalk.withContext(function($ctx2) {
  26924. return _st(self["@stream"])._nextPutAll_(",");
  26925. $ctx2.sendIdx["nextPutAll:"]=9;
  26926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  26927. $25=self["@stream"];
  26928. _st($25)._nextPutAll_("]");
  26929. $ctx1.sendIdx["nextPutAll:"]=10;
  26930. $26=_st($25)._nextPutAll_("})");
  26931. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
  26932. args: ["aMethod", "aBlock"],
  26933. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.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: '})'",
  26934. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  26935. referencedClasses: ["String"]
  26936. }),
  26937. globals.JSStream);
  26938. smalltalk.addMethod(
  26939. smalltalk.method({
  26940. selector: "nextPutNonLocalReturnHandlingWith:",
  26941. protocol: 'streaming',
  26942. fn: function (aBlock){
  26943. var self=this;
  26944. return smalltalk.withContext(function($ctx1) {
  26945. var $1,$2,$3,$4;
  26946. $1=self["@stream"];
  26947. _st($1)._nextPutAll_("var $early={};");
  26948. $ctx1.sendIdx["nextPutAll:"]=1;
  26949. _st($1)._lf();
  26950. $ctx1.sendIdx["lf"]=1;
  26951. _st($1)._nextPutAll_("try {");
  26952. $ctx1.sendIdx["nextPutAll:"]=2;
  26953. $2=_st($1)._lf();
  26954. $ctx1.sendIdx["lf"]=2;
  26955. _st(aBlock)._value();
  26956. $3=self["@stream"];
  26957. _st($3)._nextPutAll_("}");
  26958. $ctx1.sendIdx["nextPutAll:"]=3;
  26959. _st($3)._lf();
  26960. $ctx1.sendIdx["lf"]=3;
  26961. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  26962. $4=_st($3)._lf();
  26963. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)})},
  26964. args: ["aBlock"],
  26965. 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",
  26966. messageSends: ["nextPutAll:", "lf", "value"],
  26967. referencedClasses: []
  26968. }),
  26969. globals.JSStream);
  26970. smalltalk.addMethod(
  26971. smalltalk.method({
  26972. selector: "nextPutNonLocalReturnWith:",
  26973. protocol: 'streaming',
  26974. fn: function (aBlock){
  26975. var self=this;
  26976. return smalltalk.withContext(function($ctx1) {
  26977. _st(self["@stream"])._nextPutAll_("throw $early=[");
  26978. $ctx1.sendIdx["nextPutAll:"]=1;
  26979. _st(aBlock)._value();
  26980. _st(self["@stream"])._nextPutAll_("]");
  26981. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  26982. args: ["aBlock"],
  26983. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  26984. messageSends: ["nextPutAll:", "value"],
  26985. referencedClasses: []
  26986. }),
  26987. globals.JSStream);
  26988. smalltalk.addMethod(
  26989. smalltalk.method({
  26990. selector: "nextPutReturn",
  26991. protocol: 'streaming',
  26992. fn: function (){
  26993. var self=this;
  26994. return smalltalk.withContext(function($ctx1) {
  26995. _st(self["@stream"])._nextPutAll_("return ");
  26996. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)})},
  26997. args: [],
  26998. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  26999. messageSends: ["nextPutAll:"],
  27000. referencedClasses: []
  27001. }),
  27002. globals.JSStream);
  27003. smalltalk.addMethod(
  27004. smalltalk.method({
  27005. selector: "nextPutReturnWith:",
  27006. protocol: 'streaming',
  27007. fn: function (aBlock){
  27008. var self=this;
  27009. return smalltalk.withContext(function($ctx1) {
  27010. self._nextPutReturn();
  27011. _st(aBlock)._value();
  27012. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  27013. args: ["aBlock"],
  27014. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  27015. messageSends: ["nextPutReturn", "value"],
  27016. referencedClasses: []
  27017. }),
  27018. globals.JSStream);
  27019. smalltalk.addMethod(
  27020. smalltalk.method({
  27021. selector: "nextPutSendIndexFor:",
  27022. protocol: 'streaming',
  27023. fn: function (anIRSend){
  27024. var self=this;
  27025. return smalltalk.withContext(function($ctx1) {
  27026. var $1;
  27027. self._nextPutAll_(";");
  27028. $ctx1.sendIdx["nextPutAll:"]=1;
  27029. self._lf();
  27030. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  27031. $ctx1.sendIdx["nextPutAll:"]=2;
  27032. self._nextPutAll_(".sendIdx[");
  27033. $ctx1.sendIdx["nextPutAll:"]=3;
  27034. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  27035. $ctx1.sendIdx["nextPutAll:"]=4;
  27036. self._nextPutAll_("]=");
  27037. $ctx1.sendIdx["nextPutAll:"]=5;
  27038. $1=self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  27039. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)})},
  27040. args: ["anIRSend"],
  27041. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; 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",
  27042. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"],
  27043. referencedClasses: []
  27044. }),
  27045. globals.JSStream);
  27046. smalltalk.addMethod(
  27047. smalltalk.method({
  27048. selector: "nextPutSequenceWith:",
  27049. protocol: 'streaming',
  27050. fn: function (aBlock){
  27051. var self=this;
  27052. return smalltalk.withContext(function($ctx1) {
  27053. _st(aBlock)._value();
  27054. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)})},
  27055. args: ["aBlock"],
  27056. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  27057. messageSends: ["value"],
  27058. referencedClasses: []
  27059. }),
  27060. globals.JSStream);
  27061. smalltalk.addMethod(
  27062. smalltalk.method({
  27063. selector: "nextPutStatementWith:",
  27064. protocol: 'streaming',
  27065. fn: function (aBlock){
  27066. var self=this;
  27067. return smalltalk.withContext(function($ctx1) {
  27068. var $1,$2;
  27069. _st(aBlock)._value();
  27070. $1=self["@stream"];
  27071. _st($1)._nextPutAll_(";");
  27072. $2=_st($1)._lf();
  27073. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)})},
  27074. args: ["aBlock"],
  27075. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  27076. messageSends: ["value", "nextPutAll:", "lf"],
  27077. referencedClasses: []
  27078. }),
  27079. globals.JSStream);
  27080. smalltalk.addMethod(
  27081. smalltalk.method({
  27082. selector: "nextPutVars:",
  27083. protocol: 'streaming',
  27084. fn: function (aCollection){
  27085. var self=this;
  27086. return smalltalk.withContext(function($ctx1) {
  27087. var $1,$2;
  27088. var $early={};
  27089. try {
  27090. _st(aCollection)._ifEmpty_((function(){
  27091. throw $early=[self];
  27092. }));
  27093. _st(self["@stream"])._nextPutAll_("var ");
  27094. $ctx1.sendIdx["nextPutAll:"]=1;
  27095. _st(aCollection)._do_separatedBy_((function(each){
  27096. return smalltalk.withContext(function($ctx2) {
  27097. return _st(self["@stream"])._nextPutAll_(each);
  27098. $ctx2.sendIdx["nextPutAll:"]=2;
  27099. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  27100. return smalltalk.withContext(function($ctx2) {
  27101. return _st(self["@stream"])._nextPutAll_(",");
  27102. $ctx2.sendIdx["nextPutAll:"]=3;
  27103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  27104. $1=self["@stream"];
  27105. _st($1)._nextPutAll_(";");
  27106. $2=_st($1)._lf();
  27107. return self}
  27108. catch(e) {if(e===$early)return e[0]; throw e}
  27109. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)})},
  27110. args: ["aCollection"],
  27111. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  27112. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  27113. referencedClasses: []
  27114. }),
  27115. globals.JSStream);
  27116. smalltalk.addMethod(
  27117. smalltalk.method({
  27118. selector: "appendToInstruction:",
  27119. protocol: '*Compiler-IR',
  27120. fn: function (anIRInstruction){
  27121. var self=this;
  27122. return smalltalk.withContext(function($ctx1) {
  27123. _st(anIRInstruction)._appendBlock_(self);
  27124. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)})},
  27125. args: ["anIRInstruction"],
  27126. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  27127. messageSends: ["appendBlock:"],
  27128. referencedClasses: []
  27129. }),
  27130. globals.BlockClosure);
  27131. });
  27132. define("amber_core/Compiler-Inlining", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function(smalltalk,nil,_st, globals){
  27133. smalltalk.addPackage('Compiler-Inlining');
  27134. smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27135. smalltalk.addClass('IRInlinedAssignment', globals.IRAssignment, [], 'Compiler-Inlining');
  27136. globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  27137. smalltalk.addMethod(
  27138. smalltalk.method({
  27139. selector: "accept:",
  27140. protocol: 'visiting',
  27141. fn: function (aVisitor){
  27142. var self=this;
  27143. return smalltalk.withContext(function($ctx1) {
  27144. var $1;
  27145. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  27146. return $1;
  27147. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)})},
  27148. args: ["aVisitor"],
  27149. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  27150. messageSends: ["visitIRInlinedAssignment:"],
  27151. referencedClasses: []
  27152. }),
  27153. globals.IRInlinedAssignment);
  27154. smalltalk.addMethod(
  27155. smalltalk.method({
  27156. selector: "isInlined",
  27157. protocol: 'testing',
  27158. fn: function (){
  27159. var self=this;
  27160. return true;
  27161. },
  27162. args: [],
  27163. source: "isInlined\x0a\x09^ true",
  27164. messageSends: [],
  27165. referencedClasses: []
  27166. }),
  27167. globals.IRInlinedAssignment);
  27168. smalltalk.addClass('IRInlinedClosure', globals.IRClosure, [], 'Compiler-Inlining');
  27169. globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  27170. smalltalk.addMethod(
  27171. smalltalk.method({
  27172. selector: "accept:",
  27173. protocol: 'visiting',
  27174. fn: function (aVisitor){
  27175. var self=this;
  27176. return smalltalk.withContext(function($ctx1) {
  27177. _st(aVisitor)._visitIRInlinedClosure_(self);
  27178. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)})},
  27179. args: ["aVisitor"],
  27180. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  27181. messageSends: ["visitIRInlinedClosure:"],
  27182. referencedClasses: []
  27183. }),
  27184. globals.IRInlinedClosure);
  27185. smalltalk.addMethod(
  27186. smalltalk.method({
  27187. selector: "isInlined",
  27188. protocol: 'testing',
  27189. fn: function (){
  27190. var self=this;
  27191. return true;
  27192. },
  27193. args: [],
  27194. source: "isInlined\x0a\x09^ true",
  27195. messageSends: [],
  27196. referencedClasses: []
  27197. }),
  27198. globals.IRInlinedClosure);
  27199. smalltalk.addClass('IRInlinedReturn', globals.IRReturn, [], 'Compiler-Inlining');
  27200. globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  27201. smalltalk.addMethod(
  27202. smalltalk.method({
  27203. selector: "accept:",
  27204. protocol: 'visiting',
  27205. fn: function (aVisitor){
  27206. var self=this;
  27207. return smalltalk.withContext(function($ctx1) {
  27208. var $1;
  27209. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  27210. return $1;
  27211. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)})},
  27212. args: ["aVisitor"],
  27213. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  27214. messageSends: ["visitIRInlinedReturn:"],
  27215. referencedClasses: []
  27216. }),
  27217. globals.IRInlinedReturn);
  27218. smalltalk.addMethod(
  27219. smalltalk.method({
  27220. selector: "isInlined",
  27221. protocol: 'testing',
  27222. fn: function (){
  27223. var self=this;
  27224. return true;
  27225. },
  27226. args: [],
  27227. source: "isInlined\x0a\x09^ true",
  27228. messageSends: [],
  27229. referencedClasses: []
  27230. }),
  27231. globals.IRInlinedReturn);
  27232. smalltalk.addClass('IRInlinedSend', globals.IRSend, [], 'Compiler-Inlining');
  27233. globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  27234. smalltalk.addMethod(
  27235. smalltalk.method({
  27236. selector: "accept:",
  27237. protocol: 'visiting',
  27238. fn: function (aVisitor){
  27239. var self=this;
  27240. return smalltalk.withContext(function($ctx1) {
  27241. _st(aVisitor)._visitInlinedSend_(self);
  27242. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)})},
  27243. args: ["aVisitor"],
  27244. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  27245. messageSends: ["visitInlinedSend:"],
  27246. referencedClasses: []
  27247. }),
  27248. globals.IRInlinedSend);
  27249. smalltalk.addMethod(
  27250. smalltalk.method({
  27251. selector: "isInlined",
  27252. protocol: 'testing',
  27253. fn: function (){
  27254. var self=this;
  27255. return true;
  27256. },
  27257. args: [],
  27258. source: "isInlined\x0a\x09^ true",
  27259. messageSends: [],
  27260. referencedClasses: []
  27261. }),
  27262. globals.IRInlinedSend);
  27263. smalltalk.addClass('IRInlinedIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  27264. globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  27265. smalltalk.addMethod(
  27266. smalltalk.method({
  27267. selector: "accept:",
  27268. protocol: 'visiting',
  27269. fn: function (aVisitor){
  27270. var self=this;
  27271. return smalltalk.withContext(function($ctx1) {
  27272. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  27273. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)})},
  27274. args: ["aVisitor"],
  27275. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  27276. messageSends: ["visitIRInlinedIfFalse:"],
  27277. referencedClasses: []
  27278. }),
  27279. globals.IRInlinedIfFalse);
  27280. smalltalk.addClass('IRInlinedIfNilIfNotNil', globals.IRInlinedSend, [], 'Compiler-Inlining');
  27281. globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  27282. smalltalk.addMethod(
  27283. smalltalk.method({
  27284. selector: "accept:",
  27285. protocol: 'visiting',
  27286. fn: function (aVisitor){
  27287. var self=this;
  27288. return smalltalk.withContext(function($ctx1) {
  27289. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  27290. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)})},
  27291. args: ["aVisitor"],
  27292. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  27293. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  27294. referencedClasses: []
  27295. }),
  27296. globals.IRInlinedIfNilIfNotNil);
  27297. smalltalk.addClass('IRInlinedIfTrue', globals.IRInlinedSend, [], 'Compiler-Inlining');
  27298. globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  27299. smalltalk.addMethod(
  27300. smalltalk.method({
  27301. selector: "accept:",
  27302. protocol: 'visiting',
  27303. fn: function (aVisitor){
  27304. var self=this;
  27305. return smalltalk.withContext(function($ctx1) {
  27306. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  27307. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)})},
  27308. args: ["aVisitor"],
  27309. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  27310. messageSends: ["visitIRInlinedIfTrue:"],
  27311. referencedClasses: []
  27312. }),
  27313. globals.IRInlinedIfTrue);
  27314. smalltalk.addClass('IRInlinedIfTrueIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  27315. globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  27316. smalltalk.addMethod(
  27317. smalltalk.method({
  27318. selector: "accept:",
  27319. protocol: 'visiting',
  27320. fn: function (aVisitor){
  27321. var self=this;
  27322. return smalltalk.withContext(function($ctx1) {
  27323. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  27324. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)})},
  27325. args: ["aVisitor"],
  27326. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  27327. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  27328. referencedClasses: []
  27329. }),
  27330. globals.IRInlinedIfTrueIfFalse);
  27331. smalltalk.addClass('IRInlinedSequence', globals.IRBlockSequence, [], 'Compiler-Inlining');
  27332. globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  27333. smalltalk.addMethod(
  27334. smalltalk.method({
  27335. selector: "accept:",
  27336. protocol: 'visiting',
  27337. fn: function (aVisitor){
  27338. var self=this;
  27339. return smalltalk.withContext(function($ctx1) {
  27340. _st(aVisitor)._visitIRInlinedSequence_(self);
  27341. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)})},
  27342. args: ["aVisitor"],
  27343. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  27344. messageSends: ["visitIRInlinedSequence:"],
  27345. referencedClasses: []
  27346. }),
  27347. globals.IRInlinedSequence);
  27348. smalltalk.addMethod(
  27349. smalltalk.method({
  27350. selector: "isInlined",
  27351. protocol: 'testing',
  27352. fn: function (){
  27353. var self=this;
  27354. return true;
  27355. },
  27356. args: [],
  27357. source: "isInlined\x0a\x09^ true",
  27358. messageSends: [],
  27359. referencedClasses: []
  27360. }),
  27361. globals.IRInlinedSequence);
  27362. smalltalk.addClass('IRInliner', globals.IRVisitor, [], 'Compiler-Inlining');
  27363. 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`";
  27364. smalltalk.addMethod(
  27365. smalltalk.method({
  27366. selector: "assignmentInliner",
  27367. protocol: 'factory',
  27368. fn: function (){
  27369. var self=this;
  27370. function $IRAssignmentInliner(){return globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  27371. return smalltalk.withContext(function($ctx1) {
  27372. var $2,$3,$1;
  27373. $2=_st($IRAssignmentInliner())._new();
  27374. _st($2)._translator_(self);
  27375. $3=_st($2)._yourself();
  27376. $1=$3;
  27377. return $1;
  27378. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)})},
  27379. args: [],
  27380. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  27381. messageSends: ["translator:", "new", "yourself"],
  27382. referencedClasses: ["IRAssignmentInliner"]
  27383. }),
  27384. globals.IRInliner);
  27385. smalltalk.addMethod(
  27386. smalltalk.method({
  27387. selector: "returnInliner",
  27388. protocol: 'factory',
  27389. fn: function (){
  27390. var self=this;
  27391. function $IRReturnInliner(){return globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  27392. return smalltalk.withContext(function($ctx1) {
  27393. var $2,$3,$1;
  27394. $2=_st($IRReturnInliner())._new();
  27395. _st($2)._translator_(self);
  27396. $3=_st($2)._yourself();
  27397. $1=$3;
  27398. return $1;
  27399. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)})},
  27400. args: [],
  27401. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  27402. messageSends: ["translator:", "new", "yourself"],
  27403. referencedClasses: ["IRReturnInliner"]
  27404. }),
  27405. globals.IRInliner);
  27406. smalltalk.addMethod(
  27407. smalltalk.method({
  27408. selector: "sendInliner",
  27409. protocol: 'factory',
  27410. fn: function (){
  27411. var self=this;
  27412. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  27413. return smalltalk.withContext(function($ctx1) {
  27414. var $2,$3,$1;
  27415. $2=_st($IRSendInliner())._new();
  27416. _st($2)._translator_(self);
  27417. $3=_st($2)._yourself();
  27418. $1=$3;
  27419. return $1;
  27420. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)})},
  27421. args: [],
  27422. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  27423. messageSends: ["translator:", "new", "yourself"],
  27424. referencedClasses: ["IRSendInliner"]
  27425. }),
  27426. globals.IRInliner);
  27427. smalltalk.addMethod(
  27428. smalltalk.method({
  27429. selector: "shouldInlineAssignment:",
  27430. protocol: 'testing',
  27431. fn: function (anIRAssignment){
  27432. var self=this;
  27433. return smalltalk.withContext(function($ctx1) {
  27434. var $4,$3,$2,$1;
  27435. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  27436. return smalltalk.withContext(function($ctx2) {
  27437. $4=_st(anIRAssignment)._instructions();
  27438. $ctx2.sendIdx["instructions"]=1;
  27439. $3=_st($4)._last();
  27440. $ctx2.sendIdx["last"]=1;
  27441. $2=_st($3)._isSend();
  27442. return _st($2)._and_((function(){
  27443. return smalltalk.withContext(function($ctx3) {
  27444. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  27445. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  27446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27447. $ctx1.sendIdx["and:"]=1;
  27448. return $1;
  27449. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
  27450. args: ["anIRAssignment"],
  27451. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  27452. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"],
  27453. referencedClasses: []
  27454. }),
  27455. globals.IRInliner);
  27456. smalltalk.addMethod(
  27457. smalltalk.method({
  27458. selector: "shouldInlineReturn:",
  27459. protocol: 'testing',
  27460. fn: function (anIRReturn){
  27461. var self=this;
  27462. return smalltalk.withContext(function($ctx1) {
  27463. var $4,$3,$2,$1;
  27464. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  27465. return smalltalk.withContext(function($ctx2) {
  27466. $4=_st(anIRReturn)._instructions();
  27467. $ctx2.sendIdx["instructions"]=1;
  27468. $3=_st($4)._first();
  27469. $ctx2.sendIdx["first"]=1;
  27470. $2=_st($3)._isSend();
  27471. return _st($2)._and_((function(){
  27472. return smalltalk.withContext(function($ctx3) {
  27473. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  27474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  27475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27476. $ctx1.sendIdx["and:"]=1;
  27477. return $1;
  27478. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
  27479. args: ["anIRReturn"],
  27480. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  27481. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"],
  27482. referencedClasses: []
  27483. }),
  27484. globals.IRInliner);
  27485. smalltalk.addMethod(
  27486. smalltalk.method({
  27487. selector: "shouldInlineSend:",
  27488. protocol: 'testing',
  27489. fn: function (anIRSend){
  27490. var self=this;
  27491. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  27492. return smalltalk.withContext(function($ctx1) {
  27493. var $1;
  27494. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  27495. return smalltalk.withContext(function($ctx2) {
  27496. return _st($IRSendInliner())._shouldInline_(anIRSend);
  27497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27498. return $1;
  27499. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)})},
  27500. args: ["anIRSend"],
  27501. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  27502. messageSends: ["and:", "not", "isInlined", "shouldInline:"],
  27503. referencedClasses: ["IRSendInliner"]
  27504. }),
  27505. globals.IRInliner);
  27506. smalltalk.addMethod(
  27507. smalltalk.method({
  27508. selector: "transformNonLocalReturn:",
  27509. protocol: 'visiting',
  27510. fn: function (anIRNonLocalReturn){
  27511. var self=this;
  27512. var localReturn;
  27513. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  27514. return smalltalk.withContext(function($ctx1) {
  27515. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  27516. $2=_st(anIRNonLocalReturn)._scope();
  27517. $ctx1.sendIdx["scope"]=1;
  27518. $1=_st($2)._canInlineNonLocalReturns();
  27519. if(smalltalk.assert($1)){
  27520. $4=_st(anIRNonLocalReturn)._scope();
  27521. $ctx1.sendIdx["scope"]=2;
  27522. $3=_st($4)._methodScope();
  27523. $5=_st(anIRNonLocalReturn)._scope();
  27524. $ctx1.sendIdx["scope"]=3;
  27525. _st($3)._removeNonLocalReturn_($5);
  27526. $6=_st($IRReturn())._new();
  27527. _st($6)._scope_(_st(anIRNonLocalReturn)._scope());
  27528. $7=_st($6)._yourself();
  27529. localReturn=$7;
  27530. localReturn;
  27531. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  27532. return smalltalk.withContext(function($ctx2) {
  27533. return _st(localReturn)._add_(each);
  27534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  27535. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  27536. $8=localReturn;
  27537. return $8;
  27538. };
  27539. $9=globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  27540. return $9;
  27541. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)})},
  27542. args: ["anIRNonLocalReturn"],
  27543. 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",
  27544. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"],
  27545. referencedClasses: ["IRReturn"]
  27546. }),
  27547. globals.IRInliner);
  27548. smalltalk.addMethod(
  27549. smalltalk.method({
  27550. selector: "visitIRAssignment:",
  27551. protocol: 'visiting',
  27552. fn: function (anIRAssignment){
  27553. var self=this;
  27554. return smalltalk.withContext(function($ctx1) {
  27555. var $2,$1;
  27556. $2=self._shouldInlineAssignment_(anIRAssignment);
  27557. if(smalltalk.assert($2)){
  27558. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  27559. } else {
  27560. $1=globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]);
  27561. };
  27562. return $1;
  27563. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
  27564. args: ["anIRAssignment"],
  27565. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  27566. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"],
  27567. referencedClasses: []
  27568. }),
  27569. globals.IRInliner);
  27570. smalltalk.addMethod(
  27571. smalltalk.method({
  27572. selector: "visitIRNonLocalReturn:",
  27573. protocol: 'visiting',
  27574. fn: function (anIRNonLocalReturn){
  27575. var self=this;
  27576. return smalltalk.withContext(function($ctx1) {
  27577. var $1;
  27578. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  27579. return $1;
  27580. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)})},
  27581. args: ["anIRNonLocalReturn"],
  27582. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  27583. messageSends: ["transformNonLocalReturn:"],
  27584. referencedClasses: []
  27585. }),
  27586. globals.IRInliner);
  27587. smalltalk.addMethod(
  27588. smalltalk.method({
  27589. selector: "visitIRReturn:",
  27590. protocol: 'visiting',
  27591. fn: function (anIRReturn){
  27592. var self=this;
  27593. return smalltalk.withContext(function($ctx1) {
  27594. var $2,$1;
  27595. $2=self._shouldInlineReturn_(anIRReturn);
  27596. if(smalltalk.assert($2)){
  27597. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  27598. } else {
  27599. $1=globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  27600. };
  27601. return $1;
  27602. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
  27603. args: ["anIRReturn"],
  27604. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  27605. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"],
  27606. referencedClasses: []
  27607. }),
  27608. globals.IRInliner);
  27609. smalltalk.addMethod(
  27610. smalltalk.method({
  27611. selector: "visitIRSend:",
  27612. protocol: 'visiting',
  27613. fn: function (anIRSend){
  27614. var self=this;
  27615. return smalltalk.withContext(function($ctx1) {
  27616. var $2,$1;
  27617. $2=self._shouldInlineSend_(anIRSend);
  27618. if(smalltalk.assert($2)){
  27619. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  27620. } else {
  27621. $1=globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]);
  27622. };
  27623. return $1;
  27624. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)})},
  27625. args: ["anIRSend"],
  27626. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  27627. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"],
  27628. referencedClasses: []
  27629. }),
  27630. globals.IRInliner);
  27631. smalltalk.addClass('IRInliningJSTranslator', globals.IRJSTranslator, [], 'Compiler-Inlining');
  27632. globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  27633. smalltalk.addMethod(
  27634. smalltalk.method({
  27635. selector: "visitIRInlinedAssignment:",
  27636. protocol: 'visiting',
  27637. fn: function (anIRInlinedAssignment){
  27638. var self=this;
  27639. return smalltalk.withContext(function($ctx1) {
  27640. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  27641. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)})},
  27642. args: ["anIRInlinedAssignment"],
  27643. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  27644. messageSends: ["visit:", "last", "instructions"],
  27645. referencedClasses: []
  27646. }),
  27647. globals.IRInliningJSTranslator);
  27648. smalltalk.addMethod(
  27649. smalltalk.method({
  27650. selector: "visitIRInlinedClosure:",
  27651. protocol: 'visiting',
  27652. fn: function (anIRInlinedClosure){
  27653. var self=this;
  27654. return smalltalk.withContext(function($ctx1) {
  27655. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  27656. return smalltalk.withContext(function($ctx2) {
  27657. return _st(_st(each)._name())._asVariableName();
  27658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  27659. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  27660. return smalltalk.withContext(function($ctx2) {
  27661. return self._visit_(each);
  27662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  27663. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)})},
  27664. args: ["anIRInlinedClosure"],
  27665. 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 ]",
  27666. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"],
  27667. referencedClasses: []
  27668. }),
  27669. globals.IRInliningJSTranslator);
  27670. smalltalk.addMethod(
  27671. smalltalk.method({
  27672. selector: "visitIRInlinedIfFalse:",
  27673. protocol: 'visiting',
  27674. fn: function (anIRInlinedIfFalse){
  27675. var self=this;
  27676. return smalltalk.withContext(function($ctx1) {
  27677. var $1,$2,$4,$3;
  27678. $1=self._stream();
  27679. $ctx1.sendIdx["stream"]=1;
  27680. _st($1)._nextPutIf_with_((function(){
  27681. return smalltalk.withContext(function($ctx2) {
  27682. $2=self._stream();
  27683. $ctx2.sendIdx["stream"]=2;
  27684. _st($2)._nextPutAll_("! smalltalk.assert(");
  27685. $ctx2.sendIdx["nextPutAll:"]=1;
  27686. $4=_st(anIRInlinedIfFalse)._instructions();
  27687. $ctx2.sendIdx["instructions"]=1;
  27688. $3=_st($4)._first();
  27689. self._visit_($3);
  27690. $ctx2.sendIdx["visit:"]=1;
  27691. return _st(self._stream())._nextPutAll_(")");
  27692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  27693. return smalltalk.withContext(function($ctx2) {
  27694. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  27695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27696. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)})},
  27697. args: ["anIRInlinedIfFalse"],
  27698. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  27699. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  27700. referencedClasses: []
  27701. }),
  27702. globals.IRInliningJSTranslator);
  27703. smalltalk.addMethod(
  27704. smalltalk.method({
  27705. selector: "visitIRInlinedIfNil:",
  27706. protocol: 'visiting',
  27707. fn: function (anIRInlinedIfNil){
  27708. var self=this;
  27709. return smalltalk.withContext(function($ctx1) {
  27710. var $1,$2,$4,$3;
  27711. $1=self._stream();
  27712. $ctx1.sendIdx["stream"]=1;
  27713. _st($1)._nextPutIf_with_((function(){
  27714. return smalltalk.withContext(function($ctx2) {
  27715. $2=self._stream();
  27716. $ctx2.sendIdx["stream"]=2;
  27717. _st($2)._nextPutAll_("($receiver = ");
  27718. $ctx2.sendIdx["nextPutAll:"]=1;
  27719. $4=_st(anIRInlinedIfNil)._instructions();
  27720. $ctx2.sendIdx["instructions"]=1;
  27721. $3=_st($4)._first();
  27722. self._visit_($3);
  27723. $ctx2.sendIdx["visit:"]=1;
  27724. return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
  27725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  27726. return smalltalk.withContext(function($ctx2) {
  27727. return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  27728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27729. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},globals.IRInliningJSTranslator)})},
  27730. args: ["anIRInlinedIfNil"],
  27731. source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09self visit: anIRInlinedIfNil instructions first.\x0a\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
  27732. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  27733. referencedClasses: []
  27734. }),
  27735. globals.IRInliningJSTranslator);
  27736. smalltalk.addMethod(
  27737. smalltalk.method({
  27738. selector: "visitIRInlinedIfNilIfNotNil:",
  27739. protocol: 'visiting',
  27740. fn: function (anIRInlinedIfNilIfNotNil){
  27741. var self=this;
  27742. return smalltalk.withContext(function($ctx1) {
  27743. var $1,$2,$4,$3,$6,$5;
  27744. $1=self._stream();
  27745. $ctx1.sendIdx["stream"]=1;
  27746. _st($1)._nextPutIfElse_with_with_((function(){
  27747. return smalltalk.withContext(function($ctx2) {
  27748. $2=self._stream();
  27749. $ctx2.sendIdx["stream"]=2;
  27750. _st($2)._nextPutAll_("($receiver = ");
  27751. $ctx2.sendIdx["nextPutAll:"]=1;
  27752. $4=_st(anIRInlinedIfNilIfNotNil)._instructions();
  27753. $ctx2.sendIdx["instructions"]=1;
  27754. $3=_st($4)._first();
  27755. self._visit_($3);
  27756. $ctx2.sendIdx["visit:"]=1;
  27757. return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
  27758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  27759. return smalltalk.withContext(function($ctx2) {
  27760. $6=_st(anIRInlinedIfNilIfNotNil)._instructions();
  27761. $ctx2.sendIdx["instructions"]=2;
  27762. $5=_st($6)._second();
  27763. return self._visit_($5);
  27764. $ctx2.sendIdx["visit:"]=2;
  27765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  27766. return smalltalk.withContext(function($ctx2) {
  27767. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  27768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  27769. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)})},
  27770. args: ["anIRInlinedIfNilIfNotNil"],
  27771. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  27772. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
  27773. referencedClasses: []
  27774. }),
  27775. globals.IRInliningJSTranslator);
  27776. smalltalk.addMethod(
  27777. smalltalk.method({
  27778. selector: "visitIRInlinedIfTrue:",
  27779. protocol: 'visiting',
  27780. fn: function (anIRInlinedIfTrue){
  27781. var self=this;
  27782. return smalltalk.withContext(function($ctx1) {
  27783. var $1,$2,$4,$3;
  27784. $1=self._stream();
  27785. $ctx1.sendIdx["stream"]=1;
  27786. _st($1)._nextPutIf_with_((function(){
  27787. return smalltalk.withContext(function($ctx2) {
  27788. $2=self._stream();
  27789. $ctx2.sendIdx["stream"]=2;
  27790. _st($2)._nextPutAll_("smalltalk.assert(");
  27791. $ctx2.sendIdx["nextPutAll:"]=1;
  27792. $4=_st(anIRInlinedIfTrue)._instructions();
  27793. $ctx2.sendIdx["instructions"]=1;
  27794. $3=_st($4)._first();
  27795. self._visit_($3);
  27796. $ctx2.sendIdx["visit:"]=1;
  27797. return _st(self._stream())._nextPutAll_(")");
  27798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  27799. return smalltalk.withContext(function($ctx2) {
  27800. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  27801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27802. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)})},
  27803. args: ["anIRInlinedIfTrue"],
  27804. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  27805. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  27806. referencedClasses: []
  27807. }),
  27808. globals.IRInliningJSTranslator);
  27809. smalltalk.addMethod(
  27810. smalltalk.method({
  27811. selector: "visitIRInlinedIfTrueIfFalse:",
  27812. protocol: 'visiting',
  27813. fn: function (anIRInlinedIfTrueIfFalse){
  27814. var self=this;
  27815. return smalltalk.withContext(function($ctx1) {
  27816. var $1,$2,$4,$3,$6,$5;
  27817. $1=self._stream();
  27818. $ctx1.sendIdx["stream"]=1;
  27819. _st($1)._nextPutIfElse_with_with_((function(){
  27820. return smalltalk.withContext(function($ctx2) {
  27821. $2=self._stream();
  27822. $ctx2.sendIdx["stream"]=2;
  27823. _st($2)._nextPutAll_("smalltalk.assert(");
  27824. $ctx2.sendIdx["nextPutAll:"]=1;
  27825. $4=_st(anIRInlinedIfTrueIfFalse)._instructions();
  27826. $ctx2.sendIdx["instructions"]=1;
  27827. $3=_st($4)._first();
  27828. self._visit_($3);
  27829. $ctx2.sendIdx["visit:"]=1;
  27830. return _st(self._stream())._nextPutAll_(")");
  27831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  27832. return smalltalk.withContext(function($ctx2) {
  27833. $6=_st(anIRInlinedIfTrueIfFalse)._instructions();
  27834. $ctx2.sendIdx["instructions"]=2;
  27835. $5=_st($6)._second();
  27836. return self._visit_($5);
  27837. $ctx2.sendIdx["visit:"]=2;
  27838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  27839. return smalltalk.withContext(function($ctx2) {
  27840. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  27841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  27842. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)})},
  27843. args: ["anIRInlinedIfTrueIfFalse"],
  27844. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  27845. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
  27846. referencedClasses: []
  27847. }),
  27848. globals.IRInliningJSTranslator);
  27849. smalltalk.addMethod(
  27850. smalltalk.method({
  27851. selector: "visitIRInlinedNonLocalReturn:",
  27852. protocol: 'visiting',
  27853. fn: function (anIRInlinedReturn){
  27854. var self=this;
  27855. return smalltalk.withContext(function($ctx1) {
  27856. var $1;
  27857. $1=self._stream();
  27858. $ctx1.sendIdx["stream"]=1;
  27859. _st($1)._nextPutStatementWith_((function(){
  27860. return smalltalk.withContext(function($ctx2) {
  27861. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  27862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27863. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  27864. }));
  27865. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
  27866. args: ["anIRInlinedReturn"],
  27867. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  27868. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"],
  27869. referencedClasses: []
  27870. }),
  27871. globals.IRInliningJSTranslator);
  27872. smalltalk.addMethod(
  27873. smalltalk.method({
  27874. selector: "visitIRInlinedReturn:",
  27875. protocol: 'visiting',
  27876. fn: function (anIRInlinedReturn){
  27877. var self=this;
  27878. return smalltalk.withContext(function($ctx1) {
  27879. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  27880. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
  27881. args: ["anIRInlinedReturn"],
  27882. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  27883. messageSends: ["visit:", "last", "instructions"],
  27884. referencedClasses: []
  27885. }),
  27886. globals.IRInliningJSTranslator);
  27887. smalltalk.addMethod(
  27888. smalltalk.method({
  27889. selector: "visitIRInlinedSequence:",
  27890. protocol: 'visiting',
  27891. fn: function (anIRInlinedSequence){
  27892. var self=this;
  27893. return smalltalk.withContext(function($ctx1) {
  27894. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  27895. return smalltalk.withContext(function($ctx2) {
  27896. return _st(self._stream())._nextPutStatementWith_((function(){
  27897. return smalltalk.withContext(function($ctx3) {
  27898. return self._visit_(each);
  27899. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  27900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27901. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)})},
  27902. args: ["anIRInlinedSequence"],
  27903. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  27904. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"],
  27905. referencedClasses: []
  27906. }),
  27907. globals.IRInliningJSTranslator);
  27908. smalltalk.addClass('IRSendInliner', globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  27909. globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  27910. smalltalk.addMethod(
  27911. smalltalk.method({
  27912. selector: "ifFalse:",
  27913. protocol: 'inlining',
  27914. fn: function (anIRInstruction){
  27915. var self=this;
  27916. function $IRInlinedIfFalse(){return globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  27917. return smalltalk.withContext(function($ctx1) {
  27918. var $1;
  27919. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  27920. return $1;
  27921. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  27922. args: ["anIRInstruction"],
  27923. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  27924. messageSends: ["inlinedSend:with:", "new"],
  27925. referencedClasses: ["IRInlinedIfFalse"]
  27926. }),
  27927. globals.IRSendInliner);
  27928. smalltalk.addMethod(
  27929. smalltalk.method({
  27930. selector: "ifFalse:ifTrue:",
  27931. protocol: 'inlining',
  27932. fn: function (anIRInstruction,anotherIRInstruction){
  27933. var self=this;
  27934. return smalltalk.withContext(function($ctx1) {
  27935. var $1;
  27936. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  27937. return $1;
  27938. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  27939. args: ["anIRInstruction", "anotherIRInstruction"],
  27940. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  27941. messageSends: ["perform:withArguments:"],
  27942. referencedClasses: []
  27943. }),
  27944. globals.IRSendInliner);
  27945. smalltalk.addMethod(
  27946. smalltalk.method({
  27947. selector: "ifNil:",
  27948. protocol: 'inlining',
  27949. fn: function (anIRInstruction){
  27950. var self=this;
  27951. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  27952. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  27953. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  27954. return smalltalk.withContext(function($ctx1) {
  27955. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  27956. $2=_st($IRInlinedIfNilIfNotNil())._new();
  27957. $ctx1.sendIdx["new"]=1;
  27958. $4=_st($IRClosure())._new();
  27959. $ctx1.sendIdx["new"]=2;
  27960. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  27961. $5=$4;
  27962. $7=_st($IRBlockSequence())._new();
  27963. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  27964. $8=_st($7)._yourself();
  27965. $ctx1.sendIdx["yourself"]=1;
  27966. $6=$8;
  27967. _st($5)._add_($6);
  27968. $ctx1.sendIdx["add:"]=1;
  27969. $9=_st($4)._yourself();
  27970. $3=$9;
  27971. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  27972. return $1;
  27973. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  27974. args: ["anIRInstruction"],
  27975. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (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)",
  27976. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  27977. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  27978. }),
  27979. globals.IRSendInliner);
  27980. smalltalk.addMethod(
  27981. smalltalk.method({
  27982. selector: "ifNil:ifNotNil:",
  27983. protocol: 'inlining',
  27984. fn: function (anIRInstruction,anotherIRInstruction){
  27985. var self=this;
  27986. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  27987. return smalltalk.withContext(function($ctx1) {
  27988. var $1;
  27989. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  27990. return $1;
  27991. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  27992. args: ["anIRInstruction", "anotherIRInstruction"],
  27993. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  27994. messageSends: ["inlinedSend:with:with:", "new"],
  27995. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  27996. }),
  27997. globals.IRSendInliner);
  27998. smalltalk.addMethod(
  27999. smalltalk.method({
  28000. selector: "ifNotNil:",
  28001. protocol: 'inlining',
  28002. fn: function (anIRInstruction){
  28003. var self=this;
  28004. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  28005. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  28006. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  28007. return smalltalk.withContext(function($ctx1) {
  28008. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  28009. $2=_st($IRInlinedIfNilIfNotNil())._new();
  28010. $ctx1.sendIdx["new"]=1;
  28011. $4=_st($IRClosure())._new();
  28012. $ctx1.sendIdx["new"]=2;
  28013. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  28014. $5=$4;
  28015. $7=_st($IRBlockSequence())._new();
  28016. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  28017. $8=_st($7)._yourself();
  28018. $ctx1.sendIdx["yourself"]=1;
  28019. $6=$8;
  28020. _st($5)._add_($6);
  28021. $ctx1.sendIdx["add:"]=1;
  28022. $9=_st($4)._yourself();
  28023. $3=$9;
  28024. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  28025. return $1;
  28026. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  28027. args: ["anIRInstruction"],
  28028. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (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\x09with: anIRInstruction",
  28029. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  28030. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  28031. }),
  28032. globals.IRSendInliner);
  28033. smalltalk.addMethod(
  28034. smalltalk.method({
  28035. selector: "ifNotNil:ifNil:",
  28036. protocol: 'inlining',
  28037. fn: function (anIRInstruction,anotherIRInstruction){
  28038. var self=this;
  28039. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  28040. return smalltalk.withContext(function($ctx1) {
  28041. var $1;
  28042. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  28043. return $1;
  28044. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  28045. args: ["anIRInstruction", "anotherIRInstruction"],
  28046. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  28047. messageSends: ["inlinedSend:with:with:", "new"],
  28048. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  28049. }),
  28050. globals.IRSendInliner);
  28051. smalltalk.addMethod(
  28052. smalltalk.method({
  28053. selector: "ifTrue:",
  28054. protocol: 'inlining',
  28055. fn: function (anIRInstruction){
  28056. var self=this;
  28057. function $IRInlinedIfTrue(){return globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  28058. return smalltalk.withContext(function($ctx1) {
  28059. var $1;
  28060. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  28061. return $1;
  28062. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  28063. args: ["anIRInstruction"],
  28064. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  28065. messageSends: ["inlinedSend:with:", "new"],
  28066. referencedClasses: ["IRInlinedIfTrue"]
  28067. }),
  28068. globals.IRSendInliner);
  28069. smalltalk.addMethod(
  28070. smalltalk.method({
  28071. selector: "ifTrue:ifFalse:",
  28072. protocol: 'inlining',
  28073. fn: function (anIRInstruction,anotherIRInstruction){
  28074. var self=this;
  28075. function $IRInlinedIfTrueIfFalse(){return globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  28076. return smalltalk.withContext(function($ctx1) {
  28077. var $1;
  28078. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  28079. return $1;
  28080. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  28081. args: ["anIRInstruction", "anotherIRInstruction"],
  28082. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  28083. messageSends: ["inlinedSend:with:with:", "new"],
  28084. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  28085. }),
  28086. globals.IRSendInliner);
  28087. smalltalk.addMethod(
  28088. smalltalk.method({
  28089. selector: "inlineClosure:",
  28090. protocol: 'inlining',
  28091. fn: function (anIRClosure){
  28092. var self=this;
  28093. var inlinedClosure,sequence,statements;
  28094. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  28095. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  28096. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  28097. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  28098. return smalltalk.withContext(function($ctx1) {
  28099. var $1,$2,$3,$5,$6,$4,$7,$9,$10,$12,$14,$15,$16,$17,$13,$11,$18,$20,$22,$23,$21,$19,$24,$8,$26,$25,$29,$28,$30,$27,$31,$34,$33,$32,$35;
  28100. inlinedClosure=self._inlinedClosure();
  28101. $1=inlinedClosure;
  28102. $2=_st(anIRClosure)._scope();
  28103. $ctx1.sendIdx["scope"]=1;
  28104. _st($1)._scope_($2);
  28105. $ctx1.sendIdx["scope:"]=1;
  28106. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  28107. return smalltalk.withContext(function($ctx2) {
  28108. return _st(inlinedClosure)._add_(each);
  28109. $ctx2.sendIdx["add:"]=1;
  28110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  28111. $ctx1.sendIdx["do:"]=1;
  28112. sequence=self._inlinedSequence();
  28113. _st(_st(anIRClosure)._arguments())._do_((function(each){
  28114. return smalltalk.withContext(function($ctx2) {
  28115. $3=inlinedClosure;
  28116. $5=_st($IRTempDeclaration())._new();
  28117. $ctx2.sendIdx["new"]=1;
  28118. _st($5)._name_(each);
  28119. $ctx2.sendIdx["name:"]=1;
  28120. $6=_st($5)._yourself();
  28121. $ctx2.sendIdx["yourself"]=1;
  28122. $4=$6;
  28123. _st($3)._add_($4);
  28124. $ctx2.sendIdx["add:"]=2;
  28125. $7=sequence;
  28126. $9=_st($IRAssignment())._new();
  28127. $ctx2.sendIdx["new"]=2;
  28128. $10=$9;
  28129. $12=_st($IRVariable())._new();
  28130. $ctx2.sendIdx["new"]=3;
  28131. $14=_st($AliasVar())._new();
  28132. $ctx2.sendIdx["new"]=4;
  28133. $15=$14;
  28134. $16=_st(inlinedClosure)._scope();
  28135. $ctx2.sendIdx["scope"]=2;
  28136. _st($15)._scope_($16);
  28137. $ctx2.sendIdx["scope:"]=2;
  28138. _st($14)._name_(each);
  28139. $ctx2.sendIdx["name:"]=2;
  28140. $17=_st($14)._yourself();
  28141. $ctx2.sendIdx["yourself"]=2;
  28142. $13=$17;
  28143. $11=_st($12)._variable_($13);
  28144. $ctx2.sendIdx["variable:"]=1;
  28145. _st($10)._add_($11);
  28146. $ctx2.sendIdx["add:"]=4;
  28147. $18=$9;
  28148. $20=_st($IRVariable())._new();
  28149. $ctx2.sendIdx["new"]=5;
  28150. $22=_st($AliasVar())._new();
  28151. _st($22)._scope_(_st(inlinedClosure)._scope());
  28152. _st($22)._name_("$receiver");
  28153. $23=_st($22)._yourself();
  28154. $ctx2.sendIdx["yourself"]=3;
  28155. $21=$23;
  28156. $19=_st($20)._variable_($21);
  28157. _st($18)._add_($19);
  28158. $ctx2.sendIdx["add:"]=5;
  28159. $24=_st($9)._yourself();
  28160. $8=$24;
  28161. return _st($7)._add_($8);
  28162. $ctx2.sendIdx["add:"]=3;
  28163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  28164. $ctx1.sendIdx["do:"]=2;
  28165. _st(inlinedClosure)._add_(sequence);
  28166. $ctx1.sendIdx["add:"]=6;
  28167. $26=_st(anIRClosure)._instructions();
  28168. $ctx1.sendIdx["instructions"]=2;
  28169. $25=_st($26)._last();
  28170. $ctx1.sendIdx["last"]=1;
  28171. statements=_st($25)._instructions();
  28172. $ctx1.sendIdx["instructions"]=1;
  28173. _st(statements)._ifNotEmpty_((function(){
  28174. return smalltalk.withContext(function($ctx2) {
  28175. _st(_st(statements)._allButLast())._do_((function(each){
  28176. return smalltalk.withContext(function($ctx3) {
  28177. return _st(sequence)._add_(each);
  28178. $ctx3.sendIdx["add:"]=7;
  28179. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
  28180. $29=_st(statements)._last();
  28181. $ctx2.sendIdx["last"]=2;
  28182. $28=_st($29)._isReturn();
  28183. $27=_st($28)._and_((function(){
  28184. return smalltalk.withContext(function($ctx3) {
  28185. $30=_st(statements)._last();
  28186. $ctx3.sendIdx["last"]=3;
  28187. return _st($30)._isBlockReturn();
  28188. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  28189. if(smalltalk.assert($27)){
  28190. $31=sequence;
  28191. $34=_st(statements)._last();
  28192. $ctx2.sendIdx["last"]=4;
  28193. $33=_st($34)._instructions();
  28194. $32=_st($33)._first();
  28195. return _st($31)._add_($32);
  28196. $ctx2.sendIdx["add:"]=8;
  28197. } else {
  28198. return _st(sequence)._add_(_st(statements)._last());
  28199. };
  28200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  28201. $35=inlinedClosure;
  28202. return $35;
  28203. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)})},
  28204. args: ["anIRClosure"],
  28205. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure scope: anIRClosure scope.\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",
  28206. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"],
  28207. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"]
  28208. }),
  28209. globals.IRSendInliner);
  28210. smalltalk.addMethod(
  28211. smalltalk.method({
  28212. selector: "inlineSend:",
  28213. protocol: 'inlining',
  28214. fn: function (anIRSend){
  28215. var self=this;
  28216. return smalltalk.withContext(function($ctx1) {
  28217. var $3,$2,$1;
  28218. self._send_(anIRSend);
  28219. $3=self._send();
  28220. $ctx1.sendIdx["send"]=1;
  28221. $2=_st($3)._selector();
  28222. $1=self._perform_withArguments_($2,_st(_st(self._send())._instructions())._allButFirst());
  28223. return $1;
  28224. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)})},
  28225. args: ["anIRSend"],
  28226. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  28227. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  28228. referencedClasses: []
  28229. }),
  28230. globals.IRSendInliner);
  28231. smalltalk.addMethod(
  28232. smalltalk.method({
  28233. selector: "inlinedClosure",
  28234. protocol: 'factory',
  28235. fn: function (){
  28236. var self=this;
  28237. function $IRInlinedClosure(){return globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  28238. return smalltalk.withContext(function($ctx1) {
  28239. var $1;
  28240. $1=_st($IRInlinedClosure())._new();
  28241. return $1;
  28242. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)})},
  28243. args: [],
  28244. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  28245. messageSends: ["new"],
  28246. referencedClasses: ["IRInlinedClosure"]
  28247. }),
  28248. globals.IRSendInliner);
  28249. smalltalk.addMethod(
  28250. smalltalk.method({
  28251. selector: "inlinedSend:with:",
  28252. protocol: 'inlining',
  28253. fn: function (inlinedSend,anIRInstruction){
  28254. var self=this;
  28255. var inlinedClosure;
  28256. return smalltalk.withContext(function($ctx1) {
  28257. var $1,$2,$5,$4,$3,$6;
  28258. $1=_st(anIRInstruction)._isClosure();
  28259. if(! smalltalk.assert($1)){
  28260. self._inliningError_("Message argument should be a block");
  28261. $ctx1.sendIdx["inliningError:"]=1;
  28262. };
  28263. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  28264. if(! smalltalk.assert($2)){
  28265. self._inliningError_("Inlined block should have zero argument");
  28266. };
  28267. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  28268. $5=self._send();
  28269. $ctx1.sendIdx["send"]=1;
  28270. $4=_st($5)._instructions();
  28271. $3=_st($4)._first();
  28272. _st(inlinedSend)._add_($3);
  28273. $ctx1.sendIdx["add:"]=1;
  28274. $6=_st(inlinedSend)._add_(inlinedClosure);
  28275. _st(self._send())._replaceWith_(inlinedSend);
  28276. return inlinedSend;
  28277. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)})},
  28278. args: ["inlinedSend", "anIRInstruction"],
  28279. source: "inlinedSend: inlinedSend with: 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\x0a\x09^ inlinedSend",
  28280. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
  28281. referencedClasses: []
  28282. }),
  28283. globals.IRSendInliner);
  28284. smalltalk.addMethod(
  28285. smalltalk.method({
  28286. selector: "inlinedSend:with:with:",
  28287. protocol: 'inlining',
  28288. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  28289. var self=this;
  28290. var inlinedClosure1,inlinedClosure2;
  28291. return smalltalk.withContext(function($ctx1) {
  28292. var $1,$2,$3,$4,$7,$6,$5,$8;
  28293. $1=_st(anIRInstruction)._isClosure();
  28294. $ctx1.sendIdx["isClosure"]=1;
  28295. if(! smalltalk.assert($1)){
  28296. self._inliningError_("Message argument should be a block");
  28297. $ctx1.sendIdx["inliningError:"]=1;
  28298. };
  28299. $2=_st(anotherIRInstruction)._isClosure();
  28300. if(! smalltalk.assert($2)){
  28301. self._inliningError_("Message argument should be a block");
  28302. };
  28303. $3=self._translator();
  28304. $ctx1.sendIdx["translator"]=1;
  28305. $4=self._inlineClosure_(anIRInstruction);
  28306. $ctx1.sendIdx["inlineClosure:"]=1;
  28307. inlinedClosure1=_st($3)._visit_($4);
  28308. $ctx1.sendIdx["visit:"]=1;
  28309. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  28310. $7=self._send();
  28311. $ctx1.sendIdx["send"]=1;
  28312. $6=_st($7)._instructions();
  28313. $5=_st($6)._first();
  28314. _st(inlinedSend)._add_($5);
  28315. $ctx1.sendIdx["add:"]=1;
  28316. _st(inlinedSend)._add_(inlinedClosure1);
  28317. $ctx1.sendIdx["add:"]=2;
  28318. $8=_st(inlinedSend)._add_(inlinedClosure2);
  28319. _st(self._send())._replaceWith_(inlinedSend);
  28320. return inlinedSend;
  28321. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)})},
  28322. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  28323. source: "inlinedSend: inlinedSend with: anIRInstruction with: 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\x09^ inlinedSend",
  28324. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
  28325. referencedClasses: []
  28326. }),
  28327. globals.IRSendInliner);
  28328. smalltalk.addMethod(
  28329. smalltalk.method({
  28330. selector: "inlinedSequence",
  28331. protocol: 'factory',
  28332. fn: function (){
  28333. var self=this;
  28334. function $IRInlinedSequence(){return globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  28335. return smalltalk.withContext(function($ctx1) {
  28336. var $1;
  28337. $1=_st($IRInlinedSequence())._new();
  28338. return $1;
  28339. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)})},
  28340. args: [],
  28341. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  28342. messageSends: ["new"],
  28343. referencedClasses: ["IRInlinedSequence"]
  28344. }),
  28345. globals.IRSendInliner);
  28346. smalltalk.addMethod(
  28347. smalltalk.method({
  28348. selector: "inliningError:",
  28349. protocol: 'error handling',
  28350. fn: function (aString){
  28351. var self=this;
  28352. function $InliningError(){return globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  28353. return smalltalk.withContext(function($ctx1) {
  28354. _st($InliningError())._signal_(aString);
  28355. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)})},
  28356. args: ["aString"],
  28357. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  28358. messageSends: ["signal:"],
  28359. referencedClasses: ["InliningError"]
  28360. }),
  28361. globals.IRSendInliner);
  28362. smalltalk.addMethod(
  28363. smalltalk.method({
  28364. selector: "send",
  28365. protocol: 'accessing',
  28366. fn: function (){
  28367. var self=this;
  28368. var $1;
  28369. $1=self["@send"];
  28370. return $1;
  28371. },
  28372. args: [],
  28373. source: "send\x0a\x09^ send",
  28374. messageSends: [],
  28375. referencedClasses: []
  28376. }),
  28377. globals.IRSendInliner);
  28378. smalltalk.addMethod(
  28379. smalltalk.method({
  28380. selector: "send:",
  28381. protocol: 'accessing',
  28382. fn: function (anIRSend){
  28383. var self=this;
  28384. self["@send"]=anIRSend;
  28385. return self},
  28386. args: ["anIRSend"],
  28387. source: "send: anIRSend\x0a\x09send := anIRSend",
  28388. messageSends: [],
  28389. referencedClasses: []
  28390. }),
  28391. globals.IRSendInliner);
  28392. smalltalk.addMethod(
  28393. smalltalk.method({
  28394. selector: "translator",
  28395. protocol: 'accessing',
  28396. fn: function (){
  28397. var self=this;
  28398. var $1;
  28399. $1=self["@translator"];
  28400. return $1;
  28401. },
  28402. args: [],
  28403. source: "translator\x0a\x09^ translator",
  28404. messageSends: [],
  28405. referencedClasses: []
  28406. }),
  28407. globals.IRSendInliner);
  28408. smalltalk.addMethod(
  28409. smalltalk.method({
  28410. selector: "translator:",
  28411. protocol: 'accessing',
  28412. fn: function (anASTTranslator){
  28413. var self=this;
  28414. self["@translator"]=anASTTranslator;
  28415. return self},
  28416. args: ["anASTTranslator"],
  28417. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  28418. messageSends: [],
  28419. referencedClasses: []
  28420. }),
  28421. globals.IRSendInliner);
  28422. smalltalk.addMethod(
  28423. smalltalk.method({
  28424. selector: "inlinedSelectors",
  28425. protocol: 'accessing',
  28426. fn: function (){
  28427. var self=this;
  28428. var $1;
  28429. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  28430. return $1;
  28431. },
  28432. args: [],
  28433. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  28434. messageSends: [],
  28435. referencedClasses: []
  28436. }),
  28437. globals.IRSendInliner.klass);
  28438. smalltalk.addMethod(
  28439. smalltalk.method({
  28440. selector: "shouldInline:",
  28441. protocol: 'accessing',
  28442. fn: function (anIRInstruction){
  28443. var self=this;
  28444. return smalltalk.withContext(function($ctx1) {
  28445. var $1,$2;
  28446. var $early={};
  28447. try {
  28448. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  28449. if(! smalltalk.assert($1)){
  28450. return false;
  28451. };
  28452. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  28453. return smalltalk.withContext(function($ctx2) {
  28454. $2=_st(each)._isClosure();
  28455. if(! smalltalk.assert($2)){
  28456. throw $early=[false];
  28457. };
  28458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  28459. return true;
  28460. }
  28461. catch(e) {if(e===$early)return e[0]; throw e}
  28462. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)})},
  28463. args: ["anIRInstruction"],
  28464. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
  28465. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"],
  28466. referencedClasses: []
  28467. }),
  28468. globals.IRSendInliner.klass);
  28469. smalltalk.addClass('IRAssignmentInliner', globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  28470. 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(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  28471. smalltalk.addMethod(
  28472. smalltalk.method({
  28473. selector: "assignment",
  28474. protocol: 'accessing',
  28475. fn: function (){
  28476. var self=this;
  28477. var $1;
  28478. $1=self["@assignment"];
  28479. return $1;
  28480. },
  28481. args: [],
  28482. source: "assignment\x0a\x09^ assignment",
  28483. messageSends: [],
  28484. referencedClasses: []
  28485. }),
  28486. globals.IRAssignmentInliner);
  28487. smalltalk.addMethod(
  28488. smalltalk.method({
  28489. selector: "assignment:",
  28490. protocol: 'accessing',
  28491. fn: function (aNode){
  28492. var self=this;
  28493. self["@assignment"]=aNode;
  28494. return self},
  28495. args: ["aNode"],
  28496. source: "assignment: aNode\x0a\x09assignment := aNode",
  28497. messageSends: [],
  28498. referencedClasses: []
  28499. }),
  28500. globals.IRAssignmentInliner);
  28501. smalltalk.addMethod(
  28502. smalltalk.method({
  28503. selector: "inlineAssignment:",
  28504. protocol: 'inlining',
  28505. fn: function (anIRAssignment){
  28506. var self=this;
  28507. var inlinedAssignment;
  28508. function $IRInlinedAssignment(){return globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  28509. return smalltalk.withContext(function($ctx1) {
  28510. var $1,$2;
  28511. self._assignment_(anIRAssignment);
  28512. inlinedAssignment=_st($IRInlinedAssignment())._new();
  28513. $1=_st(anIRAssignment)._instructions();
  28514. $ctx1.sendIdx["instructions"]=1;
  28515. _st($1)._do_((function(each){
  28516. return smalltalk.withContext(function($ctx2) {
  28517. return _st(inlinedAssignment)._add_(each);
  28518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  28519. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  28520. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  28521. $2=inlinedAssignment;
  28522. return $2;
  28523. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)})},
  28524. args: ["anIRAssignment"],
  28525. 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",
  28526. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  28527. referencedClasses: ["IRInlinedAssignment"]
  28528. }),
  28529. globals.IRAssignmentInliner);
  28530. smalltalk.addMethod(
  28531. smalltalk.method({
  28532. selector: "inlineClosure:",
  28533. protocol: 'inlining',
  28534. fn: function (anIRClosure){
  28535. var self=this;
  28536. var inlinedClosure,statements;
  28537. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  28538. return smalltalk.withContext(function($ctx1) {
  28539. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  28540. inlinedClosure=globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  28541. $2=_st(inlinedClosure)._instructions();
  28542. $ctx1.sendIdx["instructions"]=2;
  28543. $1=_st($2)._last();
  28544. $ctx1.sendIdx["last"]=1;
  28545. statements=_st($1)._instructions();
  28546. $ctx1.sendIdx["instructions"]=1;
  28547. _st(statements)._ifNotEmpty_((function(){
  28548. return smalltalk.withContext(function($ctx2) {
  28549. $4=_st(statements)._last();
  28550. $ctx2.sendIdx["last"]=2;
  28551. $3=_st($4)._canBeAssigned();
  28552. if(smalltalk.assert($3)){
  28553. $5=_st(statements)._last();
  28554. $ctx2.sendIdx["last"]=3;
  28555. $7=_st($IRAssignment())._new();
  28556. _st($7)._add_(_st(_st(self._assignment())._instructions())._first());
  28557. $ctx2.sendIdx["add:"]=1;
  28558. _st($7)._add_(_st(_st(statements)._last())._copy());
  28559. $8=_st($7)._yourself();
  28560. $6=$8;
  28561. return _st($5)._replaceWith_($6);
  28562. };
  28563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28564. $9=inlinedClosure;
  28565. return $9;
  28566. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)})},
  28567. args: ["anIRClosure"],
  28568. 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",
  28569. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"],
  28570. referencedClasses: ["IRAssignment"]
  28571. }),
  28572. globals.IRAssignmentInliner);
  28573. smalltalk.addClass('IRReturnInliner', globals.IRSendInliner, [], 'Compiler-Inlining');
  28574. globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  28575. smalltalk.addMethod(
  28576. smalltalk.method({
  28577. selector: "inlineClosure:",
  28578. protocol: 'inlining',
  28579. fn: function (anIRClosure){
  28580. var self=this;
  28581. var closure,statements;
  28582. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  28583. return smalltalk.withContext(function($ctx1) {
  28584. var $1,$3,$2,$4,$5,$6,$7;
  28585. closure=globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  28586. $1=_st(_st(closure)._instructions())._last();
  28587. $ctx1.sendIdx["last"]=1;
  28588. statements=_st($1)._instructions();
  28589. $ctx1.sendIdx["instructions"]=1;
  28590. _st(statements)._ifNotEmpty_((function(){
  28591. return smalltalk.withContext(function($ctx2) {
  28592. $3=_st(statements)._last();
  28593. $ctx2.sendIdx["last"]=2;
  28594. $2=_st($3)._isReturn();
  28595. if(! smalltalk.assert($2)){
  28596. $4=_st(statements)._last();
  28597. $ctx2.sendIdx["last"]=3;
  28598. $5=_st($IRReturn())._new();
  28599. _st($5)._add_(_st(_st(statements)._last())._copy());
  28600. $6=_st($5)._yourself();
  28601. return _st($4)._replaceWith_($6);
  28602. };
  28603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28604. $7=closure;
  28605. return $7;
  28606. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)})},
  28607. args: ["anIRClosure"],
  28608. 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",
  28609. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"],
  28610. referencedClasses: ["IRReturn"]
  28611. }),
  28612. globals.IRReturnInliner);
  28613. smalltalk.addMethod(
  28614. smalltalk.method({
  28615. selector: "inlineReturn:",
  28616. protocol: 'inlining',
  28617. fn: function (anIRReturn){
  28618. var self=this;
  28619. var return_;
  28620. return smalltalk.withContext(function($ctx1) {
  28621. var $1,$2;
  28622. return_=self._inlinedReturn();
  28623. $1=_st(anIRReturn)._instructions();
  28624. $ctx1.sendIdx["instructions"]=1;
  28625. _st($1)._do_((function(each){
  28626. return smalltalk.withContext(function($ctx2) {
  28627. return _st(return_)._add_(each);
  28628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  28629. _st(anIRReturn)._replaceWith_(return_);
  28630. self._inlineSend_(_st(_st(return_)._instructions())._last());
  28631. $2=return_;
  28632. return $2;
  28633. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)})},
  28634. args: ["anIRReturn"],
  28635. 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",
  28636. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  28637. referencedClasses: []
  28638. }),
  28639. globals.IRReturnInliner);
  28640. smalltalk.addMethod(
  28641. smalltalk.method({
  28642. selector: "inlinedReturn",
  28643. protocol: 'factory',
  28644. fn: function (){
  28645. var self=this;
  28646. function $IRInlinedReturn(){return globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  28647. return smalltalk.withContext(function($ctx1) {
  28648. var $1;
  28649. $1=_st($IRInlinedReturn())._new();
  28650. return $1;
  28651. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)})},
  28652. args: [],
  28653. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  28654. messageSends: ["new"],
  28655. referencedClasses: ["IRInlinedReturn"]
  28656. }),
  28657. globals.IRReturnInliner);
  28658. smalltalk.addClass('InliningCodeGenerator', globals.CodeGenerator, [], 'Compiler-Inlining');
  28659. globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  28660. smalltalk.addMethod(
  28661. smalltalk.method({
  28662. selector: "compileNode:",
  28663. protocol: 'compiling',
  28664. fn: function (aNode){
  28665. var self=this;
  28666. var ir,stream;
  28667. return smalltalk.withContext(function($ctx1) {
  28668. var $2,$3,$1;
  28669. _st(self._semanticAnalyzer())._visit_(aNode);
  28670. $ctx1.sendIdx["visit:"]=1;
  28671. ir=_st(self._translator())._visit_(aNode);
  28672. $ctx1.sendIdx["visit:"]=2;
  28673. _st(self._inliner())._visit_(ir);
  28674. $ctx1.sendIdx["visit:"]=3;
  28675. $2=self._irTranslator();
  28676. _st($2)._currentClass_(self._currentClass());
  28677. _st($2)._visit_(ir);
  28678. $3=_st($2)._contents();
  28679. $1=$3;
  28680. return $1;
  28681. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)})},
  28682. args: ["aNode"],
  28683. 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",
  28684. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"],
  28685. referencedClasses: []
  28686. }),
  28687. globals.InliningCodeGenerator);
  28688. smalltalk.addMethod(
  28689. smalltalk.method({
  28690. selector: "inliner",
  28691. protocol: 'compiling',
  28692. fn: function (){
  28693. var self=this;
  28694. function $IRInliner(){return globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  28695. return smalltalk.withContext(function($ctx1) {
  28696. var $1;
  28697. $1=_st($IRInliner())._new();
  28698. return $1;
  28699. }, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)})},
  28700. args: [],
  28701. source: "inliner\x0a\x09^ IRInliner new",
  28702. messageSends: ["new"],
  28703. referencedClasses: ["IRInliner"]
  28704. }),
  28705. globals.InliningCodeGenerator);
  28706. smalltalk.addMethod(
  28707. smalltalk.method({
  28708. selector: "irTranslator",
  28709. protocol: 'compiling',
  28710. fn: function (){
  28711. var self=this;
  28712. function $IRInliningJSTranslator(){return globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  28713. return smalltalk.withContext(function($ctx1) {
  28714. var $1;
  28715. $1=_st($IRInliningJSTranslator())._new();
  28716. return $1;
  28717. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)})},
  28718. args: [],
  28719. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  28720. messageSends: ["new"],
  28721. referencedClasses: ["IRInliningJSTranslator"]
  28722. }),
  28723. globals.InliningCodeGenerator);
  28724. });
  28725. define("amber_core/Compiler-Semantic", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function(smalltalk,nil,_st, globals){
  28726. smalltalk.addPackage('Compiler-Semantic');
  28727. smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28728. smalltalk.addClass('LexicalScope', globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  28729. 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.";
  28730. smalltalk.addMethod(
  28731. smalltalk.method({
  28732. selector: "addArg:",
  28733. protocol: 'adding',
  28734. fn: function (aString){
  28735. var self=this;
  28736. function $ArgVar(){return globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  28737. return smalltalk.withContext(function($ctx1) {
  28738. var $1;
  28739. $1=self._args();
  28740. $ctx1.sendIdx["args"]=1;
  28741. _st($1)._at_put_(aString,_st($ArgVar())._on_(aString));
  28742. _st(_st(self._args())._at_(aString))._scope_(self);
  28743. return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},globals.LexicalScope)})},
  28744. args: ["aString"],
  28745. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  28746. messageSends: ["at:put:", "args", "on:", "scope:", "at:"],
  28747. referencedClasses: ["ArgVar"]
  28748. }),
  28749. globals.LexicalScope);
  28750. smalltalk.addMethod(
  28751. smalltalk.method({
  28752. selector: "addTemp:",
  28753. protocol: 'adding',
  28754. fn: function (aString){
  28755. var self=this;
  28756. function $TempVar(){return globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  28757. return smalltalk.withContext(function($ctx1) {
  28758. var $1;
  28759. $1=self._temps();
  28760. $ctx1.sendIdx["temps"]=1;
  28761. _st($1)._at_put_(aString,_st($TempVar())._on_(aString));
  28762. _st(_st(self._temps())._at_(aString))._scope_(self);
  28763. return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},globals.LexicalScope)})},
  28764. args: ["aString"],
  28765. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  28766. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"],
  28767. referencedClasses: ["TempVar"]
  28768. }),
  28769. globals.LexicalScope);
  28770. smalltalk.addMethod(
  28771. smalltalk.method({
  28772. selector: "alias",
  28773. protocol: 'accessing',
  28774. fn: function (){
  28775. var self=this;
  28776. return smalltalk.withContext(function($ctx1) {
  28777. var $1;
  28778. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  28779. return $1;
  28780. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.LexicalScope)})},
  28781. args: [],
  28782. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  28783. messageSends: [",", "asString", "scopeLevel"],
  28784. referencedClasses: []
  28785. }),
  28786. globals.LexicalScope);
  28787. smalltalk.addMethod(
  28788. smalltalk.method({
  28789. selector: "allVariableNames",
  28790. protocol: 'accessing',
  28791. fn: function (){
  28792. var self=this;
  28793. return smalltalk.withContext(function($ctx1) {
  28794. var $2,$1;
  28795. $2=_st(self._args())._keys();
  28796. $ctx1.sendIdx["keys"]=1;
  28797. $1=_st($2).__comma(_st(self._temps())._keys());
  28798. return $1;
  28799. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.LexicalScope)})},
  28800. args: [],
  28801. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  28802. messageSends: [",", "keys", "args", "temps"],
  28803. referencedClasses: []
  28804. }),
  28805. globals.LexicalScope);
  28806. smalltalk.addMethod(
  28807. smalltalk.method({
  28808. selector: "args",
  28809. protocol: 'accessing',
  28810. fn: function (){
  28811. var self=this;
  28812. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  28813. return smalltalk.withContext(function($ctx1) {
  28814. var $2,$1;
  28815. $2=self["@args"];
  28816. if(($receiver = $2) == nil || $receiver == null){
  28817. self["@args"]=_st($Dictionary())._new();
  28818. $1=self["@args"];
  28819. } else {
  28820. $1=$2;
  28821. };
  28822. return $1;
  28823. }, function($ctx1) {$ctx1.fill(self,"args",{},globals.LexicalScope)})},
  28824. args: [],
  28825. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  28826. messageSends: ["ifNil:", "new"],
  28827. referencedClasses: ["Dictionary"]
  28828. }),
  28829. globals.LexicalScope);
  28830. smalltalk.addMethod(
  28831. smalltalk.method({
  28832. selector: "bindingFor:",
  28833. protocol: 'accessing',
  28834. fn: function (aStringOrNode){
  28835. var self=this;
  28836. return smalltalk.withContext(function($ctx1) {
  28837. var $2,$3,$4,$5,$1;
  28838. $2=self._pseudoVars();
  28839. $3=_st(aStringOrNode)._value();
  28840. $ctx1.sendIdx["value"]=1;
  28841. $1=_st($2)._at_ifAbsent_($3,(function(){
  28842. return smalltalk.withContext(function($ctx2) {
  28843. $4=self._args();
  28844. $5=_st(aStringOrNode)._value();
  28845. $ctx2.sendIdx["value"]=2;
  28846. return _st($4)._at_ifAbsent_($5,(function(){
  28847. return smalltalk.withContext(function($ctx3) {
  28848. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  28849. return nil;
  28850. }));
  28851. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  28852. $ctx2.sendIdx["at:ifAbsent:"]=2;
  28853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28854. $ctx1.sendIdx["at:ifAbsent:"]=1;
  28855. return $1;
  28856. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},globals.LexicalScope)})},
  28857. args: ["aStringOrNode"],
  28858. 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 ]]]",
  28859. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"],
  28860. referencedClasses: []
  28861. }),
  28862. globals.LexicalScope);
  28863. smalltalk.addMethod(
  28864. smalltalk.method({
  28865. selector: "blockIndex",
  28866. protocol: 'accessing',
  28867. fn: function (){
  28868. var self=this;
  28869. return smalltalk.withContext(function($ctx1) {
  28870. var $2,$1;
  28871. $2=self["@blockIndex"];
  28872. if(($receiver = $2) == nil || $receiver == null){
  28873. $1=(0);
  28874. } else {
  28875. $1=$2;
  28876. };
  28877. return $1;
  28878. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},globals.LexicalScope)})},
  28879. args: [],
  28880. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  28881. messageSends: ["ifNil:"],
  28882. referencedClasses: []
  28883. }),
  28884. globals.LexicalScope);
  28885. smalltalk.addMethod(
  28886. smalltalk.method({
  28887. selector: "blockIndex:",
  28888. protocol: 'accessing',
  28889. fn: function (anInteger){
  28890. var self=this;
  28891. self["@blockIndex"]=anInteger;
  28892. return self},
  28893. args: ["anInteger"],
  28894. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  28895. messageSends: [],
  28896. referencedClasses: []
  28897. }),
  28898. globals.LexicalScope);
  28899. smalltalk.addMethod(
  28900. smalltalk.method({
  28901. selector: "canInlineNonLocalReturns",
  28902. protocol: 'testing',
  28903. fn: function (){
  28904. var self=this;
  28905. return smalltalk.withContext(function($ctx1) {
  28906. var $1;
  28907. $1=_st(self._isInlined())._and_((function(){
  28908. return smalltalk.withContext(function($ctx2) {
  28909. return _st(self._outerScope())._canInlineNonLocalReturns();
  28910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28911. return $1;
  28912. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},globals.LexicalScope)})},
  28913. args: [],
  28914. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  28915. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"],
  28916. referencedClasses: []
  28917. }),
  28918. globals.LexicalScope);
  28919. smalltalk.addMethod(
  28920. smalltalk.method({
  28921. selector: "instruction",
  28922. protocol: 'accessing',
  28923. fn: function (){
  28924. var self=this;
  28925. var $1;
  28926. $1=self["@instruction"];
  28927. return $1;
  28928. },
  28929. args: [],
  28930. source: "instruction\x0a\x09^ instruction",
  28931. messageSends: [],
  28932. referencedClasses: []
  28933. }),
  28934. globals.LexicalScope);
  28935. smalltalk.addMethod(
  28936. smalltalk.method({
  28937. selector: "instruction:",
  28938. protocol: 'accessing',
  28939. fn: function (anIRInstruction){
  28940. var self=this;
  28941. self["@instruction"]=anIRInstruction;
  28942. return self},
  28943. args: ["anIRInstruction"],
  28944. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  28945. messageSends: [],
  28946. referencedClasses: []
  28947. }),
  28948. globals.LexicalScope);
  28949. smalltalk.addMethod(
  28950. smalltalk.method({
  28951. selector: "isBlockScope",
  28952. protocol: 'testing',
  28953. fn: function (){
  28954. var self=this;
  28955. return smalltalk.withContext(function($ctx1) {
  28956. var $1;
  28957. $1=_st(self._isMethodScope())._not();
  28958. return $1;
  28959. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},globals.LexicalScope)})},
  28960. args: [],
  28961. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  28962. messageSends: ["not", "isMethodScope"],
  28963. referencedClasses: []
  28964. }),
  28965. globals.LexicalScope);
  28966. smalltalk.addMethod(
  28967. smalltalk.method({
  28968. selector: "isInlined",
  28969. protocol: 'testing',
  28970. fn: function (){
  28971. var self=this;
  28972. return smalltalk.withContext(function($ctx1) {
  28973. var $3,$2,$1;
  28974. $3=self._instruction();
  28975. $ctx1.sendIdx["instruction"]=1;
  28976. $2=_st($3)._notNil();
  28977. $1=_st($2)._and_((function(){
  28978. return smalltalk.withContext(function($ctx2) {
  28979. return _st(self._instruction())._isInlined();
  28980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28981. return $1;
  28982. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},globals.LexicalScope)})},
  28983. args: [],
  28984. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  28985. messageSends: ["and:", "notNil", "instruction", "isInlined"],
  28986. referencedClasses: []
  28987. }),
  28988. globals.LexicalScope);
  28989. smalltalk.addMethod(
  28990. smalltalk.method({
  28991. selector: "isMethodScope",
  28992. protocol: 'testing',
  28993. fn: function (){
  28994. var self=this;
  28995. return false;
  28996. },
  28997. args: [],
  28998. source: "isMethodScope\x0a\x09^ false",
  28999. messageSends: [],
  29000. referencedClasses: []
  29001. }),
  29002. globals.LexicalScope);
  29003. smalltalk.addMethod(
  29004. smalltalk.method({
  29005. selector: "lookupVariable:",
  29006. protocol: 'accessing',
  29007. fn: function (aNode){
  29008. var self=this;
  29009. var lookup;
  29010. return smalltalk.withContext(function($ctx1) {
  29011. var $1,$2,$3;
  29012. lookup=self._bindingFor_(aNode);
  29013. $1=lookup;
  29014. if(($receiver = $1) == nil || $receiver == null){
  29015. $2=self._outerScope();
  29016. $ctx1.sendIdx["outerScope"]=1;
  29017. if(($receiver = $2) == nil || $receiver == null){
  29018. lookup=$2;
  29019. } else {
  29020. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  29021. };
  29022. lookup;
  29023. } else {
  29024. $1;
  29025. };
  29026. $3=lookup;
  29027. return $3;
  29028. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},globals.LexicalScope)})},
  29029. args: ["aNode"],
  29030. 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",
  29031. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"],
  29032. referencedClasses: []
  29033. }),
  29034. globals.LexicalScope);
  29035. smalltalk.addMethod(
  29036. smalltalk.method({
  29037. selector: "methodScope",
  29038. protocol: 'accessing',
  29039. fn: function (){
  29040. var self=this;
  29041. return smalltalk.withContext(function($ctx1) {
  29042. var $2,$1;
  29043. $2=self._outerScope();
  29044. $ctx1.sendIdx["outerScope"]=1;
  29045. if(($receiver = $2) == nil || $receiver == null){
  29046. $1=$2;
  29047. } else {
  29048. $1=_st(self._outerScope())._methodScope();
  29049. };
  29050. return $1;
  29051. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},globals.LexicalScope)})},
  29052. args: [],
  29053. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  29054. messageSends: ["ifNotNil:", "outerScope", "methodScope"],
  29055. referencedClasses: []
  29056. }),
  29057. globals.LexicalScope);
  29058. smalltalk.addMethod(
  29059. smalltalk.method({
  29060. selector: "node",
  29061. protocol: 'accessing',
  29062. fn: function (){
  29063. var self=this;
  29064. var $1;
  29065. $1=self["@node"];
  29066. return $1;
  29067. },
  29068. args: [],
  29069. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  29070. messageSends: [],
  29071. referencedClasses: []
  29072. }),
  29073. globals.LexicalScope);
  29074. smalltalk.addMethod(
  29075. smalltalk.method({
  29076. selector: "node:",
  29077. protocol: 'accessing',
  29078. fn: function (aNode){
  29079. var self=this;
  29080. self["@node"]=aNode;
  29081. return self},
  29082. args: ["aNode"],
  29083. source: "node: aNode\x0a\x09node := aNode",
  29084. messageSends: [],
  29085. referencedClasses: []
  29086. }),
  29087. globals.LexicalScope);
  29088. smalltalk.addMethod(
  29089. smalltalk.method({
  29090. selector: "outerScope",
  29091. protocol: 'accessing',
  29092. fn: function (){
  29093. var self=this;
  29094. var $1;
  29095. $1=self["@outerScope"];
  29096. return $1;
  29097. },
  29098. args: [],
  29099. source: "outerScope\x0a\x09^ outerScope",
  29100. messageSends: [],
  29101. referencedClasses: []
  29102. }),
  29103. globals.LexicalScope);
  29104. smalltalk.addMethod(
  29105. smalltalk.method({
  29106. selector: "outerScope:",
  29107. protocol: 'accessing',
  29108. fn: function (aLexicalScope){
  29109. var self=this;
  29110. self["@outerScope"]=aLexicalScope;
  29111. return self},
  29112. args: ["aLexicalScope"],
  29113. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  29114. messageSends: [],
  29115. referencedClasses: []
  29116. }),
  29117. globals.LexicalScope);
  29118. smalltalk.addMethod(
  29119. smalltalk.method({
  29120. selector: "pseudoVars",
  29121. protocol: 'accessing',
  29122. fn: function (){
  29123. var self=this;
  29124. return smalltalk.withContext(function($ctx1) {
  29125. var $1;
  29126. $1=_st(self._methodScope())._pseudoVars();
  29127. return $1;
  29128. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.LexicalScope)})},
  29129. args: [],
  29130. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  29131. messageSends: ["pseudoVars", "methodScope"],
  29132. referencedClasses: []
  29133. }),
  29134. globals.LexicalScope);
  29135. smalltalk.addMethod(
  29136. smalltalk.method({
  29137. selector: "scopeLevel",
  29138. protocol: 'accessing',
  29139. fn: function (){
  29140. var self=this;
  29141. return smalltalk.withContext(function($ctx1) {
  29142. var $1,$2,$4,$3,$5;
  29143. $1=self._outerScope();
  29144. $ctx1.sendIdx["outerScope"]=1;
  29145. if(($receiver = $1) == nil || $receiver == null){
  29146. return (1);
  29147. } else {
  29148. $1;
  29149. };
  29150. $2=self._isInlined();
  29151. if(smalltalk.assert($2)){
  29152. $4=self._outerScope();
  29153. $ctx1.sendIdx["outerScope"]=2;
  29154. $3=_st($4)._scopeLevel();
  29155. $ctx1.sendIdx["scopeLevel"]=1;
  29156. return $3;
  29157. };
  29158. $5=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  29159. return $5;
  29160. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},globals.LexicalScope)})},
  29161. args: [],
  29162. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  29163. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"],
  29164. referencedClasses: []
  29165. }),
  29166. globals.LexicalScope);
  29167. smalltalk.addMethod(
  29168. smalltalk.method({
  29169. selector: "temps",
  29170. protocol: 'accessing',
  29171. fn: function (){
  29172. var self=this;
  29173. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  29174. return smalltalk.withContext(function($ctx1) {
  29175. var $2,$1;
  29176. $2=self["@temps"];
  29177. if(($receiver = $2) == nil || $receiver == null){
  29178. self["@temps"]=_st($Dictionary())._new();
  29179. $1=self["@temps"];
  29180. } else {
  29181. $1=$2;
  29182. };
  29183. return $1;
  29184. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.LexicalScope)})},
  29185. args: [],
  29186. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  29187. messageSends: ["ifNil:", "new"],
  29188. referencedClasses: ["Dictionary"]
  29189. }),
  29190. globals.LexicalScope);
  29191. smalltalk.addClass('MethodLexicalScope', globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  29192. globals.MethodLexicalScope.comment="I represent a method scope.";
  29193. smalltalk.addMethod(
  29194. smalltalk.method({
  29195. selector: "addIVar:",
  29196. protocol: 'adding',
  29197. fn: function (aString){
  29198. var self=this;
  29199. function $InstanceVar(){return globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  29200. return smalltalk.withContext(function($ctx1) {
  29201. var $1;
  29202. $1=self._iVars();
  29203. $ctx1.sendIdx["iVars"]=1;
  29204. _st($1)._at_put_(aString,_st($InstanceVar())._on_(aString));
  29205. _st(_st(self._iVars())._at_(aString))._scope_(self);
  29206. return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},globals.MethodLexicalScope)})},
  29207. args: ["aString"],
  29208. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  29209. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"],
  29210. referencedClasses: ["InstanceVar"]
  29211. }),
  29212. globals.MethodLexicalScope);
  29213. smalltalk.addMethod(
  29214. smalltalk.method({
  29215. selector: "addNonLocalReturn:",
  29216. protocol: 'adding',
  29217. fn: function (aScope){
  29218. var self=this;
  29219. return smalltalk.withContext(function($ctx1) {
  29220. _st(self._nonLocalReturns())._add_(aScope);
  29221. return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
  29222. args: ["aScope"],
  29223. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  29224. messageSends: ["add:", "nonLocalReturns"],
  29225. referencedClasses: []
  29226. }),
  29227. globals.MethodLexicalScope);
  29228. smalltalk.addMethod(
  29229. smalltalk.method({
  29230. selector: "allVariableNames",
  29231. protocol: 'accessing',
  29232. fn: function (){
  29233. var self=this;
  29234. return smalltalk.withContext(function($ctx1) {
  29235. var $1;
  29236. $1=_st(globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(self._iVars())._keys());
  29237. return $1;
  29238. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.MethodLexicalScope)})},
  29239. args: [],
  29240. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  29241. messageSends: [",", "allVariableNames", "keys", "iVars"],
  29242. referencedClasses: []
  29243. }),
  29244. globals.MethodLexicalScope);
  29245. smalltalk.addMethod(
  29246. smalltalk.method({
  29247. selector: "bindingFor:",
  29248. protocol: 'accessing',
  29249. fn: function (aNode){
  29250. var self=this;
  29251. return smalltalk.withContext(function($ctx1) {
  29252. var $2,$1;
  29253. $2=globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
  29254. if(($receiver = $2) == nil || $receiver == null){
  29255. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  29256. return nil;
  29257. }));
  29258. } else {
  29259. $1=$2;
  29260. };
  29261. return $1;
  29262. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},globals.MethodLexicalScope)})},
  29263. args: ["aNode"],
  29264. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  29265. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"],
  29266. referencedClasses: []
  29267. }),
  29268. globals.MethodLexicalScope);
  29269. smalltalk.addMethod(
  29270. smalltalk.method({
  29271. selector: "canInlineNonLocalReturns",
  29272. protocol: 'testing',
  29273. fn: function (){
  29274. var self=this;
  29275. return true;
  29276. },
  29277. args: [],
  29278. source: "canInlineNonLocalReturns\x0a\x09^ true",
  29279. messageSends: [],
  29280. referencedClasses: []
  29281. }),
  29282. globals.MethodLexicalScope);
  29283. smalltalk.addMethod(
  29284. smalltalk.method({
  29285. selector: "hasLocalReturn",
  29286. protocol: 'testing',
  29287. fn: function (){
  29288. var self=this;
  29289. return smalltalk.withContext(function($ctx1) {
  29290. var $1;
  29291. $1=self._localReturn();
  29292. return $1;
  29293. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},globals.MethodLexicalScope)})},
  29294. args: [],
  29295. source: "hasLocalReturn\x0a\x09^ self localReturn",
  29296. messageSends: ["localReturn"],
  29297. referencedClasses: []
  29298. }),
  29299. globals.MethodLexicalScope);
  29300. smalltalk.addMethod(
  29301. smalltalk.method({
  29302. selector: "hasNonLocalReturn",
  29303. protocol: 'testing',
  29304. fn: function (){
  29305. var self=this;
  29306. return smalltalk.withContext(function($ctx1) {
  29307. var $1;
  29308. $1=_st(self._nonLocalReturns())._notEmpty();
  29309. return $1;
  29310. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},globals.MethodLexicalScope)})},
  29311. args: [],
  29312. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  29313. messageSends: ["notEmpty", "nonLocalReturns"],
  29314. referencedClasses: []
  29315. }),
  29316. globals.MethodLexicalScope);
  29317. smalltalk.addMethod(
  29318. smalltalk.method({
  29319. selector: "iVars",
  29320. protocol: 'accessing',
  29321. fn: function (){
  29322. var self=this;
  29323. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  29324. return smalltalk.withContext(function($ctx1) {
  29325. var $2,$1;
  29326. $2=self["@iVars"];
  29327. if(($receiver = $2) == nil || $receiver == null){
  29328. self["@iVars"]=_st($Dictionary())._new();
  29329. $1=self["@iVars"];
  29330. } else {
  29331. $1=$2;
  29332. };
  29333. return $1;
  29334. }, function($ctx1) {$ctx1.fill(self,"iVars",{},globals.MethodLexicalScope)})},
  29335. args: [],
  29336. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  29337. messageSends: ["ifNil:", "new"],
  29338. referencedClasses: ["Dictionary"]
  29339. }),
  29340. globals.MethodLexicalScope);
  29341. smalltalk.addMethod(
  29342. smalltalk.method({
  29343. selector: "isMethodScope",
  29344. protocol: 'testing',
  29345. fn: function (){
  29346. var self=this;
  29347. return true;
  29348. },
  29349. args: [],
  29350. source: "isMethodScope\x0a\x09^ true",
  29351. messageSends: [],
  29352. referencedClasses: []
  29353. }),
  29354. globals.MethodLexicalScope);
  29355. smalltalk.addMethod(
  29356. smalltalk.method({
  29357. selector: "localReturn",
  29358. protocol: 'accessing',
  29359. fn: function (){
  29360. var self=this;
  29361. return smalltalk.withContext(function($ctx1) {
  29362. var $2,$1;
  29363. $2=self["@localReturn"];
  29364. if(($receiver = $2) == nil || $receiver == null){
  29365. $1=false;
  29366. } else {
  29367. $1=$2;
  29368. };
  29369. return $1;
  29370. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},globals.MethodLexicalScope)})},
  29371. args: [],
  29372. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  29373. messageSends: ["ifNil:"],
  29374. referencedClasses: []
  29375. }),
  29376. globals.MethodLexicalScope);
  29377. smalltalk.addMethod(
  29378. smalltalk.method({
  29379. selector: "localReturn:",
  29380. protocol: 'accessing',
  29381. fn: function (aBoolean){
  29382. var self=this;
  29383. self["@localReturn"]=aBoolean;
  29384. return self},
  29385. args: ["aBoolean"],
  29386. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  29387. messageSends: [],
  29388. referencedClasses: []
  29389. }),
  29390. globals.MethodLexicalScope);
  29391. smalltalk.addMethod(
  29392. smalltalk.method({
  29393. selector: "methodScope",
  29394. protocol: 'accessing',
  29395. fn: function (){
  29396. var self=this;
  29397. return self;
  29398. },
  29399. args: [],
  29400. source: "methodScope\x0a\x09^ self",
  29401. messageSends: [],
  29402. referencedClasses: []
  29403. }),
  29404. globals.MethodLexicalScope);
  29405. smalltalk.addMethod(
  29406. smalltalk.method({
  29407. selector: "nonLocalReturns",
  29408. protocol: 'accessing',
  29409. fn: function (){
  29410. var self=this;
  29411. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29412. return smalltalk.withContext(function($ctx1) {
  29413. var $2,$1;
  29414. $2=self["@nonLocalReturns"];
  29415. if(($receiver = $2) == nil || $receiver == null){
  29416. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  29417. $1=self["@nonLocalReturns"];
  29418. } else {
  29419. $1=$2;
  29420. };
  29421. return $1;
  29422. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},globals.MethodLexicalScope)})},
  29423. args: [],
  29424. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  29425. messageSends: ["ifNil:", "new"],
  29426. referencedClasses: ["OrderedCollection"]
  29427. }),
  29428. globals.MethodLexicalScope);
  29429. smalltalk.addMethod(
  29430. smalltalk.method({
  29431. selector: "pseudoVars",
  29432. protocol: 'accessing',
  29433. fn: function (){
  29434. var self=this;
  29435. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  29436. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29437. function $PseudoVar(){return globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  29438. return smalltalk.withContext(function($ctx1) {
  29439. var $1,$2,$3,$4;
  29440. $1=self["@pseudoVars"];
  29441. if(($receiver = $1) == nil || $receiver == null){
  29442. self["@pseudoVars"]=_st($Dictionary())._new();
  29443. self["@pseudoVars"];
  29444. _st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
  29445. return smalltalk.withContext(function($ctx2) {
  29446. $2=_st($PseudoVar())._on_(each);
  29447. _st($2)._scope_(self._methodScope());
  29448. $3=_st($2)._yourself();
  29449. return _st(self["@pseudoVars"])._at_put_(each,$3);
  29450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29451. } else {
  29452. $1;
  29453. };
  29454. $4=self["@pseudoVars"];
  29455. return $4;
  29456. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.MethodLexicalScope)})},
  29457. args: [],
  29458. 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",
  29459. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"],
  29460. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"]
  29461. }),
  29462. globals.MethodLexicalScope);
  29463. smalltalk.addMethod(
  29464. smalltalk.method({
  29465. selector: "removeNonLocalReturn:",
  29466. protocol: 'adding',
  29467. fn: function (aScope){
  29468. var self=this;
  29469. return smalltalk.withContext(function($ctx1) {
  29470. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  29471. }));
  29472. return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
  29473. args: ["aScope"],
  29474. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  29475. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  29476. referencedClasses: []
  29477. }),
  29478. globals.MethodLexicalScope);
  29479. smalltalk.addMethod(
  29480. smalltalk.method({
  29481. selector: "unknownVariables",
  29482. protocol: 'accessing',
  29483. fn: function (){
  29484. var self=this;
  29485. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29486. return smalltalk.withContext(function($ctx1) {
  29487. var $2,$1;
  29488. $2=self["@unknownVariables"];
  29489. if(($receiver = $2) == nil || $receiver == null){
  29490. self["@unknownVariables"]=_st($OrderedCollection())._new();
  29491. $1=self["@unknownVariables"];
  29492. } else {
  29493. $1=$2;
  29494. };
  29495. return $1;
  29496. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},globals.MethodLexicalScope)})},
  29497. args: [],
  29498. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  29499. messageSends: ["ifNil:", "new"],
  29500. referencedClasses: ["OrderedCollection"]
  29501. }),
  29502. globals.MethodLexicalScope);
  29503. smalltalk.addClass('ScopeVar', globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  29504. 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.";
  29505. smalltalk.addMethod(
  29506. smalltalk.method({
  29507. selector: "alias",
  29508. protocol: 'accessing',
  29509. fn: function (){
  29510. var self=this;
  29511. return smalltalk.withContext(function($ctx1) {
  29512. var $1;
  29513. $1=_st(self._name())._asVariableName();
  29514. return $1;
  29515. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ScopeVar)})},
  29516. args: [],
  29517. source: "alias\x0a\x09^ self name asVariableName",
  29518. messageSends: ["asVariableName", "name"],
  29519. referencedClasses: []
  29520. }),
  29521. globals.ScopeVar);
  29522. smalltalk.addMethod(
  29523. smalltalk.method({
  29524. selector: "isArgVar",
  29525. protocol: 'testing',
  29526. fn: function (){
  29527. var self=this;
  29528. return false;
  29529. },
  29530. args: [],
  29531. source: "isArgVar\x0a\x09^ false",
  29532. messageSends: [],
  29533. referencedClasses: []
  29534. }),
  29535. globals.ScopeVar);
  29536. smalltalk.addMethod(
  29537. smalltalk.method({
  29538. selector: "isClassRefVar",
  29539. protocol: 'testing',
  29540. fn: function (){
  29541. var self=this;
  29542. return false;
  29543. },
  29544. args: [],
  29545. source: "isClassRefVar\x0a\x09^ false",
  29546. messageSends: [],
  29547. referencedClasses: []
  29548. }),
  29549. globals.ScopeVar);
  29550. smalltalk.addMethod(
  29551. smalltalk.method({
  29552. selector: "isImmutable",
  29553. protocol: 'testing',
  29554. fn: function (){
  29555. var self=this;
  29556. return false;
  29557. },
  29558. args: [],
  29559. source: "isImmutable\x0a\x09^ false",
  29560. messageSends: [],
  29561. referencedClasses: []
  29562. }),
  29563. globals.ScopeVar);
  29564. smalltalk.addMethod(
  29565. smalltalk.method({
  29566. selector: "isInstanceVar",
  29567. protocol: 'testing',
  29568. fn: function (){
  29569. var self=this;
  29570. return false;
  29571. },
  29572. args: [],
  29573. source: "isInstanceVar\x0a\x09^ false",
  29574. messageSends: [],
  29575. referencedClasses: []
  29576. }),
  29577. globals.ScopeVar);
  29578. smalltalk.addMethod(
  29579. smalltalk.method({
  29580. selector: "isPseudoVar",
  29581. protocol: 'testing',
  29582. fn: function (){
  29583. var self=this;
  29584. return false;
  29585. },
  29586. args: [],
  29587. source: "isPseudoVar\x0a\x09^ false",
  29588. messageSends: [],
  29589. referencedClasses: []
  29590. }),
  29591. globals.ScopeVar);
  29592. smalltalk.addMethod(
  29593. smalltalk.method({
  29594. selector: "isTempVar",
  29595. protocol: 'testing',
  29596. fn: function (){
  29597. var self=this;
  29598. return false;
  29599. },
  29600. args: [],
  29601. source: "isTempVar\x0a\x09^ false",
  29602. messageSends: [],
  29603. referencedClasses: []
  29604. }),
  29605. globals.ScopeVar);
  29606. smalltalk.addMethod(
  29607. smalltalk.method({
  29608. selector: "isUnknownVar",
  29609. protocol: 'testing',
  29610. fn: function (){
  29611. var self=this;
  29612. return false;
  29613. },
  29614. args: [],
  29615. source: "isUnknownVar\x0a\x09^ false",
  29616. messageSends: [],
  29617. referencedClasses: []
  29618. }),
  29619. globals.ScopeVar);
  29620. smalltalk.addMethod(
  29621. smalltalk.method({
  29622. selector: "name",
  29623. protocol: 'accessing',
  29624. fn: function (){
  29625. var self=this;
  29626. var $1;
  29627. $1=self["@name"];
  29628. return $1;
  29629. },
  29630. args: [],
  29631. source: "name\x0a\x09^ name",
  29632. messageSends: [],
  29633. referencedClasses: []
  29634. }),
  29635. globals.ScopeVar);
  29636. smalltalk.addMethod(
  29637. smalltalk.method({
  29638. selector: "name:",
  29639. protocol: 'accessing',
  29640. fn: function (aString){
  29641. var self=this;
  29642. self["@name"]=aString;
  29643. return self},
  29644. args: ["aString"],
  29645. source: "name: aString\x0a\x09name := aString",
  29646. messageSends: [],
  29647. referencedClasses: []
  29648. }),
  29649. globals.ScopeVar);
  29650. smalltalk.addMethod(
  29651. smalltalk.method({
  29652. selector: "scope",
  29653. protocol: 'accessing',
  29654. fn: function (){
  29655. var self=this;
  29656. var $1;
  29657. $1=self["@scope"];
  29658. return $1;
  29659. },
  29660. args: [],
  29661. source: "scope\x0a\x09^ scope",
  29662. messageSends: [],
  29663. referencedClasses: []
  29664. }),
  29665. globals.ScopeVar);
  29666. smalltalk.addMethod(
  29667. smalltalk.method({
  29668. selector: "scope:",
  29669. protocol: 'accessing',
  29670. fn: function (aScope){
  29671. var self=this;
  29672. self["@scope"]=aScope;
  29673. return self},
  29674. args: ["aScope"],
  29675. source: "scope: aScope\x0a\x09scope := aScope",
  29676. messageSends: [],
  29677. referencedClasses: []
  29678. }),
  29679. globals.ScopeVar);
  29680. smalltalk.addMethod(
  29681. smalltalk.method({
  29682. selector: "validateAssignment",
  29683. protocol: 'testing',
  29684. fn: function (){
  29685. var self=this;
  29686. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  29687. return smalltalk.withContext(function($ctx1) {
  29688. var $1,$2,$3;
  29689. $1=_st(self._isArgVar())._or_((function(){
  29690. return smalltalk.withContext(function($ctx2) {
  29691. return self._isPseudoVar();
  29692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  29693. if(smalltalk.assert($1)){
  29694. $2=_st($InvalidAssignmentError())._new();
  29695. _st($2)._variableName_(self._name());
  29696. $3=_st($2)._signal();
  29697. $3;
  29698. };
  29699. return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},globals.ScopeVar)})},
  29700. args: [],
  29701. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  29702. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"],
  29703. referencedClasses: ["InvalidAssignmentError"]
  29704. }),
  29705. globals.ScopeVar);
  29706. smalltalk.addMethod(
  29707. smalltalk.method({
  29708. selector: "on:",
  29709. protocol: 'instance creation',
  29710. fn: function (aString){
  29711. var self=this;
  29712. return smalltalk.withContext(function($ctx1) {
  29713. var $2,$3,$1;
  29714. $2=self._new();
  29715. _st($2)._name_(aString);
  29716. $3=_st($2)._yourself();
  29717. $1=$3;
  29718. return $1;
  29719. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},globals.ScopeVar.klass)})},
  29720. args: ["aString"],
  29721. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  29722. messageSends: ["name:", "new", "yourself"],
  29723. referencedClasses: []
  29724. }),
  29725. globals.ScopeVar.klass);
  29726. smalltalk.addClass('AliasVar', globals.ScopeVar, ['node'], 'Compiler-Semantic');
  29727. globals.AliasVar.comment="I am an internally defined variable by the compiler";
  29728. smalltalk.addMethod(
  29729. smalltalk.method({
  29730. selector: "node",
  29731. protocol: 'accessing',
  29732. fn: function (){
  29733. var self=this;
  29734. var $1;
  29735. $1=self["@node"];
  29736. return $1;
  29737. },
  29738. args: [],
  29739. source: "node\x0a\x09^ node",
  29740. messageSends: [],
  29741. referencedClasses: []
  29742. }),
  29743. globals.AliasVar);
  29744. smalltalk.addMethod(
  29745. smalltalk.method({
  29746. selector: "node:",
  29747. protocol: 'accessing',
  29748. fn: function (aNode){
  29749. var self=this;
  29750. self["@node"]=aNode;
  29751. return self},
  29752. args: ["aNode"],
  29753. source: "node: aNode\x0a\x09node := aNode",
  29754. messageSends: [],
  29755. referencedClasses: []
  29756. }),
  29757. globals.AliasVar);
  29758. smalltalk.addClass('ArgVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29759. globals.ArgVar.comment="I am an argument of a method or block.";
  29760. smalltalk.addMethod(
  29761. smalltalk.method({
  29762. selector: "isArgVar",
  29763. protocol: 'testing',
  29764. fn: function (){
  29765. var self=this;
  29766. return true;
  29767. },
  29768. args: [],
  29769. source: "isArgVar\x0a\x09^ true",
  29770. messageSends: [],
  29771. referencedClasses: []
  29772. }),
  29773. globals.ArgVar);
  29774. smalltalk.addMethod(
  29775. smalltalk.method({
  29776. selector: "isImmutable",
  29777. protocol: 'testing',
  29778. fn: function (){
  29779. var self=this;
  29780. return true;
  29781. },
  29782. args: [],
  29783. source: "isImmutable\x0a\x09^ true",
  29784. messageSends: [],
  29785. referencedClasses: []
  29786. }),
  29787. globals.ArgVar);
  29788. smalltalk.addClass('ClassRefVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29789. globals.ClassRefVar.comment="I am an class reference variable";
  29790. smalltalk.addMethod(
  29791. smalltalk.method({
  29792. selector: "alias",
  29793. protocol: 'accessing',
  29794. fn: function (){
  29795. var self=this;
  29796. return smalltalk.withContext(function($ctx1) {
  29797. var $1;
  29798. $1=_st("$".__comma(self._name())).__comma("()");
  29799. $ctx1.sendIdx[","]=1;
  29800. return $1;
  29801. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ClassRefVar)})},
  29802. args: [],
  29803. 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^ '$', self name, '()'",
  29804. messageSends: [",", "name"],
  29805. referencedClasses: []
  29806. }),
  29807. globals.ClassRefVar);
  29808. smalltalk.addMethod(
  29809. smalltalk.method({
  29810. selector: "isClassRefVar",
  29811. protocol: 'testing',
  29812. fn: function (){
  29813. var self=this;
  29814. return true;
  29815. },
  29816. args: [],
  29817. source: "isClassRefVar\x0a\x09^ true",
  29818. messageSends: [],
  29819. referencedClasses: []
  29820. }),
  29821. globals.ClassRefVar);
  29822. smalltalk.addMethod(
  29823. smalltalk.method({
  29824. selector: "isImmutable",
  29825. protocol: 'testing',
  29826. fn: function (){
  29827. var self=this;
  29828. return true;
  29829. },
  29830. args: [],
  29831. source: "isImmutable\x0a\x09^ true",
  29832. messageSends: [],
  29833. referencedClasses: []
  29834. }),
  29835. globals.ClassRefVar);
  29836. smalltalk.addClass('InstanceVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29837. globals.InstanceVar.comment="I am an instance variable of a method or block.";
  29838. smalltalk.addMethod(
  29839. smalltalk.method({
  29840. selector: "alias",
  29841. protocol: 'testing',
  29842. fn: function (){
  29843. var self=this;
  29844. return smalltalk.withContext(function($ctx1) {
  29845. var $1;
  29846. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  29847. $ctx1.sendIdx[","]=1;
  29848. return $1;
  29849. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.InstanceVar)})},
  29850. args: [],
  29851. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  29852. messageSends: [",", "name"],
  29853. referencedClasses: []
  29854. }),
  29855. globals.InstanceVar);
  29856. smalltalk.addMethod(
  29857. smalltalk.method({
  29858. selector: "isInstanceVar",
  29859. protocol: 'testing',
  29860. fn: function (){
  29861. var self=this;
  29862. return true;
  29863. },
  29864. args: [],
  29865. source: "isInstanceVar\x0a\x09^ true",
  29866. messageSends: [],
  29867. referencedClasses: []
  29868. }),
  29869. globals.InstanceVar);
  29870. smalltalk.addClass('PseudoVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29871. globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  29872. smalltalk.addMethod(
  29873. smalltalk.method({
  29874. selector: "alias",
  29875. protocol: 'accessing',
  29876. fn: function (){
  29877. var self=this;
  29878. return smalltalk.withContext(function($ctx1) {
  29879. var $1;
  29880. $1=self._name();
  29881. return $1;
  29882. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.PseudoVar)})},
  29883. args: [],
  29884. source: "alias\x0a\x09^ self name",
  29885. messageSends: ["name"],
  29886. referencedClasses: []
  29887. }),
  29888. globals.PseudoVar);
  29889. smalltalk.addMethod(
  29890. smalltalk.method({
  29891. selector: "isImmutable",
  29892. protocol: 'testing',
  29893. fn: function (){
  29894. var self=this;
  29895. return true;
  29896. },
  29897. args: [],
  29898. source: "isImmutable\x0a\x09^ true",
  29899. messageSends: [],
  29900. referencedClasses: []
  29901. }),
  29902. globals.PseudoVar);
  29903. smalltalk.addMethod(
  29904. smalltalk.method({
  29905. selector: "isPseudoVar",
  29906. protocol: 'testing',
  29907. fn: function (){
  29908. var self=this;
  29909. return true;
  29910. },
  29911. args: [],
  29912. source: "isPseudoVar\x0a\x09^ true",
  29913. messageSends: [],
  29914. referencedClasses: []
  29915. }),
  29916. globals.PseudoVar);
  29917. smalltalk.addClass('TempVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29918. globals.TempVar.comment="I am an temporary variable of a method or block.";
  29919. smalltalk.addMethod(
  29920. smalltalk.method({
  29921. selector: "isTempVar",
  29922. protocol: 'testing',
  29923. fn: function (){
  29924. var self=this;
  29925. return true;
  29926. },
  29927. args: [],
  29928. source: "isTempVar\x0a\x09^ true",
  29929. messageSends: [],
  29930. referencedClasses: []
  29931. }),
  29932. globals.TempVar);
  29933. smalltalk.addClass('UnknownVar', globals.ScopeVar, [], 'Compiler-Semantic');
  29934. globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  29935. smalltalk.addMethod(
  29936. smalltalk.method({
  29937. selector: "isUnknownVar",
  29938. protocol: 'testing',
  29939. fn: function (){
  29940. var self=this;
  29941. return true;
  29942. },
  29943. args: [],
  29944. source: "isUnknownVar\x0a\x09^ true",
  29945. messageSends: [],
  29946. referencedClasses: []
  29947. }),
  29948. globals.UnknownVar);
  29949. smalltalk.addClass('SemanticAnalyzer', globals.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  29950. globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  29951. smalltalk.addMethod(
  29952. smalltalk.method({
  29953. selector: "classReferences",
  29954. protocol: 'accessing',
  29955. fn: function (){
  29956. var self=this;
  29957. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  29958. return smalltalk.withContext(function($ctx1) {
  29959. var $2,$1;
  29960. $2=self["@classReferences"];
  29961. if(($receiver = $2) == nil || $receiver == null){
  29962. self["@classReferences"]=_st($Set())._new();
  29963. $1=self["@classReferences"];
  29964. } else {
  29965. $1=$2;
  29966. };
  29967. return $1;
  29968. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},globals.SemanticAnalyzer)})},
  29969. args: [],
  29970. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  29971. messageSends: ["ifNil:", "new"],
  29972. referencedClasses: ["Set"]
  29973. }),
  29974. globals.SemanticAnalyzer);
  29975. smalltalk.addMethod(
  29976. smalltalk.method({
  29977. selector: "errorShadowingVariable:",
  29978. protocol: 'error handling',
  29979. fn: function (aString){
  29980. var self=this;
  29981. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  29982. return smalltalk.withContext(function($ctx1) {
  29983. var $1,$2;
  29984. $1=_st($ShadowingVariableError())._new();
  29985. _st($1)._variableName_(aString);
  29986. $2=_st($1)._signal();
  29987. return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},globals.SemanticAnalyzer)})},
  29988. args: ["aString"],
  29989. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  29990. messageSends: ["variableName:", "new", "signal"],
  29991. referencedClasses: ["ShadowingVariableError"]
  29992. }),
  29993. globals.SemanticAnalyzer);
  29994. smalltalk.addMethod(
  29995. smalltalk.method({
  29996. selector: "errorUnknownVariable:",
  29997. protocol: 'error handling',
  29998. fn: function (aNode){
  29999. var self=this;
  30000. var identifier;
  30001. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30002. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  30003. return smalltalk.withContext(function($ctx1) {
  30004. var $1,$2,$3,$4,$5;
  30005. identifier=_st(aNode)._value();
  30006. $ctx1.sendIdx["value"]=1;
  30007. $1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  30008. return smalltalk.withContext(function($ctx2) {
  30009. return self._isVariableGloballyUndefined_(identifier);
  30010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30011. if(smalltalk.assert($1)){
  30012. $2=_st($UnknownVariableError())._new();
  30013. $3=$2;
  30014. $4=_st(aNode)._value();
  30015. $ctx1.sendIdx["value"]=2;
  30016. _st($3)._variableName_($4);
  30017. $5=_st($2)._signal();
  30018. $5;
  30019. } else {
  30020. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  30021. };
  30022. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},globals.SemanticAnalyzer)})},
  30023. args: ["aNode"],
  30024. 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: `jQuery`, `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 isVariableGloballyUndefined: identifier ])\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 ]",
  30025. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
  30026. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  30027. }),
  30028. globals.SemanticAnalyzer);
  30029. smalltalk.addMethod(
  30030. smalltalk.method({
  30031. selector: "isVariableGloballyUndefined:",
  30032. protocol: 'testing',
  30033. fn: function (aString){
  30034. var self=this;
  30035. return smalltalk.withContext(function($ctx1) {
  30036. return eval('typeof ' + aString + ' == "undefined"');
  30037. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},globals.SemanticAnalyzer)})},
  30038. args: ["aString"],
  30039. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  30040. messageSends: [],
  30041. referencedClasses: []
  30042. }),
  30043. globals.SemanticAnalyzer);
  30044. smalltalk.addMethod(
  30045. smalltalk.method({
  30046. selector: "messageSends",
  30047. protocol: 'accessing',
  30048. fn: function (){
  30049. var self=this;
  30050. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30051. return smalltalk.withContext(function($ctx1) {
  30052. var $2,$1;
  30053. $2=self["@messageSends"];
  30054. if(($receiver = $2) == nil || $receiver == null){
  30055. self["@messageSends"]=_st($Dictionary())._new();
  30056. $1=self["@messageSends"];
  30057. } else {
  30058. $1=$2;
  30059. };
  30060. return $1;
  30061. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.SemanticAnalyzer)})},
  30062. args: [],
  30063. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  30064. messageSends: ["ifNil:", "new"],
  30065. referencedClasses: ["Dictionary"]
  30066. }),
  30067. globals.SemanticAnalyzer);
  30068. smalltalk.addMethod(
  30069. smalltalk.method({
  30070. selector: "newBlockScope",
  30071. protocol: 'factory',
  30072. fn: function (){
  30073. var self=this;
  30074. function $LexicalScope(){return globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  30075. return smalltalk.withContext(function($ctx1) {
  30076. var $1;
  30077. $1=self._newScopeOfClass_($LexicalScope());
  30078. return $1;
  30079. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},globals.SemanticAnalyzer)})},
  30080. args: [],
  30081. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  30082. messageSends: ["newScopeOfClass:"],
  30083. referencedClasses: ["LexicalScope"]
  30084. }),
  30085. globals.SemanticAnalyzer);
  30086. smalltalk.addMethod(
  30087. smalltalk.method({
  30088. selector: "newMethodScope",
  30089. protocol: 'factory',
  30090. fn: function (){
  30091. var self=this;
  30092. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  30093. return smalltalk.withContext(function($ctx1) {
  30094. var $1;
  30095. $1=self._newScopeOfClass_($MethodLexicalScope());
  30096. return $1;
  30097. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},globals.SemanticAnalyzer)})},
  30098. args: [],
  30099. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  30100. messageSends: ["newScopeOfClass:"],
  30101. referencedClasses: ["MethodLexicalScope"]
  30102. }),
  30103. globals.SemanticAnalyzer);
  30104. smalltalk.addMethod(
  30105. smalltalk.method({
  30106. selector: "newScopeOfClass:",
  30107. protocol: 'factory',
  30108. fn: function (aLexicalScopeClass){
  30109. var self=this;
  30110. return smalltalk.withContext(function($ctx1) {
  30111. var $2,$3,$1;
  30112. $2=_st(aLexicalScopeClass)._new();
  30113. _st($2)._outerScope_(self["@currentScope"]);
  30114. $3=_st($2)._yourself();
  30115. $1=$3;
  30116. return $1;
  30117. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},globals.SemanticAnalyzer)})},
  30118. args: ["aLexicalScopeClass"],
  30119. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  30120. messageSends: ["outerScope:", "new", "yourself"],
  30121. referencedClasses: []
  30122. }),
  30123. globals.SemanticAnalyzer);
  30124. smalltalk.addMethod(
  30125. smalltalk.method({
  30126. selector: "nextBlockIndex",
  30127. protocol: 'private',
  30128. fn: function (){
  30129. var self=this;
  30130. return smalltalk.withContext(function($ctx1) {
  30131. var $1,$2;
  30132. $1=self["@blockIndex"];
  30133. if(($receiver = $1) == nil || $receiver == null){
  30134. self["@blockIndex"]=(0);
  30135. self["@blockIndex"];
  30136. } else {
  30137. $1;
  30138. };
  30139. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  30140. $2=self["@blockIndex"];
  30141. return $2;
  30142. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},globals.SemanticAnalyzer)})},
  30143. args: [],
  30144. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  30145. messageSends: ["ifNil:", "+"],
  30146. referencedClasses: []
  30147. }),
  30148. globals.SemanticAnalyzer);
  30149. smalltalk.addMethod(
  30150. smalltalk.method({
  30151. selector: "popScope",
  30152. protocol: 'scope',
  30153. fn: function (){
  30154. var self=this;
  30155. return smalltalk.withContext(function($ctx1) {
  30156. var $1;
  30157. $1=self["@currentScope"];
  30158. if(($receiver = $1) == nil || $receiver == null){
  30159. $1;
  30160. } else {
  30161. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  30162. self["@currentScope"];
  30163. };
  30164. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},globals.SemanticAnalyzer)})},
  30165. args: [],
  30166. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  30167. messageSends: ["ifNotNil:", "outerScope"],
  30168. referencedClasses: []
  30169. }),
  30170. globals.SemanticAnalyzer);
  30171. smalltalk.addMethod(
  30172. smalltalk.method({
  30173. selector: "pushScope:",
  30174. protocol: 'scope',
  30175. fn: function (aScope){
  30176. var self=this;
  30177. return smalltalk.withContext(function($ctx1) {
  30178. _st(aScope)._outerScope_(self["@currentScope"]);
  30179. self["@currentScope"]=aScope;
  30180. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},globals.SemanticAnalyzer)})},
  30181. args: ["aScope"],
  30182. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  30183. messageSends: ["outerScope:"],
  30184. referencedClasses: []
  30185. }),
  30186. globals.SemanticAnalyzer);
  30187. smalltalk.addMethod(
  30188. smalltalk.method({
  30189. selector: "superSends",
  30190. protocol: 'accessing',
  30191. fn: function (){
  30192. var self=this;
  30193. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30194. return smalltalk.withContext(function($ctx1) {
  30195. var $2,$1;
  30196. $2=self["@superSends"];
  30197. if(($receiver = $2) == nil || $receiver == null){
  30198. self["@superSends"]=_st($Dictionary())._new();
  30199. $1=self["@superSends"];
  30200. } else {
  30201. $1=$2;
  30202. };
  30203. return $1;
  30204. }, function($ctx1) {$ctx1.fill(self,"superSends",{},globals.SemanticAnalyzer)})},
  30205. args: [],
  30206. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  30207. messageSends: ["ifNil:", "new"],
  30208. referencedClasses: ["Dictionary"]
  30209. }),
  30210. globals.SemanticAnalyzer);
  30211. smalltalk.addMethod(
  30212. smalltalk.method({
  30213. selector: "theClass",
  30214. protocol: 'accessing',
  30215. fn: function (){
  30216. var self=this;
  30217. var $1;
  30218. $1=self["@theClass"];
  30219. return $1;
  30220. },
  30221. args: [],
  30222. source: "theClass\x0a\x09^ theClass",
  30223. messageSends: [],
  30224. referencedClasses: []
  30225. }),
  30226. globals.SemanticAnalyzer);
  30227. smalltalk.addMethod(
  30228. smalltalk.method({
  30229. selector: "theClass:",
  30230. protocol: 'accessing',
  30231. fn: function (aClass){
  30232. var self=this;
  30233. self["@theClass"]=aClass;
  30234. return self},
  30235. args: ["aClass"],
  30236. source: "theClass: aClass\x0a\x09theClass := aClass",
  30237. messageSends: [],
  30238. referencedClasses: []
  30239. }),
  30240. globals.SemanticAnalyzer);
  30241. smalltalk.addMethod(
  30242. smalltalk.method({
  30243. selector: "validateVariableScope:",
  30244. protocol: 'scope',
  30245. fn: function (aString){
  30246. var self=this;
  30247. return smalltalk.withContext(function($ctx1) {
  30248. var $1;
  30249. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  30250. if(($receiver = $1) == nil || $receiver == null){
  30251. $1;
  30252. } else {
  30253. self._errorShadowingVariable_(aString);
  30254. };
  30255. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},globals.SemanticAnalyzer)})},
  30256. args: ["aString"],
  30257. 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 ]",
  30258. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"],
  30259. referencedClasses: []
  30260. }),
  30261. globals.SemanticAnalyzer);
  30262. smalltalk.addMethod(
  30263. smalltalk.method({
  30264. selector: "visitAssignmentNode:",
  30265. protocol: 'visiting',
  30266. fn: function (aNode){
  30267. var self=this;
  30268. return smalltalk.withContext(function($ctx1) {
  30269. globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  30270. _st(_st(aNode)._left())._beAssigned();
  30271. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30272. args: ["aNode"],
  30273. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  30274. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  30275. referencedClasses: []
  30276. }),
  30277. globals.SemanticAnalyzer);
  30278. smalltalk.addMethod(
  30279. smalltalk.method({
  30280. selector: "visitBlockNode:",
  30281. protocol: 'visiting',
  30282. fn: function (aNode){
  30283. var self=this;
  30284. return smalltalk.withContext(function($ctx1) {
  30285. self._pushScope_(self._newBlockScope());
  30286. _st(aNode)._scope_(self["@currentScope"]);
  30287. _st(self["@currentScope"])._node_(aNode);
  30288. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  30289. _st(_st(aNode)._parameters())._do_((function(each){
  30290. return smalltalk.withContext(function($ctx2) {
  30291. self._validateVariableScope_(each);
  30292. return _st(self["@currentScope"])._addArg_(each);
  30293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  30294. globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  30295. self._popScope();
  30296. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30297. args: ["aNode"],
  30298. 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",
  30299. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"],
  30300. referencedClasses: []
  30301. }),
  30302. globals.SemanticAnalyzer);
  30303. smalltalk.addMethod(
  30304. smalltalk.method({
  30305. selector: "visitCascadeNode:",
  30306. protocol: 'visiting',
  30307. fn: function (aNode){
  30308. var self=this;
  30309. return smalltalk.withContext(function($ctx1) {
  30310. var $3,$2,$1;
  30311. globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  30312. $3=_st(aNode)._nodes();
  30313. $ctx1.sendIdx["nodes"]=1;
  30314. $2=_st($3)._first();
  30315. $1=_st($2)._superSend();
  30316. if(smalltalk.assert($1)){
  30317. _st(_st(aNode)._nodes())._do_((function(each){
  30318. return smalltalk.withContext(function($ctx2) {
  30319. return _st(each)._superSend_(true);
  30320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  30321. };
  30322. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30323. args: ["aNode"],
  30324. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  30325. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"],
  30326. referencedClasses: []
  30327. }),
  30328. globals.SemanticAnalyzer);
  30329. smalltalk.addMethod(
  30330. smalltalk.method({
  30331. selector: "visitMethodNode:",
  30332. protocol: 'visiting',
  30333. fn: function (aNode){
  30334. var self=this;
  30335. return smalltalk.withContext(function($ctx1) {
  30336. var $1;
  30337. self._pushScope_(self._newMethodScope());
  30338. _st(aNode)._scope_(self["@currentScope"]);
  30339. _st(self["@currentScope"])._node_(aNode);
  30340. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  30341. return smalltalk.withContext(function($ctx2) {
  30342. return _st(self["@currentScope"])._addIVar_(each);
  30343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  30344. $ctx1.sendIdx["do:"]=1;
  30345. _st(_st(aNode)._arguments())._do_((function(each){
  30346. return smalltalk.withContext(function($ctx2) {
  30347. self._validateVariableScope_(each);
  30348. return _st(self["@currentScope"])._addArg_(each);
  30349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  30350. globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  30351. _st(aNode)._classReferences_(self._classReferences());
  30352. _st(aNode)._sendIndexes_(self._messageSends());
  30353. $1=_st(aNode)._superSends_(_st(self._superSends())._keys());
  30354. self._popScope();
  30355. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30356. args: ["aNode"],
  30357. 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\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  30358. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"],
  30359. referencedClasses: []
  30360. }),
  30361. globals.SemanticAnalyzer);
  30362. smalltalk.addMethod(
  30363. smalltalk.method({
  30364. selector: "visitReturnNode:",
  30365. protocol: 'visiting',
  30366. fn: function (aNode){
  30367. var self=this;
  30368. return smalltalk.withContext(function($ctx1) {
  30369. var $1;
  30370. _st(aNode)._scope_(self["@currentScope"]);
  30371. $1=_st(self["@currentScope"])._isMethodScope();
  30372. if(smalltalk.assert($1)){
  30373. _st(self["@currentScope"])._localReturn_(true);
  30374. } else {
  30375. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  30376. };
  30377. globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  30378. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30379. args: ["aNode"],
  30380. 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",
  30381. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
  30382. referencedClasses: []
  30383. }),
  30384. globals.SemanticAnalyzer);
  30385. smalltalk.addMethod(
  30386. smalltalk.method({
  30387. selector: "visitSendNode:",
  30388. protocol: 'visiting',
  30389. fn: function (aNode){
  30390. var self=this;
  30391. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  30392. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  30393. return smalltalk.withContext(function($ctx1) {
  30394. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16;
  30395. $3=_st(aNode)._receiver();
  30396. $ctx1.sendIdx["receiver"]=1;
  30397. $2=_st($3)._value();
  30398. $1=_st($2).__eq("super");
  30399. if(smalltalk.assert($1)){
  30400. _st(aNode)._superSend_(true);
  30401. $4=_st(aNode)._receiver();
  30402. $ctx1.sendIdx["receiver"]=2;
  30403. _st($4)._value_("self");
  30404. $5=self._superSends();
  30405. $ctx1.sendIdx["superSends"]=1;
  30406. $6=_st(aNode)._selector();
  30407. $ctx1.sendIdx["selector"]=1;
  30408. _st($5)._at_ifAbsentPut_($6,(function(){
  30409. return smalltalk.withContext(function($ctx2) {
  30410. return _st($Set())._new();
  30411. $ctx2.sendIdx["new"]=1;
  30412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  30413. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  30414. $8=self._superSends();
  30415. $9=_st(aNode)._selector();
  30416. $ctx1.sendIdx["selector"]=2;
  30417. $7=_st($8)._at_($9);
  30418. $ctx1.sendIdx["at:"]=1;
  30419. _st($7)._add_(aNode);
  30420. $ctx1.sendIdx["add:"]=1;
  30421. } else {
  30422. $11=_st($IRSendInliner())._inlinedSelectors();
  30423. $12=_st(aNode)._selector();
  30424. $ctx1.sendIdx["selector"]=3;
  30425. $10=_st($11)._includes_($12);
  30426. if(smalltalk.assert($10)){
  30427. _st(aNode)._shouldBeInlined_(true);
  30428. $13=_st(aNode)._receiver();
  30429. if(($receiver = $13) == nil || $receiver == null){
  30430. $13;
  30431. } else {
  30432. var receiver;
  30433. receiver=$receiver;
  30434. _st(receiver)._shouldBeAliased_(true);
  30435. };
  30436. };
  30437. };
  30438. $14=self._messageSends();
  30439. $ctx1.sendIdx["messageSends"]=1;
  30440. $15=_st(aNode)._selector();
  30441. $ctx1.sendIdx["selector"]=4;
  30442. _st($14)._at_ifAbsentPut_($15,(function(){
  30443. return smalltalk.withContext(function($ctx2) {
  30444. return _st($Set())._new();
  30445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  30446. $17=self._messageSends();
  30447. $ctx1.sendIdx["messageSends"]=2;
  30448. $18=_st(aNode)._selector();
  30449. $ctx1.sendIdx["selector"]=5;
  30450. $16=_st($17)._at_($18);
  30451. $ctx1.sendIdx["at:"]=2;
  30452. _st($16)._add_(aNode);
  30453. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  30454. globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  30455. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30456. args: ["aNode"],
  30457. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\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",
  30458. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"],
  30459. referencedClasses: ["Set", "IRSendInliner"]
  30460. }),
  30461. globals.SemanticAnalyzer);
  30462. smalltalk.addMethod(
  30463. smalltalk.method({
  30464. selector: "visitSequenceNode:",
  30465. protocol: 'visiting',
  30466. fn: function (aNode){
  30467. var self=this;
  30468. return smalltalk.withContext(function($ctx1) {
  30469. _st(_st(aNode)._temps())._do_((function(each){
  30470. return smalltalk.withContext(function($ctx2) {
  30471. self._validateVariableScope_(each);
  30472. return _st(self["@currentScope"])._addTemp_(each);
  30473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  30474. globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  30475. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  30476. args: ["aNode"],
  30477. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  30478. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"],
  30479. referencedClasses: []
  30480. }),
  30481. globals.SemanticAnalyzer);
  30482. smalltalk.addMethod(
  30483. smalltalk.method({
  30484. selector: "visitVariableNode:",
  30485. protocol: 'visiting',
  30486. fn: function (aNode){
  30487. var self=this;
  30488. var binding;
  30489. function $ClassRefVar(){return globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  30490. function $UnknownVar(){return globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  30491. return smalltalk.withContext(function($ctx1) {
  30492. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11;
  30493. binding=_st(self["@currentScope"])._lookupVariable_(aNode);
  30494. $1=binding;
  30495. if(($receiver = $1) == nil || $receiver == null){
  30496. $3=_st(aNode)._value();
  30497. $ctx1.sendIdx["value"]=1;
  30498. $2=_st($3)._isCapitalized();
  30499. if(smalltalk.assert($2)){
  30500. $4=_st($ClassRefVar())._new();
  30501. $ctx1.sendIdx["new"]=1;
  30502. $5=$4;
  30503. $6=_st(aNode)._value();
  30504. $ctx1.sendIdx["value"]=2;
  30505. _st($5)._name_($6);
  30506. $ctx1.sendIdx["name:"]=1;
  30507. $7=_st($4)._yourself();
  30508. $ctx1.sendIdx["yourself"]=1;
  30509. binding=$7;
  30510. binding;
  30511. $8=self._classReferences();
  30512. $9=_st(aNode)._value();
  30513. $ctx1.sendIdx["value"]=3;
  30514. _st($8)._add_($9);
  30515. } else {
  30516. self._errorUnknownVariable_(aNode);
  30517. $10=_st($UnknownVar())._new();
  30518. _st($10)._name_(_st(aNode)._value());
  30519. $11=_st($10)._yourself();
  30520. binding=$11;
  30521. binding;
  30522. };
  30523. } else {
  30524. $1;
  30525. };
  30526. _st(aNode)._binding_(binding);
  30527. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},globals.SemanticAnalyzer)})},
  30528. args: ["aNode"],
  30529. 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.",
  30530. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"],
  30531. referencedClasses: ["ClassRefVar", "UnknownVar"]
  30532. }),
  30533. globals.SemanticAnalyzer);
  30534. smalltalk.addMethod(
  30535. smalltalk.method({
  30536. selector: "on:",
  30537. protocol: 'instance creation',
  30538. fn: function (aClass){
  30539. var self=this;
  30540. return smalltalk.withContext(function($ctx1) {
  30541. var $2,$3,$1;
  30542. $2=self._new();
  30543. _st($2)._theClass_(aClass);
  30544. $3=_st($2)._yourself();
  30545. $1=$3;
  30546. return $1;
  30547. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},globals.SemanticAnalyzer.klass)})},
  30548. args: ["aClass"],
  30549. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  30550. messageSends: ["theClass:", "new", "yourself"],
  30551. referencedClasses: []
  30552. }),
  30553. globals.SemanticAnalyzer.klass);
  30554. });
  30555. define("amber_core/Compiler-Interpreter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function(smalltalk,nil,_st, globals){
  30556. smalltalk.addPackage('Compiler-Interpreter');
  30557. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30558. smalltalk.addClass('AIBlockClosure', globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  30559. 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`).";
  30560. smalltalk.addMethod(
  30561. smalltalk.method({
  30562. selector: "applyTo:arguments:",
  30563. protocol: 'evaluating',
  30564. fn: function (anObject,aCollection){
  30565. var self=this;
  30566. return smalltalk.withContext(function($ctx1) {
  30567. self._interpreterError();
  30568. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.AIBlockClosure)})},
  30569. args: ["anObject", "aCollection"],
  30570. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  30571. messageSends: ["interpreterError"],
  30572. referencedClasses: []
  30573. }),
  30574. globals.AIBlockClosure);
  30575. smalltalk.addMethod(
  30576. smalltalk.method({
  30577. selector: "compiledSource",
  30578. protocol: 'accessing',
  30579. fn: function (){
  30580. var self=this;
  30581. return "[ AST Block closure ]";
  30582. },
  30583. args: [],
  30584. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  30585. messageSends: [],
  30586. referencedClasses: []
  30587. }),
  30588. globals.AIBlockClosure);
  30589. smalltalk.addMethod(
  30590. smalltalk.method({
  30591. selector: "currySelf",
  30592. protocol: 'converting',
  30593. fn: function (){
  30594. var self=this;
  30595. return smalltalk.withContext(function($ctx1) {
  30596. self._interpreterError();
  30597. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.AIBlockClosure)})},
  30598. args: [],
  30599. source: "currySelf\x0a\x09self interpreterError",
  30600. messageSends: ["interpreterError"],
  30601. referencedClasses: []
  30602. }),
  30603. globals.AIBlockClosure);
  30604. smalltalk.addMethod(
  30605. smalltalk.method({
  30606. selector: "initializeWithContext:node:",
  30607. protocol: 'initialization',
  30608. fn: function (aContext,aNode){
  30609. var self=this;
  30610. self["@node"]=aNode;
  30611. self["@outerContext"]=aContext;
  30612. return self},
  30613. args: ["aContext", "aNode"],
  30614. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  30615. messageSends: [],
  30616. referencedClasses: []
  30617. }),
  30618. globals.AIBlockClosure);
  30619. smalltalk.addMethod(
  30620. smalltalk.method({
  30621. selector: "interpreterError",
  30622. protocol: 'error handling',
  30623. fn: function (){
  30624. var self=this;
  30625. function $ASTInterpreterError(){return globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  30626. return smalltalk.withContext(function($ctx1) {
  30627. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  30628. return self}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},globals.AIBlockClosure)})},
  30629. args: [],
  30630. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  30631. messageSends: ["signal:"],
  30632. referencedClasses: ["ASTInterpreterError"]
  30633. }),
  30634. globals.AIBlockClosure);
  30635. smalltalk.addMethod(
  30636. smalltalk.method({
  30637. selector: "numArgs",
  30638. protocol: 'accessing',
  30639. fn: function (){
  30640. var self=this;
  30641. return smalltalk.withContext(function($ctx1) {
  30642. var $1;
  30643. $1=_st(_st(self["@node"])._temps())._size();
  30644. return $1;
  30645. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.AIBlockClosure)})},
  30646. args: [],
  30647. source: "numArgs\x0a\x09^ node temps size",
  30648. messageSends: ["size", "temps"],
  30649. referencedClasses: []
  30650. }),
  30651. globals.AIBlockClosure);
  30652. smalltalk.addMethod(
  30653. smalltalk.method({
  30654. selector: "value",
  30655. protocol: 'evaluating',
  30656. fn: function (){
  30657. var self=this;
  30658. return smalltalk.withContext(function($ctx1) {
  30659. var $1;
  30660. $1=self._valueWithPossibleArguments_([]);
  30661. return $1;
  30662. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AIBlockClosure)})},
  30663. args: [],
  30664. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  30665. messageSends: ["valueWithPossibleArguments:"],
  30666. referencedClasses: []
  30667. }),
  30668. globals.AIBlockClosure);
  30669. smalltalk.addMethod(
  30670. smalltalk.method({
  30671. selector: "value:",
  30672. protocol: 'evaluating',
  30673. fn: function (anArgument){
  30674. var self=this;
  30675. return smalltalk.withContext(function($ctx1) {
  30676. var $1;
  30677. $1=self._valueWithPossibleArguments_([anArgument]);
  30678. return $1;
  30679. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},globals.AIBlockClosure)})},
  30680. args: ["anArgument"],
  30681. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  30682. messageSends: ["valueWithPossibleArguments:"],
  30683. referencedClasses: []
  30684. }),
  30685. globals.AIBlockClosure);
  30686. smalltalk.addMethod(
  30687. smalltalk.method({
  30688. selector: "value:value:",
  30689. protocol: 'evaluating',
  30690. fn: function (firstArgument,secondArgument){
  30691. var self=this;
  30692. return smalltalk.withContext(function($ctx1) {
  30693. var $1;
  30694. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  30695. return $1;
  30696. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.AIBlockClosure)})},
  30697. args: ["firstArgument", "secondArgument"],
  30698. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  30699. messageSends: ["valueWithPossibleArguments:"],
  30700. referencedClasses: []
  30701. }),
  30702. globals.AIBlockClosure);
  30703. smalltalk.addMethod(
  30704. smalltalk.method({
  30705. selector: "value:value:value:",
  30706. protocol: 'evaluating',
  30707. fn: function (firstArgument,secondArgument,thirdArgument){
  30708. var self=this;
  30709. return smalltalk.withContext(function($ctx1) {
  30710. var $1;
  30711. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  30712. return $1;
  30713. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.AIBlockClosure)})},
  30714. args: ["firstArgument", "secondArgument", "thirdArgument"],
  30715. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  30716. messageSends: ["valueWithPossibleArguments:"],
  30717. referencedClasses: []
  30718. }),
  30719. globals.AIBlockClosure);
  30720. smalltalk.addMethod(
  30721. smalltalk.method({
  30722. selector: "valueWithPossibleArguments:",
  30723. protocol: 'evaluating',
  30724. fn: function (aCollection){
  30725. var self=this;
  30726. var context,sequenceNode;
  30727. return smalltalk.withContext(function($ctx1) {
  30728. var $1,$2,$3,$4,$5,$6;
  30729. context=_st(self["@outerContext"])._newBlockContext();
  30730. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  30731. _st($1)._parent_(nil);
  30732. $2=_st($1)._yourself();
  30733. sequenceNode=$2;
  30734. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  30735. return smalltalk.withContext(function($ctx2) {
  30736. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  30737. return nil;
  30738. })));
  30739. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  30740. $3=_st(context)._interpreter();
  30741. $ctx1.sendIdx["interpreter"]=1;
  30742. _st($3)._node_(_st(sequenceNode)._nextChild());
  30743. $4=_st($3)._proceed();
  30744. $5=_st(self["@outerContext"])._interpreter();
  30745. $ctx1.sendIdx["interpreter"]=2;
  30746. _st($5)._setNonLocalReturnFromContext_(context);
  30747. $6=_st(_st(context)._interpreter())._pop();
  30748. return $6;
  30749. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)})},
  30750. args: ["aCollection"],
  30751. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newBlockContext.\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\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\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 nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  30752. messageSends: ["newBlockContext", "parent:", "copy", "first", "nodes", "yourself", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
  30753. referencedClasses: []
  30754. }),
  30755. globals.AIBlockClosure);
  30756. smalltalk.addMethod(
  30757. smalltalk.method({
  30758. selector: "forContext:node:",
  30759. protocol: 'instance creation',
  30760. fn: function (aContext,aNode){
  30761. var self=this;
  30762. return smalltalk.withContext(function($ctx1) {
  30763. var $2,$3,$1;
  30764. $2=self._new();
  30765. _st($2)._initializeWithContext_node_(aContext,aNode);
  30766. $3=_st($2)._yourself();
  30767. $1=$3;
  30768. return $1;
  30769. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},globals.AIBlockClosure.klass)})},
  30770. args: ["aContext", "aNode"],
  30771. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  30772. messageSends: ["initializeWithContext:node:", "new", "yourself"],
  30773. referencedClasses: []
  30774. }),
  30775. globals.AIBlockClosure.klass);
  30776. smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter'], 'Compiler-Interpreter');
  30777. 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)";
  30778. smalltalk.addMethod(
  30779. smalltalk.method({
  30780. selector: "arguments",
  30781. protocol: 'interpreting',
  30782. fn: function (){
  30783. var self=this;
  30784. return smalltalk.withContext(function($ctx1) {
  30785. var $1;
  30786. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  30787. return smalltalk.withContext(function($ctx2) {
  30788. return self._localAt_(each);
  30789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  30790. return $1;
  30791. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.AIContext)})},
  30792. args: [],
  30793. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ]",
  30794. messageSends: ["collect:", "arguments", "ast", "localAt:"],
  30795. referencedClasses: []
  30796. }),
  30797. globals.AIContext);
  30798. smalltalk.addMethod(
  30799. smalltalk.method({
  30800. selector: "ast",
  30801. protocol: 'interpreting',
  30802. fn: function (){
  30803. var self=this;
  30804. return smalltalk.withContext(function($ctx1) {
  30805. var $1,$3,$2,$4,$5;
  30806. $1=self._isBlockContext();
  30807. if(smalltalk.assert($1)){
  30808. $3=self._outerContext();
  30809. if(($receiver = $3) == nil || $receiver == null){
  30810. $2=$3;
  30811. } else {
  30812. var context;
  30813. context=$receiver;
  30814. $2=_st(context)._ast();
  30815. };
  30816. return $2;
  30817. };
  30818. $4=self["@ast"];
  30819. if(($receiver = $4) == nil || $receiver == null){
  30820. self._initializeAST();
  30821. } else {
  30822. $4;
  30823. };
  30824. $5=self["@ast"];
  30825. return $5;
  30826. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.AIContext)})},
  30827. args: [],
  30828. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  30829. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"],
  30830. referencedClasses: []
  30831. }),
  30832. globals.AIContext);
  30833. smalltalk.addMethod(
  30834. smalltalk.method({
  30835. selector: "evaluateNode:",
  30836. protocol: 'evaluating',
  30837. fn: function (aNode){
  30838. var self=this;
  30839. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  30840. return smalltalk.withContext(function($ctx1) {
  30841. var $2,$3,$1;
  30842. $2=_st($ASTInterpreter())._new();
  30843. _st($2)._context_(self);
  30844. _st($2)._node_(_st(aNode)._nextChild());
  30845. _st($2)._proceed();
  30846. $3=_st($2)._result();
  30847. $1=$3;
  30848. return $1;
  30849. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},globals.AIContext)})},
  30850. args: ["aNode"],
  30851. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  30852. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"],
  30853. referencedClasses: ["ASTInterpreter"]
  30854. }),
  30855. globals.AIContext);
  30856. smalltalk.addMethod(
  30857. smalltalk.method({
  30858. selector: "evaluatedSelector",
  30859. protocol: 'accessing',
  30860. fn: function (){
  30861. var self=this;
  30862. var $1;
  30863. $1=self["@evaluatedSelector"];
  30864. return $1;
  30865. },
  30866. args: [],
  30867. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  30868. messageSends: [],
  30869. referencedClasses: []
  30870. }),
  30871. globals.AIContext);
  30872. smalltalk.addMethod(
  30873. smalltalk.method({
  30874. selector: "evaluatedSelector:",
  30875. protocol: 'accessing',
  30876. fn: function (aString){
  30877. var self=this;
  30878. self["@evaluatedSelector"]=aString;
  30879. return self},
  30880. args: ["aString"],
  30881. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  30882. messageSends: [],
  30883. referencedClasses: []
  30884. }),
  30885. globals.AIContext);
  30886. smalltalk.addMethod(
  30887. smalltalk.method({
  30888. selector: "index",
  30889. protocol: 'accessing',
  30890. fn: function (){
  30891. var self=this;
  30892. return smalltalk.withContext(function($ctx1) {
  30893. var $2,$1;
  30894. $2=self["@index"];
  30895. if(($receiver = $2) == nil || $receiver == null){
  30896. $1=(0);
  30897. } else {
  30898. $1=$2;
  30899. };
  30900. return $1;
  30901. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.AIContext)})},
  30902. args: [],
  30903. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  30904. messageSends: ["ifNil:"],
  30905. referencedClasses: []
  30906. }),
  30907. globals.AIContext);
  30908. smalltalk.addMethod(
  30909. smalltalk.method({
  30910. selector: "index:",
  30911. protocol: 'accessing',
  30912. fn: function (anInteger){
  30913. var self=this;
  30914. self["@index"]=anInteger;
  30915. return self},
  30916. args: ["anInteger"],
  30917. source: "index: anInteger\x0a\x09index := anInteger",
  30918. messageSends: [],
  30919. referencedClasses: []
  30920. }),
  30921. globals.AIContext);
  30922. smalltalk.addMethod(
  30923. smalltalk.method({
  30924. selector: "initializeAST",
  30925. protocol: 'initialization',
  30926. fn: function (){
  30927. var self=this;
  30928. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30929. return smalltalk.withContext(function($ctx1) {
  30930. var $1;
  30931. $1=self._method();
  30932. $ctx1.sendIdx["method"]=1;
  30933. self["@ast"]=_st($1)._ast();
  30934. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  30935. return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},globals.AIContext)})},
  30936. args: [],
  30937. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  30938. messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
  30939. referencedClasses: ["SemanticAnalyzer"]
  30940. }),
  30941. globals.AIContext);
  30942. smalltalk.addMethod(
  30943. smalltalk.method({
  30944. selector: "initializeFromMethodContext:",
  30945. protocol: 'initialization',
  30946. fn: function (aMethodContext){
  30947. var self=this;
  30948. return smalltalk.withContext(function($ctx1) {
  30949. var $1,$2,$3,$4;
  30950. self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
  30951. self._index_(_st(aMethodContext)._index());
  30952. self._sendIndexes_(_st(aMethodContext)._sendIndexes());
  30953. self._receiver_(_st(aMethodContext)._receiver());
  30954. $1=self._selector_(_st(aMethodContext)._selector());
  30955. $2=_st(aMethodContext)._outerContext();
  30956. $ctx1.sendIdx["outerContext"]=1;
  30957. if(($receiver = $2) == nil || $receiver == null){
  30958. $2;
  30959. } else {
  30960. var outer;
  30961. outer=$receiver;
  30962. $3=_st(outer)._methodContext();
  30963. if(($receiver = $3) == nil || $receiver == null){
  30964. $3;
  30965. } else {
  30966. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  30967. };
  30968. $4=_st(aMethodContext)._locals();
  30969. $ctx1.sendIdx["locals"]=1;
  30970. _st($4)._keysAndValuesDo_((function(key,value){
  30971. return smalltalk.withContext(function($ctx2) {
  30972. return _st(self._locals())._at_put_(key,value);
  30973. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  30974. };
  30975. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)})},
  30976. args: ["aMethodContext"],
  30977. 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\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 ] ]",
  30978. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  30979. referencedClasses: []
  30980. }),
  30981. globals.AIContext);
  30982. smalltalk.addMethod(
  30983. smalltalk.method({
  30984. selector: "initializeInterpreter",
  30985. protocol: 'initialization',
  30986. fn: function (){
  30987. var self=this;
  30988. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  30989. return smalltalk.withContext(function($ctx1) {
  30990. var $1,$2,$3;
  30991. $1=_st($ASTInterpreter())._new();
  30992. _st($1)._context_(self);
  30993. $2=_st($1)._yourself();
  30994. self["@interpreter"]=$2;
  30995. $3=self._innerContext();
  30996. if(($receiver = $3) == nil || $receiver == null){
  30997. $3;
  30998. } else {
  30999. self._setupInterpreter_(self["@interpreter"]);
  31000. };
  31001. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},globals.AIContext)})},
  31002. args: [],
  31003. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  31004. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"],
  31005. referencedClasses: ["ASTInterpreter"]
  31006. }),
  31007. globals.AIContext);
  31008. smalltalk.addMethod(
  31009. smalltalk.method({
  31010. selector: "initializeLocals",
  31011. protocol: 'initialization',
  31012. fn: function (){
  31013. var self=this;
  31014. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  31015. return smalltalk.withContext(function($ctx1) {
  31016. self["@locals"]=_st($Dictionary())._new();
  31017. _st(self["@locals"])._at_put_("thisContext",self);
  31018. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},globals.AIContext)})},
  31019. args: [],
  31020. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  31021. messageSends: ["new", "at:put:"],
  31022. referencedClasses: ["Dictionary"]
  31023. }),
  31024. globals.AIContext);
  31025. smalltalk.addMethod(
  31026. smalltalk.method({
  31027. selector: "innerContext",
  31028. protocol: 'accessing',
  31029. fn: function (){
  31030. var self=this;
  31031. var $1;
  31032. $1=self["@innerContext"];
  31033. return $1;
  31034. },
  31035. args: [],
  31036. source: "innerContext\x0a\x09^ innerContext",
  31037. messageSends: [],
  31038. referencedClasses: []
  31039. }),
  31040. globals.AIContext);
  31041. smalltalk.addMethod(
  31042. smalltalk.method({
  31043. selector: "innerContext:",
  31044. protocol: 'accessing',
  31045. fn: function (anAIContext){
  31046. var self=this;
  31047. self["@innerContext"]=anAIContext;
  31048. return self},
  31049. args: ["anAIContext"],
  31050. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  31051. messageSends: [],
  31052. referencedClasses: []
  31053. }),
  31054. globals.AIContext);
  31055. smalltalk.addMethod(
  31056. smalltalk.method({
  31057. selector: "interpreter",
  31058. protocol: 'interpreting',
  31059. fn: function (){
  31060. var self=this;
  31061. return smalltalk.withContext(function($ctx1) {
  31062. var $1,$2;
  31063. $1=self["@interpreter"];
  31064. if(($receiver = $1) == nil || $receiver == null){
  31065. self._initializeInterpreter();
  31066. } else {
  31067. $1;
  31068. };
  31069. $2=self["@interpreter"];
  31070. return $2;
  31071. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.AIContext)})},
  31072. args: [],
  31073. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  31074. messageSends: ["ifNil:", "initializeInterpreter"],
  31075. referencedClasses: []
  31076. }),
  31077. globals.AIContext);
  31078. smalltalk.addMethod(
  31079. smalltalk.method({
  31080. selector: "interpreter:",
  31081. protocol: 'interpreting',
  31082. fn: function (anInterpreter){
  31083. var self=this;
  31084. self["@interpreter"]=anInterpreter;
  31085. return self},
  31086. args: ["anInterpreter"],
  31087. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  31088. messageSends: [],
  31089. referencedClasses: []
  31090. }),
  31091. globals.AIContext);
  31092. smalltalk.addMethod(
  31093. smalltalk.method({
  31094. selector: "localAt:",
  31095. protocol: 'accessing',
  31096. fn: function (aString){
  31097. var self=this;
  31098. return smalltalk.withContext(function($ctx1) {
  31099. var $2,$1;
  31100. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  31101. return smalltalk.withContext(function($ctx2) {
  31102. $2=self._outerContext();
  31103. if(($receiver = $2) == nil || $receiver == null){
  31104. return $2;
  31105. } else {
  31106. var context;
  31107. context=$receiver;
  31108. return _st(context)._localAt_(aString);
  31109. };
  31110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31111. return $1;
  31112. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},globals.AIContext)})},
  31113. args: ["aString"],
  31114. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext ifNotNil: [ :context | \x0a\x09\x09\x09context localAt: aString ] ]",
  31115. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:", "outerContext", "localAt:"],
  31116. referencedClasses: []
  31117. }),
  31118. globals.AIContext);
  31119. smalltalk.addMethod(
  31120. smalltalk.method({
  31121. selector: "localAt:ifAbsent:",
  31122. protocol: 'accessing',
  31123. fn: function (aString,aBlock){
  31124. var self=this;
  31125. return smalltalk.withContext(function($ctx1) {
  31126. var $2,$1;
  31127. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  31128. return smalltalk.withContext(function($ctx2) {
  31129. $2=self._outerContext();
  31130. if(($receiver = $2) == nil || $receiver == null){
  31131. return _st(aBlock)._value();
  31132. } else {
  31133. var context;
  31134. context=$receiver;
  31135. return _st(context)._localAt_ifAbsent_(aString,aBlock);
  31136. };
  31137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31138. return $1;
  31139. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock},globals.AIContext)})},
  31140. args: ["aString", "aBlock"],
  31141. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext \x0a\x09\x09\x09ifNotNil: [ :context | context localAt: aString ifAbsent: aBlock ]\x0a\x09\x09\x09ifNil: [ aBlock value ] ]",
  31142. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:ifNil:", "outerContext", "localAt:ifAbsent:", "value"],
  31143. referencedClasses: []
  31144. }),
  31145. globals.AIContext);
  31146. smalltalk.addMethod(
  31147. smalltalk.method({
  31148. selector: "localAt:put:",
  31149. protocol: 'accessing',
  31150. fn: function (aString,anObject){
  31151. var self=this;
  31152. return smalltalk.withContext(function($ctx1) {
  31153. _st(self._locals())._at_put_(aString,anObject);
  31154. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},globals.AIContext)})},
  31155. args: ["aString", "anObject"],
  31156. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  31157. messageSends: ["at:put:", "locals"],
  31158. referencedClasses: []
  31159. }),
  31160. globals.AIContext);
  31161. smalltalk.addMethod(
  31162. smalltalk.method({
  31163. selector: "locals",
  31164. protocol: 'accessing',
  31165. fn: function (){
  31166. var self=this;
  31167. return smalltalk.withContext(function($ctx1) {
  31168. var $1,$2;
  31169. $1=self["@locals"];
  31170. if(($receiver = $1) == nil || $receiver == null){
  31171. self._initializeLocals();
  31172. } else {
  31173. $1;
  31174. };
  31175. $2=self["@locals"];
  31176. return $2;
  31177. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.AIContext)})},
  31178. args: [],
  31179. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  31180. messageSends: ["ifNil:", "initializeLocals"],
  31181. referencedClasses: []
  31182. }),
  31183. globals.AIContext);
  31184. smalltalk.addMethod(
  31185. smalltalk.method({
  31186. selector: "method",
  31187. protocol: 'accessing',
  31188. fn: function (){
  31189. var self=this;
  31190. return smalltalk.withContext(function($ctx1) {
  31191. var $2,$5,$4,$3,$1;
  31192. $2=self._methodContext();
  31193. $ctx1.sendIdx["methodContext"]=1;
  31194. if(($receiver = $2) == nil || $receiver == null){
  31195. $1=$2;
  31196. } else {
  31197. $5=self._methodContext();
  31198. $ctx1.sendIdx["methodContext"]=2;
  31199. $4=_st($5)._receiver();
  31200. $3=_st($4)._class();
  31201. $1=_st($3)._lookupSelector_(_st(self._methodContext())._selector());
  31202. };
  31203. return $1;
  31204. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.AIContext)})},
  31205. args: [],
  31206. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  31207. messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
  31208. referencedClasses: []
  31209. }),
  31210. globals.AIContext);
  31211. smalltalk.addMethod(
  31212. smalltalk.method({
  31213. selector: "newBlockContext",
  31214. protocol: 'factory',
  31215. fn: function (){
  31216. var self=this;
  31217. return smalltalk.withContext(function($ctx1) {
  31218. var $2,$3,$1;
  31219. $2=_st(self._class())._new();
  31220. _st($2)._outerContext_(self);
  31221. $3=_st($2)._yourself();
  31222. $1=$3;
  31223. return $1;
  31224. }, function($ctx1) {$ctx1.fill(self,"newBlockContext",{},globals.AIContext)})},
  31225. args: [],
  31226. source: "newBlockContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  31227. messageSends: ["outerContext:", "new", "class", "yourself"],
  31228. referencedClasses: []
  31229. }),
  31230. globals.AIContext);
  31231. smalltalk.addMethod(
  31232. smalltalk.method({
  31233. selector: "outerContext",
  31234. protocol: 'accessing',
  31235. fn: function (){
  31236. var self=this;
  31237. var $1;
  31238. $1=self["@outerContext"];
  31239. return $1;
  31240. },
  31241. args: [],
  31242. source: "outerContext\x0a\x09^ outerContext",
  31243. messageSends: [],
  31244. referencedClasses: []
  31245. }),
  31246. globals.AIContext);
  31247. smalltalk.addMethod(
  31248. smalltalk.method({
  31249. selector: "outerContext:",
  31250. protocol: 'accessing',
  31251. fn: function (anAIContext){
  31252. var self=this;
  31253. return smalltalk.withContext(function($ctx1) {
  31254. var $1;
  31255. self["@outerContext"]=anAIContext;
  31256. $1=self["@outerContext"];
  31257. if(($receiver = $1) == nil || $receiver == null){
  31258. $1;
  31259. } else {
  31260. var context;
  31261. context=$receiver;
  31262. _st(context)._innerContext_(self);
  31263. };
  31264. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},globals.AIContext)})},
  31265. args: ["anAIContext"],
  31266. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  31267. messageSends: ["ifNotNil:", "innerContext:"],
  31268. referencedClasses: []
  31269. }),
  31270. globals.AIContext);
  31271. smalltalk.addMethod(
  31272. smalltalk.method({
  31273. selector: "receiver",
  31274. protocol: 'interpreting',
  31275. fn: function (){
  31276. var self=this;
  31277. return smalltalk.withContext(function($ctx1) {
  31278. var $1;
  31279. $1=self._localAt_("self");
  31280. return $1;
  31281. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AIContext)})},
  31282. args: [],
  31283. source: "receiver\x0a\x09^ self localAt: 'self'",
  31284. messageSends: ["localAt:"],
  31285. referencedClasses: []
  31286. }),
  31287. globals.AIContext);
  31288. smalltalk.addMethod(
  31289. smalltalk.method({
  31290. selector: "receiver:",
  31291. protocol: 'interpreting',
  31292. fn: function (anObject){
  31293. var self=this;
  31294. return smalltalk.withContext(function($ctx1) {
  31295. self._localAt_put_("self",anObject);
  31296. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.AIContext)})},
  31297. args: ["anObject"],
  31298. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  31299. messageSends: ["localAt:put:"],
  31300. referencedClasses: []
  31301. }),
  31302. globals.AIContext);
  31303. smalltalk.addMethod(
  31304. smalltalk.method({
  31305. selector: "selector",
  31306. protocol: 'accessing',
  31307. fn: function (){
  31308. var self=this;
  31309. var $1;
  31310. $1=self["@selector"];
  31311. return $1;
  31312. },
  31313. args: [],
  31314. source: "selector\x0a\x09^ selector",
  31315. messageSends: [],
  31316. referencedClasses: []
  31317. }),
  31318. globals.AIContext);
  31319. smalltalk.addMethod(
  31320. smalltalk.method({
  31321. selector: "selector:",
  31322. protocol: 'accessing',
  31323. fn: function (aString){
  31324. var self=this;
  31325. self["@selector"]=aString;
  31326. return self},
  31327. args: ["aString"],
  31328. source: "selector: aString\x0a\x09selector := aString",
  31329. messageSends: [],
  31330. referencedClasses: []
  31331. }),
  31332. globals.AIContext);
  31333. smalltalk.addMethod(
  31334. smalltalk.method({
  31335. selector: "sendIndexAt:",
  31336. protocol: 'accessing',
  31337. fn: function (aString){
  31338. var self=this;
  31339. return smalltalk.withContext(function($ctx1) {
  31340. var $1;
  31341. $1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  31342. return (0);
  31343. }));
  31344. return $1;
  31345. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},globals.AIContext)})},
  31346. args: ["aString"],
  31347. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  31348. messageSends: ["at:ifAbsent:", "sendIndexes"],
  31349. referencedClasses: []
  31350. }),
  31351. globals.AIContext);
  31352. smalltalk.addMethod(
  31353. smalltalk.method({
  31354. selector: "sendIndexes",
  31355. protocol: 'accessing',
  31356. fn: function (){
  31357. var self=this;
  31358. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  31359. return smalltalk.withContext(function($ctx1) {
  31360. var $2,$1;
  31361. $2=self["@sendIndexes"];
  31362. if(($receiver = $2) == nil || $receiver == null){
  31363. $1=_st($Dictionary())._new();
  31364. } else {
  31365. $1=$2;
  31366. };
  31367. return $1;
  31368. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.AIContext)})},
  31369. args: [],
  31370. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  31371. messageSends: ["ifNil:", "new"],
  31372. referencedClasses: ["Dictionary"]
  31373. }),
  31374. globals.AIContext);
  31375. smalltalk.addMethod(
  31376. smalltalk.method({
  31377. selector: "sendIndexes:",
  31378. protocol: 'accessing',
  31379. fn: function (aDictionary){
  31380. var self=this;
  31381. self["@sendIndexes"]=aDictionary;
  31382. return self},
  31383. args: ["aDictionary"],
  31384. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  31385. messageSends: [],
  31386. referencedClasses: []
  31387. }),
  31388. globals.AIContext);
  31389. smalltalk.addMethod(
  31390. smalltalk.method({
  31391. selector: "setupInterpreter:",
  31392. protocol: 'interpreting',
  31393. fn: function (anInterpreter){
  31394. var self=this;
  31395. var currentNode;
  31396. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  31397. return smalltalk.withContext(function($ctx1) {
  31398. var $1,$2,$5,$4,$3;
  31399. $1=_st($ASTPCNodeVisitor())._new();
  31400. _st($1)._selector_(self._evaluatedSelector());
  31401. _st($1)._context_(self);
  31402. _st($1)._visit_(self._ast());
  31403. $2=_st($1)._currentNode();
  31404. currentNode=$2;
  31405. _st(anInterpreter)._node_(currentNode);
  31406. $5=self._innerContext();
  31407. $ctx1.sendIdx["innerContext"]=1;
  31408. $4=_st($5)._arguments();
  31409. $3=_st($4)._reversed();
  31410. _st($3)._do_((function(each){
  31411. return smalltalk.withContext(function($ctx2) {
  31412. return _st(anInterpreter)._push_(each);
  31413. $ctx2.sendIdx["push:"]=1;
  31414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  31415. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  31416. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},globals.AIContext)})},
  31417. args: ["anInterpreter"],
  31418. 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\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)",
  31419. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "node:", "do:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  31420. referencedClasses: ["ASTPCNodeVisitor"]
  31421. }),
  31422. globals.AIContext);
  31423. smalltalk.addMethod(
  31424. smalltalk.method({
  31425. selector: "fromMethodContext:",
  31426. protocol: 'instance creation',
  31427. fn: function (aMethodContext){
  31428. var self=this;
  31429. return smalltalk.withContext(function($ctx1) {
  31430. var $2,$3,$1;
  31431. $2=self._new();
  31432. _st($2)._initializeFromMethodContext_(aMethodContext);
  31433. $3=_st($2)._yourself();
  31434. $1=$3;
  31435. return $1;
  31436. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext.klass)})},
  31437. args: ["aMethodContext"],
  31438. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  31439. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  31440. referencedClasses: []
  31441. }),
  31442. globals.AIContext.klass);
  31443. smalltalk.addClass('ASTDebugger', globals.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  31444. 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.";
  31445. smalltalk.addMethod(
  31446. smalltalk.method({
  31447. selector: "atEnd",
  31448. protocol: 'testing',
  31449. fn: function (){
  31450. var self=this;
  31451. return smalltalk.withContext(function($ctx1) {
  31452. var $1;
  31453. $1=_st(self._interpreter())._atEnd();
  31454. return $1;
  31455. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTDebugger)})},
  31456. args: [],
  31457. source: "atEnd\x0a\x09^ self interpreter atEnd",
  31458. messageSends: ["atEnd", "interpreter"],
  31459. referencedClasses: []
  31460. }),
  31461. globals.ASTDebugger);
  31462. smalltalk.addMethod(
  31463. smalltalk.method({
  31464. selector: "context",
  31465. protocol: 'accessing',
  31466. fn: function (){
  31467. var self=this;
  31468. var $1;
  31469. $1=self["@context"];
  31470. return $1;
  31471. },
  31472. args: [],
  31473. source: "context\x0a\x09^ context",
  31474. messageSends: [],
  31475. referencedClasses: []
  31476. }),
  31477. globals.ASTDebugger);
  31478. smalltalk.addMethod(
  31479. smalltalk.method({
  31480. selector: "context:",
  31481. protocol: 'accessing',
  31482. fn: function (aContext){
  31483. var self=this;
  31484. self["@context"]=aContext;
  31485. return self},
  31486. args: ["aContext"],
  31487. source: "context: aContext\x0a\x09context := aContext",
  31488. messageSends: [],
  31489. referencedClasses: []
  31490. }),
  31491. globals.ASTDebugger);
  31492. smalltalk.addMethod(
  31493. smalltalk.method({
  31494. selector: "interpreter",
  31495. protocol: 'accessing',
  31496. fn: function (){
  31497. var self=this;
  31498. return smalltalk.withContext(function($ctx1) {
  31499. var $1;
  31500. $1=_st(self._context())._interpreter();
  31501. return $1;
  31502. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.ASTDebugger)})},
  31503. args: [],
  31504. source: "interpreter\x0a\x09^ self context interpreter",
  31505. messageSends: ["interpreter", "context"],
  31506. referencedClasses: []
  31507. }),
  31508. globals.ASTDebugger);
  31509. smalltalk.addMethod(
  31510. smalltalk.method({
  31511. selector: "method",
  31512. protocol: 'accessing',
  31513. fn: function (){
  31514. var self=this;
  31515. return smalltalk.withContext(function($ctx1) {
  31516. var $1;
  31517. $1=_st(self._context())._method();
  31518. return $1;
  31519. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.ASTDebugger)})},
  31520. args: [],
  31521. source: "method\x0a\x09^ self context method",
  31522. messageSends: ["method", "context"],
  31523. referencedClasses: []
  31524. }),
  31525. globals.ASTDebugger);
  31526. smalltalk.addMethod(
  31527. smalltalk.method({
  31528. selector: "nextNode",
  31529. protocol: 'accessing',
  31530. fn: function (){
  31531. var self=this;
  31532. return smalltalk.withContext(function($ctx1) {
  31533. var $1;
  31534. $1=_st(self._interpreter())._nextNode();
  31535. return $1;
  31536. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.ASTDebugger)})},
  31537. args: [],
  31538. source: "nextNode\x0a\x09^ self interpreter nextNode",
  31539. messageSends: ["nextNode", "interpreter"],
  31540. referencedClasses: []
  31541. }),
  31542. globals.ASTDebugger);
  31543. smalltalk.addMethod(
  31544. smalltalk.method({
  31545. selector: "proceed",
  31546. protocol: 'stepping',
  31547. fn: function (){
  31548. var self=this;
  31549. return smalltalk.withContext(function($ctx1) {
  31550. self._shouldBeImplemented();
  31551. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTDebugger)})},
  31552. args: [],
  31553. source: "proceed\x0a\x09self shouldBeImplemented",
  31554. messageSends: ["shouldBeImplemented"],
  31555. referencedClasses: []
  31556. }),
  31557. globals.ASTDebugger);
  31558. smalltalk.addMethod(
  31559. smalltalk.method({
  31560. selector: "restart",
  31561. protocol: 'stepping',
  31562. fn: function (){
  31563. var self=this;
  31564. return smalltalk.withContext(function($ctx1) {
  31565. _st(self._interpreter())._restart();
  31566. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTDebugger)})},
  31567. args: [],
  31568. source: "restart\x0a\x09self interpreter restart",
  31569. messageSends: ["restart", "interpreter"],
  31570. referencedClasses: []
  31571. }),
  31572. globals.ASTDebugger);
  31573. smalltalk.addMethod(
  31574. smalltalk.method({
  31575. selector: "skip",
  31576. protocol: 'stepping',
  31577. fn: function (){
  31578. var self=this;
  31579. return smalltalk.withContext(function($ctx1) {
  31580. _st(self._interpreter())._skip();
  31581. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTDebugger)})},
  31582. args: [],
  31583. source: "skip\x0a\x09self interpreter skip",
  31584. messageSends: ["skip", "interpreter"],
  31585. referencedClasses: []
  31586. }),
  31587. globals.ASTDebugger);
  31588. smalltalk.addMethod(
  31589. smalltalk.method({
  31590. selector: "stepInto",
  31591. protocol: 'stepping',
  31592. fn: function (){
  31593. var self=this;
  31594. return smalltalk.withContext(function($ctx1) {
  31595. self._shouldBeImplemented();
  31596. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},globals.ASTDebugger)})},
  31597. args: [],
  31598. source: "stepInto\x0a\x09self shouldBeImplemented",
  31599. messageSends: ["shouldBeImplemented"],
  31600. referencedClasses: []
  31601. }),
  31602. globals.ASTDebugger);
  31603. smalltalk.addMethod(
  31604. smalltalk.method({
  31605. selector: "stepOver",
  31606. protocol: 'stepping',
  31607. fn: function (){
  31608. var self=this;
  31609. return smalltalk.withContext(function($ctx1) {
  31610. self._flushOuterContexts();
  31611. _st(self._interpreter())._stepOver();
  31612. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTDebugger)})},
  31613. args: [],
  31614. source: "stepOver\x0a\x09self flushOuterContexts.\x0a\x09self interpreter stepOver",
  31615. messageSends: ["flushOuterContexts", "stepOver", "interpreter"],
  31616. referencedClasses: []
  31617. }),
  31618. globals.ASTDebugger);
  31619. smalltalk.addMethod(
  31620. smalltalk.method({
  31621. selector: "context:",
  31622. protocol: 'instance creation',
  31623. fn: function (aContext){
  31624. var self=this;
  31625. return smalltalk.withContext(function($ctx1) {
  31626. var $2,$3,$1;
  31627. $2=self._new();
  31628. _st($2)._context_(aContext);
  31629. $3=_st($2)._yourself();
  31630. $1=$3;
  31631. return $1;
  31632. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},globals.ASTDebugger.klass)})},
  31633. args: ["aContext"],
  31634. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  31635. messageSends: ["context:", "new", "yourself"],
  31636. referencedClasses: []
  31637. }),
  31638. globals.ASTDebugger.klass);
  31639. smalltalk.addClass('ASTInterpreter', globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  31640. 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";
  31641. smalltalk.addMethod(
  31642. smalltalk.method({
  31643. selector: "assign:to:",
  31644. protocol: 'private',
  31645. fn: function (aNode,anObject){
  31646. var self=this;
  31647. return smalltalk.withContext(function($ctx1) {
  31648. var $1,$3,$2,$4;
  31649. $1=_st(_st(aNode)._binding())._isInstanceVar();
  31650. if(smalltalk.assert($1)){
  31651. $3=self._context();
  31652. $ctx1.sendIdx["context"]=1;
  31653. $2=_st($3)._receiver();
  31654. $4=_st(aNode)._value();
  31655. $ctx1.sendIdx["value"]=1;
  31656. _st($2)._instVarAt_put_($4,anObject);
  31657. } else {
  31658. _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  31659. };
  31660. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},globals.ASTInterpreter)})},
  31661. args: ["aNode", "anObject"],
  31662. 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 ]",
  31663. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  31664. referencedClasses: []
  31665. }),
  31666. globals.ASTInterpreter);
  31667. smalltalk.addMethod(
  31668. smalltalk.method({
  31669. selector: "atEnd",
  31670. protocol: 'testing',
  31671. fn: function (){
  31672. var self=this;
  31673. return smalltalk.withContext(function($ctx1) {
  31674. var $1;
  31675. $1=_st(self._hasReturned())._or_((function(){
  31676. return smalltalk.withContext(function($ctx2) {
  31677. return _st(self._node())._isNil();
  31678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31679. return $1;
  31680. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTInterpreter)})},
  31681. args: [],
  31682. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  31683. messageSends: ["or:", "hasReturned", "isNil", "node"],
  31684. referencedClasses: []
  31685. }),
  31686. globals.ASTInterpreter);
  31687. smalltalk.addMethod(
  31688. smalltalk.method({
  31689. selector: "context",
  31690. protocol: 'accessing',
  31691. fn: function (){
  31692. var self=this;
  31693. var $1;
  31694. $1=self["@context"];
  31695. return $1;
  31696. },
  31697. args: [],
  31698. source: "context\x0a\x09^ context",
  31699. messageSends: [],
  31700. referencedClasses: []
  31701. }),
  31702. globals.ASTInterpreter);
  31703. smalltalk.addMethod(
  31704. smalltalk.method({
  31705. selector: "context:",
  31706. protocol: 'accessing',
  31707. fn: function (aContext){
  31708. var self=this;
  31709. self["@context"]=aContext;
  31710. return self},
  31711. args: ["aContext"],
  31712. source: "context: aContext\x0a\x09context := aContext",
  31713. messageSends: [],
  31714. referencedClasses: []
  31715. }),
  31716. globals.ASTInterpreter);
  31717. smalltalk.addMethod(
  31718. smalltalk.method({
  31719. selector: "eval:",
  31720. protocol: 'private',
  31721. fn: function (aString){
  31722. var self=this;
  31723. var source,function_;
  31724. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  31725. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31726. return smalltalk.withContext(function($ctx1) {
  31727. var $3,$2,$1,$4,$5;
  31728. source=_st($String())._streamContents_((function(str){
  31729. return smalltalk.withContext(function($ctx2) {
  31730. _st(str)._nextPutAll_("(function(");
  31731. $ctx2.sendIdx["nextPutAll:"]=1;
  31732. $3=self._context();
  31733. $ctx2.sendIdx["context"]=1;
  31734. $2=_st($3)._locals();
  31735. $ctx2.sendIdx["locals"]=1;
  31736. $1=_st($2)._keys();
  31737. _st($1)._do_separatedBy_((function(each){
  31738. return smalltalk.withContext(function($ctx3) {
  31739. return _st(str)._nextPutAll_(each);
  31740. $ctx3.sendIdx["nextPutAll:"]=2;
  31741. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  31742. return smalltalk.withContext(function($ctx3) {
  31743. return _st(str)._nextPutAll_(",");
  31744. $ctx3.sendIdx["nextPutAll:"]=3;
  31745. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  31746. _st(str)._nextPutAll_("){ return (function() {");
  31747. $ctx2.sendIdx["nextPutAll:"]=4;
  31748. _st(str)._nextPutAll_(aString);
  31749. $ctx2.sendIdx["nextPutAll:"]=5;
  31750. $4=_st(str)._nextPutAll_("})() })");
  31751. return $4;
  31752. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  31753. function_=_st(_st($Compiler())._new())._eval_(source);
  31754. $5=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  31755. return $5;
  31756. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},globals.ASTInterpreter)})},
  31757. args: ["aString"],
  31758. 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: '(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",
  31759. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  31760. referencedClasses: ["String", "Compiler"]
  31761. }),
  31762. globals.ASTInterpreter);
  31763. smalltalk.addMethod(
  31764. smalltalk.method({
  31765. selector: "hasReturned",
  31766. protocol: 'testing',
  31767. fn: function (){
  31768. var self=this;
  31769. return smalltalk.withContext(function($ctx1) {
  31770. var $2,$1;
  31771. $2=self["@returned"];
  31772. if(($receiver = $2) == nil || $receiver == null){
  31773. $1=false;
  31774. } else {
  31775. $1=$2;
  31776. };
  31777. return $1;
  31778. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},globals.ASTInterpreter)})},
  31779. args: [],
  31780. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  31781. messageSends: ["ifNil:"],
  31782. referencedClasses: []
  31783. }),
  31784. globals.ASTInterpreter);
  31785. smalltalk.addMethod(
  31786. smalltalk.method({
  31787. selector: "interpret",
  31788. protocol: 'interpreting',
  31789. fn: function (){
  31790. var self=this;
  31791. return smalltalk.withContext(function($ctx1) {
  31792. self._visit_(self._node());
  31793. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},globals.ASTInterpreter)})},
  31794. args: [],
  31795. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  31796. messageSends: ["visit:", "node"],
  31797. referencedClasses: []
  31798. }),
  31799. globals.ASTInterpreter);
  31800. smalltalk.addMethod(
  31801. smalltalk.method({
  31802. selector: "interpret:",
  31803. protocol: 'interpreting',
  31804. fn: function (aNode){
  31805. var self=this;
  31806. return smalltalk.withContext(function($ctx1) {
  31807. self._node_(aNode);
  31808. self._interpret();
  31809. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},globals.ASTInterpreter)})},
  31810. args: ["aNode"],
  31811. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  31812. messageSends: ["node:", "interpret"],
  31813. referencedClasses: []
  31814. }),
  31815. globals.ASTInterpreter);
  31816. smalltalk.addMethod(
  31817. smalltalk.method({
  31818. selector: "messageFromSendNode:arguments:",
  31819. protocol: 'private',
  31820. fn: function (aSendNode,aCollection){
  31821. var self=this;
  31822. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  31823. return smalltalk.withContext(function($ctx1) {
  31824. var $2,$3,$1;
  31825. $2=_st($Message())._new();
  31826. _st($2)._selector_(_st(aSendNode)._selector());
  31827. _st($2)._arguments_(aCollection);
  31828. $3=_st($2)._yourself();
  31829. $1=$3;
  31830. return $1;
  31831. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},globals.ASTInterpreter)})},
  31832. args: ["aSendNode", "aCollection"],
  31833. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  31834. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  31835. referencedClasses: ["Message"]
  31836. }),
  31837. globals.ASTInterpreter);
  31838. smalltalk.addMethod(
  31839. smalltalk.method({
  31840. selector: "messageNotUnderstood:receiver:",
  31841. protocol: 'private',
  31842. fn: function (aMessage,anObject){
  31843. var self=this;
  31844. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  31845. return smalltalk.withContext(function($ctx1) {
  31846. var $1,$2;
  31847. $1=_st($MessageNotUnderstood())._new();
  31848. _st($1)._meesage_(aMessage);
  31849. _st($1)._receiver_(anObject);
  31850. $2=_st($1)._signal();
  31851. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},globals.ASTInterpreter)})},
  31852. args: ["aMessage", "anObject"],
  31853. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  31854. messageSends: ["meesage:", "new", "receiver:", "signal"],
  31855. referencedClasses: ["MessageNotUnderstood"]
  31856. }),
  31857. globals.ASTInterpreter);
  31858. smalltalk.addMethod(
  31859. smalltalk.method({
  31860. selector: "next",
  31861. protocol: 'interpreting',
  31862. fn: function (){
  31863. var self=this;
  31864. return smalltalk.withContext(function($ctx1) {
  31865. self._node_(_st(self._node())._nextNode());
  31866. return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.ASTInterpreter)})},
  31867. args: [],
  31868. source: "next\x0a\x09self node: self node nextNode",
  31869. messageSends: ["node:", "nextNode", "node"],
  31870. referencedClasses: []
  31871. }),
  31872. globals.ASTInterpreter);
  31873. smalltalk.addMethod(
  31874. smalltalk.method({
  31875. selector: "node",
  31876. protocol: 'accessing',
  31877. fn: function (){
  31878. var self=this;
  31879. var $1;
  31880. $1=self["@node"];
  31881. return $1;
  31882. },
  31883. args: [],
  31884. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  31885. messageSends: [],
  31886. referencedClasses: []
  31887. }),
  31888. globals.ASTInterpreter);
  31889. smalltalk.addMethod(
  31890. smalltalk.method({
  31891. selector: "node:",
  31892. protocol: 'accessing',
  31893. fn: function (aNode){
  31894. var self=this;
  31895. self["@node"]=aNode;
  31896. return self},
  31897. args: ["aNode"],
  31898. source: "node: aNode\x0a\x09node := aNode",
  31899. messageSends: [],
  31900. referencedClasses: []
  31901. }),
  31902. globals.ASTInterpreter);
  31903. smalltalk.addMethod(
  31904. smalltalk.method({
  31905. selector: "peek",
  31906. protocol: 'stack',
  31907. fn: function (){
  31908. var self=this;
  31909. return smalltalk.withContext(function($ctx1) {
  31910. var $1,$2;
  31911. var $early={};
  31912. try {
  31913. $1=self._stack();
  31914. $ctx1.sendIdx["stack"]=1;
  31915. _st($1)._ifEmpty_((function(){
  31916. throw $early=[nil];
  31917. }));
  31918. $2=_st(self._stack())._last();
  31919. return $2;
  31920. }
  31921. catch(e) {if(e===$early)return e[0]; throw e}
  31922. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.ASTInterpreter)})},
  31923. args: [],
  31924. 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",
  31925. messageSends: ["ifEmpty:", "stack", "last"],
  31926. referencedClasses: []
  31927. }),
  31928. globals.ASTInterpreter);
  31929. smalltalk.addMethod(
  31930. smalltalk.method({
  31931. selector: "pop",
  31932. protocol: 'stack',
  31933. fn: function (){
  31934. var self=this;
  31935. var peekedValue;
  31936. return smalltalk.withContext(function($ctx1) {
  31937. var $1;
  31938. peekedValue=self._peek();
  31939. _st(self._stack())._removeLast();
  31940. $1=peekedValue;
  31941. return $1;
  31942. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},globals.ASTInterpreter)})},
  31943. args: [],
  31944. 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",
  31945. messageSends: ["peek", "removeLast", "stack"],
  31946. referencedClasses: []
  31947. }),
  31948. globals.ASTInterpreter);
  31949. smalltalk.addMethod(
  31950. smalltalk.method({
  31951. selector: "proceed",
  31952. protocol: 'interpreting',
  31953. fn: function (){
  31954. var self=this;
  31955. return smalltalk.withContext(function($ctx1) {
  31956. _st((function(){
  31957. return smalltalk.withContext(function($ctx2) {
  31958. return self._atEnd();
  31959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  31960. return smalltalk.withContext(function($ctx2) {
  31961. return self._step();
  31962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  31963. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTInterpreter)})},
  31964. args: [],
  31965. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  31966. messageSends: ["whileFalse:", "atEnd", "step"],
  31967. referencedClasses: []
  31968. }),
  31969. globals.ASTInterpreter);
  31970. smalltalk.addMethod(
  31971. smalltalk.method({
  31972. selector: "push:",
  31973. protocol: 'stack',
  31974. fn: function (anObject){
  31975. var self=this;
  31976. return smalltalk.withContext(function($ctx1) {
  31977. var $1;
  31978. $1=_st(self._stack())._add_(anObject);
  31979. return $1;
  31980. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},globals.ASTInterpreter)})},
  31981. args: ["anObject"],
  31982. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  31983. messageSends: ["add:", "stack"],
  31984. referencedClasses: []
  31985. }),
  31986. globals.ASTInterpreter);
  31987. smalltalk.addMethod(
  31988. smalltalk.method({
  31989. selector: "restart",
  31990. protocol: 'interpreting',
  31991. fn: function (){
  31992. var self=this;
  31993. return smalltalk.withContext(function($ctx1) {
  31994. self._node_(_st(_st(self._context())._ast())._nextChild());
  31995. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTInterpreter)})},
  31996. args: [],
  31997. source: "restart\x0a\x09self node: self context ast nextChild",
  31998. messageSends: ["node:", "nextChild", "ast", "context"],
  31999. referencedClasses: []
  32000. }),
  32001. globals.ASTInterpreter);
  32002. smalltalk.addMethod(
  32003. smalltalk.method({
  32004. selector: "result",
  32005. protocol: 'accessing',
  32006. fn: function (){
  32007. var self=this;
  32008. return smalltalk.withContext(function($ctx1) {
  32009. var $2,$1;
  32010. $2=self._hasReturned();
  32011. if(smalltalk.assert($2)){
  32012. $1=self._returnValue();
  32013. } else {
  32014. $1=_st(self._context())._receiver();
  32015. };
  32016. return $1;
  32017. }, function($ctx1) {$ctx1.fill(self,"result",{},globals.ASTInterpreter)})},
  32018. args: [],
  32019. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  32020. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  32021. referencedClasses: []
  32022. }),
  32023. globals.ASTInterpreter);
  32024. smalltalk.addMethod(
  32025. smalltalk.method({
  32026. selector: "returnValue",
  32027. protocol: 'accessing',
  32028. fn: function (){
  32029. var self=this;
  32030. var $1;
  32031. $1=self["@returnValue"];
  32032. return $1;
  32033. },
  32034. args: [],
  32035. source: "returnValue\x0a\x09^ returnValue",
  32036. messageSends: [],
  32037. referencedClasses: []
  32038. }),
  32039. globals.ASTInterpreter);
  32040. smalltalk.addMethod(
  32041. smalltalk.method({
  32042. selector: "returnValue:",
  32043. protocol: 'accessing',
  32044. fn: function (anObject){
  32045. var self=this;
  32046. self["@returnValue"]=anObject;
  32047. return self},
  32048. args: ["anObject"],
  32049. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  32050. messageSends: [],
  32051. referencedClasses: []
  32052. }),
  32053. globals.ASTInterpreter);
  32054. smalltalk.addMethod(
  32055. smalltalk.method({
  32056. selector: "sendMessage:to:superSend:",
  32057. protocol: 'private',
  32058. fn: function (aMessage,anObject,aBoolean){
  32059. var self=this;
  32060. var method;
  32061. return smalltalk.withContext(function($ctx1) {
  32062. var $1,$3,$2,$4,$5,$6;
  32063. var $early={};
  32064. try {
  32065. if(! smalltalk.assert(aBoolean)){
  32066. $1=_st(aMessage)._sendTo_(anObject);
  32067. return $1;
  32068. };
  32069. $3=_st(anObject)._class();
  32070. $ctx1.sendIdx["class"]=1;
  32071. $2=_st($3)._superclass();
  32072. $ctx1.sendIdx["superclass"]=1;
  32073. if(($receiver = $2) == nil || $receiver == null){
  32074. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  32075. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  32076. return $4;
  32077. } else {
  32078. $2;
  32079. };
  32080. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  32081. return smalltalk.withContext(function($ctx2) {
  32082. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  32083. throw $early=[$5];
  32084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  32085. $6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  32086. return $6;
  32087. }
  32088. catch(e) {if(e===$early)return e[0]; throw e}
  32089. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},globals.ASTInterpreter)})},
  32090. args: ["aMessage", "anObject", "aBoolean"],
  32091. 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",
  32092. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  32093. referencedClasses: []
  32094. }),
  32095. globals.ASTInterpreter);
  32096. smalltalk.addMethod(
  32097. smalltalk.method({
  32098. selector: "setNonLocalReturnFromContext:",
  32099. protocol: 'interpreting',
  32100. fn: function (aContext){
  32101. var self=this;
  32102. return smalltalk.withContext(function($ctx1) {
  32103. var $2,$1;
  32104. $2=_st(aContext)._interpreter();
  32105. $ctx1.sendIdx["interpreter"]=1;
  32106. $1=_st($2)._hasReturned();
  32107. if(smalltalk.assert($1)){
  32108. self["@returned"]=true;
  32109. self["@returned"];
  32110. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  32111. };
  32112. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},globals.ASTInterpreter)})},
  32113. args: ["aContext"],
  32114. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  32115. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  32116. referencedClasses: []
  32117. }),
  32118. globals.ASTInterpreter);
  32119. smalltalk.addMethod(
  32120. smalltalk.method({
  32121. selector: "skip",
  32122. protocol: 'interpreting',
  32123. fn: function (){
  32124. var self=this;
  32125. return smalltalk.withContext(function($ctx1) {
  32126. self._next();
  32127. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTInterpreter)})},
  32128. args: [],
  32129. source: "skip\x0a\x09self next",
  32130. messageSends: ["next"],
  32131. referencedClasses: []
  32132. }),
  32133. globals.ASTInterpreter);
  32134. smalltalk.addMethod(
  32135. smalltalk.method({
  32136. selector: "stack",
  32137. protocol: 'accessing',
  32138. fn: function (){
  32139. var self=this;
  32140. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  32141. return smalltalk.withContext(function($ctx1) {
  32142. var $2,$1;
  32143. $2=self["@stack"];
  32144. if(($receiver = $2) == nil || $receiver == null){
  32145. self["@stack"]=_st($OrderedCollection())._new();
  32146. $1=self["@stack"];
  32147. } else {
  32148. $1=$2;
  32149. };
  32150. return $1;
  32151. }, function($ctx1) {$ctx1.fill(self,"stack",{},globals.ASTInterpreter)})},
  32152. args: [],
  32153. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  32154. messageSends: ["ifNil:", "new"],
  32155. referencedClasses: ["OrderedCollection"]
  32156. }),
  32157. globals.ASTInterpreter);
  32158. smalltalk.addMethod(
  32159. smalltalk.method({
  32160. selector: "step",
  32161. protocol: 'interpreting',
  32162. fn: function (){
  32163. var self=this;
  32164. return smalltalk.withContext(function($ctx1) {
  32165. var $1;
  32166. self._interpret();
  32167. $1=self._next();
  32168. return self}, function($ctx1) {$ctx1.fill(self,"step",{},globals.ASTInterpreter)})},
  32169. args: [],
  32170. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  32171. messageSends: ["interpret", "next"],
  32172. referencedClasses: []
  32173. }),
  32174. globals.ASTInterpreter);
  32175. smalltalk.addMethod(
  32176. smalltalk.method({
  32177. selector: "stepOver",
  32178. protocol: 'interpreting',
  32179. fn: function (){
  32180. var self=this;
  32181. return smalltalk.withContext(function($ctx1) {
  32182. self._step();
  32183. $ctx1.sendIdx["step"]=1;
  32184. _st((function(){
  32185. return smalltalk.withContext(function($ctx2) {
  32186. return _st(self._node())._isSteppingNode();
  32187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  32188. return smalltalk.withContext(function($ctx2) {
  32189. return self._step();
  32190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  32191. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTInterpreter)})},
  32192. args: [],
  32193. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  32194. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  32195. referencedClasses: []
  32196. }),
  32197. globals.ASTInterpreter);
  32198. smalltalk.addMethod(
  32199. smalltalk.method({
  32200. selector: "visit:",
  32201. protocol: 'visiting',
  32202. fn: function (aNode){
  32203. var self=this;
  32204. return smalltalk.withContext(function($ctx1) {
  32205. var $1;
  32206. $1=self._hasReturned();
  32207. if(! smalltalk.assert($1)){
  32208. globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  32209. };
  32210. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)})},
  32211. args: ["aNode"],
  32212. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  32213. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  32214. referencedClasses: []
  32215. }),
  32216. globals.ASTInterpreter);
  32217. smalltalk.addMethod(
  32218. smalltalk.method({
  32219. selector: "visitAssignmentNode:",
  32220. protocol: 'visiting',
  32221. fn: function (aNode){
  32222. var self=this;
  32223. var poppedValue;
  32224. return smalltalk.withContext(function($ctx1) {
  32225. poppedValue=self._pop();
  32226. $ctx1.sendIdx["pop"]=1;
  32227. self._pop();
  32228. self._push_(poppedValue);
  32229. self._assign_to_(_st(aNode)._left(),poppedValue);
  32230. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},globals.ASTInterpreter)})},
  32231. args: ["aNode"],
  32232. 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",
  32233. messageSends: ["pop", "push:", "assign:to:", "left"],
  32234. referencedClasses: []
  32235. }),
  32236. globals.ASTInterpreter);
  32237. smalltalk.addMethod(
  32238. smalltalk.method({
  32239. selector: "visitBlockNode:",
  32240. protocol: 'visiting',
  32241. fn: function (aNode){
  32242. var self=this;
  32243. var block;
  32244. function $AIBlockClosure(){return globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  32245. return smalltalk.withContext(function($ctx1) {
  32246. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  32247. self._push_(block);
  32248. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},globals.ASTInterpreter)})},
  32249. args: ["aNode"],
  32250. 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",
  32251. messageSends: ["forContext:node:", "context", "push:"],
  32252. referencedClasses: ["AIBlockClosure"]
  32253. }),
  32254. globals.ASTInterpreter);
  32255. smalltalk.addMethod(
  32256. smalltalk.method({
  32257. selector: "visitDynamicArrayNode:",
  32258. protocol: 'visiting',
  32259. fn: function (aNode){
  32260. var self=this;
  32261. var array;
  32262. return smalltalk.withContext(function($ctx1) {
  32263. array=[];
  32264. _st(_st(aNode)._nodes())._do_((function(each){
  32265. return smalltalk.withContext(function($ctx2) {
  32266. return _st(array)._addFirst_(self._pop());
  32267. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  32268. self._push_(array);
  32269. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.ASTInterpreter)})},
  32270. args: ["aNode"],
  32271. 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",
  32272. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  32273. referencedClasses: []
  32274. }),
  32275. globals.ASTInterpreter);
  32276. smalltalk.addMethod(
  32277. smalltalk.method({
  32278. selector: "visitDynamicDictionaryNode:",
  32279. protocol: 'visiting',
  32280. fn: function (aNode){
  32281. var self=this;
  32282. var keyValueList;
  32283. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  32284. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  32285. return smalltalk.withContext(function($ctx1) {
  32286. keyValueList=_st($OrderedCollection())._new();
  32287. _st(_st(aNode)._nodes())._do_((function(each){
  32288. return smalltalk.withContext(function($ctx2) {
  32289. return _st(keyValueList)._add_(self._pop());
  32290. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  32291. self._push_(_st($HashedCollection())._newFromPairs_(_st(keyValueList)._reversed()));
  32292. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},globals.ASTInterpreter)})},
  32293. args: ["aNode"],
  32294. 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)",
  32295. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"],
  32296. referencedClasses: ["OrderedCollection", "HashedCollection"]
  32297. }),
  32298. globals.ASTInterpreter);
  32299. smalltalk.addMethod(
  32300. smalltalk.method({
  32301. selector: "visitJSStatementNode:",
  32302. protocol: 'visiting',
  32303. fn: function (aNode){
  32304. var self=this;
  32305. return smalltalk.withContext(function($ctx1) {
  32306. self["@returned"]=true;
  32307. self._returnValue_(self._eval_(_st(aNode)._source()));
  32308. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.ASTInterpreter)})},
  32309. args: ["aNode"],
  32310. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  32311. messageSends: ["returnValue:", "eval:", "source"],
  32312. referencedClasses: []
  32313. }),
  32314. globals.ASTInterpreter);
  32315. smalltalk.addMethod(
  32316. smalltalk.method({
  32317. selector: "visitNode:",
  32318. protocol: 'visiting',
  32319. fn: function (aNode){
  32320. var self=this;
  32321. return self},
  32322. args: ["aNode"],
  32323. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  32324. messageSends: [],
  32325. referencedClasses: []
  32326. }),
  32327. globals.ASTInterpreter);
  32328. smalltalk.addMethod(
  32329. smalltalk.method({
  32330. selector: "visitReturnNode:",
  32331. protocol: 'visiting',
  32332. fn: function (aNode){
  32333. var self=this;
  32334. return smalltalk.withContext(function($ctx1) {
  32335. self["@returned"]=true;
  32336. self._returnValue_(self._pop());
  32337. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.ASTInterpreter)})},
  32338. args: ["aNode"],
  32339. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  32340. messageSends: ["returnValue:", "pop"],
  32341. referencedClasses: []
  32342. }),
  32343. globals.ASTInterpreter);
  32344. smalltalk.addMethod(
  32345. smalltalk.method({
  32346. selector: "visitSendNode:",
  32347. protocol: 'visiting',
  32348. fn: function (aNode){
  32349. var self=this;
  32350. var receiver,args,message,result;
  32351. return smalltalk.withContext(function($ctx1) {
  32352. var $1;
  32353. args=_st(_st(aNode)._arguments())._collect_((function(each){
  32354. return smalltalk.withContext(function($ctx2) {
  32355. return self._pop();
  32356. $ctx2.sendIdx["pop"]=1;
  32357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  32358. receiver=self._pop();
  32359. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  32360. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  32361. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  32362. return smalltalk.withContext(function($ctx2) {
  32363. return _st(_st(aNode)._isLastChild())._not();
  32364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  32365. if(smalltalk.assert($1)){
  32366. self._push_(receiver);
  32367. $ctx1.sendIdx["push:"]=1;
  32368. } else {
  32369. self._push_(result);
  32370. };
  32371. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},globals.ASTInterpreter)})},
  32372. args: ["aNode"],
  32373. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\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\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  32374. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  32375. referencedClasses: []
  32376. }),
  32377. globals.ASTInterpreter);
  32378. smalltalk.addMethod(
  32379. smalltalk.method({
  32380. selector: "visitValueNode:",
  32381. protocol: 'visiting',
  32382. fn: function (aNode){
  32383. var self=this;
  32384. return smalltalk.withContext(function($ctx1) {
  32385. self._push_(_st(aNode)._value());
  32386. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.ASTInterpreter)})},
  32387. args: ["aNode"],
  32388. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  32389. messageSends: ["push:", "value"],
  32390. referencedClasses: []
  32391. }),
  32392. globals.ASTInterpreter);
  32393. smalltalk.addMethod(
  32394. smalltalk.method({
  32395. selector: "visitVariableNode:",
  32396. protocol: 'visiting',
  32397. fn: function (aNode){
  32398. var self=this;
  32399. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  32400. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  32401. return smalltalk.withContext(function($ctx1) {
  32402. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  32403. $2=_st(aNode)._binding();
  32404. $ctx1.sendIdx["binding"]=1;
  32405. $1=_st($2)._isUnknownVar();
  32406. if(smalltalk.assert($1)){
  32407. $5=_st($PlatformInterface())._globals();
  32408. $ctx1.sendIdx["globals"]=1;
  32409. $6=_st(aNode)._value();
  32410. $ctx1.sendIdx["value"]=1;
  32411. $4=_st($5)._at_ifAbsent_($6,(function(){
  32412. return smalltalk.withContext(function($ctx2) {
  32413. return self._error_("Unknown variable");
  32414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  32415. $ctx1.sendIdx["at:ifAbsent:"]=1;
  32416. $3=self._push_($4);
  32417. $ctx1.sendIdx["push:"]=1;
  32418. return $3;
  32419. };
  32420. $8=_st(_st(aNode)._binding())._isInstanceVar();
  32421. if(smalltalk.assert($8)){
  32422. $10=self._context();
  32423. $ctx1.sendIdx["context"]=1;
  32424. $9=_st($10)._receiver();
  32425. $11=_st(aNode)._value();
  32426. $ctx1.sendIdx["value"]=2;
  32427. $7=_st($9)._instVarAt_($11);
  32428. } else {
  32429. $12=self._context();
  32430. $13=_st(aNode)._value();
  32431. $ctx1.sendIdx["value"]=3;
  32432. $7=_st($12)._localAt_ifAbsent_($13,(function(){
  32433. return smalltalk.withContext(function($ctx2) {
  32434. $15=_st(aNode)._value();
  32435. $ctx2.sendIdx["value"]=4;
  32436. $14=_st($15)._isCapitalized();
  32437. if(smalltalk.assert($14)){
  32438. $16=_st($Smalltalk())._globals();
  32439. $ctx2.sendIdx["globals"]=2;
  32440. $17=_st(aNode)._value();
  32441. $ctx2.sendIdx["value"]=5;
  32442. return _st($16)._at_ifAbsent_($17,(function(){
  32443. return smalltalk.withContext(function($ctx3) {
  32444. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  32445. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  32446. };
  32447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  32448. };
  32449. self._push_($7);
  32450. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.ASTInterpreter)})},
  32451. args: ["aNode"],
  32452. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface 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: [ PlatformInterface globals at: aNode value ] ] ] ])",
  32453. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"],
  32454. referencedClasses: ["PlatformInterface", "Smalltalk"]
  32455. }),
  32456. globals.ASTInterpreter);
  32457. smalltalk.addClass('ASTInterpreterError', globals.Error, [], 'Compiler-Interpreter');
  32458. globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  32459. smalltalk.addClass('ASTPCNodeVisitor', globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  32460. 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`";
  32461. smalltalk.addMethod(
  32462. smalltalk.method({
  32463. selector: "context",
  32464. protocol: 'accessing',
  32465. fn: function (){
  32466. var self=this;
  32467. var $1;
  32468. $1=self["@context"];
  32469. return $1;
  32470. },
  32471. args: [],
  32472. source: "context\x0a\x09^ context",
  32473. messageSends: [],
  32474. referencedClasses: []
  32475. }),
  32476. globals.ASTPCNodeVisitor);
  32477. smalltalk.addMethod(
  32478. smalltalk.method({
  32479. selector: "context:",
  32480. protocol: 'accessing',
  32481. fn: function (aContext){
  32482. var self=this;
  32483. self["@context"]=aContext;
  32484. return self},
  32485. args: ["aContext"],
  32486. source: "context: aContext\x0a\x09context := aContext",
  32487. messageSends: [],
  32488. referencedClasses: []
  32489. }),
  32490. globals.ASTPCNodeVisitor);
  32491. smalltalk.addMethod(
  32492. smalltalk.method({
  32493. selector: "currentNode",
  32494. protocol: 'accessing',
  32495. fn: function (){
  32496. var self=this;
  32497. var $1;
  32498. $1=self["@currentNode"];
  32499. return $1;
  32500. },
  32501. args: [],
  32502. source: "currentNode\x0a\x09^ currentNode",
  32503. messageSends: [],
  32504. referencedClasses: []
  32505. }),
  32506. globals.ASTPCNodeVisitor);
  32507. smalltalk.addMethod(
  32508. smalltalk.method({
  32509. selector: "increaseIndex",
  32510. protocol: 'accessing',
  32511. fn: function (){
  32512. var self=this;
  32513. return smalltalk.withContext(function($ctx1) {
  32514. self["@index"]=_st(self._index()).__plus((1));
  32515. return self}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},globals.ASTPCNodeVisitor)})},
  32516. args: [],
  32517. source: "increaseIndex\x0a\x09index := self index + 1",
  32518. messageSends: ["+", "index"],
  32519. referencedClasses: []
  32520. }),
  32521. globals.ASTPCNodeVisitor);
  32522. smalltalk.addMethod(
  32523. smalltalk.method({
  32524. selector: "index",
  32525. protocol: 'accessing',
  32526. fn: function (){
  32527. var self=this;
  32528. return smalltalk.withContext(function($ctx1) {
  32529. var $2,$1;
  32530. $2=self["@index"];
  32531. if(($receiver = $2) == nil || $receiver == null){
  32532. self["@index"]=(0);
  32533. $1=self["@index"];
  32534. } else {
  32535. $1=$2;
  32536. };
  32537. return $1;
  32538. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.ASTPCNodeVisitor)})},
  32539. args: [],
  32540. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  32541. messageSends: ["ifNil:"],
  32542. referencedClasses: []
  32543. }),
  32544. globals.ASTPCNodeVisitor);
  32545. smalltalk.addMethod(
  32546. smalltalk.method({
  32547. selector: "selector",
  32548. protocol: 'accessing',
  32549. fn: function (){
  32550. var self=this;
  32551. var $1;
  32552. $1=self["@selector"];
  32553. return $1;
  32554. },
  32555. args: [],
  32556. source: "selector\x0a\x09^ selector",
  32557. messageSends: [],
  32558. referencedClasses: []
  32559. }),
  32560. globals.ASTPCNodeVisitor);
  32561. smalltalk.addMethod(
  32562. smalltalk.method({
  32563. selector: "selector:",
  32564. protocol: 'accessing',
  32565. fn: function (aString){
  32566. var self=this;
  32567. self["@selector"]=aString;
  32568. return self},
  32569. args: ["aString"],
  32570. source: "selector: aString\x0a\x09selector := aString",
  32571. messageSends: [],
  32572. referencedClasses: []
  32573. }),
  32574. globals.ASTPCNodeVisitor);
  32575. smalltalk.addMethod(
  32576. smalltalk.method({
  32577. selector: "visitJSStatementNode:",
  32578. protocol: 'visiting',
  32579. fn: function (aNode){
  32580. var self=this;
  32581. self["@currentNode"]=aNode;
  32582. return self},
  32583. args: ["aNode"],
  32584. 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",
  32585. messageSends: [],
  32586. referencedClasses: []
  32587. }),
  32588. globals.ASTPCNodeVisitor);
  32589. smalltalk.addMethod(
  32590. smalltalk.method({
  32591. selector: "visitSendNode:",
  32592. protocol: 'visiting',
  32593. fn: function (aNode){
  32594. var self=this;
  32595. var sendIndex;
  32596. return smalltalk.withContext(function($ctx1) {
  32597. var $1,$2,$4,$3,$6,$5,$7;
  32598. $1=self._context();
  32599. $2=self._selector();
  32600. $ctx1.sendIdx["selector"]=1;
  32601. sendIndex=_st($1)._sendIndexAt_($2);
  32602. globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  32603. $4=self._selector();
  32604. $ctx1.sendIdx["selector"]=2;
  32605. $3=_st($4).__eq(_st(aNode)._selector());
  32606. if(smalltalk.assert($3)){
  32607. $6=self._index();
  32608. $ctx1.sendIdx["index"]=1;
  32609. $5=_st($6).__lt(sendIndex);
  32610. if(! smalltalk.assert($5)){
  32611. $7=_st(self._index()).__gt(sendIndex);
  32612. if(! smalltalk.assert($7)){
  32613. self["@currentNode"]=aNode;
  32614. self["@currentNode"];
  32615. };
  32616. };
  32617. self._increaseIndex();
  32618. };
  32619. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},globals.ASTPCNodeVisitor)})},
  32620. args: ["aNode"],
  32621. 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 ifFalse: [ \x0a\x09\x09\x09self index > sendIndex ifFalse: [ currentNode := aNode ] ].\x0a\x09\x09self increaseIndex ]",
  32622. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "ifFalse:", "<", "index", ">", "increaseIndex"],
  32623. referencedClasses: []
  32624. }),
  32625. globals.ASTPCNodeVisitor);
  32626. smalltalk.addMethod(
  32627. smalltalk.method({
  32628. selector: "isSteppingNode",
  32629. protocol: '*Compiler-Interpreter',
  32630. fn: function (){
  32631. var self=this;
  32632. return true;
  32633. },
  32634. args: [],
  32635. source: "isSteppingNode\x0a\x09^ true",
  32636. messageSends: [],
  32637. referencedClasses: []
  32638. }),
  32639. globals.AssignmentNode);
  32640. smalltalk.addMethod(
  32641. smalltalk.method({
  32642. selector: "isSteppingNode",
  32643. protocol: '*Compiler-Interpreter',
  32644. fn: function (){
  32645. var self=this;
  32646. return true;
  32647. },
  32648. args: [],
  32649. source: "isSteppingNode\x0a\x09^ true",
  32650. messageSends: [],
  32651. referencedClasses: []
  32652. }),
  32653. globals.BlockNode);
  32654. smalltalk.addMethod(
  32655. smalltalk.method({
  32656. selector: "isSteppingNode",
  32657. protocol: '*Compiler-Interpreter',
  32658. fn: function (){
  32659. var self=this;
  32660. return true;
  32661. },
  32662. args: [],
  32663. source: "isSteppingNode\x0a\x09^ true",
  32664. messageSends: [],
  32665. referencedClasses: []
  32666. }),
  32667. globals.DynamicArrayNode);
  32668. smalltalk.addMethod(
  32669. smalltalk.method({
  32670. selector: "isSteppingNode",
  32671. protocol: '*Compiler-Interpreter',
  32672. fn: function (){
  32673. var self=this;
  32674. return true;
  32675. },
  32676. args: [],
  32677. source: "isSteppingNode\x0a\x09^ true",
  32678. messageSends: [],
  32679. referencedClasses: []
  32680. }),
  32681. globals.DynamicDictionaryNode);
  32682. smalltalk.addMethod(
  32683. smalltalk.method({
  32684. selector: "isSteppingNode",
  32685. protocol: '*Compiler-Interpreter',
  32686. fn: function (){
  32687. var self=this;
  32688. return true;
  32689. },
  32690. args: [],
  32691. source: "isSteppingNode\x0a\x09^ true",
  32692. messageSends: [],
  32693. referencedClasses: []
  32694. }),
  32695. globals.JSStatementNode);
  32696. smalltalk.addMethod(
  32697. smalltalk.method({
  32698. selector: "isSteppingNode",
  32699. protocol: '*Compiler-Interpreter',
  32700. fn: function (){
  32701. var self=this;
  32702. return false;
  32703. },
  32704. args: [],
  32705. source: "isSteppingNode\x0a\x09^ false",
  32706. messageSends: [],
  32707. referencedClasses: []
  32708. }),
  32709. globals.Node);
  32710. smalltalk.addMethod(
  32711. smalltalk.method({
  32712. selector: "isSteppingNode",
  32713. protocol: '*Compiler-Interpreter',
  32714. fn: function (){
  32715. var self=this;
  32716. return true;
  32717. },
  32718. args: [],
  32719. source: "isSteppingNode\x0a\x09^ true",
  32720. messageSends: [],
  32721. referencedClasses: []
  32722. }),
  32723. globals.SendNode);
  32724. });
  32725. define("amber_vm/parser", ["./globals", "./nil"], function(globals, nil) {
  32726. globals.SmalltalkParser = (function() {
  32727. /*
  32728. * Generated by PEG.js 0.8.0.
  32729. *
  32730. * http://pegjs.majda.cz/
  32731. */
  32732. function peg$subclass(child, parent) {
  32733. function ctor() { this.constructor = child; }
  32734. ctor.prototype = parent.prototype;
  32735. child.prototype = new ctor();
  32736. }
  32737. function SyntaxError(message, expected, found, offset, line, column) {
  32738. this.message = message;
  32739. this.expected = expected;
  32740. this.found = found;
  32741. this.offset = offset;
  32742. this.line = line;
  32743. this.column = column;
  32744. this.name = "SyntaxError";
  32745. }
  32746. peg$subclass(SyntaxError, Error);
  32747. function parse(input) {
  32748. var options = arguments.length > 1 ? arguments[1] : {},
  32749. peg$FAILED = {},
  32750. peg$startRuleFunctions = { start: peg$parsestart },
  32751. peg$startRuleFunction = peg$parsestart,
  32752. peg$c0 = [],
  32753. peg$c1 = peg$FAILED,
  32754. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  32755. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  32756. peg$c4 = /^["]/,
  32757. peg$c5 = { type: "class", value: "[\"]", description: "[\"]" },
  32758. peg$c6 = /^[^"]/,
  32759. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  32760. peg$c8 = /^[a-zA-Z]/,
  32761. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  32762. peg$c10 = /^[a-zA-Z0-9]/,
  32763. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  32764. peg$c12 = function(first, others) {return first + others.join("");},
  32765. peg$c13 = /^[:]/,
  32766. peg$c14 = { type: "class", value: "[:]", description: "[:]" },
  32767. peg$c15 = function(first, last) {return first + last;},
  32768. peg$c16 = /^[a-zA-Z0-9:]/,
  32769. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  32770. peg$c18 = /^[A-Z]/,
  32771. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  32772. peg$c20 = /^[']/,
  32773. peg$c21 = { type: "class", value: "[']", description: "[']" },
  32774. peg$c22 = "''",
  32775. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  32776. peg$c24 = function() {return "'";},
  32777. peg$c25 = /^[^']/,
  32778. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  32779. peg$c27 = function(val) {
  32780. return globals.ValueNode._new()
  32781. ._position_((line()).__at(column()))
  32782. ._source_(text())
  32783. ._value_(val.join("").replace(/\"/ig, '"'));
  32784. },
  32785. peg$c28 = "#",
  32786. peg$c29 = { type: "literal", value: "#", description: "\"#\"" },
  32787. peg$c30 = function(rest) {return rest;},
  32788. peg$c31 = function(node) {return node._value();},
  32789. peg$c32 = function(val) {
  32790. return globals.ValueNode._new()
  32791. ._position_((line()).__at(column()))
  32792. ._source_(text())
  32793. ._value_(val);
  32794. },
  32795. peg$c33 = function(n) {
  32796. return globals.ValueNode._new()
  32797. ._position_((line()).__at(column()))
  32798. ._source_(text())
  32799. ._value_(n);
  32800. },
  32801. peg$c34 = "e",
  32802. peg$c35 = { type: "literal", value: "e", description: "\"e\"" },
  32803. peg$c36 = function(n) {return parseFloat(n.join(""));},
  32804. peg$c37 = null,
  32805. peg$c38 = /^[\-]/,
  32806. peg$c39 = { type: "class", value: "[\\-]", description: "[\\-]" },
  32807. peg$c40 = "16r",
  32808. peg$c41 = { type: "literal", value: "16r", description: "\"16r\"" },
  32809. peg$c42 = /^[0-9a-fA-F]/,
  32810. peg$c43 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  32811. peg$c44 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  32812. peg$c45 = /^[0-9]/,
  32813. peg$c46 = { type: "class", value: "[0-9]", description: "[0-9]" },
  32814. peg$c47 = ".",
  32815. peg$c48 = { type: "literal", value: ".", description: "\".\"" },
  32816. peg$c49 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  32817. peg$c50 = function(neg, digits) {return (parseInt((neg || '') +digits.join(""), 10));},
  32818. peg$c51 = "#(",
  32819. peg$c52 = { type: "literal", value: "#(", description: "\"#(\"" },
  32820. peg$c53 = "(",
  32821. peg$c54 = { type: "literal", value: "(", description: "\"(\"" },
  32822. peg$c55 = function(lit) {return lit._value();},
  32823. peg$c56 = ")",
  32824. peg$c57 = { type: "literal", value: ")", description: "\")\"" },
  32825. peg$c58 = function(lits) {
  32826. return globals.ValueNode._new()
  32827. ._position_((line()).__at(column()))
  32828. ._source_(text())
  32829. ._value_(lits);
  32830. },
  32831. peg$c59 = "{",
  32832. peg$c60 = { type: "literal", value: "{", description: "\"{\"" },
  32833. peg$c61 = "}",
  32834. peg$c62 = { type: "literal", value: "}", description: "\"}\"" },
  32835. peg$c63 = function(expressions) {
  32836. return globals.DynamicArrayNode._new()
  32837. ._position_((line()).__at(column()))
  32838. ._source_(text())
  32839. ._nodes_(expressions || []);
  32840. },
  32841. peg$c64 = "#{",
  32842. peg$c65 = { type: "literal", value: "#{", description: "\"#{\"" },
  32843. peg$c66 = function(expressions) {
  32844. return globals.DynamicDictionaryNode._new()
  32845. ._position_((line()).__at(column()))
  32846. ._source_(text())
  32847. ._nodes_(expressions || []);
  32848. },
  32849. peg$c67 = "true",
  32850. peg$c68 = { type: "literal", value: "true", description: "\"true\"" },
  32851. peg$c69 = function() {return true;},
  32852. peg$c70 = "false",
  32853. peg$c71 = { type: "literal", value: "false", description: "\"false\"" },
  32854. peg$c72 = function() {return false;},
  32855. peg$c73 = "nil",
  32856. peg$c74 = { type: "literal", value: "nil", description: "\"nil\"" },
  32857. peg$c75 = function() {return nil;},
  32858. peg$c76 = function(val) {
  32859. return globals.ValueNode._new()
  32860. ._position_((line()).__at(column()))
  32861. ._source_(text())
  32862. ._value_(val);
  32863. },
  32864. peg$c77 = function(identifier) {
  32865. return globals.VariableNode._new()
  32866. ._position_((line()).__at(column()))
  32867. ._source_(text())
  32868. ._value_(identifier);
  32869. },
  32870. peg$c78 = function(key, arg) {return {key:key, arg: arg};},
  32871. peg$c79 = /^[\\+*\/=><,@%~|&\-]/,
  32872. peg$c80 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  32873. peg$c81 = function(bin) {return bin.join("");},
  32874. peg$c82 = function(pairs) {
  32875. var keywords = [];
  32876. var params = [];
  32877. var i = 0;
  32878. for(i = 0; i < pairs.length; i++){
  32879. keywords.push(pairs[i].key);
  32880. }
  32881. for(i = 0; i < pairs.length; i++){
  32882. params.push(pairs[i].arg);
  32883. }
  32884. return [keywords.join(""), params];
  32885. },
  32886. peg$c83 = function(selector, arg) {return [selector, [arg]];},
  32887. peg$c84 = function(selector) {return [selector, []];},
  32888. peg$c85 = function(expression) {return expression;},
  32889. peg$c86 = function(first, others) { return [first].concat(others); },
  32890. peg$c87 = ":=",
  32891. peg$c88 = { type: "literal", value: ":=", description: "\":=\"" },
  32892. peg$c89 = function(variable, expression) {
  32893. return globals.AssignmentNode._new()
  32894. ._position_((line()).__at(column()))
  32895. ._source_(text())
  32896. ._left_(variable)
  32897. ._right_(expression);
  32898. },
  32899. peg$c90 = "^",
  32900. peg$c91 = { type: "literal", value: "^", description: "\"^\"" },
  32901. peg$c92 = function(expression) {
  32902. return globals.ReturnNode._new()
  32903. ._position_((line()).__at(column()))
  32904. ._source_(text())
  32905. ._nodes_([expression]);
  32906. },
  32907. peg$c93 = "|",
  32908. peg$c94 = { type: "literal", value: "|", description: "\"|\"" },
  32909. peg$c95 = function(variable) {return variable;},
  32910. peg$c96 = function(vars) {return vars;},
  32911. peg$c97 = ":",
  32912. peg$c98 = { type: "literal", value: ":", description: "\":\"" },
  32913. peg$c99 = function(param) {return param;},
  32914. peg$c100 = function(params) {return params;},
  32915. peg$c101 = /^[.]/,
  32916. peg$c102 = { type: "class", value: "[.]", description: "[.]" },
  32917. peg$c103 = function(ret) {return [ret];},
  32918. peg$c104 = function(exps, ret) {
  32919. var expressions = exps;
  32920. expressions.push(ret);
  32921. return expressions;
  32922. },
  32923. peg$c105 = function(expressions) {
  32924. return expressions || [];
  32925. },
  32926. peg$c106 = function(temps, statements) {
  32927. return globals.SequenceNode._new()
  32928. ._position_((line()).__at(column()))
  32929. ._source_(text())
  32930. ._temps_(temps || [])
  32931. ._nodes_(statements || []);
  32932. },
  32933. peg$c107 = "[",
  32934. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  32935. peg$c109 = "]",
  32936. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  32937. peg$c111 = function(params, sequence) {
  32938. return globals.BlockNode._new()
  32939. ._position_((line()).__at(column()))
  32940. ._source_(text())
  32941. ._parameters_(params || [])
  32942. ._nodes_([sequence._asBlockSequenceNode()]);
  32943. },
  32944. peg$c112 = void 0,
  32945. peg$c113 = function(selector) {
  32946. return globals.SendNode._new()
  32947. ._position_((line()).__at(column()))
  32948. ._source_(text())
  32949. ._selector_(selector);
  32950. },
  32951. peg$c114 = function(message, tail) {
  32952. if(tail) {
  32953. return tail._valueForReceiver_(message);
  32954. }
  32955. else {
  32956. return message;
  32957. }
  32958. },
  32959. peg$c115 = function(receiver, tail) {
  32960. if(tail) {
  32961. return tail._valueForReceiver_(receiver);
  32962. }
  32963. else {
  32964. return receiver;
  32965. }
  32966. },
  32967. peg$c116 = function(selector, arg) {
  32968. return globals.SendNode._new()
  32969. ._position_((line()).__at(column()))
  32970. ._source_(text())
  32971. ._selector_(selector)
  32972. ._arguments_([arg]);
  32973. },
  32974. peg$c117 = function(message, tail) {
  32975. if(tail) {
  32976. return tail._valueForReceiver_(message);
  32977. }
  32978. else {
  32979. return message;
  32980. }
  32981. },
  32982. peg$c118 = function(pair) {return pair;},
  32983. peg$c119 = function(pairs) {
  32984. var selector = [];
  32985. var args = [];
  32986. for(var i = 0; i < pairs.length; i++) {
  32987. selector.push(pairs[i].key);
  32988. args.push(pairs[i].arg);
  32989. }
  32990. return globals.SendNode._new()
  32991. ._position_((line()).__at(column()))
  32992. ._source_(text())
  32993. ._selector_(selector.join(""))
  32994. ._arguments_(args);
  32995. },
  32996. peg$c120 = function(receiver, tail) {
  32997. return tail._valueForReceiver_(receiver);
  32998. },
  32999. peg$c121 = ";",
  33000. peg$c122 = { type: "literal", value: ";", description: "\";\"" },
  33001. peg$c123 = function(mess) {return mess;},
  33002. peg$c124 = function(send, messages) {
  33003. var cascade = [];
  33004. cascade.push(send);
  33005. for(var i = 0; i < messages.length; i++) {
  33006. cascade.push(messages[i]);
  33007. }
  33008. return globals.CascadeNode._new()
  33009. ._position_((line()).__at(column()))
  33010. ._source_(text())
  33011. ._receiver_(send._receiver())
  33012. ._nodes_(cascade);
  33013. },
  33014. peg$c125 = "<",
  33015. peg$c126 = { type: "literal", value: "<", description: "\"<\"" },
  33016. peg$c127 = ">>",
  33017. peg$c128 = { type: "literal", value: ">>", description: "\">>\"" },
  33018. peg$c129 = function() {return ">";},
  33019. peg$c130 = /^[^>]/,
  33020. peg$c131 = { type: "class", value: "[^>]", description: "[^>]" },
  33021. peg$c132 = ">",
  33022. peg$c133 = { type: "literal", value: ">", description: "\">\"" },
  33023. peg$c134 = function(val) {
  33024. return globals.JSStatementNode._new()
  33025. ._position_((line()).__at(column()))
  33026. ._source_(val.join(""))
  33027. },
  33028. peg$c135 = function(pattern, sequence) {
  33029. return globals.MethodNode._new()
  33030. ._position_((line()).__at(column()))
  33031. ._source_(text())
  33032. ._selector_(pattern[0])
  33033. ._arguments_(pattern[1])
  33034. ._nodes_([sequence]);
  33035. },
  33036. peg$c136 = function(send) { return send._selector() === "->" },
  33037. peg$c137 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  33038. peg$c138 = function(first, others) { return first.concat.apply(first, others); },
  33039. peg$currPos = 0,
  33040. peg$reportedPos = 0,
  33041. peg$cachedPos = 0,
  33042. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  33043. peg$maxFailPos = 0,
  33044. peg$maxFailExpected = [],
  33045. peg$silentFails = 0,
  33046. peg$cache = {},
  33047. peg$result;
  33048. if ("startRule" in options) {
  33049. if (!(options.startRule in peg$startRuleFunctions)) {
  33050. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  33051. }
  33052. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  33053. }
  33054. function text() {
  33055. return input.substring(peg$reportedPos, peg$currPos);
  33056. }
  33057. function offset() {
  33058. return peg$reportedPos;
  33059. }
  33060. function line() {
  33061. return peg$computePosDetails(peg$reportedPos).line;
  33062. }
  33063. function column() {
  33064. return peg$computePosDetails(peg$reportedPos).column;
  33065. }
  33066. function expected(description) {
  33067. throw peg$buildException(
  33068. null,
  33069. [{ type: "other", description: description }],
  33070. peg$reportedPos
  33071. );
  33072. }
  33073. function error(message) {
  33074. throw peg$buildException(message, null, peg$reportedPos);
  33075. }
  33076. function peg$computePosDetails(pos) {
  33077. function advance(details, startPos, endPos) {
  33078. var p, ch;
  33079. for (p = startPos; p < endPos; p++) {
  33080. ch = input.charAt(p);
  33081. if (ch === "\n") {
  33082. if (!details.seenCR) { details.line++; }
  33083. details.column = 1;
  33084. details.seenCR = false;
  33085. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  33086. details.line++;
  33087. details.column = 1;
  33088. details.seenCR = true;
  33089. } else {
  33090. details.column++;
  33091. details.seenCR = false;
  33092. }
  33093. }
  33094. }
  33095. if (peg$cachedPos !== pos) {
  33096. if (peg$cachedPos > pos) {
  33097. peg$cachedPos = 0;
  33098. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  33099. }
  33100. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  33101. peg$cachedPos = pos;
  33102. }
  33103. return peg$cachedPosDetails;
  33104. }
  33105. function peg$fail(expected) {
  33106. if (peg$currPos < peg$maxFailPos) { return; }
  33107. if (peg$currPos > peg$maxFailPos) {
  33108. peg$maxFailPos = peg$currPos;
  33109. peg$maxFailExpected = [];
  33110. }
  33111. peg$maxFailExpected.push(expected);
  33112. }
  33113. function peg$buildException(message, expected, pos) {
  33114. function cleanupExpected(expected) {
  33115. var i = 1;
  33116. expected.sort(function(a, b) {
  33117. if (a.description < b.description) {
  33118. return -1;
  33119. } else if (a.description > b.description) {
  33120. return 1;
  33121. } else {
  33122. return 0;
  33123. }
  33124. });
  33125. while (i < expected.length) {
  33126. if (expected[i - 1] === expected[i]) {
  33127. expected.splice(i, 1);
  33128. } else {
  33129. i++;
  33130. }
  33131. }
  33132. }
  33133. function buildMessage(expected, found) {
  33134. function stringEscape(s) {
  33135. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  33136. return s
  33137. .replace(/\\/g, '\\\\')
  33138. .replace(/"/g, '\\"')
  33139. .replace(/\x08/g, '\\b')
  33140. .replace(/\t/g, '\\t')
  33141. .replace(/\n/g, '\\n')
  33142. .replace(/\f/g, '\\f')
  33143. .replace(/\r/g, '\\r')
  33144. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  33145. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  33146. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  33147. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  33148. }
  33149. var expectedDescs = new Array(expected.length),
  33150. expectedDesc, foundDesc, i;
  33151. for (i = 0; i < expected.length; i++) {
  33152. expectedDescs[i] = expected[i].description;
  33153. }
  33154. expectedDesc = expected.length > 1
  33155. ? expectedDescs.slice(0, -1).join(", ")
  33156. + " or "
  33157. + expectedDescs[expected.length - 1]
  33158. : expectedDescs[0];
  33159. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  33160. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  33161. }
  33162. var posDetails = peg$computePosDetails(pos),
  33163. found = pos < input.length ? input.charAt(pos) : null;
  33164. if (expected !== null) {
  33165. cleanupExpected(expected);
  33166. }
  33167. return new SyntaxError(
  33168. message !== null ? message : buildMessage(expected, found),
  33169. expected,
  33170. found,
  33171. pos,
  33172. posDetails.line,
  33173. posDetails.column
  33174. );
  33175. }
  33176. function peg$parsestart() {
  33177. var s0;
  33178. var key = peg$currPos * 59 + 0,
  33179. cached = peg$cache[key];
  33180. if (cached) {
  33181. peg$currPos = cached.nextPos;
  33182. return cached.result;
  33183. }
  33184. s0 = peg$parsemethod();
  33185. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33186. return s0;
  33187. }
  33188. function peg$parseseparator() {
  33189. var s0, s1;
  33190. var key = peg$currPos * 59 + 1,
  33191. cached = peg$cache[key];
  33192. if (cached) {
  33193. peg$currPos = cached.nextPos;
  33194. return cached.result;
  33195. }
  33196. s0 = [];
  33197. if (peg$c2.test(input.charAt(peg$currPos))) {
  33198. s1 = input.charAt(peg$currPos);
  33199. peg$currPos++;
  33200. } else {
  33201. s1 = peg$FAILED;
  33202. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  33203. }
  33204. if (s1 !== peg$FAILED) {
  33205. while (s1 !== peg$FAILED) {
  33206. s0.push(s1);
  33207. if (peg$c2.test(input.charAt(peg$currPos))) {
  33208. s1 = input.charAt(peg$currPos);
  33209. peg$currPos++;
  33210. } else {
  33211. s1 = peg$FAILED;
  33212. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  33213. }
  33214. }
  33215. } else {
  33216. s0 = peg$c1;
  33217. }
  33218. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33219. return s0;
  33220. }
  33221. function peg$parsecomments() {
  33222. var s0, s1, s2, s3, s4;
  33223. var key = peg$currPos * 59 + 2,
  33224. cached = peg$cache[key];
  33225. if (cached) {
  33226. peg$currPos = cached.nextPos;
  33227. return cached.result;
  33228. }
  33229. s0 = [];
  33230. s1 = peg$currPos;
  33231. if (peg$c4.test(input.charAt(peg$currPos))) {
  33232. s2 = input.charAt(peg$currPos);
  33233. peg$currPos++;
  33234. } else {
  33235. s2 = peg$FAILED;
  33236. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  33237. }
  33238. if (s2 !== peg$FAILED) {
  33239. s3 = [];
  33240. if (peg$c6.test(input.charAt(peg$currPos))) {
  33241. s4 = input.charAt(peg$currPos);
  33242. peg$currPos++;
  33243. } else {
  33244. s4 = peg$FAILED;
  33245. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  33246. }
  33247. while (s4 !== peg$FAILED) {
  33248. s3.push(s4);
  33249. if (peg$c6.test(input.charAt(peg$currPos))) {
  33250. s4 = input.charAt(peg$currPos);
  33251. peg$currPos++;
  33252. } else {
  33253. s4 = peg$FAILED;
  33254. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  33255. }
  33256. }
  33257. if (s3 !== peg$FAILED) {
  33258. if (peg$c4.test(input.charAt(peg$currPos))) {
  33259. s4 = input.charAt(peg$currPos);
  33260. peg$currPos++;
  33261. } else {
  33262. s4 = peg$FAILED;
  33263. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  33264. }
  33265. if (s4 !== peg$FAILED) {
  33266. s2 = [s2, s3, s4];
  33267. s1 = s2;
  33268. } else {
  33269. peg$currPos = s1;
  33270. s1 = peg$c1;
  33271. }
  33272. } else {
  33273. peg$currPos = s1;
  33274. s1 = peg$c1;
  33275. }
  33276. } else {
  33277. peg$currPos = s1;
  33278. s1 = peg$c1;
  33279. }
  33280. if (s1 !== peg$FAILED) {
  33281. while (s1 !== peg$FAILED) {
  33282. s0.push(s1);
  33283. s1 = peg$currPos;
  33284. if (peg$c4.test(input.charAt(peg$currPos))) {
  33285. s2 = input.charAt(peg$currPos);
  33286. peg$currPos++;
  33287. } else {
  33288. s2 = peg$FAILED;
  33289. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  33290. }
  33291. if (s2 !== peg$FAILED) {
  33292. s3 = [];
  33293. if (peg$c6.test(input.charAt(peg$currPos))) {
  33294. s4 = input.charAt(peg$currPos);
  33295. peg$currPos++;
  33296. } else {
  33297. s4 = peg$FAILED;
  33298. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  33299. }
  33300. while (s4 !== peg$FAILED) {
  33301. s3.push(s4);
  33302. if (peg$c6.test(input.charAt(peg$currPos))) {
  33303. s4 = input.charAt(peg$currPos);
  33304. peg$currPos++;
  33305. } else {
  33306. s4 = peg$FAILED;
  33307. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  33308. }
  33309. }
  33310. if (s3 !== peg$FAILED) {
  33311. if (peg$c4.test(input.charAt(peg$currPos))) {
  33312. s4 = input.charAt(peg$currPos);
  33313. peg$currPos++;
  33314. } else {
  33315. s4 = peg$FAILED;
  33316. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  33317. }
  33318. if (s4 !== peg$FAILED) {
  33319. s2 = [s2, s3, s4];
  33320. s1 = s2;
  33321. } else {
  33322. peg$currPos = s1;
  33323. s1 = peg$c1;
  33324. }
  33325. } else {
  33326. peg$currPos = s1;
  33327. s1 = peg$c1;
  33328. }
  33329. } else {
  33330. peg$currPos = s1;
  33331. s1 = peg$c1;
  33332. }
  33333. }
  33334. } else {
  33335. s0 = peg$c1;
  33336. }
  33337. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33338. return s0;
  33339. }
  33340. function peg$parsews() {
  33341. var s0, s1;
  33342. var key = peg$currPos * 59 + 3,
  33343. cached = peg$cache[key];
  33344. if (cached) {
  33345. peg$currPos = cached.nextPos;
  33346. return cached.result;
  33347. }
  33348. s0 = [];
  33349. s1 = peg$parseseparator();
  33350. if (s1 === peg$FAILED) {
  33351. s1 = peg$parsecomments();
  33352. }
  33353. while (s1 !== peg$FAILED) {
  33354. s0.push(s1);
  33355. s1 = peg$parseseparator();
  33356. if (s1 === peg$FAILED) {
  33357. s1 = peg$parsecomments();
  33358. }
  33359. }
  33360. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33361. return s0;
  33362. }
  33363. function peg$parseidentifier() {
  33364. var s0, s1, s2, s3;
  33365. var key = peg$currPos * 59 + 4,
  33366. cached = peg$cache[key];
  33367. if (cached) {
  33368. peg$currPos = cached.nextPos;
  33369. return cached.result;
  33370. }
  33371. s0 = peg$currPos;
  33372. if (peg$c8.test(input.charAt(peg$currPos))) {
  33373. s1 = input.charAt(peg$currPos);
  33374. peg$currPos++;
  33375. } else {
  33376. s1 = peg$FAILED;
  33377. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  33378. }
  33379. if (s1 !== peg$FAILED) {
  33380. s2 = [];
  33381. if (peg$c10.test(input.charAt(peg$currPos))) {
  33382. s3 = input.charAt(peg$currPos);
  33383. peg$currPos++;
  33384. } else {
  33385. s3 = peg$FAILED;
  33386. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  33387. }
  33388. while (s3 !== peg$FAILED) {
  33389. s2.push(s3);
  33390. if (peg$c10.test(input.charAt(peg$currPos))) {
  33391. s3 = input.charAt(peg$currPos);
  33392. peg$currPos++;
  33393. } else {
  33394. s3 = peg$FAILED;
  33395. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  33396. }
  33397. }
  33398. if (s2 !== peg$FAILED) {
  33399. peg$reportedPos = s0;
  33400. s1 = peg$c12(s1, s2);
  33401. s0 = s1;
  33402. } else {
  33403. peg$currPos = s0;
  33404. s0 = peg$c1;
  33405. }
  33406. } else {
  33407. peg$currPos = s0;
  33408. s0 = peg$c1;
  33409. }
  33410. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33411. return s0;
  33412. }
  33413. function peg$parsekeyword() {
  33414. var s0, s1, s2;
  33415. var key = peg$currPos * 59 + 5,
  33416. cached = peg$cache[key];
  33417. if (cached) {
  33418. peg$currPos = cached.nextPos;
  33419. return cached.result;
  33420. }
  33421. s0 = peg$currPos;
  33422. s1 = peg$parseidentifier();
  33423. if (s1 !== peg$FAILED) {
  33424. if (peg$c13.test(input.charAt(peg$currPos))) {
  33425. s2 = input.charAt(peg$currPos);
  33426. peg$currPos++;
  33427. } else {
  33428. s2 = peg$FAILED;
  33429. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  33430. }
  33431. if (s2 !== peg$FAILED) {
  33432. peg$reportedPos = s0;
  33433. s1 = peg$c15(s1, s2);
  33434. s0 = s1;
  33435. } else {
  33436. peg$currPos = s0;
  33437. s0 = peg$c1;
  33438. }
  33439. } else {
  33440. peg$currPos = s0;
  33441. s0 = peg$c1;
  33442. }
  33443. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33444. return s0;
  33445. }
  33446. function peg$parseselector() {
  33447. var s0, s1, s2, s3;
  33448. var key = peg$currPos * 59 + 6,
  33449. cached = peg$cache[key];
  33450. if (cached) {
  33451. peg$currPos = cached.nextPos;
  33452. return cached.result;
  33453. }
  33454. s0 = peg$currPos;
  33455. if (peg$c8.test(input.charAt(peg$currPos))) {
  33456. s1 = input.charAt(peg$currPos);
  33457. peg$currPos++;
  33458. } else {
  33459. s1 = peg$FAILED;
  33460. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  33461. }
  33462. if (s1 !== peg$FAILED) {
  33463. s2 = [];
  33464. if (peg$c16.test(input.charAt(peg$currPos))) {
  33465. s3 = input.charAt(peg$currPos);
  33466. peg$currPos++;
  33467. } else {
  33468. s3 = peg$FAILED;
  33469. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  33470. }
  33471. while (s3 !== peg$FAILED) {
  33472. s2.push(s3);
  33473. if (peg$c16.test(input.charAt(peg$currPos))) {
  33474. s3 = input.charAt(peg$currPos);
  33475. peg$currPos++;
  33476. } else {
  33477. s3 = peg$FAILED;
  33478. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  33479. }
  33480. }
  33481. if (s2 !== peg$FAILED) {
  33482. peg$reportedPos = s0;
  33483. s1 = peg$c12(s1, s2);
  33484. s0 = s1;
  33485. } else {
  33486. peg$currPos = s0;
  33487. s0 = peg$c1;
  33488. }
  33489. } else {
  33490. peg$currPos = s0;
  33491. s0 = peg$c1;
  33492. }
  33493. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33494. return s0;
  33495. }
  33496. function peg$parseclassName() {
  33497. var s0, s1, s2, s3;
  33498. var key = peg$currPos * 59 + 7,
  33499. cached = peg$cache[key];
  33500. if (cached) {
  33501. peg$currPos = cached.nextPos;
  33502. return cached.result;
  33503. }
  33504. s0 = peg$currPos;
  33505. if (peg$c18.test(input.charAt(peg$currPos))) {
  33506. s1 = input.charAt(peg$currPos);
  33507. peg$currPos++;
  33508. } else {
  33509. s1 = peg$FAILED;
  33510. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  33511. }
  33512. if (s1 !== peg$FAILED) {
  33513. s2 = [];
  33514. if (peg$c10.test(input.charAt(peg$currPos))) {
  33515. s3 = input.charAt(peg$currPos);
  33516. peg$currPos++;
  33517. } else {
  33518. s3 = peg$FAILED;
  33519. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  33520. }
  33521. while (s3 !== peg$FAILED) {
  33522. s2.push(s3);
  33523. if (peg$c10.test(input.charAt(peg$currPos))) {
  33524. s3 = input.charAt(peg$currPos);
  33525. peg$currPos++;
  33526. } else {
  33527. s3 = peg$FAILED;
  33528. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  33529. }
  33530. }
  33531. if (s2 !== peg$FAILED) {
  33532. peg$reportedPos = s0;
  33533. s1 = peg$c12(s1, s2);
  33534. s0 = s1;
  33535. } else {
  33536. peg$currPos = s0;
  33537. s0 = peg$c1;
  33538. }
  33539. } else {
  33540. peg$currPos = s0;
  33541. s0 = peg$c1;
  33542. }
  33543. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33544. return s0;
  33545. }
  33546. function peg$parsestring() {
  33547. var s0, s1, s2, s3, s4;
  33548. var key = peg$currPos * 59 + 8,
  33549. cached = peg$cache[key];
  33550. if (cached) {
  33551. peg$currPos = cached.nextPos;
  33552. return cached.result;
  33553. }
  33554. s0 = peg$currPos;
  33555. if (peg$c20.test(input.charAt(peg$currPos))) {
  33556. s1 = input.charAt(peg$currPos);
  33557. peg$currPos++;
  33558. } else {
  33559. s1 = peg$FAILED;
  33560. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  33561. }
  33562. if (s1 !== peg$FAILED) {
  33563. s2 = [];
  33564. s3 = peg$currPos;
  33565. if (input.substr(peg$currPos, 2) === peg$c22) {
  33566. s4 = peg$c22;
  33567. peg$currPos += 2;
  33568. } else {
  33569. s4 = peg$FAILED;
  33570. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  33571. }
  33572. if (s4 !== peg$FAILED) {
  33573. peg$reportedPos = s3;
  33574. s4 = peg$c24();
  33575. }
  33576. s3 = s4;
  33577. if (s3 === peg$FAILED) {
  33578. if (peg$c25.test(input.charAt(peg$currPos))) {
  33579. s3 = input.charAt(peg$currPos);
  33580. peg$currPos++;
  33581. } else {
  33582. s3 = peg$FAILED;
  33583. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  33584. }
  33585. }
  33586. while (s3 !== peg$FAILED) {
  33587. s2.push(s3);
  33588. s3 = peg$currPos;
  33589. if (input.substr(peg$currPos, 2) === peg$c22) {
  33590. s4 = peg$c22;
  33591. peg$currPos += 2;
  33592. } else {
  33593. s4 = peg$FAILED;
  33594. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  33595. }
  33596. if (s4 !== peg$FAILED) {
  33597. peg$reportedPos = s3;
  33598. s4 = peg$c24();
  33599. }
  33600. s3 = s4;
  33601. if (s3 === peg$FAILED) {
  33602. if (peg$c25.test(input.charAt(peg$currPos))) {
  33603. s3 = input.charAt(peg$currPos);
  33604. peg$currPos++;
  33605. } else {
  33606. s3 = peg$FAILED;
  33607. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  33608. }
  33609. }
  33610. }
  33611. if (s2 !== peg$FAILED) {
  33612. if (peg$c20.test(input.charAt(peg$currPos))) {
  33613. s3 = input.charAt(peg$currPos);
  33614. peg$currPos++;
  33615. } else {
  33616. s3 = peg$FAILED;
  33617. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  33618. }
  33619. if (s3 !== peg$FAILED) {
  33620. peg$reportedPos = s0;
  33621. s1 = peg$c27(s2);
  33622. s0 = s1;
  33623. } else {
  33624. peg$currPos = s0;
  33625. s0 = peg$c1;
  33626. }
  33627. } else {
  33628. peg$currPos = s0;
  33629. s0 = peg$c1;
  33630. }
  33631. } else {
  33632. peg$currPos = s0;
  33633. s0 = peg$c1;
  33634. }
  33635. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33636. return s0;
  33637. }
  33638. function peg$parsesymbol() {
  33639. var s0, s1, s2;
  33640. var key = peg$currPos * 59 + 9,
  33641. cached = peg$cache[key];
  33642. if (cached) {
  33643. peg$currPos = cached.nextPos;
  33644. return cached.result;
  33645. }
  33646. s0 = peg$currPos;
  33647. if (input.charCodeAt(peg$currPos) === 35) {
  33648. s1 = peg$c28;
  33649. peg$currPos++;
  33650. } else {
  33651. s1 = peg$FAILED;
  33652. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  33653. }
  33654. if (s1 !== peg$FAILED) {
  33655. s2 = peg$parsebareSymbol();
  33656. if (s2 !== peg$FAILED) {
  33657. peg$reportedPos = s0;
  33658. s1 = peg$c30(s2);
  33659. s0 = s1;
  33660. } else {
  33661. peg$currPos = s0;
  33662. s0 = peg$c1;
  33663. }
  33664. } else {
  33665. peg$currPos = s0;
  33666. s0 = peg$c1;
  33667. }
  33668. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33669. return s0;
  33670. }
  33671. function peg$parsebareSymbol() {
  33672. var s0, s1, s2;
  33673. var key = peg$currPos * 59 + 10,
  33674. cached = peg$cache[key];
  33675. if (cached) {
  33676. peg$currPos = cached.nextPos;
  33677. return cached.result;
  33678. }
  33679. s0 = peg$currPos;
  33680. s1 = peg$parseselector();
  33681. if (s1 === peg$FAILED) {
  33682. s1 = peg$parsebinarySelector();
  33683. if (s1 === peg$FAILED) {
  33684. s1 = peg$currPos;
  33685. s2 = peg$parsestring();
  33686. if (s2 !== peg$FAILED) {
  33687. peg$reportedPos = s1;
  33688. s2 = peg$c31(s2);
  33689. }
  33690. s1 = s2;
  33691. }
  33692. }
  33693. if (s1 !== peg$FAILED) {
  33694. peg$reportedPos = s0;
  33695. s1 = peg$c32(s1);
  33696. }
  33697. s0 = s1;
  33698. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33699. return s0;
  33700. }
  33701. function peg$parsenumber() {
  33702. var s0, s1;
  33703. var key = peg$currPos * 59 + 11,
  33704. cached = peg$cache[key];
  33705. if (cached) {
  33706. peg$currPos = cached.nextPos;
  33707. return cached.result;
  33708. }
  33709. s0 = peg$currPos;
  33710. s1 = peg$parsenumberExp();
  33711. if (s1 === peg$FAILED) {
  33712. s1 = peg$parsehex();
  33713. if (s1 === peg$FAILED) {
  33714. s1 = peg$parsefloat();
  33715. if (s1 === peg$FAILED) {
  33716. s1 = peg$parseinteger();
  33717. }
  33718. }
  33719. }
  33720. if (s1 !== peg$FAILED) {
  33721. peg$reportedPos = s0;
  33722. s1 = peg$c33(s1);
  33723. }
  33724. s0 = s1;
  33725. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33726. return s0;
  33727. }
  33728. function peg$parsenumberExp() {
  33729. var s0, s1, s2, s3, s4;
  33730. var key = peg$currPos * 59 + 12,
  33731. cached = peg$cache[key];
  33732. if (cached) {
  33733. peg$currPos = cached.nextPos;
  33734. return cached.result;
  33735. }
  33736. s0 = peg$currPos;
  33737. s1 = peg$currPos;
  33738. s2 = peg$parsefloat();
  33739. if (s2 === peg$FAILED) {
  33740. s2 = peg$parseinteger();
  33741. }
  33742. if (s2 !== peg$FAILED) {
  33743. if (input.charCodeAt(peg$currPos) === 101) {
  33744. s3 = peg$c34;
  33745. peg$currPos++;
  33746. } else {
  33747. s3 = peg$FAILED;
  33748. if (peg$silentFails === 0) { peg$fail(peg$c35); }
  33749. }
  33750. if (s3 !== peg$FAILED) {
  33751. s4 = peg$parseinteger();
  33752. if (s4 !== peg$FAILED) {
  33753. s2 = [s2, s3, s4];
  33754. s1 = s2;
  33755. } else {
  33756. peg$currPos = s1;
  33757. s1 = peg$c1;
  33758. }
  33759. } else {
  33760. peg$currPos = s1;
  33761. s1 = peg$c1;
  33762. }
  33763. } else {
  33764. peg$currPos = s1;
  33765. s1 = peg$c1;
  33766. }
  33767. if (s1 !== peg$FAILED) {
  33768. peg$reportedPos = s0;
  33769. s1 = peg$c36(s1);
  33770. }
  33771. s0 = s1;
  33772. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33773. return s0;
  33774. }
  33775. function peg$parsehex() {
  33776. var s0, s1, s2, s3, s4;
  33777. var key = peg$currPos * 59 + 13,
  33778. cached = peg$cache[key];
  33779. if (cached) {
  33780. peg$currPos = cached.nextPos;
  33781. return cached.result;
  33782. }
  33783. s0 = peg$currPos;
  33784. if (peg$c38.test(input.charAt(peg$currPos))) {
  33785. s1 = input.charAt(peg$currPos);
  33786. peg$currPos++;
  33787. } else {
  33788. s1 = peg$FAILED;
  33789. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  33790. }
  33791. if (s1 === peg$FAILED) {
  33792. s1 = peg$c37;
  33793. }
  33794. if (s1 !== peg$FAILED) {
  33795. if (input.substr(peg$currPos, 3) === peg$c40) {
  33796. s2 = peg$c40;
  33797. peg$currPos += 3;
  33798. } else {
  33799. s2 = peg$FAILED;
  33800. if (peg$silentFails === 0) { peg$fail(peg$c41); }
  33801. }
  33802. if (s2 !== peg$FAILED) {
  33803. s3 = [];
  33804. if (peg$c42.test(input.charAt(peg$currPos))) {
  33805. s4 = input.charAt(peg$currPos);
  33806. peg$currPos++;
  33807. } else {
  33808. s4 = peg$FAILED;
  33809. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  33810. }
  33811. if (s4 !== peg$FAILED) {
  33812. while (s4 !== peg$FAILED) {
  33813. s3.push(s4);
  33814. if (peg$c42.test(input.charAt(peg$currPos))) {
  33815. s4 = input.charAt(peg$currPos);
  33816. peg$currPos++;
  33817. } else {
  33818. s4 = peg$FAILED;
  33819. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  33820. }
  33821. }
  33822. } else {
  33823. s3 = peg$c1;
  33824. }
  33825. if (s3 !== peg$FAILED) {
  33826. peg$reportedPos = s0;
  33827. s1 = peg$c44(s1, s3);
  33828. s0 = s1;
  33829. } else {
  33830. peg$currPos = s0;
  33831. s0 = peg$c1;
  33832. }
  33833. } else {
  33834. peg$currPos = s0;
  33835. s0 = peg$c1;
  33836. }
  33837. } else {
  33838. peg$currPos = s0;
  33839. s0 = peg$c1;
  33840. }
  33841. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33842. return s0;
  33843. }
  33844. function peg$parsefloat() {
  33845. var s0, s1, s2, s3, s4, s5;
  33846. var key = peg$currPos * 59 + 14,
  33847. cached = peg$cache[key];
  33848. if (cached) {
  33849. peg$currPos = cached.nextPos;
  33850. return cached.result;
  33851. }
  33852. s0 = peg$currPos;
  33853. if (peg$c38.test(input.charAt(peg$currPos))) {
  33854. s1 = input.charAt(peg$currPos);
  33855. peg$currPos++;
  33856. } else {
  33857. s1 = peg$FAILED;
  33858. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  33859. }
  33860. if (s1 === peg$FAILED) {
  33861. s1 = peg$c37;
  33862. }
  33863. if (s1 !== peg$FAILED) {
  33864. s2 = [];
  33865. if (peg$c45.test(input.charAt(peg$currPos))) {
  33866. s3 = input.charAt(peg$currPos);
  33867. peg$currPos++;
  33868. } else {
  33869. s3 = peg$FAILED;
  33870. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33871. }
  33872. if (s3 !== peg$FAILED) {
  33873. while (s3 !== peg$FAILED) {
  33874. s2.push(s3);
  33875. if (peg$c45.test(input.charAt(peg$currPos))) {
  33876. s3 = input.charAt(peg$currPos);
  33877. peg$currPos++;
  33878. } else {
  33879. s3 = peg$FAILED;
  33880. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33881. }
  33882. }
  33883. } else {
  33884. s2 = peg$c1;
  33885. }
  33886. if (s2 !== peg$FAILED) {
  33887. if (input.charCodeAt(peg$currPos) === 46) {
  33888. s3 = peg$c47;
  33889. peg$currPos++;
  33890. } else {
  33891. s3 = peg$FAILED;
  33892. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  33893. }
  33894. if (s3 !== peg$FAILED) {
  33895. s4 = [];
  33896. if (peg$c45.test(input.charAt(peg$currPos))) {
  33897. s5 = input.charAt(peg$currPos);
  33898. peg$currPos++;
  33899. } else {
  33900. s5 = peg$FAILED;
  33901. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33902. }
  33903. if (s5 !== peg$FAILED) {
  33904. while (s5 !== peg$FAILED) {
  33905. s4.push(s5);
  33906. if (peg$c45.test(input.charAt(peg$currPos))) {
  33907. s5 = input.charAt(peg$currPos);
  33908. peg$currPos++;
  33909. } else {
  33910. s5 = peg$FAILED;
  33911. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33912. }
  33913. }
  33914. } else {
  33915. s4 = peg$c1;
  33916. }
  33917. if (s4 !== peg$FAILED) {
  33918. peg$reportedPos = s0;
  33919. s1 = peg$c49(s1, s2, s4);
  33920. s0 = s1;
  33921. } else {
  33922. peg$currPos = s0;
  33923. s0 = peg$c1;
  33924. }
  33925. } else {
  33926. peg$currPos = s0;
  33927. s0 = peg$c1;
  33928. }
  33929. } else {
  33930. peg$currPos = s0;
  33931. s0 = peg$c1;
  33932. }
  33933. } else {
  33934. peg$currPos = s0;
  33935. s0 = peg$c1;
  33936. }
  33937. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33938. return s0;
  33939. }
  33940. function peg$parseinteger() {
  33941. var s0, s1, s2, s3;
  33942. var key = peg$currPos * 59 + 15,
  33943. cached = peg$cache[key];
  33944. if (cached) {
  33945. peg$currPos = cached.nextPos;
  33946. return cached.result;
  33947. }
  33948. s0 = peg$currPos;
  33949. if (peg$c38.test(input.charAt(peg$currPos))) {
  33950. s1 = input.charAt(peg$currPos);
  33951. peg$currPos++;
  33952. } else {
  33953. s1 = peg$FAILED;
  33954. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  33955. }
  33956. if (s1 === peg$FAILED) {
  33957. s1 = peg$c37;
  33958. }
  33959. if (s1 !== peg$FAILED) {
  33960. s2 = [];
  33961. if (peg$c45.test(input.charAt(peg$currPos))) {
  33962. s3 = input.charAt(peg$currPos);
  33963. peg$currPos++;
  33964. } else {
  33965. s3 = peg$FAILED;
  33966. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33967. }
  33968. if (s3 !== peg$FAILED) {
  33969. while (s3 !== peg$FAILED) {
  33970. s2.push(s3);
  33971. if (peg$c45.test(input.charAt(peg$currPos))) {
  33972. s3 = input.charAt(peg$currPos);
  33973. peg$currPos++;
  33974. } else {
  33975. s3 = peg$FAILED;
  33976. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  33977. }
  33978. }
  33979. } else {
  33980. s2 = peg$c1;
  33981. }
  33982. if (s2 !== peg$FAILED) {
  33983. peg$reportedPos = s0;
  33984. s1 = peg$c50(s1, s2);
  33985. s0 = s1;
  33986. } else {
  33987. peg$currPos = s0;
  33988. s0 = peg$c1;
  33989. }
  33990. } else {
  33991. peg$currPos = s0;
  33992. s0 = peg$c1;
  33993. }
  33994. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  33995. return s0;
  33996. }
  33997. function peg$parseliteralArray() {
  33998. var s0, s1, s2;
  33999. var key = peg$currPos * 59 + 16,
  34000. cached = peg$cache[key];
  34001. if (cached) {
  34002. peg$currPos = cached.nextPos;
  34003. return cached.result;
  34004. }
  34005. s0 = peg$currPos;
  34006. if (input.substr(peg$currPos, 2) === peg$c51) {
  34007. s1 = peg$c51;
  34008. peg$currPos += 2;
  34009. } else {
  34010. s1 = peg$FAILED;
  34011. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  34012. }
  34013. if (s1 !== peg$FAILED) {
  34014. s2 = peg$parseliteralArrayRest();
  34015. if (s2 !== peg$FAILED) {
  34016. peg$reportedPos = s0;
  34017. s1 = peg$c30(s2);
  34018. s0 = s1;
  34019. } else {
  34020. peg$currPos = s0;
  34021. s0 = peg$c1;
  34022. }
  34023. } else {
  34024. peg$currPos = s0;
  34025. s0 = peg$c1;
  34026. }
  34027. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34028. return s0;
  34029. }
  34030. function peg$parsebareLiteralArray() {
  34031. var s0, s1, s2;
  34032. var key = peg$currPos * 59 + 17,
  34033. cached = peg$cache[key];
  34034. if (cached) {
  34035. peg$currPos = cached.nextPos;
  34036. return cached.result;
  34037. }
  34038. s0 = peg$currPos;
  34039. if (input.charCodeAt(peg$currPos) === 40) {
  34040. s1 = peg$c53;
  34041. peg$currPos++;
  34042. } else {
  34043. s1 = peg$FAILED;
  34044. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  34045. }
  34046. if (s1 !== peg$FAILED) {
  34047. s2 = peg$parseliteralArrayRest();
  34048. if (s2 !== peg$FAILED) {
  34049. peg$reportedPos = s0;
  34050. s1 = peg$c30(s2);
  34051. s0 = s1;
  34052. } else {
  34053. peg$currPos = s0;
  34054. s0 = peg$c1;
  34055. }
  34056. } else {
  34057. peg$currPos = s0;
  34058. s0 = peg$c1;
  34059. }
  34060. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34061. return s0;
  34062. }
  34063. function peg$parseliteralArrayRest() {
  34064. var s0, s1, s2, s3, s4, s5;
  34065. var key = peg$currPos * 59 + 18,
  34066. cached = peg$cache[key];
  34067. if (cached) {
  34068. peg$currPos = cached.nextPos;
  34069. return cached.result;
  34070. }
  34071. s0 = peg$currPos;
  34072. s1 = peg$parsews();
  34073. if (s1 !== peg$FAILED) {
  34074. s2 = [];
  34075. s3 = peg$currPos;
  34076. s4 = peg$parseparseTimeLiteral();
  34077. if (s4 === peg$FAILED) {
  34078. s4 = peg$parsebareLiteralArray();
  34079. if (s4 === peg$FAILED) {
  34080. s4 = peg$parsebareSymbol();
  34081. }
  34082. }
  34083. if (s4 !== peg$FAILED) {
  34084. s5 = peg$parsews();
  34085. if (s5 !== peg$FAILED) {
  34086. peg$reportedPos = s3;
  34087. s4 = peg$c55(s4);
  34088. s3 = s4;
  34089. } else {
  34090. peg$currPos = s3;
  34091. s3 = peg$c1;
  34092. }
  34093. } else {
  34094. peg$currPos = s3;
  34095. s3 = peg$c1;
  34096. }
  34097. while (s3 !== peg$FAILED) {
  34098. s2.push(s3);
  34099. s3 = peg$currPos;
  34100. s4 = peg$parseparseTimeLiteral();
  34101. if (s4 === peg$FAILED) {
  34102. s4 = peg$parsebareLiteralArray();
  34103. if (s4 === peg$FAILED) {
  34104. s4 = peg$parsebareSymbol();
  34105. }
  34106. }
  34107. if (s4 !== peg$FAILED) {
  34108. s5 = peg$parsews();
  34109. if (s5 !== peg$FAILED) {
  34110. peg$reportedPos = s3;
  34111. s4 = peg$c55(s4);
  34112. s3 = s4;
  34113. } else {
  34114. peg$currPos = s3;
  34115. s3 = peg$c1;
  34116. }
  34117. } else {
  34118. peg$currPos = s3;
  34119. s3 = peg$c1;
  34120. }
  34121. }
  34122. if (s2 !== peg$FAILED) {
  34123. s3 = peg$parsews();
  34124. if (s3 !== peg$FAILED) {
  34125. if (input.charCodeAt(peg$currPos) === 41) {
  34126. s4 = peg$c56;
  34127. peg$currPos++;
  34128. } else {
  34129. s4 = peg$FAILED;
  34130. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  34131. }
  34132. if (s4 !== peg$FAILED) {
  34133. peg$reportedPos = s0;
  34134. s1 = peg$c58(s2);
  34135. s0 = s1;
  34136. } else {
  34137. peg$currPos = s0;
  34138. s0 = peg$c1;
  34139. }
  34140. } else {
  34141. peg$currPos = s0;
  34142. s0 = peg$c1;
  34143. }
  34144. } else {
  34145. peg$currPos = s0;
  34146. s0 = peg$c1;
  34147. }
  34148. } else {
  34149. peg$currPos = s0;
  34150. s0 = peg$c1;
  34151. }
  34152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34153. return s0;
  34154. }
  34155. function peg$parsedynamicArray() {
  34156. var s0, s1, s2, s3, s4, s5, s6;
  34157. var key = peg$currPos * 59 + 19,
  34158. cached = peg$cache[key];
  34159. if (cached) {
  34160. peg$currPos = cached.nextPos;
  34161. return cached.result;
  34162. }
  34163. s0 = peg$currPos;
  34164. if (input.charCodeAt(peg$currPos) === 123) {
  34165. s1 = peg$c59;
  34166. peg$currPos++;
  34167. } else {
  34168. s1 = peg$FAILED;
  34169. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  34170. }
  34171. if (s1 !== peg$FAILED) {
  34172. s2 = peg$parsews();
  34173. if (s2 !== peg$FAILED) {
  34174. s3 = peg$parseexpressions();
  34175. if (s3 === peg$FAILED) {
  34176. s3 = peg$c37;
  34177. }
  34178. if (s3 !== peg$FAILED) {
  34179. s4 = peg$parsews();
  34180. if (s4 !== peg$FAILED) {
  34181. if (input.charCodeAt(peg$currPos) === 46) {
  34182. s5 = peg$c47;
  34183. peg$currPos++;
  34184. } else {
  34185. s5 = peg$FAILED;
  34186. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  34187. }
  34188. if (s5 === peg$FAILED) {
  34189. s5 = peg$c37;
  34190. }
  34191. if (s5 !== peg$FAILED) {
  34192. if (input.charCodeAt(peg$currPos) === 125) {
  34193. s6 = peg$c61;
  34194. peg$currPos++;
  34195. } else {
  34196. s6 = peg$FAILED;
  34197. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  34198. }
  34199. if (s6 !== peg$FAILED) {
  34200. peg$reportedPos = s0;
  34201. s1 = peg$c63(s3);
  34202. s0 = s1;
  34203. } else {
  34204. peg$currPos = s0;
  34205. s0 = peg$c1;
  34206. }
  34207. } else {
  34208. peg$currPos = s0;
  34209. s0 = peg$c1;
  34210. }
  34211. } else {
  34212. peg$currPos = s0;
  34213. s0 = peg$c1;
  34214. }
  34215. } else {
  34216. peg$currPos = s0;
  34217. s0 = peg$c1;
  34218. }
  34219. } else {
  34220. peg$currPos = s0;
  34221. s0 = peg$c1;
  34222. }
  34223. } else {
  34224. peg$currPos = s0;
  34225. s0 = peg$c1;
  34226. }
  34227. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34228. return s0;
  34229. }
  34230. function peg$parsedynamicDictionary() {
  34231. var s0, s1, s2, s3, s4, s5;
  34232. var key = peg$currPos * 59 + 20,
  34233. cached = peg$cache[key];
  34234. if (cached) {
  34235. peg$currPos = cached.nextPos;
  34236. return cached.result;
  34237. }
  34238. s0 = peg$currPos;
  34239. if (input.substr(peg$currPos, 2) === peg$c64) {
  34240. s1 = peg$c64;
  34241. peg$currPos += 2;
  34242. } else {
  34243. s1 = peg$FAILED;
  34244. if (peg$silentFails === 0) { peg$fail(peg$c65); }
  34245. }
  34246. if (s1 !== peg$FAILED) {
  34247. s2 = peg$parsews();
  34248. if (s2 !== peg$FAILED) {
  34249. s3 = peg$parseassociations();
  34250. if (s3 === peg$FAILED) {
  34251. s3 = peg$c37;
  34252. }
  34253. if (s3 !== peg$FAILED) {
  34254. s4 = peg$parsews();
  34255. if (s4 !== peg$FAILED) {
  34256. if (input.charCodeAt(peg$currPos) === 125) {
  34257. s5 = peg$c61;
  34258. peg$currPos++;
  34259. } else {
  34260. s5 = peg$FAILED;
  34261. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  34262. }
  34263. if (s5 !== peg$FAILED) {
  34264. peg$reportedPos = s0;
  34265. s1 = peg$c66(s3);
  34266. s0 = s1;
  34267. } else {
  34268. peg$currPos = s0;
  34269. s0 = peg$c1;
  34270. }
  34271. } else {
  34272. peg$currPos = s0;
  34273. s0 = peg$c1;
  34274. }
  34275. } else {
  34276. peg$currPos = s0;
  34277. s0 = peg$c1;
  34278. }
  34279. } else {
  34280. peg$currPos = s0;
  34281. s0 = peg$c1;
  34282. }
  34283. } else {
  34284. peg$currPos = s0;
  34285. s0 = peg$c1;
  34286. }
  34287. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34288. return s0;
  34289. }
  34290. function peg$parsepseudoVariable() {
  34291. var s0, s1, s2;
  34292. var key = peg$currPos * 59 + 21,
  34293. cached = peg$cache[key];
  34294. if (cached) {
  34295. peg$currPos = cached.nextPos;
  34296. return cached.result;
  34297. }
  34298. s0 = peg$currPos;
  34299. s1 = peg$currPos;
  34300. if (input.substr(peg$currPos, 4) === peg$c67) {
  34301. s2 = peg$c67;
  34302. peg$currPos += 4;
  34303. } else {
  34304. s2 = peg$FAILED;
  34305. if (peg$silentFails === 0) { peg$fail(peg$c68); }
  34306. }
  34307. if (s2 !== peg$FAILED) {
  34308. peg$reportedPos = s1;
  34309. s2 = peg$c69();
  34310. }
  34311. s1 = s2;
  34312. if (s1 === peg$FAILED) {
  34313. s1 = peg$currPos;
  34314. if (input.substr(peg$currPos, 5) === peg$c70) {
  34315. s2 = peg$c70;
  34316. peg$currPos += 5;
  34317. } else {
  34318. s2 = peg$FAILED;
  34319. if (peg$silentFails === 0) { peg$fail(peg$c71); }
  34320. }
  34321. if (s2 !== peg$FAILED) {
  34322. peg$reportedPos = s1;
  34323. s2 = peg$c72();
  34324. }
  34325. s1 = s2;
  34326. if (s1 === peg$FAILED) {
  34327. s1 = peg$currPos;
  34328. if (input.substr(peg$currPos, 3) === peg$c73) {
  34329. s2 = peg$c73;
  34330. peg$currPos += 3;
  34331. } else {
  34332. s2 = peg$FAILED;
  34333. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  34334. }
  34335. if (s2 !== peg$FAILED) {
  34336. peg$reportedPos = s1;
  34337. s2 = peg$c75();
  34338. }
  34339. s1 = s2;
  34340. }
  34341. }
  34342. if (s1 !== peg$FAILED) {
  34343. peg$reportedPos = s0;
  34344. s1 = peg$c76(s1);
  34345. }
  34346. s0 = s1;
  34347. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34348. return s0;
  34349. }
  34350. function peg$parseparseTimeLiteral() {
  34351. var s0;
  34352. var key = peg$currPos * 59 + 22,
  34353. cached = peg$cache[key];
  34354. if (cached) {
  34355. peg$currPos = cached.nextPos;
  34356. return cached.result;
  34357. }
  34358. s0 = peg$parsepseudoVariable();
  34359. if (s0 === peg$FAILED) {
  34360. s0 = peg$parsenumber();
  34361. if (s0 === peg$FAILED) {
  34362. s0 = peg$parseliteralArray();
  34363. if (s0 === peg$FAILED) {
  34364. s0 = peg$parsestring();
  34365. if (s0 === peg$FAILED) {
  34366. s0 = peg$parsesymbol();
  34367. }
  34368. }
  34369. }
  34370. }
  34371. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34372. return s0;
  34373. }
  34374. function peg$parseruntimeLiteral() {
  34375. var s0;
  34376. var key = peg$currPos * 59 + 23,
  34377. cached = peg$cache[key];
  34378. if (cached) {
  34379. peg$currPos = cached.nextPos;
  34380. return cached.result;
  34381. }
  34382. s0 = peg$parsedynamicDictionary();
  34383. if (s0 === peg$FAILED) {
  34384. s0 = peg$parsedynamicArray();
  34385. if (s0 === peg$FAILED) {
  34386. s0 = peg$parseblock();
  34387. }
  34388. }
  34389. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34390. return s0;
  34391. }
  34392. function peg$parseliteral() {
  34393. var s0;
  34394. var key = peg$currPos * 59 + 24,
  34395. cached = peg$cache[key];
  34396. if (cached) {
  34397. peg$currPos = cached.nextPos;
  34398. return cached.result;
  34399. }
  34400. s0 = peg$parseruntimeLiteral();
  34401. if (s0 === peg$FAILED) {
  34402. s0 = peg$parseparseTimeLiteral();
  34403. }
  34404. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34405. return s0;
  34406. }
  34407. function peg$parsevariable() {
  34408. var s0, s1;
  34409. var key = peg$currPos * 59 + 25,
  34410. cached = peg$cache[key];
  34411. if (cached) {
  34412. peg$currPos = cached.nextPos;
  34413. return cached.result;
  34414. }
  34415. s0 = peg$currPos;
  34416. s1 = peg$parseidentifier();
  34417. if (s1 !== peg$FAILED) {
  34418. peg$reportedPos = s0;
  34419. s1 = peg$c77(s1);
  34420. }
  34421. s0 = s1;
  34422. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34423. return s0;
  34424. }
  34425. function peg$parsekeywordPair() {
  34426. var s0, s1, s2, s3, s4;
  34427. var key = peg$currPos * 59 + 26,
  34428. cached = peg$cache[key];
  34429. if (cached) {
  34430. peg$currPos = cached.nextPos;
  34431. return cached.result;
  34432. }
  34433. s0 = peg$currPos;
  34434. s1 = peg$parsekeyword();
  34435. if (s1 !== peg$FAILED) {
  34436. s2 = peg$parsews();
  34437. if (s2 !== peg$FAILED) {
  34438. s3 = peg$parsebinarySend();
  34439. if (s3 !== peg$FAILED) {
  34440. s4 = peg$parsews();
  34441. if (s4 !== peg$FAILED) {
  34442. peg$reportedPos = s0;
  34443. s1 = peg$c78(s1, s3);
  34444. s0 = s1;
  34445. } else {
  34446. peg$currPos = s0;
  34447. s0 = peg$c1;
  34448. }
  34449. } else {
  34450. peg$currPos = s0;
  34451. s0 = peg$c1;
  34452. }
  34453. } else {
  34454. peg$currPos = s0;
  34455. s0 = peg$c1;
  34456. }
  34457. } else {
  34458. peg$currPos = s0;
  34459. s0 = peg$c1;
  34460. }
  34461. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34462. return s0;
  34463. }
  34464. function peg$parsebinarySelector() {
  34465. var s0, s1, s2;
  34466. var key = peg$currPos * 59 + 27,
  34467. cached = peg$cache[key];
  34468. if (cached) {
  34469. peg$currPos = cached.nextPos;
  34470. return cached.result;
  34471. }
  34472. s0 = peg$currPos;
  34473. s1 = [];
  34474. if (peg$c79.test(input.charAt(peg$currPos))) {
  34475. s2 = input.charAt(peg$currPos);
  34476. peg$currPos++;
  34477. } else {
  34478. s2 = peg$FAILED;
  34479. if (peg$silentFails === 0) { peg$fail(peg$c80); }
  34480. }
  34481. if (s2 !== peg$FAILED) {
  34482. while (s2 !== peg$FAILED) {
  34483. s1.push(s2);
  34484. if (peg$c79.test(input.charAt(peg$currPos))) {
  34485. s2 = input.charAt(peg$currPos);
  34486. peg$currPos++;
  34487. } else {
  34488. s2 = peg$FAILED;
  34489. if (peg$silentFails === 0) { peg$fail(peg$c80); }
  34490. }
  34491. }
  34492. } else {
  34493. s1 = peg$c1;
  34494. }
  34495. if (s1 !== peg$FAILED) {
  34496. peg$reportedPos = s0;
  34497. s1 = peg$c81(s1);
  34498. }
  34499. s0 = s1;
  34500. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34501. return s0;
  34502. }
  34503. function peg$parsekeywordPattern() {
  34504. var s0, s1, s2, s3, s4, s5, s6;
  34505. var key = peg$currPos * 59 + 28,
  34506. cached = peg$cache[key];
  34507. if (cached) {
  34508. peg$currPos = cached.nextPos;
  34509. return cached.result;
  34510. }
  34511. s0 = peg$currPos;
  34512. s1 = [];
  34513. s2 = peg$currPos;
  34514. s3 = peg$parsews();
  34515. if (s3 !== peg$FAILED) {
  34516. s4 = peg$parsekeyword();
  34517. if (s4 !== peg$FAILED) {
  34518. s5 = peg$parsews();
  34519. if (s5 !== peg$FAILED) {
  34520. s6 = peg$parseidentifier();
  34521. if (s6 !== peg$FAILED) {
  34522. peg$reportedPos = s2;
  34523. s3 = peg$c78(s4, s6);
  34524. s2 = s3;
  34525. } else {
  34526. peg$currPos = s2;
  34527. s2 = peg$c1;
  34528. }
  34529. } else {
  34530. peg$currPos = s2;
  34531. s2 = peg$c1;
  34532. }
  34533. } else {
  34534. peg$currPos = s2;
  34535. s2 = peg$c1;
  34536. }
  34537. } else {
  34538. peg$currPos = s2;
  34539. s2 = peg$c1;
  34540. }
  34541. if (s2 !== peg$FAILED) {
  34542. while (s2 !== peg$FAILED) {
  34543. s1.push(s2);
  34544. s2 = peg$currPos;
  34545. s3 = peg$parsews();
  34546. if (s3 !== peg$FAILED) {
  34547. s4 = peg$parsekeyword();
  34548. if (s4 !== peg$FAILED) {
  34549. s5 = peg$parsews();
  34550. if (s5 !== peg$FAILED) {
  34551. s6 = peg$parseidentifier();
  34552. if (s6 !== peg$FAILED) {
  34553. peg$reportedPos = s2;
  34554. s3 = peg$c78(s4, s6);
  34555. s2 = s3;
  34556. } else {
  34557. peg$currPos = s2;
  34558. s2 = peg$c1;
  34559. }
  34560. } else {
  34561. peg$currPos = s2;
  34562. s2 = peg$c1;
  34563. }
  34564. } else {
  34565. peg$currPos = s2;
  34566. s2 = peg$c1;
  34567. }
  34568. } else {
  34569. peg$currPos = s2;
  34570. s2 = peg$c1;
  34571. }
  34572. }
  34573. } else {
  34574. s1 = peg$c1;
  34575. }
  34576. if (s1 !== peg$FAILED) {
  34577. peg$reportedPos = s0;
  34578. s1 = peg$c82(s1);
  34579. }
  34580. s0 = s1;
  34581. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34582. return s0;
  34583. }
  34584. function peg$parsebinaryPattern() {
  34585. var s0, s1, s2, s3, s4;
  34586. var key = peg$currPos * 59 + 29,
  34587. cached = peg$cache[key];
  34588. if (cached) {
  34589. peg$currPos = cached.nextPos;
  34590. return cached.result;
  34591. }
  34592. s0 = peg$currPos;
  34593. s1 = peg$parsews();
  34594. if (s1 !== peg$FAILED) {
  34595. s2 = peg$parsebinarySelector();
  34596. if (s2 !== peg$FAILED) {
  34597. s3 = peg$parsews();
  34598. if (s3 !== peg$FAILED) {
  34599. s4 = peg$parseidentifier();
  34600. if (s4 !== peg$FAILED) {
  34601. peg$reportedPos = s0;
  34602. s1 = peg$c83(s2, s4);
  34603. s0 = s1;
  34604. } else {
  34605. peg$currPos = s0;
  34606. s0 = peg$c1;
  34607. }
  34608. } else {
  34609. peg$currPos = s0;
  34610. s0 = peg$c1;
  34611. }
  34612. } else {
  34613. peg$currPos = s0;
  34614. s0 = peg$c1;
  34615. }
  34616. } else {
  34617. peg$currPos = s0;
  34618. s0 = peg$c1;
  34619. }
  34620. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34621. return s0;
  34622. }
  34623. function peg$parseunaryPattern() {
  34624. var s0, s1, s2;
  34625. var key = peg$currPos * 59 + 30,
  34626. cached = peg$cache[key];
  34627. if (cached) {
  34628. peg$currPos = cached.nextPos;
  34629. return cached.result;
  34630. }
  34631. s0 = peg$currPos;
  34632. s1 = peg$parsews();
  34633. if (s1 !== peg$FAILED) {
  34634. s2 = peg$parseidentifier();
  34635. if (s2 !== peg$FAILED) {
  34636. peg$reportedPos = s0;
  34637. s1 = peg$c84(s2);
  34638. s0 = s1;
  34639. } else {
  34640. peg$currPos = s0;
  34641. s0 = peg$c1;
  34642. }
  34643. } else {
  34644. peg$currPos = s0;
  34645. s0 = peg$c1;
  34646. }
  34647. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34648. return s0;
  34649. }
  34650. function peg$parseexpression() {
  34651. var s0;
  34652. var key = peg$currPos * 59 + 31,
  34653. cached = peg$cache[key];
  34654. if (cached) {
  34655. peg$currPos = cached.nextPos;
  34656. return cached.result;
  34657. }
  34658. s0 = peg$parseassignment();
  34659. if (s0 === peg$FAILED) {
  34660. s0 = peg$parsecascade();
  34661. if (s0 === peg$FAILED) {
  34662. s0 = peg$parsekeywordSend();
  34663. if (s0 === peg$FAILED) {
  34664. s0 = peg$parsebinarySend();
  34665. }
  34666. }
  34667. }
  34668. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34669. return s0;
  34670. }
  34671. function peg$parseexpressionList() {
  34672. var s0, s1, s2, s3, s4;
  34673. var key = peg$currPos * 59 + 32,
  34674. cached = peg$cache[key];
  34675. if (cached) {
  34676. peg$currPos = cached.nextPos;
  34677. return cached.result;
  34678. }
  34679. s0 = peg$currPos;
  34680. s1 = peg$parsews();
  34681. if (s1 !== peg$FAILED) {
  34682. if (input.charCodeAt(peg$currPos) === 46) {
  34683. s2 = peg$c47;
  34684. peg$currPos++;
  34685. } else {
  34686. s2 = peg$FAILED;
  34687. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  34688. }
  34689. if (s2 !== peg$FAILED) {
  34690. s3 = peg$parsews();
  34691. if (s3 !== peg$FAILED) {
  34692. s4 = peg$parseexpression();
  34693. if (s4 !== peg$FAILED) {
  34694. peg$reportedPos = s0;
  34695. s1 = peg$c85(s4);
  34696. s0 = s1;
  34697. } else {
  34698. peg$currPos = s0;
  34699. s0 = peg$c1;
  34700. }
  34701. } else {
  34702. peg$currPos = s0;
  34703. s0 = peg$c1;
  34704. }
  34705. } else {
  34706. peg$currPos = s0;
  34707. s0 = peg$c1;
  34708. }
  34709. } else {
  34710. peg$currPos = s0;
  34711. s0 = peg$c1;
  34712. }
  34713. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34714. return s0;
  34715. }
  34716. function peg$parseexpressions() {
  34717. var s0, s1, s2, s3;
  34718. var key = peg$currPos * 59 + 33,
  34719. cached = peg$cache[key];
  34720. if (cached) {
  34721. peg$currPos = cached.nextPos;
  34722. return cached.result;
  34723. }
  34724. s0 = peg$currPos;
  34725. s1 = peg$parseexpression();
  34726. if (s1 !== peg$FAILED) {
  34727. s2 = [];
  34728. s3 = peg$parseexpressionList();
  34729. while (s3 !== peg$FAILED) {
  34730. s2.push(s3);
  34731. s3 = peg$parseexpressionList();
  34732. }
  34733. if (s2 !== peg$FAILED) {
  34734. peg$reportedPos = s0;
  34735. s1 = peg$c86(s1, s2);
  34736. s0 = s1;
  34737. } else {
  34738. peg$currPos = s0;
  34739. s0 = peg$c1;
  34740. }
  34741. } else {
  34742. peg$currPos = s0;
  34743. s0 = peg$c1;
  34744. }
  34745. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34746. return s0;
  34747. }
  34748. function peg$parseassignment() {
  34749. var s0, s1, s2, s3, s4, s5;
  34750. var key = peg$currPos * 59 + 34,
  34751. cached = peg$cache[key];
  34752. if (cached) {
  34753. peg$currPos = cached.nextPos;
  34754. return cached.result;
  34755. }
  34756. s0 = peg$currPos;
  34757. s1 = peg$parsevariable();
  34758. if (s1 !== peg$FAILED) {
  34759. s2 = peg$parsews();
  34760. if (s2 !== peg$FAILED) {
  34761. if (input.substr(peg$currPos, 2) === peg$c87) {
  34762. s3 = peg$c87;
  34763. peg$currPos += 2;
  34764. } else {
  34765. s3 = peg$FAILED;
  34766. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  34767. }
  34768. if (s3 !== peg$FAILED) {
  34769. s4 = peg$parsews();
  34770. if (s4 !== peg$FAILED) {
  34771. s5 = peg$parseexpression();
  34772. if (s5 !== peg$FAILED) {
  34773. peg$reportedPos = s0;
  34774. s1 = peg$c89(s1, s5);
  34775. s0 = s1;
  34776. } else {
  34777. peg$currPos = s0;
  34778. s0 = peg$c1;
  34779. }
  34780. } else {
  34781. peg$currPos = s0;
  34782. s0 = peg$c1;
  34783. }
  34784. } else {
  34785. peg$currPos = s0;
  34786. s0 = peg$c1;
  34787. }
  34788. } else {
  34789. peg$currPos = s0;
  34790. s0 = peg$c1;
  34791. }
  34792. } else {
  34793. peg$currPos = s0;
  34794. s0 = peg$c1;
  34795. }
  34796. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34797. return s0;
  34798. }
  34799. function peg$parseret() {
  34800. var s0, s1, s2, s3, s4, s5;
  34801. var key = peg$currPos * 59 + 35,
  34802. cached = peg$cache[key];
  34803. if (cached) {
  34804. peg$currPos = cached.nextPos;
  34805. return cached.result;
  34806. }
  34807. s0 = peg$currPos;
  34808. if (input.charCodeAt(peg$currPos) === 94) {
  34809. s1 = peg$c90;
  34810. peg$currPos++;
  34811. } else {
  34812. s1 = peg$FAILED;
  34813. if (peg$silentFails === 0) { peg$fail(peg$c91); }
  34814. }
  34815. if (s1 !== peg$FAILED) {
  34816. s2 = peg$parsews();
  34817. if (s2 !== peg$FAILED) {
  34818. s3 = peg$parseexpression();
  34819. if (s3 !== peg$FAILED) {
  34820. s4 = peg$parsews();
  34821. if (s4 !== peg$FAILED) {
  34822. if (input.charCodeAt(peg$currPos) === 46) {
  34823. s5 = peg$c47;
  34824. peg$currPos++;
  34825. } else {
  34826. s5 = peg$FAILED;
  34827. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  34828. }
  34829. if (s5 === peg$FAILED) {
  34830. s5 = peg$c37;
  34831. }
  34832. if (s5 !== peg$FAILED) {
  34833. peg$reportedPos = s0;
  34834. s1 = peg$c92(s3);
  34835. s0 = s1;
  34836. } else {
  34837. peg$currPos = s0;
  34838. s0 = peg$c1;
  34839. }
  34840. } else {
  34841. peg$currPos = s0;
  34842. s0 = peg$c1;
  34843. }
  34844. } else {
  34845. peg$currPos = s0;
  34846. s0 = peg$c1;
  34847. }
  34848. } else {
  34849. peg$currPos = s0;
  34850. s0 = peg$c1;
  34851. }
  34852. } else {
  34853. peg$currPos = s0;
  34854. s0 = peg$c1;
  34855. }
  34856. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34857. return s0;
  34858. }
  34859. function peg$parsetemps() {
  34860. var s0, s1, s2, s3, s4, s5, s6;
  34861. var key = peg$currPos * 59 + 36,
  34862. cached = peg$cache[key];
  34863. if (cached) {
  34864. peg$currPos = cached.nextPos;
  34865. return cached.result;
  34866. }
  34867. s0 = peg$currPos;
  34868. if (input.charCodeAt(peg$currPos) === 124) {
  34869. s1 = peg$c93;
  34870. peg$currPos++;
  34871. } else {
  34872. s1 = peg$FAILED;
  34873. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  34874. }
  34875. if (s1 !== peg$FAILED) {
  34876. s2 = [];
  34877. s3 = peg$currPos;
  34878. s4 = peg$parsews();
  34879. if (s4 !== peg$FAILED) {
  34880. s5 = peg$parseidentifier();
  34881. if (s5 !== peg$FAILED) {
  34882. s6 = peg$parsews();
  34883. if (s6 !== peg$FAILED) {
  34884. peg$reportedPos = s3;
  34885. s4 = peg$c95(s5);
  34886. s3 = s4;
  34887. } else {
  34888. peg$currPos = s3;
  34889. s3 = peg$c1;
  34890. }
  34891. } else {
  34892. peg$currPos = s3;
  34893. s3 = peg$c1;
  34894. }
  34895. } else {
  34896. peg$currPos = s3;
  34897. s3 = peg$c1;
  34898. }
  34899. while (s3 !== peg$FAILED) {
  34900. s2.push(s3);
  34901. s3 = peg$currPos;
  34902. s4 = peg$parsews();
  34903. if (s4 !== peg$FAILED) {
  34904. s5 = peg$parseidentifier();
  34905. if (s5 !== peg$FAILED) {
  34906. s6 = peg$parsews();
  34907. if (s6 !== peg$FAILED) {
  34908. peg$reportedPos = s3;
  34909. s4 = peg$c95(s5);
  34910. s3 = s4;
  34911. } else {
  34912. peg$currPos = s3;
  34913. s3 = peg$c1;
  34914. }
  34915. } else {
  34916. peg$currPos = s3;
  34917. s3 = peg$c1;
  34918. }
  34919. } else {
  34920. peg$currPos = s3;
  34921. s3 = peg$c1;
  34922. }
  34923. }
  34924. if (s2 !== peg$FAILED) {
  34925. if (input.charCodeAt(peg$currPos) === 124) {
  34926. s3 = peg$c93;
  34927. peg$currPos++;
  34928. } else {
  34929. s3 = peg$FAILED;
  34930. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  34931. }
  34932. if (s3 !== peg$FAILED) {
  34933. peg$reportedPos = s0;
  34934. s1 = peg$c96(s2);
  34935. s0 = s1;
  34936. } else {
  34937. peg$currPos = s0;
  34938. s0 = peg$c1;
  34939. }
  34940. } else {
  34941. peg$currPos = s0;
  34942. s0 = peg$c1;
  34943. }
  34944. } else {
  34945. peg$currPos = s0;
  34946. s0 = peg$c1;
  34947. }
  34948. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  34949. return s0;
  34950. }
  34951. function peg$parseblockParamList() {
  34952. var s0, s1, s2, s3, s4, s5, s6;
  34953. var key = peg$currPos * 59 + 37,
  34954. cached = peg$cache[key];
  34955. if (cached) {
  34956. peg$currPos = cached.nextPos;
  34957. return cached.result;
  34958. }
  34959. s0 = peg$currPos;
  34960. s1 = [];
  34961. s2 = peg$currPos;
  34962. s3 = peg$parsews();
  34963. if (s3 !== peg$FAILED) {
  34964. if (input.charCodeAt(peg$currPos) === 58) {
  34965. s4 = peg$c97;
  34966. peg$currPos++;
  34967. } else {
  34968. s4 = peg$FAILED;
  34969. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  34970. }
  34971. if (s4 !== peg$FAILED) {
  34972. s5 = peg$parsews();
  34973. if (s5 !== peg$FAILED) {
  34974. s6 = peg$parseidentifier();
  34975. if (s6 !== peg$FAILED) {
  34976. peg$reportedPos = s2;
  34977. s3 = peg$c99(s6);
  34978. s2 = s3;
  34979. } else {
  34980. peg$currPos = s2;
  34981. s2 = peg$c1;
  34982. }
  34983. } else {
  34984. peg$currPos = s2;
  34985. s2 = peg$c1;
  34986. }
  34987. } else {
  34988. peg$currPos = s2;
  34989. s2 = peg$c1;
  34990. }
  34991. } else {
  34992. peg$currPos = s2;
  34993. s2 = peg$c1;
  34994. }
  34995. if (s2 !== peg$FAILED) {
  34996. while (s2 !== peg$FAILED) {
  34997. s1.push(s2);
  34998. s2 = peg$currPos;
  34999. s3 = peg$parsews();
  35000. if (s3 !== peg$FAILED) {
  35001. if (input.charCodeAt(peg$currPos) === 58) {
  35002. s4 = peg$c97;
  35003. peg$currPos++;
  35004. } else {
  35005. s4 = peg$FAILED;
  35006. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  35007. }
  35008. if (s4 !== peg$FAILED) {
  35009. s5 = peg$parsews();
  35010. if (s5 !== peg$FAILED) {
  35011. s6 = peg$parseidentifier();
  35012. if (s6 !== peg$FAILED) {
  35013. peg$reportedPos = s2;
  35014. s3 = peg$c99(s6);
  35015. s2 = s3;
  35016. } else {
  35017. peg$currPos = s2;
  35018. s2 = peg$c1;
  35019. }
  35020. } else {
  35021. peg$currPos = s2;
  35022. s2 = peg$c1;
  35023. }
  35024. } else {
  35025. peg$currPos = s2;
  35026. s2 = peg$c1;
  35027. }
  35028. } else {
  35029. peg$currPos = s2;
  35030. s2 = peg$c1;
  35031. }
  35032. }
  35033. } else {
  35034. s1 = peg$c1;
  35035. }
  35036. if (s1 !== peg$FAILED) {
  35037. s2 = peg$parsews();
  35038. if (s2 !== peg$FAILED) {
  35039. if (input.charCodeAt(peg$currPos) === 124) {
  35040. s3 = peg$c93;
  35041. peg$currPos++;
  35042. } else {
  35043. s3 = peg$FAILED;
  35044. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  35045. }
  35046. if (s3 !== peg$FAILED) {
  35047. peg$reportedPos = s0;
  35048. s1 = peg$c100(s1);
  35049. s0 = s1;
  35050. } else {
  35051. peg$currPos = s0;
  35052. s0 = peg$c1;
  35053. }
  35054. } else {
  35055. peg$currPos = s0;
  35056. s0 = peg$c1;
  35057. }
  35058. } else {
  35059. peg$currPos = s0;
  35060. s0 = peg$c1;
  35061. }
  35062. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35063. return s0;
  35064. }
  35065. function peg$parsesubexpression() {
  35066. var s0, s1, s2, s3, s4, s5;
  35067. var key = peg$currPos * 59 + 38,
  35068. cached = peg$cache[key];
  35069. if (cached) {
  35070. peg$currPos = cached.nextPos;
  35071. return cached.result;
  35072. }
  35073. s0 = peg$currPos;
  35074. if (input.charCodeAt(peg$currPos) === 40) {
  35075. s1 = peg$c53;
  35076. peg$currPos++;
  35077. } else {
  35078. s1 = peg$FAILED;
  35079. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  35080. }
  35081. if (s1 !== peg$FAILED) {
  35082. s2 = peg$parsews();
  35083. if (s2 !== peg$FAILED) {
  35084. s3 = peg$parseexpression();
  35085. if (s3 !== peg$FAILED) {
  35086. s4 = peg$parsews();
  35087. if (s4 !== peg$FAILED) {
  35088. if (input.charCodeAt(peg$currPos) === 41) {
  35089. s5 = peg$c56;
  35090. peg$currPos++;
  35091. } else {
  35092. s5 = peg$FAILED;
  35093. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  35094. }
  35095. if (s5 !== peg$FAILED) {
  35096. peg$reportedPos = s0;
  35097. s1 = peg$c85(s3);
  35098. s0 = s1;
  35099. } else {
  35100. peg$currPos = s0;
  35101. s0 = peg$c1;
  35102. }
  35103. } else {
  35104. peg$currPos = s0;
  35105. s0 = peg$c1;
  35106. }
  35107. } else {
  35108. peg$currPos = s0;
  35109. s0 = peg$c1;
  35110. }
  35111. } else {
  35112. peg$currPos = s0;
  35113. s0 = peg$c1;
  35114. }
  35115. } else {
  35116. peg$currPos = s0;
  35117. s0 = peg$c1;
  35118. }
  35119. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35120. return s0;
  35121. }
  35122. function peg$parsestatements() {
  35123. var s0, s1, s2, s3, s4, s5, s6, s7;
  35124. var key = peg$currPos * 59 + 39,
  35125. cached = peg$cache[key];
  35126. if (cached) {
  35127. peg$currPos = cached.nextPos;
  35128. return cached.result;
  35129. }
  35130. s0 = peg$currPos;
  35131. s1 = peg$parseret();
  35132. if (s1 !== peg$FAILED) {
  35133. s2 = [];
  35134. if (peg$c101.test(input.charAt(peg$currPos))) {
  35135. s3 = input.charAt(peg$currPos);
  35136. peg$currPos++;
  35137. } else {
  35138. s3 = peg$FAILED;
  35139. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35140. }
  35141. while (s3 !== peg$FAILED) {
  35142. s2.push(s3);
  35143. if (peg$c101.test(input.charAt(peg$currPos))) {
  35144. s3 = input.charAt(peg$currPos);
  35145. peg$currPos++;
  35146. } else {
  35147. s3 = peg$FAILED;
  35148. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35149. }
  35150. }
  35151. if (s2 !== peg$FAILED) {
  35152. peg$reportedPos = s0;
  35153. s1 = peg$c103(s1);
  35154. s0 = s1;
  35155. } else {
  35156. peg$currPos = s0;
  35157. s0 = peg$c1;
  35158. }
  35159. } else {
  35160. peg$currPos = s0;
  35161. s0 = peg$c1;
  35162. }
  35163. if (s0 === peg$FAILED) {
  35164. s0 = peg$currPos;
  35165. s1 = peg$parseexpressions();
  35166. if (s1 !== peg$FAILED) {
  35167. s2 = peg$parsews();
  35168. if (s2 !== peg$FAILED) {
  35169. s3 = [];
  35170. if (peg$c101.test(input.charAt(peg$currPos))) {
  35171. s4 = input.charAt(peg$currPos);
  35172. peg$currPos++;
  35173. } else {
  35174. s4 = peg$FAILED;
  35175. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35176. }
  35177. if (s4 !== peg$FAILED) {
  35178. while (s4 !== peg$FAILED) {
  35179. s3.push(s4);
  35180. if (peg$c101.test(input.charAt(peg$currPos))) {
  35181. s4 = input.charAt(peg$currPos);
  35182. peg$currPos++;
  35183. } else {
  35184. s4 = peg$FAILED;
  35185. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35186. }
  35187. }
  35188. } else {
  35189. s3 = peg$c1;
  35190. }
  35191. if (s3 !== peg$FAILED) {
  35192. s4 = peg$parsews();
  35193. if (s4 !== peg$FAILED) {
  35194. s5 = peg$parseret();
  35195. if (s5 !== peg$FAILED) {
  35196. s6 = [];
  35197. if (peg$c101.test(input.charAt(peg$currPos))) {
  35198. s7 = input.charAt(peg$currPos);
  35199. peg$currPos++;
  35200. } else {
  35201. s7 = peg$FAILED;
  35202. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35203. }
  35204. while (s7 !== peg$FAILED) {
  35205. s6.push(s7);
  35206. if (peg$c101.test(input.charAt(peg$currPos))) {
  35207. s7 = input.charAt(peg$currPos);
  35208. peg$currPos++;
  35209. } else {
  35210. s7 = peg$FAILED;
  35211. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35212. }
  35213. }
  35214. if (s6 !== peg$FAILED) {
  35215. peg$reportedPos = s0;
  35216. s1 = peg$c104(s1, s5);
  35217. s0 = s1;
  35218. } else {
  35219. peg$currPos = s0;
  35220. s0 = peg$c1;
  35221. }
  35222. } else {
  35223. peg$currPos = s0;
  35224. s0 = peg$c1;
  35225. }
  35226. } else {
  35227. peg$currPos = s0;
  35228. s0 = peg$c1;
  35229. }
  35230. } else {
  35231. peg$currPos = s0;
  35232. s0 = peg$c1;
  35233. }
  35234. } else {
  35235. peg$currPos = s0;
  35236. s0 = peg$c1;
  35237. }
  35238. } else {
  35239. peg$currPos = s0;
  35240. s0 = peg$c1;
  35241. }
  35242. if (s0 === peg$FAILED) {
  35243. s0 = peg$currPos;
  35244. s1 = peg$parseexpressions();
  35245. if (s1 === peg$FAILED) {
  35246. s1 = peg$c37;
  35247. }
  35248. if (s1 !== peg$FAILED) {
  35249. s2 = [];
  35250. if (peg$c101.test(input.charAt(peg$currPos))) {
  35251. s3 = input.charAt(peg$currPos);
  35252. peg$currPos++;
  35253. } else {
  35254. s3 = peg$FAILED;
  35255. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35256. }
  35257. while (s3 !== peg$FAILED) {
  35258. s2.push(s3);
  35259. if (peg$c101.test(input.charAt(peg$currPos))) {
  35260. s3 = input.charAt(peg$currPos);
  35261. peg$currPos++;
  35262. } else {
  35263. s3 = peg$FAILED;
  35264. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  35265. }
  35266. }
  35267. if (s2 !== peg$FAILED) {
  35268. peg$reportedPos = s0;
  35269. s1 = peg$c105(s1);
  35270. s0 = s1;
  35271. } else {
  35272. peg$currPos = s0;
  35273. s0 = peg$c1;
  35274. }
  35275. } else {
  35276. peg$currPos = s0;
  35277. s0 = peg$c1;
  35278. }
  35279. }
  35280. }
  35281. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35282. return s0;
  35283. }
  35284. function peg$parsesequence() {
  35285. var s0;
  35286. var key = peg$currPos * 59 + 40,
  35287. cached = peg$cache[key];
  35288. if (cached) {
  35289. peg$currPos = cached.nextPos;
  35290. return cached.result;
  35291. }
  35292. s0 = peg$parsejsStatement();
  35293. if (s0 === peg$FAILED) {
  35294. s0 = peg$parsestSequence();
  35295. }
  35296. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35297. return s0;
  35298. }
  35299. function peg$parsestSequence() {
  35300. var s0, s1, s2, s3, s4;
  35301. var key = peg$currPos * 59 + 41,
  35302. cached = peg$cache[key];
  35303. if (cached) {
  35304. peg$currPos = cached.nextPos;
  35305. return cached.result;
  35306. }
  35307. s0 = peg$currPos;
  35308. s1 = peg$parsetemps();
  35309. if (s1 === peg$FAILED) {
  35310. s1 = peg$c37;
  35311. }
  35312. if (s1 !== peg$FAILED) {
  35313. s2 = peg$parsews();
  35314. if (s2 !== peg$FAILED) {
  35315. s3 = peg$parsestatements();
  35316. if (s3 === peg$FAILED) {
  35317. s3 = peg$c37;
  35318. }
  35319. if (s3 !== peg$FAILED) {
  35320. s4 = peg$parsews();
  35321. if (s4 !== peg$FAILED) {
  35322. peg$reportedPos = s0;
  35323. s1 = peg$c106(s1, s3);
  35324. s0 = s1;
  35325. } else {
  35326. peg$currPos = s0;
  35327. s0 = peg$c1;
  35328. }
  35329. } else {
  35330. peg$currPos = s0;
  35331. s0 = peg$c1;
  35332. }
  35333. } else {
  35334. peg$currPos = s0;
  35335. s0 = peg$c1;
  35336. }
  35337. } else {
  35338. peg$currPos = s0;
  35339. s0 = peg$c1;
  35340. }
  35341. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35342. return s0;
  35343. }
  35344. function peg$parseblock() {
  35345. var s0, s1, s2, s3, s4, s5, s6, s7;
  35346. var key = peg$currPos * 59 + 42,
  35347. cached = peg$cache[key];
  35348. if (cached) {
  35349. peg$currPos = cached.nextPos;
  35350. return cached.result;
  35351. }
  35352. s0 = peg$currPos;
  35353. if (input.charCodeAt(peg$currPos) === 91) {
  35354. s1 = peg$c107;
  35355. peg$currPos++;
  35356. } else {
  35357. s1 = peg$FAILED;
  35358. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  35359. }
  35360. if (s1 !== peg$FAILED) {
  35361. s2 = peg$parsews();
  35362. if (s2 !== peg$FAILED) {
  35363. s3 = peg$parseblockParamList();
  35364. if (s3 === peg$FAILED) {
  35365. s3 = peg$c37;
  35366. }
  35367. if (s3 !== peg$FAILED) {
  35368. s4 = peg$parsews();
  35369. if (s4 !== peg$FAILED) {
  35370. s5 = peg$parsesequence();
  35371. if (s5 === peg$FAILED) {
  35372. s5 = peg$c37;
  35373. }
  35374. if (s5 !== peg$FAILED) {
  35375. s6 = peg$parsews();
  35376. if (s6 !== peg$FAILED) {
  35377. if (input.charCodeAt(peg$currPos) === 93) {
  35378. s7 = peg$c109;
  35379. peg$currPos++;
  35380. } else {
  35381. s7 = peg$FAILED;
  35382. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  35383. }
  35384. if (s7 !== peg$FAILED) {
  35385. peg$reportedPos = s0;
  35386. s1 = peg$c111(s3, s5);
  35387. s0 = s1;
  35388. } else {
  35389. peg$currPos = s0;
  35390. s0 = peg$c1;
  35391. }
  35392. } else {
  35393. peg$currPos = s0;
  35394. s0 = peg$c1;
  35395. }
  35396. } else {
  35397. peg$currPos = s0;
  35398. s0 = peg$c1;
  35399. }
  35400. } else {
  35401. peg$currPos = s0;
  35402. s0 = peg$c1;
  35403. }
  35404. } else {
  35405. peg$currPos = s0;
  35406. s0 = peg$c1;
  35407. }
  35408. } else {
  35409. peg$currPos = s0;
  35410. s0 = peg$c1;
  35411. }
  35412. } else {
  35413. peg$currPos = s0;
  35414. s0 = peg$c1;
  35415. }
  35416. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35417. return s0;
  35418. }
  35419. function peg$parseoperand() {
  35420. var s0;
  35421. var key = peg$currPos * 59 + 43,
  35422. cached = peg$cache[key];
  35423. if (cached) {
  35424. peg$currPos = cached.nextPos;
  35425. return cached.result;
  35426. }
  35427. s0 = peg$parseliteral();
  35428. if (s0 === peg$FAILED) {
  35429. s0 = peg$parsevariable();
  35430. if (s0 === peg$FAILED) {
  35431. s0 = peg$parsesubexpression();
  35432. }
  35433. }
  35434. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35435. return s0;
  35436. }
  35437. function peg$parseunaryMessage() {
  35438. var s0, s1, s2, s3, s4;
  35439. var key = peg$currPos * 59 + 44,
  35440. cached = peg$cache[key];
  35441. if (cached) {
  35442. peg$currPos = cached.nextPos;
  35443. return cached.result;
  35444. }
  35445. s0 = peg$currPos;
  35446. s1 = peg$parsews();
  35447. if (s1 !== peg$FAILED) {
  35448. s2 = peg$parseidentifier();
  35449. if (s2 !== peg$FAILED) {
  35450. s3 = peg$currPos;
  35451. peg$silentFails++;
  35452. if (peg$c13.test(input.charAt(peg$currPos))) {
  35453. s4 = input.charAt(peg$currPos);
  35454. peg$currPos++;
  35455. } else {
  35456. s4 = peg$FAILED;
  35457. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  35458. }
  35459. peg$silentFails--;
  35460. if (s4 === peg$FAILED) {
  35461. s3 = peg$c112;
  35462. } else {
  35463. peg$currPos = s3;
  35464. s3 = peg$c1;
  35465. }
  35466. if (s3 !== peg$FAILED) {
  35467. peg$reportedPos = s0;
  35468. s1 = peg$c113(s2);
  35469. s0 = s1;
  35470. } else {
  35471. peg$currPos = s0;
  35472. s0 = peg$c1;
  35473. }
  35474. } else {
  35475. peg$currPos = s0;
  35476. s0 = peg$c1;
  35477. }
  35478. } else {
  35479. peg$currPos = s0;
  35480. s0 = peg$c1;
  35481. }
  35482. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35483. return s0;
  35484. }
  35485. function peg$parseunaryTail() {
  35486. var s0, s1, s2, s3, s4;
  35487. var key = peg$currPos * 59 + 45,
  35488. cached = peg$cache[key];
  35489. if (cached) {
  35490. peg$currPos = cached.nextPos;
  35491. return cached.result;
  35492. }
  35493. s0 = peg$currPos;
  35494. s1 = peg$parseunaryMessage();
  35495. if (s1 !== peg$FAILED) {
  35496. s2 = peg$parsews();
  35497. if (s2 !== peg$FAILED) {
  35498. s3 = peg$parseunaryTail();
  35499. if (s3 === peg$FAILED) {
  35500. s3 = peg$c37;
  35501. }
  35502. if (s3 !== peg$FAILED) {
  35503. s4 = peg$parsews();
  35504. if (s4 !== peg$FAILED) {
  35505. peg$reportedPos = s0;
  35506. s1 = peg$c114(s1, s3);
  35507. s0 = s1;
  35508. } else {
  35509. peg$currPos = s0;
  35510. s0 = peg$c1;
  35511. }
  35512. } else {
  35513. peg$currPos = s0;
  35514. s0 = peg$c1;
  35515. }
  35516. } else {
  35517. peg$currPos = s0;
  35518. s0 = peg$c1;
  35519. }
  35520. } else {
  35521. peg$currPos = s0;
  35522. s0 = peg$c1;
  35523. }
  35524. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35525. return s0;
  35526. }
  35527. function peg$parseunarySend() {
  35528. var s0, s1, s2, s3;
  35529. var key = peg$currPos * 59 + 46,
  35530. cached = peg$cache[key];
  35531. if (cached) {
  35532. peg$currPos = cached.nextPos;
  35533. return cached.result;
  35534. }
  35535. s0 = peg$currPos;
  35536. s1 = peg$parseoperand();
  35537. if (s1 !== peg$FAILED) {
  35538. s2 = peg$parsews();
  35539. if (s2 !== peg$FAILED) {
  35540. s3 = peg$parseunaryTail();
  35541. if (s3 === peg$FAILED) {
  35542. s3 = peg$c37;
  35543. }
  35544. if (s3 !== peg$FAILED) {
  35545. peg$reportedPos = s0;
  35546. s1 = peg$c115(s1, s3);
  35547. s0 = s1;
  35548. } else {
  35549. peg$currPos = s0;
  35550. s0 = peg$c1;
  35551. }
  35552. } else {
  35553. peg$currPos = s0;
  35554. s0 = peg$c1;
  35555. }
  35556. } else {
  35557. peg$currPos = s0;
  35558. s0 = peg$c1;
  35559. }
  35560. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35561. return s0;
  35562. }
  35563. function peg$parsebinaryMessage() {
  35564. var s0, s1, s2, s3, s4;
  35565. var key = peg$currPos * 59 + 47,
  35566. cached = peg$cache[key];
  35567. if (cached) {
  35568. peg$currPos = cached.nextPos;
  35569. return cached.result;
  35570. }
  35571. s0 = peg$currPos;
  35572. s1 = peg$parsews();
  35573. if (s1 !== peg$FAILED) {
  35574. s2 = peg$parsebinarySelector();
  35575. if (s2 !== peg$FAILED) {
  35576. s3 = peg$parsews();
  35577. if (s3 !== peg$FAILED) {
  35578. s4 = peg$parseunarySend();
  35579. if (s4 === peg$FAILED) {
  35580. s4 = peg$parseoperand();
  35581. }
  35582. if (s4 !== peg$FAILED) {
  35583. peg$reportedPos = s0;
  35584. s1 = peg$c116(s2, s4);
  35585. s0 = s1;
  35586. } else {
  35587. peg$currPos = s0;
  35588. s0 = peg$c1;
  35589. }
  35590. } else {
  35591. peg$currPos = s0;
  35592. s0 = peg$c1;
  35593. }
  35594. } else {
  35595. peg$currPos = s0;
  35596. s0 = peg$c1;
  35597. }
  35598. } else {
  35599. peg$currPos = s0;
  35600. s0 = peg$c1;
  35601. }
  35602. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35603. return s0;
  35604. }
  35605. function peg$parsebinaryTail() {
  35606. var s0, s1, s2;
  35607. var key = peg$currPos * 59 + 48,
  35608. cached = peg$cache[key];
  35609. if (cached) {
  35610. peg$currPos = cached.nextPos;
  35611. return cached.result;
  35612. }
  35613. s0 = peg$currPos;
  35614. s1 = peg$parsebinaryMessage();
  35615. if (s1 !== peg$FAILED) {
  35616. s2 = peg$parsebinaryTail();
  35617. if (s2 === peg$FAILED) {
  35618. s2 = peg$c37;
  35619. }
  35620. if (s2 !== peg$FAILED) {
  35621. peg$reportedPos = s0;
  35622. s1 = peg$c117(s1, s2);
  35623. s0 = s1;
  35624. } else {
  35625. peg$currPos = s0;
  35626. s0 = peg$c1;
  35627. }
  35628. } else {
  35629. peg$currPos = s0;
  35630. s0 = peg$c1;
  35631. }
  35632. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35633. return s0;
  35634. }
  35635. function peg$parsebinarySend() {
  35636. var s0, s1, s2;
  35637. var key = peg$currPos * 59 + 49,
  35638. cached = peg$cache[key];
  35639. if (cached) {
  35640. peg$currPos = cached.nextPos;
  35641. return cached.result;
  35642. }
  35643. s0 = peg$currPos;
  35644. s1 = peg$parseunarySend();
  35645. if (s1 !== peg$FAILED) {
  35646. s2 = peg$parsebinaryTail();
  35647. if (s2 === peg$FAILED) {
  35648. s2 = peg$c37;
  35649. }
  35650. if (s2 !== peg$FAILED) {
  35651. peg$reportedPos = s0;
  35652. s1 = peg$c115(s1, s2);
  35653. s0 = s1;
  35654. } else {
  35655. peg$currPos = s0;
  35656. s0 = peg$c1;
  35657. }
  35658. } else {
  35659. peg$currPos = s0;
  35660. s0 = peg$c1;
  35661. }
  35662. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35663. return s0;
  35664. }
  35665. function peg$parsekeywordMessage() {
  35666. var s0, s1, s2, s3, s4, s5;
  35667. var key = peg$currPos * 59 + 50,
  35668. cached = peg$cache[key];
  35669. if (cached) {
  35670. peg$currPos = cached.nextPos;
  35671. return cached.result;
  35672. }
  35673. s0 = peg$currPos;
  35674. s1 = peg$parsews();
  35675. if (s1 !== peg$FAILED) {
  35676. s2 = [];
  35677. s3 = peg$currPos;
  35678. s4 = peg$parsekeywordPair();
  35679. if (s4 !== peg$FAILED) {
  35680. s5 = peg$parsews();
  35681. if (s5 !== peg$FAILED) {
  35682. peg$reportedPos = s3;
  35683. s4 = peg$c118(s4);
  35684. s3 = s4;
  35685. } else {
  35686. peg$currPos = s3;
  35687. s3 = peg$c1;
  35688. }
  35689. } else {
  35690. peg$currPos = s3;
  35691. s3 = peg$c1;
  35692. }
  35693. if (s3 !== peg$FAILED) {
  35694. while (s3 !== peg$FAILED) {
  35695. s2.push(s3);
  35696. s3 = peg$currPos;
  35697. s4 = peg$parsekeywordPair();
  35698. if (s4 !== peg$FAILED) {
  35699. s5 = peg$parsews();
  35700. if (s5 !== peg$FAILED) {
  35701. peg$reportedPos = s3;
  35702. s4 = peg$c118(s4);
  35703. s3 = s4;
  35704. } else {
  35705. peg$currPos = s3;
  35706. s3 = peg$c1;
  35707. }
  35708. } else {
  35709. peg$currPos = s3;
  35710. s3 = peg$c1;
  35711. }
  35712. }
  35713. } else {
  35714. s2 = peg$c1;
  35715. }
  35716. if (s2 !== peg$FAILED) {
  35717. peg$reportedPos = s0;
  35718. s1 = peg$c119(s2);
  35719. s0 = s1;
  35720. } else {
  35721. peg$currPos = s0;
  35722. s0 = peg$c1;
  35723. }
  35724. } else {
  35725. peg$currPos = s0;
  35726. s0 = peg$c1;
  35727. }
  35728. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35729. return s0;
  35730. }
  35731. function peg$parsekeywordSend() {
  35732. var s0, s1, s2;
  35733. var key = peg$currPos * 59 + 51,
  35734. cached = peg$cache[key];
  35735. if (cached) {
  35736. peg$currPos = cached.nextPos;
  35737. return cached.result;
  35738. }
  35739. s0 = peg$currPos;
  35740. s1 = peg$parsebinarySend();
  35741. if (s1 !== peg$FAILED) {
  35742. s2 = peg$parsekeywordMessage();
  35743. if (s2 !== peg$FAILED) {
  35744. peg$reportedPos = s0;
  35745. s1 = peg$c120(s1, s2);
  35746. s0 = s1;
  35747. } else {
  35748. peg$currPos = s0;
  35749. s0 = peg$c1;
  35750. }
  35751. } else {
  35752. peg$currPos = s0;
  35753. s0 = peg$c1;
  35754. }
  35755. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35756. return s0;
  35757. }
  35758. function peg$parsemessage() {
  35759. var s0;
  35760. var key = peg$currPos * 59 + 52,
  35761. cached = peg$cache[key];
  35762. if (cached) {
  35763. peg$currPos = cached.nextPos;
  35764. return cached.result;
  35765. }
  35766. s0 = peg$parsebinaryMessage();
  35767. if (s0 === peg$FAILED) {
  35768. s0 = peg$parseunaryMessage();
  35769. if (s0 === peg$FAILED) {
  35770. s0 = peg$parsekeywordMessage();
  35771. }
  35772. }
  35773. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35774. return s0;
  35775. }
  35776. function peg$parsecascade() {
  35777. var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
  35778. var key = peg$currPos * 59 + 53,
  35779. cached = peg$cache[key];
  35780. if (cached) {
  35781. peg$currPos = cached.nextPos;
  35782. return cached.result;
  35783. }
  35784. s0 = peg$currPos;
  35785. s1 = peg$parsews();
  35786. if (s1 !== peg$FAILED) {
  35787. s2 = peg$parsekeywordSend();
  35788. if (s2 === peg$FAILED) {
  35789. s2 = peg$parsebinarySend();
  35790. }
  35791. if (s2 !== peg$FAILED) {
  35792. s3 = [];
  35793. s4 = peg$currPos;
  35794. s5 = peg$parsews();
  35795. if (s5 !== peg$FAILED) {
  35796. if (input.charCodeAt(peg$currPos) === 59) {
  35797. s6 = peg$c121;
  35798. peg$currPos++;
  35799. } else {
  35800. s6 = peg$FAILED;
  35801. if (peg$silentFails === 0) { peg$fail(peg$c122); }
  35802. }
  35803. if (s6 !== peg$FAILED) {
  35804. s7 = peg$parsews();
  35805. if (s7 !== peg$FAILED) {
  35806. s8 = peg$parsemessage();
  35807. if (s8 !== peg$FAILED) {
  35808. s9 = peg$parsews();
  35809. if (s9 !== peg$FAILED) {
  35810. peg$reportedPos = s4;
  35811. s5 = peg$c123(s8);
  35812. s4 = s5;
  35813. } else {
  35814. peg$currPos = s4;
  35815. s4 = peg$c1;
  35816. }
  35817. } else {
  35818. peg$currPos = s4;
  35819. s4 = peg$c1;
  35820. }
  35821. } else {
  35822. peg$currPos = s4;
  35823. s4 = peg$c1;
  35824. }
  35825. } else {
  35826. peg$currPos = s4;
  35827. s4 = peg$c1;
  35828. }
  35829. } else {
  35830. peg$currPos = s4;
  35831. s4 = peg$c1;
  35832. }
  35833. if (s4 !== peg$FAILED) {
  35834. while (s4 !== peg$FAILED) {
  35835. s3.push(s4);
  35836. s4 = peg$currPos;
  35837. s5 = peg$parsews();
  35838. if (s5 !== peg$FAILED) {
  35839. if (input.charCodeAt(peg$currPos) === 59) {
  35840. s6 = peg$c121;
  35841. peg$currPos++;
  35842. } else {
  35843. s6 = peg$FAILED;
  35844. if (peg$silentFails === 0) { peg$fail(peg$c122); }
  35845. }
  35846. if (s6 !== peg$FAILED) {
  35847. s7 = peg$parsews();
  35848. if (s7 !== peg$FAILED) {
  35849. s8 = peg$parsemessage();
  35850. if (s8 !== peg$FAILED) {
  35851. s9 = peg$parsews();
  35852. if (s9 !== peg$FAILED) {
  35853. peg$reportedPos = s4;
  35854. s5 = peg$c123(s8);
  35855. s4 = s5;
  35856. } else {
  35857. peg$currPos = s4;
  35858. s4 = peg$c1;
  35859. }
  35860. } else {
  35861. peg$currPos = s4;
  35862. s4 = peg$c1;
  35863. }
  35864. } else {
  35865. peg$currPos = s4;
  35866. s4 = peg$c1;
  35867. }
  35868. } else {
  35869. peg$currPos = s4;
  35870. s4 = peg$c1;
  35871. }
  35872. } else {
  35873. peg$currPos = s4;
  35874. s4 = peg$c1;
  35875. }
  35876. }
  35877. } else {
  35878. s3 = peg$c1;
  35879. }
  35880. if (s3 !== peg$FAILED) {
  35881. peg$reportedPos = s0;
  35882. s1 = peg$c124(s2, s3);
  35883. s0 = s1;
  35884. } else {
  35885. peg$currPos = s0;
  35886. s0 = peg$c1;
  35887. }
  35888. } else {
  35889. peg$currPos = s0;
  35890. s0 = peg$c1;
  35891. }
  35892. } else {
  35893. peg$currPos = s0;
  35894. s0 = peg$c1;
  35895. }
  35896. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35897. return s0;
  35898. }
  35899. function peg$parsejsStatement() {
  35900. var s0, s1, s2, s3, s4;
  35901. var key = peg$currPos * 59 + 54,
  35902. cached = peg$cache[key];
  35903. if (cached) {
  35904. peg$currPos = cached.nextPos;
  35905. return cached.result;
  35906. }
  35907. s0 = peg$currPos;
  35908. if (input.charCodeAt(peg$currPos) === 60) {
  35909. s1 = peg$c125;
  35910. peg$currPos++;
  35911. } else {
  35912. s1 = peg$FAILED;
  35913. if (peg$silentFails === 0) { peg$fail(peg$c126); }
  35914. }
  35915. if (s1 !== peg$FAILED) {
  35916. s2 = [];
  35917. s3 = peg$currPos;
  35918. if (input.substr(peg$currPos, 2) === peg$c127) {
  35919. s4 = peg$c127;
  35920. peg$currPos += 2;
  35921. } else {
  35922. s4 = peg$FAILED;
  35923. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  35924. }
  35925. if (s4 !== peg$FAILED) {
  35926. peg$reportedPos = s3;
  35927. s4 = peg$c129();
  35928. }
  35929. s3 = s4;
  35930. if (s3 === peg$FAILED) {
  35931. if (peg$c130.test(input.charAt(peg$currPos))) {
  35932. s3 = input.charAt(peg$currPos);
  35933. peg$currPos++;
  35934. } else {
  35935. s3 = peg$FAILED;
  35936. if (peg$silentFails === 0) { peg$fail(peg$c131); }
  35937. }
  35938. }
  35939. while (s3 !== peg$FAILED) {
  35940. s2.push(s3);
  35941. s3 = peg$currPos;
  35942. if (input.substr(peg$currPos, 2) === peg$c127) {
  35943. s4 = peg$c127;
  35944. peg$currPos += 2;
  35945. } else {
  35946. s4 = peg$FAILED;
  35947. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  35948. }
  35949. if (s4 !== peg$FAILED) {
  35950. peg$reportedPos = s3;
  35951. s4 = peg$c129();
  35952. }
  35953. s3 = s4;
  35954. if (s3 === peg$FAILED) {
  35955. if (peg$c130.test(input.charAt(peg$currPos))) {
  35956. s3 = input.charAt(peg$currPos);
  35957. peg$currPos++;
  35958. } else {
  35959. s3 = peg$FAILED;
  35960. if (peg$silentFails === 0) { peg$fail(peg$c131); }
  35961. }
  35962. }
  35963. }
  35964. if (s2 !== peg$FAILED) {
  35965. if (input.charCodeAt(peg$currPos) === 62) {
  35966. s3 = peg$c132;
  35967. peg$currPos++;
  35968. } else {
  35969. s3 = peg$FAILED;
  35970. if (peg$silentFails === 0) { peg$fail(peg$c133); }
  35971. }
  35972. if (s3 !== peg$FAILED) {
  35973. peg$reportedPos = s0;
  35974. s1 = peg$c134(s2);
  35975. s0 = s1;
  35976. } else {
  35977. peg$currPos = s0;
  35978. s0 = peg$c1;
  35979. }
  35980. } else {
  35981. peg$currPos = s0;
  35982. s0 = peg$c1;
  35983. }
  35984. } else {
  35985. peg$currPos = s0;
  35986. s0 = peg$c1;
  35987. }
  35988. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35989. return s0;
  35990. }
  35991. function peg$parsemethod() {
  35992. var s0, s1, s2, s3, s4, s5;
  35993. var key = peg$currPos * 59 + 55,
  35994. cached = peg$cache[key];
  35995. if (cached) {
  35996. peg$currPos = cached.nextPos;
  35997. return cached.result;
  35998. }
  35999. s0 = peg$currPos;
  36000. s1 = peg$parsews();
  36001. if (s1 !== peg$FAILED) {
  36002. s2 = peg$parsekeywordPattern();
  36003. if (s2 === peg$FAILED) {
  36004. s2 = peg$parsebinaryPattern();
  36005. if (s2 === peg$FAILED) {
  36006. s2 = peg$parseunaryPattern();
  36007. }
  36008. }
  36009. if (s2 !== peg$FAILED) {
  36010. s3 = peg$parsews();
  36011. if (s3 !== peg$FAILED) {
  36012. s4 = peg$parsesequence();
  36013. if (s4 === peg$FAILED) {
  36014. s4 = peg$c37;
  36015. }
  36016. if (s4 !== peg$FAILED) {
  36017. s5 = peg$parsews();
  36018. if (s5 !== peg$FAILED) {
  36019. peg$reportedPos = s0;
  36020. s1 = peg$c135(s2, s4);
  36021. s0 = s1;
  36022. } else {
  36023. peg$currPos = s0;
  36024. s0 = peg$c1;
  36025. }
  36026. } else {
  36027. peg$currPos = s0;
  36028. s0 = peg$c1;
  36029. }
  36030. } else {
  36031. peg$currPos = s0;
  36032. s0 = peg$c1;
  36033. }
  36034. } else {
  36035. peg$currPos = s0;
  36036. s0 = peg$c1;
  36037. }
  36038. } else {
  36039. peg$currPos = s0;
  36040. s0 = peg$c1;
  36041. }
  36042. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36043. return s0;
  36044. }
  36045. function peg$parseassociationSend() {
  36046. var s0, s1, s2;
  36047. var key = peg$currPos * 59 + 56,
  36048. cached = peg$cache[key];
  36049. if (cached) {
  36050. peg$currPos = cached.nextPos;
  36051. return cached.result;
  36052. }
  36053. s0 = peg$currPos;
  36054. s1 = peg$parsebinarySend();
  36055. if (s1 !== peg$FAILED) {
  36056. peg$reportedPos = peg$currPos;
  36057. s2 = peg$c136(s1);
  36058. if (s2) {
  36059. s2 = peg$c112;
  36060. } else {
  36061. s2 = peg$c1;
  36062. }
  36063. if (s2 !== peg$FAILED) {
  36064. peg$reportedPos = s0;
  36065. s1 = peg$c137(s1);
  36066. s0 = s1;
  36067. } else {
  36068. peg$currPos = s0;
  36069. s0 = peg$c1;
  36070. }
  36071. } else {
  36072. peg$currPos = s0;
  36073. s0 = peg$c1;
  36074. }
  36075. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36076. return s0;
  36077. }
  36078. function peg$parseassociationList() {
  36079. var s0, s1, s2, s3, s4;
  36080. var key = peg$currPos * 59 + 57,
  36081. cached = peg$cache[key];
  36082. if (cached) {
  36083. peg$currPos = cached.nextPos;
  36084. return cached.result;
  36085. }
  36086. s0 = peg$currPos;
  36087. s1 = peg$parsews();
  36088. if (s1 !== peg$FAILED) {
  36089. if (input.charCodeAt(peg$currPos) === 46) {
  36090. s2 = peg$c47;
  36091. peg$currPos++;
  36092. } else {
  36093. s2 = peg$FAILED;
  36094. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  36095. }
  36096. if (s2 !== peg$FAILED) {
  36097. s3 = peg$parsews();
  36098. if (s3 !== peg$FAILED) {
  36099. s4 = peg$parseassociationSend();
  36100. if (s4 !== peg$FAILED) {
  36101. peg$reportedPos = s0;
  36102. s1 = peg$c85(s4);
  36103. s0 = s1;
  36104. } else {
  36105. peg$currPos = s0;
  36106. s0 = peg$c1;
  36107. }
  36108. } else {
  36109. peg$currPos = s0;
  36110. s0 = peg$c1;
  36111. }
  36112. } else {
  36113. peg$currPos = s0;
  36114. s0 = peg$c1;
  36115. }
  36116. } else {
  36117. peg$currPos = s0;
  36118. s0 = peg$c1;
  36119. }
  36120. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36121. return s0;
  36122. }
  36123. function peg$parseassociations() {
  36124. var s0, s1, s2, s3;
  36125. var key = peg$currPos * 59 + 58,
  36126. cached = peg$cache[key];
  36127. if (cached) {
  36128. peg$currPos = cached.nextPos;
  36129. return cached.result;
  36130. }
  36131. s0 = peg$currPos;
  36132. s1 = peg$parseassociationSend();
  36133. if (s1 !== peg$FAILED) {
  36134. s2 = [];
  36135. s3 = peg$parseassociationList();
  36136. while (s3 !== peg$FAILED) {
  36137. s2.push(s3);
  36138. s3 = peg$parseassociationList();
  36139. }
  36140. if (s2 !== peg$FAILED) {
  36141. peg$reportedPos = s0;
  36142. s1 = peg$c138(s1, s2);
  36143. s0 = s1;
  36144. } else {
  36145. peg$currPos = s0;
  36146. s0 = peg$c1;
  36147. }
  36148. } else {
  36149. peg$currPos = s0;
  36150. s0 = peg$c1;
  36151. }
  36152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36153. return s0;
  36154. }
  36155. peg$result = peg$startRuleFunction();
  36156. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  36157. return peg$result;
  36158. } else {
  36159. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  36160. peg$fail({ type: "end", description: "end of input" });
  36161. }
  36162. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  36163. }
  36164. }
  36165. return {
  36166. SyntaxError: SyntaxError,
  36167. parse: parse
  36168. };
  36169. })();
  36170. });
  36171. define("amber_cli/AmberCli", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  36172. smalltalk.addPackage('AmberCli');
  36173. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  36174. smalltalk.addClass('AmberCli', globals.Object, [], 'AmberCli');
  36175. 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.";
  36176. smalltalk.addMethod(
  36177. smalltalk.method({
  36178. selector: "commandLineSwitches",
  36179. protocol: 'commandline',
  36180. fn: function (){
  36181. var self=this;
  36182. var switches;
  36183. return smalltalk.withContext(function($ctx1) {
  36184. var $1;
  36185. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  36186. return smalltalk.withContext(function($ctx2) {
  36187. return _st(each)._selector();
  36188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  36189. $ctx1.sendIdx["collect:"]=1;
  36190. switches=_st(switches)._select_((function(each){
  36191. return smalltalk.withContext(function($ctx2) {
  36192. return _st(each)._match_("^[^:]*:$");
  36193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  36194. switches=_st(switches)._collect_((function(each){
  36195. return smalltalk.withContext(function($ctx2) {
  36196. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  36197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  36198. $1=switches;
  36199. return $1;
  36200. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.AmberCli.klass)})},
  36201. args: [],
  36202. 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",
  36203. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  36204. referencedClasses: []
  36205. }),
  36206. globals.AmberCli.klass);
  36207. smalltalk.addMethod(
  36208. smalltalk.method({
  36209. selector: "handleArguments:",
  36210. protocol: 'commandline',
  36211. fn: function (args){
  36212. var self=this;
  36213. var selector;
  36214. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  36215. return smalltalk.withContext(function($ctx1) {
  36216. var $1;
  36217. $1=_st(args)._first();
  36218. $ctx1.sendIdx["first"]=1;
  36219. selector=self._selectorForCommandLineSwitch_($1);
  36220. _st(args)._remove_(_st(args)._first());
  36221. self._perform_withArguments_(selector,_st($Array())._with_(args));
  36222. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},globals.AmberCli.klass)})},
  36223. args: ["args"],
  36224. 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)",
  36225. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  36226. referencedClasses: ["Array"]
  36227. }),
  36228. globals.AmberCli.klass);
  36229. smalltalk.addMethod(
  36230. smalltalk.method({
  36231. selector: "help:",
  36232. protocol: 'commands',
  36233. fn: function (args){
  36234. var self=this;
  36235. return smalltalk.withContext(function($ctx1) {
  36236. _st(console)._log_("Available Commands:");
  36237. $ctx1.sendIdx["log:"]=1;
  36238. _st(self._commandLineSwitches())._do_((function(each){
  36239. return smalltalk.withContext(function($ctx2) {
  36240. return _st(console)._log_(each);
  36241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  36242. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},globals.AmberCli.klass)})},
  36243. args: ["args"],
  36244. source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  36245. messageSends: ["log:", "do:", "commandLineSwitches"],
  36246. referencedClasses: []
  36247. }),
  36248. globals.AmberCli.klass);
  36249. smalltalk.addMethod(
  36250. smalltalk.method({
  36251. selector: "main",
  36252. protocol: 'startup',
  36253. fn: function (){
  36254. var self=this;
  36255. var args,nodeMinorVersion;
  36256. return smalltalk.withContext(function($ctx1) {
  36257. var $3,$2,$1,$4,$5,$6;
  36258. $3=_st(process)._version();
  36259. $ctx1.sendIdx["version"]=1;
  36260. $2=_st($3)._tokenize_(".");
  36261. $1=_st($2)._second();
  36262. nodeMinorVersion=_st($1)._asNumber();
  36263. $4=_st(nodeMinorVersion).__lt((8));
  36264. if(smalltalk.assert($4)){
  36265. _st(console)._log_("You are currently using Node.js ".__comma(_st(process)._version()));
  36266. $ctx1.sendIdx["log:"]=1;
  36267. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  36268. return (-1);
  36269. };
  36270. args=_st(process)._argv();
  36271. _st(args)._removeFrom_to_((1),(2));
  36272. $5=_st(args)._isEmpty();
  36273. if(smalltalk.assert($5)){
  36274. self._help_(nil);
  36275. } else {
  36276. $6=self._handleArguments_(args);
  36277. return $6;
  36278. };
  36279. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},globals.AmberCli.klass)})},
  36280. args: [],
  36281. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09console log: 'You are currently using Node.js ', (process version).\x0a\x09\x09console log: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\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]",
  36282. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "<", "log:", ",", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"],
  36283. referencedClasses: []
  36284. }),
  36285. globals.AmberCli.klass);
  36286. smalltalk.addMethod(
  36287. smalltalk.method({
  36288. selector: "repl:",
  36289. protocol: 'commands',
  36290. fn: function (args){
  36291. var self=this;
  36292. function $Repl(){return globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  36293. return smalltalk.withContext(function($ctx1) {
  36294. var $1;
  36295. $1=_st(_st($Repl())._new())._createInterface();
  36296. return $1;
  36297. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},globals.AmberCli.klass)})},
  36298. args: ["args"],
  36299. source: "repl: args\x0a\x09^Repl new createInterface",
  36300. messageSends: ["createInterface", "new"],
  36301. referencedClasses: ["Repl"]
  36302. }),
  36303. globals.AmberCli.klass);
  36304. smalltalk.addMethod(
  36305. smalltalk.method({
  36306. selector: "selectorForCommandLineSwitch:",
  36307. protocol: 'commandline',
  36308. fn: function (aSwitch){
  36309. var self=this;
  36310. var command,selector;
  36311. return smalltalk.withContext(function($ctx1) {
  36312. var $1,$2;
  36313. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  36314. if(smalltalk.assert($1)){
  36315. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  36316. return smalltalk.withContext(function($ctx2) {
  36317. return _st(_st(each)._second())._asUppercase();
  36318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}))).__comma(":");
  36319. selector;
  36320. } else {
  36321. selector="help:";
  36322. selector;
  36323. };
  36324. $2=selector;
  36325. return $2;
  36326. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},globals.AmberCli.klass)})},
  36327. args: ["aSwitch"],
  36328. 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",
  36329. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"],
  36330. referencedClasses: []
  36331. }),
  36332. globals.AmberCli.klass);
  36333. smalltalk.addMethod(
  36334. smalltalk.method({
  36335. selector: "serve:",
  36336. protocol: 'commands',
  36337. fn: function (args){
  36338. var self=this;
  36339. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  36340. return smalltalk.withContext(function($ctx1) {
  36341. var $1;
  36342. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  36343. return $1;
  36344. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},globals.AmberCli.klass)})},
  36345. args: ["args"],
  36346. source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start",
  36347. messageSends: ["start", "createServerWithArguments:"],
  36348. referencedClasses: ["FileServer"]
  36349. }),
  36350. globals.AmberCli.klass);
  36351. smalltalk.addClass('FileServer', globals.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  36352. 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.";
  36353. smalltalk.addMethod(
  36354. smalltalk.method({
  36355. selector: "base64Decode:",
  36356. protocol: 'private',
  36357. fn: function (aString){
  36358. var self=this;
  36359. return smalltalk.withContext(function($ctx1) {
  36360. return (new Buffer(aString, 'base64').toString());
  36361. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},globals.FileServer)})},
  36362. args: ["aString"],
  36363. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  36364. messageSends: [],
  36365. referencedClasses: []
  36366. }),
  36367. globals.FileServer);
  36368. smalltalk.addMethod(
  36369. smalltalk.method({
  36370. selector: "basePath",
  36371. protocol: 'accessing',
  36372. fn: function (){
  36373. var self=this;
  36374. return smalltalk.withContext(function($ctx1) {
  36375. var $2,$1;
  36376. $2=self["@basePath"];
  36377. if(($receiver = $2) == nil || $receiver == null){
  36378. $1=_st(self._class())._defaultBasePath();
  36379. } else {
  36380. $1=$2;
  36381. };
  36382. return $1;
  36383. }, function($ctx1) {$ctx1.fill(self,"basePath",{},globals.FileServer)})},
  36384. args: [],
  36385. source: "basePath\x0a\x09^basePath ifNil: [self class defaultBasePath]",
  36386. messageSends: ["ifNil:", "defaultBasePath", "class"],
  36387. referencedClasses: []
  36388. }),
  36389. globals.FileServer);
  36390. smalltalk.addMethod(
  36391. smalltalk.method({
  36392. selector: "basePath:",
  36393. protocol: 'accessing',
  36394. fn: function (aString){
  36395. var self=this;
  36396. return smalltalk.withContext(function($ctx1) {
  36397. self["@basePath"]=aString;
  36398. self._validateBasePath();
  36399. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},globals.FileServer)})},
  36400. args: ["aString"],
  36401. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  36402. messageSends: ["validateBasePath"],
  36403. referencedClasses: []
  36404. }),
  36405. globals.FileServer);
  36406. smalltalk.addMethod(
  36407. smalltalk.method({
  36408. selector: "checkDirectoryLayout",
  36409. protocol: 'initialization',
  36410. fn: function (){
  36411. var self=this;
  36412. return smalltalk.withContext(function($ctx1) {
  36413. var $1;
  36414. $1=_st(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  36415. if(! smalltalk.assert($1)){
  36416. _st(console)._warn_("Warning: project directory does not contain index.html.");
  36417. $ctx1.sendIdx["warn:"]=1;
  36418. _st(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  36419. $ctx1.sendIdx["warn:"]=2;
  36420. _st(console)._warn_(" You can also specify a page to be served by default,");
  36421. $ctx1.sendIdx["warn:"]=3;
  36422. _st(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  36423. };
  36424. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},globals.FileServer)})},
  36425. args: [],
  36426. 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.'].",
  36427. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"],
  36428. referencedClasses: []
  36429. }),
  36430. globals.FileServer);
  36431. smalltalk.addMethod(
  36432. smalltalk.method({
  36433. selector: "fallbackPage",
  36434. protocol: 'accessing',
  36435. fn: function (){
  36436. var self=this;
  36437. var $1;
  36438. $1=self["@fallbackPage"];
  36439. return $1;
  36440. },
  36441. args: [],
  36442. source: "fallbackPage\x0a\x09^fallbackPage",
  36443. messageSends: [],
  36444. referencedClasses: []
  36445. }),
  36446. globals.FileServer);
  36447. smalltalk.addMethod(
  36448. smalltalk.method({
  36449. selector: "fallbackPage:",
  36450. protocol: 'accessing',
  36451. fn: function (aString){
  36452. var self=this;
  36453. self["@fallbackPage"]=aString;
  36454. return self},
  36455. args: ["aString"],
  36456. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  36457. messageSends: [],
  36458. referencedClasses: []
  36459. }),
  36460. globals.FileServer);
  36461. smalltalk.addMethod(
  36462. smalltalk.method({
  36463. selector: "handleGETRequest:respondTo:",
  36464. protocol: 'request handling',
  36465. fn: function (aRequest,aResponse){
  36466. var self=this;
  36467. var uri,filename;
  36468. return smalltalk.withContext(function($ctx1) {
  36469. var $1;
  36470. uri=_st(self["@url"])._parse_(_st(aRequest)._url());
  36471. filename=_st(self["@path"])._join_with_(self._basePath(),_st(uri)._pathname());
  36472. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  36473. return smalltalk.withContext(function($ctx2) {
  36474. if(smalltalk.assert(aBoolean)){
  36475. $1=_st(_st(self["@fs"])._statSync_(filename))._isDirectory();
  36476. if(smalltalk.assert($1)){
  36477. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  36478. } else {
  36479. return self._respondFileNamed_to_(filename,aResponse);
  36480. };
  36481. } else {
  36482. return self._respondNotFoundTo_(aResponse);
  36483. };
  36484. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)})}));
  36485. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},globals.FileServer)})},
  36486. args: ["aRequest", "aResponse"],
  36487. 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]]]",
  36488. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"],
  36489. referencedClasses: []
  36490. }),
  36491. globals.FileServer);
  36492. smalltalk.addMethod(
  36493. smalltalk.method({
  36494. selector: "handleOPTIONSRequest:respondTo:",
  36495. protocol: 'request handling',
  36496. fn: function (aRequest,aResponse){
  36497. var self=this;
  36498. return smalltalk.withContext(function($ctx1) {
  36499. _st(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)]));
  36500. _st(aResponse)._end();
  36501. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)})},
  36502. args: ["aRequest", "aResponse"],
  36503. 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",
  36504. messageSends: ["writeHead:options:", "end"],
  36505. referencedClasses: []
  36506. }),
  36507. globals.FileServer);
  36508. smalltalk.addMethod(
  36509. smalltalk.method({
  36510. selector: "handlePUTRequest:respondTo:",
  36511. protocol: 'request handling',
  36512. fn: function (aRequest,aResponse){
  36513. var self=this;
  36514. var file,stream;
  36515. return smalltalk.withContext(function($ctx1) {
  36516. var $1,$2,$3,$4;
  36517. $1=self._isAuthenticated_(aRequest);
  36518. if(! smalltalk.assert($1)){
  36519. self._respondAuthenticationRequiredTo_(aResponse);
  36520. return nil;
  36521. };
  36522. file=".".__comma(_st(aRequest)._url());
  36523. $ctx1.sendIdx[","]=1;
  36524. stream=_st(self["@fs"])._createWriteStream_(file);
  36525. _st(stream)._on_do_("error",(function(error){
  36526. return smalltalk.withContext(function($ctx2) {
  36527. $2=console;
  36528. $3="Error creating WriteStream for file ".__comma(file);
  36529. $ctx2.sendIdx[","]=2;
  36530. _st($2)._warn_($3);
  36531. $ctx2.sendIdx["warn:"]=1;
  36532. _st(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  36533. $ctx2.sendIdx["warn:"]=2;
  36534. _st(console)._warn_(" The exact error is: ".__comma(error));
  36535. return self._respondNotCreatedTo_(aResponse);
  36536. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  36537. $ctx1.sendIdx["on:do:"]=1;
  36538. _st(stream)._on_do_("close",(function(){
  36539. return smalltalk.withContext(function($ctx2) {
  36540. return self._respondCreatedTo_(aResponse);
  36541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  36542. $ctx1.sendIdx["on:do:"]=2;
  36543. _st(aRequest)._setEncoding_("utf8");
  36544. _st(aRequest)._on_do_("data",(function(data){
  36545. return smalltalk.withContext(function($ctx2) {
  36546. return _st(stream)._write_(data);
  36547. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)})}));
  36548. $ctx1.sendIdx["on:do:"]=3;
  36549. _st(aRequest)._on_do_("end",(function(){
  36550. return smalltalk.withContext(function($ctx2) {
  36551. $4=_st(stream)._writable();
  36552. if(smalltalk.assert($4)){
  36553. return _st(stream)._end();
  36554. };
  36555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  36556. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},globals.FileServer)})},
  36557. args: ["aRequest", "aResponse"],
  36558. 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]]",
  36559. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"],
  36560. referencedClasses: []
  36561. }),
  36562. globals.FileServer);
  36563. smalltalk.addMethod(
  36564. smalltalk.method({
  36565. selector: "handleRequest:respondTo:",
  36566. protocol: 'request handling',
  36567. fn: function (aRequest,aResponse){
  36568. var self=this;
  36569. return smalltalk.withContext(function($ctx1) {
  36570. var $2,$1,$4,$3,$5;
  36571. $2=_st(aRequest)._method();
  36572. $ctx1.sendIdx["method"]=1;
  36573. $1=_st($2).__eq("PUT");
  36574. $ctx1.sendIdx["="]=1;
  36575. if(smalltalk.assert($1)){
  36576. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  36577. };
  36578. $4=_st(aRequest)._method();
  36579. $ctx1.sendIdx["method"]=2;
  36580. $3=_st($4).__eq("GET");
  36581. $ctx1.sendIdx["="]=2;
  36582. if(smalltalk.assert($3)){
  36583. self._handleGETRequest_respondTo_(aRequest,aResponse);
  36584. };
  36585. $5=_st(_st(aRequest)._method()).__eq("OPTIONS");
  36586. if(smalltalk.assert($5)){
  36587. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  36588. };
  36589. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)})},
  36590. args: ["aRequest", "aResponse"],
  36591. 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]",
  36592. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  36593. referencedClasses: []
  36594. }),
  36595. globals.FileServer);
  36596. smalltalk.addMethod(
  36597. smalltalk.method({
  36598. selector: "host",
  36599. protocol: 'accessing',
  36600. fn: function (){
  36601. var self=this;
  36602. var $1;
  36603. $1=self["@host"];
  36604. return $1;
  36605. },
  36606. args: [],
  36607. source: "host\x0a\x09^host",
  36608. messageSends: [],
  36609. referencedClasses: []
  36610. }),
  36611. globals.FileServer);
  36612. smalltalk.addMethod(
  36613. smalltalk.method({
  36614. selector: "host:",
  36615. protocol: 'accessing',
  36616. fn: function (hostname){
  36617. var self=this;
  36618. self["@host"]=hostname;
  36619. return self},
  36620. args: ["hostname"],
  36621. source: "host: hostname\x0a\x09host := hostname",
  36622. messageSends: [],
  36623. referencedClasses: []
  36624. }),
  36625. globals.FileServer);
  36626. smalltalk.addMethod(
  36627. smalltalk.method({
  36628. selector: "initialize",
  36629. protocol: 'initialization',
  36630. fn: function (){
  36631. var self=this;
  36632. return smalltalk.withContext(function($ctx1) {
  36633. var $1;
  36634. globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []);
  36635. self["@path"]=self._require_("path");
  36636. $ctx1.sendIdx["require:"]=1;
  36637. self["@http"]=self._require_("http");
  36638. $ctx1.sendIdx["require:"]=2;
  36639. self["@fs"]=self._require_("fs");
  36640. $ctx1.sendIdx["require:"]=3;
  36641. self["@util"]=self._require_("util");
  36642. $ctx1.sendIdx["require:"]=4;
  36643. self["@url"]=self._require_("url");
  36644. $1=self._class();
  36645. $ctx1.sendIdx["class"]=1;
  36646. self["@host"]=_st($1)._defaultHost();
  36647. self["@port"]=_st(self._class())._defaultPort();
  36648. self["@username"]=nil;
  36649. self["@password"]=nil;
  36650. self["@fallbackPage"]=nil;
  36651. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.FileServer)})},
  36652. args: [],
  36653. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\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.",
  36654. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  36655. referencedClasses: []
  36656. }),
  36657. globals.FileServer);
  36658. smalltalk.addMethod(
  36659. smalltalk.method({
  36660. selector: "isAuthenticated:",
  36661. protocol: 'private',
  36662. fn: function (aRequest){
  36663. var self=this;
  36664. var header,token,auth,parts;
  36665. return smalltalk.withContext(function($ctx1) {
  36666. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7;
  36667. $2=_st(self["@username"])._isNil();
  36668. $ctx1.sendIdx["isNil"]=1;
  36669. $1=_st($2)._and_((function(){
  36670. return smalltalk.withContext(function($ctx2) {
  36671. return _st(self["@password"])._isNil();
  36672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  36673. $ctx1.sendIdx["and:"]=1;
  36674. if(smalltalk.assert($1)){
  36675. return true;
  36676. };
  36677. $3=_st(_st(aRequest)._headers())._at_("authorization");
  36678. $ctx1.sendIdx["at:"]=1;
  36679. if(($receiver = $3) == nil || $receiver == null){
  36680. header="";
  36681. } else {
  36682. header=$3;
  36683. };
  36684. $4=_st(header)._isEmpty();
  36685. if(smalltalk.assert($4)){
  36686. return false;
  36687. } else {
  36688. $5=_st(header)._tokenize_(" ");
  36689. $ctx1.sendIdx["tokenize:"]=1;
  36690. if(($receiver = $5) == nil || $receiver == null){
  36691. token="";
  36692. } else {
  36693. token=$5;
  36694. };
  36695. token;
  36696. $6=_st(token)._at_((2));
  36697. $ctx1.sendIdx["at:"]=2;
  36698. auth=self._base64Decode_($6);
  36699. auth;
  36700. parts=_st(auth)._tokenize_(":");
  36701. parts;
  36702. $9=self["@username"];
  36703. $10=_st(parts)._at_((1));
  36704. $ctx1.sendIdx["at:"]=3;
  36705. $8=_st($9).__eq($10);
  36706. $ctx1.sendIdx["="]=1;
  36707. $7=_st($8)._and_((function(){
  36708. return smalltalk.withContext(function($ctx2) {
  36709. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  36710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  36711. if(smalltalk.assert($7)){
  36712. return true;
  36713. } else {
  36714. return false;
  36715. };
  36716. };
  36717. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},globals.FileServer)})},
  36718. args: ["aRequest"],
  36719. 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].",
  36720. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="],
  36721. referencedClasses: []
  36722. }),
  36723. globals.FileServer);
  36724. smalltalk.addMethod(
  36725. smalltalk.method({
  36726. selector: "password:",
  36727. protocol: 'accessing',
  36728. fn: function (aPassword){
  36729. var self=this;
  36730. self["@password"]=aPassword;
  36731. return self},
  36732. args: ["aPassword"],
  36733. source: "password: aPassword\x0a\x09password := aPassword.",
  36734. messageSends: [],
  36735. referencedClasses: []
  36736. }),
  36737. globals.FileServer);
  36738. smalltalk.addMethod(
  36739. smalltalk.method({
  36740. selector: "port",
  36741. protocol: 'accessing',
  36742. fn: function (){
  36743. var self=this;
  36744. var $1;
  36745. $1=self["@port"];
  36746. return $1;
  36747. },
  36748. args: [],
  36749. source: "port\x0a\x09^port",
  36750. messageSends: [],
  36751. referencedClasses: []
  36752. }),
  36753. globals.FileServer);
  36754. smalltalk.addMethod(
  36755. smalltalk.method({
  36756. selector: "port:",
  36757. protocol: 'accessing',
  36758. fn: function (aNumber){
  36759. var self=this;
  36760. self["@port"]=aNumber;
  36761. return self},
  36762. args: ["aNumber"],
  36763. source: "port: aNumber\x0a\x09port := aNumber",
  36764. messageSends: [],
  36765. referencedClasses: []
  36766. }),
  36767. globals.FileServer);
  36768. smalltalk.addMethod(
  36769. smalltalk.method({
  36770. selector: "require:",
  36771. protocol: 'private',
  36772. fn: function (aModuleString){
  36773. var self=this;
  36774. return smalltalk.withContext(function($ctx1) {
  36775. var $1;
  36776. $1=_st(require)._value_(aModuleString);
  36777. return $1;
  36778. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},globals.FileServer)})},
  36779. args: ["aModuleString"],
  36780. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  36781. messageSends: ["value:"],
  36782. referencedClasses: []
  36783. }),
  36784. globals.FileServer);
  36785. smalltalk.addMethod(
  36786. smalltalk.method({
  36787. selector: "respondAuthenticationRequiredTo:",
  36788. protocol: 'request handling',
  36789. fn: function (aResponse){
  36790. var self=this;
  36791. return smalltalk.withContext(function($ctx1) {
  36792. var $1;
  36793. _st(aResponse)._writeHead_options_((401),globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  36794. _st(aResponse)._write_("<html><body>Authentication needed</body></html>");
  36795. $1=_st(aResponse)._end();
  36796. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},globals.FileServer)})},
  36797. args: ["aResponse"],
  36798. 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.",
  36799. messageSends: ["writeHead:options:", "write:", "end"],
  36800. referencedClasses: []
  36801. }),
  36802. globals.FileServer);
  36803. smalltalk.addMethod(
  36804. smalltalk.method({
  36805. selector: "respondCreatedTo:",
  36806. protocol: 'request handling',
  36807. fn: function (aResponse){
  36808. var self=this;
  36809. return smalltalk.withContext(function($ctx1) {
  36810. var $1;
  36811. _st(aResponse)._writeHead_options_((201),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  36812. $1=_st(aResponse)._end();
  36813. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},globals.FileServer)})},
  36814. args: ["aResponse"],
  36815. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  36816. messageSends: ["writeHead:options:", "end"],
  36817. referencedClasses: []
  36818. }),
  36819. globals.FileServer);
  36820. smalltalk.addMethod(
  36821. smalltalk.method({
  36822. selector: "respondDirectoryNamed:from:to:",
  36823. protocol: 'request handling',
  36824. fn: function (aDirname,aUrl,aResponse){
  36825. var self=this;
  36826. return smalltalk.withContext(function($ctx1) {
  36827. var $2,$1,$3,$5,$7,$6,$4;
  36828. $2=_st(aUrl)._pathname();
  36829. $ctx1.sendIdx["pathname"]=1;
  36830. $1=_st($2)._endsWith_("/");
  36831. if(smalltalk.assert($1)){
  36832. $3=_st(aDirname).__comma("index.html");
  36833. $ctx1.sendIdx[","]=1;
  36834. self._respondFileNamed_to_($3,aResponse);
  36835. } else {
  36836. $5=_st(_st(aUrl)._pathname()).__comma("/");
  36837. $7=_st(aUrl)._search();
  36838. if(($receiver = $7) == nil || $receiver == null){
  36839. $6="";
  36840. } else {
  36841. $6=$7;
  36842. };
  36843. $4=_st($5).__comma($6);
  36844. $ctx1.sendIdx[","]=2;
  36845. self._respondRedirect_to_($4,aResponse);
  36846. };
  36847. return self}, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},globals.FileServer)})},
  36848. args: ["aDirname", "aUrl", "aResponse"],
  36849. 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]",
  36850. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"],
  36851. referencedClasses: []
  36852. }),
  36853. globals.FileServer);
  36854. smalltalk.addMethod(
  36855. smalltalk.method({
  36856. selector: "respondFileNamed:to:",
  36857. protocol: 'request handling',
  36858. fn: function (aFilename,aResponse){
  36859. var self=this;
  36860. var type,filename;
  36861. return smalltalk.withContext(function($ctx1) {
  36862. var $1,$2,$3,$4,$5;
  36863. filename=aFilename;
  36864. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  36865. return smalltalk.withContext(function($ctx2) {
  36866. $1=_st(ex)._notNil();
  36867. if(smalltalk.assert($1)){
  36868. $2=console;
  36869. $3=_st(filename).__comma(" does not exist");
  36870. $ctx2.sendIdx[","]=1;
  36871. _st($2)._log_($3);
  36872. return self._respondNotFoundTo_(aResponse);
  36873. } else {
  36874. type=_st(self._class())._mimeTypeFor_(filename);
  36875. type;
  36876. $4=_st(type).__eq("application/javascript");
  36877. if(smalltalk.assert($4)){
  36878. type=_st(type).__comma(";charset=utf-8");
  36879. type;
  36880. };
  36881. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  36882. _st(aResponse)._write_encoding_(file,"binary");
  36883. $5=_st(aResponse)._end();
  36884. return $5;
  36885. };
  36886. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)})}));
  36887. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},globals.FileServer)})},
  36888. args: ["aFilename", "aResponse"],
  36889. 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]]",
  36890. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"],
  36891. referencedClasses: []
  36892. }),
  36893. globals.FileServer);
  36894. smalltalk.addMethod(
  36895. smalltalk.method({
  36896. selector: "respondInternalErrorTo:",
  36897. protocol: 'request handling',
  36898. fn: function (aResponse){
  36899. var self=this;
  36900. return smalltalk.withContext(function($ctx1) {
  36901. var $1;
  36902. _st(aResponse)._writeHead_options_((500),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  36903. _st(aResponse)._write_("500 Internal server error");
  36904. $1=_st(aResponse)._end();
  36905. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},globals.FileServer)})},
  36906. args: ["aResponse"],
  36907. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  36908. messageSends: ["writeHead:options:", "write:", "end"],
  36909. referencedClasses: []
  36910. }),
  36911. globals.FileServer);
  36912. smalltalk.addMethod(
  36913. smalltalk.method({
  36914. selector: "respondNotCreatedTo:",
  36915. protocol: 'request handling',
  36916. fn: function (aResponse){
  36917. var self=this;
  36918. return smalltalk.withContext(function($ctx1) {
  36919. var $1;
  36920. _st(aResponse)._writeHead_options_((400),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  36921. _st(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  36922. $1=_st(aResponse)._end();
  36923. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},globals.FileServer)})},
  36924. args: ["aResponse"],
  36925. 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.",
  36926. messageSends: ["writeHead:options:", "write:", "end"],
  36927. referencedClasses: []
  36928. }),
  36929. globals.FileServer);
  36930. smalltalk.addMethod(
  36931. smalltalk.method({
  36932. selector: "respondNotFoundTo:",
  36933. protocol: 'request handling',
  36934. fn: function (aResponse){
  36935. var self=this;
  36936. return smalltalk.withContext(function($ctx1) {
  36937. var $2,$1,$3,$4;
  36938. $2=self._fallbackPage();
  36939. $ctx1.sendIdx["fallbackPage"]=1;
  36940. $1=_st($2)._isNil();
  36941. if(! smalltalk.assert($1)){
  36942. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  36943. return $3;
  36944. };
  36945. _st(aResponse)._writeHead_options_((404),globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  36946. _st(aResponse)._write_("<html><body><p>404 Not found</p>");
  36947. $ctx1.sendIdx["write:"]=1;
  36948. _st(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>");
  36949. $ctx1.sendIdx["write:"]=2;
  36950. _st(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  36951. $ctx1.sendIdx["write:"]=3;
  36952. _st(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>");
  36953. $ctx1.sendIdx["write:"]=4;
  36954. _st(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  36955. $ctx1.sendIdx["write:"]=5;
  36956. _st(aResponse)._write_("</ul></p></body></html>");
  36957. $4=_st(aResponse)._end();
  36958. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},globals.FileServer)})},
  36959. args: ["aResponse"],
  36960. 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",
  36961. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"],
  36962. referencedClasses: []
  36963. }),
  36964. globals.FileServer);
  36965. smalltalk.addMethod(
  36966. smalltalk.method({
  36967. selector: "respondOKTo:",
  36968. protocol: 'request handling',
  36969. fn: function (aResponse){
  36970. var self=this;
  36971. return smalltalk.withContext(function($ctx1) {
  36972. var $1;
  36973. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  36974. $1=_st(aResponse)._end();
  36975. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},globals.FileServer)})},
  36976. args: ["aResponse"],
  36977. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  36978. messageSends: ["writeHead:options:", "end"],
  36979. referencedClasses: []
  36980. }),
  36981. globals.FileServer);
  36982. smalltalk.addMethod(
  36983. smalltalk.method({
  36984. selector: "respondRedirect:to:",
  36985. protocol: 'request handling',
  36986. fn: function (aString,aResponse){
  36987. var self=this;
  36988. return smalltalk.withContext(function($ctx1) {
  36989. var $1;
  36990. _st(aResponse)._writeHead_options_((303),globals.HashedCollection._newFromPairs_(["Location",aString]));
  36991. $1=_st(aResponse)._end();
  36992. return self}, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},globals.FileServer)})},
  36993. args: ["aString", "aResponse"],
  36994. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  36995. messageSends: ["writeHead:options:", "end"],
  36996. referencedClasses: []
  36997. }),
  36998. globals.FileServer);
  36999. smalltalk.addMethod(
  37000. smalltalk.method({
  37001. selector: "start",
  37002. protocol: 'starting',
  37003. fn: function (){
  37004. var self=this;
  37005. return smalltalk.withContext(function($ctx1) {
  37006. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  37007. self._checkDirectoryLayout();
  37008. $1=_st(self["@http"])._createServer_((function(request,response){
  37009. return smalltalk.withContext(function($ctx2) {
  37010. return self._handleRequest_respondTo_(request,response);
  37011. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)})}));
  37012. _st($1)._on_do_("error",(function(error){
  37013. return smalltalk.withContext(function($ctx2) {
  37014. $2=console;
  37015. $3="Error starting server: ".__comma(error);
  37016. $ctx2.sendIdx[","]=1;
  37017. return _st($2)._log_($3);
  37018. $ctx2.sendIdx["log:"]=1;
  37019. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  37020. $ctx1.sendIdx["on:do:"]=1;
  37021. _st($1)._on_do_("listening",(function(){
  37022. return smalltalk.withContext(function($ctx2) {
  37023. $4=console;
  37024. $8=self._host();
  37025. $ctx2.sendIdx["host"]=1;
  37026. $7="Starting file server on http://".__comma($8);
  37027. $6=_st($7).__comma(":");
  37028. $ctx2.sendIdx[","]=3;
  37029. $10=self._port();
  37030. $ctx2.sendIdx["port"]=1;
  37031. $9=_st($10)._asString();
  37032. $5=_st($6).__comma($9);
  37033. $ctx2.sendIdx[","]=2;
  37034. return _st($4)._log_($5);
  37035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  37036. $11=_st($1)._listen_host_(self._port(),self._host());
  37037. return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.FileServer)})},
  37038. args: [],
  37039. 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.",
  37040. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"],
  37041. referencedClasses: []
  37042. }),
  37043. globals.FileServer);
  37044. smalltalk.addMethod(
  37045. smalltalk.method({
  37046. selector: "startOn:",
  37047. protocol: 'starting',
  37048. fn: function (aPort){
  37049. var self=this;
  37050. return smalltalk.withContext(function($ctx1) {
  37051. self._port_(aPort);
  37052. self._start();
  37053. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},globals.FileServer)})},
  37054. args: ["aPort"],
  37055. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  37056. messageSends: ["port:", "start"],
  37057. referencedClasses: []
  37058. }),
  37059. globals.FileServer);
  37060. smalltalk.addMethod(
  37061. smalltalk.method({
  37062. selector: "username:",
  37063. protocol: 'accessing',
  37064. fn: function (aUsername){
  37065. var self=this;
  37066. self["@username"]=aUsername;
  37067. return self},
  37068. args: ["aUsername"],
  37069. source: "username: aUsername\x0a\x09username := aUsername.",
  37070. messageSends: [],
  37071. referencedClasses: []
  37072. }),
  37073. globals.FileServer);
  37074. smalltalk.addMethod(
  37075. smalltalk.method({
  37076. selector: "validateBasePath",
  37077. protocol: 'private',
  37078. fn: function (){
  37079. var self=this;
  37080. return smalltalk.withContext(function($ctx1) {
  37081. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  37082. $1=self["@fs"];
  37083. $2=self._basePath();
  37084. $ctx1.sendIdx["basePath"]=1;
  37085. _st($1)._stat_then_($2,(function(err,stat){
  37086. return smalltalk.withContext(function($ctx2) {
  37087. if(($receiver = err) == nil || $receiver == null){
  37088. $3=_st(stat)._isDirectory();
  37089. if(! smalltalk.assert($3)){
  37090. $4=console;
  37091. $7=self._basePath();
  37092. $ctx2.sendIdx["basePath"]=2;
  37093. $6="Warning: --base-path parameter ".__comma($7);
  37094. $ctx2.sendIdx[","]=2;
  37095. $5=_st($6).__comma(" is not a directory.");
  37096. $ctx2.sendIdx[","]=1;
  37097. return _st($4)._warn_($5);
  37098. $ctx2.sendIdx["warn:"]=1;
  37099. };
  37100. } else {
  37101. $8=console;
  37102. $9=_st("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  37103. $ctx2.sendIdx[","]=3;
  37104. return _st($8)._warn_($9);
  37105. };
  37106. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)})}));
  37107. return self}, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},globals.FileServer)})},
  37108. args: [],
  37109. 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.' ]].",
  37110. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","],
  37111. referencedClasses: []
  37112. }),
  37113. globals.FileServer);
  37114. smalltalk.addMethod(
  37115. smalltalk.method({
  37116. selector: "withBasePath:",
  37117. protocol: 'private',
  37118. fn: function (aBaseRelativePath){
  37119. var self=this;
  37120. return smalltalk.withContext(function($ctx1) {
  37121. var $1;
  37122. $1=_st(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  37123. return $1;
  37124. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},globals.FileServer)})},
  37125. args: ["aBaseRelativePath"],
  37126. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^\x09path join: self basePath with: aBaseRelativePath",
  37127. messageSends: ["join:with:", "basePath"],
  37128. referencedClasses: []
  37129. }),
  37130. globals.FileServer);
  37131. smalltalk.addMethod(
  37132. smalltalk.method({
  37133. selector: "writeData:toFileNamed:",
  37134. protocol: 'private',
  37135. fn: function (data,aFilename){
  37136. var self=this;
  37137. return smalltalk.withContext(function($ctx1) {
  37138. _st(console)._log_(aFilename);
  37139. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},globals.FileServer)})},
  37140. args: ["data", "aFilename"],
  37141. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  37142. messageSends: ["log:"],
  37143. referencedClasses: []
  37144. }),
  37145. globals.FileServer);
  37146. globals.FileServer.klass.iVarNames = ['mimeTypes'];
  37147. smalltalk.addMethod(
  37148. smalltalk.method({
  37149. selector: "commandLineSwitches",
  37150. protocol: 'accessing',
  37151. fn: function (){
  37152. var self=this;
  37153. var switches;
  37154. return smalltalk.withContext(function($ctx1) {
  37155. var $1;
  37156. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  37157. return smalltalk.withContext(function($ctx2) {
  37158. return _st(each)._selector();
  37159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  37160. $ctx1.sendIdx["collect:"]=1;
  37161. switches=_st(switches)._select_((function(each){
  37162. return smalltalk.withContext(function($ctx2) {
  37163. return _st(each)._match_("^[^:]*:$");
  37164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  37165. switches=_st(switches)._collect_((function(each){
  37166. return smalltalk.withContext(function($ctx2) {
  37167. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  37168. $ctx2.sendIdx["replace:with:"]=1;
  37169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  37170. $1=switches;
  37171. return $1;
  37172. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.FileServer.klass)})},
  37173. args: [],
  37174. 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",
  37175. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  37176. referencedClasses: []
  37177. }),
  37178. globals.FileServer.klass);
  37179. smalltalk.addMethod(
  37180. smalltalk.method({
  37181. selector: "createServerWithArguments:",
  37182. protocol: 'initialization',
  37183. fn: function (options){
  37184. var self=this;
  37185. var server,popFront,front,optionName,optionValue,switches;
  37186. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  37187. return smalltalk.withContext(function($ctx1) {
  37188. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  37189. var $early={};
  37190. try {
  37191. switches=self._commandLineSwitches();
  37192. server=self._new();
  37193. _st(options)._ifEmpty_((function(){
  37194. $1=server;
  37195. throw $early=[$1];
  37196. }));
  37197. $2=_st(_st(options)._size())._even();
  37198. if(! smalltalk.assert($2)){
  37199. _st(console)._log_("Using default parameters.");
  37200. $ctx1.sendIdx["log:"]=1;
  37201. $3=console;
  37202. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  37203. $ctx1.sendIdx[","]=1;
  37204. _st($3)._log_($4);
  37205. $ctx1.sendIdx["log:"]=2;
  37206. $5=console;
  37207. $6="Use any of the following ones: ".__comma(switches);
  37208. $ctx1.sendIdx[","]=2;
  37209. _st($5)._log_($6);
  37210. $ctx1.sendIdx["log:"]=3;
  37211. $7=server;
  37212. return $7;
  37213. };
  37214. popFront=(function(args){
  37215. return smalltalk.withContext(function($ctx2) {
  37216. front=_st(args)._first();
  37217. front;
  37218. _st(args)._remove_(front);
  37219. return front;
  37220. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)})});
  37221. _st((function(){
  37222. return smalltalk.withContext(function($ctx2) {
  37223. return _st(options)._notEmpty();
  37224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
  37225. return smalltalk.withContext(function($ctx2) {
  37226. optionName=_st(popFront)._value_(options);
  37227. $ctx2.sendIdx["value:"]=1;
  37228. optionName;
  37229. optionValue=_st(popFront)._value_(options);
  37230. optionValue;
  37231. $8=_st(switches)._includes_(optionName);
  37232. if(smalltalk.assert($8)){
  37233. optionName=self._selectorForCommandLineSwitch_(optionName);
  37234. optionName;
  37235. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  37236. } else {
  37237. $9=console;
  37238. $10=_st(optionName).__comma(" is not a valid commandline option");
  37239. $ctx2.sendIdx[","]=3;
  37240. _st($9)._log_($10);
  37241. $ctx2.sendIdx["log:"]=4;
  37242. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  37243. };
  37244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  37245. $11=server;
  37246. return $11;
  37247. }
  37248. catch(e) {if(e===$early)return e[0]; throw e}
  37249. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},globals.FileServer.klass)})},
  37250. args: ["options"],
  37251. 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.",
  37252. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"],
  37253. referencedClasses: ["Array"]
  37254. }),
  37255. globals.FileServer.klass);
  37256. smalltalk.addMethod(
  37257. smalltalk.method({
  37258. selector: "defaultBasePath",
  37259. protocol: 'accessing',
  37260. fn: function (){
  37261. var self=this;
  37262. return "./";
  37263. },
  37264. args: [],
  37265. source: "defaultBasePath\x0a\x09^ './'",
  37266. messageSends: [],
  37267. referencedClasses: []
  37268. }),
  37269. globals.FileServer.klass);
  37270. smalltalk.addMethod(
  37271. smalltalk.method({
  37272. selector: "defaultHost",
  37273. protocol: 'accessing',
  37274. fn: function (){
  37275. var self=this;
  37276. return "127.0.0.1";
  37277. },
  37278. args: [],
  37279. source: "defaultHost\x0a\x09^'127.0.0.1'",
  37280. messageSends: [],
  37281. referencedClasses: []
  37282. }),
  37283. globals.FileServer.klass);
  37284. smalltalk.addMethod(
  37285. smalltalk.method({
  37286. selector: "defaultMimeTypes",
  37287. protocol: 'accessing',
  37288. fn: function (){
  37289. var self=this;
  37290. var $1;
  37291. $1=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"]);
  37292. return $1;
  37293. },
  37294. args: [],
  37295. 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}",
  37296. messageSends: [],
  37297. referencedClasses: []
  37298. }),
  37299. globals.FileServer.klass);
  37300. smalltalk.addMethod(
  37301. smalltalk.method({
  37302. selector: "defaultPort",
  37303. protocol: 'accessing',
  37304. fn: function (){
  37305. var self=this;
  37306. return (4000);
  37307. },
  37308. args: [],
  37309. source: "defaultPort\x0a\x09^4000",
  37310. messageSends: [],
  37311. referencedClasses: []
  37312. }),
  37313. globals.FileServer.klass);
  37314. smalltalk.addMethod(
  37315. smalltalk.method({
  37316. selector: "main",
  37317. protocol: 'initialization',
  37318. fn: function (){
  37319. var self=this;
  37320. var fileServer,args;
  37321. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  37322. return smalltalk.withContext(function($ctx1) {
  37323. var $1,$2;
  37324. var $early={};
  37325. try {
  37326. args=_st(process)._argv();
  37327. _st(args)._removeFrom_to_((1),(3));
  37328. _st(args)._detect_ifNone_((function(each){
  37329. return smalltalk.withContext(function($ctx2) {
  37330. $1=_st(each).__eq("--help");
  37331. if(smalltalk.assert($1)){
  37332. return _st($FileServer())._printHelp();
  37333. };
  37334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  37335. return smalltalk.withContext(function($ctx2) {
  37336. fileServer=_st($FileServer())._createServerWithArguments_(args);
  37337. fileServer;
  37338. $2=_st(fileServer)._start();
  37339. throw $early=[$2];
  37340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  37341. return self}
  37342. catch(e) {if(e===$early)return e[0]; throw e}
  37343. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},globals.FileServer.klass)})},
  37344. args: [],
  37345. 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]",
  37346. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"],
  37347. referencedClasses: ["FileServer"]
  37348. }),
  37349. globals.FileServer.klass);
  37350. smalltalk.addMethod(
  37351. smalltalk.method({
  37352. selector: "mimeTypeFor:",
  37353. protocol: 'accessing',
  37354. fn: function (aString){
  37355. var self=this;
  37356. return smalltalk.withContext(function($ctx1) {
  37357. var $1;
  37358. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  37359. return "text/plain";
  37360. }));
  37361. return $1;
  37362. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},globals.FileServer.klass)})},
  37363. args: ["aString"],
  37364. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  37365. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  37366. referencedClasses: []
  37367. }),
  37368. globals.FileServer.klass);
  37369. smalltalk.addMethod(
  37370. smalltalk.method({
  37371. selector: "mimeTypes",
  37372. protocol: 'accessing',
  37373. fn: function (){
  37374. var self=this;
  37375. return smalltalk.withContext(function($ctx1) {
  37376. var $2,$1;
  37377. $2=self["@mimeTypes"];
  37378. if(($receiver = $2) == nil || $receiver == null){
  37379. self["@mimeTypes"]=self._defaultMimeTypes();
  37380. $1=self["@mimeTypes"];
  37381. } else {
  37382. $1=$2;
  37383. };
  37384. return $1;
  37385. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},globals.FileServer.klass)})},
  37386. args: [],
  37387. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  37388. messageSends: ["ifNil:", "defaultMimeTypes"],
  37389. referencedClasses: []
  37390. }),
  37391. globals.FileServer.klass);
  37392. smalltalk.addMethod(
  37393. smalltalk.method({
  37394. selector: "printHelp",
  37395. protocol: 'accessing',
  37396. fn: function (){
  37397. var self=this;
  37398. return smalltalk.withContext(function($ctx1) {
  37399. _st(console)._log_("Available commandline options are:");
  37400. $ctx1.sendIdx["log:"]=1;
  37401. _st(console)._log_("--help");
  37402. $ctx1.sendIdx["log:"]=2;
  37403. _st(self._commandLineSwitches())._do_((function(each){
  37404. return smalltalk.withContext(function($ctx2) {
  37405. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  37406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  37407. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},globals.FileServer.klass)})},
  37408. args: [],
  37409. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  37410. messageSends: ["log:", "do:", "commandLineSwitches", ","],
  37411. referencedClasses: []
  37412. }),
  37413. globals.FileServer.klass);
  37414. smalltalk.addMethod(
  37415. smalltalk.method({
  37416. selector: "selectorForCommandLineSwitch:",
  37417. protocol: 'accessing',
  37418. fn: function (aSwitch){
  37419. var self=this;
  37420. return smalltalk.withContext(function($ctx1) {
  37421. var $2,$1;
  37422. $2=_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  37423. return smalltalk.withContext(function($ctx2) {
  37424. return _st(_st(each)._second())._asUppercase();
  37425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  37426. $ctx1.sendIdx["replace:with:"]=1;
  37427. $1=_st($2).__comma(":");
  37428. return $1;
  37429. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},globals.FileServer.klass)})},
  37430. args: ["aSwitch"],
  37431. 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 ]), ':'",
  37432. messageSends: [",", "replace:with:", "asUppercase", "second"],
  37433. referencedClasses: []
  37434. }),
  37435. globals.FileServer.klass);
  37436. smalltalk.addClass('Repl', globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  37437. 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.";
  37438. smalltalk.addMethod(
  37439. smalltalk.method({
  37440. selector: "addVariableNamed:to:",
  37441. protocol: 'private',
  37442. fn: function (aString,anObject){
  37443. var self=this;
  37444. var newClass,newObject;
  37445. return smalltalk.withContext(function($ctx1) {
  37446. var $1;
  37447. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  37448. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  37449. newObject=_st(newClass)._new();
  37450. self._setPreviousVariablesFor_from_(newObject,anObject);
  37451. $1=newObject;
  37452. return $1;
  37453. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},globals.Repl)})},
  37454. args: ["aString", "anObject"],
  37455. 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",
  37456. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"],
  37457. referencedClasses: []
  37458. }),
  37459. globals.Repl);
  37460. smalltalk.addMethod(
  37461. smalltalk.method({
  37462. selector: "assignNewVariable:do:",
  37463. protocol: 'private',
  37464. fn: function (buffer,aBlock){
  37465. var self=this;
  37466. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  37467. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  37468. return smalltalk.withContext(function($ctx1) {
  37469. var $3,$4,$2,$1;
  37470. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  37471. var varName,value;
  37472. return smalltalk.withContext(function($ctx2) {
  37473. if(($receiver = name) == nil || $receiver == null){
  37474. varName=self._nextResultName();
  37475. } else {
  37476. varName=name;
  37477. };
  37478. varName;
  37479. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  37480. self["@session"];
  37481. _st((function(){
  37482. return smalltalk.withContext(function($ctx3) {
  37483. $3=_st(varName).__comma(" := ");
  37484. if(($receiver = expr) == nil || $receiver == null){
  37485. $4=buffer;
  37486. } else {
  37487. $4=expr;
  37488. };
  37489. $2=_st($3).__comma($4);
  37490. $ctx3.sendIdx[","]=1;
  37491. value=self._eval_on_($2,self["@session"]);
  37492. return value;
  37493. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}))._on_do_($Error(),(function(e){
  37494. return smalltalk.withContext(function($ctx3) {
  37495. _st(_st($ErrorHandler())._new())._logError_(e);
  37496. value=nil;
  37497. return value;
  37498. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)})}));
  37499. return _st(aBlock)._value_value_(varName,value);
  37500. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)})}));
  37501. return $1;
  37502. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},globals.Repl)})},
  37503. args: ["buffer", "aBlock"],
  37504. 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 | ErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  37505. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"],
  37506. referencedClasses: ["Error", "ErrorHandler"]
  37507. }),
  37508. globals.Repl);
  37509. smalltalk.addMethod(
  37510. smalltalk.method({
  37511. selector: "clearScreen",
  37512. protocol: 'actions',
  37513. fn: function (){
  37514. var self=this;
  37515. var esc,cls;
  37516. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  37517. return smalltalk.withContext(function($ctx1) {
  37518. var $1;
  37519. esc=_st($String())._fromCharCode_((27));
  37520. $1=_st(_st(esc).__comma("[2J")).__comma(esc);
  37521. $ctx1.sendIdx[","]=2;
  37522. cls=_st($1).__comma("[0;0f");
  37523. $ctx1.sendIdx[","]=1;
  37524. _st(_st(process)._stdout())._write_(cls);
  37525. _st(self["@interface"])._prompt();
  37526. return self}, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},globals.Repl)})},
  37527. args: [],
  37528. 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",
  37529. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"],
  37530. referencedClasses: ["String"]
  37531. }),
  37532. globals.Repl);
  37533. smalltalk.addMethod(
  37534. smalltalk.method({
  37535. selector: "close",
  37536. protocol: 'actions',
  37537. fn: function (){
  37538. var self=this;
  37539. return smalltalk.withContext(function($ctx1) {
  37540. _st(_st(process)._stdin())._destroy();
  37541. return self}, function($ctx1) {$ctx1.fill(self,"close",{},globals.Repl)})},
  37542. args: [],
  37543. source: "close\x0a\x09process stdin destroy",
  37544. messageSends: ["destroy", "stdin"],
  37545. referencedClasses: []
  37546. }),
  37547. globals.Repl);
  37548. smalltalk.addMethod(
  37549. smalltalk.method({
  37550. selector: "commands",
  37551. protocol: 'accessing',
  37552. fn: function (){
  37553. var self=this;
  37554. var $1;
  37555. $1=self["@commands"];
  37556. return $1;
  37557. },
  37558. args: [],
  37559. source: "commands\x0a\x09^ commands",
  37560. messageSends: [],
  37561. referencedClasses: []
  37562. }),
  37563. globals.Repl);
  37564. smalltalk.addMethod(
  37565. smalltalk.method({
  37566. selector: "createInterface",
  37567. protocol: 'actions',
  37568. fn: function (){
  37569. var self=this;
  37570. return smalltalk.withContext(function($ctx1) {
  37571. var $1;
  37572. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  37573. _st(self["@interface"])._on_do_("line",(function(buffer){
  37574. return smalltalk.withContext(function($ctx2) {
  37575. return self._processLine_(buffer);
  37576. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)})}));
  37577. $ctx1.sendIdx["on:do:"]=1;
  37578. _st(self["@interface"])._on_do_("close",(function(){
  37579. return smalltalk.withContext(function($ctx2) {
  37580. return self._close();
  37581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  37582. self._printWelcome();
  37583. self._setupHotkeys();
  37584. $1=self._setPrompt();
  37585. _st(self["@interface"])._prompt();
  37586. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},globals.Repl)})},
  37587. args: [],
  37588. 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",
  37589. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"],
  37590. referencedClasses: []
  37591. }),
  37592. globals.Repl);
  37593. smalltalk.addMethod(
  37594. smalltalk.method({
  37595. selector: "encapsulateVariable:withValue:in:",
  37596. protocol: 'private',
  37597. fn: function (aString,anObject,aClass){
  37598. var self=this;
  37599. var compiler;
  37600. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  37601. return smalltalk.withContext(function($ctx1) {
  37602. var $1,$4,$3,$2,$5,$6;
  37603. compiler=_st($Compiler())._new();
  37604. $1=compiler;
  37605. $4=_st(aString).__comma(": anObject ^ ");
  37606. $ctx1.sendIdx[","]=3;
  37607. $3=_st($4).__comma(aString);
  37608. $ctx1.sendIdx[","]=2;
  37609. $2=_st($3).__comma(" := anObject");
  37610. $ctx1.sendIdx[","]=1;
  37611. _st($1)._install_forClass_category_($2,aClass,"session");
  37612. $ctx1.sendIdx["install:forClass:category:"]=1;
  37613. $5=compiler;
  37614. $6=_st(_st(aString).__comma(" ^ ")).__comma(aString);
  37615. $ctx1.sendIdx[","]=4;
  37616. _st($5)._install_forClass_category_($6,aClass,"session");
  37617. return self}, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},globals.Repl)})},
  37618. args: ["aString", "anObject", "aClass"],
  37619. 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 category: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass category: 'session'.",
  37620. messageSends: ["new", "install:forClass:category:", ","],
  37621. referencedClasses: ["Compiler"]
  37622. }),
  37623. globals.Repl);
  37624. smalltalk.addMethod(
  37625. smalltalk.method({
  37626. selector: "eval:",
  37627. protocol: 'actions',
  37628. fn: function (buffer){
  37629. var self=this;
  37630. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  37631. return smalltalk.withContext(function($ctx1) {
  37632. var $1;
  37633. $1=self._eval_on_(buffer,_st($DoIt())._new());
  37634. return $1;
  37635. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},globals.Repl)})},
  37636. args: ["buffer"],
  37637. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  37638. messageSends: ["eval:on:", "new"],
  37639. referencedClasses: ["DoIt"]
  37640. }),
  37641. globals.Repl);
  37642. smalltalk.addMethod(
  37643. smalltalk.method({
  37644. selector: "eval:on:",
  37645. protocol: 'actions',
  37646. fn: function (buffer,anObject){
  37647. var self=this;
  37648. var result;
  37649. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  37650. return smalltalk.withContext(function($ctx1) {
  37651. var $1,$2,$3;
  37652. $1=_st(buffer)._isEmpty();
  37653. if(! smalltalk.assert($1)){
  37654. self._try_catch_((function(){
  37655. return smalltalk.withContext(function($ctx2) {
  37656. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  37657. return result;
  37658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(e){
  37659. return smalltalk.withContext(function($ctx2) {
  37660. $2=_st(e)._isSmalltalkError();
  37661. if(smalltalk.assert($2)){
  37662. return _st(e)._resignal();
  37663. } else {
  37664. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  37665. };
  37666. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
  37667. };
  37668. $3=result;
  37669. return $3;
  37670. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},globals.Repl)})},
  37671. args: ["buffer", "anObject"],
  37672. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  37673. messageSends: ["ifFalse:", "isEmpty", "try:catch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"],
  37674. referencedClasses: ["Compiler"]
  37675. }),
  37676. globals.Repl);
  37677. smalltalk.addMethod(
  37678. smalltalk.method({
  37679. selector: "executeCommand:",
  37680. protocol: 'private',
  37681. fn: function (aString){
  37682. var self=this;
  37683. return smalltalk.withContext(function($ctx1) {
  37684. var $1;
  37685. var $early={};
  37686. try {
  37687. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  37688. return smalltalk.withContext(function($ctx2) {
  37689. $1=_st(names)._includes_(aString);
  37690. if(smalltalk.assert($1)){
  37691. _st(cmd)._value();
  37692. throw $early=[true];
  37693. };
  37694. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)})}));
  37695. return false;
  37696. }
  37697. catch(e) {if(e===$early)return e[0]; throw e}
  37698. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},globals.Repl)})},
  37699. args: ["aString"],
  37700. 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",
  37701. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"],
  37702. referencedClasses: []
  37703. }),
  37704. globals.Repl);
  37705. smalltalk.addMethod(
  37706. smalltalk.method({
  37707. selector: "initialize",
  37708. protocol: 'initialization',
  37709. fn: function (){
  37710. var self=this;
  37711. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  37712. return smalltalk.withContext(function($ctx1) {
  37713. globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []);
  37714. self["@session"]=_st($DoIt())._new();
  37715. self["@readline"]=_st(require)._value_("readline");
  37716. $ctx1.sendIdx["value:"]=1;
  37717. self["@util"]=_st(require)._value_("util");
  37718. self._setupCommands();
  37719. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Repl)})},
  37720. args: [],
  37721. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  37722. messageSends: ["initialize", "new", "value:", "setupCommands"],
  37723. referencedClasses: ["DoIt"]
  37724. }),
  37725. globals.Repl);
  37726. smalltalk.addMethod(
  37727. smalltalk.method({
  37728. selector: "instanceVariableNamesFor:",
  37729. protocol: 'private',
  37730. fn: function (aClass){
  37731. var self=this;
  37732. return smalltalk.withContext(function($ctx1) {
  37733. var $2,$3,$1;
  37734. $2=_st(aClass)._superclass();
  37735. $ctx1.sendIdx["superclass"]=1;
  37736. if(($receiver = $2) == nil || $receiver == null){
  37737. $1=_st(aClass)._instanceVariableNames();
  37738. } else {
  37739. $3=_st(aClass)._instanceVariableNames();
  37740. $ctx1.sendIdx["instanceVariableNames"]=1;
  37741. $1=_st($3)._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  37742. };
  37743. return $1;
  37744. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},globals.Repl)})},
  37745. args: ["aClass"],
  37746. 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]",
  37747. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"],
  37748. referencedClasses: []
  37749. }),
  37750. globals.Repl);
  37751. smalltalk.addMethod(
  37752. smalltalk.method({
  37753. selector: "isIdentifier:",
  37754. protocol: 'private',
  37755. fn: function (aString){
  37756. var self=this;
  37757. return smalltalk.withContext(function($ctx1) {
  37758. var $1;
  37759. $1=_st(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  37760. return $1;
  37761. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},globals.Repl)})},
  37762. args: ["aString"],
  37763. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  37764. messageSends: ["match:", "asRegexp"],
  37765. referencedClasses: []
  37766. }),
  37767. globals.Repl);
  37768. smalltalk.addMethod(
  37769. smalltalk.method({
  37770. selector: "isVariableDefined:",
  37771. protocol: 'private',
  37772. fn: function (aString){
  37773. var self=this;
  37774. return smalltalk.withContext(function($ctx1) {
  37775. var $1;
  37776. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  37777. return $1;
  37778. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},globals.Repl)})},
  37779. args: ["aString"],
  37780. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  37781. messageSends: ["includes:", "instanceVariableNamesFor:", "class"],
  37782. referencedClasses: []
  37783. }),
  37784. globals.Repl);
  37785. smalltalk.addMethod(
  37786. smalltalk.method({
  37787. selector: "nextResultName",
  37788. protocol: 'private',
  37789. fn: function (){
  37790. var self=this;
  37791. return smalltalk.withContext(function($ctx1) {
  37792. var $1,$2;
  37793. $1=self["@resultCount"];
  37794. if(($receiver = $1) == nil || $receiver == null){
  37795. self["@resultCount"]=(1);
  37796. } else {
  37797. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  37798. };
  37799. $2="res".__comma(_st(self["@resultCount"])._asString());
  37800. return $2;
  37801. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},globals.Repl)})},
  37802. args: [],
  37803. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  37804. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"],
  37805. referencedClasses: []
  37806. }),
  37807. globals.Repl);
  37808. smalltalk.addMethod(
  37809. smalltalk.method({
  37810. selector: "onKeyPress:",
  37811. protocol: 'private',
  37812. fn: function (key){
  37813. var self=this;
  37814. return smalltalk.withContext(function($ctx1) {
  37815. var $1;
  37816. $1=_st(_st(key)._ctrl())._and_((function(){
  37817. return smalltalk.withContext(function($ctx2) {
  37818. return _st(_st(key)._name()).__eq("l");
  37819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  37820. if(smalltalk.assert($1)){
  37821. self._clearScreen();
  37822. };
  37823. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},globals.Repl)})},
  37824. args: ["key"],
  37825. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  37826. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"],
  37827. referencedClasses: []
  37828. }),
  37829. globals.Repl);
  37830. smalltalk.addMethod(
  37831. smalltalk.method({
  37832. selector: "parseAssignment:do:",
  37833. protocol: 'private',
  37834. fn: function (aString,aBlock){
  37835. var self=this;
  37836. var assignment;
  37837. return smalltalk.withContext(function($ctx1) {
  37838. var $3,$2,$1;
  37839. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  37840. return smalltalk.withContext(function($ctx2) {
  37841. return _st(s)._trimBoth();
  37842. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)})}));
  37843. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  37844. return smalltalk.withContext(function($ctx2) {
  37845. $3=_st(assignment)._first();
  37846. $ctx2.sendIdx["first"]=1;
  37847. return self._isIdentifier_($3);
  37848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  37849. if(smalltalk.assert($2)){
  37850. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  37851. $ctx1.sendIdx["value:value:"]=1;
  37852. } else {
  37853. $1=_st(aBlock)._value_value_(nil,nil);
  37854. };
  37855. return $1;
  37856. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},globals.Repl)})},
  37857. args: ["aString", "aBlock"],
  37858. 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 ]",
  37859. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"],
  37860. referencedClasses: []
  37861. }),
  37862. globals.Repl);
  37863. smalltalk.addMethod(
  37864. smalltalk.method({
  37865. selector: "presentResultNamed:withValue:",
  37866. protocol: 'private',
  37867. fn: function (varName,value){
  37868. var self=this;
  37869. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  37870. return smalltalk.withContext(function($ctx1) {
  37871. var $3,$2,$1,$4;
  37872. $3=_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name());
  37873. $ctx1.sendIdx[","]=3;
  37874. $2=_st($3).__comma(" = ");
  37875. $ctx1.sendIdx[","]=2;
  37876. $1=_st($2).__comma(_st(value)._asString());
  37877. $ctx1.sendIdx[","]=1;
  37878. _st($Transcript())._show_($1);
  37879. $4=_st($Transcript())._cr();
  37880. _st(self["@interface"])._prompt();
  37881. return self}, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},globals.Repl)})},
  37882. args: ["varName", "value"],
  37883. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  37884. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"],
  37885. referencedClasses: ["Transcript"]
  37886. }),
  37887. globals.Repl);
  37888. smalltalk.addMethod(
  37889. smalltalk.method({
  37890. selector: "printWelcome",
  37891. protocol: 'actions',
  37892. fn: function (){
  37893. var self=this;
  37894. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  37895. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  37896. return smalltalk.withContext(function($ctx1) {
  37897. var $3,$2,$1,$4;
  37898. $3=_st("Welcome to Amber version ".__comma(_st(_st($Smalltalk())._current())._version())).__comma(" (NodeJS ");
  37899. $ctx1.sendIdx[","]=3;
  37900. $2=_st($3).__comma(_st(_st(process)._versions())._node());
  37901. $ctx1.sendIdx[","]=2;
  37902. $1=_st($2).__comma(").");
  37903. $ctx1.sendIdx[","]=1;
  37904. _st($Transcript())._show_($1);
  37905. $ctx1.sendIdx["show:"]=1;
  37906. _st($Transcript())._show_("Type :q to exit.");
  37907. $4=_st($Transcript())._cr();
  37908. return self}, function($ctx1) {$ctx1.fill(self,"printWelcome",{},globals.Repl)})},
  37909. args: [],
  37910. source: "printWelcome\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  37911. messageSends: ["show:", ",", "version", "current", "node", "versions", "cr"],
  37912. referencedClasses: ["Transcript", "Smalltalk"]
  37913. }),
  37914. globals.Repl);
  37915. smalltalk.addMethod(
  37916. smalltalk.method({
  37917. selector: "processLine:",
  37918. protocol: 'private',
  37919. fn: function (buffer){
  37920. var self=this;
  37921. var show;
  37922. return smalltalk.withContext(function($ctx1) {
  37923. var $1,$2;
  37924. show=(function(varName,value){
  37925. return smalltalk.withContext(function($ctx2) {
  37926. return self._presentResultNamed_withValue_(varName,value);
  37927. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)})});
  37928. $1=self._executeCommand_(buffer);
  37929. if(! smalltalk.assert($1)){
  37930. $2=self._isVariableDefined_(buffer);
  37931. if(smalltalk.assert($2)){
  37932. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  37933. } else {
  37934. self._assignNewVariable_do_(buffer,show);
  37935. };
  37936. };
  37937. return self}, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},globals.Repl)})},
  37938. args: ["buffer"],
  37939. 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]]",
  37940. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"],
  37941. referencedClasses: []
  37942. }),
  37943. globals.Repl);
  37944. smalltalk.addMethod(
  37945. smalltalk.method({
  37946. selector: "prompt",
  37947. protocol: 'accessing',
  37948. fn: function (){
  37949. var self=this;
  37950. return "amber >> ";
  37951. },
  37952. args: [],
  37953. source: "prompt\x0a\x09^'amber >> '",
  37954. messageSends: [],
  37955. referencedClasses: []
  37956. }),
  37957. globals.Repl);
  37958. smalltalk.addMethod(
  37959. smalltalk.method({
  37960. selector: "setPreviousVariablesFor:from:",
  37961. protocol: 'private',
  37962. fn: function (newObject,oldObject){
  37963. var self=this;
  37964. return smalltalk.withContext(function($ctx1) {
  37965. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  37966. return smalltalk.withContext(function($ctx2) {
  37967. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  37968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  37969. return self}, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},globals.Repl)})},
  37970. args: ["newObject", "oldObject"],
  37971. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  37972. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"],
  37973. referencedClasses: []
  37974. }),
  37975. globals.Repl);
  37976. smalltalk.addMethod(
  37977. smalltalk.method({
  37978. selector: "setPrompt",
  37979. protocol: 'actions',
  37980. fn: function (){
  37981. var self=this;
  37982. return smalltalk.withContext(function($ctx1) {
  37983. _st(self["@interface"])._setPrompt_(self._prompt());
  37984. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},globals.Repl)})},
  37985. args: [],
  37986. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  37987. messageSends: ["setPrompt:", "prompt"],
  37988. referencedClasses: []
  37989. }),
  37990. globals.Repl);
  37991. smalltalk.addMethod(
  37992. smalltalk.method({
  37993. selector: "setupCommands",
  37994. protocol: 'initialization',
  37995. fn: function (){
  37996. var self=this;
  37997. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  37998. return smalltalk.withContext(function($ctx1) {
  37999. var $2,$1;
  38000. $2=_st([":q"]).__minus_gt((function(){
  38001. return smalltalk.withContext(function($ctx2) {
  38002. return _st(process)._exit();
  38003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  38004. $ctx1.sendIdx["->"]=1;
  38005. $1=[$2,_st([""]).__minus_gt((function(){
  38006. return smalltalk.withContext(function($ctx2) {
  38007. return _st(self["@interface"])._prompt();
  38008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))];
  38009. self["@commands"]=_st($Dictionary())._from_($1);
  38010. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.Repl)})},
  38011. args: [],
  38012. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  38013. messageSends: ["from:", "->", "exit", "prompt"],
  38014. referencedClasses: ["Dictionary"]
  38015. }),
  38016. globals.Repl);
  38017. smalltalk.addMethod(
  38018. smalltalk.method({
  38019. selector: "setupHotkeys",
  38020. protocol: 'initialization',
  38021. fn: function (){
  38022. var self=this;
  38023. return smalltalk.withContext(function($ctx1) {
  38024. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  38025. return smalltalk.withContext(function($ctx2) {
  38026. if(($receiver = key) == nil || $receiver == null){
  38027. return key;
  38028. } else {
  38029. return self._onKeyPress_(key);
  38030. };
  38031. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)})}));
  38032. return self}, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},globals.Repl)})},
  38033. args: [],
  38034. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  38035. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"],
  38036. referencedClasses: []
  38037. }),
  38038. globals.Repl);
  38039. smalltalk.addMethod(
  38040. smalltalk.method({
  38041. selector: "subclass:withVariable:",
  38042. protocol: 'private',
  38043. fn: function (aClass,varName){
  38044. var self=this;
  38045. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  38046. return smalltalk.withContext(function($ctx1) {
  38047. var $1;
  38048. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  38049. return $1;
  38050. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},globals.Repl)})},
  38051. args: ["aClass", "varName"],
  38052. 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'",
  38053. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"],
  38054. referencedClasses: ["ClassBuilder"]
  38055. }),
  38056. globals.Repl);
  38057. smalltalk.addMethod(
  38058. smalltalk.method({
  38059. selector: "subclassNameFor:",
  38060. protocol: 'private',
  38061. fn: function (aClass){
  38062. var self=this;
  38063. return smalltalk.withContext(function($ctx1) {
  38064. var $3,$2,$7,$6,$5,$4,$8,$1;
  38065. $3=_st(aClass)._name();
  38066. $ctx1.sendIdx["name"]=1;
  38067. $2=_st($3)._matchesOf_("\x5cd+$");
  38068. $ctx1.sendIdx["matchesOf:"]=1;
  38069. if(($receiver = $2) == nil || $receiver == null){
  38070. $1=_st(_st(aClass)._name()).__comma("2");
  38071. } else {
  38072. var counter;
  38073. $7=_st(aClass)._name();
  38074. $ctx1.sendIdx["name"]=2;
  38075. $6=_st($7)._matchesOf_("\x5cd+$");
  38076. $5=_st($6)._first();
  38077. $4=_st($5)._asNumber();
  38078. counter=_st($4).__plus((1));
  38079. counter;
  38080. $8=_st(aClass)._name();
  38081. $ctx1.sendIdx["name"]=3;
  38082. $1=_st($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  38083. };
  38084. return $1;
  38085. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},globals.Repl)})},
  38086. args: ["aClass"],
  38087. 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'].",
  38088. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","],
  38089. referencedClasses: []
  38090. }),
  38091. globals.Repl);
  38092. smalltalk.addMethod(
  38093. smalltalk.method({
  38094. selector: "main",
  38095. protocol: 'initialization',
  38096. fn: function (){
  38097. var self=this;
  38098. return smalltalk.withContext(function($ctx1) {
  38099. _st(self._new())._createInterface();
  38100. return self}, function($ctx1) {$ctx1.fill(self,"main",{},globals.Repl.klass)})},
  38101. args: [],
  38102. source: "main\x0a\x09self new createInterface",
  38103. messageSends: ["createInterface", "new"],
  38104. referencedClasses: []
  38105. }),
  38106. globals.Repl.klass);
  38107. });
  38108. define("amber_vm/_init", ["amber_vm/smalltalk", "amber_vm/globals", "amber_vm/smalltalk","amber_vm/globals","amber_vm/nil","amber_core/Kernel-Objects","amber_core/Kernel-Classes","amber_core/Kernel-Methods","amber_core/Kernel-Collections","amber_core/Kernel-Infrastructure","amber_core/Kernel-Exceptions","amber_core/Kernel-Transcript","amber_core/Kernel-Announcements","amber_core/Compiler-Exceptions","amber_core/Compiler-Core","amber_core/Compiler-AST","amber_core/Compiler-IR","amber_core/Compiler-Inlining","amber_core/Compiler-Semantic","amber_core/Compiler-Interpreter","amber_vm/parser","amber_cli/AmberCli"], function (vm, globals) {
  38109. vm.initialize();
  38110. globals.AmberCli._main();
  38111. });
  38112. requirejs("amber_vm/_init");