1
0

amber-cli.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749
  1. /* ====================================================================
  2. |
  3. | Amber Smalltalk
  4. | http://amber-lang.net
  5. |
  6. ======================================================================
  7. ======================================================================
  8. |
  9. | Copyright (c) 2010-2011
  10. | Nicolas Petton <petton.nicolas@gmail.com>
  11. |
  12. | Amber is released under the MIT license
  13. |
  14. | Permission is hereby granted, free of charge, to any person obtaining
  15. | a copy of this software and associated documentation files (the
  16. | 'Software'), to deal in the Software without restriction, including
  17. | without limitation the rights to use, copy, modify, merge, publish,
  18. | distribute, sublicense, and/or sell copies of the Software, and to
  19. | permit persons to whom the Software is furnished to do so, subject to
  20. | the following conditions:
  21. |
  22. | The above copyright notice and this permission notice shall be
  23. | included in all copies or substantial portions of the Software.
  24. |
  25. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  26. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  28. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  29. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  30. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  31. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. |
  33. ==================================================================== */
  34. /* Make sure that console is defined */
  35. if(typeof console === "undefined") {
  36. this.console = {
  37. log: function() {},
  38. warn: function() {},
  39. info: function() {},
  40. debug: function() {},
  41. error: function() {}
  42. };
  43. }
  44. /* Array extensions */
  45. Array.prototype.addElement = function(el) {
  46. if(typeof el === 'undefined') { return; }
  47. if(this.indexOf(el) == -1) {
  48. this.push(el);
  49. }
  50. };
  51. Array.prototype.removeElement = function(el) {
  52. var i = this.indexOf(el);
  53. if (i !== -1) { this.splice(i, 1); }
  54. };
  55. /* Smalltalk constructors definition */
  56. function SmalltalkObject() {}
  57. function SmalltalkBehavior() {}
  58. function SmalltalkClass() {}
  59. function SmalltalkMetaclass() {
  60. this.meta = true;
  61. }
  62. function SmalltalkPackage() {}
  63. function SmalltalkMethod() {}
  64. function SmalltalkNil() {}
  65. function SmalltalkOrganizer() {
  66. }
  67. function SmalltalkPackageOrganizer() {
  68. this.elements = [];
  69. }
  70. function SmalltalkClassOrganizer() {
  71. this.elements = [];
  72. }
  73. function inherits(child, parent) {
  74. child.prototype = Object.create(parent.prototype, {
  75. constructor: { value: child,
  76. enumerable: false, configurable: true, writable: true }
  77. });
  78. }
  79. inherits(SmalltalkBehavior, SmalltalkObject);
  80. inherits(SmalltalkClass, SmalltalkBehavior);
  81. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  82. inherits(SmalltalkNil, SmalltalkObject);
  83. inherits(SmalltalkMethod, SmalltalkObject);
  84. inherits(SmalltalkPackage, SmalltalkObject);
  85. inherits(SmalltalkOrganizer, SmalltalkObject);
  86. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  87. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  88. function Smalltalk() {
  89. var st = this;
  90. /* This is the current call context object. While it is publicly available,
  91. Use smalltalk.getThisContext() instead which will answer a safe copy of
  92. the current context */
  93. st.thisContext = undefined;
  94. /* List of all reserved words in JavaScript. They may not be used as variables
  95. in Smalltalk. */
  96. // list of reserved JavaScript keywords as of
  97. // http://es5.github.com/#x7.6.1.1
  98. // and
  99. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  100. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  101. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  102. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  103. 'try', 'typeof', 'var', 'void', 'while', 'with',
  104. // ES5: future use: http://es5.github.com/#x7.6.1.2
  105. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  106. // ES5: future use in strict mode
  107. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  108. 'public', 'static', 'yield'];
  109. var initialized = false;
  110. /* Smalltalk classes */
  111. var classes = [];
  112. var wrappedClasses = [];
  113. /* Method not implemented handlers */
  114. var dnu = {
  115. methods: [],
  116. selectors: [],
  117. get: function (string) {
  118. var index = this.selectors.indexOf(string);
  119. if(index !== -1) {
  120. return this.methods[index];
  121. }
  122. this.selectors.push(string);
  123. var selector = st.selector(string);
  124. var method = {jsSelector: selector, fn: this.createHandler(selector)};
  125. this.methods.push(method);
  126. return method;
  127. },
  128. /* Dnu handler method */
  129. createHandler: function (selector) {
  130. return function () {
  131. var args = Array.prototype.slice.call(arguments);
  132. return messageNotUnderstood(this, selector, args);
  133. };
  134. }
  135. };
  136. /* Answer all method selectors based on dnu handlers */
  137. st.allSelectors = function() {
  138. return dnu.selectors;
  139. };
  140. /* Unique ID number generator */
  141. var oid = 0;
  142. st.nextId = function() {
  143. oid += 1;
  144. return oid;
  145. };
  146. /* We hold all Packages in a separate Object */
  147. st.packages = {};
  148. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  149. function pkg(spec) {
  150. var that = new SmalltalkPackage();
  151. that.pkgName = spec.pkgName;
  152. that.organization = new SmalltalkPackageOrganizer();
  153. that.properties = spec.properties || {};
  154. return that;
  155. }
  156. /* Smalltalk class creation. A class is an instance of an automatically
  157. created metaclass object. Newly created classes (not their metaclass)
  158. should be added to the smalltalk object, see smalltalk.addClass().
  159. Superclass linking is *not* handled here, see smalltalk.init() */
  160. function klass(spec) {
  161. spec = spec || {};
  162. var meta = metaclass(spec);
  163. var that = meta.instanceClass;
  164. that.fn = spec.fn || function() {};
  165. setupClass(that, spec);
  166. that.className = spec.className;
  167. that.wrapped = spec.wrapped || false;
  168. meta.className = spec.className + ' class';
  169. if(spec.superclass) {
  170. that.superclass = spec.superclass;
  171. meta.superclass = spec.superclass.klass;
  172. }
  173. return that;
  174. }
  175. function metaclass(spec) {
  176. spec = spec || {};
  177. var that = new SmalltalkMetaclass();
  178. inherits(
  179. that.fn = function() {},
  180. spec.superclass ? spec.superclass.klass.fn : SmalltalkClass
  181. );
  182. that.instanceClass = new that.fn();
  183. setupClass(that);
  184. return that;
  185. }
  186. function setupClass(klass, spec) {
  187. spec = spec || {};
  188. klass.iVarNames = spec.iVarNames || [];
  189. klass.pkg = spec.pkg;
  190. Object.defineProperty(klass, "toString", {
  191. value: function() { return 'Smalltalk ' + this.className; },
  192. enumerable:false, configurable: true, writable: false
  193. });
  194. klass.organization = new SmalltalkClassOrganizer();
  195. klass.organization.theClass = klass;
  196. Object.defineProperty(klass, "methods", {
  197. value: {},
  198. enumerable: false, configurable: true, writable: true
  199. });
  200. wireKlass(klass);
  201. }
  202. /* Smalltalk method object. To add a method to a class,
  203. use smalltalk.addMethod() */
  204. st.method = function(spec) {
  205. var that = new SmalltalkMethod();
  206. that.selector = spec.selector;
  207. that.jsSelector = spec.jsSelector;
  208. that.args = spec.args || {};
  209. that.category = spec.category;
  210. that.source = spec.source;
  211. that.messageSends = spec.messageSends || [];
  212. that.referencedClasses = spec.referencedClasses || [];
  213. that.fn = spec.fn;
  214. return that;
  215. };
  216. /* Initialize a class in its class hierarchy. Handle both classes and
  217. metaclasses. */
  218. st.init = function(klass) {
  219. st.initClass(klass);
  220. if(klass.klass && !klass.meta) {
  221. st.initClass(klass.klass);
  222. }
  223. };
  224. st.initClass = function(klass) {
  225. if(klass.wrapped) {
  226. copySuperclass(klass);
  227. } else {
  228. installSuperclass(klass);
  229. }
  230. if(klass === st.Object || klass.wrapped) {
  231. installDnuHandlers(klass);
  232. }
  233. };
  234. function wireKlass(klass) {
  235. Object.defineProperty(klass.fn.prototype, "klass", {
  236. value: klass,
  237. enumerable: false, configurable: true, writable: true
  238. });
  239. }
  240. function installSuperclass(klass) {
  241. // only if the klass has not been initialized yet.
  242. if(klass.fn.prototype._yourself) { return; }
  243. if(klass.superclass && klass.superclass !== nil) {
  244. inherits(klass.fn, klass.superclass.fn);
  245. wireKlass(klass);
  246. reinstallMethods(klass);
  247. }
  248. }
  249. function copySuperclass(klass, superclass) {
  250. for (superclass = superclass || klass.superclass;
  251. superclass && superclass !== nil;
  252. superclass = superclass.superclass) {
  253. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  254. installMethodIfAbsent(superclass.methods[keys[i]], klass);
  255. }
  256. }
  257. }
  258. function installMethod(method, klass) {
  259. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  260. value: method.fn,
  261. enumerable: false, configurable: true, writable: true
  262. });
  263. }
  264. function installMethodIfAbsent(method, klass) {
  265. if(!klass.fn.prototype[method.jsSelector]) {
  266. installMethod(method, klass);
  267. }
  268. }
  269. function reinstallMethods(klass) {
  270. for(var keys = Object.keys(klass.methods), i=0; i<keys.length; i++) {
  271. installMethod(klass.methods[keys[i]], klass);
  272. }
  273. }
  274. function installDnuHandlers(klass) {
  275. var m = dnu.methods;
  276. for(var i=0; i<m.length; i++) {
  277. installMethodIfAbsent(m[i], klass);
  278. }
  279. }
  280. function installNewDnuHandler(newHandler) {
  281. installMethodIfAbsent(newHandler, st.Object);
  282. for(var i = 0; i < wrappedClasses.length; i++) {
  283. installMethodIfAbsent(newHandler, wrappedClasses[i]);
  284. }
  285. }
  286. /* Answer all registered Packages as Array */
  287. // TODO: Remove this hack
  288. st.packages.all = function() {
  289. var packages = [];
  290. for(var i in st.packages) {
  291. if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  292. packages.push(st.packages[i]);
  293. }
  294. return packages;
  295. };
  296. /* Answer all registered Smalltalk classes */
  297. //TODO: remove the function and make smalltalk.classes an array
  298. st.classes = function() {
  299. return classes;
  300. };
  301. st.wrappedClasses = function() {
  302. return wrappedClasses;
  303. };
  304. /* Answer the direct subclasses of klass. */
  305. st.subclasses = function(klass) {
  306. var subclasses = [];
  307. var classes = st.classes();
  308. for(var i=0; i < classes.length; i++) {
  309. var c = classes[i];
  310. if(c.fn) {
  311. //Classes
  312. if(c.superclass === klass) {
  313. subclasses.push(c);
  314. }
  315. c = c.klass;
  316. //Metaclasses
  317. if(c && c.superclass === klass) {
  318. subclasses.push(c);
  319. }
  320. }
  321. }
  322. return subclasses;
  323. };
  324. st.allSubclasses = function(klass) {
  325. var result, subclasses;
  326. result = subclasses = st.subclasses(klass);
  327. subclasses.forEach(function(subclass) {
  328. result.push.apply(result, st.allSubclasses(subclass));
  329. });
  330. return result;
  331. };
  332. /* Create a new class wrapping a JavaScript constructor, and add it to the
  333. global smalltalk object. Package is lazily created if it does not exist with given name. */
  334. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  335. if(wrapped !== false) {
  336. wrapped = true;
  337. }
  338. var pkg = st.addPackage(pkgName);
  339. st[className] = klass({
  340. className: className,
  341. superclass: superclass,
  342. pkg: pkg,
  343. fn: fn,
  344. wrapped: wrapped
  345. });
  346. classes.addElement(st[className]);
  347. if(wrapped) {
  348. wrappedClasses.addElement(st[className]);
  349. }
  350. pkg.organization.elements.addElement(st[className]);
  351. };
  352. /* Create an alias for an existing class */
  353. st.alias = function(klass, alias) {
  354. st[alias] = klass;
  355. };
  356. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  357. If pkgName is null or empty we return nil, which is an allowed package for a class.
  358. If package already exists we still update the properties of it. */
  359. st.addPackage = function(pkgName, properties) {
  360. if(!pkgName) {return nil;}
  361. if(!(st.packages[pkgName])) {
  362. st.packages[pkgName] = pkg({
  363. pkgName: pkgName,
  364. properties: properties
  365. });
  366. } else {
  367. if(properties) {
  368. st.packages[pkgName].properties = properties;
  369. }
  370. }
  371. return st.packages[pkgName];
  372. };
  373. /* Add a class to the smalltalk object, creating a new one if needed.
  374. A Package is lazily created if it does not exist with given name. */
  375. st.addClass = function(className, superclass, iVarNames, pkgName) {
  376. var pkg = st.addPackage(pkgName);
  377. if (superclass == nil) { superclass = null; }
  378. if(st[className] && st[className].superclass == superclass) {
  379. st[className].superclass = superclass;
  380. st[className].iVarNames = iVarNames;
  381. st[className].pkg = pkg || st[className].pkg;
  382. } else {
  383. if(st[className]) {
  384. st.removeClass(st[className]);
  385. }
  386. st[className] = klass({
  387. className: className,
  388. superclass: superclass,
  389. pkg: pkg,
  390. iVarNames: iVarNames
  391. });
  392. }
  393. classes.addElement(st[className]);
  394. pkg.organization.elements.addElement(st[className]);
  395. };
  396. st.removeClass = function(klass) {
  397. klass.pkg.organization.elements.removeElement(klass);
  398. classes.removeElement(klass);
  399. delete st[klass.className];
  400. };
  401. /* Add/remove a method to/from a class */
  402. /* This is a temporary version of addMethod() for backward compatibility */
  403. st.addMethod = function(method_exJsSelector, klass_exMethod, exKlass) {
  404. if (typeof method_exJsSelector === "string") { //legacy
  405. if (method_exJsSelector !== st.selector(klass_exMethod.selector)) {
  406. console.log("DISCREPANCY: arg, in_method");
  407. console.log(method_exJsSelector);
  408. console.log(st.selector(klass_exMethod.selector));
  409. klass_exMethod.jsSelector = method_exJsSelector;
  410. }
  411. return new_addMethod(klass_exMethod, exKlass);
  412. }
  413. return new_addMethod(method_exJsSelector, klass_exMethod);
  414. };
  415. // later, st.addMethod can be this:
  416. function new_addMethod(method, klass) {
  417. if (!(method.jsSelector)) {
  418. method.jsSelector = st.selector(method.selector);
  419. }
  420. installMethod(method, klass);
  421. klass.methods[method.selector] = method;
  422. method.methodClass = klass;
  423. // During the bootstrap, #addCompiledMethod is not used.
  424. // Therefore we populate the organizer here too
  425. klass.organization.elements.addElement(method.category);
  426. // If already initialized (else it will be done later anyway),
  427. // re-initialize all subclasses to ensure the new method
  428. // propagation (for wrapped classes, not using the prototype
  429. // chain.
  430. if(initialized) {
  431. st.allSubclasses(klass).forEach(function(subclass) {
  432. st.initClass(subclass);
  433. });
  434. }
  435. for(var i=0; i<method.messageSends.length; i++) {
  436. var dnuHandler = dnu.get(method.messageSends[i]);
  437. if(initialized) {
  438. installNewDnuHandler(dnuHandler);
  439. }
  440. }
  441. }
  442. st.removeMethod = function(method) {
  443. var protocol = method.category;
  444. var klass = method.methodClass;
  445. delete klass.fn.prototype[st.selector(method.selector)];
  446. delete klass.methods[method.selector];
  447. var selectors = Object.keys(klass.methods);
  448. // Do *not* delete protocols from here.
  449. // This is handled by #removeCompiledMethod
  450. };
  451. /* Handles unhandled errors during message sends */
  452. // simply send the message and handle #dnu:
  453. st.send = function(receiver, selector, args, klass) {
  454. var method;
  455. if(receiver === null) {
  456. receiver = nil;
  457. }
  458. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  459. if(method) {
  460. return method.apply(receiver, args);
  461. } else {
  462. return messageNotUnderstood(receiver, selector, args);
  463. }
  464. };
  465. st.withContext = function(worker, setup) {
  466. if(st.thisContext) {
  467. st.thisContext.pc++;
  468. return inContext(worker, setup);
  469. } else {
  470. try {
  471. return inContext(worker, setup);
  472. } catch(error) {
  473. if(error.smalltalkError) {
  474. handleError(error);
  475. } else {
  476. var errorWrapper = st.JavaScriptException._on_(error);
  477. try {errorWrapper._signal();} catch(ex) {}
  478. errorWrapper._context_(st.getThisContext());
  479. handleError(errorWrapper);
  480. }
  481. // Reset the context stack in any case
  482. st.thisContext = undefined;
  483. // Throw the exception anyway, as we want to stop
  484. // the execution to avoid infinite loops
  485. // Update: do not throw the exception. It's really annoying.
  486. // throw error;
  487. }
  488. }
  489. };
  490. function inContext(worker, setup) {
  491. var context = pushContext(setup);
  492. var result = worker(context);
  493. popContext(context);
  494. return result;
  495. }
  496. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  497. (See the Smalltalk class ErrorHandler and its subclasses */
  498. function handleError(error) {
  499. st.ErrorHandler._current()._handleError_(error);
  500. }
  501. /* Handles #dnu: *and* JavaScript method calls.
  502. if the receiver has no klass, we consider it a JS object (outside of the
  503. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  504. function messageNotUnderstood(receiver, selector, args) {
  505. /* Handles JS method calls. */
  506. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  507. return callJavaScriptMethod(receiver, selector, args);
  508. }
  509. /* Handles not understood messages. Also see the Amber counter-part
  510. Object>>doesNotUnderstand: */
  511. return receiver._doesNotUnderstand_(
  512. st.Message._new()
  513. ._selector_(st.convertSelector(selector))
  514. ._arguments_(args)
  515. );
  516. }
  517. /* Call a method of a JS object, or answer a property if it exists.
  518. Else try wrapping a JSObjectProxy around the receiver.
  519. If the object property is a function, then call it, except if it starts with
  520. an uppercase character (we probably want to answer the function itself in this
  521. case and send it #new from Amber).
  522. Converts keyword-based selectors by using the first
  523. keyword only, but keeping all message arguments.
  524. Example:
  525. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  526. function callJavaScriptMethod(receiver, selector, args) {
  527. var jsSelector = selector._asJavaScriptSelector();
  528. var jsProperty = receiver[jsSelector];
  529. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  530. return jsProperty.apply(receiver, args);
  531. } else if(jsProperty !== undefined) {
  532. if(args[0]) {
  533. receiver[jsSelector] = args[0];
  534. return nil;
  535. } else {
  536. return jsProperty;
  537. }
  538. }
  539. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  540. }
  541. /* Handle thisContext pseudo variable */
  542. st.getThisContext = function() {
  543. if(st.thisContext) {
  544. st.thisContext.init();
  545. return st.thisContext;
  546. } else {
  547. return nil;
  548. }
  549. };
  550. function pushContext(setup) {
  551. st.thisContext = new SmalltalkMethodContext(smalltalk.thisContext, setup);
  552. return st.thisContext;
  553. }
  554. function popContext(context) {
  555. st.thisContext = context.homeContext;
  556. }
  557. /* Convert a Smalltalk selector into a JS selector */
  558. st.selector = function(string) {
  559. var selector = '_' + string;
  560. selector = selector.replace(/:/g, '_');
  561. selector = selector.replace(/[\&]/g, '_and');
  562. selector = selector.replace(/[\|]/g, '_or');
  563. selector = selector.replace(/[+]/g, '_plus');
  564. selector = selector.replace(/-/g, '_minus');
  565. selector = selector.replace(/[*]/g ,'_star');
  566. selector = selector.replace(/[\/]/g ,'_slash');
  567. selector = selector.replace(/[\\]/g ,'_backslash');
  568. selector = selector.replace(/[\~]/g ,'_tild');
  569. selector = selector.replace(/>/g ,'_gt');
  570. selector = selector.replace(/</g ,'_lt');
  571. selector = selector.replace(/=/g ,'_eq');
  572. selector = selector.replace(/,/g ,'_comma');
  573. selector = selector.replace(/[@]/g ,'_at');
  574. return selector;
  575. };
  576. /* Convert a string to a valid smalltalk selector.
  577. if you modify the following functions, also change String>>asSelector
  578. accordingly */
  579. st.convertSelector = function(selector) {
  580. if(selector.match(/__/)) {
  581. return convertBinarySelector(selector);
  582. } else {
  583. return convertKeywordSelector(selector);
  584. }
  585. };
  586. function convertKeywordSelector(selector) {
  587. return selector.replace(/^_/, '').replace(/_/g, ':');
  588. }
  589. function convertBinarySelector(selector) {
  590. return selector
  591. .replace(/^_/, '')
  592. .replace(/_and/g, '&')
  593. .replace(/_or/g, '|')
  594. .replace(/_plus/g, '+')
  595. .replace(/_minus/g, '-')
  596. .replace(/_star/g, '*')
  597. .replace(/_slash/g, '/')
  598. .replace(/_backslash/g, '\\')
  599. .replace(/_tild/g, '~')
  600. .replace(/_gt/g, '>')
  601. .replace(/_lt/g, '<')
  602. .replace(/_eq/g, '=')
  603. .replace(/_comma/g, ',')
  604. .replace(/_at/g, '@');
  605. }
  606. /* Converts a JavaScript object to valid Smalltalk Object */
  607. st.readJSObject = function(js) {
  608. var object = js;
  609. var readObject = (js.constructor === Object);
  610. var readArray = (js.constructor === Array);
  611. if(readObject) {
  612. object = st.Dictionary._new();
  613. }
  614. for(var i in js) {
  615. if(readObject) {
  616. object._at_put_(i, st.readJSObject(js[i]));
  617. }
  618. if(readArray) {
  619. object[i] = st.readJSObject(js[i]);
  620. }
  621. }
  622. return object;
  623. };
  624. /* Boolean assertion */
  625. st.assert = function(shouldBeBoolean) {
  626. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  627. return (shouldBeBoolean == true);
  628. } else {
  629. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  630. }
  631. };
  632. /* Backward compatibility with Amber 0.9.1 */
  633. st.symbolFor = function(aString) { return aString; };
  634. /* Smalltalk initialization. Called on page load */
  635. st.initialize = function() {
  636. if(initialized) { return; }
  637. classes.forEach(function(klass) {
  638. st.init(klass);
  639. });
  640. classes.forEach(function(klass) {
  641. klass._initialize();
  642. });
  643. initialized = true;
  644. };
  645. }
  646. inherits(Smalltalk, SmalltalkObject);
  647. function SmalltalkMethodContext(home, setup) {
  648. this.homeContext = home;
  649. this.setup = setup || function() {};
  650. this.pc = 0;
  651. }
  652. // Fallbacks
  653. SmalltalkMethodContext.prototype.locals = {};
  654. SmalltalkMethodContext.prototype.receiver = null;
  655. SmalltalkMethodContext.prototype.selector = null;
  656. SmalltalkMethodContext.prototype.lookupClass = null;
  657. inherits(SmalltalkMethodContext, SmalltalkObject);
  658. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  659. this.receiver = receiver;
  660. this.selector = selector;
  661. this.locals = locals || {};
  662. this.lookupClass = lookupClass;
  663. };
  664. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx) {
  665. this.locals = locals || {};
  666. this.outerContext = ctx;
  667. };
  668. SmalltalkMethodContext.prototype.init = function() {
  669. var home = this.homeContext;
  670. if(home) {
  671. home = home.init();
  672. }
  673. this.setup(this);
  674. };
  675. SmalltalkMethodContext.prototype.method = function() {
  676. var method;
  677. var lookup = this.lookupClass || this.receiver.klass;
  678. while(!method && lookup) {
  679. method = lookup.methods[smalltalk.convertSelector(this.selector)];
  680. lookup = lookup.superclass;
  681. }
  682. return method;
  683. };
  684. // TODO: this is just wrong :)
  685. SmalltalkMethodContext.prototype.resume = function() {
  686. //Brutally set the receiver as thisContext, then re-enter the function
  687. smalltalk.thisContext = this;
  688. return this.method.apply(receiver, temps);
  689. };
  690. /* Global Smalltalk objects. */
  691. var nil = new SmalltalkNil();
  692. var smalltalk = new Smalltalk();
  693. if(this.jQuery) {
  694. this.jQuery.allowJavaScriptCalls = true;
  695. }
  696. /*
  697. * Answer the smalltalk representation of o.
  698. * Used in message sends
  699. */
  700. var _st = function(o) {
  701. if(o == null) {return nil;}
  702. if(o.klass) {return o;}
  703. return smalltalk.JSObjectProxy._on_(o);
  704. };
  705. /***************************************** BOOTSTRAP ******************************************/
  706. smalltalk.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
  707. smalltalk.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, smalltalk.Object, false);
  708. smalltalk.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, smalltalk.Behavior, false);
  709. smalltalk.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, smalltalk.Behavior, false);
  710. smalltalk.Object.klass.superclass = smalltalk.Class;
  711. smalltalk.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, smalltalk.Object, false);
  712. smalltalk.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, smalltalk.Object, false);
  713. smalltalk.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, smalltalk.Object, false);
  714. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object, false);
  715. smalltalk.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, smalltalk.Organizer, false);
  716. smalltalk.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, smalltalk.Organizer, false);
  717. smalltalk.wrapClassName("Number", "Kernel-Objects", Number, smalltalk.Object);
  718. smalltalk.wrapClassName("BlockClosure", "Kernel-Methods", Function, smalltalk.Object);
  719. smalltalk.wrapClassName("Boolean", "Kernel-Objects", Boolean, smalltalk.Object);
  720. smalltalk.wrapClassName("Date", "Kernel-Objects", Date, smalltalk.Object);
  721. smalltalk.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, smalltalk.Object, false);
  722. smalltalk.addClass("Collection", smalltalk.Object, null, "Kernel-Collections");
  723. smalltalk.addClass("IndexableCollection", smalltalk.Collection, null, "Kernel-Collections");
  724. smalltalk.addClass("SequenceableCollection", smalltalk.IndexableCollection, null, "Kernel-Collections");
  725. smalltalk.addClass("CharacterArray", smalltalk.SequenceableCollection, null, "Kernel-Collections");
  726. smalltalk.wrapClassName("String", "Kernel-Collections", String, smalltalk.CharacterArray);
  727. smalltalk.wrapClassName("Array", "Kernel-Collections", Array, smalltalk.SequenceableCollection);
  728. smalltalk.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, smalltalk.Object);
  729. smalltalk.wrapClassName("Error", "Kernel-Exceptions", Error, smalltalk.Object);
  730. smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, smalltalk.Object, false);
  731. /* Alias definitions */
  732. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  733. smalltalk.alias(smalltalk.Date, "Time");
  734. smalltalk.addPackage('Kernel-Objects');
  735. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  736. smalltalk.Object.comment="**I am the root of the Smalltalk class system**. All classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects, 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.";
  737. smalltalk.addMethod(
  738. smalltalk.method({
  739. selector: "->",
  740. category: 'converting',
  741. fn: function (anObject){
  742. var self=this;
  743. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  744. return smalltalk.withContext(function($ctx1) {
  745. var $1;
  746. $1=_st($Association())._key_value_(self,anObject);
  747. return $1;
  748. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
  749. args: ["anObject"],
  750. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  751. messageSends: ["key:value:"],
  752. referencedClasses: ["Association"]
  753. }),
  754. smalltalk.Object);
  755. smalltalk.addMethod(
  756. smalltalk.method({
  757. selector: "=",
  758. category: 'comparing',
  759. fn: function (anObject){
  760. var self=this;
  761. return smalltalk.withContext(function($ctx1) {
  762. var $1;
  763. $1=self.__eq_eq(anObject);
  764. return $1;
  765. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
  766. args: ["anObject"],
  767. source: "= anObject\x0a\x09^self == anObject",
  768. messageSends: ["=="],
  769. referencedClasses: []
  770. }),
  771. smalltalk.Object);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "==",
  775. category: 'comparing',
  776. fn: function (anObject){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. var $1;
  780. $1=_st(self._identityHash()).__eq(_st(anObject)._identityHash());
  781. return $1;
  782. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
  783. args: ["anObject"],
  784. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  785. messageSends: ["=", "identityHash"],
  786. referencedClasses: []
  787. }),
  788. smalltalk.Object);
  789. smalltalk.addMethod(
  790. smalltalk.method({
  791. selector: "asJSON",
  792. category: 'converting',
  793. fn: function (){
  794. var self=this;
  795. var variables;
  796. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  797. return smalltalk.withContext(function($ctx1) {
  798. var $1;
  799. variables=_st($HashedCollection())._new();
  800. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  801. return smalltalk.withContext(function($ctx2) {
  802. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  804. $1=variables;
  805. return $1;
  806. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})},
  807. args: [],
  808. 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",
  809. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  810. referencedClasses: ["HashedCollection"]
  811. }),
  812. smalltalk.Object);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "asJSONString",
  816. category: 'converting',
  817. fn: function (){
  818. var self=this;
  819. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  820. return smalltalk.withContext(function($ctx1) {
  821. var $1;
  822. $1=_st($JSON())._stringify_(self._asJSON());
  823. return $1;
  824. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
  825. args: [],
  826. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  827. messageSends: ["stringify:", "asJSON"],
  828. referencedClasses: ["JSON"]
  829. }),
  830. smalltalk.Object);
  831. smalltalk.addMethod(
  832. smalltalk.method({
  833. selector: "asJavascript",
  834. category: 'converting',
  835. fn: function (){
  836. var self=this;
  837. return smalltalk.withContext(function($ctx1) {
  838. var $1;
  839. $1=self._asString();
  840. return $1;
  841. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
  842. args: [],
  843. source: "asJavascript\x0a\x09^self asString",
  844. messageSends: ["asString"],
  845. referencedClasses: []
  846. }),
  847. smalltalk.Object);
  848. smalltalk.addMethod(
  849. smalltalk.method({
  850. selector: "asString",
  851. category: 'converting',
  852. fn: function (){
  853. var self=this;
  854. return smalltalk.withContext(function($ctx1) {
  855. var $1;
  856. $1=self._printString();
  857. return $1;
  858. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
  859. args: [],
  860. source: "asString\x0a\x09^self printString",
  861. messageSends: ["printString"],
  862. referencedClasses: []
  863. }),
  864. smalltalk.Object);
  865. smalltalk.addMethod(
  866. smalltalk.method({
  867. selector: "basicAt:",
  868. category: 'accessing',
  869. fn: function (aString){
  870. var self=this;
  871. return smalltalk.withContext(function($ctx1) {
  872. return self[aString];
  873. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
  874. args: ["aString"],
  875. source: "basicAt: aString\x0a\x09<return self[aString]>",
  876. messageSends: [],
  877. referencedClasses: []
  878. }),
  879. smalltalk.Object);
  880. smalltalk.addMethod(
  881. smalltalk.method({
  882. selector: "basicAt:put:",
  883. category: 'accessing',
  884. fn: function (aString,anObject){
  885. var self=this;
  886. return smalltalk.withContext(function($ctx1) {
  887. return self[aString] = anObject;
  888. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  889. args: ["aString", "anObject"],
  890. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  891. messageSends: [],
  892. referencedClasses: []
  893. }),
  894. smalltalk.Object);
  895. smalltalk.addMethod(
  896. smalltalk.method({
  897. selector: "basicDelete:",
  898. category: 'accessing',
  899. fn: function (aString){
  900. var self=this;
  901. return smalltalk.withContext(function($ctx1) {
  902. delete self[aString]; return aString;
  903. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
  904. args: ["aString"],
  905. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  906. messageSends: [],
  907. referencedClasses: []
  908. }),
  909. smalltalk.Object);
  910. smalltalk.addMethod(
  911. smalltalk.method({
  912. selector: "basicPerform:",
  913. category: 'message handling',
  914. fn: function (aString){
  915. var self=this;
  916. return smalltalk.withContext(function($ctx1) {
  917. var $1;
  918. $1=self._basicPerform_withArguments_(aString,[]);
  919. return $1;
  920. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
  921. args: ["aString"],
  922. source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
  923. messageSends: ["basicPerform:withArguments:"],
  924. referencedClasses: []
  925. }),
  926. smalltalk.Object);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "basicPerform:withArguments:",
  930. category: 'message handling',
  931. fn: function (aString,aCollection){
  932. var self=this;
  933. return smalltalk.withContext(function($ctx1) {
  934. return self[aString].apply(self, aCollection);;
  935. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  936. args: ["aString", "aCollection"],
  937. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.Object);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "class",
  945. category: 'accessing',
  946. fn: function (){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. return self.klass;
  950. return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
  951. args: [],
  952. source: "class\x0a\x09<return self.klass>",
  953. messageSends: [],
  954. referencedClasses: []
  955. }),
  956. smalltalk.Object);
  957. smalltalk.addMethod(
  958. smalltalk.method({
  959. selector: "copy",
  960. category: 'copying',
  961. fn: function (){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) {
  964. var $1;
  965. $1=_st(self._shallowCopy())._postCopy();
  966. return $1;
  967. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
  968. args: [],
  969. source: "copy\x0a\x09^self shallowCopy postCopy",
  970. messageSends: ["postCopy", "shallowCopy"],
  971. referencedClasses: []
  972. }),
  973. smalltalk.Object);
  974. smalltalk.addMethod(
  975. smalltalk.method({
  976. selector: "deepCopy",
  977. category: 'copying',
  978. fn: function (){
  979. var self=this;
  980. return smalltalk.withContext(function($ctx1) {
  981. var copy = self.klass._new();
  982. for(var i in self) {
  983. if(/^@.+/.test(i)) {
  984. copy[i] = self[i]._deepCopy();
  985. }
  986. }
  987. return copy;
  988. ;
  989. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
  990. args: [],
  991. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\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>",
  992. messageSends: [],
  993. referencedClasses: []
  994. }),
  995. smalltalk.Object);
  996. smalltalk.addMethod(
  997. smalltalk.method({
  998. selector: "deprecatedAPI",
  999. category: 'error handling',
  1000. fn: function (){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. _st(console)._warn_(_st(_st(_st(_st(smalltalk.getThisContext()._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(smalltalk.getThisContext()._home())._home())._asString())).__comma(")"));
  1004. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})},
  1005. args: [],
  1006. 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, ')'",
  1007. messageSends: ["warn:", ",", "asString", "home"],
  1008. referencedClasses: []
  1009. }),
  1010. smalltalk.Object);
  1011. smalltalk.addMethod(
  1012. smalltalk.method({
  1013. selector: "doesNotUnderstand:",
  1014. category: 'error handling',
  1015. fn: function (aMessage){
  1016. var self=this;
  1017. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1018. return smalltalk.withContext(function($ctx1) {
  1019. var $1,$2;
  1020. $1=_st($MessageNotUnderstood())._new();
  1021. _st($1)._receiver_(self);
  1022. _st($1)._message_(aMessage);
  1023. $2=_st($1)._signal();
  1024. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
  1025. args: ["aMessage"],
  1026. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1027. messageSends: ["receiver:", "new", "message:", "signal"],
  1028. referencedClasses: ["MessageNotUnderstood"]
  1029. }),
  1030. smalltalk.Object);
  1031. smalltalk.addMethod(
  1032. smalltalk.method({
  1033. selector: "error:",
  1034. category: 'error handling',
  1035. fn: function (aString){
  1036. var self=this;
  1037. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1038. return smalltalk.withContext(function($ctx1) {
  1039. _st($Error())._signal_(aString);
  1040. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
  1041. args: ["aString"],
  1042. source: "error: aString\x0a\x09Error signal: aString",
  1043. messageSends: ["signal:"],
  1044. referencedClasses: ["Error"]
  1045. }),
  1046. smalltalk.Object);
  1047. smalltalk.addMethod(
  1048. smalltalk.method({
  1049. selector: "halt",
  1050. category: 'error handling',
  1051. fn: function (){
  1052. var self=this;
  1053. return smalltalk.withContext(function($ctx1) {
  1054. self._error_("Halt encountered");
  1055. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
  1056. args: [],
  1057. source: "halt\x0a\x09self error: 'Halt encountered'",
  1058. messageSends: ["error:"],
  1059. referencedClasses: []
  1060. }),
  1061. smalltalk.Object);
  1062. smalltalk.addMethod(
  1063. smalltalk.method({
  1064. selector: "identityHash",
  1065. category: 'accessing',
  1066. fn: function (){
  1067. var self=this;
  1068. return smalltalk.withContext(function($ctx1) {
  1069. var hash=self.identityHash;
  1070. if (hash) return hash;
  1071. hash=smalltalk.nextId();
  1072. Object.defineProperty(self, 'identityHash', {value:hash});
  1073. return hash;
  1074. ;
  1075. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
  1076. args: [],
  1077. source: "identityHash\x0a\x09<\x0a\x09var hash=self.identityHash;\x0a\x09if (hash) return hash;\x0a\x09hash=smalltalk.nextId();\x0a\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09return hash;\x0a\x09>",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.Object);
  1082. smalltalk.addMethod(
  1083. smalltalk.method({
  1084. selector: "ifNil:",
  1085. category: 'testing',
  1086. fn: function (aBlock){
  1087. var self=this;
  1088. return smalltalk.withContext(function($ctx1) {
  1089. var $1;
  1090. $1=self;
  1091. return $1;
  1092. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
  1093. args: ["aBlock"],
  1094. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  1095. messageSends: [],
  1096. referencedClasses: []
  1097. }),
  1098. smalltalk.Object);
  1099. smalltalk.addMethod(
  1100. smalltalk.method({
  1101. selector: "ifNil:ifNotNil:",
  1102. category: 'testing',
  1103. fn: function (aBlock,anotherBlock){
  1104. var self=this;
  1105. return smalltalk.withContext(function($ctx1) {
  1106. var $1;
  1107. $1=_st(anotherBlock)._value_(self);
  1108. return $1;
  1109. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1110. args: ["aBlock", "anotherBlock"],
  1111. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
  1112. messageSends: ["value:"],
  1113. referencedClasses: []
  1114. }),
  1115. smalltalk.Object);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "ifNotNil:",
  1119. category: 'testing',
  1120. fn: function (aBlock){
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. var $1;
  1124. $1=_st(aBlock)._value_(self);
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
  1127. args: ["aBlock"],
  1128. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1129. messageSends: ["value:"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.Object);
  1133. smalltalk.addMethod(
  1134. smalltalk.method({
  1135. selector: "ifNotNil:ifNil:",
  1136. category: 'testing',
  1137. fn: function (aBlock,anotherBlock){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. var $1;
  1141. $1=_st(aBlock)._value_(self);
  1142. return $1;
  1143. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1144. args: ["aBlock", "anotherBlock"],
  1145. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1146. messageSends: ["value:"],
  1147. referencedClasses: []
  1148. }),
  1149. smalltalk.Object);
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "initialize",
  1153. category: 'initialization',
  1154. fn: function (){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
  1158. args: [],
  1159. source: "initialize",
  1160. messageSends: [],
  1161. referencedClasses: []
  1162. }),
  1163. smalltalk.Object);
  1164. smalltalk.addMethod(
  1165. smalltalk.method({
  1166. selector: "inspect",
  1167. category: 'inspecting',
  1168. fn: function (){
  1169. var self=this;
  1170. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  1171. return smalltalk.withContext(function($ctx1) {
  1172. _st($InspectorHandler())._inspect_(self);
  1173. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.Object)})},
  1174. args: [],
  1175. source: "inspect\x0a\x09InspectorHandler inspect: self",
  1176. messageSends: ["inspect:"],
  1177. referencedClasses: ["InspectorHandler"]
  1178. }),
  1179. smalltalk.Object);
  1180. smalltalk.addMethod(
  1181. smalltalk.method({
  1182. selector: "inspectOn:",
  1183. category: 'inspecting',
  1184. fn: function (anInspector){
  1185. var self=this;
  1186. var variables;
  1187. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1188. return smalltalk.withContext(function($ctx1) {
  1189. var $1,$2;
  1190. variables=_st($Dictionary())._new();
  1191. _st(variables)._at_put_("#self",self);
  1192. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1193. return smalltalk.withContext(function($ctx2) {
  1194. return _st(variables)._at_put_(each,self._instVarAt_(each));
  1195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1196. $1=anInspector;
  1197. _st($1)._setLabel_(self._printString());
  1198. $2=_st($1)._setVariables_(variables);
  1199. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.Object)})},
  1200. args: ["anInspector"],
  1201. 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",
  1202. messageSends: ["new", "at:put:", "do:", "instVarAt:", "allInstanceVariableNames", "class", "setLabel:", "printString", "setVariables:"],
  1203. referencedClasses: ["Dictionary"]
  1204. }),
  1205. smalltalk.Object);
  1206. smalltalk.addMethod(
  1207. smalltalk.method({
  1208. selector: "instVarAt:",
  1209. category: 'accessing',
  1210. fn: function (aString){
  1211. var self=this;
  1212. return smalltalk.withContext(function($ctx1) {
  1213. return self['@'+aString] ;
  1214. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  1215. args: ["aString"],
  1216. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1217. messageSends: [],
  1218. referencedClasses: []
  1219. }),
  1220. smalltalk.Object);
  1221. smalltalk.addMethod(
  1222. smalltalk.method({
  1223. selector: "instVarAt:put:",
  1224. category: 'accessing',
  1225. fn: function (aString,anObject){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. self['@' + aString] = anObject ;
  1229. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  1230. args: ["aString", "anObject"],
  1231. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1232. messageSends: [],
  1233. referencedClasses: []
  1234. }),
  1235. smalltalk.Object);
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "isBehavior",
  1239. category: 'testing',
  1240. fn: function (){
  1241. var self=this;
  1242. return smalltalk.withContext(function($ctx1) {
  1243. return false;
  1244. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  1245. args: [],
  1246. source: "isBehavior\x0a\x09^ false",
  1247. messageSends: [],
  1248. referencedClasses: []
  1249. }),
  1250. smalltalk.Object);
  1251. smalltalk.addMethod(
  1252. smalltalk.method({
  1253. selector: "isBoolean",
  1254. category: 'testing',
  1255. fn: function (){
  1256. var self=this;
  1257. return smalltalk.withContext(function($ctx1) {
  1258. return false;
  1259. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  1260. args: [],
  1261. source: "isBoolean\x0a\x09^ false",
  1262. messageSends: [],
  1263. referencedClasses: []
  1264. }),
  1265. smalltalk.Object);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "isClass",
  1269. category: 'testing',
  1270. fn: function (){
  1271. var self=this;
  1272. return smalltalk.withContext(function($ctx1) {
  1273. return false;
  1274. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  1275. args: [],
  1276. source: "isClass\x0a\x09^false",
  1277. messageSends: [],
  1278. referencedClasses: []
  1279. }),
  1280. smalltalk.Object);
  1281. smalltalk.addMethod(
  1282. smalltalk.method({
  1283. selector: "isCompiledMethod",
  1284. category: 'testing',
  1285. fn: function (){
  1286. var self=this;
  1287. return smalltalk.withContext(function($ctx1) {
  1288. return false;
  1289. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  1290. args: [],
  1291. source: "isCompiledMethod\x0a\x09^ false",
  1292. messageSends: [],
  1293. referencedClasses: []
  1294. }),
  1295. smalltalk.Object);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "isImmutable",
  1299. category: 'testing',
  1300. fn: function (){
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. return false;
  1304. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  1305. args: [],
  1306. source: "isImmutable\x0a\x09^ false",
  1307. messageSends: [],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.Object);
  1311. smalltalk.addMethod(
  1312. smalltalk.method({
  1313. selector: "isKindOf:",
  1314. category: 'testing',
  1315. fn: function (aClass){
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) {
  1318. var $2,$1;
  1319. $2=self._isMemberOf_(aClass);
  1320. if(smalltalk.assert($2)){
  1321. $1=true;
  1322. } else {
  1323. $1=_st(self._class())._inheritsFrom_(aClass);
  1324. };
  1325. return $1;
  1326. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  1327. args: ["aClass"],
  1328. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  1329. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1330. referencedClasses: []
  1331. }),
  1332. smalltalk.Object);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "isMemberOf:",
  1336. category: 'testing',
  1337. fn: function (aClass){
  1338. var self=this;
  1339. return smalltalk.withContext(function($ctx1) {
  1340. var $1;
  1341. $1=_st(self._class()).__eq(aClass);
  1342. return $1;
  1343. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  1344. args: ["aClass"],
  1345. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1346. messageSends: ["=", "class"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.Object);
  1350. smalltalk.addMethod(
  1351. smalltalk.method({
  1352. selector: "isMetaclass",
  1353. category: 'testing',
  1354. fn: function (){
  1355. var self=this;
  1356. return smalltalk.withContext(function($ctx1) {
  1357. return false;
  1358. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  1359. args: [],
  1360. source: "isMetaclass\x0a\x09^false",
  1361. messageSends: [],
  1362. referencedClasses: []
  1363. }),
  1364. smalltalk.Object);
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "isNil",
  1368. category: 'testing',
  1369. fn: function (){
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) {
  1372. return false;
  1373. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  1374. args: [],
  1375. source: "isNil\x0a\x09^false",
  1376. messageSends: [],
  1377. referencedClasses: []
  1378. }),
  1379. smalltalk.Object);
  1380. smalltalk.addMethod(
  1381. smalltalk.method({
  1382. selector: "isNumber",
  1383. category: 'testing',
  1384. fn: function (){
  1385. var self=this;
  1386. return smalltalk.withContext(function($ctx1) {
  1387. return false;
  1388. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  1389. args: [],
  1390. source: "isNumber\x0a\x09^false",
  1391. messageSends: [],
  1392. referencedClasses: []
  1393. }),
  1394. smalltalk.Object);
  1395. smalltalk.addMethod(
  1396. smalltalk.method({
  1397. selector: "isPackage",
  1398. category: 'testing',
  1399. fn: function (){
  1400. var self=this;
  1401. return smalltalk.withContext(function($ctx1) {
  1402. return false;
  1403. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  1404. args: [],
  1405. source: "isPackage\x0a\x09^ false",
  1406. messageSends: [],
  1407. referencedClasses: []
  1408. }),
  1409. smalltalk.Object);
  1410. smalltalk.addMethod(
  1411. smalltalk.method({
  1412. selector: "isParseFailure",
  1413. category: 'testing',
  1414. fn: function (){
  1415. var self=this;
  1416. return smalltalk.withContext(function($ctx1) {
  1417. return false;
  1418. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  1419. args: [],
  1420. source: "isParseFailure\x0a\x09^false",
  1421. messageSends: [],
  1422. referencedClasses: []
  1423. }),
  1424. smalltalk.Object);
  1425. smalltalk.addMethod(
  1426. smalltalk.method({
  1427. selector: "isString",
  1428. category: 'testing',
  1429. fn: function (){
  1430. var self=this;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. return false;
  1433. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  1434. args: [],
  1435. source: "isString\x0a\x09^false",
  1436. messageSends: [],
  1437. referencedClasses: []
  1438. }),
  1439. smalltalk.Object);
  1440. smalltalk.addMethod(
  1441. smalltalk.method({
  1442. selector: "isSymbol",
  1443. category: 'testing',
  1444. fn: function (){
  1445. var self=this;
  1446. return smalltalk.withContext(function($ctx1) {
  1447. return false;
  1448. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  1449. args: [],
  1450. source: "isSymbol\x0a\x09^false",
  1451. messageSends: [],
  1452. referencedClasses: []
  1453. }),
  1454. smalltalk.Object);
  1455. smalltalk.addMethod(
  1456. smalltalk.method({
  1457. selector: "notNil",
  1458. category: 'testing',
  1459. fn: function (){
  1460. var self=this;
  1461. return smalltalk.withContext(function($ctx1) {
  1462. var $1;
  1463. $1=_st(self._isNil())._not();
  1464. return $1;
  1465. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  1466. args: [],
  1467. source: "notNil\x0a\x09^self isNil not",
  1468. messageSends: ["not", "isNil"],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.Object);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "perform:",
  1475. category: 'message handling',
  1476. fn: function (aString){
  1477. var self=this;
  1478. return smalltalk.withContext(function($ctx1) {
  1479. var $1;
  1480. $1=self._perform_withArguments_(aString,[]);
  1481. return $1;
  1482. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  1483. args: ["aString"],
  1484. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  1485. messageSends: ["perform:withArguments:"],
  1486. referencedClasses: []
  1487. }),
  1488. smalltalk.Object);
  1489. smalltalk.addMethod(
  1490. smalltalk.method({
  1491. selector: "perform:withArguments:",
  1492. category: 'message handling',
  1493. fn: function (aString,aCollection){
  1494. var self=this;
  1495. return smalltalk.withContext(function($ctx1) {
  1496. return smalltalk.send(self, aString._asSelector(), aCollection);
  1497. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  1498. args: ["aString", "aCollection"],
  1499. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1500. messageSends: [],
  1501. referencedClasses: []
  1502. }),
  1503. smalltalk.Object);
  1504. smalltalk.addMethod(
  1505. smalltalk.method({
  1506. selector: "postCopy",
  1507. category: 'copying',
  1508. fn: function (){
  1509. var self=this;
  1510. return smalltalk.withContext(function($ctx1) {
  1511. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  1512. args: [],
  1513. source: "postCopy",
  1514. messageSends: [],
  1515. referencedClasses: []
  1516. }),
  1517. smalltalk.Object);
  1518. smalltalk.addMethod(
  1519. smalltalk.method({
  1520. selector: "printOn:",
  1521. category: 'printing',
  1522. fn: function (aStream){
  1523. var self=this;
  1524. return smalltalk.withContext(function($ctx1) {
  1525. var $1,$3,$2;
  1526. $1=aStream;
  1527. $3=_st(_st(_st(self._class())._name())._first())._isVowel();
  1528. if(smalltalk.assert($3)){
  1529. $2="an ";
  1530. } else {
  1531. $2="a ";
  1532. };
  1533. _st($1)._nextPutAll_($2);
  1534. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1535. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  1536. args: ["aStream"],
  1537. source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1538. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1539. referencedClasses: []
  1540. }),
  1541. smalltalk.Object);
  1542. smalltalk.addMethod(
  1543. smalltalk.method({
  1544. selector: "printString",
  1545. category: 'printing',
  1546. fn: function (){
  1547. var self=this;
  1548. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1549. return smalltalk.withContext(function($ctx1) {
  1550. var $1;
  1551. $1=_st($String())._streamContents_((function(stream){
  1552. return smalltalk.withContext(function($ctx2) {
  1553. return self._printOn_(stream);
  1554. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1555. return $1;
  1556. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  1557. args: [],
  1558. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  1559. messageSends: ["streamContents:", "printOn:"],
  1560. referencedClasses: ["String"]
  1561. }),
  1562. smalltalk.Object);
  1563. smalltalk.addMethod(
  1564. smalltalk.method({
  1565. selector: "putOn:",
  1566. category: 'streaming',
  1567. fn: function (aStream){
  1568. var self=this;
  1569. return smalltalk.withContext(function($ctx1) {
  1570. _st(aStream)._nextPut_(self);
  1571. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  1572. args: ["aStream"],
  1573. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  1574. messageSends: ["nextPut:"],
  1575. referencedClasses: []
  1576. }),
  1577. smalltalk.Object);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "respondsTo:",
  1581. category: 'testing',
  1582. fn: function (aSelector){
  1583. var self=this;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $1;
  1586. $1=_st(self._class())._canUnderstand_(aSelector);
  1587. return $1;
  1588. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  1589. args: ["aSelector"],
  1590. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1591. messageSends: ["canUnderstand:", "class"],
  1592. referencedClasses: []
  1593. }),
  1594. smalltalk.Object);
  1595. smalltalk.addMethod(
  1596. smalltalk.method({
  1597. selector: "shallowCopy",
  1598. category: 'copying',
  1599. fn: function (){
  1600. var self=this;
  1601. return smalltalk.withContext(function($ctx1) {
  1602. var copy = self.klass._new();
  1603. for(var i in self) {
  1604. if(/^@.+/.test(i)) {
  1605. copy[i] = self[i];
  1606. }
  1607. }
  1608. return copy;
  1609. ;
  1610. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  1611. args: [],
  1612. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  1613. messageSends: [],
  1614. referencedClasses: []
  1615. }),
  1616. smalltalk.Object);
  1617. smalltalk.addMethod(
  1618. smalltalk.method({
  1619. selector: "shouldNotImplement",
  1620. category: 'error handling',
  1621. fn: function (){
  1622. var self=this;
  1623. return smalltalk.withContext(function($ctx1) {
  1624. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  1625. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  1626. args: [],
  1627. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1628. messageSends: ["error:", ",", "name", "class"],
  1629. referencedClasses: []
  1630. }),
  1631. smalltalk.Object);
  1632. smalltalk.addMethod(
  1633. smalltalk.method({
  1634. selector: "size",
  1635. category: 'accessing',
  1636. fn: function (){
  1637. var self=this;
  1638. return smalltalk.withContext(function($ctx1) {
  1639. self._error_("Object not indexable");
  1640. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  1641. args: [],
  1642. source: "size\x0a\x09self error: 'Object not indexable'",
  1643. messageSends: ["error:"],
  1644. referencedClasses: []
  1645. }),
  1646. smalltalk.Object);
  1647. smalltalk.addMethod(
  1648. smalltalk.method({
  1649. selector: "subclassResponsibility",
  1650. category: 'error handling',
  1651. fn: function (){
  1652. var self=this;
  1653. return smalltalk.withContext(function($ctx1) {
  1654. self._error_("This method is a responsibility of a subclass");
  1655. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  1656. args: [],
  1657. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1658. messageSends: ["error:"],
  1659. referencedClasses: []
  1660. }),
  1661. smalltalk.Object);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "test",
  1665. category: 'converting',
  1666. fn: function (){
  1667. var self=this;
  1668. var a;
  1669. return smalltalk.withContext(function($ctx1) {
  1670. a=(1);
  1671. self._halt();
  1672. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  1673. args: [],
  1674. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  1675. messageSends: ["halt"],
  1676. referencedClasses: []
  1677. }),
  1678. smalltalk.Object);
  1679. smalltalk.addMethod(
  1680. smalltalk.method({
  1681. selector: "throw:",
  1682. category: 'error handling',
  1683. fn: function (anObject){
  1684. var self=this;
  1685. return smalltalk.withContext(function($ctx1) {
  1686. throw anObject ;
  1687. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  1688. args: ["anObject"],
  1689. source: "throw: anObject\x0a\x09< throw anObject >",
  1690. messageSends: [],
  1691. referencedClasses: []
  1692. }),
  1693. smalltalk.Object);
  1694. smalltalk.addMethod(
  1695. smalltalk.method({
  1696. selector: "try:catch:",
  1697. category: 'error handling',
  1698. fn: function (aBlock,anotherBlock){
  1699. var self=this;
  1700. return smalltalk.withContext(function($ctx1) {
  1701. try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)};
  1702. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1703. args: ["aBlock", "anotherBlock"],
  1704. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)}>",
  1705. messageSends: [],
  1706. referencedClasses: []
  1707. }),
  1708. smalltalk.Object);
  1709. smalltalk.addMethod(
  1710. smalltalk.method({
  1711. selector: "value",
  1712. category: 'accessing',
  1713. fn: function (){
  1714. var self=this;
  1715. return smalltalk.withContext(function($ctx1) {
  1716. return self.valueOf();
  1717. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  1718. args: [],
  1719. source: "value\x0a\x09<return self.valueOf()>",
  1720. messageSends: [],
  1721. referencedClasses: []
  1722. }),
  1723. smalltalk.Object);
  1724. smalltalk.addMethod(
  1725. smalltalk.method({
  1726. selector: "yourself",
  1727. category: 'accessing',
  1728. fn: function (){
  1729. var self=this;
  1730. return smalltalk.withContext(function($ctx1) {
  1731. var $1;
  1732. $1=self;
  1733. return $1;
  1734. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  1735. args: [],
  1736. source: "yourself\x0a\x09^self",
  1737. messageSends: [],
  1738. referencedClasses: []
  1739. }),
  1740. smalltalk.Object);
  1741. smalltalk.addMethod(
  1742. smalltalk.method({
  1743. selector: "~=",
  1744. category: 'comparing',
  1745. fn: function (anObject){
  1746. var self=this;
  1747. return smalltalk.withContext(function($ctx1) {
  1748. var $1;
  1749. $1=_st(self.__eq(anObject)).__eq(false);
  1750. return $1;
  1751. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  1752. args: ["anObject"],
  1753. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1754. messageSends: ["="],
  1755. referencedClasses: []
  1756. }),
  1757. smalltalk.Object);
  1758. smalltalk.addMethod(
  1759. smalltalk.method({
  1760. selector: "~~",
  1761. category: 'comparing',
  1762. fn: function (anObject){
  1763. var self=this;
  1764. return smalltalk.withContext(function($ctx1) {
  1765. var $1;
  1766. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1767. return $1;
  1768. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  1769. args: ["anObject"],
  1770. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1771. messageSends: ["=", "=="],
  1772. referencedClasses: []
  1773. }),
  1774. smalltalk.Object);
  1775. smalltalk.addMethod(
  1776. smalltalk.method({
  1777. selector: "heliosClass",
  1778. category: 'helios',
  1779. fn: function (){
  1780. var self=this;
  1781. return smalltalk.withContext(function($ctx1) {
  1782. return "class";
  1783. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Object.klass)})},
  1784. args: [],
  1785. 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'",
  1786. messageSends: [],
  1787. referencedClasses: []
  1788. }),
  1789. smalltalk.Object.klass);
  1790. smalltalk.addMethod(
  1791. smalltalk.method({
  1792. selector: "initialize",
  1793. category: 'initialization',
  1794. fn: function (){
  1795. var self=this;
  1796. return smalltalk.withContext(function($ctx1) {
  1797. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  1798. args: [],
  1799. source: "initialize\x0a\x09\x22no op\x22",
  1800. messageSends: [],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.Object.klass);
  1804. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1805. smalltalk.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: [ ... ]";
  1806. smalltalk.addMethod(
  1807. smalltalk.method({
  1808. selector: "&",
  1809. category: 'controlling',
  1810. fn: function (aBoolean){
  1811. var self=this;
  1812. return smalltalk.withContext(function($ctx1) {
  1813. if(self == true) {
  1814. return aBoolean;
  1815. } else {
  1816. return false;
  1817. }
  1818. ;
  1819. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1820. args: ["aBoolean"],
  1821. 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>",
  1822. messageSends: [],
  1823. referencedClasses: []
  1824. }),
  1825. smalltalk.Boolean);
  1826. smalltalk.addMethod(
  1827. smalltalk.method({
  1828. selector: "=",
  1829. category: 'comparing',
  1830. fn: function (aBoolean){
  1831. var self=this;
  1832. return smalltalk.withContext(function($ctx1) {
  1833. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  1834. return false;
  1835. }
  1836. return Boolean(self == true) == aBoolean
  1837. ;
  1838. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1839. args: ["aBoolean"],
  1840. source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>",
  1841. messageSends: [],
  1842. referencedClasses: []
  1843. }),
  1844. smalltalk.Boolean);
  1845. smalltalk.addMethod(
  1846. smalltalk.method({
  1847. selector: "==",
  1848. category: 'comparing',
  1849. fn: function (aBoolean){
  1850. var self=this;
  1851. return smalltalk.withContext(function($ctx1) {
  1852. var $1;
  1853. $1=self.__eq(aBoolean);
  1854. return $1;
  1855. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  1856. args: ["aBoolean"],
  1857. source: "== aBoolean\x0a\x09^self = aBoolean",
  1858. messageSends: ["="],
  1859. referencedClasses: []
  1860. }),
  1861. smalltalk.Boolean);
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "and:",
  1865. category: 'controlling',
  1866. fn: function (aBlock){
  1867. var self=this;
  1868. return smalltalk.withContext(function($ctx1) {
  1869. var $2,$1;
  1870. $2=self.__eq(true);
  1871. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1872. return smalltalk.withContext(function($ctx2) {
  1873. return false;
  1874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1875. return $1;
  1876. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  1877. args: ["aBlock"],
  1878. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  1879. messageSends: ["ifTrue:ifFalse:", "="],
  1880. referencedClasses: []
  1881. }),
  1882. smalltalk.Boolean);
  1883. smalltalk.addMethod(
  1884. smalltalk.method({
  1885. selector: "asBit",
  1886. category: 'converting',
  1887. fn: function (){
  1888. var self=this;
  1889. return smalltalk.withContext(function($ctx1) {
  1890. var $2,$1;
  1891. $2=self;
  1892. if(smalltalk.assert($2)){
  1893. $1=(1);
  1894. } else {
  1895. $1=(0);
  1896. };
  1897. return $1;
  1898. }, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
  1899. args: [],
  1900. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  1901. messageSends: ["ifTrue:ifFalse:"],
  1902. referencedClasses: []
  1903. }),
  1904. smalltalk.Boolean);
  1905. smalltalk.addMethod(
  1906. smalltalk.method({
  1907. selector: "asJSON",
  1908. category: 'converting',
  1909. fn: function (){
  1910. var self=this;
  1911. return smalltalk.withContext(function($ctx1) {
  1912. var $1;
  1913. $1=self;
  1914. return $1;
  1915. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  1916. args: [],
  1917. source: "asJSON\x0a\x09^self",
  1918. messageSends: [],
  1919. referencedClasses: []
  1920. }),
  1921. smalltalk.Boolean);
  1922. smalltalk.addMethod(
  1923. smalltalk.method({
  1924. selector: "asString",
  1925. category: 'converting',
  1926. fn: function (){
  1927. var self=this;
  1928. return smalltalk.withContext(function($ctx1) {
  1929. return self.toString() ;
  1930. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  1931. args: [],
  1932. source: "asString\x0a\x09< return self.toString() >",
  1933. messageSends: [],
  1934. referencedClasses: []
  1935. }),
  1936. smalltalk.Boolean);
  1937. smalltalk.addMethod(
  1938. smalltalk.method({
  1939. selector: "deepCopy",
  1940. category: 'copying',
  1941. fn: function (){
  1942. var self=this;
  1943. return smalltalk.withContext(function($ctx1) {
  1944. var $1;
  1945. $1=self;
  1946. return $1;
  1947. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  1948. args: [],
  1949. source: "deepCopy\x0a\x09^self",
  1950. messageSends: [],
  1951. referencedClasses: []
  1952. }),
  1953. smalltalk.Boolean);
  1954. smalltalk.addMethod(
  1955. smalltalk.method({
  1956. selector: "ifFalse:",
  1957. category: 'controlling',
  1958. fn: function (aBlock){
  1959. var self=this;
  1960. return smalltalk.withContext(function($ctx1) {
  1961. var $2,$1;
  1962. $2=self;
  1963. $1=_st($2)._ifTrue_ifFalse_((function(){
  1964. return smalltalk.withContext(function($ctx2) {
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1966. return $1;
  1967. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  1968. args: ["aBlock"],
  1969. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1970. messageSends: ["ifTrue:ifFalse:"],
  1971. referencedClasses: []
  1972. }),
  1973. smalltalk.Boolean);
  1974. smalltalk.addMethod(
  1975. smalltalk.method({
  1976. selector: "ifFalse:ifTrue:",
  1977. category: 'controlling',
  1978. fn: function (aBlock,anotherBlock){
  1979. var self=this;
  1980. return smalltalk.withContext(function($ctx1) {
  1981. var $2,$1;
  1982. $2=self;
  1983. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  1984. return $1;
  1985. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  1986. args: ["aBlock", "anotherBlock"],
  1987. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1988. messageSends: ["ifTrue:ifFalse:"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.Boolean);
  1992. smalltalk.addMethod(
  1993. smalltalk.method({
  1994. selector: "ifTrue:",
  1995. category: 'controlling',
  1996. fn: function (aBlock){
  1997. var self=this;
  1998. return smalltalk.withContext(function($ctx1) {
  1999. var $2,$1;
  2000. $2=self;
  2001. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2002. return smalltalk.withContext(function($ctx2) {
  2003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2004. return $1;
  2005. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  2006. args: ["aBlock"],
  2007. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  2008. messageSends: ["ifTrue:ifFalse:"],
  2009. referencedClasses: []
  2010. }),
  2011. smalltalk.Boolean);
  2012. smalltalk.addMethod(
  2013. smalltalk.method({
  2014. selector: "ifTrue:ifFalse:",
  2015. category: 'controlling',
  2016. fn: function (aBlock,anotherBlock){
  2017. var self=this;
  2018. return smalltalk.withContext(function($ctx1) {
  2019. if(self == true) {
  2020. return aBlock._value();
  2021. } else {
  2022. return anotherBlock._value();
  2023. }
  2024. ;
  2025. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  2026. args: ["aBlock", "anotherBlock"],
  2027. 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>",
  2028. messageSends: [],
  2029. referencedClasses: []
  2030. }),
  2031. smalltalk.Boolean);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "isBoolean",
  2035. category: 'testing',
  2036. fn: function (){
  2037. var self=this;
  2038. return smalltalk.withContext(function($ctx1) {
  2039. return true;
  2040. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  2041. args: [],
  2042. source: "isBoolean\x0a\x09^ true",
  2043. messageSends: [],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.Boolean);
  2047. smalltalk.addMethod(
  2048. smalltalk.method({
  2049. selector: "isImmutable",
  2050. category: 'testing',
  2051. fn: function (){
  2052. var self=this;
  2053. return smalltalk.withContext(function($ctx1) {
  2054. return true;
  2055. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  2056. args: [],
  2057. source: "isImmutable\x0a\x09^ true",
  2058. messageSends: [],
  2059. referencedClasses: []
  2060. }),
  2061. smalltalk.Boolean);
  2062. smalltalk.addMethod(
  2063. smalltalk.method({
  2064. selector: "not",
  2065. category: 'controlling',
  2066. fn: function (){
  2067. var self=this;
  2068. return smalltalk.withContext(function($ctx1) {
  2069. var $1;
  2070. $1=self.__eq(false);
  2071. return $1;
  2072. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  2073. args: [],
  2074. source: "not\x0a\x09^self = false",
  2075. messageSends: ["="],
  2076. referencedClasses: []
  2077. }),
  2078. smalltalk.Boolean);
  2079. smalltalk.addMethod(
  2080. smalltalk.method({
  2081. selector: "or:",
  2082. category: 'controlling',
  2083. fn: function (aBlock){
  2084. var self=this;
  2085. return smalltalk.withContext(function($ctx1) {
  2086. var $2,$1;
  2087. $2=self.__eq(true);
  2088. $1=_st($2)._ifTrue_ifFalse_((function(){
  2089. return smalltalk.withContext(function($ctx2) {
  2090. return true;
  2091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  2092. return $1;
  2093. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  2094. args: ["aBlock"],
  2095. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  2096. messageSends: ["ifTrue:ifFalse:", "="],
  2097. referencedClasses: []
  2098. }),
  2099. smalltalk.Boolean);
  2100. smalltalk.addMethod(
  2101. smalltalk.method({
  2102. selector: "printOn:",
  2103. category: 'printing',
  2104. fn: function (aStream){
  2105. var self=this;
  2106. return smalltalk.withContext(function($ctx1) {
  2107. _st(aStream)._nextPutAll_(self._asString());
  2108. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  2109. args: ["aStream"],
  2110. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2111. messageSends: ["nextPutAll:", "asString"],
  2112. referencedClasses: []
  2113. }),
  2114. smalltalk.Boolean);
  2115. smalltalk.addMethod(
  2116. smalltalk.method({
  2117. selector: "shallowCopy",
  2118. category: 'copying',
  2119. fn: function (){
  2120. var self=this;
  2121. return smalltalk.withContext(function($ctx1) {
  2122. var $1;
  2123. $1=self;
  2124. return $1;
  2125. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  2126. args: [],
  2127. source: "shallowCopy\x0a\x09^self",
  2128. messageSends: [],
  2129. referencedClasses: []
  2130. }),
  2131. smalltalk.Boolean);
  2132. smalltalk.addMethod(
  2133. smalltalk.method({
  2134. selector: "|",
  2135. category: 'controlling',
  2136. fn: function (aBoolean){
  2137. var self=this;
  2138. return smalltalk.withContext(function($ctx1) {
  2139. if(self == true) {
  2140. return true;
  2141. } else {
  2142. return aBoolean;
  2143. }
  2144. ;
  2145. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2146. args: ["aBoolean"],
  2147. 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>",
  2148. messageSends: [],
  2149. referencedClasses: []
  2150. }),
  2151. smalltalk.Boolean);
  2152. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  2153. smalltalk.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.).";
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "+",
  2157. category: 'arithmetic',
  2158. fn: function (aDate){
  2159. var self=this;
  2160. return smalltalk.withContext(function($ctx1) {
  2161. return self + aDate;
  2162. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  2163. args: ["aDate"],
  2164. source: "+ aDate\x0a\x09<return self + aDate>",
  2165. messageSends: [],
  2166. referencedClasses: []
  2167. }),
  2168. smalltalk.Date);
  2169. smalltalk.addMethod(
  2170. smalltalk.method({
  2171. selector: "-",
  2172. category: 'arithmetic',
  2173. fn: function (aDate){
  2174. var self=this;
  2175. return smalltalk.withContext(function($ctx1) {
  2176. return self - aDate;
  2177. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  2178. args: ["aDate"],
  2179. source: "- aDate\x0a\x09<return self - aDate>",
  2180. messageSends: [],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.Date);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "<",
  2187. category: 'comparing',
  2188. fn: function (aDate){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) {
  2191. return self < aDate;
  2192. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  2193. args: ["aDate"],
  2194. source: "< aDate\x0a\x09<return self < aDate>",
  2195. messageSends: [],
  2196. referencedClasses: []
  2197. }),
  2198. smalltalk.Date);
  2199. smalltalk.addMethod(
  2200. smalltalk.method({
  2201. selector: "<=",
  2202. category: 'comparing',
  2203. fn: function (aDate){
  2204. var self=this;
  2205. return smalltalk.withContext(function($ctx1) {
  2206. return self <= aDate;
  2207. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  2208. args: ["aDate"],
  2209. source: "<= aDate\x0a\x09<return self <= aDate>",
  2210. messageSends: [],
  2211. referencedClasses: []
  2212. }),
  2213. smalltalk.Date);
  2214. smalltalk.addMethod(
  2215. smalltalk.method({
  2216. selector: ">",
  2217. category: 'comparing',
  2218. fn: function (aDate){
  2219. var self=this;
  2220. return smalltalk.withContext(function($ctx1) {
  2221. return self > aDate;
  2222. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  2223. args: ["aDate"],
  2224. source: "> aDate\x0a\x09<return self >> aDate>",
  2225. messageSends: [],
  2226. referencedClasses: []
  2227. }),
  2228. smalltalk.Date);
  2229. smalltalk.addMethod(
  2230. smalltalk.method({
  2231. selector: ">=",
  2232. category: 'comparing',
  2233. fn: function (aDate){
  2234. var self=this;
  2235. return smalltalk.withContext(function($ctx1) {
  2236. return self >= aDate;
  2237. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  2238. args: ["aDate"],
  2239. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. smalltalk.Date);
  2244. smalltalk.addMethod(
  2245. smalltalk.method({
  2246. selector: "asDateString",
  2247. category: 'converting',
  2248. fn: function (){
  2249. var self=this;
  2250. return smalltalk.withContext(function($ctx1) {
  2251. return self.toDateString();
  2252. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  2253. args: [],
  2254. source: "asDateString\x0a\x09<return self.toDateString()>",
  2255. messageSends: [],
  2256. referencedClasses: []
  2257. }),
  2258. smalltalk.Date);
  2259. smalltalk.addMethod(
  2260. smalltalk.method({
  2261. selector: "asLocaleString",
  2262. category: 'converting',
  2263. fn: function (){
  2264. var self=this;
  2265. return smalltalk.withContext(function($ctx1) {
  2266. return self.toLocaleString();
  2267. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  2268. args: [],
  2269. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2270. messageSends: [],
  2271. referencedClasses: []
  2272. }),
  2273. smalltalk.Date);
  2274. smalltalk.addMethod(
  2275. smalltalk.method({
  2276. selector: "asMilliseconds",
  2277. category: 'converting',
  2278. fn: function (){
  2279. var self=this;
  2280. return smalltalk.withContext(function($ctx1) {
  2281. var $1;
  2282. $1=self._time();
  2283. return $1;
  2284. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  2285. args: [],
  2286. source: "asMilliseconds\x0a\x09^self time",
  2287. messageSends: ["time"],
  2288. referencedClasses: []
  2289. }),
  2290. smalltalk.Date);
  2291. smalltalk.addMethod(
  2292. smalltalk.method({
  2293. selector: "asNumber",
  2294. category: 'converting',
  2295. fn: function (){
  2296. var self=this;
  2297. return smalltalk.withContext(function($ctx1) {
  2298. var $1;
  2299. $1=self._asMilliseconds();
  2300. return $1;
  2301. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  2302. args: [],
  2303. source: "asNumber\x0a\x09^self asMilliseconds",
  2304. messageSends: ["asMilliseconds"],
  2305. referencedClasses: []
  2306. }),
  2307. smalltalk.Date);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "asString",
  2311. category: 'converting',
  2312. fn: function (){
  2313. var self=this;
  2314. return smalltalk.withContext(function($ctx1) {
  2315. return self.toString();
  2316. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  2317. args: [],
  2318. source: "asString\x0a\x09<return self.toString()>",
  2319. messageSends: [],
  2320. referencedClasses: []
  2321. }),
  2322. smalltalk.Date);
  2323. smalltalk.addMethod(
  2324. smalltalk.method({
  2325. selector: "asTimeString",
  2326. category: 'converting',
  2327. fn: function (){
  2328. var self=this;
  2329. return smalltalk.withContext(function($ctx1) {
  2330. return self.toTimeString();
  2331. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  2332. args: [],
  2333. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2334. messageSends: [],
  2335. referencedClasses: []
  2336. }),
  2337. smalltalk.Date);
  2338. smalltalk.addMethod(
  2339. smalltalk.method({
  2340. selector: "day",
  2341. category: 'accessing',
  2342. fn: function (){
  2343. var self=this;
  2344. return smalltalk.withContext(function($ctx1) {
  2345. var $1;
  2346. $1=self._dayOfWeek();
  2347. return $1;
  2348. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  2349. args: [],
  2350. source: "day\x0a\x09^self dayOfWeek",
  2351. messageSends: ["dayOfWeek"],
  2352. referencedClasses: []
  2353. }),
  2354. smalltalk.Date);
  2355. smalltalk.addMethod(
  2356. smalltalk.method({
  2357. selector: "day:",
  2358. category: 'accessing',
  2359. fn: function (aNumber){
  2360. var self=this;
  2361. return smalltalk.withContext(function($ctx1) {
  2362. self._dayOfWeek_(aNumber);
  2363. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  2364. args: ["aNumber"],
  2365. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2366. messageSends: ["dayOfWeek:"],
  2367. referencedClasses: []
  2368. }),
  2369. smalltalk.Date);
  2370. smalltalk.addMethod(
  2371. smalltalk.method({
  2372. selector: "dayOfMonth",
  2373. category: 'accessing',
  2374. fn: function (){
  2375. var self=this;
  2376. return smalltalk.withContext(function($ctx1) {
  2377. return self.getDate();
  2378. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  2379. args: [],
  2380. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2381. messageSends: [],
  2382. referencedClasses: []
  2383. }),
  2384. smalltalk.Date);
  2385. smalltalk.addMethod(
  2386. smalltalk.method({
  2387. selector: "dayOfMonth:",
  2388. category: 'accessing',
  2389. fn: function (aNumber){
  2390. var self=this;
  2391. return smalltalk.withContext(function($ctx1) {
  2392. self.setDate(aNumber);
  2393. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  2394. args: ["aNumber"],
  2395. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2396. messageSends: [],
  2397. referencedClasses: []
  2398. }),
  2399. smalltalk.Date);
  2400. smalltalk.addMethod(
  2401. smalltalk.method({
  2402. selector: "dayOfWeek",
  2403. category: 'accessing',
  2404. fn: function (){
  2405. var self=this;
  2406. return smalltalk.withContext(function($ctx1) {
  2407. return self.getDay() + 1;
  2408. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  2409. args: [],
  2410. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2411. messageSends: [],
  2412. referencedClasses: []
  2413. }),
  2414. smalltalk.Date);
  2415. smalltalk.addMethod(
  2416. smalltalk.method({
  2417. selector: "dayOfWeek:",
  2418. category: 'accessing',
  2419. fn: function (aNumber){
  2420. var self=this;
  2421. return smalltalk.withContext(function($ctx1) {
  2422. return self.setDay(aNumber - 1);
  2423. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  2424. args: ["aNumber"],
  2425. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2426. messageSends: [],
  2427. referencedClasses: []
  2428. }),
  2429. smalltalk.Date);
  2430. smalltalk.addMethod(
  2431. smalltalk.method({
  2432. selector: "hours",
  2433. category: 'accessing',
  2434. fn: function (){
  2435. var self=this;
  2436. return smalltalk.withContext(function($ctx1) {
  2437. return self.getHours();
  2438. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  2439. args: [],
  2440. source: "hours\x0a\x09<return self.getHours()>",
  2441. messageSends: [],
  2442. referencedClasses: []
  2443. }),
  2444. smalltalk.Date);
  2445. smalltalk.addMethod(
  2446. smalltalk.method({
  2447. selector: "hours:",
  2448. category: 'accessing',
  2449. fn: function (aNumber){
  2450. var self=this;
  2451. return smalltalk.withContext(function($ctx1) {
  2452. self.setHours(aNumber);
  2453. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  2454. args: ["aNumber"],
  2455. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2456. messageSends: [],
  2457. referencedClasses: []
  2458. }),
  2459. smalltalk.Date);
  2460. smalltalk.addMethod(
  2461. smalltalk.method({
  2462. selector: "milliseconds",
  2463. category: 'accessing',
  2464. fn: function (){
  2465. var self=this;
  2466. return smalltalk.withContext(function($ctx1) {
  2467. return self.getMilliseconds();
  2468. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  2469. args: [],
  2470. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2471. messageSends: [],
  2472. referencedClasses: []
  2473. }),
  2474. smalltalk.Date);
  2475. smalltalk.addMethod(
  2476. smalltalk.method({
  2477. selector: "milliseconds:",
  2478. category: 'accessing',
  2479. fn: function (aNumber){
  2480. var self=this;
  2481. return smalltalk.withContext(function($ctx1) {
  2482. self.setMilliseconds(aNumber);
  2483. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  2484. args: ["aNumber"],
  2485. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2486. messageSends: [],
  2487. referencedClasses: []
  2488. }),
  2489. smalltalk.Date);
  2490. smalltalk.addMethod(
  2491. smalltalk.method({
  2492. selector: "minutes",
  2493. category: 'accessing',
  2494. fn: function (){
  2495. var self=this;
  2496. return smalltalk.withContext(function($ctx1) {
  2497. return self.getMinutes();
  2498. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  2499. args: [],
  2500. source: "minutes\x0a\x09<return self.getMinutes()>",
  2501. messageSends: [],
  2502. referencedClasses: []
  2503. }),
  2504. smalltalk.Date);
  2505. smalltalk.addMethod(
  2506. smalltalk.method({
  2507. selector: "minutes:",
  2508. category: 'accessing',
  2509. fn: function (aNumber){
  2510. var self=this;
  2511. return smalltalk.withContext(function($ctx1) {
  2512. self.setMinutes(aNumber);
  2513. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  2514. args: ["aNumber"],
  2515. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2516. messageSends: [],
  2517. referencedClasses: []
  2518. }),
  2519. smalltalk.Date);
  2520. smalltalk.addMethod(
  2521. smalltalk.method({
  2522. selector: "month",
  2523. category: 'accessing',
  2524. fn: function (){
  2525. var self=this;
  2526. return smalltalk.withContext(function($ctx1) {
  2527. return self.getMonth() + 1;
  2528. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  2529. args: [],
  2530. source: "month\x0a\x09<return self.getMonth() + 1>",
  2531. messageSends: [],
  2532. referencedClasses: []
  2533. }),
  2534. smalltalk.Date);
  2535. smalltalk.addMethod(
  2536. smalltalk.method({
  2537. selector: "month:",
  2538. category: 'accessing',
  2539. fn: function (aNumber){
  2540. var self=this;
  2541. return smalltalk.withContext(function($ctx1) {
  2542. self.setMonth(aNumber - 1);
  2543. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  2544. args: ["aNumber"],
  2545. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2546. messageSends: [],
  2547. referencedClasses: []
  2548. }),
  2549. smalltalk.Date);
  2550. smalltalk.addMethod(
  2551. smalltalk.method({
  2552. selector: "printOn:",
  2553. category: 'printing',
  2554. fn: function (aStream){
  2555. var self=this;
  2556. return smalltalk.withContext(function($ctx1) {
  2557. _st(aStream)._nextPutAll_(self._asString());
  2558. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  2559. args: ["aStream"],
  2560. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2561. messageSends: ["nextPutAll:", "asString"],
  2562. referencedClasses: []
  2563. }),
  2564. smalltalk.Date);
  2565. smalltalk.addMethod(
  2566. smalltalk.method({
  2567. selector: "seconds",
  2568. category: 'accessing',
  2569. fn: function (){
  2570. var self=this;
  2571. return smalltalk.withContext(function($ctx1) {
  2572. return self.getSeconds();
  2573. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  2574. args: [],
  2575. source: "seconds\x0a\x09<return self.getSeconds()>",
  2576. messageSends: [],
  2577. referencedClasses: []
  2578. }),
  2579. smalltalk.Date);
  2580. smalltalk.addMethod(
  2581. smalltalk.method({
  2582. selector: "seconds:",
  2583. category: 'accessing',
  2584. fn: function (aNumber){
  2585. var self=this;
  2586. return smalltalk.withContext(function($ctx1) {
  2587. self.setSeconds(aNumber);
  2588. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  2589. args: ["aNumber"],
  2590. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2591. messageSends: [],
  2592. referencedClasses: []
  2593. }),
  2594. smalltalk.Date);
  2595. smalltalk.addMethod(
  2596. smalltalk.method({
  2597. selector: "time",
  2598. category: 'accessing',
  2599. fn: function (){
  2600. var self=this;
  2601. return smalltalk.withContext(function($ctx1) {
  2602. return self.getTime();
  2603. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  2604. args: [],
  2605. source: "time\x0a\x09<return self.getTime()>",
  2606. messageSends: [],
  2607. referencedClasses: []
  2608. }),
  2609. smalltalk.Date);
  2610. smalltalk.addMethod(
  2611. smalltalk.method({
  2612. selector: "time:",
  2613. category: 'accessing',
  2614. fn: function (aNumber){
  2615. var self=this;
  2616. return smalltalk.withContext(function($ctx1) {
  2617. self.setTime(aNumber);
  2618. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  2619. args: ["aNumber"],
  2620. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2621. messageSends: [],
  2622. referencedClasses: []
  2623. }),
  2624. smalltalk.Date);
  2625. smalltalk.addMethod(
  2626. smalltalk.method({
  2627. selector: "year",
  2628. category: 'accessing',
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) {
  2632. return self.getFullYear();
  2633. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  2634. args: [],
  2635. source: "year\x0a\x09<return self.getFullYear()>",
  2636. messageSends: [],
  2637. referencedClasses: []
  2638. }),
  2639. smalltalk.Date);
  2640. smalltalk.addMethod(
  2641. smalltalk.method({
  2642. selector: "year:",
  2643. category: 'accessing',
  2644. fn: function (aNumber){
  2645. var self=this;
  2646. return smalltalk.withContext(function($ctx1) {
  2647. self.setFullYear(aNumber);
  2648. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  2649. args: ["aNumber"],
  2650. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2651. messageSends: [],
  2652. referencedClasses: []
  2653. }),
  2654. smalltalk.Date);
  2655. smalltalk.addMethod(
  2656. smalltalk.method({
  2657. selector: "fromMilliseconds:",
  2658. category: 'instance creation',
  2659. fn: function (aNumber){
  2660. var self=this;
  2661. return smalltalk.withContext(function($ctx1) {
  2662. var $1;
  2663. $1=self._new_(aNumber);
  2664. return $1;
  2665. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2666. args: ["aNumber"],
  2667. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2668. messageSends: ["new:"],
  2669. referencedClasses: []
  2670. }),
  2671. smalltalk.Date.klass);
  2672. smalltalk.addMethod(
  2673. smalltalk.method({
  2674. selector: "fromSeconds:",
  2675. category: 'instance creation',
  2676. fn: function (aNumber){
  2677. var self=this;
  2678. return smalltalk.withContext(function($ctx1) {
  2679. var $1;
  2680. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  2681. return $1;
  2682. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  2683. args: ["aNumber"],
  2684. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2685. messageSends: ["fromMilliseconds:", "*"],
  2686. referencedClasses: []
  2687. }),
  2688. smalltalk.Date.klass);
  2689. smalltalk.addMethod(
  2690. smalltalk.method({
  2691. selector: "fromString:",
  2692. category: 'instance creation',
  2693. fn: function (aString){
  2694. var self=this;
  2695. return smalltalk.withContext(function($ctx1) {
  2696. var $1;
  2697. $1=self._new_(aString);
  2698. return $1;
  2699. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  2700. args: ["aString"],
  2701. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2702. messageSends: ["new:"],
  2703. referencedClasses: []
  2704. }),
  2705. smalltalk.Date.klass);
  2706. smalltalk.addMethod(
  2707. smalltalk.method({
  2708. selector: "heliosClass",
  2709. category: 'helios',
  2710. fn: function (){
  2711. var self=this;
  2712. return smalltalk.withContext(function($ctx1) {
  2713. return "magnitude";
  2714. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Date.klass)})},
  2715. args: [],
  2716. source: "heliosClass\x0a\x09^ 'magnitude'",
  2717. messageSends: [],
  2718. referencedClasses: []
  2719. }),
  2720. smalltalk.Date.klass);
  2721. smalltalk.addMethod(
  2722. smalltalk.method({
  2723. selector: "millisecondsToRun:",
  2724. category: 'instance creation',
  2725. fn: function (aBlock){
  2726. var self=this;
  2727. var t;
  2728. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  2729. return smalltalk.withContext(function($ctx1) {
  2730. var $1;
  2731. t=_st($Date())._now();
  2732. _st(aBlock)._value();
  2733. $1=_st(_st($Date())._now()).__minus(t);
  2734. return $1;
  2735. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  2736. args: ["aBlock"],
  2737. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2738. messageSends: ["now", "value", "-"],
  2739. referencedClasses: ["Date"]
  2740. }),
  2741. smalltalk.Date.klass);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "new:",
  2745. category: 'instance creation',
  2746. fn: function (anObject){
  2747. var self=this;
  2748. return smalltalk.withContext(function($ctx1) {
  2749. return new Date(anObject);
  2750. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  2751. args: ["anObject"],
  2752. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2753. messageSends: [],
  2754. referencedClasses: []
  2755. }),
  2756. smalltalk.Date.klass);
  2757. smalltalk.addMethod(
  2758. smalltalk.method({
  2759. selector: "now",
  2760. category: 'instance creation',
  2761. fn: function (){
  2762. var self=this;
  2763. return smalltalk.withContext(function($ctx1) {
  2764. var $1;
  2765. $1=self._today();
  2766. return $1;
  2767. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  2768. args: [],
  2769. source: "now\x0a\x09^self today",
  2770. messageSends: ["today"],
  2771. referencedClasses: []
  2772. }),
  2773. smalltalk.Date.klass);
  2774. smalltalk.addMethod(
  2775. smalltalk.method({
  2776. selector: "today",
  2777. category: 'instance creation',
  2778. fn: function (){
  2779. var self=this;
  2780. return smalltalk.withContext(function($ctx1) {
  2781. var $1;
  2782. $1=self._new();
  2783. return $1;
  2784. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  2785. args: [],
  2786. source: "today\x0a\x09^self new",
  2787. messageSends: ["new"],
  2788. referencedClasses: []
  2789. }),
  2790. smalltalk.Date.klass);
  2791. smalltalk.addClass('Environment', smalltalk.Object, [], 'Kernel-Objects');
  2792. smalltalk.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.";
  2793. smalltalk.addMethod(
  2794. smalltalk.method({
  2795. selector: "addInstVarNamed:to:",
  2796. category: 'compiling',
  2797. fn: function (aString,aClass){
  2798. var self=this;
  2799. return smalltalk.withContext(function($ctx1) {
  2800. var $1,$2;
  2801. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  2802. _st($1)._add_(aString);
  2803. $2=_st($1)._yourself();
  2804. _st(self._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  2805. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2806. args: ["aString", "aClass"],
  2807. 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",
  2808. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package", "classBuilder"],
  2809. referencedClasses: []
  2810. }),
  2811. smalltalk.Environment);
  2812. smalltalk.addMethod(
  2813. smalltalk.method({
  2814. selector: "allSelectors",
  2815. category: 'accessing',
  2816. fn: function (){
  2817. var self=this;
  2818. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2819. return smalltalk.withContext(function($ctx1) {
  2820. var $1;
  2821. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  2822. return $1;
  2823. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  2824. args: [],
  2825. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  2826. messageSends: ["value", "at:", "current"],
  2827. referencedClasses: ["Smalltalk"]
  2828. }),
  2829. smalltalk.Environment);
  2830. smalltalk.addMethod(
  2831. smalltalk.method({
  2832. selector: "availableClassNames",
  2833. category: 'accessing',
  2834. fn: function (){
  2835. var self=this;
  2836. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2837. return smalltalk.withContext(function($ctx1) {
  2838. var $1;
  2839. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  2840. return smalltalk.withContext(function($ctx2) {
  2841. return _st(each)._name();
  2842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2843. return $1;
  2844. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
  2845. args: [],
  2846. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  2847. messageSends: ["collect:", "name", "classes", "current"],
  2848. referencedClasses: ["Smalltalk"]
  2849. }),
  2850. smalltalk.Environment);
  2851. smalltalk.addMethod(
  2852. smalltalk.method({
  2853. selector: "availablePackageNames",
  2854. category: 'accessing',
  2855. fn: function (){
  2856. var self=this;
  2857. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2858. return smalltalk.withContext(function($ctx1) {
  2859. var $1;
  2860. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  2861. return smalltalk.withContext(function($ctx2) {
  2862. return _st(each)._name();
  2863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2864. return $1;
  2865. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
  2866. args: [],
  2867. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  2868. messageSends: ["collect:", "name", "packages", "current"],
  2869. referencedClasses: ["Smalltalk"]
  2870. }),
  2871. smalltalk.Environment);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "availableProtocolsFor:",
  2875. category: 'accessing',
  2876. fn: function (aClass){
  2877. var self=this;
  2878. var protocols;
  2879. return smalltalk.withContext(function($ctx1) {
  2880. var $1,$2;
  2881. protocols=_st(aClass)._protocols();
  2882. $1=_st(aClass)._superclass();
  2883. if(($receiver = $1) == nil || $receiver == undefined){
  2884. $1;
  2885. } else {
  2886. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  2887. };
  2888. $2=_st(_st(protocols)._asSet())._asArray();
  2889. return $2;
  2890. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
  2891. args: ["aClass"],
  2892. 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",
  2893. messageSends: ["protocols", "ifNotNil:", "addAll:", "availableProtocolsFor:", "superclass", "asArray", "asSet"],
  2894. referencedClasses: []
  2895. }),
  2896. smalltalk.Environment);
  2897. smalltalk.addMethod(
  2898. smalltalk.method({
  2899. selector: "classBuilder",
  2900. category: 'accessing',
  2901. fn: function (){
  2902. var self=this;
  2903. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2904. return smalltalk.withContext(function($ctx1) {
  2905. var $1;
  2906. $1=_st($ClassBuilder())._new();
  2907. return $1;
  2908. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
  2909. args: [],
  2910. source: "classBuilder\x0a\x09^ ClassBuilder new",
  2911. messageSends: ["new"],
  2912. referencedClasses: ["ClassBuilder"]
  2913. }),
  2914. smalltalk.Environment);
  2915. smalltalk.addMethod(
  2916. smalltalk.method({
  2917. selector: "classNamed:",
  2918. category: 'accessing',
  2919. fn: function (aString){
  2920. var self=this;
  2921. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2922. return smalltalk.withContext(function($ctx1) {
  2923. var $2,$1;
  2924. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  2925. if(($receiver = $2) == nil || $receiver == undefined){
  2926. $1=self._error_("Invalid class name");
  2927. } else {
  2928. $1=$2;
  2929. };
  2930. return $1;
  2931. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
  2932. args: ["aString"],
  2933. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  2934. messageSends: ["ifNil:", "error:", "at:", "asSymbol", "current"],
  2935. referencedClasses: ["Smalltalk"]
  2936. }),
  2937. smalltalk.Environment);
  2938. smalltalk.addMethod(
  2939. smalltalk.method({
  2940. selector: "classes",
  2941. category: 'accessing',
  2942. fn: function (){
  2943. var self=this;
  2944. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2945. return smalltalk.withContext(function($ctx1) {
  2946. var $1;
  2947. $1=_st(_st($Smalltalk())._current())._classes();
  2948. return $1;
  2949. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  2950. args: [],
  2951. source: "classes\x0a\x09^ Smalltalk current classes",
  2952. messageSends: ["classes", "current"],
  2953. referencedClasses: ["Smalltalk"]
  2954. }),
  2955. smalltalk.Environment);
  2956. smalltalk.addMethod(
  2957. smalltalk.method({
  2958. selector: "commitPackage:",
  2959. category: 'actions',
  2960. fn: function (aPackage){
  2961. var self=this;
  2962. return smalltalk.withContext(function($ctx1) {
  2963. _st(aPackage)._commit();
  2964. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
  2965. args: ["aPackage"],
  2966. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  2967. messageSends: ["commit"],
  2968. referencedClasses: []
  2969. }),
  2970. smalltalk.Environment);
  2971. smalltalk.addMethod(
  2972. smalltalk.method({
  2973. selector: "compileClassComment:for:",
  2974. category: 'compiling',
  2975. fn: function (aString,aClass){
  2976. var self=this;
  2977. return smalltalk.withContext(function($ctx1) {
  2978. _st(aClass)._comment_(aString);
  2979. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  2980. args: ["aString", "aClass"],
  2981. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  2982. messageSends: ["comment:"],
  2983. referencedClasses: []
  2984. }),
  2985. smalltalk.Environment);
  2986. smalltalk.addMethod(
  2987. smalltalk.method({
  2988. selector: "compileClassDefinition:",
  2989. category: 'compiling',
  2990. fn: function (aString){
  2991. var self=this;
  2992. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2993. return smalltalk.withContext(function($ctx1) {
  2994. self._eval_on_(aString,_st($DoIt())._new());
  2995. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
  2996. args: ["aString"],
  2997. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  2998. messageSends: ["eval:on:", "new"],
  2999. referencedClasses: ["DoIt"]
  3000. }),
  3001. smalltalk.Environment);
  3002. smalltalk.addMethod(
  3003. smalltalk.method({
  3004. selector: "compileMethod:for:protocol:",
  3005. category: 'compiling',
  3006. fn: function (sourceCode,class_,protocol){
  3007. var self=this;
  3008. return smalltalk.withContext(function($ctx1) {
  3009. var $1;
  3010. $1=_st(class_)._compile_category_(sourceCode,protocol);
  3011. return $1;
  3012. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.Environment)})},
  3013. args: ["sourceCode", "class", "protocol"],
  3014. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  3015. messageSends: ["compile:category:"],
  3016. referencedClasses: []
  3017. }),
  3018. smalltalk.Environment);
  3019. smalltalk.addMethod(
  3020. smalltalk.method({
  3021. selector: "copyClass:to:",
  3022. category: 'actions',
  3023. fn: function (aClass,aClassName){
  3024. var self=this;
  3025. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3026. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3027. return smalltalk.withContext(function($ctx1) {
  3028. var $1;
  3029. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  3030. if(($receiver = $1) == nil || $receiver == undefined){
  3031. $1;
  3032. } else {
  3033. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  3034. };
  3035. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  3036. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  3037. args: ["aClass", "aClassName"],
  3038. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  3039. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "copyClass:named:", "new"],
  3040. referencedClasses: ["Smalltalk", "ClassBuilder"]
  3041. }),
  3042. smalltalk.Environment);
  3043. smalltalk.addMethod(
  3044. smalltalk.method({
  3045. selector: "eval:on:",
  3046. category: 'actions',
  3047. fn: function (aString,aReceiver){
  3048. var self=this;
  3049. var compiler;
  3050. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  3051. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3052. return smalltalk.withContext(function($ctx1) {
  3053. var $1,$2;
  3054. var $early={};
  3055. try {
  3056. compiler=_st($Compiler())._new();
  3057. _st((function(){
  3058. return smalltalk.withContext(function($ctx2) {
  3059. return _st(compiler)._parseExpression_(aString);
  3060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  3061. return smalltalk.withContext(function($ctx2) {
  3062. $1=_st(window)._alert_(_st(ex)._messageText());
  3063. throw $early=[$1];
  3064. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  3065. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  3066. return $2;
  3067. }
  3068. catch(e) {if(e===$early)return e[0]; throw e}
  3069. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.Environment)})},
  3070. args: ["aString", "aReceiver"],
  3071. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ window alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  3072. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "evaluateExpression:on:"],
  3073. referencedClasses: ["Compiler", "Error"]
  3074. }),
  3075. smalltalk.Environment);
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "evaluate:on:do:",
  3079. category: 'error handling',
  3080. fn: function (aBlock,anErrorClass,exceptionBlock){
  3081. var self=this;
  3082. return smalltalk.withContext(function($ctx1) {
  3083. var $1;
  3084. self._try_catch_(aBlock,(function(exception){
  3085. return smalltalk.withContext(function($ctx2) {
  3086. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  3087. if(smalltalk.assert($1)){
  3088. return _st(exceptionBlock)._value_(exception);
  3089. } else {
  3090. return _st(exception)._signal();
  3091. };
  3092. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  3093. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
  3094. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  3095. 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 ] ]",
  3096. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:", "classNamed:", "name"],
  3097. referencedClasses: []
  3098. }),
  3099. smalltalk.Environment);
  3100. smalltalk.addMethod(
  3101. smalltalk.method({
  3102. selector: "inspect:",
  3103. category: 'actions',
  3104. fn: function (anObject){
  3105. var self=this;
  3106. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  3107. return smalltalk.withContext(function($ctx1) {
  3108. _st(_st($InspectorHandler())._inspector())._inspect_(anObject);
  3109. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
  3110. args: ["anObject"],
  3111. source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
  3112. messageSends: ["inspect:", "inspector"],
  3113. referencedClasses: ["InspectorHandler"]
  3114. }),
  3115. smalltalk.Environment);
  3116. smalltalk.addMethod(
  3117. smalltalk.method({
  3118. selector: "moveClass:toPackage:",
  3119. category: 'actions',
  3120. fn: function (aClass,aPackageName){
  3121. var self=this;
  3122. var package_;
  3123. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  3124. return smalltalk.withContext(function($ctx1) {
  3125. var $1,$2,$3;
  3126. package_=_st($Package())._named_(aPackageName);
  3127. $1=package_;
  3128. if(($receiver = $1) == nil || $receiver == undefined){
  3129. self._error_("Invalid package name");
  3130. } else {
  3131. $1;
  3132. };
  3133. $2=_st(package_).__eq_eq(_st(aClass)._package());
  3134. if(smalltalk.assert($2)){
  3135. $3=self;
  3136. return $3;
  3137. };
  3138. _st(aClass)._package_(package_);
  3139. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
  3140. args: ["aClass", "aPackageName"],
  3141. 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",
  3142. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  3143. referencedClasses: ["Package"]
  3144. }),
  3145. smalltalk.Environment);
  3146. smalltalk.addMethod(
  3147. smalltalk.method({
  3148. selector: "moveMethod:toClass:",
  3149. category: 'actions',
  3150. fn: function (aMethod,aClassName){
  3151. var self=this;
  3152. var destinationClass;
  3153. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3154. return smalltalk.withContext(function($ctx1) {
  3155. var $1,$2,$3;
  3156. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  3157. $1=destinationClass;
  3158. if(($receiver = $1) == nil || $receiver == undefined){
  3159. self._error_("Invalid class name");
  3160. } else {
  3161. $1;
  3162. };
  3163. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  3164. if(smalltalk.assert($2)){
  3165. $3=self;
  3166. return $3;
  3167. };
  3168. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  3169. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3170. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  3171. args: ["aMethod", "aClassName"],
  3172. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  3173. messageSends: ["at:", "asSymbol", "current", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  3174. referencedClasses: ["Smalltalk"]
  3175. }),
  3176. smalltalk.Environment);
  3177. smalltalk.addMethod(
  3178. smalltalk.method({
  3179. selector: "moveMethod:toProtocol:",
  3180. category: 'actions',
  3181. fn: function (aMethod,aProtocol){
  3182. var self=this;
  3183. return smalltalk.withContext(function($ctx1) {
  3184. _st(aMethod)._category_(aProtocol);
  3185. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
  3186. args: ["aMethod", "aProtocol"],
  3187. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  3188. messageSends: ["category:"],
  3189. referencedClasses: []
  3190. }),
  3191. smalltalk.Environment);
  3192. smalltalk.addMethod(
  3193. smalltalk.method({
  3194. selector: "packages",
  3195. category: 'accessing',
  3196. fn: function (){
  3197. var self=this;
  3198. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3199. return smalltalk.withContext(function($ctx1) {
  3200. var $1;
  3201. $1=_st(_st($Smalltalk())._current())._packages();
  3202. return $1;
  3203. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
  3204. args: [],
  3205. source: "packages\x0a\x09^ Smalltalk current packages",
  3206. messageSends: ["packages", "current"],
  3207. referencedClasses: ["Smalltalk"]
  3208. }),
  3209. smalltalk.Environment);
  3210. smalltalk.addMethod(
  3211. smalltalk.method({
  3212. selector: "registerErrorHandler:",
  3213. category: 'actions',
  3214. fn: function (anErrorHandler){
  3215. var self=this;
  3216. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  3217. return smalltalk.withContext(function($ctx1) {
  3218. _st($ErrorHandler())._setCurrent_(anErrorHandler);
  3219. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
  3220. args: ["anErrorHandler"],
  3221. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
  3222. messageSends: ["setCurrent:"],
  3223. referencedClasses: ["ErrorHandler"]
  3224. }),
  3225. smalltalk.Environment);
  3226. smalltalk.addMethod(
  3227. smalltalk.method({
  3228. selector: "registerInspector:",
  3229. category: 'actions',
  3230. fn: function (anInspector){
  3231. var self=this;
  3232. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  3233. return smalltalk.withContext(function($ctx1) {
  3234. _st($InspectorHandler())._register_(anInspector);
  3235. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
  3236. args: ["anInspector"],
  3237. source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
  3238. messageSends: ["register:"],
  3239. referencedClasses: ["InspectorHandler"]
  3240. }),
  3241. smalltalk.Environment);
  3242. smalltalk.addMethod(
  3243. smalltalk.method({
  3244. selector: "registerProgressHandler:",
  3245. category: 'actions',
  3246. fn: function (aProgressHandler){
  3247. var self=this;
  3248. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  3249. return smalltalk.withContext(function($ctx1) {
  3250. _st($ProgressHandler())._setCurrent_(aProgressHandler);
  3251. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
  3252. args: ["aProgressHandler"],
  3253. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
  3254. messageSends: ["setCurrent:"],
  3255. referencedClasses: ["ProgressHandler"]
  3256. }),
  3257. smalltalk.Environment);
  3258. smalltalk.addMethod(
  3259. smalltalk.method({
  3260. selector: "removeClass:",
  3261. category: 'actions',
  3262. fn: function (aClass){
  3263. var self=this;
  3264. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3265. return smalltalk.withContext(function($ctx1) {
  3266. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  3267. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
  3268. args: ["aClass"],
  3269. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  3270. messageSends: ["removeClass:", "current"],
  3271. referencedClasses: ["Smalltalk"]
  3272. }),
  3273. smalltalk.Environment);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "removeMethod:",
  3277. category: 'actions',
  3278. fn: function (aMethod){
  3279. var self=this;
  3280. return smalltalk.withContext(function($ctx1) {
  3281. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  3282. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  3283. args: ["aMethod"],
  3284. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  3285. messageSends: ["removeCompiledMethod:", "methodClass"],
  3286. referencedClasses: []
  3287. }),
  3288. smalltalk.Environment);
  3289. smalltalk.addMethod(
  3290. smalltalk.method({
  3291. selector: "removeProtocol:from:",
  3292. category: 'actions',
  3293. fn: function (aString,aClass){
  3294. var self=this;
  3295. return smalltalk.withContext(function($ctx1) {
  3296. _st(_st(_st(aClass)._methods())._select_((function(each){
  3297. return smalltalk.withContext(function($ctx2) {
  3298. return _st(_st(each)._protocol()).__eq(aString);
  3299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3300. return smalltalk.withContext(function($ctx2) {
  3301. return _st(aClass)._removeCompiledMethod_(each);
  3302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3303. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  3304. args: ["aString", "aClass"],
  3305. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  3306. messageSends: ["do:", "removeCompiledMethod:", "select:", "=", "protocol", "methods"],
  3307. referencedClasses: []
  3308. }),
  3309. smalltalk.Environment);
  3310. smalltalk.addMethod(
  3311. smalltalk.method({
  3312. selector: "renameClass:to:",
  3313. category: 'actions',
  3314. fn: function (aClass,aClassName){
  3315. var self=this;
  3316. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3317. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  3318. return smalltalk.withContext(function($ctx1) {
  3319. var $1;
  3320. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  3321. if(($receiver = $1) == nil || $receiver == undefined){
  3322. $1;
  3323. } else {
  3324. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  3325. };
  3326. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  3327. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  3328. args: ["aClass", "aClassName"],
  3329. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  3330. messageSends: ["ifNotNil:", "error:", ",", "at:", "current", "renameClass:to:", "new"],
  3331. referencedClasses: ["Smalltalk", "ClassBuilder"]
  3332. }),
  3333. smalltalk.Environment);
  3334. smalltalk.addMethod(
  3335. smalltalk.method({
  3336. selector: "renameProtocol:to:in:",
  3337. category: 'actions',
  3338. fn: function (aString,anotherString,aClass){
  3339. var self=this;
  3340. return smalltalk.withContext(function($ctx1) {
  3341. _st(_st(_st(aClass)._methods())._select_((function(each){
  3342. return smalltalk.withContext(function($ctx2) {
  3343. return _st(_st(each)._protocol()).__eq(aString);
  3344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._do_((function(each){
  3345. return smalltalk.withContext(function($ctx2) {
  3346. return _st(each)._protocol_(anotherString);
  3347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3348. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  3349. args: ["aString", "anotherString", "aClass"],
  3350. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  3351. messageSends: ["do:", "protocol:", "select:", "=", "protocol", "methods"],
  3352. referencedClasses: []
  3353. }),
  3354. smalltalk.Environment);
  3355. smalltalk.addMethod(
  3356. smalltalk.method({
  3357. selector: "setClassCommentOf:to:",
  3358. category: 'actions',
  3359. fn: function (aClass,aString){
  3360. var self=this;
  3361. return smalltalk.withContext(function($ctx1) {
  3362. _st(aClass)._comment_(aString);
  3363. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
  3364. args: ["aClass", "aString"],
  3365. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  3366. messageSends: ["comment:"],
  3367. referencedClasses: []
  3368. }),
  3369. smalltalk.Environment);
  3370. smalltalk.addMethod(
  3371. smalltalk.method({
  3372. selector: "systemAnnouncer",
  3373. category: 'accessing',
  3374. fn: function (){
  3375. var self=this;
  3376. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $1;
  3379. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  3380. return $1;
  3381. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  3382. args: [],
  3383. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  3384. messageSends: ["current", "at:"],
  3385. referencedClasses: ["Smalltalk"]
  3386. }),
  3387. smalltalk.Environment);
  3388. smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Objects');
  3389. smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
  3390. smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
  3391. smalltalk.addMethod(
  3392. smalltalk.method({
  3393. selector: "inspect:",
  3394. category: 'registration',
  3395. fn: function (anObject){
  3396. var self=this;
  3397. return smalltalk.withContext(function($ctx1) {
  3398. var $1;
  3399. $1=_st(self._inspector())._inspect_(anObject);
  3400. return $1;
  3401. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
  3402. args: ["anObject"],
  3403. source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
  3404. messageSends: ["inspect:", "inspector"],
  3405. referencedClasses: []
  3406. }),
  3407. smalltalk.InspectorHandler.klass);
  3408. smalltalk.addMethod(
  3409. smalltalk.method({
  3410. selector: "inspector",
  3411. category: 'accessing',
  3412. fn: function (){
  3413. var self=this;
  3414. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  3415. return smalltalk.withContext(function($ctx1) {
  3416. var $2,$1;
  3417. $2=self["@inspector"];
  3418. if(($receiver = $2) == nil || $receiver == undefined){
  3419. self["@inspector"]=$Transcript();
  3420. $1=self["@inspector"];
  3421. } else {
  3422. $1=$2;
  3423. };
  3424. return $1;
  3425. }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
  3426. args: [],
  3427. source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
  3428. messageSends: ["ifNil:"],
  3429. referencedClasses: ["Transcript"]
  3430. }),
  3431. smalltalk.InspectorHandler.klass);
  3432. smalltalk.addMethod(
  3433. smalltalk.method({
  3434. selector: "register:",
  3435. category: 'registration',
  3436. fn: function (anInspector){
  3437. var self=this;
  3438. return smalltalk.withContext(function($ctx1) {
  3439. self["@inspector"]=anInspector;
  3440. return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
  3441. args: ["anInspector"],
  3442. source: "register: anInspector\x0a\x09inspector := anInspector",
  3443. messageSends: [],
  3444. referencedClasses: []
  3445. }),
  3446. smalltalk.InspectorHandler.klass);
  3447. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  3448. smalltalk.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`.";
  3449. smalltalk.addMethod(
  3450. smalltalk.method({
  3451. selector: "addObjectVariablesTo:",
  3452. category: 'proxy',
  3453. fn: function (aDictionary){
  3454. var self=this;
  3455. return smalltalk.withContext(function($ctx1) {
  3456. for(var i in self['@jsObject']) {
  3457. aDictionary._at_put_(i, self['@jsObject'][i]);
  3458. }
  3459. ;
  3460. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  3461. args: ["aDictionary"],
  3462. 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>",
  3463. messageSends: [],
  3464. referencedClasses: []
  3465. }),
  3466. smalltalk.JSObjectProxy);
  3467. smalltalk.addMethod(
  3468. smalltalk.method({
  3469. selector: "at:",
  3470. category: 'accessing',
  3471. fn: function (aString){
  3472. var self=this;
  3473. return smalltalk.withContext(function($ctx1) {
  3474. return self['@jsObject'][aString];
  3475. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  3476. args: ["aString"],
  3477. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  3478. messageSends: [],
  3479. referencedClasses: []
  3480. }),
  3481. smalltalk.JSObjectProxy);
  3482. smalltalk.addMethod(
  3483. smalltalk.method({
  3484. selector: "at:ifAbsent:",
  3485. category: 'accessing',
  3486. fn: function (aString,aBlock){
  3487. var self=this;
  3488. return smalltalk.withContext(function($ctx1) {
  3489. var obj = self['@jsObject'];
  3490. return aString in obj ? obj[aString] : aBlock._value();
  3491. ;
  3492. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3493. args: ["aString", "aBlock"],
  3494. 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>",
  3495. messageSends: [],
  3496. referencedClasses: []
  3497. }),
  3498. smalltalk.JSObjectProxy);
  3499. smalltalk.addMethod(
  3500. smalltalk.method({
  3501. selector: "at:ifPresent:",
  3502. category: 'accessing',
  3503. fn: function (aString,aBlock){
  3504. var self=this;
  3505. return smalltalk.withContext(function($ctx1) {
  3506. var obj = self['@jsObject'];
  3507. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  3508. ;
  3509. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3510. args: ["aString", "aBlock"],
  3511. 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>",
  3512. messageSends: [],
  3513. referencedClasses: []
  3514. }),
  3515. smalltalk.JSObjectProxy);
  3516. smalltalk.addMethod(
  3517. smalltalk.method({
  3518. selector: "at:ifPresent:ifAbsent:",
  3519. category: 'accessing',
  3520. fn: function (aString,aBlock,anotherBlock){
  3521. var self=this;
  3522. return smalltalk.withContext(function($ctx1) {
  3523. var obj = self['@jsObject'];
  3524. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  3525. ;
  3526. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  3527. args: ["aString", "aBlock", "anotherBlock"],
  3528. 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>",
  3529. messageSends: [],
  3530. referencedClasses: []
  3531. }),
  3532. smalltalk.JSObjectProxy);
  3533. smalltalk.addMethod(
  3534. smalltalk.method({
  3535. selector: "at:put:",
  3536. category: 'accessing',
  3537. fn: function (aString,anObject){
  3538. var self=this;
  3539. return smalltalk.withContext(function($ctx1) {
  3540. self['@jsObject'][aString] = anObject;
  3541. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  3542. args: ["aString", "anObject"],
  3543. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  3544. messageSends: [],
  3545. referencedClasses: []
  3546. }),
  3547. smalltalk.JSObjectProxy);
  3548. smalltalk.addMethod(
  3549. smalltalk.method({
  3550. selector: "doesNotUnderstand:",
  3551. category: 'proxy',
  3552. fn: function (aMessage){
  3553. var self=this;
  3554. return smalltalk.withContext(function($ctx1) {
  3555. var $2,$1;
  3556. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  3557. if(($receiver = $2) == nil || $receiver == undefined){
  3558. $1=smalltalk.Object.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  3559. } else {
  3560. var jsSelector;
  3561. jsSelector=$receiver;
  3562. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  3563. };
  3564. return $1;
  3565. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  3566. args: ["aMessage"],
  3567. 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 ]",
  3568. messageSends: ["ifNil:ifNotNil:", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments", "lookupProperty:", "asJavaScriptSelector", "selector"],
  3569. referencedClasses: []
  3570. }),
  3571. smalltalk.JSObjectProxy);
  3572. smalltalk.addMethod(
  3573. smalltalk.method({
  3574. selector: "forwardMessage:withArguments:",
  3575. category: 'proxy',
  3576. fn: function (aString,anArray){
  3577. var self=this;
  3578. return smalltalk.withContext(function($ctx1) {
  3579. return smalltalk.send(self._jsObject(), aString, anArray);
  3580. ;
  3581. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  3582. args: ["aString", "anArray"],
  3583. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  3584. messageSends: [],
  3585. referencedClasses: []
  3586. }),
  3587. smalltalk.JSObjectProxy);
  3588. smalltalk.addMethod(
  3589. smalltalk.method({
  3590. selector: "inspectOn:",
  3591. category: 'proxy',
  3592. fn: function (anInspector){
  3593. var self=this;
  3594. var variables;
  3595. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3596. return smalltalk.withContext(function($ctx1) {
  3597. variables=_st($Dictionary())._new();
  3598. _st(variables)._at_put_("#self",self._jsObject());
  3599. _st(anInspector)._setLabel_(self._printString());
  3600. self._addObjectVariablesTo_(variables);
  3601. _st(anInspector)._setVariables_(variables);
  3602. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  3603. args: ["anInspector"],
  3604. 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",
  3605. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  3606. referencedClasses: ["Dictionary"]
  3607. }),
  3608. smalltalk.JSObjectProxy);
  3609. smalltalk.addMethod(
  3610. smalltalk.method({
  3611. selector: "jsObject",
  3612. category: 'accessing',
  3613. fn: function (){
  3614. var self=this;
  3615. return smalltalk.withContext(function($ctx1) {
  3616. var $1;
  3617. $1=self["@jsObject"];
  3618. return $1;
  3619. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  3620. args: [],
  3621. source: "jsObject\x0a\x09^jsObject",
  3622. messageSends: [],
  3623. referencedClasses: []
  3624. }),
  3625. smalltalk.JSObjectProxy);
  3626. smalltalk.addMethod(
  3627. smalltalk.method({
  3628. selector: "jsObject:",
  3629. category: 'accessing',
  3630. fn: function (aJSObject){
  3631. var self=this;
  3632. return smalltalk.withContext(function($ctx1) {
  3633. self["@jsObject"]=aJSObject;
  3634. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  3635. args: ["aJSObject"],
  3636. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  3637. messageSends: [],
  3638. referencedClasses: []
  3639. }),
  3640. smalltalk.JSObjectProxy);
  3641. smalltalk.addMethod(
  3642. smalltalk.method({
  3643. selector: "keysAndValuesDo:",
  3644. category: 'enumerating',
  3645. fn: function (aBlock){
  3646. var self=this;
  3647. return smalltalk.withContext(function($ctx1) {
  3648. var o = self['@jsObject'];
  3649. for(var i in o) {
  3650. aBlock._value_value_(i, o[i]);
  3651. }
  3652. ;
  3653. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  3654. args: ["aBlock"],
  3655. 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>",
  3656. messageSends: [],
  3657. referencedClasses: []
  3658. }),
  3659. smalltalk.JSObjectProxy);
  3660. smalltalk.addMethod(
  3661. smalltalk.method({
  3662. selector: "lookupProperty:",
  3663. category: 'accessing',
  3664. fn: function (aString){
  3665. var self=this;
  3666. return smalltalk.withContext(function($ctx1) {
  3667. return aString in self._jsObject() ? aString : nil;
  3668. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  3669. args: ["aString"],
  3670. 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>",
  3671. messageSends: [],
  3672. referencedClasses: []
  3673. }),
  3674. smalltalk.JSObjectProxy);
  3675. smalltalk.addMethod(
  3676. smalltalk.method({
  3677. selector: "printOn:",
  3678. category: 'printing',
  3679. fn: function (aStream){
  3680. var self=this;
  3681. return smalltalk.withContext(function($ctx1) {
  3682. _st(aStream)._nextPutAll_(_st(self._jsObject())._toString());
  3683. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  3684. args: ["aStream"],
  3685. source: "printOn: aStream\x0a\x09aStream nextPutAll: self jsObject toString",
  3686. messageSends: ["nextPutAll:", "toString", "jsObject"],
  3687. referencedClasses: []
  3688. }),
  3689. smalltalk.JSObjectProxy);
  3690. smalltalk.addMethod(
  3691. smalltalk.method({
  3692. selector: "value",
  3693. category: 'accessing',
  3694. fn: function (){
  3695. var self=this;
  3696. return smalltalk.withContext(function($ctx1) {
  3697. var $1;
  3698. $1=self._at_ifAbsent_("value",(function(){
  3699. return smalltalk.withContext(function($ctx2) {
  3700. return smalltalk.Object.fn.prototype._value.apply(_st(self), []);
  3701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3702. return $1;
  3703. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  3704. args: [],
  3705. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
  3706. messageSends: ["at:ifAbsent:", "value"],
  3707. referencedClasses: []
  3708. }),
  3709. smalltalk.JSObjectProxy);
  3710. smalltalk.addMethod(
  3711. smalltalk.method({
  3712. selector: "on:",
  3713. category: 'instance creation',
  3714. fn: function (aJSObject){
  3715. var self=this;
  3716. return smalltalk.withContext(function($ctx1) {
  3717. var $2,$3,$1;
  3718. $2=self._new();
  3719. _st($2)._jsObject_(aJSObject);
  3720. $3=_st($2)._yourself();
  3721. $1=$3;
  3722. return $1;
  3723. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  3724. args: ["aJSObject"],
  3725. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  3726. messageSends: ["jsObject:", "new", "yourself"],
  3727. referencedClasses: []
  3728. }),
  3729. smalltalk.JSObjectProxy.klass);
  3730. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  3731. smalltalk.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].";
  3732. smalltalk.addMethod(
  3733. smalltalk.method({
  3734. selector: "&",
  3735. category: 'converting',
  3736. fn: function (aNumber){
  3737. var self=this;
  3738. return smalltalk.withContext(function($ctx1) {
  3739. return self & aNumber;
  3740. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  3741. args: ["aNumber"],
  3742. source: "& aNumber\x0a\x09<return self & aNumber>",
  3743. messageSends: [],
  3744. referencedClasses: []
  3745. }),
  3746. smalltalk.Number);
  3747. smalltalk.addMethod(
  3748. smalltalk.method({
  3749. selector: "*",
  3750. category: 'arithmetic',
  3751. fn: function (aNumber){
  3752. var self=this;
  3753. return smalltalk.withContext(function($ctx1) {
  3754. return self * aNumber;
  3755. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  3756. args: ["aNumber"],
  3757. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3758. messageSends: [],
  3759. referencedClasses: []
  3760. }),
  3761. smalltalk.Number);
  3762. smalltalk.addMethod(
  3763. smalltalk.method({
  3764. selector: "+",
  3765. category: 'arithmetic',
  3766. fn: function (aNumber){
  3767. var self=this;
  3768. return smalltalk.withContext(function($ctx1) {
  3769. return self + aNumber;
  3770. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  3771. args: ["aNumber"],
  3772. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3773. messageSends: [],
  3774. referencedClasses: []
  3775. }),
  3776. smalltalk.Number);
  3777. smalltalk.addMethod(
  3778. smalltalk.method({
  3779. selector: "-",
  3780. category: 'arithmetic',
  3781. fn: function (aNumber){
  3782. var self=this;
  3783. return smalltalk.withContext(function($ctx1) {
  3784. return self - aNumber;
  3785. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  3786. args: ["aNumber"],
  3787. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3788. messageSends: [],
  3789. referencedClasses: []
  3790. }),
  3791. smalltalk.Number);
  3792. smalltalk.addMethod(
  3793. smalltalk.method({
  3794. selector: "/",
  3795. category: 'arithmetic',
  3796. fn: function (aNumber){
  3797. var self=this;
  3798. return smalltalk.withContext(function($ctx1) {
  3799. return self / aNumber;
  3800. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  3801. args: ["aNumber"],
  3802. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3803. messageSends: [],
  3804. referencedClasses: []
  3805. }),
  3806. smalltalk.Number);
  3807. smalltalk.addMethod(
  3808. smalltalk.method({
  3809. selector: "<",
  3810. category: 'comparing',
  3811. fn: function (aNumber){
  3812. var self=this;
  3813. return smalltalk.withContext(function($ctx1) {
  3814. return self < aNumber;
  3815. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  3816. args: ["aNumber"],
  3817. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3818. messageSends: [],
  3819. referencedClasses: []
  3820. }),
  3821. smalltalk.Number);
  3822. smalltalk.addMethod(
  3823. smalltalk.method({
  3824. selector: "<=",
  3825. category: 'comparing',
  3826. fn: function (aNumber){
  3827. var self=this;
  3828. return smalltalk.withContext(function($ctx1) {
  3829. return self <= aNumber;
  3830. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  3831. args: ["aNumber"],
  3832. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3833. messageSends: [],
  3834. referencedClasses: []
  3835. }),
  3836. smalltalk.Number);
  3837. smalltalk.addMethod(
  3838. smalltalk.method({
  3839. selector: "=",
  3840. category: 'comparing',
  3841. fn: function (aNumber){
  3842. var self=this;
  3843. return smalltalk.withContext(function($ctx1) {
  3844. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  3845. return false;
  3846. }
  3847. return Number(self) == aNumber
  3848. ;
  3849. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  3850. args: ["aNumber"],
  3851. source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>",
  3852. messageSends: [],
  3853. referencedClasses: []
  3854. }),
  3855. smalltalk.Number);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: ">",
  3859. category: 'comparing',
  3860. fn: function (aNumber){
  3861. var self=this;
  3862. return smalltalk.withContext(function($ctx1) {
  3863. return self > aNumber;
  3864. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  3865. args: ["aNumber"],
  3866. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3867. messageSends: [],
  3868. referencedClasses: []
  3869. }),
  3870. smalltalk.Number);
  3871. smalltalk.addMethod(
  3872. smalltalk.method({
  3873. selector: ">=",
  3874. category: 'comparing',
  3875. fn: function (aNumber){
  3876. var self=this;
  3877. return smalltalk.withContext(function($ctx1) {
  3878. return self >= aNumber;
  3879. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  3880. args: ["aNumber"],
  3881. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3882. messageSends: [],
  3883. referencedClasses: []
  3884. }),
  3885. smalltalk.Number);
  3886. smalltalk.addMethod(
  3887. smalltalk.method({
  3888. selector: "@",
  3889. category: 'converting',
  3890. fn: function (aNumber){
  3891. var self=this;
  3892. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3893. return smalltalk.withContext(function($ctx1) {
  3894. var $1;
  3895. $1=_st($Point())._x_y_(self,aNumber);
  3896. return $1;
  3897. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  3898. args: ["aNumber"],
  3899. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3900. messageSends: ["x:y:"],
  3901. referencedClasses: ["Point"]
  3902. }),
  3903. smalltalk.Number);
  3904. smalltalk.addMethod(
  3905. smalltalk.method({
  3906. selector: "\x5c\x5c",
  3907. category: 'arithmetic',
  3908. fn: function (aNumber){
  3909. var self=this;
  3910. return smalltalk.withContext(function($ctx1) {
  3911. return self % aNumber;
  3912. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  3913. args: ["aNumber"],
  3914. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3915. messageSends: [],
  3916. referencedClasses: []
  3917. }),
  3918. smalltalk.Number);
  3919. smalltalk.addMethod(
  3920. smalltalk.method({
  3921. selector: "abs",
  3922. category: 'arithmetic',
  3923. fn: function (){
  3924. var self=this;
  3925. return smalltalk.withContext(function($ctx1) {
  3926. return Math.abs(self);;
  3927. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  3928. args: [],
  3929. source: "abs\x0a\x09<return Math.abs(self);>",
  3930. messageSends: [],
  3931. referencedClasses: []
  3932. }),
  3933. smalltalk.Number);
  3934. smalltalk.addMethod(
  3935. smalltalk.method({
  3936. selector: "asJSON",
  3937. category: 'converting',
  3938. fn: function (){
  3939. var self=this;
  3940. return smalltalk.withContext(function($ctx1) {
  3941. var $1;
  3942. $1=self;
  3943. return $1;
  3944. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  3945. args: [],
  3946. source: "asJSON\x0a\x09^self",
  3947. messageSends: [],
  3948. referencedClasses: []
  3949. }),
  3950. smalltalk.Number);
  3951. smalltalk.addMethod(
  3952. smalltalk.method({
  3953. selector: "asJavascript",
  3954. category: 'converting',
  3955. fn: function (){
  3956. var self=this;
  3957. return smalltalk.withContext(function($ctx1) {
  3958. var $1;
  3959. $1=_st("(".__comma(self._printString())).__comma(")");
  3960. return $1;
  3961. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  3962. args: [],
  3963. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3964. messageSends: [",", "printString"],
  3965. referencedClasses: []
  3966. }),
  3967. smalltalk.Number);
  3968. smalltalk.addMethod(
  3969. smalltalk.method({
  3970. selector: "asPoint",
  3971. category: 'converting',
  3972. fn: function (){
  3973. var self=this;
  3974. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3975. return smalltalk.withContext(function($ctx1) {
  3976. var $1;
  3977. $1=_st($Point())._x_y_(self,self);
  3978. return $1;
  3979. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  3980. args: [],
  3981. source: "asPoint\x0a\x09^Point x: self y: self",
  3982. messageSends: ["x:y:"],
  3983. referencedClasses: ["Point"]
  3984. }),
  3985. smalltalk.Number);
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "asString",
  3989. category: 'converting',
  3990. fn: function (){
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) {
  3993. return String(self) ;
  3994. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  3995. args: [],
  3996. source: "asString\x0a\x09< return String(self) >",
  3997. messageSends: [],
  3998. referencedClasses: []
  3999. }),
  4000. smalltalk.Number);
  4001. smalltalk.addMethod(
  4002. smalltalk.method({
  4003. selector: "atRandom",
  4004. category: 'converting',
  4005. fn: function (){
  4006. var self=this;
  4007. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  4008. return smalltalk.withContext(function($ctx1) {
  4009. var $1;
  4010. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  4011. return $1;
  4012. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  4013. args: [],
  4014. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  4015. messageSends: ["+", "truncated", "*", "next", "new"],
  4016. referencedClasses: ["Random"]
  4017. }),
  4018. smalltalk.Number);
  4019. smalltalk.addMethod(
  4020. smalltalk.method({
  4021. selector: "copy",
  4022. category: 'copying',
  4023. fn: function (){
  4024. var self=this;
  4025. return smalltalk.withContext(function($ctx1) {
  4026. var $1;
  4027. $1=self;
  4028. return $1;
  4029. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  4030. args: [],
  4031. source: "copy\x0a\x09^self",
  4032. messageSends: [],
  4033. referencedClasses: []
  4034. }),
  4035. smalltalk.Number);
  4036. smalltalk.addMethod(
  4037. smalltalk.method({
  4038. selector: "deepCopy",
  4039. category: 'copying',
  4040. fn: function (){
  4041. var self=this;
  4042. return smalltalk.withContext(function($ctx1) {
  4043. var $1;
  4044. $1=self._copy();
  4045. return $1;
  4046. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  4047. args: [],
  4048. source: "deepCopy\x0a\x09^self copy",
  4049. messageSends: ["copy"],
  4050. referencedClasses: []
  4051. }),
  4052. smalltalk.Number);
  4053. smalltalk.addMethod(
  4054. smalltalk.method({
  4055. selector: "even",
  4056. category: 'testing',
  4057. fn: function (){
  4058. var self=this;
  4059. return smalltalk.withContext(function($ctx1) {
  4060. var $1;
  4061. $1=(0).__eq(self.__backslash_backslash((2)));
  4062. return $1;
  4063. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  4064. args: [],
  4065. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4066. messageSends: ["=", "\x5c\x5c"],
  4067. referencedClasses: []
  4068. }),
  4069. smalltalk.Number);
  4070. smalltalk.addMethod(
  4071. smalltalk.method({
  4072. selector: "identityHash",
  4073. category: 'accessing',
  4074. fn: function (){
  4075. var self=this;
  4076. return smalltalk.withContext(function($ctx1) {
  4077. var $1;
  4078. $1=_st(self._asString()).__comma("n");
  4079. return $1;
  4080. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  4081. args: [],
  4082. source: "identityHash\x0a\x09^self asString, 'n'",
  4083. messageSends: [",", "asString"],
  4084. referencedClasses: []
  4085. }),
  4086. smalltalk.Number);
  4087. smalltalk.addMethod(
  4088. smalltalk.method({
  4089. selector: "isImmutable",
  4090. category: 'testing',
  4091. fn: function (){
  4092. var self=this;
  4093. return smalltalk.withContext(function($ctx1) {
  4094. return true;
  4095. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Number)})},
  4096. args: [],
  4097. source: "isImmutable\x0a\x09^ true",
  4098. messageSends: [],
  4099. referencedClasses: []
  4100. }),
  4101. smalltalk.Number);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "isNumber",
  4105. category: 'testing',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. return true;
  4110. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  4111. args: [],
  4112. source: "isNumber\x0a\x09^true",
  4113. messageSends: [],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.Number);
  4117. smalltalk.addMethod(
  4118. smalltalk.method({
  4119. selector: "isZero",
  4120. category: 'testing',
  4121. fn: function (){
  4122. var self=this;
  4123. return smalltalk.withContext(function($ctx1) {
  4124. var $1;
  4125. $1=self.__eq((0));
  4126. return $1;
  4127. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  4128. args: [],
  4129. source: "isZero\x0a\x09^self = 0",
  4130. messageSends: ["="],
  4131. referencedClasses: []
  4132. }),
  4133. smalltalk.Number);
  4134. smalltalk.addMethod(
  4135. smalltalk.method({
  4136. selector: "max:",
  4137. category: 'arithmetic',
  4138. fn: function (aNumber){
  4139. var self=this;
  4140. return smalltalk.withContext(function($ctx1) {
  4141. return Math.max(self, aNumber);;
  4142. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  4143. args: ["aNumber"],
  4144. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4145. messageSends: [],
  4146. referencedClasses: []
  4147. }),
  4148. smalltalk.Number);
  4149. smalltalk.addMethod(
  4150. smalltalk.method({
  4151. selector: "min:",
  4152. category: 'arithmetic',
  4153. fn: function (aNumber){
  4154. var self=this;
  4155. return smalltalk.withContext(function($ctx1) {
  4156. return Math.min(self, aNumber);;
  4157. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  4158. args: ["aNumber"],
  4159. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4160. messageSends: [],
  4161. referencedClasses: []
  4162. }),
  4163. smalltalk.Number);
  4164. smalltalk.addMethod(
  4165. smalltalk.method({
  4166. selector: "negated",
  4167. category: 'arithmetic',
  4168. fn: function (){
  4169. var self=this;
  4170. return smalltalk.withContext(function($ctx1) {
  4171. var $1;
  4172. $1=(0).__minus(self);
  4173. return $1;
  4174. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  4175. args: [],
  4176. source: "negated\x0a\x09^0 - self",
  4177. messageSends: ["-"],
  4178. referencedClasses: []
  4179. }),
  4180. smalltalk.Number);
  4181. smalltalk.addMethod(
  4182. smalltalk.method({
  4183. selector: "negative",
  4184. category: 'testing',
  4185. fn: function (){
  4186. var self=this;
  4187. return smalltalk.withContext(function($ctx1) {
  4188. var $1;
  4189. $1=self.__lt((0));
  4190. return $1;
  4191. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  4192. args: [],
  4193. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4194. messageSends: ["<"],
  4195. referencedClasses: []
  4196. }),
  4197. smalltalk.Number);
  4198. smalltalk.addMethod(
  4199. smalltalk.method({
  4200. selector: "odd",
  4201. category: 'testing',
  4202. fn: function (){
  4203. var self=this;
  4204. return smalltalk.withContext(function($ctx1) {
  4205. var $1;
  4206. $1=_st(self._even())._not();
  4207. return $1;
  4208. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  4209. args: [],
  4210. source: "odd\x0a\x09^ self even not",
  4211. messageSends: ["not", "even"],
  4212. referencedClasses: []
  4213. }),
  4214. smalltalk.Number);
  4215. smalltalk.addMethod(
  4216. smalltalk.method({
  4217. selector: "positive",
  4218. category: 'testing',
  4219. fn: function (){
  4220. var self=this;
  4221. return smalltalk.withContext(function($ctx1) {
  4222. var $1;
  4223. $1=self.__gt_eq((0));
  4224. return $1;
  4225. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  4226. args: [],
  4227. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4228. messageSends: [">="],
  4229. referencedClasses: []
  4230. }),
  4231. smalltalk.Number);
  4232. smalltalk.addMethod(
  4233. smalltalk.method({
  4234. selector: "printOn:",
  4235. category: 'printing',
  4236. fn: function (aStream){
  4237. var self=this;
  4238. return smalltalk.withContext(function($ctx1) {
  4239. _st(aStream)._nextPutAll_(self._asString());
  4240. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  4241. args: ["aStream"],
  4242. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4243. messageSends: ["nextPutAll:", "asString"],
  4244. referencedClasses: []
  4245. }),
  4246. smalltalk.Number);
  4247. smalltalk.addMethod(
  4248. smalltalk.method({
  4249. selector: "printShowingDecimalPlaces:",
  4250. category: 'printing',
  4251. fn: function (placesDesired){
  4252. var self=this;
  4253. return smalltalk.withContext(function($ctx1) {
  4254. return self.toFixed(placesDesired);
  4255. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  4256. args: ["placesDesired"],
  4257. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4258. messageSends: [],
  4259. referencedClasses: []
  4260. }),
  4261. smalltalk.Number);
  4262. smalltalk.addMethod(
  4263. smalltalk.method({
  4264. selector: "rounded",
  4265. category: 'converting',
  4266. fn: function (){
  4267. var self=this;
  4268. return smalltalk.withContext(function($ctx1) {
  4269. return Math.round(self);;
  4270. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  4271. args: [],
  4272. source: "rounded\x0a\x09<return Math.round(self);>",
  4273. messageSends: [],
  4274. referencedClasses: []
  4275. }),
  4276. smalltalk.Number);
  4277. smalltalk.addMethod(
  4278. smalltalk.method({
  4279. selector: "sqrt",
  4280. category: 'arithmetic',
  4281. fn: function (){
  4282. var self=this;
  4283. return smalltalk.withContext(function($ctx1) {
  4284. return Math.sqrt(self);
  4285. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  4286. args: [],
  4287. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4288. messageSends: [],
  4289. referencedClasses: []
  4290. }),
  4291. smalltalk.Number);
  4292. smalltalk.addMethod(
  4293. smalltalk.method({
  4294. selector: "squared",
  4295. category: 'arithmetic',
  4296. fn: function (){
  4297. var self=this;
  4298. return smalltalk.withContext(function($ctx1) {
  4299. var $1;
  4300. $1=self.__star(self);
  4301. return $1;
  4302. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  4303. args: [],
  4304. source: "squared\x0a\x09^self * self",
  4305. messageSends: ["*"],
  4306. referencedClasses: []
  4307. }),
  4308. smalltalk.Number);
  4309. smalltalk.addMethod(
  4310. smalltalk.method({
  4311. selector: "timesRepeat:",
  4312. category: 'enumerating',
  4313. fn: function (aBlock){
  4314. var self=this;
  4315. var count;
  4316. return smalltalk.withContext(function($ctx1) {
  4317. count=(1);
  4318. _st((function(){
  4319. return smalltalk.withContext(function($ctx2) {
  4320. return _st(count).__gt(self);
  4321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  4322. return smalltalk.withContext(function($ctx2) {
  4323. _st(aBlock)._value();
  4324. count=_st(count).__plus((1));
  4325. return count;
  4326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4327. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  4328. args: ["aBlock"],
  4329. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  4330. messageSends: ["whileFalse:", "value", "+", ">"],
  4331. referencedClasses: []
  4332. }),
  4333. smalltalk.Number);
  4334. smalltalk.addMethod(
  4335. smalltalk.method({
  4336. selector: "to:",
  4337. category: 'converting',
  4338. fn: function (aNumber){
  4339. var self=this;
  4340. var array,first,last,count;
  4341. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4342. return smalltalk.withContext(function($ctx1) {
  4343. var $1;
  4344. first=self._truncated();
  4345. last=_st(_st(aNumber)._truncated()).__plus((1));
  4346. count=(1);
  4347. array=_st($Array())._new();
  4348. _st(_st(last).__minus(first))._timesRepeat_((function(){
  4349. return smalltalk.withContext(function($ctx2) {
  4350. _st(array)._at_put_(count,first);
  4351. count=_st(count).__plus((1));
  4352. count;
  4353. first=_st(first).__plus((1));
  4354. return first;
  4355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4356. $1=array;
  4357. return $1;
  4358. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  4359. args: ["aNumber"],
  4360. 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",
  4361. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  4362. referencedClasses: ["Array"]
  4363. }),
  4364. smalltalk.Number);
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "to:by:",
  4368. category: 'converting',
  4369. fn: function (stop,step){
  4370. var self=this;
  4371. var array,value,pos;
  4372. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  4373. return smalltalk.withContext(function($ctx1) {
  4374. var $1,$2,$3;
  4375. value=self;
  4376. array=_st($Array())._new();
  4377. pos=(1);
  4378. $1=_st(step).__eq((0));
  4379. if(smalltalk.assert($1)){
  4380. self._error_("step must be non-zero");
  4381. };
  4382. $2=_st(step).__lt((0));
  4383. if(smalltalk.assert($2)){
  4384. _st((function(){
  4385. return smalltalk.withContext(function($ctx2) {
  4386. return _st(value).__gt_eq(stop);
  4387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4388. return smalltalk.withContext(function($ctx2) {
  4389. _st(array)._at_put_(pos,value);
  4390. pos=_st(pos).__plus((1));
  4391. pos;
  4392. value=_st(value).__plus(step);
  4393. return value;
  4394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4395. } else {
  4396. _st((function(){
  4397. return smalltalk.withContext(function($ctx2) {
  4398. return _st(value).__lt_eq(stop);
  4399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4400. return smalltalk.withContext(function($ctx2) {
  4401. _st(array)._at_put_(pos,value);
  4402. pos=_st(pos).__plus((1));
  4403. pos;
  4404. value=_st(value).__plus(step);
  4405. return value;
  4406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4407. };
  4408. $3=array;
  4409. return $3;
  4410. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  4411. args: ["stop", "step"],
  4412. 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",
  4413. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  4414. referencedClasses: ["Array"]
  4415. }),
  4416. smalltalk.Number);
  4417. smalltalk.addMethod(
  4418. smalltalk.method({
  4419. selector: "to:by:do:",
  4420. category: 'enumerating',
  4421. fn: function (stop,step,aBlock){
  4422. var self=this;
  4423. var value;
  4424. return smalltalk.withContext(function($ctx1) {
  4425. var $1,$2;
  4426. value=self;
  4427. $1=_st(step).__eq((0));
  4428. if(smalltalk.assert($1)){
  4429. self._error_("step must be non-zero");
  4430. };
  4431. $2=_st(step).__lt((0));
  4432. if(smalltalk.assert($2)){
  4433. _st((function(){
  4434. return smalltalk.withContext(function($ctx2) {
  4435. return _st(value).__gt_eq(stop);
  4436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4437. return smalltalk.withContext(function($ctx2) {
  4438. _st(aBlock)._value_(value);
  4439. value=_st(value).__plus(step);
  4440. return value;
  4441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4442. } else {
  4443. _st((function(){
  4444. return smalltalk.withContext(function($ctx2) {
  4445. return _st(value).__lt_eq(stop);
  4446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4447. return smalltalk.withContext(function($ctx2) {
  4448. _st(aBlock)._value_(value);
  4449. value=_st(value).__plus(step);
  4450. return value;
  4451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4452. };
  4453. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  4454. args: ["stop", "step", "aBlock"],
  4455. 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]]",
  4456. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  4457. referencedClasses: []
  4458. }),
  4459. smalltalk.Number);
  4460. smalltalk.addMethod(
  4461. smalltalk.method({
  4462. selector: "to:do:",
  4463. category: 'enumerating',
  4464. fn: function (stop,aBlock){
  4465. var self=this;
  4466. var nextValue;
  4467. return smalltalk.withContext(function($ctx1) {
  4468. nextValue=self;
  4469. _st((function(){
  4470. return smalltalk.withContext(function($ctx2) {
  4471. return _st(nextValue).__lt_eq(stop);
  4472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  4473. return smalltalk.withContext(function($ctx2) {
  4474. _st(aBlock)._value_(nextValue);
  4475. nextValue=_st(nextValue).__plus((1));
  4476. return nextValue;
  4477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4478. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  4479. args: ["stop", "aBlock"],
  4480. 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]",
  4481. messageSends: ["whileTrue:", "value:", "+", "<="],
  4482. referencedClasses: []
  4483. }),
  4484. smalltalk.Number);
  4485. smalltalk.addMethod(
  4486. smalltalk.method({
  4487. selector: "truncated",
  4488. category: 'converting',
  4489. fn: function (){
  4490. var self=this;
  4491. return smalltalk.withContext(function($ctx1) {
  4492. if(self >= 0) {
  4493. return Math.floor(self);
  4494. } else {
  4495. return Math.floor(self * (-1)) * (-1);
  4496. };
  4497. ;
  4498. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  4499. args: [],
  4500. 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>",
  4501. messageSends: [],
  4502. referencedClasses: []
  4503. }),
  4504. smalltalk.Number);
  4505. smalltalk.addMethod(
  4506. smalltalk.method({
  4507. selector: "|",
  4508. category: 'converting',
  4509. fn: function (aNumber){
  4510. var self=this;
  4511. return smalltalk.withContext(function($ctx1) {
  4512. return self | aNumber;
  4513. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  4514. args: ["aNumber"],
  4515. source: "| aNumber\x0a\x09<return self | aNumber>",
  4516. messageSends: [],
  4517. referencedClasses: []
  4518. }),
  4519. smalltalk.Number);
  4520. smalltalk.addMethod(
  4521. smalltalk.method({
  4522. selector: "heliosClass",
  4523. category: 'helios',
  4524. fn: function (){
  4525. var self=this;
  4526. return smalltalk.withContext(function($ctx1) {
  4527. return "magnitude";
  4528. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Number.klass)})},
  4529. args: [],
  4530. source: "heliosClass\x0a\x09^ 'magnitude'",
  4531. messageSends: [],
  4532. referencedClasses: []
  4533. }),
  4534. smalltalk.Number.klass);
  4535. smalltalk.addMethod(
  4536. smalltalk.method({
  4537. selector: "pi",
  4538. category: 'instance creation',
  4539. fn: function (){
  4540. var self=this;
  4541. return smalltalk.withContext(function($ctx1) {
  4542. return Math.PI;
  4543. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  4544. args: [],
  4545. source: "pi\x0a\x09<return Math.PI>",
  4546. messageSends: [],
  4547. referencedClasses: []
  4548. }),
  4549. smalltalk.Number.klass);
  4550. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  4551. smalltalk.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  4552. smalltalk.addMethod(
  4553. smalltalk.method({
  4554. selector: "addElement:",
  4555. category: 'accessing',
  4556. fn: function (anObject){
  4557. var self=this;
  4558. return smalltalk.withContext(function($ctx1) {
  4559. self.elements.addElement(anObject);
  4560. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  4561. args: ["anObject"],
  4562. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  4563. messageSends: [],
  4564. referencedClasses: []
  4565. }),
  4566. smalltalk.Organizer);
  4567. smalltalk.addMethod(
  4568. smalltalk.method({
  4569. selector: "elements",
  4570. category: 'accessing',
  4571. fn: function (){
  4572. var self=this;
  4573. return smalltalk.withContext(function($ctx1) {
  4574. var $1;
  4575. $1=_st(self._basicAt_("elements"))._copy();
  4576. return $1;
  4577. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  4578. args: [],
  4579. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  4580. messageSends: ["copy", "basicAt:"],
  4581. referencedClasses: []
  4582. }),
  4583. smalltalk.Organizer);
  4584. smalltalk.addMethod(
  4585. smalltalk.method({
  4586. selector: "removeElement:",
  4587. category: 'accessing',
  4588. fn: function (anObject){
  4589. var self=this;
  4590. return smalltalk.withContext(function($ctx1) {
  4591. self.elements.removeElement(anObject);
  4592. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  4593. args: ["anObject"],
  4594. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  4595. messageSends: [],
  4596. referencedClasses: []
  4597. }),
  4598. smalltalk.Organizer);
  4599. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4600. smalltalk.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  4601. smalltalk.addMethod(
  4602. smalltalk.method({
  4603. selector: "addElement:",
  4604. category: 'accessing',
  4605. fn: function (aString){
  4606. var self=this;
  4607. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  4608. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4609. return smalltalk.withContext(function($ctx1) {
  4610. var $1,$2;
  4611. smalltalk.Organizer.fn.prototype._addElement_.apply(_st(self), [aString]);
  4612. $1=_st($ProtocolAdded())._new();
  4613. _st($1)._protocol_(aString);
  4614. _st($1)._theClass_(self._theClass());
  4615. $2=_st($1)._yourself();
  4616. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4617. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4618. args: ["aString"],
  4619. 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)",
  4620. messageSends: ["addElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4621. referencedClasses: ["ProtocolAdded", "SystemAnnouncer"]
  4622. }),
  4623. smalltalk.ClassOrganizer);
  4624. smalltalk.addMethod(
  4625. smalltalk.method({
  4626. selector: "removeElement:",
  4627. category: 'accessing',
  4628. fn: function (aString){
  4629. var self=this;
  4630. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  4631. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4632. return smalltalk.withContext(function($ctx1) {
  4633. var $1,$2;
  4634. smalltalk.Organizer.fn.prototype._removeElement_.apply(_st(self), [aString]);
  4635. $1=_st($ProtocolRemoved())._new();
  4636. _st($1)._protocol_(aString);
  4637. _st($1)._theClass_(self._theClass());
  4638. $2=_st($1)._yourself();
  4639. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4640. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  4641. args: ["aString"],
  4642. 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)",
  4643. messageSends: ["removeElement:", "announce:", "protocol:", "new", "theClass:", "theClass", "yourself", "current"],
  4644. referencedClasses: ["ProtocolRemoved", "SystemAnnouncer"]
  4645. }),
  4646. smalltalk.ClassOrganizer);
  4647. smalltalk.addMethod(
  4648. smalltalk.method({
  4649. selector: "theClass",
  4650. category: 'accessing',
  4651. fn: function (){
  4652. var self=this;
  4653. return smalltalk.withContext(function($ctx1) {
  4654. return self.theClass ;
  4655. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  4656. args: [],
  4657. source: "theClass\x0a\x09< return self.theClass >",
  4658. messageSends: [],
  4659. referencedClasses: []
  4660. }),
  4661. smalltalk.ClassOrganizer);
  4662. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Objects');
  4663. smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  4664. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  4665. smalltalk.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'";
  4666. smalltalk.addMethod(
  4667. smalltalk.method({
  4668. selector: "classes",
  4669. category: 'classes',
  4670. fn: function (){
  4671. var self=this;
  4672. return smalltalk.withContext(function($ctx1) {
  4673. var $1;
  4674. $1=_st(self._organization())._elements();
  4675. return $1;
  4676. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  4677. args: [],
  4678. source: "classes\x0a\x09^ self organization elements",
  4679. messageSends: ["elements", "organization"],
  4680. referencedClasses: []
  4681. }),
  4682. smalltalk.Package);
  4683. smalltalk.addMethod(
  4684. smalltalk.method({
  4685. selector: "commitPathJs",
  4686. category: 'accessing',
  4687. fn: function (){
  4688. var self=this;
  4689. return smalltalk.withContext(function($ctx1) {
  4690. var $2,$1;
  4691. $2=self["@commitPathJs"];
  4692. if(($receiver = $2) == nil || $receiver == undefined){
  4693. $1=_st(self._class())._defaultCommitPathJs();
  4694. } else {
  4695. $1=$2;
  4696. };
  4697. return $1;
  4698. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  4699. args: [],
  4700. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  4701. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  4702. referencedClasses: []
  4703. }),
  4704. smalltalk.Package);
  4705. smalltalk.addMethod(
  4706. smalltalk.method({
  4707. selector: "commitPathJs:",
  4708. category: 'accessing',
  4709. fn: function (aString){
  4710. var self=this;
  4711. return smalltalk.withContext(function($ctx1) {
  4712. self["@commitPathJs"]=aString;
  4713. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  4714. args: ["aString"],
  4715. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  4716. messageSends: [],
  4717. referencedClasses: []
  4718. }),
  4719. smalltalk.Package);
  4720. smalltalk.addMethod(
  4721. smalltalk.method({
  4722. selector: "commitPathSt",
  4723. category: 'accessing',
  4724. fn: function (){
  4725. var self=this;
  4726. return smalltalk.withContext(function($ctx1) {
  4727. var $2,$1;
  4728. $2=self["@commitPathSt"];
  4729. if(($receiver = $2) == nil || $receiver == undefined){
  4730. $1=_st(self._class())._defaultCommitPathSt();
  4731. } else {
  4732. $1=$2;
  4733. };
  4734. return $1;
  4735. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  4736. args: [],
  4737. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  4738. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  4739. referencedClasses: []
  4740. }),
  4741. smalltalk.Package);
  4742. smalltalk.addMethod(
  4743. smalltalk.method({
  4744. selector: "commitPathSt:",
  4745. category: 'accessing',
  4746. fn: function (aString){
  4747. var self=this;
  4748. return smalltalk.withContext(function($ctx1) {
  4749. self["@commitPathSt"]=aString;
  4750. return self}, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  4751. args: ["aString"],
  4752. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  4753. messageSends: [],
  4754. referencedClasses: []
  4755. }),
  4756. smalltalk.Package);
  4757. smalltalk.addMethod(
  4758. smalltalk.method({
  4759. selector: "isPackage",
  4760. category: 'testing',
  4761. fn: function (){
  4762. var self=this;
  4763. return smalltalk.withContext(function($ctx1) {
  4764. return true;
  4765. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  4766. args: [],
  4767. source: "isPackage\x0a\x09^ true",
  4768. messageSends: [],
  4769. referencedClasses: []
  4770. }),
  4771. smalltalk.Package);
  4772. smalltalk.addMethod(
  4773. smalltalk.method({
  4774. selector: "name",
  4775. category: 'accessing',
  4776. fn: function (){
  4777. var self=this;
  4778. return smalltalk.withContext(function($ctx1) {
  4779. return self.pkgName;
  4780. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  4781. args: [],
  4782. source: "name\x0a\x09<return self.pkgName>",
  4783. messageSends: [],
  4784. referencedClasses: []
  4785. }),
  4786. smalltalk.Package);
  4787. smalltalk.addMethod(
  4788. smalltalk.method({
  4789. selector: "name:",
  4790. category: 'accessing',
  4791. fn: function (aString){
  4792. var self=this;
  4793. return smalltalk.withContext(function($ctx1) {
  4794. self.pkgName = aString;
  4795. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  4796. args: ["aString"],
  4797. source: "name: aString\x0a\x09<self.pkgName = aString>",
  4798. messageSends: [],
  4799. referencedClasses: []
  4800. }),
  4801. smalltalk.Package);
  4802. smalltalk.addMethod(
  4803. smalltalk.method({
  4804. selector: "organization",
  4805. category: 'accessing',
  4806. fn: function (){
  4807. var self=this;
  4808. return smalltalk.withContext(function($ctx1) {
  4809. var $1;
  4810. $1=self._basicAt_("organization");
  4811. return $1;
  4812. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  4813. args: [],
  4814. source: "organization\x0a\x09^ self basicAt: 'organization'",
  4815. messageSends: ["basicAt:"],
  4816. referencedClasses: []
  4817. }),
  4818. smalltalk.Package);
  4819. smalltalk.addMethod(
  4820. smalltalk.method({
  4821. selector: "printOn:",
  4822. category: 'printing',
  4823. fn: function (aStream){
  4824. var self=this;
  4825. return smalltalk.withContext(function($ctx1) {
  4826. var $1,$2;
  4827. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  4828. $1=aStream;
  4829. _st($1)._nextPutAll_(" (");
  4830. _st($1)._nextPutAll_(self._name());
  4831. $2=_st($1)._nextPutAll_(")");
  4832. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  4833. args: ["aStream"],
  4834. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  4835. messageSends: ["printOn:", "nextPutAll:", "name"],
  4836. referencedClasses: []
  4837. }),
  4838. smalltalk.Package);
  4839. smalltalk.addMethod(
  4840. smalltalk.method({
  4841. selector: "setupClasses",
  4842. category: 'classes',
  4843. fn: function (){
  4844. var self=this;
  4845. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4846. return smalltalk.withContext(function($ctx1) {
  4847. var $1,$2;
  4848. $1=self._classes();
  4849. _st($1)._do_((function(each){
  4850. return smalltalk.withContext(function($ctx2) {
  4851. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  4852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4853. $2=_st($1)._do_((function(each){
  4854. return smalltalk.withContext(function($ctx2) {
  4855. return _st(each)._initialize();
  4856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4857. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  4858. args: [],
  4859. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  4860. messageSends: ["do:", "setupClass:", "new", "classes", "initialize"],
  4861. referencedClasses: ["ClassBuilder"]
  4862. }),
  4863. smalltalk.Package);
  4864. smalltalk.addMethod(
  4865. smalltalk.method({
  4866. selector: "sortedClasses",
  4867. category: 'classes',
  4868. fn: function (){
  4869. var self=this;
  4870. return smalltalk.withContext(function($ctx1) {
  4871. var $1;
  4872. $1=_st(self._class())._sortedClasses_(self._classes());
  4873. return $1;
  4874. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  4875. args: [],
  4876. 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",
  4877. messageSends: ["sortedClasses:", "classes", "class"],
  4878. referencedClasses: []
  4879. }),
  4880. smalltalk.Package);
  4881. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  4882. smalltalk.addMethod(
  4883. smalltalk.method({
  4884. selector: "commitPathsFromLoader",
  4885. category: 'commit paths',
  4886. fn: function (){
  4887. var self=this;
  4888. return smalltalk.withContext(function($ctx1) {
  4889. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  4890. if (!commitPath) return;
  4891. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  4892. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  4893. ;
  4894. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.Package.klass)})},
  4895. args: [],
  4896. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  4897. messageSends: [],
  4898. referencedClasses: []
  4899. }),
  4900. smalltalk.Package.klass);
  4901. smalltalk.addMethod(
  4902. smalltalk.method({
  4903. selector: "defaultCommitPathJs",
  4904. category: 'commit paths',
  4905. fn: function (){
  4906. var self=this;
  4907. return smalltalk.withContext(function($ctx1) {
  4908. var $2,$1;
  4909. $2=self["@defaultCommitPathJs"];
  4910. if(($receiver = $2) == nil || $receiver == undefined){
  4911. self["@defaultCommitPathJs"]="js";
  4912. $1=self["@defaultCommitPathJs"];
  4913. } else {
  4914. $1=$2;
  4915. };
  4916. return $1;
  4917. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.Package.klass)})},
  4918. args: [],
  4919. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  4920. messageSends: ["ifNil:"],
  4921. referencedClasses: []
  4922. }),
  4923. smalltalk.Package.klass);
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "defaultCommitPathJs:",
  4927. category: 'commit paths',
  4928. fn: function (aString){
  4929. var self=this;
  4930. return smalltalk.withContext(function($ctx1) {
  4931. self["@defaultCommitPathJs"]=aString;
  4932. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.Package.klass)})},
  4933. args: ["aString"],
  4934. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  4935. messageSends: [],
  4936. referencedClasses: []
  4937. }),
  4938. smalltalk.Package.klass);
  4939. smalltalk.addMethod(
  4940. smalltalk.method({
  4941. selector: "defaultCommitPathSt",
  4942. category: 'commit paths',
  4943. fn: function (){
  4944. var self=this;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. var $2,$1;
  4947. $2=self["@defaultCommitPathSt"];
  4948. if(($receiver = $2) == nil || $receiver == undefined){
  4949. self["@defaultCommitPathSt"]="st";
  4950. $1=self["@defaultCommitPathSt"];
  4951. } else {
  4952. $1=$2;
  4953. };
  4954. return $1;
  4955. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.Package.klass)})},
  4956. args: [],
  4957. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  4958. messageSends: ["ifNil:"],
  4959. referencedClasses: []
  4960. }),
  4961. smalltalk.Package.klass);
  4962. smalltalk.addMethod(
  4963. smalltalk.method({
  4964. selector: "defaultCommitPathSt:",
  4965. category: 'commit paths',
  4966. fn: function (aString){
  4967. var self=this;
  4968. return smalltalk.withContext(function($ctx1) {
  4969. self["@defaultCommitPathSt"]=aString;
  4970. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.Package.klass)})},
  4971. args: ["aString"],
  4972. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  4973. messageSends: [],
  4974. referencedClasses: []
  4975. }),
  4976. smalltalk.Package.klass);
  4977. smalltalk.addMethod(
  4978. smalltalk.method({
  4979. selector: "initialize",
  4980. category: 'initialization',
  4981. fn: function (){
  4982. var self=this;
  4983. return smalltalk.withContext(function($ctx1) {
  4984. smalltalk.Object.klass.fn.prototype._initialize.apply(_st(self), []);
  4985. self._commitPathsFromLoader();
  4986. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Package.klass)})},
  4987. args: [],
  4988. source: "initialize\x0a\x09super initialize.\x0a\x09self commitPathsFromLoader",
  4989. messageSends: ["initialize", "commitPathsFromLoader"],
  4990. referencedClasses: []
  4991. }),
  4992. smalltalk.Package.klass);
  4993. smalltalk.addMethod(
  4994. smalltalk.method({
  4995. selector: "load:",
  4996. category: 'loading-storing',
  4997. fn: function (aPackageName){
  4998. var self=this;
  4999. return smalltalk.withContext(function($ctx1) {
  5000. self._load_prefix_(aPackageName,_st(self._defaultCommitPathJs()).__comma("/"));
  5001. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  5002. args: ["aPackageName"],
  5003. source: "load: aPackageName\x0a\x09self load: aPackageName prefix: self defaultCommitPathJs, '/'",
  5004. messageSends: ["load:prefix:", ",", "defaultCommitPathJs"],
  5005. referencedClasses: []
  5006. }),
  5007. smalltalk.Package.klass);
  5008. smalltalk.addMethod(
  5009. smalltalk.method({
  5010. selector: "load:prefix:",
  5011. category: 'loading-storing',
  5012. fn: function (aPackageName,aPrefix){
  5013. var self=this;
  5014. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  5015. return smalltalk.withContext(function($ctx1) {
  5016. _st(jQuery)._getScript_onSuccess_(_st(_st(aPrefix).__comma(aPackageName)).__comma(".js"),(function(){
  5017. return smalltalk.withContext(function($ctx2) {
  5018. return _st(_st($Package())._named_(aPackageName))._setupClasses();
  5019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5020. return self}, function($ctx1) {$ctx1.fill(self,"load:prefix:",{aPackageName:aPackageName,aPrefix:aPrefix},smalltalk.Package.klass)})},
  5021. args: ["aPackageName", "aPrefix"],
  5022. source: "load: aPackageName prefix: aPrefix\x0a\x09jQuery\x0a\x09\x09getScript: (aPrefix , aPackageName , '.js')\x0a\x09\x09onSuccess: [\x0a\x09\x09\x09(Package named: aPackageName) setupClasses ]",
  5023. messageSends: ["getScript:onSuccess:", ",", "setupClasses", "named:"],
  5024. referencedClasses: ["Package"]
  5025. }),
  5026. smalltalk.Package.klass);
  5027. smalltalk.addMethod(
  5028. smalltalk.method({
  5029. selector: "named:",
  5030. category: 'accessing',
  5031. fn: function (aPackageName){
  5032. var self=this;
  5033. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5034. return smalltalk.withContext(function($ctx1) {
  5035. var $1;
  5036. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  5037. return $1;
  5038. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  5039. args: ["aPackageName"],
  5040. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  5041. messageSends: ["packageAt:", "current"],
  5042. referencedClasses: ["Smalltalk"]
  5043. }),
  5044. smalltalk.Package.klass);
  5045. smalltalk.addMethod(
  5046. smalltalk.method({
  5047. selector: "named:ifAbsent:",
  5048. category: 'accessing',
  5049. fn: function (aPackageName,aBlock){
  5050. var self=this;
  5051. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5052. return smalltalk.withContext(function($ctx1) {
  5053. var $1;
  5054. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  5055. return $1;
  5056. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  5057. args: ["aPackageName", "aBlock"],
  5058. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  5059. messageSends: ["packageAt:ifAbsent:", "current"],
  5060. referencedClasses: ["Smalltalk"]
  5061. }),
  5062. smalltalk.Package.klass);
  5063. smalltalk.addMethod(
  5064. smalltalk.method({
  5065. selector: "resetCommitPaths",
  5066. category: 'commit paths',
  5067. fn: function (){
  5068. var self=this;
  5069. return smalltalk.withContext(function($ctx1) {
  5070. self["@defaultCommitPathJs"]=nil;
  5071. self["@defaultCommitPathSt"]=nil;
  5072. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.Package.klass)})},
  5073. args: [],
  5074. source: "resetCommitPaths\x0a\x09\x09defaultCommitPathJs := nil.\x0a\x09\x09defaultCommitPathSt := nil.",
  5075. messageSends: [],
  5076. referencedClasses: []
  5077. }),
  5078. smalltalk.Package.klass);
  5079. smalltalk.addMethod(
  5080. smalltalk.method({
  5081. selector: "sortedClasses:",
  5082. category: 'sorting',
  5083. fn: function (classes){
  5084. var self=this;
  5085. var children,others,nodes,expandedClasses;
  5086. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  5087. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  5088. return smalltalk.withContext(function($ctx1) {
  5089. var $1,$2;
  5090. children=[];
  5091. others=[];
  5092. _st(classes)._do_((function(each){
  5093. return smalltalk.withContext(function($ctx2) {
  5094. $1=_st(classes)._includes_(_st(each)._superclass());
  5095. if(smalltalk.assert($1)){
  5096. return _st(others)._add_(each);
  5097. } else {
  5098. return _st(children)._add_(each);
  5099. };
  5100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5101. nodes=_st(children)._collect_((function(each){
  5102. return smalltalk.withContext(function($ctx2) {
  5103. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  5104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5105. nodes=_st(nodes)._sorted_((function(a,b){
  5106. return smalltalk.withContext(function($ctx2) {
  5107. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  5108. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  5109. expandedClasses=_st($Array())._new();
  5110. _st(nodes)._do_((function(aNode){
  5111. return smalltalk.withContext(function($ctx2) {
  5112. return _st(aNode)._traverseClassesWith_(expandedClasses);
  5113. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  5114. $2=expandedClasses;
  5115. return $2;
  5116. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  5117. args: ["classes"],
  5118. 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",
  5119. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  5120. referencedClasses: ["ClassSorterNode", "Array"]
  5121. }),
  5122. smalltalk.Package.klass);
  5123. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  5124. smalltalk.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";
  5125. smalltalk.addMethod(
  5126. smalltalk.method({
  5127. selector: "*",
  5128. category: 'arithmetic',
  5129. fn: function (aPoint){
  5130. var self=this;
  5131. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5132. return smalltalk.withContext(function($ctx1) {
  5133. var $1;
  5134. $1=_st($Point())._x_y_(_st(self._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  5135. return $1;
  5136. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  5137. args: ["aPoint"],
  5138. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5139. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  5140. referencedClasses: ["Point"]
  5141. }),
  5142. smalltalk.Point);
  5143. smalltalk.addMethod(
  5144. smalltalk.method({
  5145. selector: "+",
  5146. category: 'arithmetic',
  5147. fn: function (aPoint){
  5148. var self=this;
  5149. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5150. return smalltalk.withContext(function($ctx1) {
  5151. var $1;
  5152. $1=_st($Point())._x_y_(_st(self._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  5153. return $1;
  5154. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  5155. args: ["aPoint"],
  5156. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5157. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  5158. referencedClasses: ["Point"]
  5159. }),
  5160. smalltalk.Point);
  5161. smalltalk.addMethod(
  5162. smalltalk.method({
  5163. selector: "-",
  5164. category: 'arithmetic',
  5165. fn: function (aPoint){
  5166. var self=this;
  5167. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5168. return smalltalk.withContext(function($ctx1) {
  5169. var $1;
  5170. $1=_st($Point())._x_y_(_st(self._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  5171. return $1;
  5172. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  5173. args: ["aPoint"],
  5174. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5175. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  5176. referencedClasses: ["Point"]
  5177. }),
  5178. smalltalk.Point);
  5179. smalltalk.addMethod(
  5180. smalltalk.method({
  5181. selector: "/",
  5182. category: 'arithmetic',
  5183. fn: function (aPoint){
  5184. var self=this;
  5185. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  5186. return smalltalk.withContext(function($ctx1) {
  5187. var $1;
  5188. $1=_st($Point())._x_y_(_st(self._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  5189. return $1;
  5190. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  5191. args: ["aPoint"],
  5192. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5193. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  5194. referencedClasses: ["Point"]
  5195. }),
  5196. smalltalk.Point);
  5197. smalltalk.addMethod(
  5198. smalltalk.method({
  5199. selector: "=",
  5200. category: 'arithmetic',
  5201. fn: function (aPoint){
  5202. var self=this;
  5203. return smalltalk.withContext(function($ctx1) {
  5204. var $1;
  5205. $1=_st(_st(_st(aPoint)._class()).__eq(self._class()))._and_((function(){
  5206. return smalltalk.withContext(function($ctx2) {
  5207. return _st(_st(_st(aPoint)._x()).__eq(self._x())).__and(_st(_st(aPoint)._y()).__eq(self._y()));
  5208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5209. return $1;
  5210. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  5211. args: ["aPoint"],
  5212. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  5213. messageSends: ["and:", "&", "=", "y", "x", "class"],
  5214. referencedClasses: []
  5215. }),
  5216. smalltalk.Point);
  5217. smalltalk.addMethod(
  5218. smalltalk.method({
  5219. selector: "asPoint",
  5220. category: 'converting',
  5221. fn: function (){
  5222. var self=this;
  5223. return smalltalk.withContext(function($ctx1) {
  5224. var $1;
  5225. $1=self;
  5226. return $1;
  5227. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  5228. args: [],
  5229. source: "asPoint\x0a\x09^self",
  5230. messageSends: [],
  5231. referencedClasses: []
  5232. }),
  5233. smalltalk.Point);
  5234. smalltalk.addMethod(
  5235. smalltalk.method({
  5236. selector: "printOn:",
  5237. category: 'printing',
  5238. fn: function (aStream){
  5239. var self=this;
  5240. return smalltalk.withContext(function($ctx1) {
  5241. var $1;
  5242. _st(self["@x"])._printOn_(aStream);
  5243. _st(aStream)._nextPutAll_("@");
  5244. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  5245. return smalltalk.withContext(function($ctx2) {
  5246. return _st(self["@y"])._negative();
  5247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5248. if(smalltalk.assert($1)){
  5249. _st(aStream)._space();
  5250. };
  5251. _st(self["@y"])._printOn_(aStream);
  5252. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  5253. args: ["aStream"],
  5254. 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",
  5255. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "space", "and:", "negative", "notNil"],
  5256. referencedClasses: []
  5257. }),
  5258. smalltalk.Point);
  5259. smalltalk.addMethod(
  5260. smalltalk.method({
  5261. selector: "translateBy:",
  5262. category: 'transforming',
  5263. fn: function (delta){
  5264. var self=this;
  5265. return smalltalk.withContext(function($ctx1) {
  5266. var $1;
  5267. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  5268. return $1;
  5269. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  5270. args: ["delta"],
  5271. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  5272. messageSends: ["@", "+", "y", "x"],
  5273. referencedClasses: []
  5274. }),
  5275. smalltalk.Point);
  5276. smalltalk.addMethod(
  5277. smalltalk.method({
  5278. selector: "x",
  5279. category: 'accessing',
  5280. fn: function (){
  5281. var self=this;
  5282. return smalltalk.withContext(function($ctx1) {
  5283. var $1;
  5284. $1=self["@x"];
  5285. return $1;
  5286. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  5287. args: [],
  5288. source: "x\x0a\x09^x",
  5289. messageSends: [],
  5290. referencedClasses: []
  5291. }),
  5292. smalltalk.Point);
  5293. smalltalk.addMethod(
  5294. smalltalk.method({
  5295. selector: "x:",
  5296. category: 'accessing',
  5297. fn: function (aNumber){
  5298. var self=this;
  5299. return smalltalk.withContext(function($ctx1) {
  5300. self["@x"]=aNumber;
  5301. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  5302. args: ["aNumber"],
  5303. source: "x: aNumber\x0a\x09x := aNumber",
  5304. messageSends: [],
  5305. referencedClasses: []
  5306. }),
  5307. smalltalk.Point);
  5308. smalltalk.addMethod(
  5309. smalltalk.method({
  5310. selector: "y",
  5311. category: 'accessing',
  5312. fn: function (){
  5313. var self=this;
  5314. return smalltalk.withContext(function($ctx1) {
  5315. var $1;
  5316. $1=self["@y"];
  5317. return $1;
  5318. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  5319. args: [],
  5320. source: "y\x0a\x09^y",
  5321. messageSends: [],
  5322. referencedClasses: []
  5323. }),
  5324. smalltalk.Point);
  5325. smalltalk.addMethod(
  5326. smalltalk.method({
  5327. selector: "y:",
  5328. category: 'accessing',
  5329. fn: function (aNumber){
  5330. var self=this;
  5331. return smalltalk.withContext(function($ctx1) {
  5332. self["@y"]=aNumber;
  5333. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  5334. args: ["aNumber"],
  5335. source: "y: aNumber\x0a\x09y := aNumber",
  5336. messageSends: [],
  5337. referencedClasses: []
  5338. }),
  5339. smalltalk.Point);
  5340. smalltalk.addMethod(
  5341. smalltalk.method({
  5342. selector: "heliosClass",
  5343. category: 'helios',
  5344. fn: function (){
  5345. var self=this;
  5346. return smalltalk.withContext(function($ctx1) {
  5347. return "magnitude";
  5348. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Point.klass)})},
  5349. args: [],
  5350. source: "heliosClass\x0a\x09^ 'magnitude'",
  5351. messageSends: [],
  5352. referencedClasses: []
  5353. }),
  5354. smalltalk.Point.klass);
  5355. smalltalk.addMethod(
  5356. smalltalk.method({
  5357. selector: "x:y:",
  5358. category: 'instance creation',
  5359. fn: function (aNumber,anotherNumber){
  5360. var self=this;
  5361. return smalltalk.withContext(function($ctx1) {
  5362. var $2,$3,$1;
  5363. $2=self._new();
  5364. _st($2)._x_(aNumber);
  5365. _st($2)._y_(anotherNumber);
  5366. $3=_st($2)._yourself();
  5367. $1=$3;
  5368. return $1;
  5369. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  5370. args: ["aNumber", "anotherNumber"],
  5371. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5372. messageSends: ["x:", "new", "y:", "yourself"],
  5373. referencedClasses: []
  5374. }),
  5375. smalltalk.Point.klass);
  5376. smalltalk.addClass('ProgressHandler', smalltalk.Object, [], 'Kernel-Objects');
  5377. smalltalk.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aSubclasses of can register themselves as the current handler with\x0a`ProgressHandler class >> register`.\x0a\x0aThe default behavior is to simply iterate over the collection.";
  5378. smalltalk.addMethod(
  5379. smalltalk.method({
  5380. selector: "do:on:displaying:",
  5381. category: 'progress handling',
  5382. fn: function (aBlock,aCollection,aString){
  5383. var self=this;
  5384. return smalltalk.withContext(function($ctx1) {
  5385. _st(aCollection)._do_(aBlock);
  5386. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},smalltalk.ProgressHandler)})},
  5387. args: ["aBlock", "aCollection", "aString"],
  5388. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  5389. messageSends: ["do:"],
  5390. referencedClasses: []
  5391. }),
  5392. smalltalk.ProgressHandler);
  5393. smalltalk.ProgressHandler.klass.iVarNames = ['current'];
  5394. smalltalk.addMethod(
  5395. smalltalk.method({
  5396. selector: "current",
  5397. category: 'accessing',
  5398. fn: function (){
  5399. var self=this;
  5400. return smalltalk.withContext(function($ctx1) {
  5401. var $2,$1;
  5402. $2=self["@current"];
  5403. if(($receiver = $2) == nil || $receiver == undefined){
  5404. self["@current"]=self._new();
  5405. $1=self["@current"];
  5406. } else {
  5407. $1=$2;
  5408. };
  5409. return $1;
  5410. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ProgressHandler.klass)})},
  5411. args: [],
  5412. source: "current\x0a\x09^current ifNil: [ current := self new ]",
  5413. messageSends: ["ifNil:", "new"],
  5414. referencedClasses: []
  5415. }),
  5416. smalltalk.ProgressHandler.klass);
  5417. smalltalk.addMethod(
  5418. smalltalk.method({
  5419. selector: "initialize",
  5420. category: 'initialization',
  5421. fn: function (){
  5422. var self=this;
  5423. return smalltalk.withContext(function($ctx1) {
  5424. self._register();
  5425. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProgressHandler.klass)})},
  5426. args: [],
  5427. source: "initialize\x0a\x09self register",
  5428. messageSends: ["register"],
  5429. referencedClasses: []
  5430. }),
  5431. smalltalk.ProgressHandler.klass);
  5432. smalltalk.addMethod(
  5433. smalltalk.method({
  5434. selector: "register",
  5435. category: 'initialization',
  5436. fn: function (){
  5437. var self=this;
  5438. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  5439. return smalltalk.withContext(function($ctx1) {
  5440. _st($ProgressHandler())._setCurrent_(self._new());
  5441. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ProgressHandler.klass)})},
  5442. args: [],
  5443. source: "register\x0a\x09ProgressHandler setCurrent: self new",
  5444. messageSends: ["setCurrent:", "new"],
  5445. referencedClasses: ["ProgressHandler"]
  5446. }),
  5447. smalltalk.ProgressHandler.klass);
  5448. smalltalk.addMethod(
  5449. smalltalk.method({
  5450. selector: "setCurrent:",
  5451. category: 'accessing',
  5452. fn: function (anHandler){
  5453. var self=this;
  5454. return smalltalk.withContext(function($ctx1) {
  5455. self["@current"]=anHandler;
  5456. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ProgressHandler.klass)})},
  5457. args: ["anHandler"],
  5458. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  5459. messageSends: [],
  5460. referencedClasses: []
  5461. }),
  5462. smalltalk.ProgressHandler.klass);
  5463. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  5464. smalltalk.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'`.";
  5465. smalltalk.addMethod(
  5466. smalltalk.method({
  5467. selector: "next",
  5468. category: 'accessing',
  5469. fn: function (){
  5470. var self=this;
  5471. return smalltalk.withContext(function($ctx1) {
  5472. return Math.random();
  5473. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  5474. args: [],
  5475. source: "next\x0a\x09<return Math.random()>",
  5476. messageSends: [],
  5477. referencedClasses: []
  5478. }),
  5479. smalltalk.Random);
  5480. smalltalk.addMethod(
  5481. smalltalk.method({
  5482. selector: "next:",
  5483. category: 'accessing',
  5484. fn: function (anInteger){
  5485. var self=this;
  5486. return smalltalk.withContext(function($ctx1) {
  5487. var $1;
  5488. $1=_st((1)._to_(anInteger))._collect_((function(each){
  5489. return smalltalk.withContext(function($ctx2) {
  5490. return self._next();
  5491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5492. return $1;
  5493. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  5494. args: ["anInteger"],
  5495. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  5496. messageSends: ["collect:", "next", "to:"],
  5497. referencedClasses: []
  5498. }),
  5499. smalltalk.Random);
  5500. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  5501. smalltalk.Smalltalk.comment="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\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 `js/parser.js` parser file in order to work.";
  5502. smalltalk.addMethod(
  5503. smalltalk.method({
  5504. selector: "asSmalltalkException:",
  5505. category: 'error handling',
  5506. fn: function (anObject){
  5507. var self=this;
  5508. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5509. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5510. return smalltalk.withContext(function($ctx1) {
  5511. var $2,$1;
  5512. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  5513. return smalltalk.withContext(function($ctx2) {
  5514. return _st(anObject)._isKindOf_($Error());
  5515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5516. if(smalltalk.assert($2)){
  5517. $1=anObject;
  5518. } else {
  5519. $1=_st($JavaScriptException())._on_(anObject);
  5520. };
  5521. return $1;
  5522. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  5523. args: ["anObject"],
  5524. 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 ]",
  5525. messageSends: ["ifTrue:ifFalse:", "on:", "and:", "isKindOf:", "isSmalltalkObject:"],
  5526. referencedClasses: ["JavaScriptException", "Error"]
  5527. }),
  5528. smalltalk.Smalltalk);
  5529. smalltalk.addMethod(
  5530. smalltalk.method({
  5531. selector: "at:",
  5532. category: 'accessing',
  5533. fn: function (aString){
  5534. var self=this;
  5535. return smalltalk.withContext(function($ctx1) {
  5536. return self[aString];
  5537. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  5538. args: ["aString"],
  5539. source: "at: aString\x0a\x09<return self[aString]>",
  5540. messageSends: [],
  5541. referencedClasses: []
  5542. }),
  5543. smalltalk.Smalltalk);
  5544. smalltalk.addMethod(
  5545. smalltalk.method({
  5546. selector: "basicParse:",
  5547. category: 'private',
  5548. fn: function (aString){
  5549. var self=this;
  5550. return smalltalk.withContext(function($ctx1) {
  5551. return smalltalk.parser.parse(aString);
  5552. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  5553. args: ["aString"],
  5554. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  5555. messageSends: [],
  5556. referencedClasses: []
  5557. }),
  5558. smalltalk.Smalltalk);
  5559. smalltalk.addMethod(
  5560. smalltalk.method({
  5561. selector: "classes",
  5562. category: 'classes',
  5563. fn: function (){
  5564. var self=this;
  5565. return smalltalk.withContext(function($ctx1) {
  5566. return self.classes();
  5567. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  5568. args: [],
  5569. source: "classes\x0a\x09<return self.classes()>",
  5570. messageSends: [],
  5571. referencedClasses: []
  5572. }),
  5573. smalltalk.Smalltalk);
  5574. smalltalk.addMethod(
  5575. smalltalk.method({
  5576. selector: "createPackage:",
  5577. category: 'packages',
  5578. fn: function (packageName){
  5579. var self=this;
  5580. return smalltalk.withContext(function($ctx1) {
  5581. return smalltalk.addPackage(packageName);
  5582. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5583. args: ["packageName"],
  5584. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  5585. messageSends: [],
  5586. referencedClasses: []
  5587. }),
  5588. smalltalk.Smalltalk);
  5589. smalltalk.addMethod(
  5590. smalltalk.method({
  5591. selector: "createPackage:properties:",
  5592. category: 'private',
  5593. fn: function (packageName,aDict){
  5594. var self=this;
  5595. return smalltalk.withContext(function($ctx1) {
  5596. var $1,$2;
  5597. self._deprecatedAPI();
  5598. $1=_st(aDict)._isEmpty();
  5599. if(! smalltalk.assert($1)){
  5600. self._error_("createPackage:properties: called with nonempty properties");
  5601. };
  5602. $2=self._createPackage_(packageName);
  5603. return $2;
  5604. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  5605. args: ["packageName", "aDict"],
  5606. 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",
  5607. messageSends: ["deprecatedAPI", "ifFalse:", "error:", "isEmpty", "createPackage:"],
  5608. referencedClasses: []
  5609. }),
  5610. smalltalk.Smalltalk);
  5611. smalltalk.addMethod(
  5612. smalltalk.method({
  5613. selector: "deleteClass:",
  5614. category: 'classes',
  5615. fn: function (aClass){
  5616. var self=this;
  5617. return smalltalk.withContext(function($ctx1) {
  5618. self.removeClass(aClass);
  5619. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5620. args: ["aClass"],
  5621. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  5622. messageSends: [],
  5623. referencedClasses: []
  5624. }),
  5625. smalltalk.Smalltalk);
  5626. smalltalk.addMethod(
  5627. smalltalk.method({
  5628. selector: "deletePackage:",
  5629. category: 'packages',
  5630. fn: function (packageName){
  5631. var self=this;
  5632. return smalltalk.withContext(function($ctx1) {
  5633. delete smalltalk.packages[packageName];
  5634. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  5635. args: ["packageName"],
  5636. 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]>",
  5637. messageSends: [],
  5638. referencedClasses: []
  5639. }),
  5640. smalltalk.Smalltalk);
  5641. smalltalk.addMethod(
  5642. smalltalk.method({
  5643. selector: "isSmalltalkObject:",
  5644. category: 'testing',
  5645. fn: function (anObject){
  5646. var self=this;
  5647. return smalltalk.withContext(function($ctx1) {
  5648. return typeof anObject.klass !== 'undefined';
  5649. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5650. args: ["anObject"],
  5651. 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'>",
  5652. messageSends: [],
  5653. referencedClasses: []
  5654. }),
  5655. smalltalk.Smalltalk);
  5656. smalltalk.addMethod(
  5657. smalltalk.method({
  5658. selector: "packageAt:",
  5659. category: 'packages',
  5660. fn: function (packageName){
  5661. var self=this;
  5662. return smalltalk.withContext(function($ctx1) {
  5663. return self.packages[packageName];
  5664. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  5665. args: ["packageName"],
  5666. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  5667. messageSends: [],
  5668. referencedClasses: []
  5669. }),
  5670. smalltalk.Smalltalk);
  5671. smalltalk.addMethod(
  5672. smalltalk.method({
  5673. selector: "packageAt:ifAbsent:",
  5674. category: 'packages',
  5675. fn: function (packageName,aBlock){
  5676. var self=this;
  5677. return smalltalk.withContext(function($ctx1) {
  5678. var $2,$1;
  5679. $2=self._packageAt_(packageName);
  5680. $1=_st($2)._ifNil_(aBlock);
  5681. return $1;
  5682. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  5683. args: ["packageName", "aBlock"],
  5684. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  5685. messageSends: ["ifNil:", "packageAt:"],
  5686. referencedClasses: []
  5687. }),
  5688. smalltalk.Smalltalk);
  5689. smalltalk.addMethod(
  5690. smalltalk.method({
  5691. selector: "packages",
  5692. category: 'packages',
  5693. fn: function (){
  5694. var self=this;
  5695. return smalltalk.withContext(function($ctx1) {
  5696. return self.packages.all();
  5697. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  5698. args: [],
  5699. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  5700. messageSends: [],
  5701. referencedClasses: []
  5702. }),
  5703. smalltalk.Smalltalk);
  5704. smalltalk.addMethod(
  5705. smalltalk.method({
  5706. selector: "parse:",
  5707. category: 'accessing',
  5708. fn: function (aString){
  5709. var self=this;
  5710. var result;
  5711. return smalltalk.withContext(function($ctx1) {
  5712. var $2,$3,$1;
  5713. self._try_catch_((function(){
  5714. return smalltalk.withContext(function($ctx2) {
  5715. result=self._basicParse_(aString);
  5716. return result;
  5717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(ex){
  5718. return smalltalk.withContext(function($ctx2) {
  5719. return _st(self._parseError_parsing_(ex,aString))._signal();
  5720. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  5721. $2=result;
  5722. _st($2)._source_(aString);
  5723. $3=_st($2)._yourself();
  5724. $1=$3;
  5725. return $1;
  5726. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  5727. args: ["aString"],
  5728. 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",
  5729. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  5730. referencedClasses: []
  5731. }),
  5732. smalltalk.Smalltalk);
  5733. smalltalk.addMethod(
  5734. smalltalk.method({
  5735. selector: "parseError:parsing:",
  5736. category: 'error handling',
  5737. fn: function (anException,aString){
  5738. var self=this;
  5739. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  5740. return smalltalk.withContext(function($ctx1) {
  5741. var $1;
  5742. $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st("Parse error on line ".__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
  5743. return $1;
  5744. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  5745. args: ["anException", "aString"],
  5746. 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')",
  5747. messageSends: ["messageText:", ",", "basicAt:", "new"],
  5748. referencedClasses: ["ParseError"]
  5749. }),
  5750. smalltalk.Smalltalk);
  5751. smalltalk.addMethod(
  5752. smalltalk.method({
  5753. selector: "pseudoVariableNames",
  5754. category: 'packages',
  5755. fn: function (){
  5756. var self=this;
  5757. return smalltalk.withContext(function($ctx1) {
  5758. var $1;
  5759. $1=["self", "super", "nil", "true", "false", "thisContext"];
  5760. return $1;
  5761. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  5762. args: [],
  5763. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  5764. messageSends: [],
  5765. referencedClasses: []
  5766. }),
  5767. smalltalk.Smalltalk);
  5768. smalltalk.addMethod(
  5769. smalltalk.method({
  5770. selector: "readJSObject:",
  5771. category: 'accessing',
  5772. fn: function (anObject){
  5773. var self=this;
  5774. return smalltalk.withContext(function($ctx1) {
  5775. return self.readJSObject(anObject);
  5776. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  5777. args: ["anObject"],
  5778. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  5779. messageSends: [],
  5780. referencedClasses: []
  5781. }),
  5782. smalltalk.Smalltalk);
  5783. smalltalk.addMethod(
  5784. smalltalk.method({
  5785. selector: "removeClass:",
  5786. category: 'classes',
  5787. fn: function (aClass){
  5788. var self=this;
  5789. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  5790. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5791. return smalltalk.withContext(function($ctx1) {
  5792. var $1,$2,$3;
  5793. $1=_st(aClass)._isMetaclass();
  5794. if(smalltalk.assert($1)){
  5795. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  5796. };
  5797. self._deleteClass_(aClass);
  5798. $2=_st($ClassRemoved())._new();
  5799. _st($2)._theClass_(aClass);
  5800. $3=_st($2)._yourself();
  5801. _st(_st($SystemAnnouncer())._current())._announce_($3);
  5802. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  5803. args: ["aClass"],
  5804. 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)",
  5805. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  5806. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  5807. }),
  5808. smalltalk.Smalltalk);
  5809. smalltalk.addMethod(
  5810. smalltalk.method({
  5811. selector: "removePackage:",
  5812. category: 'packages',
  5813. fn: function (packageName){
  5814. var self=this;
  5815. var pkg;
  5816. return smalltalk.withContext(function($ctx1) {
  5817. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5818. return smalltalk.withContext(function($ctx2) {
  5819. return self._error_("Missing package: ".__comma(packageName));
  5820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5821. _st(_st(pkg)._classes())._do_((function(each){
  5822. return smalltalk.withContext(function($ctx2) {
  5823. return self._removeClass_(each);
  5824. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5825. self._deletePackage_(packageName);
  5826. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  5827. args: ["packageName"],
  5828. 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",
  5829. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  5830. referencedClasses: []
  5831. }),
  5832. smalltalk.Smalltalk);
  5833. smalltalk.addMethod(
  5834. smalltalk.method({
  5835. selector: "renamePackage:to:",
  5836. category: 'packages',
  5837. fn: function (packageName,newName){
  5838. var self=this;
  5839. var pkg;
  5840. return smalltalk.withContext(function($ctx1) {
  5841. var $1;
  5842. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  5843. return smalltalk.withContext(function($ctx2) {
  5844. return self._error_("Missing package: ".__comma(packageName));
  5845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5846. $1=self._packageAt_(newName);
  5847. if(($receiver = $1) == nil || $receiver == undefined){
  5848. $1;
  5849. } else {
  5850. self._error_("Already exists a package called: ".__comma(newName));
  5851. };
  5852. _st(self._basicAt_("packages"))._at_put_(newName,pkg);
  5853. _st(pkg)._name_(newName);
  5854. self._deletePackage_(packageName);
  5855. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  5856. args: ["packageName", "newName"],
  5857. 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 basicAt: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  5858. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "basicAt:", "name:", "deletePackage:"],
  5859. referencedClasses: []
  5860. }),
  5861. smalltalk.Smalltalk);
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "reservedWords",
  5865. category: 'accessing',
  5866. fn: function (){
  5867. var self=this;
  5868. return smalltalk.withContext(function($ctx1) {
  5869. return self.reservedWords;
  5870. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  5871. args: [],
  5872. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  5873. messageSends: [],
  5874. referencedClasses: []
  5875. }),
  5876. smalltalk.Smalltalk);
  5877. smalltalk.addMethod(
  5878. smalltalk.method({
  5879. selector: "version",
  5880. category: 'accessing',
  5881. fn: function (){
  5882. var self=this;
  5883. return smalltalk.withContext(function($ctx1) {
  5884. return "0.10";
  5885. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  5886. args: [],
  5887. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.10'",
  5888. messageSends: [],
  5889. referencedClasses: []
  5890. }),
  5891. smalltalk.Smalltalk);
  5892. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  5893. smalltalk.addMethod(
  5894. smalltalk.method({
  5895. selector: "current",
  5896. category: 'accessing',
  5897. fn: function (){
  5898. var self=this;
  5899. return smalltalk.withContext(function($ctx1) {
  5900. return smalltalk;
  5901. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  5902. args: [],
  5903. source: "current\x0a\x09<return smalltalk>",
  5904. messageSends: [],
  5905. referencedClasses: []
  5906. }),
  5907. smalltalk.Smalltalk.klass);
  5908. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  5909. smalltalk.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.";
  5910. smalltalk.addMethod(
  5911. smalltalk.method({
  5912. selector: "clearInterval",
  5913. category: 'timeout/interval',
  5914. fn: function (){
  5915. var self=this;
  5916. return smalltalk.withContext(function($ctx1) {
  5917. var interval = self["@rawTimeout"];
  5918. clearInterval(interval);
  5919. ;
  5920. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  5921. args: [],
  5922. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  5923. messageSends: [],
  5924. referencedClasses: []
  5925. }),
  5926. smalltalk.Timeout);
  5927. smalltalk.addMethod(
  5928. smalltalk.method({
  5929. selector: "clearTimeout",
  5930. category: 'timeout/interval',
  5931. fn: function (){
  5932. var self=this;
  5933. return smalltalk.withContext(function($ctx1) {
  5934. var timeout = self["@rawTimeout"];
  5935. clearTimeout(timeout);
  5936. ;
  5937. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  5938. args: [],
  5939. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  5940. messageSends: [],
  5941. referencedClasses: []
  5942. }),
  5943. smalltalk.Timeout);
  5944. smalltalk.addMethod(
  5945. smalltalk.method({
  5946. selector: "rawTimeout:",
  5947. category: 'accessing',
  5948. fn: function (anObject){
  5949. var self=this;
  5950. return smalltalk.withContext(function($ctx1) {
  5951. self["@rawTimeout"]=anObject;
  5952. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  5953. args: ["anObject"],
  5954. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  5955. messageSends: [],
  5956. referencedClasses: []
  5957. }),
  5958. smalltalk.Timeout);
  5959. smalltalk.addMethod(
  5960. smalltalk.method({
  5961. selector: "on:",
  5962. category: 'instance creation',
  5963. fn: function (anObject){
  5964. var self=this;
  5965. return smalltalk.withContext(function($ctx1) {
  5966. var $2,$3,$1;
  5967. $2=self._new();
  5968. _st($2)._rawTimeout_(anObject);
  5969. $3=_st($2)._yourself();
  5970. $1=$3;
  5971. return $1;
  5972. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  5973. args: ["anObject"],
  5974. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  5975. messageSends: ["rawTimeout:", "new", "yourself"],
  5976. referencedClasses: []
  5977. }),
  5978. smalltalk.Timeout.klass);
  5979. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  5980. smalltalk.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`.";
  5981. smalltalk.addMethod(
  5982. smalltalk.method({
  5983. selector: "asJSON",
  5984. category: 'converting',
  5985. fn: function (){
  5986. var self=this;
  5987. return smalltalk.withContext(function($ctx1) {
  5988. var $1;
  5989. $1=null;
  5990. return $1;
  5991. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  5992. args: [],
  5993. source: "asJSON\x0a\x09^null",
  5994. messageSends: [],
  5995. referencedClasses: []
  5996. }),
  5997. smalltalk.UndefinedObject);
  5998. smalltalk.addMethod(
  5999. smalltalk.method({
  6000. selector: "deepCopy",
  6001. category: 'copying',
  6002. fn: function (){
  6003. var self=this;
  6004. return smalltalk.withContext(function($ctx1) {
  6005. var $1;
  6006. $1=self;
  6007. return $1;
  6008. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  6009. args: [],
  6010. source: "deepCopy\x0a\x09^self",
  6011. messageSends: [],
  6012. referencedClasses: []
  6013. }),
  6014. smalltalk.UndefinedObject);
  6015. smalltalk.addMethod(
  6016. smalltalk.method({
  6017. selector: "ifNil:",
  6018. category: 'testing',
  6019. fn: function (aBlock){
  6020. var self=this;
  6021. return smalltalk.withContext(function($ctx1) {
  6022. var $2,$1;
  6023. $2=self;
  6024. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  6025. return smalltalk.withContext(function($ctx2) {
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6027. return $1;
  6028. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  6029. args: ["aBlock"],
  6030. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  6031. messageSends: ["ifNil:ifNotNil:"],
  6032. referencedClasses: []
  6033. }),
  6034. smalltalk.UndefinedObject);
  6035. smalltalk.addMethod(
  6036. smalltalk.method({
  6037. selector: "ifNil:ifNotNil:",
  6038. category: 'testing',
  6039. fn: function (aBlock,anotherBlock){
  6040. var self=this;
  6041. return smalltalk.withContext(function($ctx1) {
  6042. var $1;
  6043. $1=_st(aBlock)._value();
  6044. return $1;
  6045. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  6046. args: ["aBlock", "anotherBlock"],
  6047. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  6048. messageSends: ["value"],
  6049. referencedClasses: []
  6050. }),
  6051. smalltalk.UndefinedObject);
  6052. smalltalk.addMethod(
  6053. smalltalk.method({
  6054. selector: "ifNotNil:",
  6055. category: 'testing',
  6056. fn: function (aBlock){
  6057. var self=this;
  6058. return smalltalk.withContext(function($ctx1) {
  6059. var $1;
  6060. $1=self;
  6061. return $1;
  6062. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  6063. args: ["aBlock"],
  6064. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  6065. messageSends: [],
  6066. referencedClasses: []
  6067. }),
  6068. smalltalk.UndefinedObject);
  6069. smalltalk.addMethod(
  6070. smalltalk.method({
  6071. selector: "ifNotNil:ifNil:",
  6072. category: 'testing',
  6073. fn: function (aBlock,anotherBlock){
  6074. var self=this;
  6075. return smalltalk.withContext(function($ctx1) {
  6076. var $1;
  6077. $1=_st(anotherBlock)._value();
  6078. return $1;
  6079. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  6080. args: ["aBlock", "anotherBlock"],
  6081. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  6082. messageSends: ["value"],
  6083. referencedClasses: []
  6084. }),
  6085. smalltalk.UndefinedObject);
  6086. smalltalk.addMethod(
  6087. smalltalk.method({
  6088. selector: "isImmutable",
  6089. category: 'testing',
  6090. fn: function (){
  6091. var self=this;
  6092. return smalltalk.withContext(function($ctx1) {
  6093. return true;
  6094. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  6095. args: [],
  6096. source: "isImmutable\x0a\x09^ true",
  6097. messageSends: [],
  6098. referencedClasses: []
  6099. }),
  6100. smalltalk.UndefinedObject);
  6101. smalltalk.addMethod(
  6102. smalltalk.method({
  6103. selector: "isNil",
  6104. category: 'testing',
  6105. fn: function (){
  6106. var self=this;
  6107. return smalltalk.withContext(function($ctx1) {
  6108. return true;
  6109. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  6110. args: [],
  6111. source: "isNil\x0a\x09^true",
  6112. messageSends: [],
  6113. referencedClasses: []
  6114. }),
  6115. smalltalk.UndefinedObject);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "notNil",
  6119. category: 'testing',
  6120. fn: function (){
  6121. var self=this;
  6122. return smalltalk.withContext(function($ctx1) {
  6123. return false;
  6124. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  6125. args: [],
  6126. source: "notNil\x0a\x09^false",
  6127. messageSends: [],
  6128. referencedClasses: []
  6129. }),
  6130. smalltalk.UndefinedObject);
  6131. smalltalk.addMethod(
  6132. smalltalk.method({
  6133. selector: "printOn:",
  6134. category: 'printing',
  6135. fn: function (aStream){
  6136. var self=this;
  6137. return smalltalk.withContext(function($ctx1) {
  6138. _st(aStream)._nextPutAll_("nil");
  6139. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  6140. args: ["aStream"],
  6141. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6142. messageSends: ["nextPutAll:"],
  6143. referencedClasses: []
  6144. }),
  6145. smalltalk.UndefinedObject);
  6146. smalltalk.addMethod(
  6147. smalltalk.method({
  6148. selector: "shallowCopy",
  6149. category: 'copying',
  6150. fn: function (){
  6151. var self=this;
  6152. return smalltalk.withContext(function($ctx1) {
  6153. var $1;
  6154. $1=self;
  6155. return $1;
  6156. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  6157. args: [],
  6158. source: "shallowCopy\x0a\x09^self",
  6159. messageSends: [],
  6160. referencedClasses: []
  6161. }),
  6162. smalltalk.UndefinedObject);
  6163. smalltalk.addMethod(
  6164. smalltalk.method({
  6165. selector: "subclass:instanceVariableNames:",
  6166. category: 'class creation',
  6167. fn: function (aString,anotherString){
  6168. var self=this;
  6169. return smalltalk.withContext(function($ctx1) {
  6170. var $1;
  6171. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6172. return $1;
  6173. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  6174. args: ["aString", "anotherString"],
  6175. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  6176. messageSends: ["subclass:instanceVariableNames:package:"],
  6177. referencedClasses: []
  6178. }),
  6179. smalltalk.UndefinedObject);
  6180. smalltalk.addMethod(
  6181. smalltalk.method({
  6182. selector: "subclass:instanceVariableNames:category:",
  6183. category: 'class creation',
  6184. fn: function (aString,aString2,aString3){
  6185. var self=this;
  6186. return smalltalk.withContext(function($ctx1) {
  6187. var $1;
  6188. self._deprecatedAPI();
  6189. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6190. return $1;
  6191. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  6192. args: ["aString", "aString2", "aString3"],
  6193. 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",
  6194. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6195. referencedClasses: []
  6196. }),
  6197. smalltalk.UndefinedObject);
  6198. smalltalk.addMethod(
  6199. smalltalk.method({
  6200. selector: "subclass:instanceVariableNames:package:",
  6201. category: 'class creation',
  6202. fn: function (aString,aString2,aString3){
  6203. var self=this;
  6204. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6205. return smalltalk.withContext(function($ctx1) {
  6206. var $1;
  6207. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6208. return $1;
  6209. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  6210. args: ["aString", "aString2", "aString3"],
  6211. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6212. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  6213. referencedClasses: ["ClassBuilder"]
  6214. }),
  6215. smalltalk.UndefinedObject);
  6216. smalltalk.addMethod(
  6217. smalltalk.method({
  6218. selector: "new",
  6219. category: 'instance creation',
  6220. fn: function (){
  6221. var self=this;
  6222. return smalltalk.withContext(function($ctx1) {
  6223. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6224. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  6225. args: [],
  6226. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6227. messageSends: ["error:"],
  6228. referencedClasses: []
  6229. }),
  6230. smalltalk.UndefinedObject.klass);
  6231. smalltalk.addMethod(
  6232. smalltalk.method({
  6233. selector: "asJavaScriptSelector",
  6234. category: '*Kernel-Objects',
  6235. fn: function (){
  6236. var self=this;
  6237. return smalltalk.withContext(function($ctx1) {
  6238. var $1;
  6239. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  6240. return $1;
  6241. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  6242. args: [],
  6243. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  6244. messageSends: ["replace:with:"],
  6245. referencedClasses: []
  6246. }),
  6247. smalltalk.String);
  6248. smalltalk.addPackage('Kernel-Classes');
  6249. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  6250. smalltalk.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.";
  6251. smalltalk.addMethod(
  6252. smalltalk.method({
  6253. selector: ">>",
  6254. category: 'accessing',
  6255. fn: function (aString){
  6256. var self=this;
  6257. return smalltalk.withContext(function($ctx1) {
  6258. var $1;
  6259. $1=self._methodAt_(aString);
  6260. return $1;
  6261. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},smalltalk.Behavior)})},
  6262. args: ["aString"],
  6263. source: ">> aString\x0a\x09^ self methodAt: aString",
  6264. messageSends: ["methodAt:"],
  6265. referencedClasses: []
  6266. }),
  6267. smalltalk.Behavior);
  6268. smalltalk.addMethod(
  6269. smalltalk.method({
  6270. selector: "addCompiledMethod:",
  6271. category: 'compiling',
  6272. fn: function (aMethod){
  6273. var self=this;
  6274. var oldMethod,announcement;
  6275. function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  6276. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  6277. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6278. return smalltalk.withContext(function($ctx1) {
  6279. var $1,$2,$3,$4,$5,$6;
  6280. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  6281. return smalltalk.withContext(function($ctx2) {
  6282. return nil;
  6283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6284. $1=_st(self._protocols())._includes_(_st(aMethod)._protocol());
  6285. if(! smalltalk.assert($1)){
  6286. _st(self._organization())._addElement_(_st(aMethod)._protocol());
  6287. };
  6288. self._basicAddCompiledMethod_(aMethod);
  6289. $2=oldMethod;
  6290. if(($receiver = $2) == nil || $receiver == undefined){
  6291. $3=_st($MethodAdded())._new();
  6292. _st($3)._method_(aMethod);
  6293. $4=_st($3)._yourself();
  6294. announcement=$4;
  6295. } else {
  6296. $5=_st($MethodModified())._new();
  6297. _st($5)._oldMethod_(oldMethod);
  6298. _st($5)._method_(aMethod);
  6299. $6=_st($5)._yourself();
  6300. announcement=$6;
  6301. };
  6302. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  6303. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})},
  6304. args: ["aMethod"],
  6305. 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\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",
  6306. messageSends: ["at:ifAbsent:", "selector", "methodDictionary", "ifFalse:", "addElement:", "protocol", "organization", "includes:", "protocols", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  6307. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  6308. }),
  6309. smalltalk.Behavior);
  6310. smalltalk.addMethod(
  6311. smalltalk.method({
  6312. selector: "allInstanceVariableNames",
  6313. category: 'accessing',
  6314. fn: function (){
  6315. var self=this;
  6316. var result;
  6317. return smalltalk.withContext(function($ctx1) {
  6318. var $1,$2;
  6319. result=_st(self._instanceVariableNames())._copy();
  6320. $1=self._superclass();
  6321. if(($receiver = $1) == nil || $receiver == undefined){
  6322. $1;
  6323. } else {
  6324. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  6325. };
  6326. $2=result;
  6327. return $2;
  6328. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})},
  6329. args: [],
  6330. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  6331. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  6332. referencedClasses: []
  6333. }),
  6334. smalltalk.Behavior);
  6335. smalltalk.addMethod(
  6336. smalltalk.method({
  6337. selector: "allSelectors",
  6338. category: 'accessing',
  6339. fn: function (){
  6340. var self=this;
  6341. return smalltalk.withContext(function($ctx1) {
  6342. var $2,$3,$1;
  6343. $1=_st(self._allSuperclasses())._inject_into_(self._selectors(),(function(soFar,aBehavior){
  6344. return smalltalk.withContext(function($ctx2) {
  6345. $2=soFar;
  6346. _st($2)._addAll_(_st(aBehavior)._selectors());
  6347. $3=_st($2)._yourself();
  6348. return $3;
  6349. }, function($ctx2) {$ctx2.fillBlock({soFar:soFar,aBehavior:aBehavior},$ctx1)})}));
  6350. return $1;
  6351. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
  6352. args: [],
  6353. source: "allSelectors\x0a\x09^self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :soFar :aBehavior | soFar addAll: aBehavior selectors; yourself ]",
  6354. messageSends: ["inject:into:", "selectors", "addAll:", "yourself", "allSuperclasses"],
  6355. referencedClasses: []
  6356. }),
  6357. smalltalk.Behavior);
  6358. smalltalk.addMethod(
  6359. smalltalk.method({
  6360. selector: "allSubclasses",
  6361. category: 'accessing',
  6362. fn: function (){
  6363. var self=this;
  6364. var result;
  6365. return smalltalk.withContext(function($ctx1) {
  6366. var $1;
  6367. result=self._subclasses();
  6368. _st(self._subclasses())._do_((function(each){
  6369. return smalltalk.withContext(function($ctx2) {
  6370. return _st(result)._addAll_(_st(each)._allSubclasses());
  6371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6372. $1=result;
  6373. return $1;
  6374. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result},smalltalk.Behavior)})},
  6375. args: [],
  6376. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09\x09result addAll: each allSubclasses].\x0a\x09^result",
  6377. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  6378. referencedClasses: []
  6379. }),
  6380. smalltalk.Behavior);
  6381. smalltalk.addMethod(
  6382. smalltalk.method({
  6383. selector: "allSubclassesDo:",
  6384. category: 'enumerating',
  6385. fn: function (aBlock){
  6386. var self=this;
  6387. return smalltalk.withContext(function($ctx1) {
  6388. _st(self._subclasses())._do_((function(each){
  6389. return smalltalk.withContext(function($ctx2) {
  6390. _st(aBlock)._value_(each);
  6391. return _st(each)._allSubclassesDo_(aBlock);
  6392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6393. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
  6394. args: ["aBlock"],
  6395. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self subclasses do: [ :each |\x0a \x09aBlock value: each.\x0a each allSubclassesDo: aBlock ].",
  6396. messageSends: ["do:", "value:", "allSubclassesDo:", "subclasses"],
  6397. referencedClasses: []
  6398. }),
  6399. smalltalk.Behavior);
  6400. smalltalk.addMethod(
  6401. smalltalk.method({
  6402. selector: "allSuperclasses",
  6403. category: 'accessing',
  6404. fn: function (){
  6405. var self=this;
  6406. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6407. return smalltalk.withContext(function($ctx1) {
  6408. var $1,$2,$4,$5,$3;
  6409. $1=self._superclass();
  6410. if(($receiver = $1) == nil || $receiver == undefined){
  6411. $2=[];
  6412. return $2;
  6413. } else {
  6414. $1;
  6415. };
  6416. $4=_st($OrderedCollection())._with_(self._superclass());
  6417. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  6418. $5=_st($4)._yourself();
  6419. $3=$5;
  6420. return $3;
  6421. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})},
  6422. args: [],
  6423. 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",
  6424. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  6425. referencedClasses: ["OrderedCollection"]
  6426. }),
  6427. smalltalk.Behavior);
  6428. smalltalk.addMethod(
  6429. smalltalk.method({
  6430. selector: "basicAddCompiledMethod:",
  6431. category: 'private',
  6432. fn: function (aMethod){
  6433. var self=this;
  6434. return smalltalk.withContext(function($ctx1) {
  6435. smalltalk.addMethod(aMethod, self);
  6436. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6437. args: ["aMethod"],
  6438. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  6439. messageSends: [],
  6440. referencedClasses: []
  6441. }),
  6442. smalltalk.Behavior);
  6443. smalltalk.addMethod(
  6444. smalltalk.method({
  6445. selector: "basicNew",
  6446. category: 'instance creation',
  6447. fn: function (){
  6448. var self=this;
  6449. return smalltalk.withContext(function($ctx1) {
  6450. return new self.fn();
  6451. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
  6452. args: [],
  6453. source: "basicNew\x0a\x09<return new self.fn()>",
  6454. messageSends: [],
  6455. referencedClasses: []
  6456. }),
  6457. smalltalk.Behavior);
  6458. smalltalk.addMethod(
  6459. smalltalk.method({
  6460. selector: "basicRemoveCompiledMethod:",
  6461. category: 'private',
  6462. fn: function (aMethod){
  6463. var self=this;
  6464. return smalltalk.withContext(function($ctx1) {
  6465. smalltalk.removeMethod(aMethod)
  6466. smalltalk.init(self);
  6467. ;
  6468. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  6469. args: ["aMethod"],
  6470. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a\x09\x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a\x09>",
  6471. messageSends: [],
  6472. referencedClasses: []
  6473. }),
  6474. smalltalk.Behavior);
  6475. smalltalk.addMethod(
  6476. smalltalk.method({
  6477. selector: "canUnderstand:",
  6478. category: 'testing',
  6479. fn: function (aSelector){
  6480. var self=this;
  6481. return smalltalk.withContext(function($ctx1) {
  6482. var $1;
  6483. $1=_st(_st(_st(self._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  6484. return smalltalk.withContext(function($ctx2) {
  6485. return _st(_st(self._superclass())._notNil())._and_((function(){
  6486. return smalltalk.withContext(function($ctx3) {
  6487. return _st(self._superclass())._canUnderstand_(aSelector);
  6488. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  6489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6490. return $1;
  6491. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
  6492. args: ["aSelector"],
  6493. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  6494. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  6495. referencedClasses: []
  6496. }),
  6497. smalltalk.Behavior);
  6498. smalltalk.addMethod(
  6499. smalltalk.method({
  6500. selector: "comment",
  6501. category: 'accessing',
  6502. fn: function (){
  6503. var self=this;
  6504. return smalltalk.withContext(function($ctx1) {
  6505. var $2,$1;
  6506. $2=self._basicAt_("comment");
  6507. if(($receiver = $2) == nil || $receiver == undefined){
  6508. $1="";
  6509. } else {
  6510. $1=$2;
  6511. };
  6512. return $1;
  6513. }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
  6514. args: [],
  6515. source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
  6516. messageSends: ["ifNil:", "basicAt:"],
  6517. referencedClasses: []
  6518. }),
  6519. smalltalk.Behavior);
  6520. smalltalk.addMethod(
  6521. smalltalk.method({
  6522. selector: "comment:",
  6523. category: 'accessing',
  6524. fn: function (aString){
  6525. var self=this;
  6526. function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  6527. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6528. return smalltalk.withContext(function($ctx1) {
  6529. var $1,$2;
  6530. self._basicAt_put_("comment",aString);
  6531. $1=_st($ClassCommentChanged())._new();
  6532. _st($1)._theClass_(self);
  6533. $2=_st($1)._yourself();
  6534. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6535. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})},
  6536. args: ["aString"],
  6537. 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)",
  6538. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  6539. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  6540. }),
  6541. smalltalk.Behavior);
  6542. smalltalk.addMethod(
  6543. smalltalk.method({
  6544. selector: "commentStamp",
  6545. category: 'accessing',
  6546. fn: function (){
  6547. var self=this;
  6548. function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  6549. return smalltalk.withContext(function($ctx1) {
  6550. var $2,$3,$1;
  6551. $2=_st($ClassCommentReader())._new();
  6552. _st($2)._class_(self);
  6553. $3=_st($2)._yourself();
  6554. $1=$3;
  6555. return $1;
  6556. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
  6557. args: [],
  6558. source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  6559. messageSends: ["class:", "new", "yourself"],
  6560. referencedClasses: ["ClassCommentReader"]
  6561. }),
  6562. smalltalk.Behavior);
  6563. smalltalk.addMethod(
  6564. smalltalk.method({
  6565. selector: "commentStamp:prior:",
  6566. category: 'accessing',
  6567. fn: function (aStamp,prior){
  6568. var self=this;
  6569. return smalltalk.withContext(function($ctx1) {
  6570. var $1;
  6571. $1=self._commentStamp();
  6572. return $1;
  6573. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
  6574. args: ["aStamp", "prior"],
  6575. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
  6576. messageSends: ["commentStamp"],
  6577. referencedClasses: []
  6578. }),
  6579. smalltalk.Behavior);
  6580. smalltalk.addMethod(
  6581. smalltalk.method({
  6582. selector: "compile:",
  6583. category: 'compiling',
  6584. fn: function (aString){
  6585. var self=this;
  6586. return smalltalk.withContext(function($ctx1) {
  6587. var $1;
  6588. $1=self._compile_category_(aString,"");
  6589. return $1;
  6590. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
  6591. args: ["aString"],
  6592. source: "compile: aString\x0a\x09^ self compile: aString category: ''",
  6593. messageSends: ["compile:category:"],
  6594. referencedClasses: []
  6595. }),
  6596. smalltalk.Behavior);
  6597. smalltalk.addMethod(
  6598. smalltalk.method({
  6599. selector: "compile:category:",
  6600. category: 'compiling',
  6601. fn: function (aString,anotherString){
  6602. var self=this;
  6603. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6604. return smalltalk.withContext(function($ctx1) {
  6605. var $1;
  6606. $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
  6607. return $1;
  6608. }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
  6609. args: ["aString", "anotherString"],
  6610. source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
  6611. messageSends: ["install:forClass:category:", "new"],
  6612. referencedClasses: ["Compiler"]
  6613. }),
  6614. smalltalk.Behavior);
  6615. smalltalk.addMethod(
  6616. smalltalk.method({
  6617. selector: "definition",
  6618. category: 'accessing',
  6619. fn: function (){
  6620. var self=this;
  6621. return smalltalk.withContext(function($ctx1) {
  6622. return "";
  6623. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
  6624. args: [],
  6625. source: "definition\x0a\x09^ ''",
  6626. messageSends: [],
  6627. referencedClasses: []
  6628. }),
  6629. smalltalk.Behavior);
  6630. smalltalk.addMethod(
  6631. smalltalk.method({
  6632. selector: "includesBehavior:",
  6633. category: 'testing',
  6634. fn: function (aClass){
  6635. var self=this;
  6636. return smalltalk.withContext(function($ctx1) {
  6637. var $1;
  6638. $1=_st(self.__eq_eq(aClass))._or_((function(){
  6639. return smalltalk.withContext(function($ctx2) {
  6640. return self._inheritsFrom_(aClass);
  6641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6642. return $1;
  6643. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
  6644. args: ["aClass"],
  6645. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6646. messageSends: ["or:", "inheritsFrom:", "=="],
  6647. referencedClasses: []
  6648. }),
  6649. smalltalk.Behavior);
  6650. smalltalk.addMethod(
  6651. smalltalk.method({
  6652. selector: "includesSelector:",
  6653. category: 'testing',
  6654. fn: function (aString){
  6655. var self=this;
  6656. return smalltalk.withContext(function($ctx1) {
  6657. var $1;
  6658. $1=_st(self._methodDictionary())._includesKey_(aString);
  6659. return $1;
  6660. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
  6661. args: ["aString"],
  6662. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6663. messageSends: ["includesKey:", "methodDictionary"],
  6664. referencedClasses: []
  6665. }),
  6666. smalltalk.Behavior);
  6667. smalltalk.addMethod(
  6668. smalltalk.method({
  6669. selector: "inheritsFrom:",
  6670. category: 'testing',
  6671. fn: function (aClass){
  6672. var self=this;
  6673. return smalltalk.withContext(function($ctx1) {
  6674. var $1,$2;
  6675. $1=self._superclass();
  6676. if(($receiver = $1) == nil || $receiver == undefined){
  6677. return false;
  6678. } else {
  6679. $1;
  6680. };
  6681. $2=_st(_st(aClass).__eq_eq(self._superclass()))._or_((function(){
  6682. return smalltalk.withContext(function($ctx2) {
  6683. return _st(self._superclass())._inheritsFrom_(aClass);
  6684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6685. return $2;
  6686. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
  6687. args: ["aClass"],
  6688. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6689. messageSends: ["ifNil:", "superclass", "or:", "inheritsFrom:", "=="],
  6690. referencedClasses: []
  6691. }),
  6692. smalltalk.Behavior);
  6693. smalltalk.addMethod(
  6694. smalltalk.method({
  6695. selector: "instanceVariableNames",
  6696. category: 'accessing',
  6697. fn: function (){
  6698. var self=this;
  6699. return smalltalk.withContext(function($ctx1) {
  6700. return self.iVarNames;
  6701. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
  6702. args: [],
  6703. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6704. messageSends: [],
  6705. referencedClasses: []
  6706. }),
  6707. smalltalk.Behavior);
  6708. smalltalk.addMethod(
  6709. smalltalk.method({
  6710. selector: "isBehavior",
  6711. category: 'testing',
  6712. fn: function (){
  6713. var self=this;
  6714. return smalltalk.withContext(function($ctx1) {
  6715. return true;
  6716. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
  6717. args: [],
  6718. source: "isBehavior\x0a\x09^ true",
  6719. messageSends: [],
  6720. referencedClasses: []
  6721. }),
  6722. smalltalk.Behavior);
  6723. smalltalk.addMethod(
  6724. smalltalk.method({
  6725. selector: "lookupSelector:",
  6726. category: 'accessing',
  6727. fn: function (selector){
  6728. var self=this;
  6729. var lookupClass;
  6730. return smalltalk.withContext(function($ctx1) {
  6731. var $1,$2;
  6732. var $early={};
  6733. try {
  6734. lookupClass=self;
  6735. _st((function(){
  6736. return smalltalk.withContext(function($ctx2) {
  6737. return _st(lookupClass).__eq(nil);
  6738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  6739. return smalltalk.withContext(function($ctx2) {
  6740. $1=_st(lookupClass)._includesSelector_(selector);
  6741. if(smalltalk.assert($1)){
  6742. $2=_st(lookupClass)._methodAt_(selector);
  6743. throw $early=[$2];
  6744. };
  6745. lookupClass=_st(lookupClass)._superclass();
  6746. return lookupClass;
  6747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  6748. return nil;
  6749. }
  6750. catch(e) {if(e===$early)return e[0]; throw e}
  6751. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})},
  6752. args: ["selector"],
  6753. 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",
  6754. messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
  6755. referencedClasses: []
  6756. }),
  6757. smalltalk.Behavior);
  6758. smalltalk.addMethod(
  6759. smalltalk.method({
  6760. selector: "methodAt:",
  6761. category: 'accessing',
  6762. fn: function (aString){
  6763. var self=this;
  6764. return smalltalk.withContext(function($ctx1) {
  6765. var $1;
  6766. $1=_st(self._methodDictionary())._at_(aString);
  6767. return $1;
  6768. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
  6769. args: ["aString"],
  6770. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6771. messageSends: ["at:", "methodDictionary"],
  6772. referencedClasses: []
  6773. }),
  6774. smalltalk.Behavior);
  6775. smalltalk.addMethod(
  6776. smalltalk.method({
  6777. selector: "methodDictionary",
  6778. category: 'accessing',
  6779. fn: function (){
  6780. var self=this;
  6781. return smalltalk.withContext(function($ctx1) {
  6782. var dict = smalltalk.HashedCollection._new();
  6783. var methods = self.methods;
  6784. for(var i in methods) {
  6785. if(methods[i].selector) {
  6786. dict._at_put_(methods[i].selector, methods[i]);
  6787. }
  6788. };
  6789. return dict;
  6790. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
  6791. args: [],
  6792. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09for(var i in methods) {\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>",
  6793. messageSends: [],
  6794. referencedClasses: []
  6795. }),
  6796. smalltalk.Behavior);
  6797. smalltalk.addMethod(
  6798. smalltalk.method({
  6799. selector: "methods",
  6800. category: 'accessing',
  6801. fn: function (){
  6802. var self=this;
  6803. return smalltalk.withContext(function($ctx1) {
  6804. var $1;
  6805. $1=_st(self._methodDictionary())._values();
  6806. return $1;
  6807. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
  6808. args: [],
  6809. source: "methods\x0a\x09^ self methodDictionary values",
  6810. messageSends: ["values", "methodDictionary"],
  6811. referencedClasses: []
  6812. }),
  6813. smalltalk.Behavior);
  6814. smalltalk.addMethod(
  6815. smalltalk.method({
  6816. selector: "methodsFor:",
  6817. category: 'accessing',
  6818. fn: function (aString){
  6819. var self=this;
  6820. function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  6821. return smalltalk.withContext(function($ctx1) {
  6822. var $2,$3,$1;
  6823. $2=_st($ClassCategoryReader())._new();
  6824. _st($2)._class_category_(self,aString);
  6825. $3=_st($2)._yourself();
  6826. $1=$3;
  6827. return $1;
  6828. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
  6829. args: ["aString"],
  6830. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  6831. messageSends: ["class:category:", "new", "yourself"],
  6832. referencedClasses: ["ClassCategoryReader"]
  6833. }),
  6834. smalltalk.Behavior);
  6835. smalltalk.addMethod(
  6836. smalltalk.method({
  6837. selector: "methodsFor:stamp:",
  6838. category: 'accessing',
  6839. fn: function (aString,aStamp){
  6840. var self=this;
  6841. return smalltalk.withContext(function($ctx1) {
  6842. var $1;
  6843. $1=self._methodsFor_(aString);
  6844. return $1;
  6845. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
  6846. args: ["aString", "aStamp"],
  6847. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  6848. messageSends: ["methodsFor:"],
  6849. referencedClasses: []
  6850. }),
  6851. smalltalk.Behavior);
  6852. smalltalk.addMethod(
  6853. smalltalk.method({
  6854. selector: "methodsInProtocol:",
  6855. category: 'accessing',
  6856. fn: function (aString){
  6857. var self=this;
  6858. return smalltalk.withContext(function($ctx1) {
  6859. var $1;
  6860. $1=_st(_st(self._methodDictionary())._values())._select_((function(each){
  6861. return smalltalk.withContext(function($ctx2) {
  6862. return _st(_st(each)._protocol()).__eq(aString);
  6863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  6864. return $1;
  6865. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
  6866. args: ["aString"],
  6867. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  6868. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  6869. referencedClasses: []
  6870. }),
  6871. smalltalk.Behavior);
  6872. smalltalk.addMethod(
  6873. smalltalk.method({
  6874. selector: "name",
  6875. category: 'accessing',
  6876. fn: function (){
  6877. var self=this;
  6878. return smalltalk.withContext(function($ctx1) {
  6879. return self.className || nil;
  6880. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
  6881. args: [],
  6882. source: "name\x0a\x09<return self.className || nil>",
  6883. messageSends: [],
  6884. referencedClasses: []
  6885. }),
  6886. smalltalk.Behavior);
  6887. smalltalk.addMethod(
  6888. smalltalk.method({
  6889. selector: "new",
  6890. category: 'instance creation',
  6891. fn: function (){
  6892. var self=this;
  6893. return smalltalk.withContext(function($ctx1) {
  6894. var $1;
  6895. $1=_st(self._basicNew())._initialize();
  6896. return $1;
  6897. }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
  6898. args: [],
  6899. source: "new\x0a\x09^self basicNew initialize",
  6900. messageSends: ["initialize", "basicNew"],
  6901. referencedClasses: []
  6902. }),
  6903. smalltalk.Behavior);
  6904. smalltalk.addMethod(
  6905. smalltalk.method({
  6906. selector: "organization",
  6907. category: 'accessing',
  6908. fn: function (){
  6909. var self=this;
  6910. return smalltalk.withContext(function($ctx1) {
  6911. var $1;
  6912. $1=self._basicAt_("organization");
  6913. return $1;
  6914. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
  6915. args: [],
  6916. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6917. messageSends: ["basicAt:"],
  6918. referencedClasses: []
  6919. }),
  6920. smalltalk.Behavior);
  6921. smalltalk.addMethod(
  6922. smalltalk.method({
  6923. selector: "protocols",
  6924. category: 'accessing',
  6925. fn: function (){
  6926. var self=this;
  6927. return smalltalk.withContext(function($ctx1) {
  6928. var $1;
  6929. $1=_st(_st(self._organization())._elements())._sorted();
  6930. return $1;
  6931. }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
  6932. args: [],
  6933. source: "protocols\x0a\x09^ self organization elements sorted",
  6934. messageSends: ["sorted", "elements", "organization"],
  6935. referencedClasses: []
  6936. }),
  6937. smalltalk.Behavior);
  6938. smalltalk.addMethod(
  6939. smalltalk.method({
  6940. selector: "protocolsDo:",
  6941. category: 'enumerating',
  6942. fn: function (aBlock){
  6943. var self=this;
  6944. var methodsByCategory;
  6945. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6946. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  6947. return smalltalk.withContext(function($ctx1) {
  6948. methodsByCategory=_st($HashedCollection())._new();
  6949. _st(_st(self._methodDictionary())._values())._do_((function(m){
  6950. return smalltalk.withContext(function($ctx2) {
  6951. return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  6952. return smalltalk.withContext(function($ctx3) {
  6953. return _st($Array())._new();
  6954. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})})))._add_(m);
  6955. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
  6956. _st(self._protocols())._do_((function(category){
  6957. return smalltalk.withContext(function($ctx2) {
  6958. return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  6959. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  6960. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
  6961. args: ["aBlock"],
  6962. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method category with\x0a\x09its collection of methods in the sort order of category name.\x22\x0a\x0a\x09| methodsByCategory |\x0a\x09methodsByCategory := HashedCollection new.\x0a\x09self methodDictionary values do: [:m |\x0a\x09\x09(methodsByCategory at: m category ifAbsentPut: [Array new])\x0a\x09\x09\x09add: m].\x0a\x09self protocols do: [:category |\x0a\x09\x09aBlock value: category value: (methodsByCategory at: category)]",
  6963. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  6964. referencedClasses: ["HashedCollection", "Array"]
  6965. }),
  6966. smalltalk.Behavior);
  6967. smalltalk.addMethod(
  6968. smalltalk.method({
  6969. selector: "prototype",
  6970. category: 'accessing',
  6971. fn: function (){
  6972. var self=this;
  6973. return smalltalk.withContext(function($ctx1) {
  6974. return self.fn.prototype;
  6975. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
  6976. args: [],
  6977. source: "prototype\x0a\x09<return self.fn.prototype>",
  6978. messageSends: [],
  6979. referencedClasses: []
  6980. }),
  6981. smalltalk.Behavior);
  6982. smalltalk.addMethod(
  6983. smalltalk.method({
  6984. selector: "removeCompiledMethod:",
  6985. category: 'compiling',
  6986. fn: function (aMethod){
  6987. var self=this;
  6988. function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6989. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6990. return smalltalk.withContext(function($ctx1) {
  6991. var $1,$2;
  6992. self._basicRemoveCompiledMethod_(aMethod);
  6993. _st(self._methods())._detect_ifNone_((function(each){
  6994. return smalltalk.withContext(function($ctx2) {
  6995. return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol());
  6996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  6997. return smalltalk.withContext(function($ctx2) {
  6998. return _st(self._organization())._removeElement_(_st(aMethod)._protocol());
  6999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7000. $1=_st($MethodRemoved())._new();
  7001. _st($1)._method_(aMethod);
  7002. $2=_st($1)._yourself();
  7003. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7004. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  7005. args: ["aMethod"],
  7006. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  7007. messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "=", "protocol", "removeElement:", "organization", "methods", "announce:", "method:", "new", "yourself", "current"],
  7008. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  7009. }),
  7010. smalltalk.Behavior);
  7011. smalltalk.addMethod(
  7012. smalltalk.method({
  7013. selector: "selectors",
  7014. category: 'accessing',
  7015. fn: function (){
  7016. var self=this;
  7017. return smalltalk.withContext(function($ctx1) {
  7018. var $1;
  7019. $1=_st(self._methodDictionary())._keys();
  7020. return $1;
  7021. }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
  7022. args: [],
  7023. source: "selectors\x0a\x09^ self methodDictionary keys",
  7024. messageSends: ["keys", "methodDictionary"],
  7025. referencedClasses: []
  7026. }),
  7027. smalltalk.Behavior);
  7028. smalltalk.addMethod(
  7029. smalltalk.method({
  7030. selector: "subclasses",
  7031. category: 'accessing',
  7032. fn: function (){
  7033. var self=this;
  7034. return smalltalk.withContext(function($ctx1) {
  7035. return smalltalk.subclasses(self);
  7036. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
  7037. args: [],
  7038. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  7039. messageSends: [],
  7040. referencedClasses: []
  7041. }),
  7042. smalltalk.Behavior);
  7043. smalltalk.addMethod(
  7044. smalltalk.method({
  7045. selector: "superclass",
  7046. category: 'accessing',
  7047. fn: function (){
  7048. var self=this;
  7049. return smalltalk.withContext(function($ctx1) {
  7050. return self.superclass || nil;
  7051. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
  7052. args: [],
  7053. source: "superclass\x0a\x09<return self.superclass || nil>",
  7054. messageSends: [],
  7055. referencedClasses: []
  7056. }),
  7057. smalltalk.Behavior);
  7058. smalltalk.addMethod(
  7059. smalltalk.method({
  7060. selector: "theMetaClass",
  7061. category: 'accessing',
  7062. fn: function (){
  7063. var self=this;
  7064. return smalltalk.withContext(function($ctx1) {
  7065. var $1;
  7066. $1=self._class();
  7067. return $1;
  7068. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
  7069. args: [],
  7070. source: "theMetaClass\x0a\x09^ self class",
  7071. messageSends: ["class"],
  7072. referencedClasses: []
  7073. }),
  7074. smalltalk.Behavior);
  7075. smalltalk.addMethod(
  7076. smalltalk.method({
  7077. selector: "theNonMetaClass",
  7078. category: 'accessing',
  7079. fn: function (){
  7080. var self=this;
  7081. return smalltalk.withContext(function($ctx1) {
  7082. var $1;
  7083. $1=self;
  7084. return $1;
  7085. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
  7086. args: [],
  7087. source: "theNonMetaClass\x0a\x09^ self",
  7088. messageSends: [],
  7089. referencedClasses: []
  7090. }),
  7091. smalltalk.Behavior);
  7092. smalltalk.addMethod(
  7093. smalltalk.method({
  7094. selector: "withAllSubclasses",
  7095. category: 'accessing',
  7096. fn: function (){
  7097. var self=this;
  7098. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7099. return smalltalk.withContext(function($ctx1) {
  7100. var $2,$3,$1;
  7101. $2=_st($Array())._with_(self);
  7102. _st($2)._addAll_(self._allSubclasses());
  7103. $3=_st($2)._yourself();
  7104. $1=$3;
  7105. return $1;
  7106. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
  7107. args: [],
  7108. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  7109. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  7110. referencedClasses: ["Array"]
  7111. }),
  7112. smalltalk.Behavior);
  7113. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  7114. smalltalk.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  7115. smalltalk.addMethod(
  7116. smalltalk.method({
  7117. selector: "asJavascript",
  7118. category: 'converting',
  7119. fn: function (){
  7120. var self=this;
  7121. return smalltalk.withContext(function($ctx1) {
  7122. var $1;
  7123. $1="smalltalk.".__comma(self._name());
  7124. return $1;
  7125. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
  7126. args: [],
  7127. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  7128. messageSends: [",", "name"],
  7129. referencedClasses: []
  7130. }),
  7131. smalltalk.Class);
  7132. smalltalk.addMethod(
  7133. smalltalk.method({
  7134. selector: "category",
  7135. category: 'accessing',
  7136. fn: function (){
  7137. var self=this;
  7138. return smalltalk.withContext(function($ctx1) {
  7139. var $2,$1;
  7140. $2=self._package();
  7141. if(($receiver = $2) == nil || $receiver == undefined){
  7142. $1="Unclassified";
  7143. } else {
  7144. $1=_st(self._package())._name();
  7145. };
  7146. return $1;
  7147. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
  7148. args: [],
  7149. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  7150. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  7151. referencedClasses: []
  7152. }),
  7153. smalltalk.Class);
  7154. smalltalk.addMethod(
  7155. smalltalk.method({
  7156. selector: "definition",
  7157. category: 'accessing',
  7158. fn: function (){
  7159. var self=this;
  7160. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7161. return smalltalk.withContext(function($ctx1) {
  7162. var $2,$3,$4,$5,$1;
  7163. $1=_st($String())._streamContents_((function(stream){
  7164. return smalltalk.withContext(function($ctx2) {
  7165. $2=stream;
  7166. _st($2)._nextPutAll_(_st(self._superclass())._asString());
  7167. _st($2)._nextPutAll_(" subclass: #");
  7168. _st($2)._nextPutAll_(self._name());
  7169. _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  7170. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  7171. $3;
  7172. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  7173. return smalltalk.withContext(function($ctx3) {
  7174. return _st(stream)._nextPutAll_(each);
  7175. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  7176. return smalltalk.withContext(function($ctx3) {
  7177. return _st(stream)._nextPutAll_(" ");
  7178. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  7179. $4=stream;
  7180. _st($4)._nextPutAll_(_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab()));
  7181. _st($4)._nextPutAll_("package: '");
  7182. _st($4)._nextPutAll_(self._category());
  7183. $5=_st($4)._nextPutAll_("'");
  7184. return $5;
  7185. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  7186. return $1;
  7187. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})},
  7188. args: [],
  7189. 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: '''' ]",
  7190. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  7191. referencedClasses: ["String"]
  7192. }),
  7193. smalltalk.Class);
  7194. smalltalk.addMethod(
  7195. smalltalk.method({
  7196. selector: "isClass",
  7197. category: 'testing',
  7198. fn: function (){
  7199. var self=this;
  7200. return smalltalk.withContext(function($ctx1) {
  7201. return true;
  7202. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
  7203. args: [],
  7204. source: "isClass\x0a\x09^true",
  7205. messageSends: [],
  7206. referencedClasses: []
  7207. }),
  7208. smalltalk.Class);
  7209. smalltalk.addMethod(
  7210. smalltalk.method({
  7211. selector: "package",
  7212. category: 'accessing',
  7213. fn: function (){
  7214. var self=this;
  7215. return smalltalk.withContext(function($ctx1) {
  7216. var $1;
  7217. $1=self._basicAt_("pkg");
  7218. return $1;
  7219. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
  7220. args: [],
  7221. source: "package\x0a\x09^ self basicAt: 'pkg'",
  7222. messageSends: ["basicAt:"],
  7223. referencedClasses: []
  7224. }),
  7225. smalltalk.Class);
  7226. smalltalk.addMethod(
  7227. smalltalk.method({
  7228. selector: "package:",
  7229. category: 'accessing',
  7230. fn: function (aPackage){
  7231. var self=this;
  7232. var oldPackage;
  7233. function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  7234. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7235. return smalltalk.withContext(function($ctx1) {
  7236. var $1,$2,$3,$4;
  7237. $1=_st(self._package()).__eq(aPackage);
  7238. if(smalltalk.assert($1)){
  7239. $2=self;
  7240. return $2;
  7241. };
  7242. oldPackage=self._package();
  7243. self._basicAt_put_("pkg",aPackage);
  7244. _st(_st(oldPackage)._organization())._removeElement_(self);
  7245. _st(_st(aPackage)._organization())._addElement_(self);
  7246. $3=_st($ClassMoved())._new();
  7247. _st($3)._theClass_(self);
  7248. _st($3)._oldPackage_(oldPackage);
  7249. $4=_st($3)._yourself();
  7250. _st(_st($SystemAnnouncer())._current())._announce_($4);
  7251. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
  7252. args: ["aPackage"],
  7253. 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)",
  7254. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "theClass:", "new", "oldPackage:", "yourself", "current"],
  7255. referencedClasses: ["ClassMoved", "SystemAnnouncer"]
  7256. }),
  7257. smalltalk.Class);
  7258. smalltalk.addMethod(
  7259. smalltalk.method({
  7260. selector: "printOn:",
  7261. category: 'printing',
  7262. fn: function (aStream){
  7263. var self=this;
  7264. return smalltalk.withContext(function($ctx1) {
  7265. _st(aStream)._nextPutAll_(self._name());
  7266. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
  7267. args: ["aStream"],
  7268. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7269. messageSends: ["nextPutAll:", "name"],
  7270. referencedClasses: []
  7271. }),
  7272. smalltalk.Class);
  7273. smalltalk.addMethod(
  7274. smalltalk.method({
  7275. selector: "rename:",
  7276. category: 'accessing',
  7277. fn: function (aString){
  7278. var self=this;
  7279. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7280. return smalltalk.withContext(function($ctx1) {
  7281. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  7282. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
  7283. args: ["aString"],
  7284. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7285. messageSends: ["renameClass:to:", "new"],
  7286. referencedClasses: ["ClassBuilder"]
  7287. }),
  7288. smalltalk.Class);
  7289. smalltalk.addMethod(
  7290. smalltalk.method({
  7291. selector: "subclass:instanceVariableNames:",
  7292. category: 'class creation',
  7293. fn: function (aString,anotherString){
  7294. var self=this;
  7295. return smalltalk.withContext(function($ctx1) {
  7296. var $1;
  7297. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7298. return $1;
  7299. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
  7300. args: ["aString", "anotherString"],
  7301. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  7302. messageSends: ["subclass:instanceVariableNames:package:"],
  7303. referencedClasses: []
  7304. }),
  7305. smalltalk.Class);
  7306. smalltalk.addMethod(
  7307. smalltalk.method({
  7308. selector: "subclass:instanceVariableNames:category:",
  7309. category: 'class creation',
  7310. fn: function (aString,aString2,aString3){
  7311. var self=this;
  7312. return smalltalk.withContext(function($ctx1) {
  7313. var $1;
  7314. self._deprecatedAPI();
  7315. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7316. return $1;
  7317. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  7318. args: ["aString", "aString2", "aString3"],
  7319. 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",
  7320. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  7321. referencedClasses: []
  7322. }),
  7323. smalltalk.Class);
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7327. category: 'class creation',
  7328. fn: function (aString,aString2,classVars,pools,aString3){
  7329. var self=this;
  7330. return smalltalk.withContext(function($ctx1) {
  7331. var $1;
  7332. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7333. return $1;
  7334. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})},
  7335. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7336. 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",
  7337. messageSends: ["subclass:instanceVariableNames:package:"],
  7338. referencedClasses: []
  7339. }),
  7340. smalltalk.Class);
  7341. smalltalk.addMethod(
  7342. smalltalk.method({
  7343. selector: "subclass:instanceVariableNames:package:",
  7344. category: 'class creation',
  7345. fn: function (aString,aString2,aString3){
  7346. var self=this;
  7347. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7348. return smalltalk.withContext(function($ctx1) {
  7349. var $1;
  7350. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  7351. return $1;
  7352. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  7353. args: ["aString", "aString2", "aString3"],
  7354. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7355. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  7356. referencedClasses: ["ClassBuilder"]
  7357. }),
  7358. smalltalk.Class);
  7359. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  7360. smalltalk.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.";
  7361. smalltalk.addMethod(
  7362. smalltalk.method({
  7363. selector: "asJavascript",
  7364. category: 'converting',
  7365. fn: function (){
  7366. var self=this;
  7367. return smalltalk.withContext(function($ctx1) {
  7368. var $1;
  7369. $1=_st("smalltalk.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  7370. return $1;
  7371. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
  7372. args: [],
  7373. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  7374. messageSends: [",", "name", "instanceClass"],
  7375. referencedClasses: []
  7376. }),
  7377. smalltalk.Metaclass);
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "definition",
  7381. category: 'accessing',
  7382. fn: function (){
  7383. var self=this;
  7384. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7385. return smalltalk.withContext(function($ctx1) {
  7386. var $2,$3,$1;
  7387. $1=_st($String())._streamContents_((function(stream){
  7388. return smalltalk.withContext(function($ctx2) {
  7389. $2=stream;
  7390. _st($2)._nextPutAll_(self._asString());
  7391. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  7392. $3;
  7393. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  7394. return smalltalk.withContext(function($ctx3) {
  7395. return _st(stream)._nextPutAll_(each);
  7396. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  7397. return smalltalk.withContext(function($ctx3) {
  7398. return _st(stream)._nextPutAll_(" ");
  7399. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  7400. return _st(stream)._nextPutAll_("'");
  7401. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  7402. return $1;
  7403. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})},
  7404. args: [],
  7405. 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: '''' ]",
  7406. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  7407. referencedClasses: ["String"]
  7408. }),
  7409. smalltalk.Metaclass);
  7410. smalltalk.addMethod(
  7411. smalltalk.method({
  7412. selector: "instanceClass",
  7413. category: 'accessing',
  7414. fn: function (){
  7415. var self=this;
  7416. return smalltalk.withContext(function($ctx1) {
  7417. return self.instanceClass;
  7418. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
  7419. args: [],
  7420. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7421. messageSends: [],
  7422. referencedClasses: []
  7423. }),
  7424. smalltalk.Metaclass);
  7425. smalltalk.addMethod(
  7426. smalltalk.method({
  7427. selector: "instanceVariableNames:",
  7428. category: 'accessing',
  7429. fn: function (aCollection){
  7430. var self=this;
  7431. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7432. return smalltalk.withContext(function($ctx1) {
  7433. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  7434. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
  7435. args: ["aCollection"],
  7436. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7437. messageSends: ["class:instanceVariableNames:", "new"],
  7438. referencedClasses: ["ClassBuilder"]
  7439. }),
  7440. smalltalk.Metaclass);
  7441. smalltalk.addMethod(
  7442. smalltalk.method({
  7443. selector: "isMetaclass",
  7444. category: 'testing',
  7445. fn: function (){
  7446. var self=this;
  7447. return smalltalk.withContext(function($ctx1) {
  7448. return true;
  7449. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
  7450. args: [],
  7451. source: "isMetaclass\x0a\x09^true",
  7452. messageSends: [],
  7453. referencedClasses: []
  7454. }),
  7455. smalltalk.Metaclass);
  7456. smalltalk.addMethod(
  7457. smalltalk.method({
  7458. selector: "printOn:",
  7459. category: 'printing',
  7460. fn: function (aStream){
  7461. var self=this;
  7462. return smalltalk.withContext(function($ctx1) {
  7463. var $1,$2;
  7464. $1=aStream;
  7465. _st($1)._nextPutAll_(_st(self._instanceClass())._name());
  7466. $2=_st($1)._nextPutAll_(" class");
  7467. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
  7468. args: ["aStream"],
  7469. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7470. messageSends: ["nextPutAll:", "name", "instanceClass"],
  7471. referencedClasses: []
  7472. }),
  7473. smalltalk.Metaclass);
  7474. smalltalk.addMethod(
  7475. smalltalk.method({
  7476. selector: "theMetaClass",
  7477. category: 'accessing',
  7478. fn: function (){
  7479. var self=this;
  7480. return smalltalk.withContext(function($ctx1) {
  7481. var $1;
  7482. $1=self;
  7483. return $1;
  7484. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
  7485. args: [],
  7486. source: "theMetaClass\x0a\x09^ self",
  7487. messageSends: [],
  7488. referencedClasses: []
  7489. }),
  7490. smalltalk.Metaclass);
  7491. smalltalk.addMethod(
  7492. smalltalk.method({
  7493. selector: "theNonMetaClass",
  7494. category: 'accessing',
  7495. fn: function (){
  7496. var self=this;
  7497. return smalltalk.withContext(function($ctx1) {
  7498. var $1;
  7499. $1=self._instanceClass();
  7500. return $1;
  7501. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
  7502. args: [],
  7503. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7504. messageSends: ["instanceClass"],
  7505. referencedClasses: []
  7506. }),
  7507. smalltalk.Metaclass);
  7508. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  7509. smalltalk.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:`.";
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7513. category: 'class definition',
  7514. fn: function (aClass,className,aCollection,packageName){
  7515. var self=this;
  7516. var theClass;
  7517. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7518. return smalltalk.withContext(function($ctx1) {
  7519. var $1,$2,$3,$4;
  7520. theClass=_st(_st($Smalltalk())._current())._at_(className);
  7521. $1=theClass;
  7522. if(($receiver = $1) == nil || $receiver == undefined){
  7523. $1;
  7524. } else {
  7525. _st(theClass)._package_(self._createPackageNamed_(packageName));
  7526. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  7527. if(! smalltalk.assert($2)){
  7528. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7529. return $3;
  7530. };
  7531. };
  7532. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7533. return $4;
  7534. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass},smalltalk.ClassBuilder)})},
  7535. args: ["aClass", "className", "aCollection", "packageName"],
  7536. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: (self createPackageNamed: packageName).\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\x09^ self\x0a\x09\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09\x09named: className\x0a\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09package: packageName",
  7537. messageSends: ["at:", "current", "ifNotNil:", "package:", "createPackageNamed:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  7538. referencedClasses: ["Smalltalk"]
  7539. }),
  7540. smalltalk.ClassBuilder);
  7541. smalltalk.addMethod(
  7542. smalltalk.method({
  7543. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7544. category: 'private',
  7545. fn: function (aClass,aString,aCollection,packageName){
  7546. var self=this;
  7547. return smalltalk.withContext(function($ctx1) {
  7548. smalltalk.addClass(aString, aClass, aCollection, packageName);
  7549. return smalltalk[aString]
  7550. ;
  7551. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
  7552. args: ["aClass", "aString", "aCollection", "packageName"],
  7553. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>",
  7554. messageSends: [],
  7555. referencedClasses: []
  7556. }),
  7557. smalltalk.ClassBuilder);
  7558. smalltalk.addMethod(
  7559. smalltalk.method({
  7560. selector: "basicClass:instanceVariableNames:",
  7561. category: 'private',
  7562. fn: function (aClass,aString){
  7563. var self=this;
  7564. return smalltalk.withContext(function($ctx1) {
  7565. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7566. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7567. args: ["aClass", "aString"],
  7568. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7569. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  7570. referencedClasses: []
  7571. }),
  7572. smalltalk.ClassBuilder);
  7573. smalltalk.addMethod(
  7574. smalltalk.method({
  7575. selector: "basicClass:instanceVariables:",
  7576. category: 'private',
  7577. fn: function (aClass,aCollection){
  7578. var self=this;
  7579. return smalltalk.withContext(function($ctx1) {
  7580. var $1;
  7581. $1=_st(aClass)._isMetaclass();
  7582. if(! smalltalk.assert($1)){
  7583. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  7584. };
  7585. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  7586. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})},
  7587. args: ["aClass", "aCollection"],
  7588. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7589. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
  7590. referencedClasses: []
  7591. }),
  7592. smalltalk.ClassBuilder);
  7593. smalltalk.addMethod(
  7594. smalltalk.method({
  7595. selector: "basicRemoveClass:",
  7596. category: 'private',
  7597. fn: function (aClass){
  7598. var self=this;
  7599. return smalltalk.withContext(function($ctx1) {
  7600. smalltalk.removeClass(aClass);
  7601. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7602. args: ["aClass"],
  7603. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  7604. messageSends: [],
  7605. referencedClasses: []
  7606. }),
  7607. smalltalk.ClassBuilder);
  7608. smalltalk.addMethod(
  7609. smalltalk.method({
  7610. selector: "basicRenameClass:to:",
  7611. category: 'private',
  7612. fn: function (aClass,aString){
  7613. var self=this;
  7614. return smalltalk.withContext(function($ctx1) {
  7615. smalltalk[aString] = aClass;
  7616. delete smalltalk[aClass.className];
  7617. aClass.className = aString;
  7618. ;
  7619. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7620. args: ["aClass", "aString"],
  7621. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7622. messageSends: [],
  7623. referencedClasses: []
  7624. }),
  7625. smalltalk.ClassBuilder);
  7626. smalltalk.addMethod(
  7627. smalltalk.method({
  7628. selector: "basicSwapClassNames:with:",
  7629. category: 'private',
  7630. fn: function (aClass,anotherClass){
  7631. var self=this;
  7632. return smalltalk.withContext(function($ctx1) {
  7633. var tmp = aClass.className;
  7634. aClass.className = anotherClass.className;
  7635. anotherClass.className = tmp;
  7636. ;
  7637. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7638. args: ["aClass", "anotherClass"],
  7639. 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>",
  7640. messageSends: [],
  7641. referencedClasses: []
  7642. }),
  7643. smalltalk.ClassBuilder);
  7644. smalltalk.addMethod(
  7645. smalltalk.method({
  7646. selector: "class:instanceVariableNames:",
  7647. category: 'class definition',
  7648. fn: function (aClass,ivarNames){
  7649. var self=this;
  7650. function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7651. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7652. return smalltalk.withContext(function($ctx1) {
  7653. var $1,$2;
  7654. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7655. self._setupClass_(aClass);
  7656. $1=_st($ClassDefinitionChanged())._new();
  7657. _st($1)._theClass_(aClass);
  7658. $2=_st($1)._yourself();
  7659. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7660. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},smalltalk.ClassBuilder)})},
  7661. args: ["aClass", "ivarNames"],
  7662. 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)",
  7663. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  7664. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  7665. }),
  7666. smalltalk.ClassBuilder);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "copyClass:named:",
  7670. category: 'copying',
  7671. fn: function (aClass,className){
  7672. var self=this;
  7673. var newClass;
  7674. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7675. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7676. return smalltalk.withContext(function($ctx1) {
  7677. var $1,$2,$3;
  7678. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7679. self._copyClass_to_(aClass,newClass);
  7680. $1=_st($ClassAdded())._new();
  7681. _st($1)._theClass_(newClass);
  7682. $2=_st($1)._yourself();
  7683. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7684. $3=newClass;
  7685. return $3;
  7686. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},smalltalk.ClassBuilder)})},
  7687. args: ["aClass", "className"],
  7688. 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",
  7689. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7690. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  7691. }),
  7692. smalltalk.ClassBuilder);
  7693. smalltalk.addMethod(
  7694. smalltalk.method({
  7695. selector: "copyClass:to:",
  7696. category: 'copying',
  7697. fn: function (aClass,anotherClass){
  7698. var self=this;
  7699. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7700. return smalltalk.withContext(function($ctx1) {
  7701. _st(anotherClass)._comment_(_st(aClass)._comment());
  7702. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  7703. return smalltalk.withContext(function($ctx2) {
  7704. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  7705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7706. self._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  7707. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  7708. return smalltalk.withContext(function($ctx2) {
  7709. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  7710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7711. self._setupClass_(anotherClass);
  7712. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7713. args: ["aClass", "anotherClass"],
  7714. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass",
  7715. messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  7716. referencedClasses: ["Compiler"]
  7717. }),
  7718. smalltalk.ClassBuilder);
  7719. smalltalk.addMethod(
  7720. smalltalk.method({
  7721. selector: "createPackageNamed:",
  7722. category: 'private',
  7723. fn: function (aString){
  7724. var self=this;
  7725. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7726. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  7727. return smalltalk.withContext(function($ctx1) {
  7728. var $1;
  7729. $1=_st($Package())._named_ifAbsent_(aString,(function(){
  7730. return smalltalk.withContext(function($ctx2) {
  7731. return _st(_st($Smalltalk())._current())._createPackage_(aString);
  7732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  7733. return $1;
  7734. }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
  7735. args: ["aString"],
  7736. source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
  7737. messageSends: ["named:ifAbsent:", "createPackage:", "current"],
  7738. referencedClasses: ["Smalltalk", "Package"]
  7739. }),
  7740. smalltalk.ClassBuilder);
  7741. smalltalk.addMethod(
  7742. smalltalk.method({
  7743. selector: "installMethod:forClass:category:",
  7744. category: 'method definition',
  7745. fn: function (aCompiledMethod,aBehavior,aString){
  7746. var self=this;
  7747. return smalltalk.withContext(function($ctx1) {
  7748. var $1;
  7749. _st(aCompiledMethod)._category_(aString);
  7750. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7751. self._setupClass_(aBehavior);
  7752. $1=aCompiledMethod;
  7753. return $1;
  7754. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
  7755. args: ["aCompiledMethod", "aBehavior", "aString"],
  7756. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  7757. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  7758. referencedClasses: []
  7759. }),
  7760. smalltalk.ClassBuilder);
  7761. smalltalk.addMethod(
  7762. smalltalk.method({
  7763. selector: "instanceVariableNamesFor:",
  7764. category: 'accessing',
  7765. fn: function (aString){
  7766. var self=this;
  7767. return smalltalk.withContext(function($ctx1) {
  7768. var $1;
  7769. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  7770. return smalltalk.withContext(function($ctx2) {
  7771. return _st(each)._isEmpty();
  7772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  7773. return $1;
  7774. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
  7775. args: ["aString"],
  7776. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7777. messageSends: ["reject:", "isEmpty", "tokenize:"],
  7778. referencedClasses: []
  7779. }),
  7780. smalltalk.ClassBuilder);
  7781. smalltalk.addMethod(
  7782. smalltalk.method({
  7783. selector: "migrateClass:superclass:",
  7784. category: 'class migration',
  7785. fn: function (aClass,anotherClass){
  7786. var self=this;
  7787. return smalltalk.withContext(function($ctx1) {
  7788. var $1;
  7789. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7790. return $1;
  7791. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  7792. args: ["aClass", "anotherClass"],
  7793. 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",
  7794. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  7795. referencedClasses: []
  7796. }),
  7797. smalltalk.ClassBuilder);
  7798. smalltalk.addMethod(
  7799. smalltalk.method({
  7800. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7801. category: 'class migration',
  7802. fn: function (className,aClass,aCollection,packageName){
  7803. var self=this;
  7804. var oldClass,newClass,tmp;
  7805. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7806. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7807. function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7808. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7809. return smalltalk.withContext(function($ctx1) {
  7810. var $1,$2,$3,$4,$5,$6,$7;
  7811. tmp="new*".__comma(className);
  7812. oldClass=_st(_st($Smalltalk())._current())._at_(className);
  7813. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7814. self._basicSwapClassNames_with_(oldClass,newClass);
  7815. _st((function(){
  7816. return smalltalk.withContext(function($ctx2) {
  7817. return self._copyClass_to_(oldClass,newClass);
  7818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(exception){
  7819. return smalltalk.withContext(function($ctx2) {
  7820. $1=self;
  7821. _st($1)._basicSwapClassNames_with_(oldClass,newClass);
  7822. $2=_st($1)._basicRemoveClass_(newClass);
  7823. $2;
  7824. return _st(exception)._signal();
  7825. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  7826. $3=self;
  7827. _st($3)._rawRenameClass_to_(oldClass,tmp);
  7828. $4=_st($3)._rawRenameClass_to_(newClass,className);
  7829. _st(_st(oldClass)._subclasses())._do_displayingProgress_((function(each){
  7830. return smalltalk.withContext(function($ctx2) {
  7831. return self._migrateClass_superclass_(each,newClass);
  7832. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),_st("Recompiling ".__comma(_st(newClass)._name())).__comma("..."));
  7833. self._basicRemoveClass_(oldClass);
  7834. $5=_st($ClassMigrated())._new();
  7835. _st($5)._theClass_(newClass);
  7836. _st($5)._oldClass_(oldClass);
  7837. $6=_st($5)._yourself();
  7838. _st(_st($SystemAnnouncer())._current())._announce_($6);
  7839. $7=newClass;
  7840. return $7;
  7841. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
  7842. args: ["className", "aClass", "aCollection", "packageName"],
  7843. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk current 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",
  7844. messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:", "rawRenameClass:to:", "do:displayingProgress:", "migrateClass:superclass:", "name", "subclasses", "announce:", "theClass:", "new", "oldClass:", "yourself"],
  7845. referencedClasses: ["Smalltalk", "Error", "ClassMigrated", "SystemAnnouncer"]
  7846. }),
  7847. smalltalk.ClassBuilder);
  7848. smalltalk.addMethod(
  7849. smalltalk.method({
  7850. selector: "rawRenameClass:to:",
  7851. category: 'private',
  7852. fn: function (aClass,aString){
  7853. var self=this;
  7854. return smalltalk.withContext(function($ctx1) {
  7855. smalltalk[aString] = aClass;
  7856. ;
  7857. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  7858. args: ["aClass", "aString"],
  7859. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
  7860. messageSends: [],
  7861. referencedClasses: []
  7862. }),
  7863. smalltalk.ClassBuilder);
  7864. smalltalk.addMethod(
  7865. smalltalk.method({
  7866. selector: "renameClass:to:",
  7867. category: 'class migration',
  7868. fn: function (aClass,className){
  7869. var self=this;
  7870. function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7871. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7872. return smalltalk.withContext(function($ctx1) {
  7873. var $1,$2;
  7874. self._basicRenameClass_to_(aClass,className);
  7875. $1=_st($ClassRenamed())._new();
  7876. _st($1)._theClass_(aClass);
  7877. $2=_st($1)._yourself();
  7878. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7879. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  7880. args: ["aClass", "className"],
  7881. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7882. messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  7883. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  7884. }),
  7885. smalltalk.ClassBuilder);
  7886. smalltalk.addMethod(
  7887. smalltalk.method({
  7888. selector: "setupClass:",
  7889. category: 'public',
  7890. fn: function (aClass){
  7891. var self=this;
  7892. return smalltalk.withContext(function($ctx1) {
  7893. smalltalk.init(aClass);;
  7894. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  7895. args: ["aClass"],
  7896. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  7897. messageSends: [],
  7898. referencedClasses: []
  7899. }),
  7900. smalltalk.ClassBuilder);
  7901. smalltalk.addMethod(
  7902. smalltalk.method({
  7903. selector: "superclass:subclass:",
  7904. category: 'class definition',
  7905. fn: function (aClass,className){
  7906. var self=this;
  7907. return smalltalk.withContext(function($ctx1) {
  7908. var $1;
  7909. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7910. return $1;
  7911. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  7912. args: ["aClass", "className"],
  7913. source: "superclass: aClass subclass: className\x0a\x09^self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7914. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  7915. referencedClasses: []
  7916. }),
  7917. smalltalk.ClassBuilder);
  7918. smalltalk.addMethod(
  7919. smalltalk.method({
  7920. selector: "superclass:subclass:instanceVariableNames:package:",
  7921. category: 'class definition',
  7922. fn: function (aClass,className,ivarNames,packageName){
  7923. var self=this;
  7924. var newClass;
  7925. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7926. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7927. return smalltalk.withContext(function($ctx1) {
  7928. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  7929. $1=self;
  7930. $2=aClass;
  7931. $3=className;
  7932. $4=self._instanceVariableNamesFor_(ivarNames);
  7933. $6=packageName;
  7934. if(($receiver = $6) == nil || $receiver == undefined){
  7935. $5="unclassified";
  7936. } else {
  7937. $5=$6;
  7938. };
  7939. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  7940. self._setupClass_(newClass);
  7941. $7=_st($ClassAdded())._new();
  7942. _st($7)._theClass_(newClass);
  7943. $8=_st($7)._yourself();
  7944. _st(_st($SystemAnnouncer())._current())._announce_($8);
  7945. $9=newClass;
  7946. return $9;
  7947. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},smalltalk.ClassBuilder)})},
  7948. args: ["aClass", "className", "ivarNames", "packageName"],
  7949. 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",
  7950. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  7951. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  7952. }),
  7953. smalltalk.ClassBuilder);
  7954. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  7955. smalltalk.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  7956. smalltalk.addMethod(
  7957. smalltalk.method({
  7958. selector: "class:category:",
  7959. category: 'accessing',
  7960. fn: function (aClass,aString){
  7961. var self=this;
  7962. return smalltalk.withContext(function($ctx1) {
  7963. self["@class"]=aClass;
  7964. self["@category"]=aString;
  7965. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
  7966. args: ["aClass", "aString"],
  7967. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  7968. messageSends: [],
  7969. referencedClasses: []
  7970. }),
  7971. smalltalk.ClassCategoryReader);
  7972. smalltalk.addMethod(
  7973. smalltalk.method({
  7974. selector: "compileMethod:",
  7975. category: 'private',
  7976. fn: function (aString){
  7977. var self=this;
  7978. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7979. return smalltalk.withContext(function($ctx1) {
  7980. _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  7981. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
  7982. args: ["aString"],
  7983. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  7984. messageSends: ["install:forClass:category:", "new"],
  7985. referencedClasses: ["Compiler"]
  7986. }),
  7987. smalltalk.ClassCategoryReader);
  7988. smalltalk.addMethod(
  7989. smalltalk.method({
  7990. selector: "initialize",
  7991. category: 'initialization',
  7992. fn: function (){
  7993. var self=this;
  7994. return smalltalk.withContext(function($ctx1) {
  7995. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  7996. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
  7997. args: [],
  7998. source: "initialize\x0a\x09super initialize.",
  7999. messageSends: ["initialize"],
  8000. referencedClasses: []
  8001. }),
  8002. smalltalk.ClassCategoryReader);
  8003. smalltalk.addMethod(
  8004. smalltalk.method({
  8005. selector: "scanFrom:",
  8006. category: 'fileIn',
  8007. fn: function (aChunkParser){
  8008. var self=this;
  8009. var chunk;
  8010. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8011. return smalltalk.withContext(function($ctx1) {
  8012. _st((function(){
  8013. return smalltalk.withContext(function($ctx2) {
  8014. chunk=_st(aChunkParser)._nextChunk();
  8015. chunk;
  8016. return _st(chunk)._isEmpty();
  8017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  8018. return smalltalk.withContext(function($ctx2) {
  8019. return self._compileMethod_(chunk);
  8020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8021. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  8022. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
  8023. args: ["aChunkParser"],
  8024. 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",
  8025. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  8026. referencedClasses: ["ClassBuilder"]
  8027. }),
  8028. smalltalk.ClassCategoryReader);
  8029. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  8030. smalltalk.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  8031. smalltalk.addMethod(
  8032. smalltalk.method({
  8033. selector: "class:",
  8034. category: 'accessing',
  8035. fn: function (aClass){
  8036. var self=this;
  8037. return smalltalk.withContext(function($ctx1) {
  8038. self["@class"]=aClass;
  8039. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
  8040. args: ["aClass"],
  8041. source: "class: aClass\x0a\x09class := aClass",
  8042. messageSends: [],
  8043. referencedClasses: []
  8044. }),
  8045. smalltalk.ClassCommentReader);
  8046. smalltalk.addMethod(
  8047. smalltalk.method({
  8048. selector: "initialize",
  8049. category: 'initialization',
  8050. fn: function (){
  8051. var self=this;
  8052. return smalltalk.withContext(function($ctx1) {
  8053. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  8054. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
  8055. args: [],
  8056. source: "initialize\x0a\x09super initialize.",
  8057. messageSends: ["initialize"],
  8058. referencedClasses: []
  8059. }),
  8060. smalltalk.ClassCommentReader);
  8061. smalltalk.addMethod(
  8062. smalltalk.method({
  8063. selector: "scanFrom:",
  8064. category: 'fileIn',
  8065. fn: function (aChunkParser){
  8066. var self=this;
  8067. var chunk;
  8068. return smalltalk.withContext(function($ctx1) {
  8069. var $1;
  8070. chunk=_st(aChunkParser)._nextChunk();
  8071. $1=_st(chunk)._isEmpty();
  8072. if(! smalltalk.assert($1)){
  8073. self._setComment_(chunk);
  8074. };
  8075. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
  8076. args: ["aChunkParser"],
  8077. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
  8078. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  8079. referencedClasses: []
  8080. }),
  8081. smalltalk.ClassCommentReader);
  8082. smalltalk.addMethod(
  8083. smalltalk.method({
  8084. selector: "setComment:",
  8085. category: 'private',
  8086. fn: function (aString){
  8087. var self=this;
  8088. return smalltalk.withContext(function($ctx1) {
  8089. _st(self["@class"])._comment_(aString);
  8090. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
  8091. args: ["aString"],
  8092. source: "setComment: aString\x0a\x09class comment: aString",
  8093. messageSends: ["comment:"],
  8094. referencedClasses: []
  8095. }),
  8096. smalltalk.ClassCommentReader);
  8097. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  8098. smalltalk.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  8099. smalltalk.addMethod(
  8100. smalltalk.method({
  8101. selector: "getNodesFrom:",
  8102. category: 'accessing',
  8103. fn: function (aCollection){
  8104. var self=this;
  8105. var children,others;
  8106. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  8107. return smalltalk.withContext(function($ctx1) {
  8108. var $1;
  8109. children=[];
  8110. others=[];
  8111. _st(aCollection)._do_((function(each){
  8112. return smalltalk.withContext(function($ctx2) {
  8113. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  8114. if(smalltalk.assert($1)){
  8115. return _st(children)._add_(each);
  8116. } else {
  8117. return _st(others)._add_(each);
  8118. };
  8119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8120. self["@nodes"]=_st(children)._collect_((function(each){
  8121. return smalltalk.withContext(function($ctx2) {
  8122. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  8123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8124. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})},
  8125. args: ["aCollection"],
  8126. 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]",
  8127. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  8128. referencedClasses: ["ClassSorterNode"]
  8129. }),
  8130. smalltalk.ClassSorterNode);
  8131. smalltalk.addMethod(
  8132. smalltalk.method({
  8133. selector: "level",
  8134. category: 'accessing',
  8135. fn: function (){
  8136. var self=this;
  8137. return smalltalk.withContext(function($ctx1) {
  8138. var $1;
  8139. $1=self["@level"];
  8140. return $1;
  8141. }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
  8142. args: [],
  8143. source: "level\x0a\x09^level",
  8144. messageSends: [],
  8145. referencedClasses: []
  8146. }),
  8147. smalltalk.ClassSorterNode);
  8148. smalltalk.addMethod(
  8149. smalltalk.method({
  8150. selector: "level:",
  8151. category: 'accessing',
  8152. fn: function (anInteger){
  8153. var self=this;
  8154. return smalltalk.withContext(function($ctx1) {
  8155. self["@level"]=anInteger;
  8156. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
  8157. args: ["anInteger"],
  8158. source: "level: anInteger\x0a\x09level := anInteger",
  8159. messageSends: [],
  8160. referencedClasses: []
  8161. }),
  8162. smalltalk.ClassSorterNode);
  8163. smalltalk.addMethod(
  8164. smalltalk.method({
  8165. selector: "nodes",
  8166. category: 'accessing',
  8167. fn: function (){
  8168. var self=this;
  8169. return smalltalk.withContext(function($ctx1) {
  8170. var $1;
  8171. $1=self["@nodes"];
  8172. return $1;
  8173. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
  8174. args: [],
  8175. source: "nodes\x0a\x09^nodes",
  8176. messageSends: [],
  8177. referencedClasses: []
  8178. }),
  8179. smalltalk.ClassSorterNode);
  8180. smalltalk.addMethod(
  8181. smalltalk.method({
  8182. selector: "theClass",
  8183. category: 'accessing',
  8184. fn: function (){
  8185. var self=this;
  8186. return smalltalk.withContext(function($ctx1) {
  8187. var $1;
  8188. $1=self["@theClass"];
  8189. return $1;
  8190. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
  8191. args: [],
  8192. source: "theClass\x0a\x09^theClass",
  8193. messageSends: [],
  8194. referencedClasses: []
  8195. }),
  8196. smalltalk.ClassSorterNode);
  8197. smalltalk.addMethod(
  8198. smalltalk.method({
  8199. selector: "theClass:",
  8200. category: 'accessing',
  8201. fn: function (aClass){
  8202. var self=this;
  8203. return smalltalk.withContext(function($ctx1) {
  8204. self["@theClass"]=aClass;
  8205. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
  8206. args: ["aClass"],
  8207. source: "theClass: aClass\x0a\x09theClass := aClass",
  8208. messageSends: [],
  8209. referencedClasses: []
  8210. }),
  8211. smalltalk.ClassSorterNode);
  8212. smalltalk.addMethod(
  8213. smalltalk.method({
  8214. selector: "traverseClassesWith:",
  8215. category: 'visiting',
  8216. fn: function (aCollection){
  8217. var self=this;
  8218. return smalltalk.withContext(function($ctx1) {
  8219. _st(aCollection)._add_(self._theClass());
  8220. _st(_st(self._nodes())._sorted_((function(a,b){
  8221. return smalltalk.withContext(function($ctx2) {
  8222. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  8223. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
  8224. return smalltalk.withContext(function($ctx2) {
  8225. return _st(aNode)._traverseClassesWith_(aCollection);
  8226. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  8227. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})},
  8228. args: ["aCollection"],
  8229. 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 ].",
  8230. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  8231. referencedClasses: []
  8232. }),
  8233. smalltalk.ClassSorterNode);
  8234. smalltalk.addMethod(
  8235. smalltalk.method({
  8236. selector: "on:classes:level:",
  8237. category: 'instance creation',
  8238. fn: function (aClass,aCollection,anInteger){
  8239. var self=this;
  8240. return smalltalk.withContext(function($ctx1) {
  8241. var $2,$3,$1;
  8242. $2=self._new();
  8243. _st($2)._theClass_(aClass);
  8244. _st($2)._level_(anInteger);
  8245. _st($2)._getNodesFrom_(aCollection);
  8246. $3=_st($2)._yourself();
  8247. $1=$3;
  8248. return $1;
  8249. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})},
  8250. args: ["aClass", "aCollection", "anInteger"],
  8251. 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",
  8252. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  8253. referencedClasses: []
  8254. }),
  8255. smalltalk.ClassSorterNode.klass);
  8256. smalltalk.addPackage('Kernel-Methods');
  8257. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  8258. smalltalk.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 | ... ] `";
  8259. smalltalk.addMethod(
  8260. smalltalk.method({
  8261. selector: "applyTo:arguments:",
  8262. category: 'evaluating',
  8263. fn: function (anObject,aCollection){
  8264. var self=this;
  8265. return smalltalk.withContext(function($ctx1) {
  8266. return self.apply(anObject, aCollection);
  8267. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  8268. args: ["anObject", "aCollection"],
  8269. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  8270. messageSends: [],
  8271. referencedClasses: []
  8272. }),
  8273. smalltalk.BlockClosure);
  8274. smalltalk.addMethod(
  8275. smalltalk.method({
  8276. selector: "asCompiledMethod:",
  8277. category: 'converting',
  8278. fn: function (aString){
  8279. var self=this;
  8280. return smalltalk.withContext(function($ctx1) {
  8281. return smalltalk.method({selector:aString, fn:self});;
  8282. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  8283. args: ["aString"],
  8284. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  8285. messageSends: [],
  8286. referencedClasses: []
  8287. }),
  8288. smalltalk.BlockClosure);
  8289. smalltalk.addMethod(
  8290. smalltalk.method({
  8291. selector: "compiledSource",
  8292. category: 'accessing',
  8293. fn: function (){
  8294. var self=this;
  8295. return smalltalk.withContext(function($ctx1) {
  8296. return self.toString();
  8297. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  8298. args: [],
  8299. source: "compiledSource\x0a\x09<return self.toString()>",
  8300. messageSends: [],
  8301. referencedClasses: []
  8302. }),
  8303. smalltalk.BlockClosure);
  8304. smalltalk.addMethod(
  8305. smalltalk.method({
  8306. selector: "currySelf",
  8307. category: 'converting',
  8308. fn: function (){
  8309. var self=this;
  8310. return smalltalk.withContext(function($ctx1) {
  8311. return function () {
  8312. var args = [ this ];
  8313. args.push.apply(args, arguments);
  8314. return self.apply(null, args);
  8315. }
  8316. ;
  8317. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  8318. args: [],
  8319. 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>",
  8320. messageSends: [],
  8321. referencedClasses: []
  8322. }),
  8323. smalltalk.BlockClosure);
  8324. smalltalk.addMethod(
  8325. smalltalk.method({
  8326. selector: "ensure:",
  8327. category: 'evaluating',
  8328. fn: function (aBlock){
  8329. var self=this;
  8330. return smalltalk.withContext(function($ctx1) {
  8331. try{return self._value()}finally{aBlock._value()};
  8332. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8333. args: ["aBlock"],
  8334. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8335. messageSends: [],
  8336. referencedClasses: []
  8337. }),
  8338. smalltalk.BlockClosure);
  8339. smalltalk.addMethod(
  8340. smalltalk.method({
  8341. selector: "fork",
  8342. category: 'timeout/interval',
  8343. fn: function (){
  8344. var self=this;
  8345. function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  8346. return smalltalk.withContext(function($ctx1) {
  8347. _st(_st($ForkPool())._default())._fork_(self);
  8348. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  8349. args: [],
  8350. source: "fork\x0a\x09ForkPool default fork: self",
  8351. messageSends: ["fork:", "default"],
  8352. referencedClasses: ["ForkPool"]
  8353. }),
  8354. smalltalk.BlockClosure);
  8355. smalltalk.addMethod(
  8356. smalltalk.method({
  8357. selector: "new",
  8358. category: 'evaluating',
  8359. fn: function (){
  8360. var self=this;
  8361. return smalltalk.withContext(function($ctx1) {
  8362. return new self();
  8363. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  8364. args: [],
  8365. 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()>",
  8366. messageSends: [],
  8367. referencedClasses: []
  8368. }),
  8369. smalltalk.BlockClosure);
  8370. smalltalk.addMethod(
  8371. smalltalk.method({
  8372. selector: "newValue:",
  8373. category: 'evaluating',
  8374. fn: function (anObject){
  8375. var self=this;
  8376. return smalltalk.withContext(function($ctx1) {
  8377. var $1;
  8378. $1=self._newWithValues_([anObject]);
  8379. return $1;
  8380. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  8381. args: ["anObject"],
  8382. source: "newValue: anObject\x0a^ self newWithValues: { anObject }",
  8383. messageSends: ["newWithValues:"],
  8384. referencedClasses: []
  8385. }),
  8386. smalltalk.BlockClosure);
  8387. smalltalk.addMethod(
  8388. smalltalk.method({
  8389. selector: "newValue:value:",
  8390. category: 'evaluating',
  8391. fn: function (anObject,anObject2){
  8392. var self=this;
  8393. return smalltalk.withContext(function($ctx1) {
  8394. var $1;
  8395. $1=self._newWithValues_([anObject,anObject2]);
  8396. return $1;
  8397. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  8398. args: ["anObject", "anObject2"],
  8399. source: "newValue: anObject value: anObject2\x0a^ self newWithValues: { anObject. anObject2 }.",
  8400. messageSends: ["newWithValues:"],
  8401. referencedClasses: []
  8402. }),
  8403. smalltalk.BlockClosure);
  8404. smalltalk.addMethod(
  8405. smalltalk.method({
  8406. selector: "newValue:value:value:",
  8407. category: 'evaluating',
  8408. fn: function (anObject,anObject2,anObject3){
  8409. var self=this;
  8410. return smalltalk.withContext(function($ctx1) {
  8411. var $1;
  8412. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  8413. return $1;
  8414. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  8415. args: ["anObject", "anObject2", "anObject3"],
  8416. source: "newValue: anObject value: anObject2 value: anObject3\x0a^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8417. messageSends: ["newWithValues:"],
  8418. referencedClasses: []
  8419. }),
  8420. smalltalk.BlockClosure);
  8421. smalltalk.addMethod(
  8422. smalltalk.method({
  8423. selector: "newWithValues:",
  8424. category: 'evaluating',
  8425. fn: function (aCollection){
  8426. var self=this;
  8427. return smalltalk.withContext(function($ctx1) {
  8428. var constructor = function() {};
  8429. constructor.prototype = self.prototype;
  8430. var object = new constructor;
  8431. var result = self.apply(object, aCollection);
  8432. return typeof result === "object" ? result : object;;
  8433. return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  8434. args: ["aCollection"],
  8435. source: "newWithValues: aCollection\x0a\x22Use the receiver as a JavaScript constructor with a variable number of arguments.\x0aAnswer the object created using the operator `new`.\x0a\x0aThis algorithm was inspired by http://stackoverflow.com/a/6069331.\x0a\x0aHere's a general breakdown of what's going on:\x0a1) Create a new, empty constructor function.\x0a2) Set it's prototype to the receiver's prototype. Because the receiver is a `BlockClosure`, it is also a JavaScript function.\x0a3) Instantiate a new object using the constructor function just created. \x0a This forces the interpreter to set the internal [[prototype]] property to what was set on the function before. \x0a This has to be done, as we have no access to the [[prototype]] property externally.\x0a4) Apply `self` to the object I just instantiated.\x22\x0a\x0a<\x0a\x09var constructor = function() {};\x0a\x09constructor.prototype = self.prototype;\x0a\x09var object = new constructor;\x0a\x09var result = self.apply(object, aCollection);\x0a\x09return typeof result === \x22object\x22 ? result : object;\x0a>",
  8436. messageSends: [],
  8437. referencedClasses: []
  8438. }),
  8439. smalltalk.BlockClosure);
  8440. smalltalk.addMethod(
  8441. smalltalk.method({
  8442. selector: "numArgs",
  8443. category: 'accessing',
  8444. fn: function (){
  8445. var self=this;
  8446. return smalltalk.withContext(function($ctx1) {
  8447. return self.length;
  8448. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  8449. args: [],
  8450. source: "numArgs\x0a\x09<return self.length>",
  8451. messageSends: [],
  8452. referencedClasses: []
  8453. }),
  8454. smalltalk.BlockClosure);
  8455. smalltalk.addMethod(
  8456. smalltalk.method({
  8457. selector: "on:do:",
  8458. category: 'error handling',
  8459. fn: function (anErrorClass,aBlock){
  8460. var self=this;
  8461. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  8462. return smalltalk.withContext(function($ctx1) {
  8463. var $2,$1;
  8464. $1=self._try_catch_(self,(function(error){
  8465. var smalltalkError;
  8466. return smalltalk.withContext(function($ctx2) {
  8467. smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
  8468. smalltalkError;
  8469. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  8470. if(smalltalk.assert($2)){
  8471. return _st(aBlock)._value_(smalltalkError);
  8472. } else {
  8473. return _st(smalltalkError)._resignal();
  8474. };
  8475. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  8476. return $1;
  8477. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  8478. args: ["anErrorClass", "aBlock"],
  8479. 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 current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  8480. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "resignal", "isKindOf:"],
  8481. referencedClasses: ["Smalltalk"]
  8482. }),
  8483. smalltalk.BlockClosure);
  8484. smalltalk.addMethod(
  8485. smalltalk.method({
  8486. selector: "receiver",
  8487. category: 'accessing',
  8488. fn: function (){
  8489. var self=this;
  8490. return smalltalk.withContext(function($ctx1) {
  8491. return nil;
  8492. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.BlockClosure)})},
  8493. args: [],
  8494. source: "receiver\x0a\x09^ nil",
  8495. messageSends: [],
  8496. referencedClasses: []
  8497. }),
  8498. smalltalk.BlockClosure);
  8499. smalltalk.addMethod(
  8500. smalltalk.method({
  8501. selector: "timeToRun",
  8502. category: 'evaluating',
  8503. fn: function (){
  8504. var self=this;
  8505. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  8506. return smalltalk.withContext(function($ctx1) {
  8507. var $1;
  8508. $1=_st($Date())._millisecondsToRun_(self);
  8509. return $1;
  8510. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  8511. args: [],
  8512. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8513. messageSends: ["millisecondsToRun:"],
  8514. referencedClasses: ["Date"]
  8515. }),
  8516. smalltalk.BlockClosure);
  8517. smalltalk.addMethod(
  8518. smalltalk.method({
  8519. selector: "value",
  8520. category: 'evaluating',
  8521. fn: function (){
  8522. var self=this;
  8523. return smalltalk.withContext(function($ctx1) {
  8524. return self();;
  8525. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  8526. args: [],
  8527. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  8528. messageSends: [],
  8529. referencedClasses: []
  8530. }),
  8531. smalltalk.BlockClosure);
  8532. smalltalk.addMethod(
  8533. smalltalk.method({
  8534. selector: "value:",
  8535. category: 'evaluating',
  8536. fn: function (anArg){
  8537. var self=this;
  8538. return smalltalk.withContext(function($ctx1) {
  8539. return self(anArg);;
  8540. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  8541. args: ["anArg"],
  8542. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  8543. messageSends: [],
  8544. referencedClasses: []
  8545. }),
  8546. smalltalk.BlockClosure);
  8547. smalltalk.addMethod(
  8548. smalltalk.method({
  8549. selector: "value:value:",
  8550. category: 'evaluating',
  8551. fn: function (firstArg,secondArg){
  8552. var self=this;
  8553. return smalltalk.withContext(function($ctx1) {
  8554. return self(firstArg, secondArg);;
  8555. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  8556. args: ["firstArg", "secondArg"],
  8557. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  8558. messageSends: [],
  8559. referencedClasses: []
  8560. }),
  8561. smalltalk.BlockClosure);
  8562. smalltalk.addMethod(
  8563. smalltalk.method({
  8564. selector: "value:value:value:",
  8565. category: 'evaluating',
  8566. fn: function (firstArg,secondArg,thirdArg){
  8567. var self=this;
  8568. return smalltalk.withContext(function($ctx1) {
  8569. return self(firstArg, secondArg, thirdArg);;
  8570. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  8571. args: ["firstArg", "secondArg", "thirdArg"],
  8572. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8573. messageSends: [],
  8574. referencedClasses: []
  8575. }),
  8576. smalltalk.BlockClosure);
  8577. smalltalk.addMethod(
  8578. smalltalk.method({
  8579. selector: "valueWithInterval:",
  8580. category: 'timeout/interval',
  8581. fn: function (aNumber){
  8582. var self=this;
  8583. return smalltalk.withContext(function($ctx1) {
  8584. var interval = setInterval(self, aNumber);
  8585. return smalltalk.Timeout._on_(interval);
  8586. ;
  8587. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8588. args: ["aNumber"],
  8589. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
  8590. messageSends: [],
  8591. referencedClasses: []
  8592. }),
  8593. smalltalk.BlockClosure);
  8594. smalltalk.addMethod(
  8595. smalltalk.method({
  8596. selector: "valueWithPossibleArguments:",
  8597. category: 'evaluating',
  8598. fn: function (aCollection){
  8599. var self=this;
  8600. return smalltalk.withContext(function($ctx1) {
  8601. return self.apply(null, aCollection);;
  8602. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  8603. args: ["aCollection"],
  8604. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8605. messageSends: [],
  8606. referencedClasses: []
  8607. }),
  8608. smalltalk.BlockClosure);
  8609. smalltalk.addMethod(
  8610. smalltalk.method({
  8611. selector: "valueWithTimeout:",
  8612. category: 'timeout/interval',
  8613. fn: function (aNumber){
  8614. var self=this;
  8615. return smalltalk.withContext(function($ctx1) {
  8616. var timeout = setTimeout(self, aNumber);
  8617. return smalltalk.Timeout._on_(timeout);
  8618. ;
  8619. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  8620. args: ["aNumber"],
  8621. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
  8622. messageSends: [],
  8623. referencedClasses: []
  8624. }),
  8625. smalltalk.BlockClosure);
  8626. smalltalk.addMethod(
  8627. smalltalk.method({
  8628. selector: "whileFalse",
  8629. category: 'controlling',
  8630. fn: function (){
  8631. var self=this;
  8632. return smalltalk.withContext(function($ctx1) {
  8633. self._whileFalse_((function(){
  8634. return smalltalk.withContext(function($ctx2) {
  8635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8636. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  8637. args: [],
  8638. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  8639. messageSends: ["whileFalse:"],
  8640. referencedClasses: []
  8641. }),
  8642. smalltalk.BlockClosure);
  8643. smalltalk.addMethod(
  8644. smalltalk.method({
  8645. selector: "whileFalse:",
  8646. category: 'controlling',
  8647. fn: function (aBlock){
  8648. var self=this;
  8649. return smalltalk.withContext(function($ctx1) {
  8650. while(!smalltalk.assert(self._value())) {aBlock._value()};
  8651. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8652. args: ["aBlock"],
  8653. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  8654. messageSends: [],
  8655. referencedClasses: []
  8656. }),
  8657. smalltalk.BlockClosure);
  8658. smalltalk.addMethod(
  8659. smalltalk.method({
  8660. selector: "whileTrue",
  8661. category: 'controlling',
  8662. fn: function (){
  8663. var self=this;
  8664. return smalltalk.withContext(function($ctx1) {
  8665. self._whileTrue_((function(){
  8666. return smalltalk.withContext(function($ctx2) {
  8667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8668. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  8669. args: [],
  8670. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  8671. messageSends: ["whileTrue:"],
  8672. referencedClasses: []
  8673. }),
  8674. smalltalk.BlockClosure);
  8675. smalltalk.addMethod(
  8676. smalltalk.method({
  8677. selector: "whileTrue:",
  8678. category: 'controlling',
  8679. fn: function (aBlock){
  8680. var self=this;
  8681. return smalltalk.withContext(function($ctx1) {
  8682. while(smalltalk.assert(self._value())) {aBlock._value()};
  8683. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  8684. args: ["aBlock"],
  8685. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  8686. messageSends: [],
  8687. referencedClasses: []
  8688. }),
  8689. smalltalk.BlockClosure);
  8690. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  8691. smalltalk.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";
  8692. smalltalk.addMethod(
  8693. smalltalk.method({
  8694. selector: "arguments",
  8695. category: 'accessing',
  8696. fn: function (){
  8697. var self=this;
  8698. return smalltalk.withContext(function($ctx1) {
  8699. return self.args || [];
  8700. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  8701. args: [],
  8702. source: "arguments\x0a\x09<return self.args || []>",
  8703. messageSends: [],
  8704. referencedClasses: []
  8705. }),
  8706. smalltalk.CompiledMethod);
  8707. smalltalk.addMethod(
  8708. smalltalk.method({
  8709. selector: "category",
  8710. category: 'accessing',
  8711. fn: function (){
  8712. var self=this;
  8713. return smalltalk.withContext(function($ctx1) {
  8714. var $2,$1;
  8715. $2=self._basicAt_("category");
  8716. if(($receiver = $2) == nil || $receiver == undefined){
  8717. $1=self._defaultCategory();
  8718. } else {
  8719. $1=$2;
  8720. };
  8721. return $1;
  8722. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  8723. args: [],
  8724. source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
  8725. messageSends: ["ifNil:", "defaultCategory", "basicAt:"],
  8726. referencedClasses: []
  8727. }),
  8728. smalltalk.CompiledMethod);
  8729. smalltalk.addMethod(
  8730. smalltalk.method({
  8731. selector: "category:",
  8732. category: 'accessing',
  8733. fn: function (aString){
  8734. var self=this;
  8735. var oldProtocol;
  8736. function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8737. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8738. return smalltalk.withContext(function($ctx1) {
  8739. var $1,$2,$3;
  8740. oldProtocol=self._protocol();
  8741. self._basicAt_put_("category",aString);
  8742. $1=_st($MethodMoved())._new();
  8743. _st($1)._method_(self);
  8744. _st($1)._oldProtocol_(oldProtocol);
  8745. $2=_st($1)._yourself();
  8746. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8747. $3=self._methodClass();
  8748. if(($receiver = $3) == nil || $receiver == undefined){
  8749. $3;
  8750. } else {
  8751. _st(_st(self._methodClass())._organization())._addElement_(aString);
  8752. _st(_st(_st(self._methodClass())._methods())._select_((function(each){
  8753. return smalltalk.withContext(function($ctx2) {
  8754. return _st(_st(each)._protocol()).__eq(oldProtocol);
  8755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  8756. return smalltalk.withContext(function($ctx2) {
  8757. return _st(_st(self._methodClass())._organization())._removeElement_(oldProtocol);
  8758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  8759. };
  8760. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})},
  8761. args: ["aString"],
  8762. source: "category: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'category' 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: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each protocol = oldProtocol ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldProtocol ] ]",
  8763. messageSends: ["protocol", "basicAt:put:", "announce:", "method:", "new", "oldProtocol:", "yourself", "current", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  8764. referencedClasses: ["MethodMoved", "SystemAnnouncer"]
  8765. }),
  8766. smalltalk.CompiledMethod);
  8767. smalltalk.addMethod(
  8768. smalltalk.method({
  8769. selector: "defaultCategory",
  8770. category: 'defaults',
  8771. fn: function (){
  8772. var self=this;
  8773. return smalltalk.withContext(function($ctx1) {
  8774. return "as yet unclassified";
  8775. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  8776. args: [],
  8777. source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
  8778. messageSends: [],
  8779. referencedClasses: []
  8780. }),
  8781. smalltalk.CompiledMethod);
  8782. smalltalk.addMethod(
  8783. smalltalk.method({
  8784. selector: "fn",
  8785. category: 'accessing',
  8786. fn: function (){
  8787. var self=this;
  8788. return smalltalk.withContext(function($ctx1) {
  8789. var $1;
  8790. $1=self._basicAt_("fn");
  8791. return $1;
  8792. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  8793. args: [],
  8794. source: "fn\x0a\x09^self basicAt: 'fn'",
  8795. messageSends: ["basicAt:"],
  8796. referencedClasses: []
  8797. }),
  8798. smalltalk.CompiledMethod);
  8799. smalltalk.addMethod(
  8800. smalltalk.method({
  8801. selector: "fn:",
  8802. category: 'accessing',
  8803. fn: function (aBlock){
  8804. var self=this;
  8805. return smalltalk.withContext(function($ctx1) {
  8806. self._basicAt_put_("fn",aBlock);
  8807. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  8808. args: ["aBlock"],
  8809. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8810. messageSends: ["basicAt:put:"],
  8811. referencedClasses: []
  8812. }),
  8813. smalltalk.CompiledMethod);
  8814. smalltalk.addMethod(
  8815. smalltalk.method({
  8816. selector: "isCompiledMethod",
  8817. category: 'testing',
  8818. fn: function (){
  8819. var self=this;
  8820. return smalltalk.withContext(function($ctx1) {
  8821. return true;
  8822. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
  8823. args: [],
  8824. source: "isCompiledMethod\x0a\x09^ true",
  8825. messageSends: [],
  8826. referencedClasses: []
  8827. }),
  8828. smalltalk.CompiledMethod);
  8829. smalltalk.addMethod(
  8830. smalltalk.method({
  8831. selector: "isOverridden",
  8832. category: 'testing',
  8833. fn: function (){
  8834. var self=this;
  8835. var selector;
  8836. return smalltalk.withContext(function($ctx1) {
  8837. var $1;
  8838. var $early={};
  8839. try {
  8840. selector=self._selector();
  8841. _st(self._methodClass())._allSubclassesDo_((function(each){
  8842. return smalltalk.withContext(function($ctx2) {
  8843. $1=_st(each)._includesSelector_(selector);
  8844. if(smalltalk.assert($1)){
  8845. throw $early=[true];
  8846. };
  8847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  8848. return false;
  8849. }
  8850. catch(e) {if(e===$early)return e[0]; throw e}
  8851. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.CompiledMethod)})},
  8852. args: [],
  8853. 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",
  8854. messageSends: ["selector", "allSubclassesDo:", "ifTrue:", "includesSelector:", "methodClass"],
  8855. referencedClasses: []
  8856. }),
  8857. smalltalk.CompiledMethod);
  8858. smalltalk.addMethod(
  8859. smalltalk.method({
  8860. selector: "isOverride",
  8861. category: 'testing',
  8862. fn: function (){
  8863. var self=this;
  8864. var superclass;
  8865. return smalltalk.withContext(function($ctx1) {
  8866. var $1,$2;
  8867. superclass=_st(self._methodClass())._superclass();
  8868. $1=superclass;
  8869. if(($receiver = $1) == nil || $receiver == undefined){
  8870. return false;
  8871. } else {
  8872. $1;
  8873. };
  8874. $2=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8875. return $2;
  8876. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.CompiledMethod)})},
  8877. args: [],
  8878. 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",
  8879. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  8880. referencedClasses: []
  8881. }),
  8882. smalltalk.CompiledMethod);
  8883. smalltalk.addMethod(
  8884. smalltalk.method({
  8885. selector: "messageSends",
  8886. category: 'accessing',
  8887. fn: function (){
  8888. var self=this;
  8889. return smalltalk.withContext(function($ctx1) {
  8890. var $1;
  8891. $1=self._basicAt_("messageSends");
  8892. return $1;
  8893. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  8894. args: [],
  8895. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  8896. messageSends: ["basicAt:"],
  8897. referencedClasses: []
  8898. }),
  8899. smalltalk.CompiledMethod);
  8900. smalltalk.addMethod(
  8901. smalltalk.method({
  8902. selector: "methodClass",
  8903. category: 'accessing',
  8904. fn: function (){
  8905. var self=this;
  8906. return smalltalk.withContext(function($ctx1) {
  8907. var $1;
  8908. $1=self._basicAt_("methodClass");
  8909. return $1;
  8910. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  8911. args: [],
  8912. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  8913. messageSends: ["basicAt:"],
  8914. referencedClasses: []
  8915. }),
  8916. smalltalk.CompiledMethod);
  8917. smalltalk.addMethod(
  8918. smalltalk.method({
  8919. selector: "protocol",
  8920. category: 'accessing',
  8921. fn: function (){
  8922. var self=this;
  8923. return smalltalk.withContext(function($ctx1) {
  8924. var $1;
  8925. $1=self._category();
  8926. return $1;
  8927. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  8928. args: [],
  8929. source: "protocol\x0a\x09^ self category",
  8930. messageSends: ["category"],
  8931. referencedClasses: []
  8932. }),
  8933. smalltalk.CompiledMethod);
  8934. smalltalk.addMethod(
  8935. smalltalk.method({
  8936. selector: "protocol:",
  8937. category: 'accessing',
  8938. fn: function (aString){
  8939. var self=this;
  8940. return smalltalk.withContext(function($ctx1) {
  8941. self._category_(aString);
  8942. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})},
  8943. args: ["aString"],
  8944. source: "protocol: aString\x0a\x09self category: aString",
  8945. messageSends: ["category:"],
  8946. referencedClasses: []
  8947. }),
  8948. smalltalk.CompiledMethod);
  8949. smalltalk.addMethod(
  8950. smalltalk.method({
  8951. selector: "referencedClasses",
  8952. category: 'accessing',
  8953. fn: function (){
  8954. var self=this;
  8955. return smalltalk.withContext(function($ctx1) {
  8956. var $1;
  8957. $1=self._basicAt_("referencedClasses");
  8958. return $1;
  8959. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  8960. args: [],
  8961. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  8962. messageSends: ["basicAt:"],
  8963. referencedClasses: []
  8964. }),
  8965. smalltalk.CompiledMethod);
  8966. smalltalk.addMethod(
  8967. smalltalk.method({
  8968. selector: "selector",
  8969. category: 'accessing',
  8970. fn: function (){
  8971. var self=this;
  8972. return smalltalk.withContext(function($ctx1) {
  8973. var $1;
  8974. $1=self._basicAt_("selector");
  8975. return $1;
  8976. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  8977. args: [],
  8978. source: "selector\x0a\x09^self basicAt: 'selector'",
  8979. messageSends: ["basicAt:"],
  8980. referencedClasses: []
  8981. }),
  8982. smalltalk.CompiledMethod);
  8983. smalltalk.addMethod(
  8984. smalltalk.method({
  8985. selector: "selector:",
  8986. category: 'accessing',
  8987. fn: function (aString){
  8988. var self=this;
  8989. return smalltalk.withContext(function($ctx1) {
  8990. self._basicAt_put_("selector",aString);
  8991. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  8992. args: ["aString"],
  8993. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8994. messageSends: ["basicAt:put:"],
  8995. referencedClasses: []
  8996. }),
  8997. smalltalk.CompiledMethod);
  8998. smalltalk.addMethod(
  8999. smalltalk.method({
  9000. selector: "source",
  9001. category: 'accessing',
  9002. fn: function (){
  9003. var self=this;
  9004. return smalltalk.withContext(function($ctx1) {
  9005. var $2,$1;
  9006. $2=self._basicAt_("source");
  9007. if(($receiver = $2) == nil || $receiver == undefined){
  9008. $1="";
  9009. } else {
  9010. $1=$2;
  9011. };
  9012. return $1;
  9013. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  9014. args: [],
  9015. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  9016. messageSends: ["ifNil:", "basicAt:"],
  9017. referencedClasses: []
  9018. }),
  9019. smalltalk.CompiledMethod);
  9020. smalltalk.addMethod(
  9021. smalltalk.method({
  9022. selector: "source:",
  9023. category: 'accessing',
  9024. fn: function (aString){
  9025. var self=this;
  9026. return smalltalk.withContext(function($ctx1) {
  9027. self._basicAt_put_("source",aString);
  9028. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  9029. args: ["aString"],
  9030. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  9031. messageSends: ["basicAt:put:"],
  9032. referencedClasses: []
  9033. }),
  9034. smalltalk.CompiledMethod);
  9035. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  9036. smalltalk.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`";
  9037. smalltalk.addMethod(
  9038. smalltalk.method({
  9039. selector: "addWorker",
  9040. category: 'private',
  9041. fn: function (){
  9042. var self=this;
  9043. return smalltalk.withContext(function($ctx1) {
  9044. _st(self["@worker"])._valueWithTimeout_((0));
  9045. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  9046. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  9047. args: [],
  9048. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  9049. messageSends: ["valueWithTimeout:", "+"],
  9050. referencedClasses: []
  9051. }),
  9052. smalltalk.ForkPool);
  9053. smalltalk.addMethod(
  9054. smalltalk.method({
  9055. selector: "defaultMaxPoolSize",
  9056. category: 'defaults',
  9057. fn: function (){
  9058. var self=this;
  9059. return smalltalk.withContext(function($ctx1) {
  9060. var $1;
  9061. $1=_st(self._class())._defaultMaxPoolSize();
  9062. return $1;
  9063. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  9064. args: [],
  9065. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  9066. messageSends: ["defaultMaxPoolSize", "class"],
  9067. referencedClasses: []
  9068. }),
  9069. smalltalk.ForkPool);
  9070. smalltalk.addMethod(
  9071. smalltalk.method({
  9072. selector: "fork:",
  9073. category: 'actions',
  9074. fn: function (aBlock){
  9075. var self=this;
  9076. return smalltalk.withContext(function($ctx1) {
  9077. var $1;
  9078. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  9079. if(smalltalk.assert($1)){
  9080. self._addWorker();
  9081. };
  9082. _st(self["@queue"])._nextPut_(aBlock);
  9083. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  9084. args: ["aBlock"],
  9085. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  9086. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "nextPut:"],
  9087. referencedClasses: []
  9088. }),
  9089. smalltalk.ForkPool);
  9090. smalltalk.addMethod(
  9091. smalltalk.method({
  9092. selector: "initialize",
  9093. category: 'initialization',
  9094. fn: function (){
  9095. var self=this;
  9096. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  9097. return smalltalk.withContext(function($ctx1) {
  9098. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  9099. self["@poolSize"]=(0);
  9100. self["@queue"]=_st($Queue())._new();
  9101. self["@worker"]=self._makeWorker();
  9102. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  9103. args: [],
  9104. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  9105. messageSends: ["initialize", "new", "makeWorker"],
  9106. referencedClasses: ["Queue"]
  9107. }),
  9108. smalltalk.ForkPool);
  9109. smalltalk.addMethod(
  9110. smalltalk.method({
  9111. selector: "makeWorker",
  9112. category: 'initialization',
  9113. fn: function (){
  9114. var self=this;
  9115. var sentinel;
  9116. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  9117. return smalltalk.withContext(function($ctx1) {
  9118. var $2,$1;
  9119. sentinel=_st($Object())._new();
  9120. $1=(function(){
  9121. var block;
  9122. return smalltalk.withContext(function($ctx2) {
  9123. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  9124. self["@poolSize"];
  9125. block=_st(self["@queue"])._nextIfAbsent_((function(){
  9126. return smalltalk.withContext(function($ctx3) {
  9127. return sentinel;
  9128. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9129. block;
  9130. $2=_st(block).__eq_eq(sentinel);
  9131. if(! smalltalk.assert($2)){
  9132. return _st((function(){
  9133. return smalltalk.withContext(function($ctx3) {
  9134. return _st(block)._value();
  9135. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  9136. return smalltalk.withContext(function($ctx3) {
  9137. return self._addWorker();
  9138. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9139. };
  9140. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  9141. return $1;
  9142. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  9143. args: [],
  9144. 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 ]]]",
  9145. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  9146. referencedClasses: ["Object"]
  9147. }),
  9148. smalltalk.ForkPool);
  9149. smalltalk.addMethod(
  9150. smalltalk.method({
  9151. selector: "maxPoolSize",
  9152. category: 'accessing',
  9153. fn: function (){
  9154. var self=this;
  9155. return smalltalk.withContext(function($ctx1) {
  9156. var $2,$1;
  9157. $2=self["@maxPoolSize"];
  9158. if(($receiver = $2) == nil || $receiver == undefined){
  9159. $1=self._defaultMaxPoolSize();
  9160. } else {
  9161. $1=$2;
  9162. };
  9163. return $1;
  9164. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  9165. args: [],
  9166. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  9167. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  9168. referencedClasses: []
  9169. }),
  9170. smalltalk.ForkPool);
  9171. smalltalk.addMethod(
  9172. smalltalk.method({
  9173. selector: "maxPoolSize:",
  9174. category: 'accessing',
  9175. fn: function (anInteger){
  9176. var self=this;
  9177. return smalltalk.withContext(function($ctx1) {
  9178. self["@maxPoolSize"]=anInteger;
  9179. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  9180. args: ["anInteger"],
  9181. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  9182. messageSends: [],
  9183. referencedClasses: []
  9184. }),
  9185. smalltalk.ForkPool);
  9186. smalltalk.ForkPool.klass.iVarNames = ['default'];
  9187. smalltalk.addMethod(
  9188. smalltalk.method({
  9189. selector: "default",
  9190. category: 'accessing',
  9191. fn: function (){
  9192. var self=this;
  9193. return smalltalk.withContext(function($ctx1) {
  9194. var $2,$1;
  9195. $2=self["@default"];
  9196. if(($receiver = $2) == nil || $receiver == undefined){
  9197. self["@default"]=self._new();
  9198. $1=self["@default"];
  9199. } else {
  9200. $1=$2;
  9201. };
  9202. return $1;
  9203. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  9204. args: [],
  9205. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  9206. messageSends: ["ifNil:", "new"],
  9207. referencedClasses: []
  9208. }),
  9209. smalltalk.ForkPool.klass);
  9210. smalltalk.addMethod(
  9211. smalltalk.method({
  9212. selector: "defaultMaxPoolSize",
  9213. category: 'accessing',
  9214. fn: function (){
  9215. var self=this;
  9216. return smalltalk.withContext(function($ctx1) {
  9217. return (100);
  9218. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  9219. args: [],
  9220. source: "defaultMaxPoolSize\x0a\x09^100",
  9221. messageSends: [],
  9222. referencedClasses: []
  9223. }),
  9224. smalltalk.ForkPool.klass);
  9225. smalltalk.addMethod(
  9226. smalltalk.method({
  9227. selector: "resetDefault",
  9228. category: 'accessing',
  9229. fn: function (){
  9230. var self=this;
  9231. return smalltalk.withContext(function($ctx1) {
  9232. self["@default"]=nil;
  9233. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  9234. args: [],
  9235. source: "resetDefault\x0a\x09default := nil",
  9236. messageSends: [],
  9237. referencedClasses: []
  9238. }),
  9239. smalltalk.ForkPool.klass);
  9240. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9241. smalltalk.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.";
  9242. smalltalk.addMethod(
  9243. smalltalk.method({
  9244. selector: "arguments",
  9245. category: 'accessing',
  9246. fn: function (){
  9247. var self=this;
  9248. return smalltalk.withContext(function($ctx1) {
  9249. var $1;
  9250. $1=self["@arguments"];
  9251. return $1;
  9252. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  9253. args: [],
  9254. source: "arguments\x0a\x09^arguments",
  9255. messageSends: [],
  9256. referencedClasses: []
  9257. }),
  9258. smalltalk.Message);
  9259. smalltalk.addMethod(
  9260. smalltalk.method({
  9261. selector: "arguments:",
  9262. category: 'accessing',
  9263. fn: function (anArray){
  9264. var self=this;
  9265. return smalltalk.withContext(function($ctx1) {
  9266. self["@arguments"]=anArray;
  9267. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  9268. args: ["anArray"],
  9269. source: "arguments: anArray\x0a\x09arguments := anArray",
  9270. messageSends: [],
  9271. referencedClasses: []
  9272. }),
  9273. smalltalk.Message);
  9274. smalltalk.addMethod(
  9275. smalltalk.method({
  9276. selector: "printOn:",
  9277. category: 'printing',
  9278. fn: function (aStream){
  9279. var self=this;
  9280. return smalltalk.withContext(function($ctx1) {
  9281. var $1,$2;
  9282. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9283. $1=aStream;
  9284. _st($1)._nextPutAll_("(");
  9285. _st($1)._nextPutAll_(self._selector());
  9286. $2=_st($1)._nextPutAll_(")");
  9287. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
  9288. args: ["aStream"],
  9289. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9290. messageSends: ["printOn:", "nextPutAll:", "selector"],
  9291. referencedClasses: []
  9292. }),
  9293. smalltalk.Message);
  9294. smalltalk.addMethod(
  9295. smalltalk.method({
  9296. selector: "selector",
  9297. category: 'accessing',
  9298. fn: function (){
  9299. var self=this;
  9300. return smalltalk.withContext(function($ctx1) {
  9301. var $1;
  9302. $1=self["@selector"];
  9303. return $1;
  9304. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  9305. args: [],
  9306. source: "selector\x0a\x09^selector",
  9307. messageSends: [],
  9308. referencedClasses: []
  9309. }),
  9310. smalltalk.Message);
  9311. smalltalk.addMethod(
  9312. smalltalk.method({
  9313. selector: "selector:",
  9314. category: 'accessing',
  9315. fn: function (aString){
  9316. var self=this;
  9317. return smalltalk.withContext(function($ctx1) {
  9318. self["@selector"]=aString;
  9319. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  9320. args: ["aString"],
  9321. source: "selector: aString\x0a\x09selector := aString",
  9322. messageSends: [],
  9323. referencedClasses: []
  9324. }),
  9325. smalltalk.Message);
  9326. smalltalk.addMethod(
  9327. smalltalk.method({
  9328. selector: "sendTo:",
  9329. category: 'actions',
  9330. fn: function (anObject){
  9331. var self=this;
  9332. return smalltalk.withContext(function($ctx1) {
  9333. var $1;
  9334. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9335. return $1;
  9336. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  9337. args: ["anObject"],
  9338. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9339. messageSends: ["perform:withArguments:", "selector", "arguments"],
  9340. referencedClasses: []
  9341. }),
  9342. smalltalk.Message);
  9343. smalltalk.addMethod(
  9344. smalltalk.method({
  9345. selector: "selector:arguments:",
  9346. category: 'instance creation',
  9347. fn: function (aString,anArray){
  9348. var self=this;
  9349. return smalltalk.withContext(function($ctx1) {
  9350. var $2,$3,$1;
  9351. $2=self._new();
  9352. _st($2)._selector_(aString);
  9353. _st($2)._arguments_(anArray);
  9354. $3=_st($2)._yourself();
  9355. $1=$3;
  9356. return $1;
  9357. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  9358. args: ["aString", "anArray"],
  9359. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9360. messageSends: ["selector:", "new", "arguments:", "yourself"],
  9361. referencedClasses: []
  9362. }),
  9363. smalltalk.Message.klass);
  9364. smalltalk.addClass('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
  9365. smalltalk.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.";
  9366. smalltalk.addMethod(
  9367. smalltalk.method({
  9368. selector: "arguments",
  9369. category: 'accessing',
  9370. fn: function (){
  9371. var self=this;
  9372. return smalltalk.withContext(function($ctx1) {
  9373. var $1;
  9374. $1=_st(self["@message"])._arguments();
  9375. return $1;
  9376. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
  9377. args: [],
  9378. source: "arguments\x0a\x09^ message arguments",
  9379. messageSends: ["arguments"],
  9380. referencedClasses: []
  9381. }),
  9382. smalltalk.MessageSend);
  9383. smalltalk.addMethod(
  9384. smalltalk.method({
  9385. selector: "arguments:",
  9386. category: 'accessing',
  9387. fn: function (aCollection){
  9388. var self=this;
  9389. return smalltalk.withContext(function($ctx1) {
  9390. _st(self["@message"])._arguments_(aCollection);
  9391. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  9392. args: ["aCollection"],
  9393. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9394. messageSends: ["arguments:"],
  9395. referencedClasses: []
  9396. }),
  9397. smalltalk.MessageSend);
  9398. smalltalk.addMethod(
  9399. smalltalk.method({
  9400. selector: "initialize",
  9401. category: 'initialization',
  9402. fn: function (){
  9403. var self=this;
  9404. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  9405. return smalltalk.withContext(function($ctx1) {
  9406. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  9407. self["@message"]=_st($Message())._new();
  9408. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
  9409. args: [],
  9410. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9411. messageSends: ["initialize", "new"],
  9412. referencedClasses: ["Message"]
  9413. }),
  9414. smalltalk.MessageSend);
  9415. smalltalk.addMethod(
  9416. smalltalk.method({
  9417. selector: "printOn:",
  9418. category: 'printing',
  9419. fn: function (aStream){
  9420. var self=this;
  9421. return smalltalk.withContext(function($ctx1) {
  9422. var $1,$2;
  9423. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9424. $1=aStream;
  9425. _st($1)._nextPutAll_("(");
  9426. _st($1)._nextPutAll_(self._receiver());
  9427. _st($1)._nextPutAll_(" >> ");
  9428. _st($1)._nextPutAll_(self._selector());
  9429. $2=_st($1)._nextPutAll_(")");
  9430. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
  9431. args: ["aStream"],
  9432. 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: ')'",
  9433. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
  9434. referencedClasses: []
  9435. }),
  9436. smalltalk.MessageSend);
  9437. smalltalk.addMethod(
  9438. smalltalk.method({
  9439. selector: "receiver",
  9440. category: 'accessing',
  9441. fn: function (){
  9442. var self=this;
  9443. return smalltalk.withContext(function($ctx1) {
  9444. var $1;
  9445. $1=self["@receiver"];
  9446. return $1;
  9447. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageSend)})},
  9448. args: [],
  9449. source: "receiver\x0a\x09^ receiver",
  9450. messageSends: [],
  9451. referencedClasses: []
  9452. }),
  9453. smalltalk.MessageSend);
  9454. smalltalk.addMethod(
  9455. smalltalk.method({
  9456. selector: "receiver:",
  9457. category: 'accessing',
  9458. fn: function (anObject){
  9459. var self=this;
  9460. return smalltalk.withContext(function($ctx1) {
  9461. self["@receiver"]=anObject;
  9462. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageSend)})},
  9463. args: ["anObject"],
  9464. source: "receiver: anObject\x0a\x09receiver := anObject",
  9465. messageSends: [],
  9466. referencedClasses: []
  9467. }),
  9468. smalltalk.MessageSend);
  9469. smalltalk.addMethod(
  9470. smalltalk.method({
  9471. selector: "selector",
  9472. category: 'accessing',
  9473. fn: function (){
  9474. var self=this;
  9475. return smalltalk.withContext(function($ctx1) {
  9476. var $1;
  9477. $1=_st(self["@message"])._selector();
  9478. return $1;
  9479. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
  9480. args: [],
  9481. source: "selector\x0a\x09^ message selector",
  9482. messageSends: ["selector"],
  9483. referencedClasses: []
  9484. }),
  9485. smalltalk.MessageSend);
  9486. smalltalk.addMethod(
  9487. smalltalk.method({
  9488. selector: "selector:",
  9489. category: 'accessing',
  9490. fn: function (aString){
  9491. var self=this;
  9492. return smalltalk.withContext(function($ctx1) {
  9493. _st(self["@message"])._selector_(aString);
  9494. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
  9495. args: ["aString"],
  9496. source: "selector: aString\x0a\x09message selector: aString",
  9497. messageSends: ["selector:"],
  9498. referencedClasses: []
  9499. }),
  9500. smalltalk.MessageSend);
  9501. smalltalk.addMethod(
  9502. smalltalk.method({
  9503. selector: "value",
  9504. category: 'evaluating',
  9505. fn: function (){
  9506. var self=this;
  9507. return smalltalk.withContext(function($ctx1) {
  9508. var $1;
  9509. $1=_st(self["@message"])._sendTo_(self._receiver());
  9510. return $1;
  9511. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
  9512. args: [],
  9513. source: "value\x0a\x09^ message sendTo: self receiver",
  9514. messageSends: ["sendTo:", "receiver"],
  9515. referencedClasses: []
  9516. }),
  9517. smalltalk.MessageSend);
  9518. smalltalk.addMethod(
  9519. smalltalk.method({
  9520. selector: "value:",
  9521. category: 'evaluating',
  9522. fn: function (anObject){
  9523. var self=this;
  9524. return smalltalk.withContext(function($ctx1) {
  9525. var $2,$3,$1;
  9526. $2=self["@message"];
  9527. _st($2)._arguments_([anObject]);
  9528. $3=_st($2)._sendTo_(self._receiver());
  9529. $1=$3;
  9530. return $1;
  9531. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
  9532. args: ["anObject"],
  9533. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9534. messageSends: ["arguments:", "sendTo:", "receiver"],
  9535. referencedClasses: []
  9536. }),
  9537. smalltalk.MessageSend);
  9538. smalltalk.addMethod(
  9539. smalltalk.method({
  9540. selector: "value:value:",
  9541. category: 'evaluating',
  9542. fn: function (firstArgument,secondArgument){
  9543. var self=this;
  9544. return smalltalk.withContext(function($ctx1) {
  9545. var $2,$3,$1;
  9546. $2=self["@message"];
  9547. _st($2)._arguments_([firstArgument,secondArgument]);
  9548. $3=_st($2)._sendTo_(self._receiver());
  9549. $1=$3;
  9550. return $1;
  9551. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
  9552. args: ["firstArgument", "secondArgument"],
  9553. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9554. messageSends: ["arguments:", "sendTo:", "receiver"],
  9555. referencedClasses: []
  9556. }),
  9557. smalltalk.MessageSend);
  9558. smalltalk.addMethod(
  9559. smalltalk.method({
  9560. selector: "value:value:value:",
  9561. category: 'evaluating',
  9562. fn: function (firstArgument,secondArgument,thirdArgument){
  9563. var self=this;
  9564. return smalltalk.withContext(function($ctx1) {
  9565. var $2,$3,$1;
  9566. $2=self["@message"];
  9567. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9568. $3=_st($2)._sendTo_(self._receiver());
  9569. $1=$3;
  9570. return $1;
  9571. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
  9572. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9573. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9574. messageSends: ["arguments:", "sendTo:", "receiver"],
  9575. referencedClasses: []
  9576. }),
  9577. smalltalk.MessageSend);
  9578. smalltalk.addMethod(
  9579. smalltalk.method({
  9580. selector: "valueWithPossibleArguments:",
  9581. category: 'evaluating',
  9582. fn: function (aCollection){
  9583. var self=this;
  9584. return smalltalk.withContext(function($ctx1) {
  9585. var $1;
  9586. self._arguments_(aCollection);
  9587. $1=self._value();
  9588. return $1;
  9589. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  9590. args: ["aCollection"],
  9591. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9592. messageSends: ["arguments:", "value"],
  9593. referencedClasses: []
  9594. }),
  9595. smalltalk.MessageSend);
  9596. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  9597. smalltalk.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`.";
  9598. smalltalk.addMethod(
  9599. smalltalk.method({
  9600. selector: "asString",
  9601. category: 'converting',
  9602. fn: function (){
  9603. var self=this;
  9604. return smalltalk.withContext(function($ctx1) {
  9605. var $2,$1;
  9606. $2=self._isBlockContext();
  9607. if(smalltalk.assert($2)){
  9608. $1=_st("a block (in ".__comma(_st(self._methodContext())._asString())).__comma(")");
  9609. } else {
  9610. $1=_st(_st(_st(_st(self._receiver())._class())._name()).__comma(" >> ")).__comma(self._selector());
  9611. };
  9612. return $1;
  9613. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  9614. args: [],
  9615. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
  9616. messageSends: ["ifTrue:ifFalse:", ",", "asString", "methodContext", "selector", "name", "class", "receiver", "isBlockContext"],
  9617. referencedClasses: []
  9618. }),
  9619. smalltalk.MethodContext);
  9620. smalltalk.addMethod(
  9621. smalltalk.method({
  9622. selector: "home",
  9623. category: 'accessing',
  9624. fn: function (){
  9625. var self=this;
  9626. return smalltalk.withContext(function($ctx1) {
  9627. return self.homeContext;
  9628. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  9629. args: [],
  9630. source: "home\x0a\x09<return self.homeContext>",
  9631. messageSends: [],
  9632. referencedClasses: []
  9633. }),
  9634. smalltalk.MethodContext);
  9635. smalltalk.addMethod(
  9636. smalltalk.method({
  9637. selector: "isBlockContext",
  9638. category: 'testing',
  9639. fn: function (){
  9640. var self=this;
  9641. return smalltalk.withContext(function($ctx1) {
  9642. var $1;
  9643. $1=_st(self._selector())._isNil();
  9644. return $1;
  9645. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  9646. args: [],
  9647. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9648. messageSends: ["isNil", "selector"],
  9649. referencedClasses: []
  9650. }),
  9651. smalltalk.MethodContext);
  9652. smalltalk.addMethod(
  9653. smalltalk.method({
  9654. selector: "locals",
  9655. category: 'accessing',
  9656. fn: function (){
  9657. var self=this;
  9658. return smalltalk.withContext(function($ctx1) {
  9659. return self.locals || {};
  9660. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  9661. args: [],
  9662. source: "locals\x0a\x09<return self.locals || {}>",
  9663. messageSends: [],
  9664. referencedClasses: []
  9665. }),
  9666. smalltalk.MethodContext);
  9667. smalltalk.addMethod(
  9668. smalltalk.method({
  9669. selector: "method",
  9670. category: 'accessing',
  9671. fn: function (){
  9672. var self=this;
  9673. return smalltalk.withContext(function($ctx1) {
  9674. var $2,$1;
  9675. $2=self._methodContext();
  9676. if(($receiver = $2) == nil || $receiver == undefined){
  9677. $1=$2;
  9678. } else {
  9679. $1=_st(_st(_st(self._methodContext())._receiver())._class())._lookupSelector_(_st(self._methodContext())._selector());
  9680. };
  9681. return $1;
  9682. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  9683. args: [],
  9684. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  9685. messageSends: ["ifNotNil:", "lookupSelector:", "selector", "methodContext", "class", "receiver"],
  9686. referencedClasses: []
  9687. }),
  9688. smalltalk.MethodContext);
  9689. smalltalk.addMethod(
  9690. smalltalk.method({
  9691. selector: "methodContext",
  9692. category: 'accessing',
  9693. fn: function (){
  9694. var self=this;
  9695. return smalltalk.withContext(function($ctx1) {
  9696. var $1,$2,$4,$3;
  9697. $1=self._isBlockContext();
  9698. if(! smalltalk.assert($1)){
  9699. $2=self;
  9700. return $2;
  9701. };
  9702. $4=self._home();
  9703. if(($receiver = $4) == nil || $receiver == undefined){
  9704. $3=$4;
  9705. } else {
  9706. var home;
  9707. home=$receiver;
  9708. $3=_st(home)._methodContext();
  9709. };
  9710. return $3;
  9711. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  9712. args: [],
  9713. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home ifNotNil: [ :home |\x0a\x09\x09home methodContext ]",
  9714. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "methodContext", "home"],
  9715. referencedClasses: []
  9716. }),
  9717. smalltalk.MethodContext);
  9718. smalltalk.addMethod(
  9719. smalltalk.method({
  9720. selector: "outerContext",
  9721. category: 'accessing',
  9722. fn: function (){
  9723. var self=this;
  9724. return smalltalk.withContext(function($ctx1) {
  9725. return self.outerContext || self.homeContext;
  9726. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  9727. args: [],
  9728. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9729. messageSends: [],
  9730. referencedClasses: []
  9731. }),
  9732. smalltalk.MethodContext);
  9733. smalltalk.addMethod(
  9734. smalltalk.method({
  9735. selector: "pc",
  9736. category: 'accessing',
  9737. fn: function (){
  9738. var self=this;
  9739. return smalltalk.withContext(function($ctx1) {
  9740. return self.pc;
  9741. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  9742. args: [],
  9743. source: "pc\x0a\x09<return self.pc>",
  9744. messageSends: [],
  9745. referencedClasses: []
  9746. }),
  9747. smalltalk.MethodContext);
  9748. smalltalk.addMethod(
  9749. smalltalk.method({
  9750. selector: "printOn:",
  9751. category: 'printing',
  9752. fn: function (aStream){
  9753. var self=this;
  9754. return smalltalk.withContext(function($ctx1) {
  9755. var $1,$2;
  9756. smalltalk.Object.fn.prototype._printOn_.apply(_st(self), [aStream]);
  9757. $1=aStream;
  9758. _st($1)._nextPutAll_("(");
  9759. _st($1)._nextPutAll_(self._asString());
  9760. $2=_st($1)._nextPutAll_(")");
  9761. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
  9762. args: ["aStream"],
  9763. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9764. messageSends: ["printOn:", "nextPutAll:", "asString"],
  9765. referencedClasses: []
  9766. }),
  9767. smalltalk.MethodContext);
  9768. smalltalk.addMethod(
  9769. smalltalk.method({
  9770. selector: "receiver",
  9771. category: 'accessing',
  9772. fn: function (){
  9773. var self=this;
  9774. return smalltalk.withContext(function($ctx1) {
  9775. return self.receiver;
  9776. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  9777. args: [],
  9778. source: "receiver\x0a\x09<return self.receiver>",
  9779. messageSends: [],
  9780. referencedClasses: []
  9781. }),
  9782. smalltalk.MethodContext);
  9783. smalltalk.addMethod(
  9784. smalltalk.method({
  9785. selector: "selector",
  9786. category: 'accessing',
  9787. fn: function (){
  9788. var self=this;
  9789. return smalltalk.withContext(function($ctx1) {
  9790. if(self.selector) {
  9791. return smalltalk.convertSelector(self.selector);
  9792. } else {
  9793. return nil;
  9794. }
  9795. ;
  9796. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  9797. args: [],
  9798. 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>",
  9799. messageSends: [],
  9800. referencedClasses: []
  9801. }),
  9802. smalltalk.MethodContext);
  9803. smalltalk.addMethod(
  9804. smalltalk.method({
  9805. selector: "temps",
  9806. category: 'accessing',
  9807. fn: function (){
  9808. var self=this;
  9809. return smalltalk.withContext(function($ctx1) {
  9810. var $1;
  9811. self._deprecatedAPI();
  9812. $1=self._locals();
  9813. return $1;
  9814. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  9815. args: [],
  9816. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  9817. messageSends: ["deprecatedAPI", "locals"],
  9818. referencedClasses: []
  9819. }),
  9820. smalltalk.MethodContext);
  9821. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  9822. smalltalk.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' ]";
  9823. smalltalk.addMethod(
  9824. smalltalk.method({
  9825. selector: "constructor:",
  9826. category: 'instance creation',
  9827. fn: function (aString){
  9828. var self=this;
  9829. return smalltalk.withContext(function($ctx1) {
  9830. var native=eval(aString);
  9831. return new native();
  9832. ;
  9833. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9834. args: ["aString"],
  9835. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  9836. messageSends: [],
  9837. referencedClasses: []
  9838. }),
  9839. smalltalk.NativeFunction.klass);
  9840. smalltalk.addMethod(
  9841. smalltalk.method({
  9842. selector: "constructor:value:",
  9843. category: 'instance creation',
  9844. fn: function (aString,anObject){
  9845. var self=this;
  9846. return smalltalk.withContext(function($ctx1) {
  9847. var native=eval(aString);
  9848. return new native(anObject);
  9849. ;
  9850. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  9851. args: ["aString", "anObject"],
  9852. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  9853. messageSends: [],
  9854. referencedClasses: []
  9855. }),
  9856. smalltalk.NativeFunction.klass);
  9857. smalltalk.addMethod(
  9858. smalltalk.method({
  9859. selector: "constructor:value:value:",
  9860. category: 'instance creation',
  9861. fn: function (aString,anObject,anObject2){
  9862. var self=this;
  9863. return smalltalk.withContext(function($ctx1) {
  9864. var native=eval(aString);
  9865. return new native(anObject,anObject2);
  9866. ;
  9867. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  9868. args: ["aString", "anObject", "anObject2"],
  9869. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  9870. messageSends: [],
  9871. referencedClasses: []
  9872. }),
  9873. smalltalk.NativeFunction.klass);
  9874. smalltalk.addMethod(
  9875. smalltalk.method({
  9876. selector: "constructor:value:value:value:",
  9877. category: 'instance creation',
  9878. fn: function (aString,anObject,anObject2,anObject3){
  9879. var self=this;
  9880. return smalltalk.withContext(function($ctx1) {
  9881. var native=eval(aString);
  9882. return new native(anObject,anObject2, anObject3);
  9883. ;
  9884. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  9885. args: ["aString", "anObject", "anObject2", "anObject3"],
  9886. 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>",
  9887. messageSends: [],
  9888. referencedClasses: []
  9889. }),
  9890. smalltalk.NativeFunction.klass);
  9891. smalltalk.addMethod(
  9892. smalltalk.method({
  9893. selector: "exists:",
  9894. category: 'testing',
  9895. fn: function (aString){
  9896. var self=this;
  9897. return smalltalk.withContext(function($ctx1) {
  9898. if(aString in window) {
  9899. return true
  9900. } else {
  9901. return false
  9902. }
  9903. ;
  9904. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  9905. args: ["aString"],
  9906. source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>",
  9907. messageSends: [],
  9908. referencedClasses: []
  9909. }),
  9910. smalltalk.NativeFunction.klass);
  9911. smalltalk.addPackage('Kernel-Collections');
  9912. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  9913. smalltalk.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:`";
  9914. smalltalk.addMethod(
  9915. smalltalk.method({
  9916. selector: "=",
  9917. category: 'comparing',
  9918. fn: function (anAssociation){
  9919. var self=this;
  9920. return smalltalk.withContext(function($ctx1) {
  9921. var $1;
  9922. $1=_st(_st(self._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  9923. return smalltalk.withContext(function($ctx2) {
  9924. return _st(_st(self._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  9925. return smalltalk.withContext(function($ctx3) {
  9926. return _st(self._value()).__eq(_st(anAssociation)._value());
  9927. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  9928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  9929. return $1;
  9930. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.Association)})},
  9931. args: ["anAssociation"],
  9932. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  9933. messageSends: ["and:", "=", "value", "key", "class"],
  9934. referencedClasses: []
  9935. }),
  9936. smalltalk.Association);
  9937. smalltalk.addMethod(
  9938. smalltalk.method({
  9939. selector: "key",
  9940. category: 'accessing',
  9941. fn: function (){
  9942. var self=this;
  9943. return smalltalk.withContext(function($ctx1) {
  9944. var $1;
  9945. $1=self["@key"];
  9946. return $1;
  9947. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})},
  9948. args: [],
  9949. source: "key\x0a\x09^key",
  9950. messageSends: [],
  9951. referencedClasses: []
  9952. }),
  9953. smalltalk.Association);
  9954. smalltalk.addMethod(
  9955. smalltalk.method({
  9956. selector: "key:",
  9957. category: 'accessing',
  9958. fn: function (aKey){
  9959. var self=this;
  9960. return smalltalk.withContext(function($ctx1) {
  9961. self["@key"]=aKey;
  9962. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})},
  9963. args: ["aKey"],
  9964. source: "key: aKey\x0a\x09key := aKey",
  9965. messageSends: [],
  9966. referencedClasses: []
  9967. }),
  9968. smalltalk.Association);
  9969. smalltalk.addMethod(
  9970. smalltalk.method({
  9971. selector: "printOn:",
  9972. category: 'printing',
  9973. fn: function (aStream){
  9974. var self=this;
  9975. return smalltalk.withContext(function($ctx1) {
  9976. _st(self._key())._printOn_(aStream);
  9977. _st(aStream)._nextPutAll_(" -> ");
  9978. _st(self._value())._printOn_(aStream);
  9979. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})},
  9980. args: ["aStream"],
  9981. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  9982. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  9983. referencedClasses: []
  9984. }),
  9985. smalltalk.Association);
  9986. smalltalk.addMethod(
  9987. smalltalk.method({
  9988. selector: "value",
  9989. category: 'accessing',
  9990. fn: function (){
  9991. var self=this;
  9992. return smalltalk.withContext(function($ctx1) {
  9993. var $1;
  9994. $1=self["@value"];
  9995. return $1;
  9996. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})},
  9997. args: [],
  9998. source: "value\x0a\x09^value",
  9999. messageSends: [],
  10000. referencedClasses: []
  10001. }),
  10002. smalltalk.Association);
  10003. smalltalk.addMethod(
  10004. smalltalk.method({
  10005. selector: "value:",
  10006. category: 'accessing',
  10007. fn: function (aValue){
  10008. var self=this;
  10009. return smalltalk.withContext(function($ctx1) {
  10010. self["@value"]=aValue;
  10011. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})},
  10012. args: ["aValue"],
  10013. source: "value: aValue\x0a\x09value := aValue",
  10014. messageSends: [],
  10015. referencedClasses: []
  10016. }),
  10017. smalltalk.Association);
  10018. smalltalk.addMethod(
  10019. smalltalk.method({
  10020. selector: "key:value:",
  10021. category: 'instance creation',
  10022. fn: function (aKey,aValue){
  10023. var self=this;
  10024. return smalltalk.withContext(function($ctx1) {
  10025. var $2,$3,$1;
  10026. $2=self._new();
  10027. _st($2)._key_(aKey);
  10028. _st($2)._value_(aValue);
  10029. $3=_st($2)._yourself();
  10030. $1=$3;
  10031. return $1;
  10032. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.Association.klass)})},
  10033. args: ["aKey", "aValue"],
  10034. source: "key: aKey value: aValue\x0a\x09\x09^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10035. messageSends: ["key:", "new", "value:", "yourself"],
  10036. referencedClasses: []
  10037. }),
  10038. smalltalk.Association.klass);
  10039. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  10040. smalltalk.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.";
  10041. smalltalk.addMethod(
  10042. smalltalk.method({
  10043. selector: ",",
  10044. category: 'copying',
  10045. fn: function (aCollection){
  10046. var self=this;
  10047. return smalltalk.withContext(function($ctx1) {
  10048. var $2,$3,$1;
  10049. $2=self._copy();
  10050. _st($2)._addAll_(aCollection);
  10051. $3=_st($2)._yourself();
  10052. $1=$3;
  10053. return $1;
  10054. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})},
  10055. args: ["aCollection"],
  10056. source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10057. messageSends: ["addAll:", "copy", "yourself"],
  10058. referencedClasses: []
  10059. }),
  10060. smalltalk.Collection);
  10061. smalltalk.addMethod(
  10062. smalltalk.method({
  10063. selector: "add:",
  10064. category: 'adding/removing',
  10065. fn: function (anObject){
  10066. var self=this;
  10067. return smalltalk.withContext(function($ctx1) {
  10068. self._subclassResponsibility();
  10069. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})},
  10070. args: ["anObject"],
  10071. source: "add: anObject\x0a\x09self subclassResponsibility",
  10072. messageSends: ["subclassResponsibility"],
  10073. referencedClasses: []
  10074. }),
  10075. smalltalk.Collection);
  10076. smalltalk.addMethod(
  10077. smalltalk.method({
  10078. selector: "addAll:",
  10079. category: 'adding/removing',
  10080. fn: function (aCollection){
  10081. var self=this;
  10082. return smalltalk.withContext(function($ctx1) {
  10083. var $1;
  10084. _st(aCollection)._do_((function(each){
  10085. return smalltalk.withContext(function($ctx2) {
  10086. return self._add_(each);
  10087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10088. $1=aCollection;
  10089. return $1;
  10090. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10091. args: ["aCollection"],
  10092. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection",
  10093. messageSends: ["do:", "add:"],
  10094. referencedClasses: []
  10095. }),
  10096. smalltalk.Collection);
  10097. smalltalk.addMethod(
  10098. smalltalk.method({
  10099. selector: "asArray",
  10100. category: 'converting',
  10101. fn: function (){
  10102. var self=this;
  10103. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  10104. return smalltalk.withContext(function($ctx1) {
  10105. var $1;
  10106. $1=_st($Array())._withAll_(self);
  10107. return $1;
  10108. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})},
  10109. args: [],
  10110. source: "asArray\x0a\x09^Array withAll: self",
  10111. messageSends: ["withAll:"],
  10112. referencedClasses: ["Array"]
  10113. }),
  10114. smalltalk.Collection);
  10115. smalltalk.addMethod(
  10116. smalltalk.method({
  10117. selector: "asJSON",
  10118. category: 'converting',
  10119. fn: function (){
  10120. var self=this;
  10121. return smalltalk.withContext(function($ctx1) {
  10122. var $1;
  10123. $1=_st(self._asArray())._collect_((function(each){
  10124. return smalltalk.withContext(function($ctx2) {
  10125. return _st(each)._asJSON();
  10126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10127. return $1;
  10128. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})},
  10129. args: [],
  10130. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  10131. messageSends: ["collect:", "asJSON", "asArray"],
  10132. referencedClasses: []
  10133. }),
  10134. smalltalk.Collection);
  10135. smalltalk.addMethod(
  10136. smalltalk.method({
  10137. selector: "asOrderedCollection",
  10138. category: 'converting',
  10139. fn: function (){
  10140. var self=this;
  10141. return smalltalk.withContext(function($ctx1) {
  10142. var $1;
  10143. $1=self._asArray();
  10144. return $1;
  10145. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})},
  10146. args: [],
  10147. source: "asOrderedCollection\x0a\x09^self asArray",
  10148. messageSends: ["asArray"],
  10149. referencedClasses: []
  10150. }),
  10151. smalltalk.Collection);
  10152. smalltalk.addMethod(
  10153. smalltalk.method({
  10154. selector: "asSet",
  10155. category: 'converting',
  10156. fn: function (){
  10157. var self=this;
  10158. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  10159. return smalltalk.withContext(function($ctx1) {
  10160. var $1;
  10161. $1=_st($Set())._withAll_(self);
  10162. return $1;
  10163. }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})},
  10164. args: [],
  10165. source: "asSet\x0a\x09^Set withAll: self",
  10166. messageSends: ["withAll:"],
  10167. referencedClasses: ["Set"]
  10168. }),
  10169. smalltalk.Collection);
  10170. smalltalk.addMethod(
  10171. smalltalk.method({
  10172. selector: "collect:",
  10173. category: 'enumerating',
  10174. fn: function (aBlock){
  10175. var self=this;
  10176. var stream;
  10177. return smalltalk.withContext(function($ctx1) {
  10178. var $1;
  10179. stream=_st(_st(self._class())._new())._writeStream();
  10180. self._do_((function(each){
  10181. return smalltalk.withContext(function($ctx2) {
  10182. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  10183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10184. $1=_st(stream)._contents();
  10185. return $1;
  10186. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  10187. args: ["aBlock"],
  10188. 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",
  10189. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  10190. referencedClasses: []
  10191. }),
  10192. smalltalk.Collection);
  10193. smalltalk.addMethod(
  10194. smalltalk.method({
  10195. selector: "contains:",
  10196. category: 'testing',
  10197. fn: function (aBlock){
  10198. var self=this;
  10199. return smalltalk.withContext(function($ctx1) {
  10200. var $1;
  10201. var $early={};
  10202. try {
  10203. self._do_((function(each){
  10204. return smalltalk.withContext(function($ctx2) {
  10205. $1=_st(aBlock)._value_(each);
  10206. if(smalltalk.assert($1)){
  10207. throw $early=[true];
  10208. };
  10209. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10210. return false;
  10211. }
  10212. catch(e) {if(e===$early)return e[0]; throw e}
  10213. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},smalltalk.Collection)})},
  10214. args: ["aBlock"],
  10215. source: "contains: 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",
  10216. messageSends: ["do:", "ifTrue:", "value:"],
  10217. referencedClasses: []
  10218. }),
  10219. smalltalk.Collection);
  10220. smalltalk.addMethod(
  10221. smalltalk.method({
  10222. selector: "copyWith:",
  10223. category: 'copying',
  10224. fn: function (anObject){
  10225. var self=this;
  10226. return smalltalk.withContext(function($ctx1) {
  10227. var $2,$3,$1;
  10228. $2=self._copy();
  10229. _st($2)._add_(anObject);
  10230. $3=_st($2)._yourself();
  10231. $1=$3;
  10232. return $1;
  10233. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})},
  10234. args: ["anObject"],
  10235. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  10236. messageSends: ["add:", "copy", "yourself"],
  10237. referencedClasses: []
  10238. }),
  10239. smalltalk.Collection);
  10240. smalltalk.addMethod(
  10241. smalltalk.method({
  10242. selector: "copyWithAll:",
  10243. category: 'copying',
  10244. fn: function (aCollection){
  10245. var self=this;
  10246. return smalltalk.withContext(function($ctx1) {
  10247. var $2,$3,$1;
  10248. $2=self._copy();
  10249. _st($2)._addAll_(aCollection);
  10250. $3=_st($2)._yourself();
  10251. $1=$3;
  10252. return $1;
  10253. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10254. args: ["aCollection"],
  10255. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  10256. messageSends: ["addAll:", "copy", "yourself"],
  10257. referencedClasses: []
  10258. }),
  10259. smalltalk.Collection);
  10260. smalltalk.addMethod(
  10261. smalltalk.method({
  10262. selector: "copyWithoutAll:",
  10263. category: 'copying',
  10264. fn: function (aCollection){
  10265. var self=this;
  10266. return smalltalk.withContext(function($ctx1) {
  10267. var $1;
  10268. $1=self._reject_((function(each){
  10269. return smalltalk.withContext(function($ctx2) {
  10270. return _st(aCollection)._includes_(each);
  10271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10272. return $1;
  10273. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.Collection)})},
  10274. args: ["aCollection"],
  10275. 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]",
  10276. messageSends: ["reject:", "includes:"],
  10277. referencedClasses: []
  10278. }),
  10279. smalltalk.Collection);
  10280. smalltalk.addMethod(
  10281. smalltalk.method({
  10282. selector: "detect:",
  10283. category: 'enumerating',
  10284. fn: function (aBlock){
  10285. var self=this;
  10286. return smalltalk.withContext(function($ctx1) {
  10287. var $1;
  10288. $1=self._detect_ifNone_(aBlock,(function(){
  10289. return smalltalk.withContext(function($ctx2) {
  10290. return self._errorNotFound();
  10291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10292. return $1;
  10293. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})},
  10294. args: ["aBlock"],
  10295. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  10296. messageSends: ["detect:ifNone:", "errorNotFound"],
  10297. referencedClasses: []
  10298. }),
  10299. smalltalk.Collection);
  10300. smalltalk.addMethod(
  10301. smalltalk.method({
  10302. selector: "detect:ifNone:",
  10303. category: 'enumerating',
  10304. fn: function (aBlock,anotherBlock){
  10305. var self=this;
  10306. return smalltalk.withContext(function($ctx1) {
  10307. self._subclassResponsibility();
  10308. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})},
  10309. args: ["aBlock", "anotherBlock"],
  10310. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10311. messageSends: ["subclassResponsibility"],
  10312. referencedClasses: []
  10313. }),
  10314. smalltalk.Collection);
  10315. smalltalk.addMethod(
  10316. smalltalk.method({
  10317. selector: "do:",
  10318. category: 'enumerating',
  10319. fn: function (aBlock){
  10320. var self=this;
  10321. return smalltalk.withContext(function($ctx1) {
  10322. self._subclassResponsibility();
  10323. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})},
  10324. args: ["aBlock"],
  10325. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10326. messageSends: ["subclassResponsibility"],
  10327. referencedClasses: []
  10328. }),
  10329. smalltalk.Collection);
  10330. smalltalk.addMethod(
  10331. smalltalk.method({
  10332. selector: "do:separatedBy:",
  10333. category: 'enumerating',
  10334. fn: function (aBlock,anotherBlock){
  10335. var self=this;
  10336. var actionBeforeElement;
  10337. return smalltalk.withContext(function($ctx1) {
  10338. actionBeforeElement=(function(){
  10339. return smalltalk.withContext(function($ctx2) {
  10340. actionBeforeElement=anotherBlock;
  10341. return actionBeforeElement;
  10342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  10343. self._do_((function(each){
  10344. return smalltalk.withContext(function($ctx2) {
  10345. _st(actionBeforeElement)._value();
  10346. return _st(aBlock)._value_(each);
  10347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10348. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.Collection)})},
  10349. args: ["aBlock", "anotherBlock"],
  10350. 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]",
  10351. messageSends: ["do:", "value", "value:"],
  10352. referencedClasses: []
  10353. }),
  10354. smalltalk.Collection);
  10355. smalltalk.addMethod(
  10356. smalltalk.method({
  10357. selector: "errorNotFound",
  10358. category: 'error handling',
  10359. fn: function (){
  10360. var self=this;
  10361. return smalltalk.withContext(function($ctx1) {
  10362. self._error_("Object is not in the collection");
  10363. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})},
  10364. args: [],
  10365. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10366. messageSends: ["error:"],
  10367. referencedClasses: []
  10368. }),
  10369. smalltalk.Collection);
  10370. smalltalk.addMethod(
  10371. smalltalk.method({
  10372. selector: "ifEmpty:",
  10373. category: 'testing',
  10374. fn: function (aBlock){
  10375. var self=this;
  10376. return smalltalk.withContext(function($ctx1) {
  10377. var $2,$1;
  10378. $2=self._isEmpty();
  10379. if(smalltalk.assert($2)){
  10380. $1=_st(aBlock)._value();
  10381. } else {
  10382. $1=self;
  10383. };
  10384. return $1;
  10385. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  10386. args: ["aBlock"],
  10387. 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. Note 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: self classifyMethodAs:\x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  10388. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  10389. referencedClasses: []
  10390. }),
  10391. smalltalk.Collection);
  10392. smalltalk.addMethod(
  10393. smalltalk.method({
  10394. selector: "ifNotEmpty:",
  10395. category: 'testing',
  10396. fn: function (aBlock){
  10397. var self=this;
  10398. return smalltalk.withContext(function($ctx1) {
  10399. var $1;
  10400. $1=self._notEmpty();
  10401. _st($1)._ifTrue_(aBlock);
  10402. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  10403. args: ["aBlock"],
  10404. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  10405. messageSends: ["ifTrue:", "notEmpty"],
  10406. referencedClasses: []
  10407. }),
  10408. smalltalk.Collection);
  10409. smalltalk.addMethod(
  10410. smalltalk.method({
  10411. selector: "includes:",
  10412. category: 'testing',
  10413. fn: function (anObject){
  10414. var self=this;
  10415. var sentinel;
  10416. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  10417. return smalltalk.withContext(function($ctx1) {
  10418. var $1;
  10419. sentinel=_st($Object())._new();
  10420. $1=_st(self._detect_ifNone_((function(each){
  10421. return smalltalk.withContext(function($ctx2) {
  10422. return _st(each).__eq(anObject);
  10423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  10424. return smalltalk.withContext(function($ctx2) {
  10425. return sentinel;
  10426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  10427. return $1;
  10428. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
  10429. args: ["anObject"],
  10430. source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  10431. messageSends: ["new", "~=", "detect:ifNone:", "="],
  10432. referencedClasses: ["Object"]
  10433. }),
  10434. smalltalk.Collection);
  10435. smalltalk.addMethod(
  10436. smalltalk.method({
  10437. selector: "inject:into:",
  10438. category: 'enumerating',
  10439. fn: function (anObject,aBlock){
  10440. var self=this;
  10441. var result;
  10442. return smalltalk.withContext(function($ctx1) {
  10443. var $1;
  10444. result=anObject;
  10445. self._do_((function(each){
  10446. return smalltalk.withContext(function($ctx2) {
  10447. result=_st(aBlock)._value_value_(result,each);
  10448. return result;
  10449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10450. $1=result;
  10451. return $1;
  10452. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.Collection)})},
  10453. args: ["anObject", "aBlock"],
  10454. 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",
  10455. messageSends: ["do:", "value:value:"],
  10456. referencedClasses: []
  10457. }),
  10458. smalltalk.Collection);
  10459. smalltalk.addMethod(
  10460. smalltalk.method({
  10461. selector: "intersection:",
  10462. category: 'enumerating',
  10463. fn: function (aCollection){
  10464. var self=this;
  10465. var set,outputSet;
  10466. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  10467. return smalltalk.withContext(function($ctx1) {
  10468. var $1,$2;
  10469. set=self._asSet();
  10470. outputSet=_st($Set())._new();
  10471. _st(aCollection)._do_((function(each){
  10472. return smalltalk.withContext(function($ctx2) {
  10473. $1=_st(_st(set)._includes_(each))._and_((function(){
  10474. return smalltalk.withContext(function($ctx3) {
  10475. return _st(_st(outputSet)._includes_(each))._not();
  10476. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  10477. if(smalltalk.assert($1)){
  10478. return _st(outputSet)._add_(each);
  10479. };
  10480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10481. $2=_st(self._class())._withAll_(_st(outputSet)._asArray());
  10482. return $2;
  10483. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.Collection)})},
  10484. args: ["aCollection"],
  10485. 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",
  10486. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  10487. referencedClasses: ["Set"]
  10488. }),
  10489. smalltalk.Collection);
  10490. smalltalk.addMethod(
  10491. smalltalk.method({
  10492. selector: "isEmpty",
  10493. category: 'testing',
  10494. fn: function (){
  10495. var self=this;
  10496. return smalltalk.withContext(function($ctx1) {
  10497. var $1;
  10498. $1=_st(self._size()).__eq((0));
  10499. return $1;
  10500. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})},
  10501. args: [],
  10502. source: "isEmpty\x0a\x09^self size = 0",
  10503. messageSends: ["=", "size"],
  10504. referencedClasses: []
  10505. }),
  10506. smalltalk.Collection);
  10507. smalltalk.addMethod(
  10508. smalltalk.method({
  10509. selector: "notEmpty",
  10510. category: 'testing',
  10511. fn: function (){
  10512. var self=this;
  10513. return smalltalk.withContext(function($ctx1) {
  10514. var $1;
  10515. $1=_st(self._isEmpty())._not();
  10516. return $1;
  10517. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})},
  10518. args: [],
  10519. source: "notEmpty\x0a\x09^self isEmpty not",
  10520. messageSends: ["not", "isEmpty"],
  10521. referencedClasses: []
  10522. }),
  10523. smalltalk.Collection);
  10524. smalltalk.addMethod(
  10525. smalltalk.method({
  10526. selector: "occurrencesOf:",
  10527. category: 'accessing',
  10528. fn: function (anObject){
  10529. var self=this;
  10530. var tally;
  10531. return smalltalk.withContext(function($ctx1) {
  10532. var $1,$2;
  10533. tally=(0);
  10534. self._do_((function(each){
  10535. return smalltalk.withContext(function($ctx2) {
  10536. $1=_st(anObject).__eq(each);
  10537. if(smalltalk.assert($1)){
  10538. tally=_st(tally).__plus((1));
  10539. return tally;
  10540. };
  10541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10542. $2=tally;
  10543. return $2;
  10544. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.Collection)})},
  10545. args: ["anObject"],
  10546. 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",
  10547. messageSends: ["do:", "ifTrue:", "+", "="],
  10548. referencedClasses: []
  10549. }),
  10550. smalltalk.Collection);
  10551. smalltalk.addMethod(
  10552. smalltalk.method({
  10553. selector: "putOn:",
  10554. category: 'streaming',
  10555. fn: function (aStream){
  10556. var self=this;
  10557. return smalltalk.withContext(function($ctx1) {
  10558. self._do_((function(each){
  10559. return smalltalk.withContext(function($ctx2) {
  10560. return _st(each)._putOn_(aStream);
  10561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10562. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})},
  10563. args: ["aStream"],
  10564. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  10565. messageSends: ["do:", "putOn:"],
  10566. referencedClasses: []
  10567. }),
  10568. smalltalk.Collection);
  10569. smalltalk.addMethod(
  10570. smalltalk.method({
  10571. selector: "reject:",
  10572. category: 'enumerating',
  10573. fn: function (aBlock){
  10574. var self=this;
  10575. return smalltalk.withContext(function($ctx1) {
  10576. var $1;
  10577. $1=self._select_((function(each){
  10578. return smalltalk.withContext(function($ctx2) {
  10579. return _st(_st(aBlock)._value_(each)).__eq(false);
  10580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10581. return $1;
  10582. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})},
  10583. args: ["aBlock"],
  10584. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  10585. messageSends: ["select:", "=", "value:"],
  10586. referencedClasses: []
  10587. }),
  10588. smalltalk.Collection);
  10589. smalltalk.addMethod(
  10590. smalltalk.method({
  10591. selector: "remove:",
  10592. category: 'adding/removing',
  10593. fn: function (anObject){
  10594. var self=this;
  10595. return smalltalk.withContext(function($ctx1) {
  10596. var $1;
  10597. $1=self._remove_ifAbsent_(anObject,(function(){
  10598. return smalltalk.withContext(function($ctx2) {
  10599. return self._errorNotFound();
  10600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10601. return $1;
  10602. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})},
  10603. args: ["anObject"],
  10604. source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]",
  10605. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  10606. referencedClasses: []
  10607. }),
  10608. smalltalk.Collection);
  10609. smalltalk.addMethod(
  10610. smalltalk.method({
  10611. selector: "remove:ifAbsent:",
  10612. category: 'adding/removing',
  10613. fn: function (anObject,aBlock){
  10614. var self=this;
  10615. return smalltalk.withContext(function($ctx1) {
  10616. self._subclassResponsibility();
  10617. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})},
  10618. args: ["anObject", "aBlock"],
  10619. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10620. messageSends: ["subclassResponsibility"],
  10621. referencedClasses: []
  10622. }),
  10623. smalltalk.Collection);
  10624. smalltalk.addMethod(
  10625. smalltalk.method({
  10626. selector: "select:",
  10627. category: 'enumerating',
  10628. fn: function (aBlock){
  10629. var self=this;
  10630. var stream;
  10631. return smalltalk.withContext(function($ctx1) {
  10632. var $1,$2;
  10633. stream=_st(_st(self._class())._new())._writeStream();
  10634. self._do_((function(each){
  10635. return smalltalk.withContext(function($ctx2) {
  10636. $1=_st(aBlock)._value_(each);
  10637. if(smalltalk.assert($1)){
  10638. return _st(stream)._nextPut_(each);
  10639. };
  10640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  10641. $2=_st(stream)._contents();
  10642. return $2;
  10643. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  10644. args: ["aBlock"],
  10645. 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",
  10646. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  10647. referencedClasses: []
  10648. }),
  10649. smalltalk.Collection);
  10650. smalltalk.addMethod(
  10651. smalltalk.method({
  10652. selector: "size",
  10653. category: 'accessing',
  10654. fn: function (){
  10655. var self=this;
  10656. return smalltalk.withContext(function($ctx1) {
  10657. self._subclassResponsibility();
  10658. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})},
  10659. args: [],
  10660. source: "size\x0a\x09self subclassResponsibility",
  10661. messageSends: ["subclassResponsibility"],
  10662. referencedClasses: []
  10663. }),
  10664. smalltalk.Collection);
  10665. smalltalk.addMethod(
  10666. smalltalk.method({
  10667. selector: "heliosClass",
  10668. category: 'helios',
  10669. fn: function (){
  10670. var self=this;
  10671. return smalltalk.withContext(function($ctx1) {
  10672. return "collection";
  10673. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Collection.klass)})},
  10674. args: [],
  10675. source: "heliosClass\x0a\x09^ 'collection'",
  10676. messageSends: [],
  10677. referencedClasses: []
  10678. }),
  10679. smalltalk.Collection.klass);
  10680. smalltalk.addMethod(
  10681. smalltalk.method({
  10682. selector: "new:",
  10683. category: 'instance creation',
  10684. fn: function (anInteger){
  10685. var self=this;
  10686. return smalltalk.withContext(function($ctx1) {
  10687. var $1;
  10688. $1=self._new();
  10689. return $1;
  10690. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})},
  10691. args: ["anInteger"],
  10692. source: "new: anInteger\x0a\x09^self new",
  10693. messageSends: ["new"],
  10694. referencedClasses: []
  10695. }),
  10696. smalltalk.Collection.klass);
  10697. smalltalk.addMethod(
  10698. smalltalk.method({
  10699. selector: "with:",
  10700. category: 'instance creation',
  10701. fn: function (anObject){
  10702. var self=this;
  10703. return smalltalk.withContext(function($ctx1) {
  10704. var $2,$3,$1;
  10705. $2=self._new();
  10706. _st($2)._add_(anObject);
  10707. $3=_st($2)._yourself();
  10708. $1=$3;
  10709. return $1;
  10710. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})},
  10711. args: ["anObject"],
  10712. source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  10713. messageSends: ["add:", "new", "yourself"],
  10714. referencedClasses: []
  10715. }),
  10716. smalltalk.Collection.klass);
  10717. smalltalk.addMethod(
  10718. smalltalk.method({
  10719. selector: "with:with:",
  10720. category: 'instance creation',
  10721. fn: function (anObject,anotherObject){
  10722. var self=this;
  10723. return smalltalk.withContext(function($ctx1) {
  10724. var $2,$3,$1;
  10725. $2=self._new();
  10726. _st($2)._add_(anObject);
  10727. _st($2)._add_(anotherObject);
  10728. $3=_st($2)._yourself();
  10729. $1=$3;
  10730. return $1;
  10731. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.Collection.klass)})},
  10732. args: ["anObject", "anotherObject"],
  10733. source: "with: anObject with: anotherObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  10734. messageSends: ["add:", "new", "yourself"],
  10735. referencedClasses: []
  10736. }),
  10737. smalltalk.Collection.klass);
  10738. smalltalk.addMethod(
  10739. smalltalk.method({
  10740. selector: "with:with:with:",
  10741. category: 'instance creation',
  10742. fn: function (firstObject,secondObject,thirdObject){
  10743. var self=this;
  10744. return smalltalk.withContext(function($ctx1) {
  10745. var $2,$3,$1;
  10746. $2=self._new();
  10747. _st($2)._add_(firstObject);
  10748. _st($2)._add_(secondObject);
  10749. _st($2)._add_(thirdObject);
  10750. $3=_st($2)._yourself();
  10751. $1=$3;
  10752. return $1;
  10753. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.Collection.klass)})},
  10754. args: ["firstObject", "secondObject", "thirdObject"],
  10755. 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",
  10756. messageSends: ["add:", "new", "yourself"],
  10757. referencedClasses: []
  10758. }),
  10759. smalltalk.Collection.klass);
  10760. smalltalk.addMethod(
  10761. smalltalk.method({
  10762. selector: "withAll:",
  10763. category: 'instance creation',
  10764. fn: function (aCollection){
  10765. var self=this;
  10766. return smalltalk.withContext(function($ctx1) {
  10767. var $2,$3,$1;
  10768. $2=self._new();
  10769. _st($2)._addAll_(aCollection);
  10770. $3=_st($2)._yourself();
  10771. $1=$3;
  10772. return $1;
  10773. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})},
  10774. args: ["aCollection"],
  10775. source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10776. messageSends: ["addAll:", "new", "yourself"],
  10777. referencedClasses: []
  10778. }),
  10779. smalltalk.Collection.klass);
  10780. smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  10781. smalltalk.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.";
  10782. smalltalk.addMethod(
  10783. smalltalk.method({
  10784. selector: "at:",
  10785. category: 'accessing',
  10786. fn: function (anIndex){
  10787. var self=this;
  10788. return smalltalk.withContext(function($ctx1) {
  10789. var $1;
  10790. $1=self._at_ifAbsent_(anIndex,(function(){
  10791. return smalltalk.withContext(function($ctx2) {
  10792. return self._errorNotFound();
  10793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10794. return $1;
  10795. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.IndexableCollection)})},
  10796. args: ["anIndex"],
  10797. 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 ]",
  10798. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10799. referencedClasses: []
  10800. }),
  10801. smalltalk.IndexableCollection);
  10802. smalltalk.addMethod(
  10803. smalltalk.method({
  10804. selector: "at:ifAbsent:",
  10805. category: 'accessing',
  10806. fn: function (anIndex,aBlock){
  10807. var self=this;
  10808. return smalltalk.withContext(function($ctx1) {
  10809. self._subclassReponsibility();
  10810. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10811. args: ["anIndex", "aBlock"],
  10812. 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 subclassReponsibility",
  10813. messageSends: ["subclassReponsibility"],
  10814. referencedClasses: []
  10815. }),
  10816. smalltalk.IndexableCollection);
  10817. smalltalk.addMethod(
  10818. smalltalk.method({
  10819. selector: "at:ifPresent:",
  10820. category: 'accessing',
  10821. fn: function (anIndex,aBlock){
  10822. var self=this;
  10823. return smalltalk.withContext(function($ctx1) {
  10824. var $1;
  10825. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  10826. return smalltalk.withContext(function($ctx2) {
  10827. return nil;
  10828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10829. return $1;
  10830. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10831. args: ["anIndex", "aBlock"],
  10832. 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 ]",
  10833. messageSends: ["at:ifPresent:ifAbsent:"],
  10834. referencedClasses: []
  10835. }),
  10836. smalltalk.IndexableCollection);
  10837. smalltalk.addMethod(
  10838. smalltalk.method({
  10839. selector: "at:ifPresent:ifAbsent:",
  10840. category: 'accessing',
  10841. fn: function (anIndex,aBlock,anotherBlock){
  10842. var self=this;
  10843. return smalltalk.withContext(function($ctx1) {
  10844. self._subclassResponsibility();
  10845. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.IndexableCollection)})},
  10846. args: ["anIndex", "aBlock", "anotherBlock"],
  10847. 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",
  10848. messageSends: ["subclassResponsibility"],
  10849. referencedClasses: []
  10850. }),
  10851. smalltalk.IndexableCollection);
  10852. smalltalk.addMethod(
  10853. smalltalk.method({
  10854. selector: "at:put:",
  10855. category: 'accessing',
  10856. fn: function (anIndex,anObject){
  10857. var self=this;
  10858. return smalltalk.withContext(function($ctx1) {
  10859. self._subclassReponsibility();
  10860. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})},
  10861. args: ["anIndex", "anObject"],
  10862. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility",
  10863. messageSends: ["subclassReponsibility"],
  10864. referencedClasses: []
  10865. }),
  10866. smalltalk.IndexableCollection);
  10867. smalltalk.addMethod(
  10868. smalltalk.method({
  10869. selector: "indexOf:",
  10870. category: 'accessing',
  10871. fn: function (anObject){
  10872. var self=this;
  10873. return smalltalk.withContext(function($ctx1) {
  10874. var $1;
  10875. $1=self._indexOf_ifAbsent_(anObject,(function(){
  10876. return smalltalk.withContext(function($ctx2) {
  10877. return self._errorNotFound();
  10878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  10879. return $1;
  10880. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.IndexableCollection)})},
  10881. args: ["anObject"],
  10882. 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 ]",
  10883. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10884. referencedClasses: []
  10885. }),
  10886. smalltalk.IndexableCollection);
  10887. smalltalk.addMethod(
  10888. smalltalk.method({
  10889. selector: "indexOf:ifAbsent:",
  10890. category: 'accessing',
  10891. fn: function (anObject,aBlock){
  10892. var self=this;
  10893. return smalltalk.withContext(function($ctx1) {
  10894. self._subclassResponsibility();
  10895. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10896. args: ["anObject", "aBlock"],
  10897. 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",
  10898. messageSends: ["subclassResponsibility"],
  10899. referencedClasses: []
  10900. }),
  10901. smalltalk.IndexableCollection);
  10902. smalltalk.addMethod(
  10903. smalltalk.method({
  10904. selector: "with:do:",
  10905. category: 'enumarating',
  10906. fn: function (anotherCollection,aBlock){
  10907. var self=this;
  10908. return smalltalk.withContext(function($ctx1) {
  10909. self._withIndexDo_((function(each,index){
  10910. return smalltalk.withContext(function($ctx2) {
  10911. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  10912. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  10913. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.IndexableCollection)})},
  10914. args: ["anotherCollection", "aBlock"],
  10915. 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) ]",
  10916. messageSends: ["withIndexDo:", "value:value:", "at:"],
  10917. referencedClasses: []
  10918. }),
  10919. smalltalk.IndexableCollection);
  10920. smalltalk.addMethod(
  10921. smalltalk.method({
  10922. selector: "withIndexDo:",
  10923. category: 'enumarating',
  10924. fn: function (aBlock){
  10925. var self=this;
  10926. return smalltalk.withContext(function($ctx1) {
  10927. self._subclassReponsibility();
  10928. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.IndexableCollection)})},
  10929. args: ["aBlock"],
  10930. 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 subclassReponsibility",
  10931. messageSends: ["subclassReponsibility"],
  10932. referencedClasses: []
  10933. }),
  10934. smalltalk.IndexableCollection);
  10935. smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  10936. smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  10937. smalltalk.addMethod(
  10938. smalltalk.method({
  10939. selector: ",",
  10940. category: 'copying',
  10941. fn: function (aCollection){
  10942. var self=this;
  10943. return smalltalk.withContext(function($ctx1) {
  10944. self._shouldNotImplement();
  10945. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})},
  10946. args: ["aCollection"],
  10947. source: ", aCollection\x0a\x09self shouldNotImplement",
  10948. messageSends: ["shouldNotImplement"],
  10949. referencedClasses: []
  10950. }),
  10951. smalltalk.HashedCollection);
  10952. smalltalk.addMethod(
  10953. smalltalk.method({
  10954. selector: "=",
  10955. category: 'comparing',
  10956. fn: function (aHashedCollection){
  10957. var self=this;
  10958. return smalltalk.withContext(function($ctx1) {
  10959. var $1,$2,$3;
  10960. $1=_st(self._class()).__eq(_st(aHashedCollection)._class());
  10961. if(! smalltalk.assert($1)){
  10962. return false;
  10963. };
  10964. $2=_st(self._size()).__eq(_st(aHashedCollection)._size());
  10965. if(! smalltalk.assert($2)){
  10966. return false;
  10967. };
  10968. $3=_st(self._associations()).__eq(_st(aHashedCollection)._associations());
  10969. return $3;
  10970. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  10971. args: ["aHashedCollection"],
  10972. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  10973. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  10974. referencedClasses: []
  10975. }),
  10976. smalltalk.HashedCollection);
  10977. smalltalk.addMethod(
  10978. smalltalk.method({
  10979. selector: "add:",
  10980. category: 'adding/removing',
  10981. fn: function (anAssociation){
  10982. var self=this;
  10983. return smalltalk.withContext(function($ctx1) {
  10984. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  10985. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})},
  10986. args: ["anAssociation"],
  10987. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  10988. messageSends: ["at:put:", "key", "value"],
  10989. referencedClasses: []
  10990. }),
  10991. smalltalk.HashedCollection);
  10992. smalltalk.addMethod(
  10993. smalltalk.method({
  10994. selector: "addAll:",
  10995. category: 'adding/removing',
  10996. fn: function (aHashedCollection){
  10997. var self=this;
  10998. return smalltalk.withContext(function($ctx1) {
  10999. var $1;
  11000. smalltalk.IndexableCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  11001. $1=aHashedCollection;
  11002. return $1;
  11003. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  11004. args: ["aHashedCollection"],
  11005. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  11006. messageSends: ["addAll:", "associations"],
  11007. referencedClasses: []
  11008. }),
  11009. smalltalk.HashedCollection);
  11010. smalltalk.addMethod(
  11011. smalltalk.method({
  11012. selector: "asDictionary",
  11013. category: 'converting',
  11014. fn: function (){
  11015. var self=this;
  11016. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11017. return smalltalk.withContext(function($ctx1) {
  11018. var $1;
  11019. $1=_st($Dictionary())._from_(self._associations());
  11020. return $1;
  11021. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})},
  11022. args: [],
  11023. source: "asDictionary\x0a\x09^Dictionary from: self associations",
  11024. messageSends: ["from:", "associations"],
  11025. referencedClasses: ["Dictionary"]
  11026. }),
  11027. smalltalk.HashedCollection);
  11028. smalltalk.addMethod(
  11029. smalltalk.method({
  11030. selector: "asJSON",
  11031. category: 'converting',
  11032. fn: function (){
  11033. var self=this;
  11034. var c;
  11035. return smalltalk.withContext(function($ctx1) {
  11036. var $1;
  11037. c=_st(self._class())._new();
  11038. self._keysAndValuesDo_((function(key,value){
  11039. return smalltalk.withContext(function($ctx2) {
  11040. return _st(c)._at_put_(key,_st(value)._asJSON());
  11041. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11042. $1=c;
  11043. return $1;
  11044. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})},
  11045. args: [],
  11046. source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c",
  11047. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  11048. referencedClasses: []
  11049. }),
  11050. smalltalk.HashedCollection);
  11051. smalltalk.addMethod(
  11052. smalltalk.method({
  11053. selector: "associations",
  11054. category: 'accessing',
  11055. fn: function (){
  11056. var self=this;
  11057. var associations;
  11058. return smalltalk.withContext(function($ctx1) {
  11059. var $1;
  11060. associations=[];
  11061. self._associationsDo_((function(each){
  11062. return smalltalk.withContext(function($ctx2) {
  11063. return _st(associations)._add_(each);
  11064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11065. $1=associations;
  11066. return $1;
  11067. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})},
  11068. args: [],
  11069. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
  11070. messageSends: ["associationsDo:", "add:"],
  11071. referencedClasses: []
  11072. }),
  11073. smalltalk.HashedCollection);
  11074. smalltalk.addMethod(
  11075. smalltalk.method({
  11076. selector: "associationsDo:",
  11077. category: 'enumerating',
  11078. fn: function (aBlock){
  11079. var self=this;
  11080. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  11081. return smalltalk.withContext(function($ctx1) {
  11082. self._keysAndValuesDo_((function(key,value){
  11083. return smalltalk.withContext(function($ctx2) {
  11084. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  11085. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11086. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11087. args: ["aBlock"],
  11088. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]",
  11089. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  11090. referencedClasses: ["Association"]
  11091. }),
  11092. smalltalk.HashedCollection);
  11093. smalltalk.addMethod(
  11094. smalltalk.method({
  11095. selector: "at:ifAbsent:",
  11096. category: 'accessing',
  11097. fn: function (aKey,aBlock){
  11098. var self=this;
  11099. return smalltalk.withContext(function($ctx1) {
  11100. var $2,$1;
  11101. $2=self._includesKey_(aKey);
  11102. $1=_st($2)._ifTrue_ifFalse_((function(){
  11103. return smalltalk.withContext(function($ctx2) {
  11104. return self._basicAt_(aKey);
  11105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  11106. return $1;
  11107. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11108. args: ["aKey", "aBlock"],
  11109. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  11110. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  11111. referencedClasses: []
  11112. }),
  11113. smalltalk.HashedCollection);
  11114. smalltalk.addMethod(
  11115. smalltalk.method({
  11116. selector: "at:ifAbsentPut:",
  11117. category: 'accessing',
  11118. fn: function (aKey,aBlock){
  11119. var self=this;
  11120. return smalltalk.withContext(function($ctx1) {
  11121. var $1;
  11122. $1=self._at_ifAbsent_(aKey,(function(){
  11123. return smalltalk.withContext(function($ctx2) {
  11124. return self._at_put_(aKey,_st(aBlock)._value());
  11125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11126. return $1;
  11127. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11128. args: ["aKey", "aBlock"],
  11129. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]",
  11130. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  11131. referencedClasses: []
  11132. }),
  11133. smalltalk.HashedCollection);
  11134. smalltalk.addMethod(
  11135. smalltalk.method({
  11136. selector: "at:ifPresent:ifAbsent:",
  11137. category: 'accessing',
  11138. fn: function (aKey,aBlock,anotherBlock){
  11139. var self=this;
  11140. return smalltalk.withContext(function($ctx1) {
  11141. var $2,$1;
  11142. $2=self._includesKey_(aKey);
  11143. $1=_st($2)._ifTrue_ifFalse_((function(){
  11144. return smalltalk.withContext(function($ctx2) {
  11145. return _st(aBlock)._value_(self._at_(aKey));
  11146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  11147. return $1;
  11148. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  11149. args: ["aKey", "aBlock", "anotherBlock"],
  11150. 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 with the value associated with the key,\x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
  11151. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  11152. referencedClasses: []
  11153. }),
  11154. smalltalk.HashedCollection);
  11155. smalltalk.addMethod(
  11156. smalltalk.method({
  11157. selector: "at:put:",
  11158. category: 'accessing',
  11159. fn: function (aKey,aValue){
  11160. var self=this;
  11161. return smalltalk.withContext(function($ctx1) {
  11162. var $1;
  11163. $1=self._basicAt_put_(aKey,aValue);
  11164. return $1;
  11165. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})},
  11166. args: ["aKey", "aValue"],
  11167. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  11168. messageSends: ["basicAt:put:"],
  11169. referencedClasses: []
  11170. }),
  11171. smalltalk.HashedCollection);
  11172. smalltalk.addMethod(
  11173. smalltalk.method({
  11174. selector: "collect:",
  11175. category: 'enumerating',
  11176. fn: function (aBlock){
  11177. var self=this;
  11178. var newDict;
  11179. return smalltalk.withContext(function($ctx1) {
  11180. var $1;
  11181. newDict=_st(self._class())._new();
  11182. self._keysAndValuesDo_((function(key,value){
  11183. return smalltalk.withContext(function($ctx2) {
  11184. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  11185. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11186. $1=newDict;
  11187. return $1;
  11188. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  11189. args: ["aBlock"],
  11190. 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",
  11191. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  11192. referencedClasses: []
  11193. }),
  11194. smalltalk.HashedCollection);
  11195. smalltalk.addMethod(
  11196. smalltalk.method({
  11197. selector: "deepCopy",
  11198. category: 'copying',
  11199. fn: function (){
  11200. var self=this;
  11201. var copy;
  11202. return smalltalk.withContext(function($ctx1) {
  11203. var $1;
  11204. copy=_st(self._class())._new();
  11205. self._keysAndValuesDo_((function(key,value){
  11206. return smalltalk.withContext(function($ctx2) {
  11207. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  11208. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11209. $1=copy;
  11210. return $1;
  11211. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})},
  11212. args: [],
  11213. 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",
  11214. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  11215. referencedClasses: []
  11216. }),
  11217. smalltalk.HashedCollection);
  11218. smalltalk.addMethod(
  11219. smalltalk.method({
  11220. selector: "detect:ifNone:",
  11221. category: 'enumerating',
  11222. fn: function (aBlock,anotherBlock){
  11223. var self=this;
  11224. return smalltalk.withContext(function($ctx1) {
  11225. var $1;
  11226. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11227. return $1;
  11228. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  11229. args: ["aBlock", "anotherBlock"],
  11230. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  11231. messageSends: ["detect:ifNone:", "values"],
  11232. referencedClasses: []
  11233. }),
  11234. smalltalk.HashedCollection);
  11235. smalltalk.addMethod(
  11236. smalltalk.method({
  11237. selector: "do:",
  11238. category: 'enumerating',
  11239. fn: function (aBlock){
  11240. var self=this;
  11241. return smalltalk.withContext(function($ctx1) {
  11242. self._valuesDo_(aBlock);
  11243. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11244. args: ["aBlock"],
  11245. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11246. messageSends: ["valuesDo:"],
  11247. referencedClasses: []
  11248. }),
  11249. smalltalk.HashedCollection);
  11250. smalltalk.addMethod(
  11251. smalltalk.method({
  11252. selector: "includes:",
  11253. category: 'enumerating',
  11254. fn: function (anObject){
  11255. var self=this;
  11256. return smalltalk.withContext(function($ctx1) {
  11257. var $1;
  11258. $1=_st(self._values())._includes_(anObject);
  11259. return $1;
  11260. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})},
  11261. args: ["anObject"],
  11262. source: "includes: anObject\x0a\x09^self values includes: anObject",
  11263. messageSends: ["includes:", "values"],
  11264. referencedClasses: []
  11265. }),
  11266. smalltalk.HashedCollection);
  11267. smalltalk.addMethod(
  11268. smalltalk.method({
  11269. selector: "includesKey:",
  11270. category: 'testing',
  11271. fn: function (aKey){
  11272. var self=this;
  11273. return smalltalk.withContext(function($ctx1) {
  11274. return self.hasOwnProperty(aKey);
  11275. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  11276. args: ["aKey"],
  11277. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  11278. messageSends: [],
  11279. referencedClasses: []
  11280. }),
  11281. smalltalk.HashedCollection);
  11282. smalltalk.addMethod(
  11283. smalltalk.method({
  11284. selector: "indexOf:ifAbsent:",
  11285. category: 'accessing',
  11286. fn: function (anObject,aBlock){
  11287. var self=this;
  11288. return smalltalk.withContext(function($ctx1) {
  11289. var $1;
  11290. $1=_st(self._keys())._detect_ifNone_((function(each){
  11291. return smalltalk.withContext(function($ctx2) {
  11292. return _st(self._at_(each)).__eq(anObject);
  11293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),aBlock);
  11294. return $1;
  11295. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
  11296. args: ["anObject", "aBlock"],
  11297. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock",
  11298. messageSends: ["detect:ifNone:", "=", "at:", "keys"],
  11299. referencedClasses: []
  11300. }),
  11301. smalltalk.HashedCollection);
  11302. smalltalk.addMethod(
  11303. smalltalk.method({
  11304. selector: "keys",
  11305. category: 'accessing',
  11306. fn: function (){
  11307. var self=this;
  11308. return smalltalk.withContext(function($ctx1) {
  11309. if ('function'===typeof Object.keys) return Object.keys(self);
  11310. var keys = [];
  11311. for(var i in self) {
  11312. if(self.hasOwnProperty(i)) {
  11313. keys.push(i);
  11314. }
  11315. };
  11316. return keys;
  11317. ;
  11318. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})},
  11319. args: [],
  11320. source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>",
  11321. messageSends: [],
  11322. referencedClasses: []
  11323. }),
  11324. smalltalk.HashedCollection);
  11325. smalltalk.addMethod(
  11326. smalltalk.method({
  11327. selector: "keysAndValuesDo:",
  11328. category: 'enumerating',
  11329. fn: function (aBlock){
  11330. var self=this;
  11331. return smalltalk.withContext(function($ctx1) {
  11332. self._keysDo_((function(each){
  11333. return smalltalk.withContext(function($ctx2) {
  11334. return _st(aBlock)._value_value_(each,self._at_(each));
  11335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11336. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11337. args: ["aBlock"],
  11338. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]",
  11339. messageSends: ["keysDo:", "value:value:", "at:"],
  11340. referencedClasses: []
  11341. }),
  11342. smalltalk.HashedCollection);
  11343. smalltalk.addMethod(
  11344. smalltalk.method({
  11345. selector: "keysDo:",
  11346. category: 'enumerating',
  11347. fn: function (aBlock){
  11348. var self=this;
  11349. return smalltalk.withContext(function($ctx1) {
  11350. _st(self._keys())._do_(aBlock);
  11351. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11352. args: ["aBlock"],
  11353. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  11354. messageSends: ["do:", "keys"],
  11355. referencedClasses: []
  11356. }),
  11357. smalltalk.HashedCollection);
  11358. smalltalk.addMethod(
  11359. smalltalk.method({
  11360. selector: "printOn:",
  11361. category: 'printing',
  11362. fn: function (aStream){
  11363. var self=this;
  11364. return smalltalk.withContext(function($ctx1) {
  11365. smalltalk.IndexableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  11366. _st(aStream)._nextPutAll_(" (");
  11367. _st(self._associations())._do_separatedBy_((function(each){
  11368. return smalltalk.withContext(function($ctx2) {
  11369. return _st(each)._printOn_(aStream);
  11370. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  11371. return smalltalk.withContext(function($ctx2) {
  11372. return _st(aStream)._nextPutAll_(" , ");
  11373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11374. _st(aStream)._nextPutAll_(")");
  11375. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})},
  11376. args: ["aStream"],
  11377. 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: ')'",
  11378. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  11379. referencedClasses: []
  11380. }),
  11381. smalltalk.HashedCollection);
  11382. smalltalk.addMethod(
  11383. smalltalk.method({
  11384. selector: "remove:ifAbsent:",
  11385. category: 'adding/removing',
  11386. fn: function (aKey,aBlock){
  11387. var self=this;
  11388. return smalltalk.withContext(function($ctx1) {
  11389. var $1;
  11390. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  11391. return $1;
  11392. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11393. args: ["aKey", "aBlock"],
  11394. source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock",
  11395. messageSends: ["removeKey:ifAbsent:"],
  11396. referencedClasses: []
  11397. }),
  11398. smalltalk.HashedCollection);
  11399. smalltalk.addMethod(
  11400. smalltalk.method({
  11401. selector: "removeKey:",
  11402. category: 'adding/removing',
  11403. fn: function (aKey){
  11404. var self=this;
  11405. return smalltalk.withContext(function($ctx1) {
  11406. var $1;
  11407. $1=self._remove_(aKey);
  11408. return $1;
  11409. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  11410. args: ["aKey"],
  11411. source: "removeKey: aKey\x0a\x09^self remove: aKey",
  11412. messageSends: ["remove:"],
  11413. referencedClasses: []
  11414. }),
  11415. smalltalk.HashedCollection);
  11416. smalltalk.addMethod(
  11417. smalltalk.method({
  11418. selector: "removeKey:ifAbsent:",
  11419. category: 'adding/removing',
  11420. fn: function (aKey,aBlock){
  11421. var self=this;
  11422. return smalltalk.withContext(function($ctx1) {
  11423. var $2,$1;
  11424. $2=self._includesKey_(aKey);
  11425. if(smalltalk.assert($2)){
  11426. $1=self._basicDelete_(aKey);
  11427. } else {
  11428. $1=_st(aBlock)._value();
  11429. };
  11430. return $1;
  11431. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  11432. args: ["aKey", "aBlock"],
  11433. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  11434. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  11435. referencedClasses: []
  11436. }),
  11437. smalltalk.HashedCollection);
  11438. smalltalk.addMethod(
  11439. smalltalk.method({
  11440. selector: "select:",
  11441. category: 'enumerating',
  11442. fn: function (aBlock){
  11443. var self=this;
  11444. var newDict;
  11445. return smalltalk.withContext(function($ctx1) {
  11446. var $1,$2;
  11447. newDict=_st(self._class())._new();
  11448. self._keysAndValuesDo_((function(key,value){
  11449. return smalltalk.withContext(function($ctx2) {
  11450. $1=_st(aBlock)._value_(value);
  11451. if(smalltalk.assert($1)){
  11452. return _st(newDict)._at_put_(key,value);
  11453. };
  11454. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11455. $2=newDict;
  11456. return $2;
  11457. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  11458. args: ["aBlock"],
  11459. 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",
  11460. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  11461. referencedClasses: []
  11462. }),
  11463. smalltalk.HashedCollection);
  11464. smalltalk.addMethod(
  11465. smalltalk.method({
  11466. selector: "shallowCopy",
  11467. category: 'copying',
  11468. fn: function (){
  11469. var self=this;
  11470. var copy;
  11471. return smalltalk.withContext(function($ctx1) {
  11472. var $1;
  11473. copy=_st(self._class())._new();
  11474. self._keysAndValuesDo_((function(key,value){
  11475. return smalltalk.withContext(function($ctx2) {
  11476. return _st(copy)._at_put_(key,value);
  11477. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11478. $1=copy;
  11479. return $1;
  11480. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})},
  11481. args: [],
  11482. 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",
  11483. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  11484. referencedClasses: []
  11485. }),
  11486. smalltalk.HashedCollection);
  11487. smalltalk.addMethod(
  11488. smalltalk.method({
  11489. selector: "size",
  11490. category: 'accessing',
  11491. fn: function (){
  11492. var self=this;
  11493. return smalltalk.withContext(function($ctx1) {
  11494. var $1;
  11495. $1=_st(self._keys())._size();
  11496. return $1;
  11497. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})},
  11498. args: [],
  11499. source: "size\x0a\x09^self keys size",
  11500. messageSends: ["size", "keys"],
  11501. referencedClasses: []
  11502. }),
  11503. smalltalk.HashedCollection);
  11504. smalltalk.addMethod(
  11505. smalltalk.method({
  11506. selector: "values",
  11507. category: 'accessing',
  11508. fn: function (){
  11509. var self=this;
  11510. return smalltalk.withContext(function($ctx1) {
  11511. var $1;
  11512. $1=_st(self._keys())._collect_((function(each){
  11513. return smalltalk.withContext(function($ctx2) {
  11514. return self._at_(each);
  11515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11516. return $1;
  11517. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})},
  11518. args: [],
  11519. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  11520. messageSends: ["collect:", "at:", "keys"],
  11521. referencedClasses: []
  11522. }),
  11523. smalltalk.HashedCollection);
  11524. smalltalk.addMethod(
  11525. smalltalk.method({
  11526. selector: "valuesDo:",
  11527. category: 'enumerating',
  11528. fn: function (aBlock){
  11529. var self=this;
  11530. return smalltalk.withContext(function($ctx1) {
  11531. self._keysAndValuesDo_((function(key,value){
  11532. return smalltalk.withContext(function($ctx2) {
  11533. return _st(aBlock)._value_(value);
  11534. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11535. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11536. args: ["aBlock"],
  11537. source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]",
  11538. messageSends: ["keysAndValuesDo:", "value:"],
  11539. referencedClasses: []
  11540. }),
  11541. smalltalk.HashedCollection);
  11542. smalltalk.addMethod(
  11543. smalltalk.method({
  11544. selector: "withIndexDo:",
  11545. category: 'enumerating',
  11546. fn: function (aBlock){
  11547. var self=this;
  11548. return smalltalk.withContext(function($ctx1) {
  11549. self._keysAndValuesDo_((function(key,value){
  11550. return smalltalk.withContext(function($ctx2) {
  11551. return _st(aBlock)._value_value_(value,key);
  11552. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  11553. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  11554. args: ["aBlock"],
  11555. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  11556. messageSends: ["keysAndValuesDo:", "value:value:"],
  11557. referencedClasses: []
  11558. }),
  11559. smalltalk.HashedCollection);
  11560. smalltalk.addMethod(
  11561. smalltalk.method({
  11562. selector: "from:",
  11563. category: 'instance creation',
  11564. fn: function (aCollection){
  11565. var self=this;
  11566. var newCollection;
  11567. return smalltalk.withContext(function($ctx1) {
  11568. var $1;
  11569. newCollection=self._new();
  11570. _st(aCollection)._do_((function(each){
  11571. return smalltalk.withContext(function($ctx2) {
  11572. return _st(newCollection)._add_(each);
  11573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11574. $1=newCollection;
  11575. return $1;
  11576. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  11577. args: ["aCollection"],
  11578. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  11579. messageSends: ["new", "do:", "add:"],
  11580. referencedClasses: []
  11581. }),
  11582. smalltalk.HashedCollection.klass);
  11583. smalltalk.addMethod(
  11584. smalltalk.method({
  11585. selector: "fromPairs:",
  11586. category: 'instance creation',
  11587. fn: function (aCollection){
  11588. var self=this;
  11589. return smalltalk.withContext(function($ctx1) {
  11590. var $1;
  11591. $1=self._from_(aCollection);
  11592. return $1;
  11593. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},smalltalk.HashedCollection.klass)})},
  11594. args: ["aCollection"],
  11595. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  11596. messageSends: ["from:"],
  11597. referencedClasses: []
  11598. }),
  11599. smalltalk.HashedCollection.klass);
  11600. smalltalk.addMethod(
  11601. smalltalk.method({
  11602. selector: "newFromPairs:",
  11603. category: 'instance creation',
  11604. fn: function (aCollection){
  11605. var self=this;
  11606. var newCollection;
  11607. return smalltalk.withContext(function($ctx1) {
  11608. var $1,$2;
  11609. $1=_st(_st(aCollection)._size())._even();
  11610. if(! smalltalk.assert($1)){
  11611. self._error_("#newFromPairs only accepts arrays of an even length");
  11612. };
  11613. newCollection=self._new();
  11614. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  11615. return smalltalk.withContext(function($ctx2) {
  11616. return _st(newCollection)._at_put_(_st(aCollection)._at_(each),_st(aCollection)._at_(_st(each).__plus((1))));
  11617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  11618. $2=newCollection;
  11619. return $2;
  11620. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  11621. args: ["aCollection"],
  11622. 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",
  11623. messageSends: ["ifFalse:", "error:", "even", "size", "new", "do:", "at:put:", "at:", "+", "to:by:"],
  11624. referencedClasses: []
  11625. }),
  11626. smalltalk.HashedCollection.klass);
  11627. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  11628. smalltalk.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.";
  11629. smalltalk.addMethod(
  11630. smalltalk.method({
  11631. selector: "asHashedCollection",
  11632. category: 'converting',
  11633. fn: function (){
  11634. var self=this;
  11635. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11636. return smalltalk.withContext(function($ctx1) {
  11637. var $1;
  11638. $1=_st($HashedCollection())._from_(self._associations());
  11639. return $1;
  11640. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})},
  11641. args: [],
  11642. source: "asHashedCollection\x0a\x09^HashedCollection from: self associations",
  11643. messageSends: ["from:", "associations"],
  11644. referencedClasses: ["HashedCollection"]
  11645. }),
  11646. smalltalk.Dictionary);
  11647. smalltalk.addMethod(
  11648. smalltalk.method({
  11649. selector: "asJSON",
  11650. category: 'converting',
  11651. fn: function (){
  11652. var self=this;
  11653. return smalltalk.withContext(function($ctx1) {
  11654. var $1;
  11655. $1=_st(self._asHashedCollection())._asJSON();
  11656. return $1;
  11657. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})},
  11658. args: [],
  11659. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  11660. messageSends: ["asJSON", "asHashedCollection"],
  11661. referencedClasses: []
  11662. }),
  11663. smalltalk.Dictionary);
  11664. smalltalk.addMethod(
  11665. smalltalk.method({
  11666. selector: "at:ifAbsent:",
  11667. category: 'accessing',
  11668. fn: function (aKey,aBlock){
  11669. var self=this;
  11670. return smalltalk.withContext(function($ctx1) {
  11671. var index = self._positionOfKey_(aKey);
  11672. return index >=0 ? self['@values'][index] : aBlock._value();
  11673. ;
  11674. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  11675. args: ["aKey", "aBlock"],
  11676. 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>",
  11677. messageSends: [],
  11678. referencedClasses: []
  11679. }),
  11680. smalltalk.Dictionary);
  11681. smalltalk.addMethod(
  11682. smalltalk.method({
  11683. selector: "at:put:",
  11684. category: 'accessing',
  11685. fn: function (aKey,aValue){
  11686. var self=this;
  11687. return smalltalk.withContext(function($ctx1) {
  11688. var index = self._positionOfKey_(aKey);
  11689. if(index === -1) {
  11690. var keys = self['@keys'];
  11691. index = keys.length;
  11692. keys.push(aKey);
  11693. }
  11694. return self['@values'][index] = aValue;
  11695. ;
  11696. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.Dictionary)})},
  11697. args: ["aKey", "aValue"],
  11698. 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>",
  11699. messageSends: [],
  11700. referencedClasses: []
  11701. }),
  11702. smalltalk.Dictionary);
  11703. smalltalk.addMethod(
  11704. smalltalk.method({
  11705. selector: "includesKey:",
  11706. category: 'testing',
  11707. fn: function (aKey){
  11708. var self=this;
  11709. return smalltalk.withContext(function($ctx1) {
  11710. return self._positionOfKey_(aKey) >= 0; ;
  11711. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})},
  11712. args: ["aKey"],
  11713. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  11714. messageSends: [],
  11715. referencedClasses: []
  11716. }),
  11717. smalltalk.Dictionary);
  11718. smalltalk.addMethod(
  11719. smalltalk.method({
  11720. selector: "indexOf:ifAbsent:",
  11721. category: 'accessing',
  11722. fn: function (anObject,aBlock){
  11723. var self=this;
  11724. var index;
  11725. return smalltalk.withContext(function($ctx1) {
  11726. var $2,$1;
  11727. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  11728. return smalltalk.withContext(function($ctx2) {
  11729. return (0);
  11730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11731. $2=_st(index).__eq((0));
  11732. if(smalltalk.assert($2)){
  11733. $1=_st(aBlock)._value();
  11734. } else {
  11735. $1=_st(self["@keys"])._at_(index);
  11736. };
  11737. return $1;
  11738. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})},
  11739. args: ["anObject", "aBlock"],
  11740. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09| index |\x0a\x09index := values indexOf: anObject ifAbsent: [0].\x0a\x09^ index = 0 ifTrue: [ aBlock value ] ifFalse: [ keys at: index ]",
  11741. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "value", "at:", "="],
  11742. referencedClasses: []
  11743. }),
  11744. smalltalk.Dictionary);
  11745. smalltalk.addMethod(
  11746. smalltalk.method({
  11747. selector: "initialize",
  11748. category: 'initialization',
  11749. fn: function (){
  11750. var self=this;
  11751. return smalltalk.withContext(function($ctx1) {
  11752. smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  11753. self["@keys"]=[];
  11754. self["@values"]=[];
  11755. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})},
  11756. args: [],
  11757. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  11758. messageSends: ["initialize"],
  11759. referencedClasses: []
  11760. }),
  11761. smalltalk.Dictionary);
  11762. smalltalk.addMethod(
  11763. smalltalk.method({
  11764. selector: "keys",
  11765. category: 'accessing',
  11766. fn: function (){
  11767. var self=this;
  11768. return smalltalk.withContext(function($ctx1) {
  11769. var $1;
  11770. $1=_st(self["@keys"])._copy();
  11771. return $1;
  11772. }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})},
  11773. args: [],
  11774. source: "keys\x0a\x09^keys copy",
  11775. messageSends: ["copy"],
  11776. referencedClasses: []
  11777. }),
  11778. smalltalk.Dictionary);
  11779. smalltalk.addMethod(
  11780. smalltalk.method({
  11781. selector: "keysAndValuesDo:",
  11782. category: 'enumerating',
  11783. fn: function (aBlock){
  11784. var self=this;
  11785. return smalltalk.withContext(function($ctx1) {
  11786. var $1;
  11787. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  11788. return $1;
  11789. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11790. args: ["aBlock"],
  11791. source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock",
  11792. messageSends: ["with:do:"],
  11793. referencedClasses: []
  11794. }),
  11795. smalltalk.Dictionary);
  11796. smalltalk.addMethod(
  11797. smalltalk.method({
  11798. selector: "keysDo:",
  11799. category: 'enumerating',
  11800. fn: function (aBlock){
  11801. var self=this;
  11802. return smalltalk.withContext(function($ctx1) {
  11803. var $1;
  11804. $1=_st(self["@keys"])._do_(aBlock);
  11805. return $1;
  11806. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11807. args: ["aBlock"],
  11808. source: "keysDo: aBlock\x0a\x09^keys do: aBlock",
  11809. messageSends: ["do:"],
  11810. referencedClasses: []
  11811. }),
  11812. smalltalk.Dictionary);
  11813. smalltalk.addMethod(
  11814. smalltalk.method({
  11815. selector: "positionOfKey:",
  11816. category: 'private',
  11817. fn: function (anObject){
  11818. var self=this;
  11819. return smalltalk.withContext(function($ctx1) {
  11820. var keys = self['@keys'];
  11821. for(var i=0;i<keys.length;i++){
  11822. if(keys[i].__eq(anObject)) { return i;}
  11823. }
  11824. return -1;
  11825. ;
  11826. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},smalltalk.Dictionary)})},
  11827. args: ["anObject"],
  11828. 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>",
  11829. messageSends: [],
  11830. referencedClasses: []
  11831. }),
  11832. smalltalk.Dictionary);
  11833. smalltalk.addMethod(
  11834. smalltalk.method({
  11835. selector: "removeKey:ifAbsent:",
  11836. category: 'adding/removing',
  11837. fn: function (aKey,aBlock){
  11838. var self=this;
  11839. return smalltalk.withContext(function($ctx1) {
  11840. var index = self._positionOfKey_(aKey);
  11841. if(index === -1) {
  11842. return aBlock._value()
  11843. } else {
  11844. var keys = self['@keys'], values = self['@values'];
  11845. var value = values[index], l = keys.length;
  11846. keys[index] = keys[l-1];
  11847. keys.pop();
  11848. values[index] = values[l-1];
  11849. values.pop();
  11850. return value;
  11851. }
  11852. ;
  11853. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  11854. args: ["aKey", "aBlock"],
  11855. 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>",
  11856. messageSends: [],
  11857. referencedClasses: []
  11858. }),
  11859. smalltalk.Dictionary);
  11860. smalltalk.addMethod(
  11861. smalltalk.method({
  11862. selector: "values",
  11863. category: 'accessing',
  11864. fn: function (){
  11865. var self=this;
  11866. return smalltalk.withContext(function($ctx1) {
  11867. var $1;
  11868. $1=_st(self["@values"])._copy();
  11869. return $1;
  11870. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})},
  11871. args: [],
  11872. source: "values\x0a\x09^values copy",
  11873. messageSends: ["copy"],
  11874. referencedClasses: []
  11875. }),
  11876. smalltalk.Dictionary);
  11877. smalltalk.addMethod(
  11878. smalltalk.method({
  11879. selector: "valuesDo:",
  11880. category: 'enumerating',
  11881. fn: function (aBlock){
  11882. var self=this;
  11883. return smalltalk.withContext(function($ctx1) {
  11884. var $1;
  11885. $1=_st(self["@values"])._do_(aBlock);
  11886. return $1;
  11887. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  11888. args: ["aBlock"],
  11889. source: "valuesDo: aBlock\x0a\x09^values do: aBlock",
  11890. messageSends: ["do:"],
  11891. referencedClasses: []
  11892. }),
  11893. smalltalk.Dictionary);
  11894. smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  11895. smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  11896. smalltalk.addMethod(
  11897. smalltalk.method({
  11898. selector: "=",
  11899. category: 'comparing',
  11900. fn: function (aCollection){
  11901. var self=this;
  11902. return smalltalk.withContext(function($ctx1) {
  11903. var $1,$2;
  11904. var $early={};
  11905. try {
  11906. $1=_st(_st(self._class()).__eq(_st(aCollection)._class()))._and_((function(){
  11907. return smalltalk.withContext(function($ctx2) {
  11908. return _st(self._size()).__eq(_st(aCollection)._size());
  11909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  11910. if(! smalltalk.assert($1)){
  11911. return false;
  11912. };
  11913. self._withIndexDo_((function(each,i){
  11914. return smalltalk.withContext(function($ctx2) {
  11915. $2=_st(_st(aCollection)._at_(i)).__eq(each);
  11916. if(! smalltalk.assert($2)){
  11917. throw $early=[false];
  11918. };
  11919. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  11920. return true;
  11921. }
  11922. catch(e) {if(e===$early)return e[0]; throw e}
  11923. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.SequenceableCollection)})},
  11924. args: ["aCollection"],
  11925. 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",
  11926. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  11927. referencedClasses: []
  11928. }),
  11929. smalltalk.SequenceableCollection);
  11930. smalltalk.addMethod(
  11931. smalltalk.method({
  11932. selector: "addLast:",
  11933. category: 'adding',
  11934. fn: function (anObject){
  11935. var self=this;
  11936. return smalltalk.withContext(function($ctx1) {
  11937. self._add_(anObject);
  11938. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  11939. args: ["anObject"],
  11940. source: "addLast: anObject\x0a\x09self add: anObject",
  11941. messageSends: ["add:"],
  11942. referencedClasses: []
  11943. }),
  11944. smalltalk.SequenceableCollection);
  11945. smalltalk.addMethod(
  11946. smalltalk.method({
  11947. selector: "allButFirst",
  11948. category: 'accessing',
  11949. fn: function (){
  11950. var self=this;
  11951. return smalltalk.withContext(function($ctx1) {
  11952. var $1;
  11953. $1=self._copyFrom_to_((2),self._size());
  11954. return $1;
  11955. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})},
  11956. args: [],
  11957. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  11958. messageSends: ["copyFrom:to:", "size"],
  11959. referencedClasses: []
  11960. }),
  11961. smalltalk.SequenceableCollection);
  11962. smalltalk.addMethod(
  11963. smalltalk.method({
  11964. selector: "allButLast",
  11965. category: 'accessing',
  11966. fn: function (){
  11967. var self=this;
  11968. return smalltalk.withContext(function($ctx1) {
  11969. var $1;
  11970. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  11971. return $1;
  11972. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})},
  11973. args: [],
  11974. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  11975. messageSends: ["copyFrom:to:", "-", "size"],
  11976. referencedClasses: []
  11977. }),
  11978. smalltalk.SequenceableCollection);
  11979. smalltalk.addMethod(
  11980. smalltalk.method({
  11981. selector: "atRandom",
  11982. category: 'accessing',
  11983. fn: function (){
  11984. var self=this;
  11985. return smalltalk.withContext(function($ctx1) {
  11986. var $1;
  11987. $1=self._at_(_st(self._size())._atRandom());
  11988. return $1;
  11989. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})},
  11990. args: [],
  11991. source: "atRandom\x0a\x09^ self at: self size atRandom",
  11992. messageSends: ["at:", "atRandom", "size"],
  11993. referencedClasses: []
  11994. }),
  11995. smalltalk.SequenceableCollection);
  11996. smalltalk.addMethod(
  11997. smalltalk.method({
  11998. selector: "copyFrom:to:",
  11999. category: 'copying',
  12000. fn: function (anIndex,anotherIndex){
  12001. var self=this;
  12002. var range,newCollection;
  12003. return smalltalk.withContext(function($ctx1) {
  12004. var $1;
  12005. range=_st(anIndex)._to_(anotherIndex);
  12006. newCollection=_st(self._class())._new_(_st(range)._size());
  12007. _st(range)._withIndexDo_((function(each,i){
  12008. return smalltalk.withContext(function($ctx2) {
  12009. return _st(newCollection)._at_put_(i,self._at_(each));
  12010. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  12011. $1=newCollection;
  12012. return $1;
  12013. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12014. args: ["anIndex", "anotherIndex"],
  12015. 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",
  12016. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  12017. referencedClasses: []
  12018. }),
  12019. smalltalk.SequenceableCollection);
  12020. smalltalk.addMethod(
  12021. smalltalk.method({
  12022. selector: "deepCopy",
  12023. category: 'copying',
  12024. fn: function (){
  12025. var self=this;
  12026. var newCollection;
  12027. return smalltalk.withContext(function($ctx1) {
  12028. var $1;
  12029. newCollection=_st(self._class())._new_(self._size());
  12030. self._withIndexDo_((function(each,index){
  12031. return smalltalk.withContext(function($ctx2) {
  12032. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  12033. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  12034. $1=newCollection;
  12035. return $1;
  12036. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12037. args: [],
  12038. 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",
  12039. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  12040. referencedClasses: []
  12041. }),
  12042. smalltalk.SequenceableCollection);
  12043. smalltalk.addMethod(
  12044. smalltalk.method({
  12045. selector: "detect:ifNone:",
  12046. category: 'enumerating',
  12047. fn: function (aBlock,anotherBlock){
  12048. var self=this;
  12049. return smalltalk.withContext(function($ctx1) {
  12050. for(var i = 0; i < self.length; i++)
  12051. if(aBlock._value_(self[i]))
  12052. return self[i];
  12053. return anotherBlock._value();
  12054. ;
  12055. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})},
  12056. args: ["aBlock", "anotherBlock"],
  12057. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\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>",
  12058. messageSends: [],
  12059. referencedClasses: []
  12060. }),
  12061. smalltalk.SequenceableCollection);
  12062. smalltalk.addMethod(
  12063. smalltalk.method({
  12064. selector: "do:",
  12065. category: 'enumerating',
  12066. fn: function (aBlock){
  12067. var self=this;
  12068. return smalltalk.withContext(function($ctx1) {
  12069. for(var i=0;i<self.length;i++){aBlock._value_(self[i]);};
  12070. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12071. args: ["aBlock"],
  12072. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self[i]);}>",
  12073. messageSends: [],
  12074. referencedClasses: []
  12075. }),
  12076. smalltalk.SequenceableCollection);
  12077. smalltalk.addMethod(
  12078. smalltalk.method({
  12079. selector: "do:displayingProgress:",
  12080. category: 'enumerating',
  12081. fn: function (aBlock,aString){
  12082. var self=this;
  12083. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  12084. return smalltalk.withContext(function($ctx1) {
  12085. _st(_st($ProgressHandler())._current())._do_on_displaying_(aBlock,self,aString);
  12086. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},smalltalk.SequenceableCollection)})},
  12087. args: ["aBlock", "aString"],
  12088. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler current\x0a\x09\x09do: aBlock on: self displaying: aString",
  12089. messageSends: ["do:on:displaying:", "current"],
  12090. referencedClasses: ["ProgressHandler"]
  12091. }),
  12092. smalltalk.SequenceableCollection);
  12093. smalltalk.addMethod(
  12094. smalltalk.method({
  12095. selector: "first",
  12096. category: 'accessing',
  12097. fn: function (){
  12098. var self=this;
  12099. return smalltalk.withContext(function($ctx1) {
  12100. var $1;
  12101. $1=self._at_((1));
  12102. return $1;
  12103. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})},
  12104. args: [],
  12105. source: "first\x0a\x09^self at: 1",
  12106. messageSends: ["at:"],
  12107. referencedClasses: []
  12108. }),
  12109. smalltalk.SequenceableCollection);
  12110. smalltalk.addMethod(
  12111. smalltalk.method({
  12112. selector: "first:",
  12113. category: 'accessing',
  12114. fn: function (n){
  12115. var self=this;
  12116. return smalltalk.withContext(function($ctx1) {
  12117. var $1;
  12118. $1=self._copyFrom_to_((1),n);
  12119. return $1;
  12120. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})},
  12121. args: ["n"],
  12122. source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n",
  12123. messageSends: ["copyFrom:to:"],
  12124. referencedClasses: []
  12125. }),
  12126. smalltalk.SequenceableCollection);
  12127. smalltalk.addMethod(
  12128. smalltalk.method({
  12129. selector: "fourth",
  12130. category: 'accessing',
  12131. fn: function (){
  12132. var self=this;
  12133. return smalltalk.withContext(function($ctx1) {
  12134. var $1;
  12135. $1=self._at_((4));
  12136. return $1;
  12137. }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})},
  12138. args: [],
  12139. source: "fourth\x0a\x09^self at: 4",
  12140. messageSends: ["at:"],
  12141. referencedClasses: []
  12142. }),
  12143. smalltalk.SequenceableCollection);
  12144. smalltalk.addMethod(
  12145. smalltalk.method({
  12146. selector: "includes:",
  12147. category: 'testing',
  12148. fn: function (anObject){
  12149. var self=this;
  12150. return smalltalk.withContext(function($ctx1) {
  12151. var $1;
  12152. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  12153. return smalltalk.withContext(function($ctx2) {
  12154. return nil;
  12155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  12156. return $1;
  12157. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  12158. args: ["anObject"],
  12159. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  12160. messageSends: ["notNil", "indexOf:ifAbsent:"],
  12161. referencedClasses: []
  12162. }),
  12163. smalltalk.SequenceableCollection);
  12164. smalltalk.addMethod(
  12165. smalltalk.method({
  12166. selector: "indexOf:ifAbsent:",
  12167. category: 'accessing',
  12168. fn: function (anObject,aBlock){
  12169. var self=this;
  12170. return smalltalk.withContext(function($ctx1) {
  12171. for(var i=0;i<self.length;i++) {
  12172. if(self[i].__eq(anObject)) {return i+1}
  12173. };
  12174. return aBlock._value();
  12175. ;
  12176. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12177. args: ["anObject", "aBlock"],
  12178. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  12179. messageSends: [],
  12180. referencedClasses: []
  12181. }),
  12182. smalltalk.SequenceableCollection);
  12183. smalltalk.addMethod(
  12184. smalltalk.method({
  12185. selector: "indexOf:startingAt:",
  12186. category: 'accessing',
  12187. fn: function (anObject,start){
  12188. var self=this;
  12189. return smalltalk.withContext(function($ctx1) {
  12190. var $1;
  12191. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  12192. return smalltalk.withContext(function($ctx2) {
  12193. return (0);
  12194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12195. return $1;
  12196. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.SequenceableCollection)})},
  12197. args: ["anObject", "start"],
  12198. 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]",
  12199. messageSends: ["indexOf:startingAt:ifAbsent:"],
  12200. referencedClasses: []
  12201. }),
  12202. smalltalk.SequenceableCollection);
  12203. smalltalk.addMethod(
  12204. smalltalk.method({
  12205. selector: "indexOf:startingAt:ifAbsent:",
  12206. category: 'accessing',
  12207. fn: function (anObject,start,aBlock){
  12208. var self=this;
  12209. return smalltalk.withContext(function($ctx1) {
  12210. for(var i=start-1;i<self.length;i++){
  12211. if(self[i].__eq(anObject)) {return i+1}
  12212. }
  12213. return aBlock._value();
  12214. ;
  12215. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12216. args: ["anObject", "start", "aBlock"],
  12217. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  12218. messageSends: [],
  12219. referencedClasses: []
  12220. }),
  12221. smalltalk.SequenceableCollection);
  12222. smalltalk.addMethod(
  12223. smalltalk.method({
  12224. selector: "last",
  12225. category: 'accessing',
  12226. fn: function (){
  12227. var self=this;
  12228. return smalltalk.withContext(function($ctx1) {
  12229. var $1;
  12230. $1=self._at_(self._size());
  12231. return $1;
  12232. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})},
  12233. args: [],
  12234. source: "last\x0a\x09^self at: self size",
  12235. messageSends: ["at:", "size"],
  12236. referencedClasses: []
  12237. }),
  12238. smalltalk.SequenceableCollection);
  12239. smalltalk.addMethod(
  12240. smalltalk.method({
  12241. selector: "newStream",
  12242. category: 'streaming',
  12243. fn: function (){
  12244. var self=this;
  12245. return smalltalk.withContext(function($ctx1) {
  12246. var $1;
  12247. $1=_st(self._streamClass())._on_(self);
  12248. return $1;
  12249. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
  12250. args: [],
  12251. source: "newStream\x0a\x09^self streamClass on: self",
  12252. messageSends: ["on:", "streamClass"],
  12253. referencedClasses: []
  12254. }),
  12255. smalltalk.SequenceableCollection);
  12256. smalltalk.addMethod(
  12257. smalltalk.method({
  12258. selector: "readStream",
  12259. category: 'streaming',
  12260. fn: function (){
  12261. var self=this;
  12262. return smalltalk.withContext(function($ctx1) {
  12263. var $1;
  12264. $1=self._stream();
  12265. return $1;
  12266. }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
  12267. args: [],
  12268. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  12269. messageSends: ["stream"],
  12270. referencedClasses: []
  12271. }),
  12272. smalltalk.SequenceableCollection);
  12273. smalltalk.addMethod(
  12274. smalltalk.method({
  12275. selector: "removeLast",
  12276. category: 'adding',
  12277. fn: function (){
  12278. var self=this;
  12279. return smalltalk.withContext(function($ctx1) {
  12280. self._remove_(self._last());
  12281. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})},
  12282. args: [],
  12283. source: "removeLast\x0a\x09self remove: self last",
  12284. messageSends: ["remove:", "last"],
  12285. referencedClasses: []
  12286. }),
  12287. smalltalk.SequenceableCollection);
  12288. smalltalk.addMethod(
  12289. smalltalk.method({
  12290. selector: "reversed",
  12291. category: 'converting',
  12292. fn: function (){
  12293. var self=this;
  12294. return smalltalk.withContext(function($ctx1) {
  12295. self._subclassResponsibility();
  12296. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})},
  12297. args: [],
  12298. source: "reversed\x0a\x09self subclassResponsibility",
  12299. messageSends: ["subclassResponsibility"],
  12300. referencedClasses: []
  12301. }),
  12302. smalltalk.SequenceableCollection);
  12303. smalltalk.addMethod(
  12304. smalltalk.method({
  12305. selector: "second",
  12306. category: 'accessing',
  12307. fn: function (){
  12308. var self=this;
  12309. return smalltalk.withContext(function($ctx1) {
  12310. var $1;
  12311. $1=self._at_((2));
  12312. return $1;
  12313. }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})},
  12314. args: [],
  12315. source: "second\x0a\x09^self at: 2",
  12316. messageSends: ["at:"],
  12317. referencedClasses: []
  12318. }),
  12319. smalltalk.SequenceableCollection);
  12320. smalltalk.addMethod(
  12321. smalltalk.method({
  12322. selector: "shallowCopy",
  12323. category: 'copying',
  12324. fn: function (){
  12325. var self=this;
  12326. var newCollection;
  12327. return smalltalk.withContext(function($ctx1) {
  12328. var $1;
  12329. newCollection=_st(self._class())._new_(self._size());
  12330. self._withIndexDo_((function(each,index){
  12331. return smalltalk.withContext(function($ctx2) {
  12332. return _st(newCollection)._at_put_(index,each);
  12333. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  12334. $1=newCollection;
  12335. return $1;
  12336. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  12337. args: [],
  12338. 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",
  12339. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  12340. referencedClasses: []
  12341. }),
  12342. smalltalk.SequenceableCollection);
  12343. smalltalk.addMethod(
  12344. smalltalk.method({
  12345. selector: "stream",
  12346. category: 'streaming',
  12347. fn: function (){
  12348. var self=this;
  12349. return smalltalk.withContext(function($ctx1) {
  12350. var $1;
  12351. $1=self._newStream();
  12352. return $1;
  12353. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
  12354. args: [],
  12355. source: "stream\x0a\x09^self newStream",
  12356. messageSends: ["newStream"],
  12357. referencedClasses: []
  12358. }),
  12359. smalltalk.SequenceableCollection);
  12360. smalltalk.addMethod(
  12361. smalltalk.method({
  12362. selector: "streamClass",
  12363. category: 'streaming',
  12364. fn: function (){
  12365. var self=this;
  12366. return smalltalk.withContext(function($ctx1) {
  12367. var $1;
  12368. $1=_st(self._class())._streamClass();
  12369. return $1;
  12370. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
  12371. args: [],
  12372. source: "streamClass\x0a\x09^self class streamClass",
  12373. messageSends: ["streamClass", "class"],
  12374. referencedClasses: []
  12375. }),
  12376. smalltalk.SequenceableCollection);
  12377. smalltalk.addMethod(
  12378. smalltalk.method({
  12379. selector: "third",
  12380. category: 'accessing',
  12381. fn: function (){
  12382. var self=this;
  12383. return smalltalk.withContext(function($ctx1) {
  12384. var $1;
  12385. $1=self._at_((3));
  12386. return $1;
  12387. }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})},
  12388. args: [],
  12389. source: "third\x0a\x09^self at: 3",
  12390. messageSends: ["at:"],
  12391. referencedClasses: []
  12392. }),
  12393. smalltalk.SequenceableCollection);
  12394. smalltalk.addMethod(
  12395. smalltalk.method({
  12396. selector: "with:do:",
  12397. category: 'enumerating',
  12398. fn: function (anotherCollection,aBlock){
  12399. var self=this;
  12400. return smalltalk.withContext(function($ctx1) {
  12401. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);};
  12402. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12403. args: ["anotherCollection", "aBlock"],
  12404. source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);}>",
  12405. messageSends: [],
  12406. referencedClasses: []
  12407. }),
  12408. smalltalk.SequenceableCollection);
  12409. smalltalk.addMethod(
  12410. smalltalk.method({
  12411. selector: "withIndexDo:",
  12412. category: 'enumerating',
  12413. fn: function (aBlock){
  12414. var self=this;
  12415. return smalltalk.withContext(function($ctx1) {
  12416. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);};
  12417. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  12418. args: ["aBlock"],
  12419. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);}>",
  12420. messageSends: [],
  12421. referencedClasses: []
  12422. }),
  12423. smalltalk.SequenceableCollection);
  12424. smalltalk.addMethod(
  12425. smalltalk.method({
  12426. selector: "writeStream",
  12427. category: 'streaming',
  12428. fn: function (){
  12429. var self=this;
  12430. return smalltalk.withContext(function($ctx1) {
  12431. var $1;
  12432. $1=self._stream();
  12433. return $1;
  12434. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
  12435. args: [],
  12436. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  12437. messageSends: ["stream"],
  12438. referencedClasses: []
  12439. }),
  12440. smalltalk.SequenceableCollection);
  12441. smalltalk.addMethod(
  12442. smalltalk.method({
  12443. selector: "streamClass",
  12444. category: 'accessing',
  12445. fn: function (){
  12446. var self=this;
  12447. function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)}
  12448. return smalltalk.withContext(function($ctx1) {
  12449. var $1;
  12450. $1=$Stream();
  12451. return $1;
  12452. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
  12453. args: [],
  12454. source: "streamClass\x0a\x09\x09^Stream",
  12455. messageSends: [],
  12456. referencedClasses: ["Stream"]
  12457. }),
  12458. smalltalk.SequenceableCollection.klass);
  12459. smalltalk.addMethod(
  12460. smalltalk.method({
  12461. selector: "streamContents:",
  12462. category: 'streaming',
  12463. fn: function (aBlock){
  12464. var self=this;
  12465. var stream;
  12466. return smalltalk.withContext(function($ctx1) {
  12467. var $1;
  12468. stream=_st(self._streamClass())._on_(self._new());
  12469. _st(aBlock)._value_(stream);
  12470. $1=_st(stream)._contents();
  12471. return $1;
  12472. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
  12473. args: ["aBlock"],
  12474. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  12475. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  12476. referencedClasses: []
  12477. }),
  12478. smalltalk.SequenceableCollection.klass);
  12479. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  12480. smalltalk.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`.";
  12481. smalltalk.addMethod(
  12482. smalltalk.method({
  12483. selector: "add:",
  12484. category: 'adding/removing',
  12485. fn: function (anObject){
  12486. var self=this;
  12487. return smalltalk.withContext(function($ctx1) {
  12488. self.push(anObject); return anObject;;
  12489. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})},
  12490. args: ["anObject"],
  12491. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  12492. messageSends: [],
  12493. referencedClasses: []
  12494. }),
  12495. smalltalk.Array);
  12496. smalltalk.addMethod(
  12497. smalltalk.method({
  12498. selector: "asJavascript",
  12499. category: 'converting',
  12500. fn: function (){
  12501. var self=this;
  12502. return smalltalk.withContext(function($ctx1) {
  12503. var $1;
  12504. $1=_st("[".__comma(_st(self._collect_((function(each){
  12505. return smalltalk.withContext(function($ctx2) {
  12506. return _st(each)._asJavascript();
  12507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  12508. return $1;
  12509. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})},
  12510. args: [],
  12511. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  12512. messageSends: [",", "join:", "collect:", "asJavascript"],
  12513. referencedClasses: []
  12514. }),
  12515. smalltalk.Array);
  12516. smalltalk.addMethod(
  12517. smalltalk.method({
  12518. selector: "at:ifAbsent:",
  12519. category: 'accessing',
  12520. fn: function (anIndex,aBlock){
  12521. var self=this;
  12522. return smalltalk.withContext(function($ctx1) {
  12523. if((anIndex < 1) || (self.length < anIndex)) {return aBlock._value()};
  12524. return self[anIndex - 1];
  12525. ;
  12526. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})},
  12527. args: ["anIndex", "aBlock"],
  12528. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock._value()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  12529. messageSends: [],
  12530. referencedClasses: []
  12531. }),
  12532. smalltalk.Array);
  12533. smalltalk.addMethod(
  12534. smalltalk.method({
  12535. selector: "at:ifPresent:ifAbsent:",
  12536. category: 'accessing',
  12537. fn: function (anIndex,aBlock,anotherBlock){
  12538. var self=this;
  12539. return smalltalk.withContext(function($ctx1) {
  12540. return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);;
  12541. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Array)})},
  12542. args: ["anIndex", "aBlock", "anotherBlock"],
  12543. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);>",
  12544. messageSends: [],
  12545. referencedClasses: []
  12546. }),
  12547. smalltalk.Array);
  12548. smalltalk.addMethod(
  12549. smalltalk.method({
  12550. selector: "at:put:",
  12551. category: 'accessing',
  12552. fn: function (anIndex,anObject){
  12553. var self=this;
  12554. return smalltalk.withContext(function($ctx1) {
  12555. return self[anIndex - 1] = anObject;
  12556. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})},
  12557. args: ["anIndex", "anObject"],
  12558. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  12559. messageSends: [],
  12560. referencedClasses: []
  12561. }),
  12562. smalltalk.Array);
  12563. smalltalk.addMethod(
  12564. smalltalk.method({
  12565. selector: "join:",
  12566. category: 'enumerating',
  12567. fn: function (aString){
  12568. var self=this;
  12569. return smalltalk.withContext(function($ctx1) {
  12570. return self.join(aString);
  12571. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})},
  12572. args: ["aString"],
  12573. source: "join: aString\x0a\x09<return self.join(aString)>",
  12574. messageSends: [],
  12575. referencedClasses: []
  12576. }),
  12577. smalltalk.Array);
  12578. smalltalk.addMethod(
  12579. smalltalk.method({
  12580. selector: "printOn:",
  12581. category: 'printing',
  12582. fn: function (aStream){
  12583. var self=this;
  12584. return smalltalk.withContext(function($ctx1) {
  12585. smalltalk.SequenceableCollection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  12586. _st(aStream)._nextPutAll_(" (");
  12587. self._do_separatedBy_((function(each){
  12588. return smalltalk.withContext(function($ctx2) {
  12589. return _st(each)._printOn_(aStream);
  12590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  12591. return smalltalk.withContext(function($ctx2) {
  12592. return _st(aStream)._nextPutAll_(" ");
  12593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  12594. _st(aStream)._nextPutAll_(")");
  12595. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Array)})},
  12596. args: ["aStream"],
  12597. 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: ')'",
  12598. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  12599. referencedClasses: []
  12600. }),
  12601. smalltalk.Array);
  12602. smalltalk.addMethod(
  12603. smalltalk.method({
  12604. selector: "remove:ifAbsent:",
  12605. category: 'adding/removing',
  12606. fn: function (anObject,aBlock){
  12607. var self=this;
  12608. return smalltalk.withContext(function($ctx1) {
  12609. for(var i=0;i<self.length;i++) {
  12610. if(self[i] == anObject) {
  12611. self.splice(i,1);
  12612. return self;
  12613. }
  12614. };
  12615. aBlock._value();
  12616. ;
  12617. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Array)})},
  12618. args: ["anObject", "aBlock"],
  12619. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09aBlock._value();\x0a\x09>",
  12620. messageSends: [],
  12621. referencedClasses: []
  12622. }),
  12623. smalltalk.Array);
  12624. smalltalk.addMethod(
  12625. smalltalk.method({
  12626. selector: "removeFrom:to:",
  12627. category: 'adding/removing',
  12628. fn: function (aNumber,anotherNumber){
  12629. var self=this;
  12630. return smalltalk.withContext(function($ctx1) {
  12631. self.splice(aNumber - 1,anotherNumber - 1);
  12632. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})},
  12633. args: ["aNumber", "anotherNumber"],
  12634. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  12635. messageSends: [],
  12636. referencedClasses: []
  12637. }),
  12638. smalltalk.Array);
  12639. smalltalk.addMethod(
  12640. smalltalk.method({
  12641. selector: "reversed",
  12642. category: 'converting',
  12643. fn: function (){
  12644. var self=this;
  12645. return smalltalk.withContext(function($ctx1) {
  12646. return self._copy().reverse();
  12647. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})},
  12648. args: [],
  12649. source: "reversed\x0a\x09<return self._copy().reverse()>",
  12650. messageSends: [],
  12651. referencedClasses: []
  12652. }),
  12653. smalltalk.Array);
  12654. smalltalk.addMethod(
  12655. smalltalk.method({
  12656. selector: "size",
  12657. category: 'accessing',
  12658. fn: function (){
  12659. var self=this;
  12660. return smalltalk.withContext(function($ctx1) {
  12661. return self.length;
  12662. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})},
  12663. args: [],
  12664. source: "size\x0a\x09<return self.length>",
  12665. messageSends: [],
  12666. referencedClasses: []
  12667. }),
  12668. smalltalk.Array);
  12669. smalltalk.addMethod(
  12670. smalltalk.method({
  12671. selector: "sort",
  12672. category: 'enumerating',
  12673. fn: function (){
  12674. var self=this;
  12675. return smalltalk.withContext(function($ctx1) {
  12676. var $1;
  12677. $1=self._basicPerform_("sort");
  12678. return $1;
  12679. }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})},
  12680. args: [],
  12681. source: "sort\x0a\x09^self basicPerform: 'sort'",
  12682. messageSends: ["basicPerform:"],
  12683. referencedClasses: []
  12684. }),
  12685. smalltalk.Array);
  12686. smalltalk.addMethod(
  12687. smalltalk.method({
  12688. selector: "sort:",
  12689. category: 'enumerating',
  12690. fn: function (aBlock){
  12691. var self=this;
  12692. return smalltalk.withContext(function($ctx1) {
  12693. return self.sort(function(a, b) {
  12694. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  12695. })
  12696. ;
  12697. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})},
  12698. args: ["aBlock"],
  12699. 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>",
  12700. messageSends: [],
  12701. referencedClasses: []
  12702. }),
  12703. smalltalk.Array);
  12704. smalltalk.addMethod(
  12705. smalltalk.method({
  12706. selector: "sorted",
  12707. category: 'enumerating',
  12708. fn: function (){
  12709. var self=this;
  12710. return smalltalk.withContext(function($ctx1) {
  12711. var $1;
  12712. $1=_st(self._copy())._sort();
  12713. return $1;
  12714. }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})},
  12715. args: [],
  12716. source: "sorted\x0a\x09^self copy sort",
  12717. messageSends: ["sort", "copy"],
  12718. referencedClasses: []
  12719. }),
  12720. smalltalk.Array);
  12721. smalltalk.addMethod(
  12722. smalltalk.method({
  12723. selector: "sorted:",
  12724. category: 'enumerating',
  12725. fn: function (aBlock){
  12726. var self=this;
  12727. return smalltalk.withContext(function($ctx1) {
  12728. var $1;
  12729. $1=_st(self._copy())._sort_(aBlock);
  12730. return $1;
  12731. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})},
  12732. args: ["aBlock"],
  12733. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  12734. messageSends: ["sort:", "copy"],
  12735. referencedClasses: []
  12736. }),
  12737. smalltalk.Array);
  12738. smalltalk.addMethod(
  12739. smalltalk.method({
  12740. selector: "new:",
  12741. category: 'instance creation',
  12742. fn: function (anInteger){
  12743. var self=this;
  12744. return smalltalk.withContext(function($ctx1) {
  12745. return new Array(anInteger);
  12746. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})},
  12747. args: ["anInteger"],
  12748. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  12749. messageSends: [],
  12750. referencedClasses: []
  12751. }),
  12752. smalltalk.Array.klass);
  12753. smalltalk.addMethod(
  12754. smalltalk.method({
  12755. selector: "with:",
  12756. category: 'instance creation',
  12757. fn: function (anObject){
  12758. var self=this;
  12759. return smalltalk.withContext(function($ctx1) {
  12760. var $2,$3,$1;
  12761. $2=self._new_((1));
  12762. _st($2)._at_put_((1),anObject);
  12763. $3=_st($2)._yourself();
  12764. $1=$3;
  12765. return $1;
  12766. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})},
  12767. args: ["anObject"],
  12768. source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  12769. messageSends: ["at:put:", "new:", "yourself"],
  12770. referencedClasses: []
  12771. }),
  12772. smalltalk.Array.klass);
  12773. smalltalk.addMethod(
  12774. smalltalk.method({
  12775. selector: "with:with:",
  12776. category: 'instance creation',
  12777. fn: function (anObject,anObject2){
  12778. var self=this;
  12779. return smalltalk.withContext(function($ctx1) {
  12780. var $2,$3,$1;
  12781. $2=self._new_((2));
  12782. _st($2)._at_put_((1),anObject);
  12783. _st($2)._at_put_((2),anObject2);
  12784. $3=_st($2)._yourself();
  12785. $1=$3;
  12786. return $1;
  12787. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.Array.klass)})},
  12788. args: ["anObject", "anObject2"],
  12789. 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",
  12790. messageSends: ["at:put:", "new:", "yourself"],
  12791. referencedClasses: []
  12792. }),
  12793. smalltalk.Array.klass);
  12794. smalltalk.addMethod(
  12795. smalltalk.method({
  12796. selector: "with:with:with:",
  12797. category: 'instance creation',
  12798. fn: function (anObject,anObject2,anObject3){
  12799. var self=this;
  12800. return smalltalk.withContext(function($ctx1) {
  12801. var $2,$3,$1;
  12802. $2=self._new_((3));
  12803. _st($2)._at_put_((1),anObject);
  12804. _st($2)._at_put_((2),anObject2);
  12805. _st($2)._at_put_((3),anObject3);
  12806. $3=_st($2)._yourself();
  12807. $1=$3;
  12808. return $1;
  12809. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.Array.klass)})},
  12810. args: ["anObject", "anObject2", "anObject3"],
  12811. 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",
  12812. messageSends: ["at:put:", "new:", "yourself"],
  12813. referencedClasses: []
  12814. }),
  12815. smalltalk.Array.klass);
  12816. smalltalk.addMethod(
  12817. smalltalk.method({
  12818. selector: "withAll:",
  12819. category: 'instance creation',
  12820. fn: function (aCollection){
  12821. var self=this;
  12822. var instance,index;
  12823. return smalltalk.withContext(function($ctx1) {
  12824. var $1;
  12825. index=(1);
  12826. instance=self._new_(_st(aCollection)._size());
  12827. _st(aCollection)._do_((function(each){
  12828. return smalltalk.withContext(function($ctx2) {
  12829. _st(instance)._at_put_(index,each);
  12830. index=_st(index).__plus((1));
  12831. return index;
  12832. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  12833. $1=instance;
  12834. return $1;
  12835. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.Array.klass)})},
  12836. args: ["aCollection"],
  12837. 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",
  12838. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  12839. referencedClasses: []
  12840. }),
  12841. smalltalk.Array.klass);
  12842. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  12843. smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  12844. smalltalk.addMethod(
  12845. smalltalk.method({
  12846. selector: ",",
  12847. category: 'copying',
  12848. fn: function (aString){
  12849. var self=this;
  12850. return smalltalk.withContext(function($ctx1) {
  12851. var $1;
  12852. $1=_st(self._asString()).__comma(_st(aString)._asString());
  12853. return $1;
  12854. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})},
  12855. args: ["aString"],
  12856. source: ", aString\x0a\x09^self asString, aString asString",
  12857. messageSends: [",", "asString"],
  12858. referencedClasses: []
  12859. }),
  12860. smalltalk.CharacterArray);
  12861. smalltalk.addMethod(
  12862. smalltalk.method({
  12863. selector: "add:",
  12864. category: 'adding',
  12865. fn: function (anObject){
  12866. var self=this;
  12867. return smalltalk.withContext(function($ctx1) {
  12868. self._errorReadOnly();
  12869. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})},
  12870. args: ["anObject"],
  12871. source: "add: anObject\x0a\x09self errorReadOnly",
  12872. messageSends: ["errorReadOnly"],
  12873. referencedClasses: []
  12874. }),
  12875. smalltalk.CharacterArray);
  12876. smalltalk.addMethod(
  12877. smalltalk.method({
  12878. selector: "asLowercase",
  12879. category: 'converting',
  12880. fn: function (){
  12881. var self=this;
  12882. return smalltalk.withContext(function($ctx1) {
  12883. var $1;
  12884. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  12885. return $1;
  12886. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})},
  12887. args: [],
  12888. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  12889. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  12890. referencedClasses: []
  12891. }),
  12892. smalltalk.CharacterArray);
  12893. smalltalk.addMethod(
  12894. smalltalk.method({
  12895. selector: "asNumber",
  12896. category: 'converting',
  12897. fn: function (){
  12898. var self=this;
  12899. return smalltalk.withContext(function($ctx1) {
  12900. var $1;
  12901. $1=_st(self._asString())._asNumber();
  12902. return $1;
  12903. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})},
  12904. args: [],
  12905. source: "asNumber\x0a\x09^self asString asNumber",
  12906. messageSends: ["asNumber", "asString"],
  12907. referencedClasses: []
  12908. }),
  12909. smalltalk.CharacterArray);
  12910. smalltalk.addMethod(
  12911. smalltalk.method({
  12912. selector: "asString",
  12913. category: 'converting',
  12914. fn: function (){
  12915. var self=this;
  12916. return smalltalk.withContext(function($ctx1) {
  12917. var $1;
  12918. $1=self._subclassResponsibility();
  12919. return $1;
  12920. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})},
  12921. args: [],
  12922. source: "asString\x0a\x09^self subclassResponsibility",
  12923. messageSends: ["subclassResponsibility"],
  12924. referencedClasses: []
  12925. }),
  12926. smalltalk.CharacterArray);
  12927. smalltalk.addMethod(
  12928. smalltalk.method({
  12929. selector: "asSymbol",
  12930. category: 'converting',
  12931. fn: function (){
  12932. var self=this;
  12933. return smalltalk.withContext(function($ctx1) {
  12934. var $1;
  12935. $1=self._asString();
  12936. return $1;
  12937. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})},
  12938. args: [],
  12939. source: "asSymbol\x0a\x09^self asString",
  12940. messageSends: ["asString"],
  12941. referencedClasses: []
  12942. }),
  12943. smalltalk.CharacterArray);
  12944. smalltalk.addMethod(
  12945. smalltalk.method({
  12946. selector: "asUppercase",
  12947. category: 'converting',
  12948. fn: function (){
  12949. var self=this;
  12950. return smalltalk.withContext(function($ctx1) {
  12951. var $1;
  12952. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  12953. return $1;
  12954. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})},
  12955. args: [],
  12956. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  12957. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  12958. referencedClasses: []
  12959. }),
  12960. smalltalk.CharacterArray);
  12961. smalltalk.addMethod(
  12962. smalltalk.method({
  12963. selector: "at:put:",
  12964. category: 'accessing',
  12965. fn: function (anIndex,anObject){
  12966. var self=this;
  12967. return smalltalk.withContext(function($ctx1) {
  12968. self._errorReadOnly();
  12969. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})},
  12970. args: ["anIndex", "anObject"],
  12971. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  12972. messageSends: ["errorReadOnly"],
  12973. referencedClasses: []
  12974. }),
  12975. smalltalk.CharacterArray);
  12976. smalltalk.addMethod(
  12977. smalltalk.method({
  12978. selector: "errorReadOnly",
  12979. category: 'error handling',
  12980. fn: function (){
  12981. var self=this;
  12982. return smalltalk.withContext(function($ctx1) {
  12983. self._error_("Object is read-only");
  12984. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})},
  12985. args: [],
  12986. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  12987. messageSends: ["error:"],
  12988. referencedClasses: []
  12989. }),
  12990. smalltalk.CharacterArray);
  12991. smalltalk.addMethod(
  12992. smalltalk.method({
  12993. selector: "printOn:",
  12994. category: 'printing',
  12995. fn: function (aStream){
  12996. var self=this;
  12997. return smalltalk.withContext(function($ctx1) {
  12998. _st(self._asString())._printOn_(aStream);
  12999. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  13000. args: ["aStream"],
  13001. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  13002. messageSends: ["printOn:", "asString"],
  13003. referencedClasses: []
  13004. }),
  13005. smalltalk.CharacterArray);
  13006. smalltalk.addMethod(
  13007. smalltalk.method({
  13008. selector: "putOn:",
  13009. category: 'streaming',
  13010. fn: function (aStream){
  13011. var self=this;
  13012. return smalltalk.withContext(function($ctx1) {
  13013. _st(aStream)._nextPutString_(self);
  13014. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  13015. args: ["aStream"],
  13016. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  13017. messageSends: ["nextPutString:"],
  13018. referencedClasses: []
  13019. }),
  13020. smalltalk.CharacterArray);
  13021. smalltalk.addMethod(
  13022. smalltalk.method({
  13023. selector: "remove:",
  13024. category: 'adding',
  13025. fn: function (anObject){
  13026. var self=this;
  13027. return smalltalk.withContext(function($ctx1) {
  13028. self._errorReadOnly();
  13029. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})},
  13030. args: ["anObject"],
  13031. source: "remove: anObject\x0a\x09self errorReadOnly",
  13032. messageSends: ["errorReadOnly"],
  13033. referencedClasses: []
  13034. }),
  13035. smalltalk.CharacterArray);
  13036. smalltalk.addMethod(
  13037. smalltalk.method({
  13038. selector: "fromString:",
  13039. category: 'instance creation',
  13040. fn: function (aString){
  13041. var self=this;
  13042. return smalltalk.withContext(function($ctx1) {
  13043. self._subclassResponsibility();
  13044. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})},
  13045. args: ["aString"],
  13046. source: "fromString: aString\x0a\x09self subclassResponsibility",
  13047. messageSends: ["subclassResponsibility"],
  13048. referencedClasses: []
  13049. }),
  13050. smalltalk.CharacterArray.klass);
  13051. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  13052. smalltalk.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 >> #,`";
  13053. smalltalk.addMethod(
  13054. smalltalk.method({
  13055. selector: ",",
  13056. category: 'copying',
  13057. fn: function (aString){
  13058. var self=this;
  13059. return smalltalk.withContext(function($ctx1) {
  13060. return self + aString;
  13061. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})},
  13062. args: ["aString"],
  13063. source: ", aString\x0a\x09<return self + aString>",
  13064. messageSends: [],
  13065. referencedClasses: []
  13066. }),
  13067. smalltalk.String);
  13068. smalltalk.addMethod(
  13069. smalltalk.method({
  13070. selector: "<",
  13071. category: 'comparing',
  13072. fn: function (aString){
  13073. var self=this;
  13074. return smalltalk.withContext(function($ctx1) {
  13075. return String(self) < aString._asString();
  13076. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})},
  13077. args: ["aString"],
  13078. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  13079. messageSends: [],
  13080. referencedClasses: []
  13081. }),
  13082. smalltalk.String);
  13083. smalltalk.addMethod(
  13084. smalltalk.method({
  13085. selector: "<=",
  13086. category: 'comparing',
  13087. fn: function (aString){
  13088. var self=this;
  13089. return smalltalk.withContext(function($ctx1) {
  13090. return String(self) <= aString._asString();
  13091. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})},
  13092. args: ["aString"],
  13093. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  13094. messageSends: [],
  13095. referencedClasses: []
  13096. }),
  13097. smalltalk.String);
  13098. smalltalk.addMethod(
  13099. smalltalk.method({
  13100. selector: "=",
  13101. category: 'comparing',
  13102. fn: function (aString){
  13103. var self=this;
  13104. return smalltalk.withContext(function($ctx1) {
  13105. if(typeof aString === 'undefined') { return false }
  13106. if(!aString._isString || ! aString._isString()) {
  13107. return false;
  13108. }
  13109. return String(self) === String(aString)
  13110. ;
  13111. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})},
  13112. args: ["aString"],
  13113. source: "= aString\x0a\x09<\x0a\x09\x09if(typeof aString === 'undefined') { return false }\x0a\x09\x09if(!aString._isString || ! aString._isString()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return String(self) === String(aString)\x0a\x09>",
  13114. messageSends: [],
  13115. referencedClasses: []
  13116. }),
  13117. smalltalk.String);
  13118. smalltalk.addMethod(
  13119. smalltalk.method({
  13120. selector: "==",
  13121. category: 'comparing',
  13122. fn: function (aString){
  13123. var self=this;
  13124. return smalltalk.withContext(function($ctx1) {
  13125. var $1;
  13126. $1=self.__eq(aString);
  13127. return $1;
  13128. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})},
  13129. args: ["aString"],
  13130. source: "== aString\x0a\x09^self = aString",
  13131. messageSends: ["="],
  13132. referencedClasses: []
  13133. }),
  13134. smalltalk.String);
  13135. smalltalk.addMethod(
  13136. smalltalk.method({
  13137. selector: ">",
  13138. category: 'comparing',
  13139. fn: function (aString){
  13140. var self=this;
  13141. return smalltalk.withContext(function($ctx1) {
  13142. return String(self) > aString._asString();
  13143. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})},
  13144. args: ["aString"],
  13145. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  13146. messageSends: [],
  13147. referencedClasses: []
  13148. }),
  13149. smalltalk.String);
  13150. smalltalk.addMethod(
  13151. smalltalk.method({
  13152. selector: ">=",
  13153. category: 'comparing',
  13154. fn: function (aString){
  13155. var self=this;
  13156. return smalltalk.withContext(function($ctx1) {
  13157. return String(self) >= aString._asString();
  13158. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})},
  13159. args: ["aString"],
  13160. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  13161. messageSends: [],
  13162. referencedClasses: []
  13163. }),
  13164. smalltalk.String);
  13165. smalltalk.addMethod(
  13166. smalltalk.method({
  13167. selector: "asJSON",
  13168. category: 'converting',
  13169. fn: function (){
  13170. var self=this;
  13171. return smalltalk.withContext(function($ctx1) {
  13172. var $1;
  13173. $1=self;
  13174. return $1;
  13175. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})},
  13176. args: [],
  13177. source: "asJSON\x0a\x09^self",
  13178. messageSends: [],
  13179. referencedClasses: []
  13180. }),
  13181. smalltalk.String);
  13182. smalltalk.addMethod(
  13183. smalltalk.method({
  13184. selector: "asJavascript",
  13185. category: 'converting',
  13186. fn: function (){
  13187. var self=this;
  13188. return smalltalk.withContext(function($ctx1) {
  13189. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  13190. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  13191. else
  13192. return "\"" + self + "\"";
  13193. ;
  13194. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.String)})},
  13195. args: [],
  13196. 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>",
  13197. messageSends: [],
  13198. referencedClasses: []
  13199. }),
  13200. smalltalk.String);
  13201. smalltalk.addMethod(
  13202. smalltalk.method({
  13203. selector: "asLowercase",
  13204. category: 'converting',
  13205. fn: function (){
  13206. var self=this;
  13207. return smalltalk.withContext(function($ctx1) {
  13208. return self.toLowerCase();
  13209. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})},
  13210. args: [],
  13211. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  13212. messageSends: [],
  13213. referencedClasses: []
  13214. }),
  13215. smalltalk.String);
  13216. smalltalk.addMethod(
  13217. smalltalk.method({
  13218. selector: "asNumber",
  13219. category: 'converting',
  13220. fn: function (){
  13221. var self=this;
  13222. return smalltalk.withContext(function($ctx1) {
  13223. return Number(self);
  13224. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})},
  13225. args: [],
  13226. source: "asNumber\x0a\x09<return Number(self)>",
  13227. messageSends: [],
  13228. referencedClasses: []
  13229. }),
  13230. smalltalk.String);
  13231. smalltalk.addMethod(
  13232. smalltalk.method({
  13233. selector: "asRegexp",
  13234. category: 'converting',
  13235. fn: function (){
  13236. var self=this;
  13237. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13238. return smalltalk.withContext(function($ctx1) {
  13239. var $1;
  13240. $1=_st($RegularExpression())._fromString_(self);
  13241. return $1;
  13242. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})},
  13243. args: [],
  13244. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  13245. messageSends: ["fromString:"],
  13246. referencedClasses: ["RegularExpression"]
  13247. }),
  13248. smalltalk.String);
  13249. smalltalk.addMethod(
  13250. smalltalk.method({
  13251. selector: "asSelector",
  13252. category: 'converting',
  13253. fn: function (){
  13254. var self=this;
  13255. return smalltalk.withContext(function($ctx1) {
  13256. return smalltalk.selector(self);
  13257. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})},
  13258. args: [],
  13259. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  13260. messageSends: [],
  13261. referencedClasses: []
  13262. }),
  13263. smalltalk.String);
  13264. smalltalk.addMethod(
  13265. smalltalk.method({
  13266. selector: "asString",
  13267. category: 'converting',
  13268. fn: function (){
  13269. var self=this;
  13270. return smalltalk.withContext(function($ctx1) {
  13271. var $1;
  13272. $1=self;
  13273. return $1;
  13274. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})},
  13275. args: [],
  13276. source: "asString\x0a\x09^self",
  13277. messageSends: [],
  13278. referencedClasses: []
  13279. }),
  13280. smalltalk.String);
  13281. smalltalk.addMethod(
  13282. smalltalk.method({
  13283. selector: "asSymbol",
  13284. category: 'converting',
  13285. fn: function (){
  13286. var self=this;
  13287. return smalltalk.withContext(function($ctx1) {
  13288. var $1;
  13289. $1=self;
  13290. return $1;
  13291. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})},
  13292. args: [],
  13293. source: "asSymbol\x0a\x09^ self",
  13294. messageSends: [],
  13295. referencedClasses: []
  13296. }),
  13297. smalltalk.String);
  13298. smalltalk.addMethod(
  13299. smalltalk.method({
  13300. selector: "asUppercase",
  13301. category: 'converting',
  13302. fn: function (){
  13303. var self=this;
  13304. return smalltalk.withContext(function($ctx1) {
  13305. return self.toUpperCase();
  13306. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})},
  13307. args: [],
  13308. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  13309. messageSends: [],
  13310. referencedClasses: []
  13311. }),
  13312. smalltalk.String);
  13313. smalltalk.addMethod(
  13314. smalltalk.method({
  13315. selector: "asciiValue",
  13316. category: 'accessing',
  13317. fn: function (){
  13318. var self=this;
  13319. return smalltalk.withContext(function($ctx1) {
  13320. return self.charCodeAt(0);;
  13321. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})},
  13322. args: [],
  13323. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  13324. messageSends: [],
  13325. referencedClasses: []
  13326. }),
  13327. smalltalk.String);
  13328. smalltalk.addMethod(
  13329. smalltalk.method({
  13330. selector: "at:ifAbsent:",
  13331. category: 'accessing',
  13332. fn: function (anIndex,aBlock){
  13333. var self=this;
  13334. return smalltalk.withContext(function($ctx1) {
  13335. return String(self).charAt(anIndex - 1) || aBlock._value();
  13336. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})},
  13337. args: ["anIndex", "aBlock"],
  13338. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock._value()>",
  13339. messageSends: [],
  13340. referencedClasses: []
  13341. }),
  13342. smalltalk.String);
  13343. smalltalk.addMethod(
  13344. smalltalk.method({
  13345. selector: "at:ifPresent:ifAbsent:",
  13346. category: 'accessing',
  13347. fn: function (anIndex,aBlock,anotherBlock){
  13348. var self=this;
  13349. return smalltalk.withContext(function($ctx1) {
  13350. var result = String(self).charAt(anIndex - 1);
  13351. return result ? aBlock._value_(result) : anotherBlock._value();
  13352. ;
  13353. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.String)})},
  13354. args: ["anIndex", "aBlock", "anotherBlock"],
  13355. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self).charAt(anIndex - 1);\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  13356. messageSends: [],
  13357. referencedClasses: []
  13358. }),
  13359. smalltalk.String);
  13360. smalltalk.addMethod(
  13361. smalltalk.method({
  13362. selector: "charCodeAt:",
  13363. category: 'accessing',
  13364. fn: function (anInteger){
  13365. var self=this;
  13366. return smalltalk.withContext(function($ctx1) {
  13367. return self.charCodeAt(anInteger - 1) ;
  13368. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
  13369. args: ["anInteger"],
  13370. source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
  13371. messageSends: [],
  13372. referencedClasses: []
  13373. }),
  13374. smalltalk.String);
  13375. smalltalk.addMethod(
  13376. smalltalk.method({
  13377. selector: "copyFrom:to:",
  13378. category: 'copying',
  13379. fn: function (anIndex,anotherIndex){
  13380. var self=this;
  13381. return smalltalk.withContext(function($ctx1) {
  13382. return self.substring(anIndex - 1, anotherIndex);
  13383. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})},
  13384. args: ["anIndex", "anotherIndex"],
  13385. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  13386. messageSends: [],
  13387. referencedClasses: []
  13388. }),
  13389. smalltalk.String);
  13390. smalltalk.addMethod(
  13391. smalltalk.method({
  13392. selector: "crlfSanitized",
  13393. category: 'converting',
  13394. fn: function (){
  13395. var self=this;
  13396. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13397. return smalltalk.withContext(function($ctx1) {
  13398. var $1;
  13399. $1=_st(self._lines())._join_(_st($String())._lf());
  13400. return $1;
  13401. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})},
  13402. args: [],
  13403. source: "crlfSanitized\x0a\x09^self lines join: String lf",
  13404. messageSends: ["join:", "lf", "lines"],
  13405. referencedClasses: ["String"]
  13406. }),
  13407. smalltalk.String);
  13408. smalltalk.addMethod(
  13409. smalltalk.method({
  13410. selector: "deepCopy",
  13411. category: 'copying',
  13412. fn: function (){
  13413. var self=this;
  13414. return smalltalk.withContext(function($ctx1) {
  13415. var $1;
  13416. $1=self._shallowCopy();
  13417. return $1;
  13418. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})},
  13419. args: [],
  13420. source: "deepCopy\x0a\x09^self shallowCopy",
  13421. messageSends: ["shallowCopy"],
  13422. referencedClasses: []
  13423. }),
  13424. smalltalk.String);
  13425. smalltalk.addMethod(
  13426. smalltalk.method({
  13427. selector: "do:",
  13428. category: 'enumerating',
  13429. fn: function (aBlock){
  13430. var self=this;
  13431. return smalltalk.withContext(function($ctx1) {
  13432. for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));};
  13433. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.String)})},
  13434. args: ["aBlock"],
  13435. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));}>",
  13436. messageSends: [],
  13437. referencedClasses: []
  13438. }),
  13439. smalltalk.String);
  13440. smalltalk.addMethod(
  13441. smalltalk.method({
  13442. selector: "escaped",
  13443. category: 'accessing',
  13444. fn: function (){
  13445. var self=this;
  13446. return smalltalk.withContext(function($ctx1) {
  13447. return escape(self);
  13448. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})},
  13449. args: [],
  13450. source: "escaped\x0a\x09<return escape(self)>",
  13451. messageSends: [],
  13452. referencedClasses: []
  13453. }),
  13454. smalltalk.String);
  13455. smalltalk.addMethod(
  13456. smalltalk.method({
  13457. selector: "includesSubString:",
  13458. category: 'testing',
  13459. fn: function (subString){
  13460. var self=this;
  13461. return smalltalk.withContext(function($ctx1) {
  13462. return self.indexOf(subString) != -1 ;
  13463. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})},
  13464. args: ["subString"],
  13465. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  13466. messageSends: [],
  13467. referencedClasses: []
  13468. }),
  13469. smalltalk.String);
  13470. smalltalk.addMethod(
  13471. smalltalk.method({
  13472. selector: "isImmutable",
  13473. category: 'testing',
  13474. fn: function (){
  13475. var self=this;
  13476. return smalltalk.withContext(function($ctx1) {
  13477. return true;
  13478. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})},
  13479. args: [],
  13480. source: "isImmutable\x0a\x09^ true",
  13481. messageSends: [],
  13482. referencedClasses: []
  13483. }),
  13484. smalltalk.String);
  13485. smalltalk.addMethod(
  13486. smalltalk.method({
  13487. selector: "isString",
  13488. category: 'testing',
  13489. fn: function (){
  13490. var self=this;
  13491. return smalltalk.withContext(function($ctx1) {
  13492. return true;
  13493. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})},
  13494. args: [],
  13495. source: "isString\x0a\x09^true",
  13496. messageSends: [],
  13497. referencedClasses: []
  13498. }),
  13499. smalltalk.String);
  13500. smalltalk.addMethod(
  13501. smalltalk.method({
  13502. selector: "isVowel",
  13503. category: 'testing',
  13504. fn: function (){
  13505. var self=this;
  13506. return smalltalk.withContext(function($ctx1) {
  13507. var $1;
  13508. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  13509. return smalltalk.withContext(function($ctx2) {
  13510. return "aeiou"._includes_(self._asLowercase());
  13511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13512. return $1;
  13513. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.String)})},
  13514. args: [],
  13515. 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 ]",
  13516. messageSends: ["and:", "includes:", "asLowercase", "=", "size"],
  13517. referencedClasses: []
  13518. }),
  13519. smalltalk.String);
  13520. smalltalk.addMethod(
  13521. smalltalk.method({
  13522. selector: "join:",
  13523. category: 'split join',
  13524. fn: function (aCollection){
  13525. var self=this;
  13526. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13527. return smalltalk.withContext(function($ctx1) {
  13528. var $1;
  13529. $1=_st($String())._streamContents_((function(stream){
  13530. return smalltalk.withContext(function($ctx2) {
  13531. return _st(aCollection)._do_separatedBy_((function(each){
  13532. return smalltalk.withContext(function($ctx3) {
  13533. return _st(stream)._nextPutAll_(_st(each)._asString());
  13534. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  13535. return smalltalk.withContext(function($ctx3) {
  13536. return _st(stream)._nextPutAll_(self);
  13537. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13538. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  13539. return $1;
  13540. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.String)})},
  13541. args: ["aCollection"],
  13542. 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]]",
  13543. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  13544. referencedClasses: ["String"]
  13545. }),
  13546. smalltalk.String);
  13547. smalltalk.addMethod(
  13548. smalltalk.method({
  13549. selector: "lineIndicesDo:",
  13550. category: 'split join',
  13551. fn: function (aBlock){
  13552. var self=this;
  13553. var cr,lf,start,sz,nextLF,nextCR;
  13554. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13555. return smalltalk.withContext(function($ctx1) {
  13556. var $1,$2,$3,$4;
  13557. var $early={};
  13558. try {
  13559. start=(1);
  13560. sz=self._size();
  13561. cr=_st($String())._cr();
  13562. nextCR=self._indexOf_startingAt_(cr,(1));
  13563. lf=_st($String())._lf();
  13564. nextLF=self._indexOf_startingAt_(lf,(1));
  13565. _st((function(){
  13566. return smalltalk.withContext(function($ctx2) {
  13567. return _st(start).__lt_eq(sz);
  13568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  13569. return smalltalk.withContext(function($ctx2) {
  13570. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  13571. return smalltalk.withContext(function($ctx3) {
  13572. return _st(nextCR).__eq((0));
  13573. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13574. if(smalltalk.assert($1)){
  13575. _st(aBlock)._value_value_value_(start,sz,sz);
  13576. $2=self;
  13577. throw $early=[$2];
  13578. };
  13579. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  13580. return smalltalk.withContext(function($ctx3) {
  13581. return _st((0).__lt(nextLF))._and_((function(){
  13582. return smalltalk.withContext(function($ctx4) {
  13583. return _st(nextLF).__lt(nextCR);
  13584. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  13585. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  13586. if(smalltalk.assert($3)){
  13587. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  13588. start=(1).__plus(nextLF);
  13589. start;
  13590. nextLF=self._indexOf_startingAt_(lf,start);
  13591. return nextLF;
  13592. } else {
  13593. $4=_st((1).__plus(nextCR)).__eq(nextLF);
  13594. if(smalltalk.assert($4)){
  13595. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  13596. start=(1).__plus(nextLF);
  13597. start;
  13598. nextCR=self._indexOf_startingAt_(cr,start);
  13599. nextCR;
  13600. nextLF=self._indexOf_startingAt_(lf,start);
  13601. return nextLF;
  13602. } else {
  13603. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  13604. start=(1).__plus(nextCR);
  13605. start;
  13606. nextCR=self._indexOf_startingAt_(cr,start);
  13607. return nextCR;
  13608. };
  13609. };
  13610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  13611. return self}
  13612. catch(e) {if(e===$early)return e[0]; throw e}
  13613. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},smalltalk.String)})},
  13614. args: ["aBlock"],
  13615. 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 ]]]",
  13616. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  13617. referencedClasses: ["String"]
  13618. }),
  13619. smalltalk.String);
  13620. smalltalk.addMethod(
  13621. smalltalk.method({
  13622. selector: "lineNumber:",
  13623. category: 'split join',
  13624. fn: function (anIndex){
  13625. var self=this;
  13626. var lineCount;
  13627. return smalltalk.withContext(function($ctx1) {
  13628. var $1,$2;
  13629. var $early={};
  13630. try {
  13631. lineCount=(0);
  13632. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13633. return smalltalk.withContext(function($ctx2) {
  13634. lineCount=_st(lineCount).__plus((1));
  13635. $1=_st(lineCount).__eq(anIndex);
  13636. if(smalltalk.assert($1)){
  13637. $2=self._copyFrom_to_(start,endWithoutDelimiters);
  13638. throw $early=[$2];
  13639. };
  13640. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  13641. return nil;
  13642. }
  13643. catch(e) {if(e===$early)return e[0]; throw e}
  13644. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.String)})},
  13645. args: ["anIndex"],
  13646. 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",
  13647. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  13648. referencedClasses: []
  13649. }),
  13650. smalltalk.String);
  13651. smalltalk.addMethod(
  13652. smalltalk.method({
  13653. selector: "lines",
  13654. category: 'split join',
  13655. fn: function (){
  13656. var self=this;
  13657. var lines;
  13658. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  13659. return smalltalk.withContext(function($ctx1) {
  13660. var $1;
  13661. lines=_st($Array())._new();
  13662. self._linesDo_((function(aLine){
  13663. return smalltalk.withContext(function($ctx2) {
  13664. return _st(lines)._add_(aLine);
  13665. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  13666. $1=lines;
  13667. return $1;
  13668. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})},
  13669. args: [],
  13670. 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",
  13671. messageSends: ["new", "linesDo:", "add:"],
  13672. referencedClasses: ["Array"]
  13673. }),
  13674. smalltalk.String);
  13675. smalltalk.addMethod(
  13676. smalltalk.method({
  13677. selector: "linesDo:",
  13678. category: 'split join',
  13679. fn: function (aBlock){
  13680. var self=this;
  13681. return smalltalk.withContext(function($ctx1) {
  13682. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13683. return smalltalk.withContext(function($ctx2) {
  13684. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  13685. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  13686. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.String)})},
  13687. args: ["aBlock"],
  13688. 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)]",
  13689. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  13690. referencedClasses: []
  13691. }),
  13692. smalltalk.String);
  13693. smalltalk.addMethod(
  13694. smalltalk.method({
  13695. selector: "match:",
  13696. category: 'regular expressions',
  13697. fn: function (aRegexp){
  13698. var self=this;
  13699. return smalltalk.withContext(function($ctx1) {
  13700. return self.search(aRegexp) != -1;
  13701. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})},
  13702. args: ["aRegexp"],
  13703. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  13704. messageSends: [],
  13705. referencedClasses: []
  13706. }),
  13707. smalltalk.String);
  13708. smalltalk.addMethod(
  13709. smalltalk.method({
  13710. selector: "matchesOf:",
  13711. category: 'regular expressions',
  13712. fn: function (aRegularExpression){
  13713. var self=this;
  13714. return smalltalk.withContext(function($ctx1) {
  13715. return self.match(aRegularExpression);
  13716. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})},
  13717. args: ["aRegularExpression"],
  13718. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  13719. messageSends: [],
  13720. referencedClasses: []
  13721. }),
  13722. smalltalk.String);
  13723. smalltalk.addMethod(
  13724. smalltalk.method({
  13725. selector: "printNl",
  13726. category: 'printing',
  13727. fn: function (){
  13728. var self=this;
  13729. return smalltalk.withContext(function($ctx1) {
  13730. console.log(self);
  13731. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})},
  13732. args: [],
  13733. source: "printNl\x0a\x09<console.log(self)>",
  13734. messageSends: [],
  13735. referencedClasses: []
  13736. }),
  13737. smalltalk.String);
  13738. smalltalk.addMethod(
  13739. smalltalk.method({
  13740. selector: "printOn:",
  13741. category: 'printing',
  13742. fn: function (aStream){
  13743. var self=this;
  13744. return smalltalk.withContext(function($ctx1) {
  13745. var $1,$2;
  13746. $1=aStream;
  13747. _st($1)._nextPutAll_("'");
  13748. _st($1)._nextPutAll_(self);
  13749. $2=_st($1)._nextPutAll_("'");
  13750. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})},
  13751. args: ["aStream"],
  13752. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  13753. messageSends: ["nextPutAll:"],
  13754. referencedClasses: []
  13755. }),
  13756. smalltalk.String);
  13757. smalltalk.addMethod(
  13758. smalltalk.method({
  13759. selector: "replace:with:",
  13760. category: 'regular expressions',
  13761. fn: function (aString,anotherString){
  13762. var self=this;
  13763. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13764. return smalltalk.withContext(function($ctx1) {
  13765. var $1;
  13766. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  13767. return $1;
  13768. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})},
  13769. args: ["aString", "anotherString"],
  13770. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  13771. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  13772. referencedClasses: ["RegularExpression"]
  13773. }),
  13774. smalltalk.String);
  13775. smalltalk.addMethod(
  13776. smalltalk.method({
  13777. selector: "replaceRegexp:with:",
  13778. category: 'regular expressions',
  13779. fn: function (aRegexp,aString){
  13780. var self=this;
  13781. return smalltalk.withContext(function($ctx1) {
  13782. return self.replace(aRegexp, aString);
  13783. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})},
  13784. args: ["aRegexp", "aString"],
  13785. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  13786. messageSends: [],
  13787. referencedClasses: []
  13788. }),
  13789. smalltalk.String);
  13790. smalltalk.addMethod(
  13791. smalltalk.method({
  13792. selector: "reversed",
  13793. category: 'converting',
  13794. fn: function (){
  13795. var self=this;
  13796. return smalltalk.withContext(function($ctx1) {
  13797. return self.split("").reverse().join("");
  13798. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})},
  13799. args: [],
  13800. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  13801. messageSends: [],
  13802. referencedClasses: []
  13803. }),
  13804. smalltalk.String);
  13805. smalltalk.addMethod(
  13806. smalltalk.method({
  13807. selector: "shallowCopy",
  13808. category: 'copying',
  13809. fn: function (){
  13810. var self=this;
  13811. return smalltalk.withContext(function($ctx1) {
  13812. var $1;
  13813. $1=_st(self._class())._fromString_(self);
  13814. return $1;
  13815. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})},
  13816. args: [],
  13817. source: "shallowCopy\x0a\x09^self class fromString: self",
  13818. messageSends: ["fromString:", "class"],
  13819. referencedClasses: []
  13820. }),
  13821. smalltalk.String);
  13822. smalltalk.addMethod(
  13823. smalltalk.method({
  13824. selector: "size",
  13825. category: 'accessing',
  13826. fn: function (){
  13827. var self=this;
  13828. return smalltalk.withContext(function($ctx1) {
  13829. return self.length;
  13830. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})},
  13831. args: [],
  13832. source: "size\x0a\x09<return self.length>",
  13833. messageSends: [],
  13834. referencedClasses: []
  13835. }),
  13836. smalltalk.String);
  13837. smalltalk.addMethod(
  13838. smalltalk.method({
  13839. selector: "subStrings:",
  13840. category: 'split join',
  13841. fn: function (aString){
  13842. var self=this;
  13843. return smalltalk.withContext(function($ctx1) {
  13844. var $1;
  13845. $1=self._tokenize_(aString);
  13846. return $1;
  13847. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},smalltalk.String)})},
  13848. args: ["aString"],
  13849. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  13850. messageSends: ["tokenize:"],
  13851. referencedClasses: []
  13852. }),
  13853. smalltalk.String);
  13854. smalltalk.addMethod(
  13855. smalltalk.method({
  13856. selector: "tokenize:",
  13857. category: 'split join',
  13858. fn: function (aString){
  13859. var self=this;
  13860. return smalltalk.withContext(function($ctx1) {
  13861. return self.split(aString);
  13862. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})},
  13863. args: ["aString"],
  13864. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  13865. messageSends: [],
  13866. referencedClasses: []
  13867. }),
  13868. smalltalk.String);
  13869. smalltalk.addMethod(
  13870. smalltalk.method({
  13871. selector: "trimBoth",
  13872. category: 'regular expressions',
  13873. fn: function (){
  13874. var self=this;
  13875. return smalltalk.withContext(function($ctx1) {
  13876. var $1;
  13877. $1=self._trimBoth_("\x5cs");
  13878. return $1;
  13879. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})},
  13880. args: [],
  13881. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  13882. messageSends: ["trimBoth:"],
  13883. referencedClasses: []
  13884. }),
  13885. smalltalk.String);
  13886. smalltalk.addMethod(
  13887. smalltalk.method({
  13888. selector: "trimBoth:",
  13889. category: 'regular expressions',
  13890. fn: function (separators){
  13891. var self=this;
  13892. return smalltalk.withContext(function($ctx1) {
  13893. var $1;
  13894. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  13895. return $1;
  13896. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})},
  13897. args: ["separators"],
  13898. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  13899. messageSends: ["trimRight:", "trimLeft:"],
  13900. referencedClasses: []
  13901. }),
  13902. smalltalk.String);
  13903. smalltalk.addMethod(
  13904. smalltalk.method({
  13905. selector: "trimLeft",
  13906. category: 'regular expressions',
  13907. fn: function (){
  13908. var self=this;
  13909. return smalltalk.withContext(function($ctx1) {
  13910. var $1;
  13911. $1=self._trimLeft_("\x5cs");
  13912. return $1;
  13913. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})},
  13914. args: [],
  13915. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  13916. messageSends: ["trimLeft:"],
  13917. referencedClasses: []
  13918. }),
  13919. smalltalk.String);
  13920. smalltalk.addMethod(
  13921. smalltalk.method({
  13922. selector: "trimLeft:",
  13923. category: 'regular expressions',
  13924. fn: function (separators){
  13925. var self=this;
  13926. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13927. return smalltalk.withContext(function($ctx1) {
  13928. var $1;
  13929. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("^[".__comma(separators)).__comma("]+"),"g"),"");
  13930. return $1;
  13931. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})},
  13932. args: ["separators"],
  13933. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  13934. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13935. referencedClasses: ["RegularExpression"]
  13936. }),
  13937. smalltalk.String);
  13938. smalltalk.addMethod(
  13939. smalltalk.method({
  13940. selector: "trimRight",
  13941. category: 'regular expressions',
  13942. fn: function (){
  13943. var self=this;
  13944. return smalltalk.withContext(function($ctx1) {
  13945. var $1;
  13946. $1=self._trimRight_("\x5cs");
  13947. return $1;
  13948. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})},
  13949. args: [],
  13950. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  13951. messageSends: ["trimRight:"],
  13952. referencedClasses: []
  13953. }),
  13954. smalltalk.String);
  13955. smalltalk.addMethod(
  13956. smalltalk.method({
  13957. selector: "trimRight:",
  13958. category: 'regular expressions',
  13959. fn: function (separators){
  13960. var self=this;
  13961. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13962. return smalltalk.withContext(function($ctx1) {
  13963. var $1;
  13964. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("[".__comma(separators)).__comma("]+$"),"g"),"");
  13965. return $1;
  13966. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})},
  13967. args: ["separators"],
  13968. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  13969. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  13970. referencedClasses: ["RegularExpression"]
  13971. }),
  13972. smalltalk.String);
  13973. smalltalk.addMethod(
  13974. smalltalk.method({
  13975. selector: "unescaped",
  13976. category: 'accessing',
  13977. fn: function (){
  13978. var self=this;
  13979. return smalltalk.withContext(function($ctx1) {
  13980. return unescape(self);
  13981. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})},
  13982. args: [],
  13983. source: "unescaped\x0a\x09<return unescape(self)>",
  13984. messageSends: [],
  13985. referencedClasses: []
  13986. }),
  13987. smalltalk.String);
  13988. smalltalk.addMethod(
  13989. smalltalk.method({
  13990. selector: "withIndexDo:",
  13991. category: 'enumerating',
  13992. fn: function (aBlock){
  13993. var self=this;
  13994. return smalltalk.withContext(function($ctx1) {
  13995. for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);};
  13996. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.String)})},
  13997. args: ["aBlock"],
  13998. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);}>",
  13999. messageSends: [],
  14000. referencedClasses: []
  14001. }),
  14002. smalltalk.String);
  14003. smalltalk.addMethod(
  14004. smalltalk.method({
  14005. selector: "cr",
  14006. category: 'accessing',
  14007. fn: function (){
  14008. var self=this;
  14009. return smalltalk.withContext(function($ctx1) {
  14010. return '\r';
  14011. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})},
  14012. args: [],
  14013. source: "cr\x0a\x09<return '\x5cr'>",
  14014. messageSends: [],
  14015. referencedClasses: []
  14016. }),
  14017. smalltalk.String.klass);
  14018. smalltalk.addMethod(
  14019. smalltalk.method({
  14020. selector: "crlf",
  14021. category: 'accessing',
  14022. fn: function (){
  14023. var self=this;
  14024. return smalltalk.withContext(function($ctx1) {
  14025. return '\r\n';
  14026. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})},
  14027. args: [],
  14028. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  14029. messageSends: [],
  14030. referencedClasses: []
  14031. }),
  14032. smalltalk.String.klass);
  14033. smalltalk.addMethod(
  14034. smalltalk.method({
  14035. selector: "fromCharCode:",
  14036. category: 'instance creation',
  14037. fn: function (anInteger){
  14038. var self=this;
  14039. return smalltalk.withContext(function($ctx1) {
  14040. return String.fromCharCode(anInteger);
  14041. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})},
  14042. args: ["anInteger"],
  14043. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  14044. messageSends: [],
  14045. referencedClasses: []
  14046. }),
  14047. smalltalk.String.klass);
  14048. smalltalk.addMethod(
  14049. smalltalk.method({
  14050. selector: "fromString:",
  14051. category: 'instance creation',
  14052. fn: function (aString){
  14053. var self=this;
  14054. return smalltalk.withContext(function($ctx1) {
  14055. return String(aString);
  14056. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})},
  14057. args: ["aString"],
  14058. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  14059. messageSends: [],
  14060. referencedClasses: []
  14061. }),
  14062. smalltalk.String.klass);
  14063. smalltalk.addMethod(
  14064. smalltalk.method({
  14065. selector: "lf",
  14066. category: 'accessing',
  14067. fn: function (){
  14068. var self=this;
  14069. return smalltalk.withContext(function($ctx1) {
  14070. return '\n';
  14071. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})},
  14072. args: [],
  14073. source: "lf\x0a\x09<return '\x5cn'>",
  14074. messageSends: [],
  14075. referencedClasses: []
  14076. }),
  14077. smalltalk.String.klass);
  14078. smalltalk.addMethod(
  14079. smalltalk.method({
  14080. selector: "random",
  14081. category: 'random',
  14082. fn: function (){
  14083. var self=this;
  14084. return smalltalk.withContext(function($ctx1) {
  14085. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  14086. return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.String.klass)})},
  14087. args: [],
  14088. 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);>",
  14089. messageSends: [],
  14090. referencedClasses: []
  14091. }),
  14092. smalltalk.String.klass);
  14093. smalltalk.addMethod(
  14094. smalltalk.method({
  14095. selector: "randomNotIn:",
  14096. category: 'random',
  14097. fn: function (aString){
  14098. var self=this;
  14099. var result;
  14100. return smalltalk.withContext(function($ctx1) {
  14101. var $1;
  14102. _st((function(){
  14103. return smalltalk.withContext(function($ctx2) {
  14104. result=self._random();
  14105. result;
  14106. return _st(aString)._includesSubString_(result);
  14107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue();
  14108. $1=result;
  14109. return $1;
  14110. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})},
  14111. args: ["aString"],
  14112. source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result",
  14113. messageSends: ["whileTrue", "random", "includesSubString:"],
  14114. referencedClasses: []
  14115. }),
  14116. smalltalk.String.klass);
  14117. smalltalk.addMethod(
  14118. smalltalk.method({
  14119. selector: "space",
  14120. category: 'accessing',
  14121. fn: function (){
  14122. var self=this;
  14123. return smalltalk.withContext(function($ctx1) {
  14124. return ' ';
  14125. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})},
  14126. args: [],
  14127. source: "space\x0a\x09<return ' '>",
  14128. messageSends: [],
  14129. referencedClasses: []
  14130. }),
  14131. smalltalk.String.klass);
  14132. smalltalk.addMethod(
  14133. smalltalk.method({
  14134. selector: "streamClass",
  14135. category: 'accessing',
  14136. fn: function (){
  14137. var self=this;
  14138. function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  14139. return smalltalk.withContext(function($ctx1) {
  14140. var $1;
  14141. $1=$StringStream();
  14142. return $1;
  14143. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})},
  14144. args: [],
  14145. source: "streamClass\x0a\x09\x09^StringStream",
  14146. messageSends: [],
  14147. referencedClasses: ["StringStream"]
  14148. }),
  14149. smalltalk.String.klass);
  14150. smalltalk.addMethod(
  14151. smalltalk.method({
  14152. selector: "tab",
  14153. category: 'accessing',
  14154. fn: function (){
  14155. var self=this;
  14156. return smalltalk.withContext(function($ctx1) {
  14157. return '\t';
  14158. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})},
  14159. args: [],
  14160. source: "tab\x0a\x09<return '\x5ct'>",
  14161. messageSends: [],
  14162. referencedClasses: []
  14163. }),
  14164. smalltalk.String.klass);
  14165. smalltalk.addMethod(
  14166. smalltalk.method({
  14167. selector: "value:",
  14168. category: 'instance creation',
  14169. fn: function (aUTFCharCode){
  14170. var self=this;
  14171. return smalltalk.withContext(function($ctx1) {
  14172. return String.fromCharCode(aUTFCharCode);;
  14173. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})},
  14174. args: ["aUTFCharCode"],
  14175. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  14176. messageSends: [],
  14177. referencedClasses: []
  14178. }),
  14179. smalltalk.String.klass);
  14180. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  14181. smalltalk.Set.comment="I represent an unordered set of objects without duplicates.";
  14182. smalltalk.addMethod(
  14183. smalltalk.method({
  14184. selector: "=",
  14185. category: 'comparing',
  14186. fn: function (aCollection){
  14187. var self=this;
  14188. return smalltalk.withContext(function($ctx1) {
  14189. var $1,$2,$3;
  14190. var $early={};
  14191. try {
  14192. $1=_st(self._class()).__eq(_st(aCollection)._class());
  14193. if(! smalltalk.assert($1)){
  14194. return false;
  14195. };
  14196. $2=_st(self._size()).__eq(_st(aCollection)._size());
  14197. if(! smalltalk.assert($2)){
  14198. return false;
  14199. };
  14200. self._do_((function(each){
  14201. return smalltalk.withContext(function($ctx2) {
  14202. $3=_st(aCollection)._includes_(each);
  14203. if(! smalltalk.assert($3)){
  14204. throw $early=[false];
  14205. };
  14206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14207. return true;
  14208. }
  14209. catch(e) {if(e===$early)return e[0]; throw e}
  14210. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.Set)})},
  14211. args: ["aCollection"],
  14212. 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",
  14213. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  14214. referencedClasses: []
  14215. }),
  14216. smalltalk.Set);
  14217. smalltalk.addMethod(
  14218. smalltalk.method({
  14219. selector: "add:",
  14220. category: 'adding/removing',
  14221. fn: function (anObject){
  14222. var self=this;
  14223. return smalltalk.withContext(function($ctx1) {
  14224. var found;
  14225. for(var i=0; i < self['@elements'].length; i++) {
  14226. if(anObject == self['@elements'][i]) {
  14227. found = true;
  14228. break;
  14229. }
  14230. }
  14231. if(!found) {self['@elements'].push(anObject)}
  14232. ;
  14233. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})},
  14234. args: ["anObject"],
  14235. source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>",
  14236. messageSends: [],
  14237. referencedClasses: []
  14238. }),
  14239. smalltalk.Set);
  14240. smalltalk.addMethod(
  14241. smalltalk.method({
  14242. selector: "asArray",
  14243. category: 'converting',
  14244. fn: function (){
  14245. var self=this;
  14246. return smalltalk.withContext(function($ctx1) {
  14247. var $1;
  14248. $1=_st(self["@elements"])._copy();
  14249. return $1;
  14250. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})},
  14251. args: [],
  14252. source: "asArray\x0a\x09^elements copy",
  14253. messageSends: ["copy"],
  14254. referencedClasses: []
  14255. }),
  14256. smalltalk.Set);
  14257. smalltalk.addMethod(
  14258. smalltalk.method({
  14259. selector: "collect:",
  14260. category: 'enumerating',
  14261. fn: function (aBlock){
  14262. var self=this;
  14263. return smalltalk.withContext(function($ctx1) {
  14264. var $1;
  14265. $1=_st(self._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  14266. return $1;
  14267. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})},
  14268. args: ["aBlock"],
  14269. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  14270. messageSends: ["withAll:", "collect:", "class"],
  14271. referencedClasses: []
  14272. }),
  14273. smalltalk.Set);
  14274. smalltalk.addMethod(
  14275. smalltalk.method({
  14276. selector: "detect:ifNone:",
  14277. category: 'enumerating',
  14278. fn: function (aBlock,anotherBlock){
  14279. var self=this;
  14280. return smalltalk.withContext(function($ctx1) {
  14281. var $1;
  14282. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  14283. return $1;
  14284. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})},
  14285. args: ["aBlock", "anotherBlock"],
  14286. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  14287. messageSends: ["detect:ifNone:"],
  14288. referencedClasses: []
  14289. }),
  14290. smalltalk.Set);
  14291. smalltalk.addMethod(
  14292. smalltalk.method({
  14293. selector: "do:",
  14294. category: 'enumerating',
  14295. fn: function (aBlock){
  14296. var self=this;
  14297. return smalltalk.withContext(function($ctx1) {
  14298. _st(self["@elements"])._do_(aBlock);
  14299. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})},
  14300. args: ["aBlock"],
  14301. source: "do: aBlock\x0a\x09elements do: aBlock",
  14302. messageSends: ["do:"],
  14303. referencedClasses: []
  14304. }),
  14305. smalltalk.Set);
  14306. smalltalk.addMethod(
  14307. smalltalk.method({
  14308. selector: "includes:",
  14309. category: 'testing',
  14310. fn: function (anObject){
  14311. var self=this;
  14312. return smalltalk.withContext(function($ctx1) {
  14313. var $1;
  14314. $1=_st(self["@elements"])._includes_(anObject);
  14315. return $1;
  14316. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})},
  14317. args: ["anObject"],
  14318. source: "includes: anObject\x0a\x09^elements includes: anObject",
  14319. messageSends: ["includes:"],
  14320. referencedClasses: []
  14321. }),
  14322. smalltalk.Set);
  14323. smalltalk.addMethod(
  14324. smalltalk.method({
  14325. selector: "initialize",
  14326. category: 'initialization',
  14327. fn: function (){
  14328. var self=this;
  14329. return smalltalk.withContext(function($ctx1) {
  14330. smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  14331. self["@elements"]=[];
  14332. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})},
  14333. args: [],
  14334. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  14335. messageSends: ["initialize"],
  14336. referencedClasses: []
  14337. }),
  14338. smalltalk.Set);
  14339. smalltalk.addMethod(
  14340. smalltalk.method({
  14341. selector: "printOn:",
  14342. category: 'printing',
  14343. fn: function (aStream){
  14344. var self=this;
  14345. return smalltalk.withContext(function($ctx1) {
  14346. smalltalk.Collection.fn.prototype._printOn_.apply(_st(self), [aStream]);
  14347. _st(aStream)._nextPutAll_(" (");
  14348. self._do_separatedBy_((function(each){
  14349. return smalltalk.withContext(function($ctx2) {
  14350. return _st(each)._printOn_(aStream);
  14351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  14352. return smalltalk.withContext(function($ctx2) {
  14353. return _st(aStream)._nextPutAll_(" ");
  14354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14355. _st(aStream)._nextPutAll_(")");
  14356. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Set)})},
  14357. args: ["aStream"],
  14358. 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: ')'",
  14359. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  14360. referencedClasses: []
  14361. }),
  14362. smalltalk.Set);
  14363. smalltalk.addMethod(
  14364. smalltalk.method({
  14365. selector: "remove:",
  14366. category: 'adding/removing',
  14367. fn: function (anObject){
  14368. var self=this;
  14369. return smalltalk.withContext(function($ctx1) {
  14370. _st(self["@elements"])._remove_(anObject);
  14371. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})},
  14372. args: ["anObject"],
  14373. source: "remove: anObject\x0a\x09elements remove: anObject",
  14374. messageSends: ["remove:"],
  14375. referencedClasses: []
  14376. }),
  14377. smalltalk.Set);
  14378. smalltalk.addMethod(
  14379. smalltalk.method({
  14380. selector: "remove:ifAbsent:",
  14381. category: 'adding/removing',
  14382. fn: function (anObject,aBlock){
  14383. var self=this;
  14384. return smalltalk.withContext(function($ctx1) {
  14385. _st(self["@elements"])._remove_ifAbsent_(anObject,aBlock);
  14386. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Set)})},
  14387. args: ["anObject", "aBlock"],
  14388. source: "remove: anObject ifAbsent: aBlock\x0a\x09elements remove: anObject ifAbsent: aBlock",
  14389. messageSends: ["remove:ifAbsent:"],
  14390. referencedClasses: []
  14391. }),
  14392. smalltalk.Set);
  14393. smalltalk.addMethod(
  14394. smalltalk.method({
  14395. selector: "select:",
  14396. category: 'enumerating',
  14397. fn: function (aBlock){
  14398. var self=this;
  14399. var collection;
  14400. return smalltalk.withContext(function($ctx1) {
  14401. var $1,$2;
  14402. collection=_st(self._class())._new();
  14403. self._do_((function(each){
  14404. return smalltalk.withContext(function($ctx2) {
  14405. $1=_st(aBlock)._value_(each);
  14406. if(smalltalk.assert($1)){
  14407. return _st(collection)._add_(each);
  14408. };
  14409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14410. $2=collection;
  14411. return $2;
  14412. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.Set)})},
  14413. args: ["aBlock"],
  14414. 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",
  14415. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  14416. referencedClasses: []
  14417. }),
  14418. smalltalk.Set);
  14419. smalltalk.addMethod(
  14420. smalltalk.method({
  14421. selector: "size",
  14422. category: 'accessing',
  14423. fn: function (){
  14424. var self=this;
  14425. return smalltalk.withContext(function($ctx1) {
  14426. var $1;
  14427. $1=_st(self["@elements"])._size();
  14428. return $1;
  14429. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})},
  14430. args: [],
  14431. source: "size\x0a\x09^elements size",
  14432. messageSends: ["size"],
  14433. referencedClasses: []
  14434. }),
  14435. smalltalk.Set);
  14436. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  14437. smalltalk.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.";
  14438. smalltalk.addMethod(
  14439. smalltalk.method({
  14440. selector: "initialize",
  14441. category: 'initialization',
  14442. fn: function (){
  14443. var self=this;
  14444. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14445. return smalltalk.withContext(function($ctx1) {
  14446. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  14447. self["@read"]=_st($OrderedCollection())._new();
  14448. self["@write"]=_st($OrderedCollection())._new();
  14449. self["@readIndex"]=(1);
  14450. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})},
  14451. args: [],
  14452. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14453. messageSends: ["initialize", "new"],
  14454. referencedClasses: ["OrderedCollection"]
  14455. }),
  14456. smalltalk.Queue);
  14457. smalltalk.addMethod(
  14458. smalltalk.method({
  14459. selector: "next",
  14460. category: 'accessing',
  14461. fn: function (){
  14462. var self=this;
  14463. return smalltalk.withContext(function($ctx1) {
  14464. var $1;
  14465. $1=self._nextIfAbsent_((function(){
  14466. return smalltalk.withContext(function($ctx2) {
  14467. return self._error_("Cannot read from empty Queue.");
  14468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14469. return $1;
  14470. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})},
  14471. args: [],
  14472. source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14473. messageSends: ["nextIfAbsent:", "error:"],
  14474. referencedClasses: []
  14475. }),
  14476. smalltalk.Queue);
  14477. smalltalk.addMethod(
  14478. smalltalk.method({
  14479. selector: "nextIfAbsent:",
  14480. category: 'accessing',
  14481. fn: function (aBlock){
  14482. var self=this;
  14483. var result;
  14484. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  14485. return smalltalk.withContext(function($ctx1) {
  14486. var $1,$2,$3,$4;
  14487. var $early={};
  14488. try {
  14489. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  14490. return smalltalk.withContext(function($ctx2) {
  14491. $1=_st(self["@write"])._isEmpty();
  14492. if(smalltalk.assert($1)){
  14493. $2=_st(self["@readIndex"]).__gt((1));
  14494. if(smalltalk.assert($2)){
  14495. self["@read"]=[];
  14496. self["@read"];
  14497. self["@readIndex"]=(1);
  14498. self["@readIndex"];
  14499. };
  14500. $3=_st(aBlock)._value();
  14501. throw $early=[$3];
  14502. };
  14503. self["@read"]=self["@write"];
  14504. self["@read"];
  14505. self["@readIndex"]=(1);
  14506. self["@readIndex"];
  14507. self["@write"]=_st($OrderedCollection())._new();
  14508. self["@write"];
  14509. return _st(self["@read"])._first();
  14510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14511. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  14512. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  14513. $4=result;
  14514. return $4;
  14515. }
  14516. catch(e) {if(e===$early)return e[0]; throw e}
  14517. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},smalltalk.Queue)})},
  14518. args: ["aBlock"],
  14519. 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",
  14520. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  14521. referencedClasses: ["OrderedCollection"]
  14522. }),
  14523. smalltalk.Queue);
  14524. smalltalk.addMethod(
  14525. smalltalk.method({
  14526. selector: "nextPut:",
  14527. category: 'accessing',
  14528. fn: function (anObject){
  14529. var self=this;
  14530. return smalltalk.withContext(function($ctx1) {
  14531. _st(self["@write"])._add_(anObject);
  14532. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})},
  14533. args: ["anObject"],
  14534. source: "nextPut: anObject\x0a\x09write add: anObject",
  14535. messageSends: ["add:"],
  14536. referencedClasses: []
  14537. }),
  14538. smalltalk.Queue);
  14539. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  14540. smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14541. smalltalk.addMethod(
  14542. smalltalk.method({
  14543. selector: "compile:",
  14544. category: 'evaluating',
  14545. fn: function (aString){
  14546. var self=this;
  14547. return smalltalk.withContext(function($ctx1) {
  14548. return self.compile(aString);
  14549. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})},
  14550. args: ["aString"],
  14551. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  14552. messageSends: [],
  14553. referencedClasses: []
  14554. }),
  14555. smalltalk.RegularExpression);
  14556. smalltalk.addMethod(
  14557. smalltalk.method({
  14558. selector: "exec:",
  14559. category: 'evaluating',
  14560. fn: function (aString){
  14561. var self=this;
  14562. return smalltalk.withContext(function($ctx1) {
  14563. return self.exec(aString) || nil;
  14564. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})},
  14565. args: ["aString"],
  14566. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  14567. messageSends: [],
  14568. referencedClasses: []
  14569. }),
  14570. smalltalk.RegularExpression);
  14571. smalltalk.addMethod(
  14572. smalltalk.method({
  14573. selector: "test:",
  14574. category: 'evaluating',
  14575. fn: function (aString){
  14576. var self=this;
  14577. return smalltalk.withContext(function($ctx1) {
  14578. return self.test(aString);
  14579. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})},
  14580. args: ["aString"],
  14581. source: "test: aString\x0a\x09<return self.test(aString)>",
  14582. messageSends: [],
  14583. referencedClasses: []
  14584. }),
  14585. smalltalk.RegularExpression);
  14586. smalltalk.addMethod(
  14587. smalltalk.method({
  14588. selector: "fromString:",
  14589. category: 'instance creation',
  14590. fn: function (aString){
  14591. var self=this;
  14592. return smalltalk.withContext(function($ctx1) {
  14593. var $1;
  14594. $1=self._fromString_flag_(aString,"");
  14595. return $1;
  14596. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})},
  14597. args: ["aString"],
  14598. source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''",
  14599. messageSends: ["fromString:flag:"],
  14600. referencedClasses: []
  14601. }),
  14602. smalltalk.RegularExpression.klass);
  14603. smalltalk.addMethod(
  14604. smalltalk.method({
  14605. selector: "fromString:flag:",
  14606. category: 'instance creation',
  14607. fn: function (aString,anotherString){
  14608. var self=this;
  14609. return smalltalk.withContext(function($ctx1) {
  14610. return new RegExp(aString, anotherString);
  14611. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})},
  14612. args: ["aString", "anotherString"],
  14613. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  14614. messageSends: [],
  14615. referencedClasses: []
  14616. }),
  14617. smalltalk.RegularExpression.klass);
  14618. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  14619. smalltalk.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.";
  14620. smalltalk.addMethod(
  14621. smalltalk.method({
  14622. selector: "<<",
  14623. category: 'writing',
  14624. fn: function (anObject){
  14625. var self=this;
  14626. return smalltalk.withContext(function($ctx1) {
  14627. self._write_(anObject);
  14628. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})},
  14629. args: ["anObject"],
  14630. source: "<< anObject\x0a\x09self write: anObject",
  14631. messageSends: ["write:"],
  14632. referencedClasses: []
  14633. }),
  14634. smalltalk.Stream);
  14635. smalltalk.addMethod(
  14636. smalltalk.method({
  14637. selector: "atEnd",
  14638. category: 'testing',
  14639. fn: function (){
  14640. var self=this;
  14641. return smalltalk.withContext(function($ctx1) {
  14642. var $1;
  14643. $1=_st(self._position()).__eq(self._size());
  14644. return $1;
  14645. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})},
  14646. args: [],
  14647. source: "atEnd\x0a\x09^self position = self size",
  14648. messageSends: ["=", "size", "position"],
  14649. referencedClasses: []
  14650. }),
  14651. smalltalk.Stream);
  14652. smalltalk.addMethod(
  14653. smalltalk.method({
  14654. selector: "atStart",
  14655. category: 'testing',
  14656. fn: function (){
  14657. var self=this;
  14658. return smalltalk.withContext(function($ctx1) {
  14659. var $1;
  14660. $1=_st(self._position()).__eq((0));
  14661. return $1;
  14662. }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})},
  14663. args: [],
  14664. source: "atStart\x0a\x09^self position = 0",
  14665. messageSends: ["=", "position"],
  14666. referencedClasses: []
  14667. }),
  14668. smalltalk.Stream);
  14669. smalltalk.addMethod(
  14670. smalltalk.method({
  14671. selector: "close",
  14672. category: 'actions',
  14673. fn: function (){
  14674. var self=this;
  14675. return smalltalk.withContext(function($ctx1) {
  14676. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})},
  14677. args: [],
  14678. source: "close",
  14679. messageSends: [],
  14680. referencedClasses: []
  14681. }),
  14682. smalltalk.Stream);
  14683. smalltalk.addMethod(
  14684. smalltalk.method({
  14685. selector: "collection",
  14686. category: 'accessing',
  14687. fn: function (){
  14688. var self=this;
  14689. return smalltalk.withContext(function($ctx1) {
  14690. var $1;
  14691. $1=self["@collection"];
  14692. return $1;
  14693. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})},
  14694. args: [],
  14695. source: "collection\x0a\x09^collection",
  14696. messageSends: [],
  14697. referencedClasses: []
  14698. }),
  14699. smalltalk.Stream);
  14700. smalltalk.addMethod(
  14701. smalltalk.method({
  14702. selector: "contents",
  14703. category: 'accessing',
  14704. fn: function (){
  14705. var self=this;
  14706. return smalltalk.withContext(function($ctx1) {
  14707. var $1;
  14708. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  14709. return $1;
  14710. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})},
  14711. args: [],
  14712. source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  14713. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  14714. referencedClasses: []
  14715. }),
  14716. smalltalk.Stream);
  14717. smalltalk.addMethod(
  14718. smalltalk.method({
  14719. selector: "do:",
  14720. category: 'enumerating',
  14721. fn: function (aBlock){
  14722. var self=this;
  14723. return smalltalk.withContext(function($ctx1) {
  14724. _st((function(){
  14725. return smalltalk.withContext(function($ctx2) {
  14726. return self._atEnd();
  14727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  14728. return smalltalk.withContext(function($ctx2) {
  14729. return _st(aBlock)._value_(self._next());
  14730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14731. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})},
  14732. args: ["aBlock"],
  14733. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  14734. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  14735. referencedClasses: []
  14736. }),
  14737. smalltalk.Stream);
  14738. smalltalk.addMethod(
  14739. smalltalk.method({
  14740. selector: "flush",
  14741. category: 'actions',
  14742. fn: function (){
  14743. var self=this;
  14744. return smalltalk.withContext(function($ctx1) {
  14745. return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})},
  14746. args: [],
  14747. source: "flush",
  14748. messageSends: [],
  14749. referencedClasses: []
  14750. }),
  14751. smalltalk.Stream);
  14752. smalltalk.addMethod(
  14753. smalltalk.method({
  14754. selector: "isEmpty",
  14755. category: 'testing',
  14756. fn: function (){
  14757. var self=this;
  14758. return smalltalk.withContext(function($ctx1) {
  14759. var $1;
  14760. $1=_st(self._size()).__eq((0));
  14761. return $1;
  14762. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})},
  14763. args: [],
  14764. source: "isEmpty\x0a\x09^self size = 0",
  14765. messageSends: ["=", "size"],
  14766. referencedClasses: []
  14767. }),
  14768. smalltalk.Stream);
  14769. smalltalk.addMethod(
  14770. smalltalk.method({
  14771. selector: "next",
  14772. category: 'reading',
  14773. fn: function (){
  14774. var self=this;
  14775. return smalltalk.withContext(function($ctx1) {
  14776. var $2,$1;
  14777. $2=self._atEnd();
  14778. if(smalltalk.assert($2)){
  14779. $1=nil;
  14780. } else {
  14781. self._position_(_st(self._position()).__plus((1)));
  14782. $1=_st(self["@collection"])._at_(self._position());
  14783. };
  14784. return $1;
  14785. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Stream)})},
  14786. args: [],
  14787. 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]",
  14788. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  14789. referencedClasses: []
  14790. }),
  14791. smalltalk.Stream);
  14792. smalltalk.addMethod(
  14793. smalltalk.method({
  14794. selector: "next:",
  14795. category: 'reading',
  14796. fn: function (anInteger){
  14797. var self=this;
  14798. var tempCollection;
  14799. return smalltalk.withContext(function($ctx1) {
  14800. var $1,$2;
  14801. tempCollection=_st(_st(self._collection())._class())._new();
  14802. _st(anInteger)._timesRepeat_((function(){
  14803. return smalltalk.withContext(function($ctx2) {
  14804. $1=self._atEnd();
  14805. if(! smalltalk.assert($1)){
  14806. return _st(tempCollection)._add_(self._next());
  14807. };
  14808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  14809. $2=tempCollection;
  14810. return $2;
  14811. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.Stream)})},
  14812. args: ["anInteger"],
  14813. 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",
  14814. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  14815. referencedClasses: []
  14816. }),
  14817. smalltalk.Stream);
  14818. smalltalk.addMethod(
  14819. smalltalk.method({
  14820. selector: "nextPut:",
  14821. category: 'writing',
  14822. fn: function (anObject){
  14823. var self=this;
  14824. return smalltalk.withContext(function($ctx1) {
  14825. self._position_(_st(self._position()).__plus((1)));
  14826. _st(self._collection())._at_put_(self._position(),anObject);
  14827. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  14828. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Stream)})},
  14829. args: ["anObject"],
  14830. 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)",
  14831. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  14832. referencedClasses: []
  14833. }),
  14834. smalltalk.Stream);
  14835. smalltalk.addMethod(
  14836. smalltalk.method({
  14837. selector: "nextPutAll:",
  14838. category: 'writing',
  14839. fn: function (aCollection){
  14840. var self=this;
  14841. return smalltalk.withContext(function($ctx1) {
  14842. _st(aCollection)._do_((function(each){
  14843. return smalltalk.withContext(function($ctx2) {
  14844. return self._nextPut_(each);
  14845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  14846. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})},
  14847. args: ["aCollection"],
  14848. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]",
  14849. messageSends: ["do:", "nextPut:"],
  14850. referencedClasses: []
  14851. }),
  14852. smalltalk.Stream);
  14853. smalltalk.addMethod(
  14854. smalltalk.method({
  14855. selector: "nextPutString:",
  14856. category: 'writing',
  14857. fn: function (aString){
  14858. var self=this;
  14859. return smalltalk.withContext(function($ctx1) {
  14860. self._nextPut_(aString);
  14861. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})},
  14862. args: ["aString"],
  14863. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  14864. messageSends: ["nextPut:"],
  14865. referencedClasses: []
  14866. }),
  14867. smalltalk.Stream);
  14868. smalltalk.addMethod(
  14869. smalltalk.method({
  14870. selector: "peek",
  14871. category: 'reading',
  14872. fn: function (){
  14873. var self=this;
  14874. return smalltalk.withContext(function($ctx1) {
  14875. var $2,$1;
  14876. $2=self._atEnd();
  14877. if(! smalltalk.assert($2)){
  14878. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  14879. };
  14880. return $1;
  14881. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})},
  14882. args: [],
  14883. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]",
  14884. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  14885. referencedClasses: []
  14886. }),
  14887. smalltalk.Stream);
  14888. smalltalk.addMethod(
  14889. smalltalk.method({
  14890. selector: "position",
  14891. category: 'accessing',
  14892. fn: function (){
  14893. var self=this;
  14894. return smalltalk.withContext(function($ctx1) {
  14895. var $2,$1;
  14896. $2=self["@position"];
  14897. if(($receiver = $2) == nil || $receiver == undefined){
  14898. self["@position"]=(0);
  14899. $1=self["@position"];
  14900. } else {
  14901. $1=$2;
  14902. };
  14903. return $1;
  14904. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})},
  14905. args: [],
  14906. source: "position\x0a\x09^position ifNil: [position := 0]",
  14907. messageSends: ["ifNil:"],
  14908. referencedClasses: []
  14909. }),
  14910. smalltalk.Stream);
  14911. smalltalk.addMethod(
  14912. smalltalk.method({
  14913. selector: "position:",
  14914. category: 'accessing',
  14915. fn: function (anInteger){
  14916. var self=this;
  14917. return smalltalk.withContext(function($ctx1) {
  14918. self["@position"]=anInteger;
  14919. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})},
  14920. args: ["anInteger"],
  14921. source: "position: anInteger\x0a\x09position := anInteger",
  14922. messageSends: [],
  14923. referencedClasses: []
  14924. }),
  14925. smalltalk.Stream);
  14926. smalltalk.addMethod(
  14927. smalltalk.method({
  14928. selector: "reset",
  14929. category: 'actions',
  14930. fn: function (){
  14931. var self=this;
  14932. return smalltalk.withContext(function($ctx1) {
  14933. self._position_((0));
  14934. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})},
  14935. args: [],
  14936. source: "reset\x0a\x09self position: 0",
  14937. messageSends: ["position:"],
  14938. referencedClasses: []
  14939. }),
  14940. smalltalk.Stream);
  14941. smalltalk.addMethod(
  14942. smalltalk.method({
  14943. selector: "resetContents",
  14944. category: 'actions',
  14945. fn: function (){
  14946. var self=this;
  14947. return smalltalk.withContext(function($ctx1) {
  14948. self._reset();
  14949. self._setStreamSize_((0));
  14950. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})},
  14951. args: [],
  14952. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  14953. messageSends: ["reset", "setStreamSize:"],
  14954. referencedClasses: []
  14955. }),
  14956. smalltalk.Stream);
  14957. smalltalk.addMethod(
  14958. smalltalk.method({
  14959. selector: "setCollection:",
  14960. category: 'accessing',
  14961. fn: function (aCollection){
  14962. var self=this;
  14963. return smalltalk.withContext(function($ctx1) {
  14964. self["@collection"]=aCollection;
  14965. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})},
  14966. args: ["aCollection"],
  14967. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  14968. messageSends: [],
  14969. referencedClasses: []
  14970. }),
  14971. smalltalk.Stream);
  14972. smalltalk.addMethod(
  14973. smalltalk.method({
  14974. selector: "setStreamSize:",
  14975. category: 'accessing',
  14976. fn: function (anInteger){
  14977. var self=this;
  14978. return smalltalk.withContext(function($ctx1) {
  14979. self["@streamSize"]=anInteger;
  14980. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})},
  14981. args: ["anInteger"],
  14982. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  14983. messageSends: [],
  14984. referencedClasses: []
  14985. }),
  14986. smalltalk.Stream);
  14987. smalltalk.addMethod(
  14988. smalltalk.method({
  14989. selector: "setToEnd",
  14990. category: 'positioning',
  14991. fn: function (){
  14992. var self=this;
  14993. return smalltalk.withContext(function($ctx1) {
  14994. self._position_(self._size());
  14995. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})},
  14996. args: [],
  14997. source: "setToEnd\x0a\x09self position: self size",
  14998. messageSends: ["position:", "size"],
  14999. referencedClasses: []
  15000. }),
  15001. smalltalk.Stream);
  15002. smalltalk.addMethod(
  15003. smalltalk.method({
  15004. selector: "size",
  15005. category: 'accessing',
  15006. fn: function (){
  15007. var self=this;
  15008. return smalltalk.withContext(function($ctx1) {
  15009. var $1;
  15010. $1=self._streamSize();
  15011. return $1;
  15012. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})},
  15013. args: [],
  15014. source: "size\x0a\x09^self streamSize",
  15015. messageSends: ["streamSize"],
  15016. referencedClasses: []
  15017. }),
  15018. smalltalk.Stream);
  15019. smalltalk.addMethod(
  15020. smalltalk.method({
  15021. selector: "skip:",
  15022. category: 'positioning',
  15023. fn: function (anInteger){
  15024. var self=this;
  15025. return smalltalk.withContext(function($ctx1) {
  15026. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  15027. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})},
  15028. args: ["anInteger"],
  15029. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  15030. messageSends: ["position:", "min:max:", "size", "+", "position"],
  15031. referencedClasses: []
  15032. }),
  15033. smalltalk.Stream);
  15034. smalltalk.addMethod(
  15035. smalltalk.method({
  15036. selector: "streamSize",
  15037. category: 'accessing',
  15038. fn: function (){
  15039. var self=this;
  15040. return smalltalk.withContext(function($ctx1) {
  15041. var $1;
  15042. $1=self["@streamSize"];
  15043. return $1;
  15044. }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})},
  15045. args: [],
  15046. source: "streamSize\x0a\x09^streamSize",
  15047. messageSends: [],
  15048. referencedClasses: []
  15049. }),
  15050. smalltalk.Stream);
  15051. smalltalk.addMethod(
  15052. smalltalk.method({
  15053. selector: "write:",
  15054. category: 'writing',
  15055. fn: function (anObject){
  15056. var self=this;
  15057. return smalltalk.withContext(function($ctx1) {
  15058. _st(anObject)._putOn_(self);
  15059. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})},
  15060. args: ["anObject"],
  15061. source: "write: anObject\x0a\x09anObject putOn: self",
  15062. messageSends: ["putOn:"],
  15063. referencedClasses: []
  15064. }),
  15065. smalltalk.Stream);
  15066. smalltalk.addMethod(
  15067. smalltalk.method({
  15068. selector: "on:",
  15069. category: 'instance creation',
  15070. fn: function (aCollection){
  15071. var self=this;
  15072. return smalltalk.withContext(function($ctx1) {
  15073. var $2,$3,$1;
  15074. $2=self._new();
  15075. _st($2)._setCollection_(aCollection);
  15076. _st($2)._setStreamSize_(_st(aCollection)._size());
  15077. $3=_st($2)._yourself();
  15078. $1=$3;
  15079. return $1;
  15080. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})},
  15081. args: ["aCollection"],
  15082. source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  15083. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  15084. referencedClasses: []
  15085. }),
  15086. smalltalk.Stream.klass);
  15087. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  15088. smalltalk.StringStream.comment="I am a Stream specific to `String` objects.";
  15089. smalltalk.addMethod(
  15090. smalltalk.method({
  15091. selector: "cr",
  15092. category: 'writing',
  15093. fn: function (){
  15094. var self=this;
  15095. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15096. return smalltalk.withContext(function($ctx1) {
  15097. var $1;
  15098. $1=self._nextPutAll_(_st($String())._cr());
  15099. return $1;
  15100. }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})},
  15101. args: [],
  15102. source: "cr\x0a\x09^self nextPutAll: String cr",
  15103. messageSends: ["nextPutAll:", "cr"],
  15104. referencedClasses: ["String"]
  15105. }),
  15106. smalltalk.StringStream);
  15107. smalltalk.addMethod(
  15108. smalltalk.method({
  15109. selector: "crlf",
  15110. category: 'writing',
  15111. fn: function (){
  15112. var self=this;
  15113. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15114. return smalltalk.withContext(function($ctx1) {
  15115. var $1;
  15116. $1=self._nextPutAll_(_st($String())._crlf());
  15117. return $1;
  15118. }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})},
  15119. args: [],
  15120. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  15121. messageSends: ["nextPutAll:", "crlf"],
  15122. referencedClasses: ["String"]
  15123. }),
  15124. smalltalk.StringStream);
  15125. smalltalk.addMethod(
  15126. smalltalk.method({
  15127. selector: "lf",
  15128. category: 'writing',
  15129. fn: function (){
  15130. var self=this;
  15131. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15132. return smalltalk.withContext(function($ctx1) {
  15133. var $1;
  15134. $1=self._nextPutAll_(_st($String())._lf());
  15135. return $1;
  15136. }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})},
  15137. args: [],
  15138. source: "lf\x0a\x09^self nextPutAll: String lf",
  15139. messageSends: ["nextPutAll:", "lf"],
  15140. referencedClasses: ["String"]
  15141. }),
  15142. smalltalk.StringStream);
  15143. smalltalk.addMethod(
  15144. smalltalk.method({
  15145. selector: "next:",
  15146. category: 'reading',
  15147. fn: function (anInteger){
  15148. var self=this;
  15149. var tempCollection;
  15150. return smalltalk.withContext(function($ctx1) {
  15151. var $1,$2;
  15152. tempCollection=_st(_st(self._collection())._class())._new();
  15153. _st(anInteger)._timesRepeat_((function(){
  15154. return smalltalk.withContext(function($ctx2) {
  15155. $1=self._atEnd();
  15156. if(! smalltalk.assert($1)){
  15157. tempCollection=_st(tempCollection).__comma(self._next());
  15158. return tempCollection;
  15159. };
  15160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15161. $2=tempCollection;
  15162. return $2;
  15163. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.StringStream)})},
  15164. args: ["anInteger"],
  15165. 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",
  15166. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  15167. referencedClasses: []
  15168. }),
  15169. smalltalk.StringStream);
  15170. smalltalk.addMethod(
  15171. smalltalk.method({
  15172. selector: "nextPut:",
  15173. category: 'writing',
  15174. fn: function (aString){
  15175. var self=this;
  15176. return smalltalk.withContext(function($ctx1) {
  15177. self._nextPutAll_(aString);
  15178. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})},
  15179. args: ["aString"],
  15180. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  15181. messageSends: ["nextPutAll:"],
  15182. referencedClasses: []
  15183. }),
  15184. smalltalk.StringStream);
  15185. smalltalk.addMethod(
  15186. smalltalk.method({
  15187. selector: "nextPutAll:",
  15188. category: 'writing',
  15189. fn: function (aString){
  15190. var self=this;
  15191. var pre,post;
  15192. return smalltalk.withContext(function($ctx1) {
  15193. var $1;
  15194. $1=self._atEnd();
  15195. if(smalltalk.assert($1)){
  15196. self._setCollection_(_st(self._collection()).__comma(aString));
  15197. } else {
  15198. pre=_st(self._collection())._copyFrom_to_((1),self._position());
  15199. pre;
  15200. post=_st(self._collection())._copyFrom_to_(_st(_st(self._position()).__plus((1))).__plus(_st(aString)._size()),_st(self._collection())._size());
  15201. post;
  15202. self._setCollection_(_st(_st(pre).__comma(aString)).__comma(post));
  15203. };
  15204. self._position_(_st(self._position()).__plus(_st(aString)._size()));
  15205. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15206. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.StringStream)})},
  15207. args: ["aString"],
  15208. 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)",
  15209. messageSends: ["ifTrue:ifFalse:", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "atEnd", "position:", "setStreamSize:", "max:", "streamSize"],
  15210. referencedClasses: []
  15211. }),
  15212. smalltalk.StringStream);
  15213. smalltalk.addMethod(
  15214. smalltalk.method({
  15215. selector: "nextPutString:",
  15216. category: 'writing',
  15217. fn: function (aString){
  15218. var self=this;
  15219. return smalltalk.withContext(function($ctx1) {
  15220. self._nextPutAll_(aString);
  15221. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})},
  15222. args: ["aString"],
  15223. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  15224. messageSends: ["nextPutAll:"],
  15225. referencedClasses: []
  15226. }),
  15227. smalltalk.StringStream);
  15228. smalltalk.addMethod(
  15229. smalltalk.method({
  15230. selector: "space",
  15231. category: 'writing',
  15232. fn: function (){
  15233. var self=this;
  15234. return smalltalk.withContext(function($ctx1) {
  15235. self._nextPut_(" ");
  15236. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})},
  15237. args: [],
  15238. source: "space\x0a\x09self nextPut: ' '",
  15239. messageSends: ["nextPut:"],
  15240. referencedClasses: []
  15241. }),
  15242. smalltalk.StringStream);
  15243. smalltalk.addMethod(
  15244. smalltalk.method({
  15245. selector: "tab",
  15246. category: 'writing',
  15247. fn: function (){
  15248. var self=this;
  15249. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15250. return smalltalk.withContext(function($ctx1) {
  15251. var $1;
  15252. $1=self._nextPutAll_(_st($String())._tab());
  15253. return $1;
  15254. }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})},
  15255. args: [],
  15256. source: "tab\x0a\x09^self nextPutAll: String tab",
  15257. messageSends: ["nextPutAll:", "tab"],
  15258. referencedClasses: ["String"]
  15259. }),
  15260. smalltalk.StringStream);
  15261. smalltalk.addPackage('Kernel-Exceptions');
  15262. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  15263. smalltalk.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.";
  15264. smalltalk.addMethod(
  15265. smalltalk.method({
  15266. selector: "context",
  15267. category: 'accessing',
  15268. fn: function (){
  15269. var self=this;
  15270. return smalltalk.withContext(function($ctx1) {
  15271. return self.context;
  15272. return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
  15273. args: [],
  15274. source: "context\x0a\x09<return self.context>",
  15275. messageSends: [],
  15276. referencedClasses: []
  15277. }),
  15278. smalltalk.Error);
  15279. smalltalk.addMethod(
  15280. smalltalk.method({
  15281. selector: "initialize",
  15282. category: 'initialization',
  15283. fn: function (){
  15284. var self=this;
  15285. return smalltalk.withContext(function($ctx1) {
  15286. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  15287. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
  15288. args: [],
  15289. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  15290. messageSends: ["messageText:", ",", "name", "class"],
  15291. referencedClasses: []
  15292. }),
  15293. smalltalk.Error);
  15294. smalltalk.addMethod(
  15295. smalltalk.method({
  15296. selector: "isSmalltalkError",
  15297. category: 'testing',
  15298. fn: function (){
  15299. var self=this;
  15300. return smalltalk.withContext(function($ctx1) {
  15301. return self.smalltalkError === true;
  15302. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
  15303. args: [],
  15304. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  15305. messageSends: [],
  15306. referencedClasses: []
  15307. }),
  15308. smalltalk.Error);
  15309. smalltalk.addMethod(
  15310. smalltalk.method({
  15311. selector: "jsStack",
  15312. category: 'accessing',
  15313. fn: function (){
  15314. var self=this;
  15315. return smalltalk.withContext(function($ctx1) {
  15316. return self.stack;
  15317. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
  15318. args: [],
  15319. source: "jsStack\x0a\x09<return self.stack>",
  15320. messageSends: [],
  15321. referencedClasses: []
  15322. }),
  15323. smalltalk.Error);
  15324. smalltalk.addMethod(
  15325. smalltalk.method({
  15326. selector: "messageText",
  15327. category: 'accessing',
  15328. fn: function (){
  15329. var self=this;
  15330. return smalltalk.withContext(function($ctx1) {
  15331. var $1;
  15332. $1=self["@messageText"];
  15333. return $1;
  15334. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
  15335. args: [],
  15336. source: "messageText\x0a\x09^messageText",
  15337. messageSends: [],
  15338. referencedClasses: []
  15339. }),
  15340. smalltalk.Error);
  15341. smalltalk.addMethod(
  15342. smalltalk.method({
  15343. selector: "messageText:",
  15344. category: 'accessing',
  15345. fn: function (aString){
  15346. var self=this;
  15347. return smalltalk.withContext(function($ctx1) {
  15348. self["@messageText"]=aString;
  15349. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
  15350. args: ["aString"],
  15351. source: "messageText: aString\x0a\x09messageText := aString",
  15352. messageSends: [],
  15353. referencedClasses: []
  15354. }),
  15355. smalltalk.Error);
  15356. smalltalk.addMethod(
  15357. smalltalk.method({
  15358. selector: "resignal",
  15359. category: 'signaling',
  15360. fn: function (){
  15361. var self=this;
  15362. return smalltalk.withContext(function($ctx1) {
  15363. throw(self);
  15364. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},smalltalk.Error)})},
  15365. args: [],
  15366. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<throw(self)>",
  15367. messageSends: [],
  15368. referencedClasses: []
  15369. }),
  15370. smalltalk.Error);
  15371. smalltalk.addMethod(
  15372. smalltalk.method({
  15373. selector: "signal",
  15374. category: 'signaling',
  15375. fn: function (){
  15376. var self=this;
  15377. return smalltalk.withContext(function($ctx1) {
  15378. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  15379. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
  15380. args: [],
  15381. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  15382. messageSends: [],
  15383. referencedClasses: []
  15384. }),
  15385. smalltalk.Error);
  15386. smalltalk.addMethod(
  15387. smalltalk.method({
  15388. selector: "signal:",
  15389. category: 'signaling',
  15390. fn: function (aString){
  15391. var self=this;
  15392. return smalltalk.withContext(function($ctx1) {
  15393. self._messageText_(aString);
  15394. self._signal();
  15395. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
  15396. args: ["aString"],
  15397. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  15398. messageSends: ["messageText:", "signal"],
  15399. referencedClasses: []
  15400. }),
  15401. smalltalk.Error);
  15402. smalltalk.addMethod(
  15403. smalltalk.method({
  15404. selector: "heliosClass",
  15405. category: 'helios',
  15406. fn: function (){
  15407. var self=this;
  15408. return smalltalk.withContext(function($ctx1) {
  15409. return "exception";
  15410. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Error.klass)})},
  15411. args: [],
  15412. source: "heliosClass\x0a\x09^ 'exception'",
  15413. messageSends: [],
  15414. referencedClasses: []
  15415. }),
  15416. smalltalk.Error.klass);
  15417. smalltalk.addMethod(
  15418. smalltalk.method({
  15419. selector: "signal",
  15420. category: 'instance creation',
  15421. fn: function (){
  15422. var self=this;
  15423. return smalltalk.withContext(function($ctx1) {
  15424. var $1;
  15425. $1=_st(self._new())._signal();
  15426. return $1;
  15427. }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
  15428. args: [],
  15429. source: "signal\x0a\x09^self new signal",
  15430. messageSends: ["signal", "new"],
  15431. referencedClasses: []
  15432. }),
  15433. smalltalk.Error.klass);
  15434. smalltalk.addMethod(
  15435. smalltalk.method({
  15436. selector: "signal:",
  15437. category: 'instance creation',
  15438. fn: function (aString){
  15439. var self=this;
  15440. return smalltalk.withContext(function($ctx1) {
  15441. var $1;
  15442. $1=_st(self._new())._signal_(aString);
  15443. return $1;
  15444. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
  15445. args: ["aString"],
  15446. source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
  15447. messageSends: ["signal:", "new"],
  15448. referencedClasses: []
  15449. }),
  15450. smalltalk.Error.klass);
  15451. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  15452. smalltalk.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:`";
  15453. smalltalk.addMethod(
  15454. smalltalk.method({
  15455. selector: "context:",
  15456. category: 'accessing',
  15457. fn: function (aMethodContext){
  15458. var self=this;
  15459. return smalltalk.withContext(function($ctx1) {
  15460. self.context = aMethodContext;
  15461. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})},
  15462. args: ["aMethodContext"],
  15463. 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>",
  15464. messageSends: [],
  15465. referencedClasses: []
  15466. }),
  15467. smalltalk.JavaScriptException);
  15468. smalltalk.addMethod(
  15469. smalltalk.method({
  15470. selector: "exception",
  15471. category: 'accessing',
  15472. fn: function (){
  15473. var self=this;
  15474. return smalltalk.withContext(function($ctx1) {
  15475. var $1;
  15476. $1=self["@exception"];
  15477. return $1;
  15478. }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
  15479. args: [],
  15480. source: "exception\x0a\x09^ exception",
  15481. messageSends: [],
  15482. referencedClasses: []
  15483. }),
  15484. smalltalk.JavaScriptException);
  15485. smalltalk.addMethod(
  15486. smalltalk.method({
  15487. selector: "exception:",
  15488. category: 'accessing',
  15489. fn: function (anException){
  15490. var self=this;
  15491. return smalltalk.withContext(function($ctx1) {
  15492. self["@exception"]=anException;
  15493. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
  15494. args: ["anException"],
  15495. source: "exception: anException\x0a\x09exception := anException",
  15496. messageSends: [],
  15497. referencedClasses: []
  15498. }),
  15499. smalltalk.JavaScriptException);
  15500. smalltalk.addMethod(
  15501. smalltalk.method({
  15502. selector: "messageText",
  15503. category: 'accessing',
  15504. fn: function (){
  15505. var self=this;
  15506. return smalltalk.withContext(function($ctx1) {
  15507. return 'JavaScript exception: ' + self["@exception"].toString();
  15508. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
  15509. args: [],
  15510. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  15511. messageSends: [],
  15512. referencedClasses: []
  15513. }),
  15514. smalltalk.JavaScriptException);
  15515. smalltalk.addMethod(
  15516. smalltalk.method({
  15517. selector: "on:",
  15518. category: 'instance creation',
  15519. fn: function (anException){
  15520. var self=this;
  15521. return smalltalk.withContext(function($ctx1) {
  15522. var $2,$3,$1;
  15523. $2=self._new();
  15524. _st($2)._exception_(anException);
  15525. $3=_st($2)._yourself();
  15526. $1=$3;
  15527. return $1;
  15528. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
  15529. args: ["anException"],
  15530. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  15531. messageSends: ["exception:", "new", "yourself"],
  15532. referencedClasses: []
  15533. }),
  15534. smalltalk.JavaScriptException.klass);
  15535. smalltalk.addMethod(
  15536. smalltalk.method({
  15537. selector: "on:context:",
  15538. category: 'instance creation',
  15539. fn: function (anException,aMethodContext){
  15540. var self=this;
  15541. return smalltalk.withContext(function($ctx1) {
  15542. var $2,$3,$1;
  15543. $2=self._new();
  15544. _st($2)._exception_(anException);
  15545. _st($2)._context_(aMethodContext);
  15546. $3=_st($2)._yourself();
  15547. $1=$3;
  15548. return $1;
  15549. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})},
  15550. args: ["anException", "aMethodContext"],
  15551. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  15552. messageSends: ["exception:", "new", "context:", "yourself"],
  15553. referencedClasses: []
  15554. }),
  15555. smalltalk.JavaScriptException.klass);
  15556. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  15557. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  15558. smalltalk.addMethod(
  15559. smalltalk.method({
  15560. selector: "message",
  15561. category: 'accessing',
  15562. fn: function (){
  15563. var self=this;
  15564. return smalltalk.withContext(function($ctx1) {
  15565. var $1;
  15566. $1=self["@message"];
  15567. return $1;
  15568. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
  15569. args: [],
  15570. source: "message\x0a\x09^message",
  15571. messageSends: [],
  15572. referencedClasses: []
  15573. }),
  15574. smalltalk.MessageNotUnderstood);
  15575. smalltalk.addMethod(
  15576. smalltalk.method({
  15577. selector: "message:",
  15578. category: 'accessing',
  15579. fn: function (aMessage){
  15580. var self=this;
  15581. return smalltalk.withContext(function($ctx1) {
  15582. self["@message"]=aMessage;
  15583. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
  15584. args: ["aMessage"],
  15585. source: "message: aMessage\x0a\x09message := aMessage",
  15586. messageSends: [],
  15587. referencedClasses: []
  15588. }),
  15589. smalltalk.MessageNotUnderstood);
  15590. smalltalk.addMethod(
  15591. smalltalk.method({
  15592. selector: "messageText",
  15593. category: 'accessing',
  15594. fn: function (){
  15595. var self=this;
  15596. return smalltalk.withContext(function($ctx1) {
  15597. var $1;
  15598. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  15599. return $1;
  15600. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  15601. args: [],
  15602. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  15603. messageSends: [",", "selector", "message", "asString", "receiver"],
  15604. referencedClasses: []
  15605. }),
  15606. smalltalk.MessageNotUnderstood);
  15607. smalltalk.addMethod(
  15608. smalltalk.method({
  15609. selector: "receiver",
  15610. category: 'accessing',
  15611. fn: function (){
  15612. var self=this;
  15613. return smalltalk.withContext(function($ctx1) {
  15614. var $1;
  15615. $1=self["@receiver"];
  15616. return $1;
  15617. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  15618. args: [],
  15619. source: "receiver\x0a\x09^receiver",
  15620. messageSends: [],
  15621. referencedClasses: []
  15622. }),
  15623. smalltalk.MessageNotUnderstood);
  15624. smalltalk.addMethod(
  15625. smalltalk.method({
  15626. selector: "receiver:",
  15627. category: 'accessing',
  15628. fn: function (anObject){
  15629. var self=this;
  15630. return smalltalk.withContext(function($ctx1) {
  15631. self["@receiver"]=anObject;
  15632. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  15633. args: ["anObject"],
  15634. source: "receiver: anObject\x0a\x09receiver := anObject",
  15635. messageSends: [],
  15636. referencedClasses: []
  15637. }),
  15638. smalltalk.MessageNotUnderstood);
  15639. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  15640. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  15641. smalltalk.addMethod(
  15642. smalltalk.method({
  15643. selector: "object",
  15644. category: 'accessing',
  15645. fn: function (){
  15646. var self=this;
  15647. return smalltalk.withContext(function($ctx1) {
  15648. var $1;
  15649. $1=self["@object"];
  15650. return $1;
  15651. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  15652. args: [],
  15653. source: "object\x0a\x09^ object",
  15654. messageSends: [],
  15655. referencedClasses: []
  15656. }),
  15657. smalltalk.NonBooleanReceiver);
  15658. smalltalk.addMethod(
  15659. smalltalk.method({
  15660. selector: "object:",
  15661. category: 'accessing',
  15662. fn: function (anObject){
  15663. var self=this;
  15664. return smalltalk.withContext(function($ctx1) {
  15665. self["@object"]=anObject;
  15666. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  15667. args: ["anObject"],
  15668. source: "object: anObject\x0a\x09object := anObject",
  15669. messageSends: [],
  15670. referencedClasses: []
  15671. }),
  15672. smalltalk.NonBooleanReceiver);
  15673. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  15674. smalltalk.ErrorHandler.comment="I am used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console.";
  15675. smalltalk.addMethod(
  15676. smalltalk.method({
  15677. selector: "handleError:",
  15678. category: 'error handling',
  15679. fn: function (anError){
  15680. var self=this;
  15681. return smalltalk.withContext(function($ctx1) {
  15682. var $1;
  15683. $1=_st(anError)._context();
  15684. if(($receiver = $1) == nil || $receiver == undefined){
  15685. $1;
  15686. } else {
  15687. self._logErrorContext_(_st(anError)._context());
  15688. };
  15689. self._logError_(anError);
  15690. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  15691. args: ["anError"],
  15692. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  15693. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  15694. referencedClasses: []
  15695. }),
  15696. smalltalk.ErrorHandler);
  15697. smalltalk.addMethod(
  15698. smalltalk.method({
  15699. selector: "log:",
  15700. category: 'private',
  15701. fn: function (aString){
  15702. var self=this;
  15703. return smalltalk.withContext(function($ctx1) {
  15704. _st(console)._log_(aString);
  15705. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  15706. args: ["aString"],
  15707. source: "log: aString\x0a\x09console log: aString",
  15708. messageSends: ["log:"],
  15709. referencedClasses: []
  15710. }),
  15711. smalltalk.ErrorHandler);
  15712. smalltalk.addMethod(
  15713. smalltalk.method({
  15714. selector: "logContext:",
  15715. category: 'private',
  15716. fn: function (aContext){
  15717. var self=this;
  15718. return smalltalk.withContext(function($ctx1) {
  15719. var $1;
  15720. $1=_st(aContext)._home();
  15721. if(($receiver = $1) == nil || $receiver == undefined){
  15722. $1;
  15723. } else {
  15724. self._logContext_(_st(aContext)._home());
  15725. };
  15726. self._log_(_st(aContext)._asString());
  15727. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  15728. args: ["aContext"],
  15729. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext asString",
  15730. messageSends: ["ifNotNil:", "logContext:", "home", "log:", "asString"],
  15731. referencedClasses: []
  15732. }),
  15733. smalltalk.ErrorHandler);
  15734. smalltalk.addMethod(
  15735. smalltalk.method({
  15736. selector: "logError:",
  15737. category: 'private',
  15738. fn: function (anError){
  15739. var self=this;
  15740. return smalltalk.withContext(function($ctx1) {
  15741. self._log_(_st(anError)._messageText());
  15742. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  15743. args: ["anError"],
  15744. source: "logError: anError\x0a\x09self log: anError messageText",
  15745. messageSends: ["log:", "messageText"],
  15746. referencedClasses: []
  15747. }),
  15748. smalltalk.ErrorHandler);
  15749. smalltalk.addMethod(
  15750. smalltalk.method({
  15751. selector: "logErrorContext:",
  15752. category: 'private',
  15753. fn: function (aContext){
  15754. var self=this;
  15755. return smalltalk.withContext(function($ctx1) {
  15756. var $1,$2;
  15757. $1=aContext;
  15758. if(($receiver = $1) == nil || $receiver == undefined){
  15759. $1;
  15760. } else {
  15761. $2=_st(aContext)._home();
  15762. if(($receiver = $2) == nil || $receiver == undefined){
  15763. $2;
  15764. } else {
  15765. self._logContext_(_st(aContext)._home());
  15766. };
  15767. };
  15768. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  15769. args: ["aContext"],
  15770. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  15771. messageSends: ["ifNotNil:", "logContext:", "home"],
  15772. referencedClasses: []
  15773. }),
  15774. smalltalk.ErrorHandler);
  15775. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  15776. smalltalk.addMethod(
  15777. smalltalk.method({
  15778. selector: "current",
  15779. category: 'accessing',
  15780. fn: function (){
  15781. var self=this;
  15782. return smalltalk.withContext(function($ctx1) {
  15783. var $2,$1;
  15784. $2=self["@current"];
  15785. if(($receiver = $2) == nil || $receiver == undefined){
  15786. self["@current"]=self._new();
  15787. $1=self["@current"];
  15788. } else {
  15789. $1=$2;
  15790. };
  15791. return $1;
  15792. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  15793. args: [],
  15794. source: "current\x0a\x09^current ifNil: [current := self new]",
  15795. messageSends: ["ifNil:", "new"],
  15796. referencedClasses: []
  15797. }),
  15798. smalltalk.ErrorHandler.klass);
  15799. smalltalk.addMethod(
  15800. smalltalk.method({
  15801. selector: "initialize",
  15802. category: 'initialization',
  15803. fn: function (){
  15804. var self=this;
  15805. return smalltalk.withContext(function($ctx1) {
  15806. self._register();
  15807. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  15808. args: [],
  15809. source: "initialize\x0a\x09self register",
  15810. messageSends: ["register"],
  15811. referencedClasses: []
  15812. }),
  15813. smalltalk.ErrorHandler.klass);
  15814. smalltalk.addMethod(
  15815. smalltalk.method({
  15816. selector: "register",
  15817. category: 'initialization',
  15818. fn: function (){
  15819. var self=this;
  15820. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  15821. return smalltalk.withContext(function($ctx1) {
  15822. _st($ErrorHandler())._setCurrent_(self._new());
  15823. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  15824. args: [],
  15825. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  15826. messageSends: ["setCurrent:", "new"],
  15827. referencedClasses: ["ErrorHandler"]
  15828. }),
  15829. smalltalk.ErrorHandler.klass);
  15830. smalltalk.addMethod(
  15831. smalltalk.method({
  15832. selector: "setCurrent:",
  15833. category: 'accessing',
  15834. fn: function (anHandler){
  15835. var self=this;
  15836. return smalltalk.withContext(function($ctx1) {
  15837. self["@current"]=anHandler;
  15838. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  15839. args: ["anHandler"],
  15840. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  15841. messageSends: [],
  15842. referencedClasses: []
  15843. }),
  15844. smalltalk.ErrorHandler.klass);
  15845. smalltalk.addPackage('Kernel-Transcript');
  15846. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  15847. smalltalk.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  15848. smalltalk.addMethod(
  15849. smalltalk.method({
  15850. selector: "clear",
  15851. category: 'printing',
  15852. fn: function (){
  15853. var self=this;
  15854. return smalltalk.withContext(function($ctx1) {
  15855. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
  15856. args: [],
  15857. source: "clear\x0a\x09\x22no op\x22",
  15858. messageSends: [],
  15859. referencedClasses: []
  15860. }),
  15861. smalltalk.ConsoleTranscript);
  15862. smalltalk.addMethod(
  15863. smalltalk.method({
  15864. selector: "cr",
  15865. category: 'printing',
  15866. fn: function (){
  15867. var self=this;
  15868. return smalltalk.withContext(function($ctx1) {
  15869. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
  15870. args: [],
  15871. source: "cr\x0a\x09\x22no op\x22",
  15872. messageSends: [],
  15873. referencedClasses: []
  15874. }),
  15875. smalltalk.ConsoleTranscript);
  15876. smalltalk.addMethod(
  15877. smalltalk.method({
  15878. selector: "open",
  15879. category: 'actions',
  15880. fn: function (){
  15881. var self=this;
  15882. return smalltalk.withContext(function($ctx1) {
  15883. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
  15884. args: [],
  15885. source: "open",
  15886. messageSends: [],
  15887. referencedClasses: []
  15888. }),
  15889. smalltalk.ConsoleTranscript);
  15890. smalltalk.addMethod(
  15891. smalltalk.method({
  15892. selector: "show:",
  15893. category: 'printing',
  15894. fn: function (anObject){
  15895. var self=this;
  15896. return smalltalk.withContext(function($ctx1) {
  15897. console.log(String(_st(anObject)._asString()));
  15898. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
  15899. args: ["anObject"],
  15900. 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()))>",
  15901. messageSends: [],
  15902. referencedClasses: []
  15903. }),
  15904. smalltalk.ConsoleTranscript);
  15905. smalltalk.addMethod(
  15906. smalltalk.method({
  15907. selector: "initialize",
  15908. category: 'initialization',
  15909. fn: function (){
  15910. var self=this;
  15911. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  15912. return smalltalk.withContext(function($ctx1) {
  15913. _st($Transcript())._register_(self._new());
  15914. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
  15915. args: [],
  15916. source: "initialize\x0a\x09Transcript register: self new",
  15917. messageSends: ["register:", "new"],
  15918. referencedClasses: ["Transcript"]
  15919. }),
  15920. smalltalk.ConsoleTranscript.klass);
  15921. smalltalk.addClass('Transcript', smalltalk.Object, [], 'Kernel-Transcript');
  15922. smalltalk.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.";
  15923. smalltalk.Transcript.klass.iVarNames = ['current'];
  15924. smalltalk.addMethod(
  15925. smalltalk.method({
  15926. selector: "clear",
  15927. category: 'printing',
  15928. fn: function (){
  15929. var self=this;
  15930. return smalltalk.withContext(function($ctx1) {
  15931. _st(self._current())._clear();
  15932. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
  15933. args: [],
  15934. source: "clear\x0a\x09self current clear",
  15935. messageSends: ["clear", "current"],
  15936. referencedClasses: []
  15937. }),
  15938. smalltalk.Transcript.klass);
  15939. smalltalk.addMethod(
  15940. smalltalk.method({
  15941. selector: "cr",
  15942. category: 'printing',
  15943. fn: function (){
  15944. var self=this;
  15945. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  15946. return smalltalk.withContext(function($ctx1) {
  15947. _st(self._current())._show_(_st($String())._cr());
  15948. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
  15949. args: [],
  15950. source: "cr\x0a\x09self current show: String cr",
  15951. messageSends: ["show:", "cr", "current"],
  15952. referencedClasses: ["String"]
  15953. }),
  15954. smalltalk.Transcript.klass);
  15955. smalltalk.addMethod(
  15956. smalltalk.method({
  15957. selector: "current",
  15958. category: 'instance creation',
  15959. fn: function (){
  15960. var self=this;
  15961. return smalltalk.withContext(function($ctx1) {
  15962. var $1;
  15963. $1=self["@current"];
  15964. return $1;
  15965. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
  15966. args: [],
  15967. source: "current\x0a\x09^current",
  15968. messageSends: [],
  15969. referencedClasses: []
  15970. }),
  15971. smalltalk.Transcript.klass);
  15972. smalltalk.addMethod(
  15973. smalltalk.method({
  15974. selector: "inspect:",
  15975. category: 'printing',
  15976. fn: function (anObject){
  15977. var self=this;
  15978. return smalltalk.withContext(function($ctx1) {
  15979. self._show_(anObject);
  15980. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Transcript.klass)})},
  15981. args: ["anObject"],
  15982. source: "inspect: anObject\x0a\x09self show: anObject",
  15983. messageSends: ["show:"],
  15984. referencedClasses: []
  15985. }),
  15986. smalltalk.Transcript.klass);
  15987. smalltalk.addMethod(
  15988. smalltalk.method({
  15989. selector: "new",
  15990. category: 'instance creation',
  15991. fn: function (){
  15992. var self=this;
  15993. return smalltalk.withContext(function($ctx1) {
  15994. self._shouldNotImplement();
  15995. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
  15996. args: [],
  15997. source: "new\x0a\x09self shouldNotImplement",
  15998. messageSends: ["shouldNotImplement"],
  15999. referencedClasses: []
  16000. }),
  16001. smalltalk.Transcript.klass);
  16002. smalltalk.addMethod(
  16003. smalltalk.method({
  16004. selector: "open",
  16005. category: 'instance creation',
  16006. fn: function (){
  16007. var self=this;
  16008. return smalltalk.withContext(function($ctx1) {
  16009. _st(self._current())._open();
  16010. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
  16011. args: [],
  16012. source: "open\x0a\x09self current open",
  16013. messageSends: ["open", "current"],
  16014. referencedClasses: []
  16015. }),
  16016. smalltalk.Transcript.klass);
  16017. smalltalk.addMethod(
  16018. smalltalk.method({
  16019. selector: "register:",
  16020. category: 'instance creation',
  16021. fn: function (aTranscript){
  16022. var self=this;
  16023. return smalltalk.withContext(function($ctx1) {
  16024. self["@current"]=aTranscript;
  16025. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
  16026. args: ["aTranscript"],
  16027. source: "register: aTranscript\x0a\x09current := aTranscript",
  16028. messageSends: [],
  16029. referencedClasses: []
  16030. }),
  16031. smalltalk.Transcript.klass);
  16032. smalltalk.addMethod(
  16033. smalltalk.method({
  16034. selector: "show:",
  16035. category: 'printing',
  16036. fn: function (anObject){
  16037. var self=this;
  16038. return smalltalk.withContext(function($ctx1) {
  16039. _st(self._current())._show_(anObject);
  16040. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
  16041. args: ["anObject"],
  16042. source: "show: anObject\x0a\x09self current show: anObject",
  16043. messageSends: ["show:", "current"],
  16044. referencedClasses: []
  16045. }),
  16046. smalltalk.Transcript.klass);
  16047. smalltalk.addPackage('Kernel-Announcements');
  16048. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  16049. smalltalk.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  16050. smalltalk.addMethod(
  16051. smalltalk.method({
  16052. selector: "announcementClass",
  16053. category: 'accessing',
  16054. fn: function (){
  16055. var self=this;
  16056. return smalltalk.withContext(function($ctx1) {
  16057. var $1;
  16058. $1=self["@announcementClass"];
  16059. return $1;
  16060. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
  16061. args: [],
  16062. source: "announcementClass\x0a\x09^ announcementClass",
  16063. messageSends: [],
  16064. referencedClasses: []
  16065. }),
  16066. smalltalk.AnnouncementSubscription);
  16067. smalltalk.addMethod(
  16068. smalltalk.method({
  16069. selector: "announcementClass:",
  16070. category: 'accessing',
  16071. fn: function (aClass){
  16072. var self=this;
  16073. return smalltalk.withContext(function($ctx1) {
  16074. self["@announcementClass"]=aClass;
  16075. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
  16076. args: ["aClass"],
  16077. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  16078. messageSends: [],
  16079. referencedClasses: []
  16080. }),
  16081. smalltalk.AnnouncementSubscription);
  16082. smalltalk.addMethod(
  16083. smalltalk.method({
  16084. selector: "block",
  16085. category: 'accessing',
  16086. fn: function (){
  16087. var self=this;
  16088. return smalltalk.withContext(function($ctx1) {
  16089. var $1;
  16090. self._deprecatedAPI();
  16091. $1=self._valuable();
  16092. return $1;
  16093. }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
  16094. args: [],
  16095. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  16096. messageSends: ["deprecatedAPI", "valuable"],
  16097. referencedClasses: []
  16098. }),
  16099. smalltalk.AnnouncementSubscription);
  16100. smalltalk.addMethod(
  16101. smalltalk.method({
  16102. selector: "block:",
  16103. category: 'accessing',
  16104. fn: function (aValuable){
  16105. var self=this;
  16106. return smalltalk.withContext(function($ctx1) {
  16107. self._deprecatedAPI();
  16108. self._valuable_(aValuable);
  16109. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  16110. args: ["aValuable"],
  16111. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  16112. messageSends: ["deprecatedAPI", "valuable:"],
  16113. referencedClasses: []
  16114. }),
  16115. smalltalk.AnnouncementSubscription);
  16116. smalltalk.addMethod(
  16117. smalltalk.method({
  16118. selector: "deliver:",
  16119. category: 'announcing',
  16120. fn: function (anAnnouncement){
  16121. var self=this;
  16122. return smalltalk.withContext(function($ctx1) {
  16123. var $1;
  16124. $1=self._handlesAnnouncement_(anAnnouncement);
  16125. if(smalltalk.assert($1)){
  16126. _st(self._valuable())._value_(anAnnouncement);
  16127. };
  16128. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  16129. args: ["anAnnouncement"],
  16130. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self valuable value: anAnnouncement]",
  16131. messageSends: ["ifTrue:", "value:", "valuable", "handlesAnnouncement:"],
  16132. referencedClasses: []
  16133. }),
  16134. smalltalk.AnnouncementSubscription);
  16135. smalltalk.addMethod(
  16136. smalltalk.method({
  16137. selector: "handlesAnnouncement:",
  16138. category: 'announcing',
  16139. fn: function (anAnnouncement){
  16140. var self=this;
  16141. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16142. return smalltalk.withContext(function($ctx1) {
  16143. var $2,$1;
  16144. $2=_st(_st($Smalltalk())._current())._at_(_st(self._announcementClass())._name());
  16145. if(($receiver = $2) == nil || $receiver == undefined){
  16146. return false;
  16147. } else {
  16148. var class_;
  16149. class_=$receiver;
  16150. $1=_st(class_)._includesBehavior_(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()));
  16151. };
  16152. return $1;
  16153. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  16154. args: ["anAnnouncement"],
  16155. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09class includesBehavior: (Smalltalk current at: anAnnouncement class theNonMetaClass name) ]",
  16156. messageSends: ["ifNil:ifNotNil:", "includesBehavior:", "at:", "name", "theNonMetaClass", "class", "current", "announcementClass"],
  16157. referencedClasses: ["Smalltalk"]
  16158. }),
  16159. smalltalk.AnnouncementSubscription);
  16160. smalltalk.addMethod(
  16161. smalltalk.method({
  16162. selector: "receiver",
  16163. category: 'accessing',
  16164. fn: function (){
  16165. var self=this;
  16166. return smalltalk.withContext(function($ctx1) {
  16167. var $1;
  16168. $1=_st(self._valuable())._receiver();
  16169. return $1;
  16170. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AnnouncementSubscription)})},
  16171. args: [],
  16172. source: "receiver\x0a\x09^ self valuable receiver",
  16173. messageSends: ["receiver", "valuable"],
  16174. referencedClasses: []
  16175. }),
  16176. smalltalk.AnnouncementSubscription);
  16177. smalltalk.addMethod(
  16178. smalltalk.method({
  16179. selector: "valuable",
  16180. category: 'accessing',
  16181. fn: function (){
  16182. var self=this;
  16183. return smalltalk.withContext(function($ctx1) {
  16184. var $1;
  16185. $1=self["@valuable"];
  16186. return $1;
  16187. }, function($ctx1) {$ctx1.fill(self,"valuable",{},smalltalk.AnnouncementSubscription)})},
  16188. args: [],
  16189. source: "valuable\x0a\x09^ valuable",
  16190. messageSends: [],
  16191. referencedClasses: []
  16192. }),
  16193. smalltalk.AnnouncementSubscription);
  16194. smalltalk.addMethod(
  16195. smalltalk.method({
  16196. selector: "valuable:",
  16197. category: 'accessing',
  16198. fn: function (aValuable){
  16199. var self=this;
  16200. return smalltalk.withContext(function($ctx1) {
  16201. self["@valuable"]=aValuable;
  16202. return self}, function($ctx1) {$ctx1.fill(self,"valuable:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  16203. args: ["aValuable"],
  16204. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  16205. messageSends: [],
  16206. referencedClasses: []
  16207. }),
  16208. smalltalk.AnnouncementSubscription);
  16209. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  16210. smalltalk.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' ].";
  16211. smalltalk.addMethod(
  16212. smalltalk.method({
  16213. selector: "announce:",
  16214. category: 'announcing',
  16215. fn: function (anAnnouncement){
  16216. var self=this;
  16217. return smalltalk.withContext(function($ctx1) {
  16218. _st(self["@subscriptions"])._do_((function(each){
  16219. return smalltalk.withContext(function($ctx2) {
  16220. return _st(each)._deliver_(anAnnouncement);
  16221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16222. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
  16223. args: ["anAnnouncement"],
  16224. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  16225. messageSends: ["do:", "deliver:"],
  16226. referencedClasses: []
  16227. }),
  16228. smalltalk.Announcer);
  16229. smalltalk.addMethod(
  16230. smalltalk.method({
  16231. selector: "initialize",
  16232. category: 'initialization',
  16233. fn: function (){
  16234. var self=this;
  16235. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  16236. return smalltalk.withContext(function($ctx1) {
  16237. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  16238. self["@subscriptions"]=_st($OrderedCollection())._new();
  16239. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
  16240. args: [],
  16241. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  16242. messageSends: ["initialize", "new"],
  16243. referencedClasses: ["OrderedCollection"]
  16244. }),
  16245. smalltalk.Announcer);
  16246. smalltalk.addMethod(
  16247. smalltalk.method({
  16248. selector: "on:do:",
  16249. category: 'subscribing',
  16250. fn: function (aClass,aBlock){
  16251. var self=this;
  16252. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  16253. return smalltalk.withContext(function($ctx1) {
  16254. var $1,$2;
  16255. $1=_st($AnnouncementSubscription())._new();
  16256. _st($1)._valuable_(aBlock);
  16257. _st($1)._announcementClass_(aClass);
  16258. $2=_st($1)._yourself();
  16259. _st(self["@subscriptions"])._add_($2);
  16260. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
  16261. args: ["aClass", "aBlock"],
  16262. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  16263. messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
  16264. referencedClasses: ["AnnouncementSubscription"]
  16265. }),
  16266. smalltalk.Announcer);
  16267. smalltalk.addMethod(
  16268. smalltalk.method({
  16269. selector: "on:send:to:",
  16270. category: 'subscribing',
  16271. fn: function (aClass,aSelector,anObject){
  16272. var self=this;
  16273. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  16274. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  16275. return smalltalk.withContext(function($ctx1) {
  16276. var $1,$2,$3,$4;
  16277. $1=_st($AnnouncementSubscription())._new();
  16278. $2=_st($MessageSend())._new();
  16279. _st($2)._receiver_(anObject);
  16280. _st($2)._selector_(aSelector);
  16281. $3=_st($2)._yourself();
  16282. _st($1)._valuable_($3);
  16283. _st($1)._announcementClass_(aClass);
  16284. $4=_st($1)._yourself();
  16285. _st(self["@subscriptions"])._add_($4);
  16286. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},smalltalk.Announcer)})},
  16287. args: ["aClass", "aSelector", "anObject"],
  16288. 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)",
  16289. messageSends: ["add:", "valuable:", "receiver:", "new", "selector:", "yourself", "announcementClass:"],
  16290. referencedClasses: ["MessageSend", "AnnouncementSubscription"]
  16291. }),
  16292. smalltalk.Announcer);
  16293. smalltalk.addMethod(
  16294. smalltalk.method({
  16295. selector: "unsubscribe:",
  16296. category: 'subscribing',
  16297. fn: function (anObject){
  16298. var self=this;
  16299. return smalltalk.withContext(function($ctx1) {
  16300. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  16301. return smalltalk.withContext(function($ctx2) {
  16302. return _st(_st(each)._receiver()).__eq(anObject);
  16303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  16304. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},smalltalk.Announcer)})},
  16305. args: ["anObject"],
  16306. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  16307. messageSends: ["reject:", "=", "receiver"],
  16308. referencedClasses: []
  16309. }),
  16310. smalltalk.Announcer);
  16311. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  16312. smalltalk.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`";
  16313. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  16314. smalltalk.addMethod(
  16315. smalltalk.method({
  16316. selector: "current",
  16317. category: 'accessing',
  16318. fn: function (){
  16319. var self=this;
  16320. return smalltalk.withContext(function($ctx1) {
  16321. var $2,$1;
  16322. $2=self["@current"];
  16323. if(($receiver = $2) == nil || $receiver == undefined){
  16324. self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
  16325. $1=self["@current"];
  16326. } else {
  16327. $1=$2;
  16328. };
  16329. return $1;
  16330. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
  16331. args: [],
  16332. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  16333. messageSends: ["ifNil:", "new"],
  16334. referencedClasses: []
  16335. }),
  16336. smalltalk.SystemAnnouncer.klass);
  16337. smalltalk.addMethod(
  16338. smalltalk.method({
  16339. selector: "new",
  16340. category: 'instance creation',
  16341. fn: function (){
  16342. var self=this;
  16343. return smalltalk.withContext(function($ctx1) {
  16344. self._shouldNotImplement();
  16345. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
  16346. args: [],
  16347. source: "new\x0a\x09self shouldNotImplement",
  16348. messageSends: ["shouldNotImplement"],
  16349. referencedClasses: []
  16350. }),
  16351. smalltalk.SystemAnnouncer.klass);
  16352. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  16353. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements";
  16354. smalltalk.addMethod(
  16355. smalltalk.method({
  16356. selector: "theClass",
  16357. category: 'accessing',
  16358. fn: function (){
  16359. var self=this;
  16360. return smalltalk.withContext(function($ctx1) {
  16361. var $1;
  16362. $1=self["@theClass"];
  16363. return $1;
  16364. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
  16365. args: [],
  16366. source: "theClass\x0a\x09^ theClass",
  16367. messageSends: [],
  16368. referencedClasses: []
  16369. }),
  16370. smalltalk.SystemAnnouncement);
  16371. smalltalk.addMethod(
  16372. smalltalk.method({
  16373. selector: "theClass:",
  16374. category: 'accessing',
  16375. fn: function (aClass){
  16376. var self=this;
  16377. return smalltalk.withContext(function($ctx1) {
  16378. self["@theClass"]=aClass;
  16379. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
  16380. args: ["aClass"],
  16381. source: "theClass: aClass\x0a\x09theClass := aClass",
  16382. messageSends: [],
  16383. referencedClasses: []
  16384. }),
  16385. smalltalk.SystemAnnouncement);
  16386. smalltalk.addMethod(
  16387. smalltalk.method({
  16388. selector: "heliosClass",
  16389. category: 'helios',
  16390. fn: function (){
  16391. var self=this;
  16392. return smalltalk.withContext(function($ctx1) {
  16393. return "announcement";
  16394. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
  16395. args: [],
  16396. source: "heliosClass\x0a\x09^ 'announcement'",
  16397. messageSends: [],
  16398. referencedClasses: []
  16399. }),
  16400. smalltalk.SystemAnnouncement.klass);
  16401. smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  16402. smalltalk.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  16403. smalltalk.addMethod(
  16404. smalltalk.method({
  16405. selector: "theClass",
  16406. category: 'accessing',
  16407. fn: function (){
  16408. var self=this;
  16409. return smalltalk.withContext(function($ctx1) {
  16410. var $1;
  16411. $1=self["@theClass"];
  16412. return $1;
  16413. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
  16414. args: [],
  16415. source: "theClass\x0a\x09^ theClass",
  16416. messageSends: [],
  16417. referencedClasses: []
  16418. }),
  16419. smalltalk.ClassAnnouncement);
  16420. smalltalk.addMethod(
  16421. smalltalk.method({
  16422. selector: "theClass:",
  16423. category: 'accessing',
  16424. fn: function (aClass){
  16425. var self=this;
  16426. return smalltalk.withContext(function($ctx1) {
  16427. self["@theClass"]=aClass;
  16428. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
  16429. args: ["aClass"],
  16430. source: "theClass: aClass\x0a\x09theClass := aClass",
  16431. messageSends: [],
  16432. referencedClasses: []
  16433. }),
  16434. smalltalk.ClassAnnouncement);
  16435. smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16436. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  16437. smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16438. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  16439. smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16440. smalltalk.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  16441. smalltalk.addClass('ClassMigrated', smalltalk.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  16442. smalltalk.ClassMigrated.comment="I am emitted when a class is migrated.";
  16443. smalltalk.addMethod(
  16444. smalltalk.method({
  16445. selector: "oldClass",
  16446. category: 'accessing',
  16447. fn: function (){
  16448. var self=this;
  16449. return smalltalk.withContext(function($ctx1) {
  16450. var $1;
  16451. $1=self["@oldClass"];
  16452. return $1;
  16453. }, function($ctx1) {$ctx1.fill(self,"oldClass",{},smalltalk.ClassMigrated)})},
  16454. args: [],
  16455. source: "oldClass\x0a\x09^ oldClass",
  16456. messageSends: [],
  16457. referencedClasses: []
  16458. }),
  16459. smalltalk.ClassMigrated);
  16460. smalltalk.addMethod(
  16461. smalltalk.method({
  16462. selector: "oldClass:",
  16463. category: 'accessing',
  16464. fn: function (aClass){
  16465. var self=this;
  16466. return smalltalk.withContext(function($ctx1) {
  16467. self["@oldClass"]=aClass;
  16468. return self}, function($ctx1) {$ctx1.fill(self,"oldClass:",{aClass:aClass},smalltalk.ClassMigrated)})},
  16469. args: ["aClass"],
  16470. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  16471. messageSends: [],
  16472. referencedClasses: []
  16473. }),
  16474. smalltalk.ClassMigrated);
  16475. smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  16476. smalltalk.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  16477. smalltalk.addMethod(
  16478. smalltalk.method({
  16479. selector: "oldPackage",
  16480. category: 'accessing',
  16481. fn: function (){
  16482. var self=this;
  16483. return smalltalk.withContext(function($ctx1) {
  16484. var $1;
  16485. $1=self["@oldPackage"];
  16486. return $1;
  16487. }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
  16488. args: [],
  16489. source: "oldPackage\x0a\x09^ oldPackage",
  16490. messageSends: [],
  16491. referencedClasses: []
  16492. }),
  16493. smalltalk.ClassMoved);
  16494. smalltalk.addMethod(
  16495. smalltalk.method({
  16496. selector: "oldPackage:",
  16497. category: 'accessing',
  16498. fn: function (aPackage){
  16499. var self=this;
  16500. return smalltalk.withContext(function($ctx1) {
  16501. self["@oldPackage"]=aPackage;
  16502. return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
  16503. args: ["aPackage"],
  16504. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  16505. messageSends: [],
  16506. referencedClasses: []
  16507. }),
  16508. smalltalk.ClassMoved);
  16509. smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16510. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  16511. smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  16512. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  16513. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  16514. smalltalk.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  16515. smalltalk.addMethod(
  16516. smalltalk.method({
  16517. selector: "method",
  16518. category: 'accessing',
  16519. fn: function (){
  16520. var self=this;
  16521. return smalltalk.withContext(function($ctx1) {
  16522. var $1;
  16523. $1=self["@method"];
  16524. return $1;
  16525. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
  16526. args: [],
  16527. source: "method\x0a\x09^ method",
  16528. messageSends: [],
  16529. referencedClasses: []
  16530. }),
  16531. smalltalk.MethodAnnouncement);
  16532. smalltalk.addMethod(
  16533. smalltalk.method({
  16534. selector: "method:",
  16535. category: 'accessing',
  16536. fn: function (aCompiledMethod){
  16537. var self=this;
  16538. return smalltalk.withContext(function($ctx1) {
  16539. self["@method"]=aCompiledMethod;
  16540. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
  16541. args: ["aCompiledMethod"],
  16542. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  16543. messageSends: [],
  16544. referencedClasses: []
  16545. }),
  16546. smalltalk.MethodAnnouncement);
  16547. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  16548. smalltalk.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  16549. smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  16550. smalltalk.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.";
  16551. smalltalk.addMethod(
  16552. smalltalk.method({
  16553. selector: "oldMethod",
  16554. category: 'accessing',
  16555. fn: function (){
  16556. var self=this;
  16557. return smalltalk.withContext(function($ctx1) {
  16558. var $1;
  16559. $1=self["@oldMethod"];
  16560. return $1;
  16561. }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
  16562. args: [],
  16563. source: "oldMethod\x0a\x09^ oldMethod",
  16564. messageSends: [],
  16565. referencedClasses: []
  16566. }),
  16567. smalltalk.MethodModified);
  16568. smalltalk.addMethod(
  16569. smalltalk.method({
  16570. selector: "oldMethod:",
  16571. category: 'accessing',
  16572. fn: function (aMethod){
  16573. var self=this;
  16574. return smalltalk.withContext(function($ctx1) {
  16575. self["@oldMethod"]=aMethod;
  16576. return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
  16577. args: ["aMethod"],
  16578. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  16579. messageSends: [],
  16580. referencedClasses: []
  16581. }),
  16582. smalltalk.MethodModified);
  16583. smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  16584. smalltalk.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  16585. smalltalk.addMethod(
  16586. smalltalk.method({
  16587. selector: "oldProtocol",
  16588. category: 'accessing',
  16589. fn: function (){
  16590. var self=this;
  16591. return smalltalk.withContext(function($ctx1) {
  16592. var $1;
  16593. $1=self["@oldProtocol"];
  16594. return $1;
  16595. }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
  16596. args: [],
  16597. source: "oldProtocol\x0a\x09^ oldProtocol",
  16598. messageSends: [],
  16599. referencedClasses: []
  16600. }),
  16601. smalltalk.MethodMoved);
  16602. smalltalk.addMethod(
  16603. smalltalk.method({
  16604. selector: "oldProtocol:",
  16605. category: 'accessing',
  16606. fn: function (aString){
  16607. var self=this;
  16608. return smalltalk.withContext(function($ctx1) {
  16609. self["@oldProtocol"]=aString;
  16610. return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
  16611. args: ["aString"],
  16612. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  16613. messageSends: [],
  16614. referencedClasses: []
  16615. }),
  16616. smalltalk.MethodMoved);
  16617. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  16618. smalltalk.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  16619. smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  16620. smalltalk.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  16621. smalltalk.addMethod(
  16622. smalltalk.method({
  16623. selector: "package",
  16624. category: 'accessing',
  16625. fn: function (){
  16626. var self=this;
  16627. return smalltalk.withContext(function($ctx1) {
  16628. var $1;
  16629. $1=self["@package"];
  16630. return $1;
  16631. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
  16632. args: [],
  16633. source: "package\x0a\x09^ package",
  16634. messageSends: [],
  16635. referencedClasses: []
  16636. }),
  16637. smalltalk.PackageAnnouncement);
  16638. smalltalk.addMethod(
  16639. smalltalk.method({
  16640. selector: "package:",
  16641. category: 'accessing',
  16642. fn: function (aPackage){
  16643. var self=this;
  16644. return smalltalk.withContext(function($ctx1) {
  16645. self["@package"]=aPackage;
  16646. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
  16647. args: ["aPackage"],
  16648. source: "package: aPackage\x0a\x09package := aPackage",
  16649. messageSends: [],
  16650. referencedClasses: []
  16651. }),
  16652. smalltalk.PackageAnnouncement);
  16653. smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  16654. smalltalk.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  16655. smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  16656. smalltalk.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  16657. smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  16658. smalltalk.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  16659. smalltalk.addMethod(
  16660. smalltalk.method({
  16661. selector: "protocol",
  16662. category: 'accessing',
  16663. fn: function (){
  16664. var self=this;
  16665. return smalltalk.withContext(function($ctx1) {
  16666. var $1;
  16667. $1=self["@protocol"];
  16668. return $1;
  16669. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
  16670. args: [],
  16671. source: "protocol\x0a\x09^ protocol",
  16672. messageSends: [],
  16673. referencedClasses: []
  16674. }),
  16675. smalltalk.ProtocolAnnouncement);
  16676. smalltalk.addMethod(
  16677. smalltalk.method({
  16678. selector: "protocol:",
  16679. category: 'accessing',
  16680. fn: function (aString){
  16681. var self=this;
  16682. return smalltalk.withContext(function($ctx1) {
  16683. self["@protocol"]=aString;
  16684. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
  16685. args: ["aString"],
  16686. source: "protocol: aString\x0a\x09protocol := aString",
  16687. messageSends: [],
  16688. referencedClasses: []
  16689. }),
  16690. smalltalk.ProtocolAnnouncement);
  16691. smalltalk.addMethod(
  16692. smalltalk.method({
  16693. selector: "theClass",
  16694. category: 'accessing',
  16695. fn: function (){
  16696. var self=this;
  16697. return smalltalk.withContext(function($ctx1) {
  16698. var $1;
  16699. $1=self["@theClass"];
  16700. return $1;
  16701. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
  16702. args: [],
  16703. source: "theClass\x0a\x09^ theClass",
  16704. messageSends: [],
  16705. referencedClasses: []
  16706. }),
  16707. smalltalk.ProtocolAnnouncement);
  16708. smalltalk.addMethod(
  16709. smalltalk.method({
  16710. selector: "theClass:",
  16711. category: 'accessing',
  16712. fn: function (aClass){
  16713. var self=this;
  16714. return smalltalk.withContext(function($ctx1) {
  16715. self["@theClass"]=aClass;
  16716. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
  16717. args: ["aClass"],
  16718. source: "theClass: aClass\x0a\x09theClass := aClass",
  16719. messageSends: [],
  16720. referencedClasses: []
  16721. }),
  16722. smalltalk.ProtocolAnnouncement);
  16723. smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  16724. smalltalk.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  16725. smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  16726. smalltalk.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  16727. smalltalk.addPackage('Compiler-Exceptions');
  16728. smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
  16729. smalltalk.CompilerError.comment="I am the common superclass of all compiling errors.";
  16730. smalltalk.addClass('ParseError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  16731. smalltalk.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  16732. smalltalk.addClass('SemanticError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  16733. smalltalk.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";
  16734. smalltalk.addClass('InliningError', smalltalk.SemanticError, [], 'Compiler-Exceptions');
  16735. smalltalk.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  16736. smalltalk.addClass('InvalidAssignmentError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16737. smalltalk.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  16738. smalltalk.addMethod(
  16739. smalltalk.method({
  16740. selector: "messageText",
  16741. category: 'accessing',
  16742. fn: function (){
  16743. var self=this;
  16744. return smalltalk.withContext(function($ctx1) {
  16745. var $1;
  16746. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  16747. return $1;
  16748. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.InvalidAssignmentError)})},
  16749. args: [],
  16750. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  16751. messageSends: [",", "variableName"],
  16752. referencedClasses: []
  16753. }),
  16754. smalltalk.InvalidAssignmentError);
  16755. smalltalk.addMethod(
  16756. smalltalk.method({
  16757. selector: "variableName",
  16758. category: 'accessing',
  16759. fn: function (){
  16760. var self=this;
  16761. return smalltalk.withContext(function($ctx1) {
  16762. var $1;
  16763. $1=self["@variableName"];
  16764. return $1;
  16765. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.InvalidAssignmentError)})},
  16766. args: [],
  16767. source: "variableName\x0a\x09^ variableName",
  16768. messageSends: [],
  16769. referencedClasses: []
  16770. }),
  16771. smalltalk.InvalidAssignmentError);
  16772. smalltalk.addMethod(
  16773. smalltalk.method({
  16774. selector: "variableName:",
  16775. category: 'accessing',
  16776. fn: function (aString){
  16777. var self=this;
  16778. return smalltalk.withContext(function($ctx1) {
  16779. self["@variableName"]=aString;
  16780. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.InvalidAssignmentError)})},
  16781. args: ["aString"],
  16782. source: "variableName: aString\x0a\x09variableName := aString",
  16783. messageSends: [],
  16784. referencedClasses: []
  16785. }),
  16786. smalltalk.InvalidAssignmentError);
  16787. smalltalk.addClass('ShadowingVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16788. smalltalk.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.";
  16789. smalltalk.addMethod(
  16790. smalltalk.method({
  16791. selector: "messageText",
  16792. category: 'accessing',
  16793. fn: function (){
  16794. var self=this;
  16795. return smalltalk.withContext(function($ctx1) {
  16796. var $1;
  16797. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  16798. return $1;
  16799. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.ShadowingVariableError)})},
  16800. args: [],
  16801. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  16802. messageSends: [",", "variableName"],
  16803. referencedClasses: []
  16804. }),
  16805. smalltalk.ShadowingVariableError);
  16806. smalltalk.addMethod(
  16807. smalltalk.method({
  16808. selector: "variableName",
  16809. category: 'accessing',
  16810. fn: function (){
  16811. var self=this;
  16812. return smalltalk.withContext(function($ctx1) {
  16813. var $1;
  16814. $1=self["@variableName"];
  16815. return $1;
  16816. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.ShadowingVariableError)})},
  16817. args: [],
  16818. source: "variableName\x0a\x09^ variableName",
  16819. messageSends: [],
  16820. referencedClasses: []
  16821. }),
  16822. smalltalk.ShadowingVariableError);
  16823. smalltalk.addMethod(
  16824. smalltalk.method({
  16825. selector: "variableName:",
  16826. category: 'accessing',
  16827. fn: function (aString){
  16828. var self=this;
  16829. return smalltalk.withContext(function($ctx1) {
  16830. self["@variableName"]=aString;
  16831. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.ShadowingVariableError)})},
  16832. args: ["aString"],
  16833. source: "variableName: aString\x0a\x09variableName := aString",
  16834. messageSends: [],
  16835. referencedClasses: []
  16836. }),
  16837. smalltalk.ShadowingVariableError);
  16838. smalltalk.addClass('UnknownVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  16839. smalltalk.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.";
  16840. smalltalk.addMethod(
  16841. smalltalk.method({
  16842. selector: "messageText",
  16843. category: 'accessing',
  16844. fn: function (){
  16845. var self=this;
  16846. return smalltalk.withContext(function($ctx1) {
  16847. var $1;
  16848. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  16849. return $1;
  16850. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.UnknownVariableError)})},
  16851. args: [],
  16852. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  16853. messageSends: [",", "variableName"],
  16854. referencedClasses: []
  16855. }),
  16856. smalltalk.UnknownVariableError);
  16857. smalltalk.addMethod(
  16858. smalltalk.method({
  16859. selector: "variableName",
  16860. category: 'accessing',
  16861. fn: function (){
  16862. var self=this;
  16863. return smalltalk.withContext(function($ctx1) {
  16864. var $1;
  16865. $1=self["@variableName"];
  16866. return $1;
  16867. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.UnknownVariableError)})},
  16868. args: [],
  16869. source: "variableName\x0a\x09^ variableName",
  16870. messageSends: [],
  16871. referencedClasses: []
  16872. }),
  16873. smalltalk.UnknownVariableError);
  16874. smalltalk.addMethod(
  16875. smalltalk.method({
  16876. selector: "variableName:",
  16877. category: 'accessing',
  16878. fn: function (aString){
  16879. var self=this;
  16880. return smalltalk.withContext(function($ctx1) {
  16881. self["@variableName"]=aString;
  16882. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.UnknownVariableError)})},
  16883. args: ["aString"],
  16884. source: "variableName: aString\x0a\x09variableName := aString",
  16885. messageSends: [],
  16886. referencedClasses: []
  16887. }),
  16888. smalltalk.UnknownVariableError);
  16889. smalltalk.addClass('RethrowErrorHandler', smalltalk.ErrorHandler, [], 'Compiler-Exceptions');
  16890. smalltalk.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.";
  16891. smalltalk.addMethod(
  16892. smalltalk.method({
  16893. selector: "basicSignal:",
  16894. category: 'error handling',
  16895. fn: function (anError){
  16896. var self=this;
  16897. return smalltalk.withContext(function($ctx1) {
  16898. throw anError;
  16899. return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  16900. args: ["anError"],
  16901. source: "basicSignal: anError\x0a\x09<throw anError>",
  16902. messageSends: [],
  16903. referencedClasses: []
  16904. }),
  16905. smalltalk.RethrowErrorHandler);
  16906. smalltalk.addMethod(
  16907. smalltalk.method({
  16908. selector: "handleError:",
  16909. category: 'error handling',
  16910. fn: function (anError){
  16911. var self=this;
  16912. return smalltalk.withContext(function($ctx1) {
  16913. smalltalk.ErrorHandler.fn.prototype._handleError_.apply(_st(self), [anError]);
  16914. self._basicSignal_(anError);
  16915. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  16916. args: ["anError"],
  16917. source: "handleError: anError\x0a\x09super handleError: anError.\x0a\x09self basicSignal: anError",
  16918. messageSends: ["handleError:", "basicSignal:"],
  16919. referencedClasses: []
  16920. }),
  16921. smalltalk.RethrowErrorHandler);
  16922. smalltalk.addPackage('Compiler-Core');
  16923. smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
  16924. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  16925. smalltalk.addMethod(
  16926. smalltalk.method({
  16927. selector: "classNameFor:",
  16928. category: 'accessing',
  16929. fn: function (aClass){
  16930. var self=this;
  16931. return smalltalk.withContext(function($ctx1) {
  16932. var $2,$3,$1;
  16933. $2=_st(aClass)._isMetaclass();
  16934. if(smalltalk.assert($2)){
  16935. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  16936. } else {
  16937. $3=_st(aClass)._isNil();
  16938. if(smalltalk.assert($3)){
  16939. $1="nil";
  16940. } else {
  16941. $1=_st(aClass)._name();
  16942. };
  16943. };
  16944. return $1;
  16945. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  16946. args: ["aClass"],
  16947. 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]]",
  16948. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  16949. referencedClasses: []
  16950. }),
  16951. smalltalk.AbstractCodeGenerator);
  16952. smalltalk.addMethod(
  16953. smalltalk.method({
  16954. selector: "compileNode:",
  16955. category: 'compiling',
  16956. fn: function (aNode){
  16957. var self=this;
  16958. return smalltalk.withContext(function($ctx1) {
  16959. self._subclassResponsibility();
  16960. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},smalltalk.AbstractCodeGenerator)})},
  16961. args: ["aNode"],
  16962. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  16963. messageSends: ["subclassResponsibility"],
  16964. referencedClasses: []
  16965. }),
  16966. smalltalk.AbstractCodeGenerator);
  16967. smalltalk.addMethod(
  16968. smalltalk.method({
  16969. selector: "currentClass",
  16970. category: 'accessing',
  16971. fn: function (){
  16972. var self=this;
  16973. return smalltalk.withContext(function($ctx1) {
  16974. var $1;
  16975. $1=self["@currentClass"];
  16976. return $1;
  16977. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.AbstractCodeGenerator)})},
  16978. args: [],
  16979. source: "currentClass\x0a\x09^currentClass",
  16980. messageSends: [],
  16981. referencedClasses: []
  16982. }),
  16983. smalltalk.AbstractCodeGenerator);
  16984. smalltalk.addMethod(
  16985. smalltalk.method({
  16986. selector: "currentClass:",
  16987. category: 'accessing',
  16988. fn: function (aClass){
  16989. var self=this;
  16990. return smalltalk.withContext(function($ctx1) {
  16991. self["@currentClass"]=aClass;
  16992. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  16993. args: ["aClass"],
  16994. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  16995. messageSends: [],
  16996. referencedClasses: []
  16997. }),
  16998. smalltalk.AbstractCodeGenerator);
  16999. smalltalk.addMethod(
  17000. smalltalk.method({
  17001. selector: "pseudoVariables",
  17002. category: 'accessing',
  17003. fn: function (){
  17004. var self=this;
  17005. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17006. return smalltalk.withContext(function($ctx1) {
  17007. var $1;
  17008. $1=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  17009. return $1;
  17010. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},smalltalk.AbstractCodeGenerator)})},
  17011. args: [],
  17012. source: "pseudoVariables\x0a\x09^ Smalltalk current pseudoVariableNames",
  17013. messageSends: ["pseudoVariableNames", "current"],
  17014. referencedClasses: ["Smalltalk"]
  17015. }),
  17016. smalltalk.AbstractCodeGenerator);
  17017. smalltalk.addMethod(
  17018. smalltalk.method({
  17019. selector: "safeVariableNameFor:",
  17020. category: 'accessing',
  17021. fn: function (aString){
  17022. var self=this;
  17023. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17024. return smalltalk.withContext(function($ctx1) {
  17025. var $2,$1;
  17026. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(aString);
  17027. if(smalltalk.assert($2)){
  17028. $1=_st(aString).__comma("_");
  17029. } else {
  17030. $1=aString;
  17031. };
  17032. return $1;
  17033. }, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  17034. args: ["aString"],
  17035. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  17036. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  17037. referencedClasses: ["Smalltalk"]
  17038. }),
  17039. smalltalk.AbstractCodeGenerator);
  17040. smalltalk.addMethod(
  17041. smalltalk.method({
  17042. selector: "source",
  17043. category: 'accessing',
  17044. fn: function (){
  17045. var self=this;
  17046. return smalltalk.withContext(function($ctx1) {
  17047. var $2,$1;
  17048. $2=self["@source"];
  17049. if(($receiver = $2) == nil || $receiver == undefined){
  17050. $1="";
  17051. } else {
  17052. $1=$2;
  17053. };
  17054. return $1;
  17055. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.AbstractCodeGenerator)})},
  17056. args: [],
  17057. source: "source\x0a\x09^source ifNil: ['']",
  17058. messageSends: ["ifNil:"],
  17059. referencedClasses: []
  17060. }),
  17061. smalltalk.AbstractCodeGenerator);
  17062. smalltalk.addMethod(
  17063. smalltalk.method({
  17064. selector: "source:",
  17065. category: 'accessing',
  17066. fn: function (aString){
  17067. var self=this;
  17068. return smalltalk.withContext(function($ctx1) {
  17069. self["@source"]=aString;
  17070. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  17071. args: ["aString"],
  17072. source: "source: aString\x0a\x09source := aString",
  17073. messageSends: [],
  17074. referencedClasses: []
  17075. }),
  17076. smalltalk.AbstractCodeGenerator);
  17077. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  17078. smalltalk.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.";
  17079. smalltalk.addMethod(
  17080. smalltalk.method({
  17081. selector: "compileNode:",
  17082. category: 'compiling',
  17083. fn: function (aNode){
  17084. var self=this;
  17085. var ir,stream;
  17086. return smalltalk.withContext(function($ctx1) {
  17087. var $2,$3,$1;
  17088. _st(self._semanticAnalyzer())._visit_(aNode);
  17089. ir=_st(self._translator())._visit_(aNode);
  17090. $2=self._irTranslator();
  17091. _st($2)._visit_(ir);
  17092. $3=_st($2)._contents();
  17093. $1=$3;
  17094. return $1;
  17095. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.CodeGenerator)})},
  17096. args: ["aNode"],
  17097. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  17098. messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
  17099. referencedClasses: []
  17100. }),
  17101. smalltalk.CodeGenerator);
  17102. smalltalk.addMethod(
  17103. smalltalk.method({
  17104. selector: "irTranslator",
  17105. category: 'compiling',
  17106. fn: function (){
  17107. var self=this;
  17108. function $IRJSTranslator(){return smalltalk.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  17109. return smalltalk.withContext(function($ctx1) {
  17110. var $1;
  17111. $1=_st($IRJSTranslator())._new();
  17112. return $1;
  17113. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.CodeGenerator)})},
  17114. args: [],
  17115. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  17116. messageSends: ["new"],
  17117. referencedClasses: ["IRJSTranslator"]
  17118. }),
  17119. smalltalk.CodeGenerator);
  17120. smalltalk.addMethod(
  17121. smalltalk.method({
  17122. selector: "semanticAnalyzer",
  17123. category: 'compiling',
  17124. fn: function (){
  17125. var self=this;
  17126. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  17127. return smalltalk.withContext(function($ctx1) {
  17128. var $1;
  17129. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  17130. return $1;
  17131. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},smalltalk.CodeGenerator)})},
  17132. args: [],
  17133. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  17134. messageSends: ["on:", "currentClass"],
  17135. referencedClasses: ["SemanticAnalyzer"]
  17136. }),
  17137. smalltalk.CodeGenerator);
  17138. smalltalk.addMethod(
  17139. smalltalk.method({
  17140. selector: "translator",
  17141. category: 'compiling',
  17142. fn: function (){
  17143. var self=this;
  17144. function $IRASTTranslator(){return smalltalk.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  17145. return smalltalk.withContext(function($ctx1) {
  17146. var $2,$3,$1;
  17147. $2=_st($IRASTTranslator())._new();
  17148. _st($2)._source_(self._source());
  17149. _st($2)._theClass_(self._currentClass());
  17150. $3=_st($2)._yourself();
  17151. $1=$3;
  17152. return $1;
  17153. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.CodeGenerator)})},
  17154. args: [],
  17155. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  17156. messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
  17157. referencedClasses: ["IRASTTranslator"]
  17158. }),
  17159. smalltalk.CodeGenerator);
  17160. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  17161. smalltalk.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`";
  17162. smalltalk.addMethod(
  17163. smalltalk.method({
  17164. selector: "codeGeneratorClass",
  17165. category: 'accessing',
  17166. fn: function (){
  17167. var self=this;
  17168. function $InliningCodeGenerator(){return smalltalk.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  17169. return smalltalk.withContext(function($ctx1) {
  17170. var $2,$1;
  17171. $2=self["@codeGeneratorClass"];
  17172. if(($receiver = $2) == nil || $receiver == undefined){
  17173. $1=$InliningCodeGenerator();
  17174. } else {
  17175. $1=$2;
  17176. };
  17177. return $1;
  17178. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.Compiler)})},
  17179. args: [],
  17180. source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
  17181. messageSends: ["ifNil:"],
  17182. referencedClasses: ["InliningCodeGenerator"]
  17183. }),
  17184. smalltalk.Compiler);
  17185. smalltalk.addMethod(
  17186. smalltalk.method({
  17187. selector: "codeGeneratorClass:",
  17188. category: 'accessing',
  17189. fn: function (aClass){
  17190. var self=this;
  17191. return smalltalk.withContext(function($ctx1) {
  17192. self["@codeGeneratorClass"]=aClass;
  17193. return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass},smalltalk.Compiler)})},
  17194. args: ["aClass"],
  17195. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  17196. messageSends: [],
  17197. referencedClasses: []
  17198. }),
  17199. smalltalk.Compiler);
  17200. smalltalk.addMethod(
  17201. smalltalk.method({
  17202. selector: "compile:",
  17203. category: 'compiling',
  17204. fn: function (aString){
  17205. var self=this;
  17206. return smalltalk.withContext(function($ctx1) {
  17207. var $1;
  17208. $1=self._compileNode_(self._parse_(aString));
  17209. return $1;
  17210. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Compiler)})},
  17211. args: ["aString"],
  17212. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  17213. messageSends: ["compileNode:", "parse:"],
  17214. referencedClasses: []
  17215. }),
  17216. smalltalk.Compiler);
  17217. smalltalk.addMethod(
  17218. smalltalk.method({
  17219. selector: "compile:forClass:",
  17220. category: 'compiling',
  17221. fn: function (aString,aClass){
  17222. var self=this;
  17223. return smalltalk.withContext(function($ctx1) {
  17224. var $1;
  17225. self._currentClass_(aClass);
  17226. self._source_(aString);
  17227. $1=self._compile_(aString);
  17228. return $1;
  17229. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},smalltalk.Compiler)})},
  17230. args: ["aString", "aClass"],
  17231. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  17232. messageSends: ["currentClass:", "source:", "compile:"],
  17233. referencedClasses: []
  17234. }),
  17235. smalltalk.Compiler);
  17236. smalltalk.addMethod(
  17237. smalltalk.method({
  17238. selector: "compileExpression:",
  17239. category: 'compiling',
  17240. fn: function (aString){
  17241. var self=this;
  17242. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  17243. return smalltalk.withContext(function($ctx1) {
  17244. var $1;
  17245. self._currentClass_($DoIt());
  17246. self._source_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  17247. $1=self._compileNode_(self._parse_(self._source()));
  17248. return $1;
  17249. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},smalltalk.Compiler)})},
  17250. args: ["aString"],
  17251. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  17252. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  17253. referencedClasses: ["DoIt"]
  17254. }),
  17255. smalltalk.Compiler);
  17256. smalltalk.addMethod(
  17257. smalltalk.method({
  17258. selector: "compileExpression:on:",
  17259. category: 'compiling',
  17260. fn: function (aString,anObject){
  17261. var self=this;
  17262. return smalltalk.withContext(function($ctx1) {
  17263. var $1;
  17264. self._currentClass_(_st(anObject)._class());
  17265. self._source_(_st("xxxDoIt ^[".__comma(aString)).__comma("] value"));
  17266. $1=self._compileNode_(self._parse_(self._source()));
  17267. return $1;
  17268. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},smalltalk.Compiler)})},
  17269. args: ["aString", "anObject"],
  17270. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  17271. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  17272. referencedClasses: []
  17273. }),
  17274. smalltalk.Compiler);
  17275. smalltalk.addMethod(
  17276. smalltalk.method({
  17277. selector: "compileNode:",
  17278. category: 'compiling',
  17279. fn: function (aNode){
  17280. var self=this;
  17281. var generator,result;
  17282. return smalltalk.withContext(function($ctx1) {
  17283. var $1,$2,$3;
  17284. generator=_st(self._codeGeneratorClass())._new();
  17285. $1=generator;
  17286. _st($1)._source_(self._source());
  17287. $2=_st($1)._currentClass_(self._currentClass());
  17288. result=_st(generator)._compileNode_(aNode);
  17289. self._unknownVariables_([]);
  17290. $3=result;
  17291. return $3;
  17292. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},smalltalk.Compiler)})},
  17293. args: ["aNode"],
  17294. 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",
  17295. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  17296. referencedClasses: []
  17297. }),
  17298. smalltalk.Compiler);
  17299. smalltalk.addMethod(
  17300. smalltalk.method({
  17301. selector: "currentClass",
  17302. category: 'accessing',
  17303. fn: function (){
  17304. var self=this;
  17305. return smalltalk.withContext(function($ctx1) {
  17306. var $1;
  17307. $1=self["@currentClass"];
  17308. return $1;
  17309. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.Compiler)})},
  17310. args: [],
  17311. source: "currentClass\x0a\x09^currentClass",
  17312. messageSends: [],
  17313. referencedClasses: []
  17314. }),
  17315. smalltalk.Compiler);
  17316. smalltalk.addMethod(
  17317. smalltalk.method({
  17318. selector: "currentClass:",
  17319. category: 'accessing',
  17320. fn: function (aClass){
  17321. var self=this;
  17322. return smalltalk.withContext(function($ctx1) {
  17323. self["@currentClass"]=aClass;
  17324. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.Compiler)})},
  17325. args: ["aClass"],
  17326. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  17327. messageSends: [],
  17328. referencedClasses: []
  17329. }),
  17330. smalltalk.Compiler);
  17331. smalltalk.addMethod(
  17332. smalltalk.method({
  17333. selector: "eval:",
  17334. category: 'compiling',
  17335. fn: function (aString){
  17336. var self=this;
  17337. return smalltalk.withContext(function($ctx1) {
  17338. return eval(aString);
  17339. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},smalltalk.Compiler)})},
  17340. args: ["aString"],
  17341. source: "eval: aString\x0a\x09<return eval(aString)>",
  17342. messageSends: [],
  17343. referencedClasses: []
  17344. }),
  17345. smalltalk.Compiler);
  17346. smalltalk.addMethod(
  17347. smalltalk.method({
  17348. selector: "evaluateExpression:",
  17349. category: 'compiling',
  17350. fn: function (aString){
  17351. var self=this;
  17352. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  17353. return smalltalk.withContext(function($ctx1) {
  17354. var $1;
  17355. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  17356. return $1;
  17357. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},smalltalk.Compiler)})},
  17358. args: ["aString"],
  17359. 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",
  17360. messageSends: ["evaluateExpression:on:", "new"],
  17361. referencedClasses: ["DoIt"]
  17362. }),
  17363. smalltalk.Compiler);
  17364. smalltalk.addMethod(
  17365. smalltalk.method({
  17366. selector: "evaluateExpression:on:",
  17367. category: 'compiling',
  17368. fn: function (aString,anObject){
  17369. var self=this;
  17370. var result,method;
  17371. return smalltalk.withContext(function($ctx1) {
  17372. var $1;
  17373. method=self._eval_(self._compileExpression_on_(aString,anObject));
  17374. _st(method)._category_("xxxDoIt");
  17375. _st(_st(anObject)._class())._addCompiledMethod_(method);
  17376. result=_st(anObject)._xxxDoIt();
  17377. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  17378. $1=result;
  17379. return $1;
  17380. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},smalltalk.Compiler)})},
  17381. args: ["aString", "anObject"],
  17382. 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 category: 'xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^result",
  17383. messageSends: ["eval:", "compileExpression:on:", "category:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  17384. referencedClasses: []
  17385. }),
  17386. smalltalk.Compiler);
  17387. smalltalk.addMethod(
  17388. smalltalk.method({
  17389. selector: "install:forClass:category:",
  17390. category: 'compiling',
  17391. fn: function (aString,aBehavior,anotherString){
  17392. var self=this;
  17393. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  17394. return smalltalk.withContext(function($ctx1) {
  17395. var $1;
  17396. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_category_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  17397. return $1;
  17398. }, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},smalltalk.Compiler)})},
  17399. args: ["aString", "aBehavior", "anotherString"],
  17400. source: "install: aString forClass: aBehavior category: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09category: anotherString",
  17401. messageSends: ["installMethod:forClass:category:", "eval:", "compile:forClass:", "new"],
  17402. referencedClasses: ["ClassBuilder"]
  17403. }),
  17404. smalltalk.Compiler);
  17405. smalltalk.addMethod(
  17406. smalltalk.method({
  17407. selector: "parse:",
  17408. category: 'compiling',
  17409. fn: function (aString){
  17410. var self=this;
  17411. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17412. return smalltalk.withContext(function($ctx1) {
  17413. var $1;
  17414. $1=_st(_st($Smalltalk())._current())._parse_(aString);
  17415. return $1;
  17416. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Compiler)})},
  17417. args: ["aString"],
  17418. source: "parse: aString\x0a\x09^Smalltalk current parse: aString",
  17419. messageSends: ["parse:", "current"],
  17420. referencedClasses: ["Smalltalk"]
  17421. }),
  17422. smalltalk.Compiler);
  17423. smalltalk.addMethod(
  17424. smalltalk.method({
  17425. selector: "parseExpression:",
  17426. category: 'compiling',
  17427. fn: function (aString){
  17428. var self=this;
  17429. return smalltalk.withContext(function($ctx1) {
  17430. var $1;
  17431. $1=self._parse_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  17432. return $1;
  17433. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},smalltalk.Compiler)})},
  17434. args: ["aString"],
  17435. source: "parseExpression: aString\x0a\x09^self parse: 'doIt ^[', aString, '] value'",
  17436. messageSends: ["parse:", ","],
  17437. referencedClasses: []
  17438. }),
  17439. smalltalk.Compiler);
  17440. smalltalk.addMethod(
  17441. smalltalk.method({
  17442. selector: "recompile:",
  17443. category: 'compiling',
  17444. fn: function (aClass){
  17445. var self=this;
  17446. return smalltalk.withContext(function($ctx1) {
  17447. var $1;
  17448. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  17449. return smalltalk.withContext(function($ctx2) {
  17450. return self._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
  17451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  17452. $1=_st(aClass)._isMetaclass();
  17453. if(! smalltalk.assert($1)){
  17454. self._recompile_(_st(aClass)._class());
  17455. };
  17456. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler)})},
  17457. args: ["aClass"],
  17458. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | self install: each source forClass: aClass category: each category ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09\x22self setupClass: aClass.\x22\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  17459. messageSends: ["do:displayingProgress:", "install:forClass:category:", "source", "category", ",", "name", "values", "methodDictionary", "ifFalse:", "recompile:", "class", "isMetaclass"],
  17460. referencedClasses: []
  17461. }),
  17462. smalltalk.Compiler);
  17463. smalltalk.addMethod(
  17464. smalltalk.method({
  17465. selector: "recompileAll",
  17466. category: 'compiling',
  17467. fn: function (){
  17468. var self=this;
  17469. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17470. return smalltalk.withContext(function($ctx1) {
  17471. _st(_st(_st($Smalltalk())._current())._classes())._do_displayingProgress_((function(each){
  17472. return smalltalk.withContext(function($ctx2) {
  17473. return self._recompile_(each);
  17474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),"Compiling all classes...");
  17475. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler)})},
  17476. args: [],
  17477. source: "recompileAll\x0a\x09Smalltalk current classes \x0a\x09\x09do: [:each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  17478. messageSends: ["do:displayingProgress:", "recompile:", "classes", "current"],
  17479. referencedClasses: ["Smalltalk"]
  17480. }),
  17481. smalltalk.Compiler);
  17482. smalltalk.addMethod(
  17483. smalltalk.method({
  17484. selector: "source",
  17485. category: 'accessing',
  17486. fn: function (){
  17487. var self=this;
  17488. return smalltalk.withContext(function($ctx1) {
  17489. var $2,$1;
  17490. $2=self["@source"];
  17491. if(($receiver = $2) == nil || $receiver == undefined){
  17492. $1="";
  17493. } else {
  17494. $1=$2;
  17495. };
  17496. return $1;
  17497. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.Compiler)})},
  17498. args: [],
  17499. source: "source\x0a\x09^source ifNil: ['']",
  17500. messageSends: ["ifNil:"],
  17501. referencedClasses: []
  17502. }),
  17503. smalltalk.Compiler);
  17504. smalltalk.addMethod(
  17505. smalltalk.method({
  17506. selector: "source:",
  17507. category: 'accessing',
  17508. fn: function (aString){
  17509. var self=this;
  17510. return smalltalk.withContext(function($ctx1) {
  17511. self["@source"]=aString;
  17512. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.Compiler)})},
  17513. args: ["aString"],
  17514. source: "source: aString\x0a\x09source := aString",
  17515. messageSends: [],
  17516. referencedClasses: []
  17517. }),
  17518. smalltalk.Compiler);
  17519. smalltalk.addMethod(
  17520. smalltalk.method({
  17521. selector: "unknownVariables",
  17522. category: 'accessing',
  17523. fn: function (){
  17524. var self=this;
  17525. return smalltalk.withContext(function($ctx1) {
  17526. var $1;
  17527. $1=self["@unknownVariables"];
  17528. return $1;
  17529. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.Compiler)})},
  17530. args: [],
  17531. source: "unknownVariables\x0a\x09^unknownVariables",
  17532. messageSends: [],
  17533. referencedClasses: []
  17534. }),
  17535. smalltalk.Compiler);
  17536. smalltalk.addMethod(
  17537. smalltalk.method({
  17538. selector: "unknownVariables:",
  17539. category: 'accessing',
  17540. fn: function (aCollection){
  17541. var self=this;
  17542. return smalltalk.withContext(function($ctx1) {
  17543. self["@unknownVariables"]=aCollection;
  17544. return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection},smalltalk.Compiler)})},
  17545. args: ["aCollection"],
  17546. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  17547. messageSends: [],
  17548. referencedClasses: []
  17549. }),
  17550. smalltalk.Compiler);
  17551. smalltalk.addMethod(
  17552. smalltalk.method({
  17553. selector: "recompile:",
  17554. category: 'compiling',
  17555. fn: function (aClass){
  17556. var self=this;
  17557. return smalltalk.withContext(function($ctx1) {
  17558. _st(self._new())._recompile_(aClass);
  17559. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler.klass)})},
  17560. args: ["aClass"],
  17561. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  17562. messageSends: ["recompile:", "new"],
  17563. referencedClasses: []
  17564. }),
  17565. smalltalk.Compiler.klass);
  17566. smalltalk.addMethod(
  17567. smalltalk.method({
  17568. selector: "recompileAll",
  17569. category: 'compiling',
  17570. fn: function (){
  17571. var self=this;
  17572. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17573. return smalltalk.withContext(function($ctx1) {
  17574. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  17575. return smalltalk.withContext(function($ctx2) {
  17576. return self._recompile_(each);
  17577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  17578. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler.klass)})},
  17579. args: [],
  17580. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  17581. messageSends: ["do:", "recompile:", "classes", "current"],
  17582. referencedClasses: ["Smalltalk"]
  17583. }),
  17584. smalltalk.Compiler.klass);
  17585. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  17586. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  17587. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  17588. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  17589. smalltalk.addMethod(
  17590. smalltalk.method({
  17591. selector: "visit:",
  17592. category: 'visiting',
  17593. fn: function (aNode){
  17594. var self=this;
  17595. return smalltalk.withContext(function($ctx1) {
  17596. var $1;
  17597. $1=_st(aNode)._accept_(self);
  17598. return $1;
  17599. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17600. args: ["aNode"],
  17601. source: "visit: aNode\x0a\x09^ aNode accept: self",
  17602. messageSends: ["accept:"],
  17603. referencedClasses: []
  17604. }),
  17605. smalltalk.NodeVisitor);
  17606. smalltalk.addMethod(
  17607. smalltalk.method({
  17608. selector: "visitAll:",
  17609. category: 'visiting',
  17610. fn: function (aCollection){
  17611. var self=this;
  17612. return smalltalk.withContext(function($ctx1) {
  17613. var $1;
  17614. $1=_st(aCollection)._collect_((function(each){
  17615. return smalltalk.withContext(function($ctx2) {
  17616. return self._visit_(each);
  17617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  17618. return $1;
  17619. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},smalltalk.NodeVisitor)})},
  17620. args: ["aCollection"],
  17621. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  17622. messageSends: ["collect:", "visit:"],
  17623. referencedClasses: []
  17624. }),
  17625. smalltalk.NodeVisitor);
  17626. smalltalk.addMethod(
  17627. smalltalk.method({
  17628. selector: "visitAssignmentNode:",
  17629. category: 'visiting',
  17630. fn: function (aNode){
  17631. var self=this;
  17632. return smalltalk.withContext(function($ctx1) {
  17633. var $1;
  17634. $1=self._visitNode_(aNode);
  17635. return $1;
  17636. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17637. args: ["aNode"],
  17638. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  17639. messageSends: ["visitNode:"],
  17640. referencedClasses: []
  17641. }),
  17642. smalltalk.NodeVisitor);
  17643. smalltalk.addMethod(
  17644. smalltalk.method({
  17645. selector: "visitBlockNode:",
  17646. category: 'visiting',
  17647. fn: function (aNode){
  17648. var self=this;
  17649. return smalltalk.withContext(function($ctx1) {
  17650. var $1;
  17651. $1=self._visitNode_(aNode);
  17652. return $1;
  17653. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17654. args: ["aNode"],
  17655. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  17656. messageSends: ["visitNode:"],
  17657. referencedClasses: []
  17658. }),
  17659. smalltalk.NodeVisitor);
  17660. smalltalk.addMethod(
  17661. smalltalk.method({
  17662. selector: "visitBlockSequenceNode:",
  17663. category: 'visiting',
  17664. fn: function (aNode){
  17665. var self=this;
  17666. return smalltalk.withContext(function($ctx1) {
  17667. var $1;
  17668. $1=self._visitSequenceNode_(aNode);
  17669. return $1;
  17670. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17671. args: ["aNode"],
  17672. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  17673. messageSends: ["visitSequenceNode:"],
  17674. referencedClasses: []
  17675. }),
  17676. smalltalk.NodeVisitor);
  17677. smalltalk.addMethod(
  17678. smalltalk.method({
  17679. selector: "visitCascadeNode:",
  17680. category: 'visiting',
  17681. fn: function (aNode){
  17682. var self=this;
  17683. return smalltalk.withContext(function($ctx1) {
  17684. var $1;
  17685. $1=self._visitNode_(aNode);
  17686. return $1;
  17687. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17688. args: ["aNode"],
  17689. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  17690. messageSends: ["visitNode:"],
  17691. referencedClasses: []
  17692. }),
  17693. smalltalk.NodeVisitor);
  17694. smalltalk.addMethod(
  17695. smalltalk.method({
  17696. selector: "visitClassReferenceNode:",
  17697. category: 'visiting',
  17698. fn: function (aNode){
  17699. var self=this;
  17700. return smalltalk.withContext(function($ctx1) {
  17701. var $1;
  17702. $1=self._visitVariableNode_(aNode);
  17703. return $1;
  17704. }, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17705. args: ["aNode"],
  17706. source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
  17707. messageSends: ["visitVariableNode:"],
  17708. referencedClasses: []
  17709. }),
  17710. smalltalk.NodeVisitor);
  17711. smalltalk.addMethod(
  17712. smalltalk.method({
  17713. selector: "visitDynamicArrayNode:",
  17714. category: 'visiting',
  17715. fn: function (aNode){
  17716. var self=this;
  17717. return smalltalk.withContext(function($ctx1) {
  17718. var $1;
  17719. $1=self._visitNode_(aNode);
  17720. return $1;
  17721. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17722. args: ["aNode"],
  17723. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  17724. messageSends: ["visitNode:"],
  17725. referencedClasses: []
  17726. }),
  17727. smalltalk.NodeVisitor);
  17728. smalltalk.addMethod(
  17729. smalltalk.method({
  17730. selector: "visitDynamicDictionaryNode:",
  17731. category: 'visiting',
  17732. fn: function (aNode){
  17733. var self=this;
  17734. return smalltalk.withContext(function($ctx1) {
  17735. var $1;
  17736. $1=self._visitNode_(aNode);
  17737. return $1;
  17738. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17739. args: ["aNode"],
  17740. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  17741. messageSends: ["visitNode:"],
  17742. referencedClasses: []
  17743. }),
  17744. smalltalk.NodeVisitor);
  17745. smalltalk.addMethod(
  17746. smalltalk.method({
  17747. selector: "visitJSStatementNode:",
  17748. category: 'visiting',
  17749. fn: function (aNode){
  17750. var self=this;
  17751. return smalltalk.withContext(function($ctx1) {
  17752. var $1;
  17753. $1=self._visitNode_(aNode);
  17754. return $1;
  17755. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17756. args: ["aNode"],
  17757. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  17758. messageSends: ["visitNode:"],
  17759. referencedClasses: []
  17760. }),
  17761. smalltalk.NodeVisitor);
  17762. smalltalk.addMethod(
  17763. smalltalk.method({
  17764. selector: "visitMethodNode:",
  17765. category: 'visiting',
  17766. fn: function (aNode){
  17767. var self=this;
  17768. return smalltalk.withContext(function($ctx1) {
  17769. var $1;
  17770. $1=self._visitNode_(aNode);
  17771. return $1;
  17772. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17773. args: ["aNode"],
  17774. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  17775. messageSends: ["visitNode:"],
  17776. referencedClasses: []
  17777. }),
  17778. smalltalk.NodeVisitor);
  17779. smalltalk.addMethod(
  17780. smalltalk.method({
  17781. selector: "visitNode:",
  17782. category: 'visiting',
  17783. fn: function (aNode){
  17784. var self=this;
  17785. return smalltalk.withContext(function($ctx1) {
  17786. var $1;
  17787. $1=self._visitAll_(_st(aNode)._nodes());
  17788. return $1;
  17789. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17790. args: ["aNode"],
  17791. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  17792. messageSends: ["visitAll:", "nodes"],
  17793. referencedClasses: []
  17794. }),
  17795. smalltalk.NodeVisitor);
  17796. smalltalk.addMethod(
  17797. smalltalk.method({
  17798. selector: "visitReturnNode:",
  17799. category: 'visiting',
  17800. fn: function (aNode){
  17801. var self=this;
  17802. return smalltalk.withContext(function($ctx1) {
  17803. var $1;
  17804. $1=self._visitNode_(aNode);
  17805. return $1;
  17806. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17807. args: ["aNode"],
  17808. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  17809. messageSends: ["visitNode:"],
  17810. referencedClasses: []
  17811. }),
  17812. smalltalk.NodeVisitor);
  17813. smalltalk.addMethod(
  17814. smalltalk.method({
  17815. selector: "visitSendNode:",
  17816. category: 'visiting',
  17817. fn: function (aNode){
  17818. var self=this;
  17819. return smalltalk.withContext(function($ctx1) {
  17820. var $1;
  17821. $1=self._visitNode_(aNode);
  17822. return $1;
  17823. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17824. args: ["aNode"],
  17825. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  17826. messageSends: ["visitNode:"],
  17827. referencedClasses: []
  17828. }),
  17829. smalltalk.NodeVisitor);
  17830. smalltalk.addMethod(
  17831. smalltalk.method({
  17832. selector: "visitSequenceNode:",
  17833. category: 'visiting',
  17834. fn: function (aNode){
  17835. var self=this;
  17836. return smalltalk.withContext(function($ctx1) {
  17837. var $1;
  17838. $1=self._visitNode_(aNode);
  17839. return $1;
  17840. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17841. args: ["aNode"],
  17842. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  17843. messageSends: ["visitNode:"],
  17844. referencedClasses: []
  17845. }),
  17846. smalltalk.NodeVisitor);
  17847. smalltalk.addMethod(
  17848. smalltalk.method({
  17849. selector: "visitValueNode:",
  17850. category: 'visiting',
  17851. fn: function (aNode){
  17852. var self=this;
  17853. return smalltalk.withContext(function($ctx1) {
  17854. var $1;
  17855. $1=self._visitNode_(aNode);
  17856. return $1;
  17857. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17858. args: ["aNode"],
  17859. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  17860. messageSends: ["visitNode:"],
  17861. referencedClasses: []
  17862. }),
  17863. smalltalk.NodeVisitor);
  17864. smalltalk.addMethod(
  17865. smalltalk.method({
  17866. selector: "visitVariableNode:",
  17867. category: 'visiting',
  17868. fn: function (aNode){
  17869. var self=this;
  17870. return smalltalk.withContext(function($ctx1) {
  17871. var $1;
  17872. $1=self._visitNode_(aNode);
  17873. return $1;
  17874. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  17875. args: ["aNode"],
  17876. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  17877. messageSends: ["visitNode:"],
  17878. referencedClasses: []
  17879. }),
  17880. smalltalk.NodeVisitor);
  17881. smalltalk.addPackage('Compiler-AST');
  17882. smalltalk.addClass('Node', smalltalk.Object, ['parent', 'position', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  17883. smalltalk.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.";
  17884. smalltalk.addMethod(
  17885. smalltalk.method({
  17886. selector: "accept:",
  17887. category: 'visiting',
  17888. fn: function (aVisitor){
  17889. var self=this;
  17890. return smalltalk.withContext(function($ctx1) {
  17891. var $1;
  17892. $1=_st(aVisitor)._visitNode_(self);
  17893. return $1;
  17894. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.Node)})},
  17895. args: ["aVisitor"],
  17896. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  17897. messageSends: ["visitNode:"],
  17898. referencedClasses: []
  17899. }),
  17900. smalltalk.Node);
  17901. smalltalk.addMethod(
  17902. smalltalk.method({
  17903. selector: "addNode:",
  17904. category: 'accessing',
  17905. fn: function (aNode){
  17906. var self=this;
  17907. return smalltalk.withContext(function($ctx1) {
  17908. _st(self._nodes())._add_(aNode);
  17909. _st(aNode)._parent_(self);
  17910. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},smalltalk.Node)})},
  17911. args: ["aNode"],
  17912. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  17913. messageSends: ["add:", "nodes", "parent:"],
  17914. referencedClasses: []
  17915. }),
  17916. smalltalk.Node);
  17917. smalltalk.addMethod(
  17918. smalltalk.method({
  17919. selector: "extent",
  17920. category: 'accessing',
  17921. fn: function (){
  17922. var self=this;
  17923. return smalltalk.withContext(function($ctx1) {
  17924. var $2,$3,$1;
  17925. $2=self._nextNode();
  17926. if(($receiver = $2) == nil || $receiver == undefined){
  17927. $3=self._parent();
  17928. if(($receiver = $3) == nil || $receiver == undefined){
  17929. $1=$3;
  17930. } else {
  17931. var node;
  17932. node=$receiver;
  17933. $1=_st(node)._extent();
  17934. };
  17935. } else {
  17936. var node;
  17937. node=$receiver;
  17938. $1=_st(node)._position();
  17939. };
  17940. return $1;
  17941. }, function($ctx1) {$ctx1.fill(self,"extent",{},smalltalk.Node)})},
  17942. args: [],
  17943. source: "extent\x0a\x09\x22Answer the line and column of the end position of the receiver in the source code\x22\x0a\x09\x0a\x09^ self nextNode \x0a\x09\x09ifNil: [ self parent ifNotNil: [ :node | node extent ] ]\x0a\x09\x09ifNotNil: [ :node | node position ]",
  17944. messageSends: ["ifNil:ifNotNil:", "ifNotNil:", "extent", "parent", "position", "nextNode"],
  17945. referencedClasses: []
  17946. }),
  17947. smalltalk.Node);
  17948. smalltalk.addMethod(
  17949. smalltalk.method({
  17950. selector: "isAssignmentNode",
  17951. category: 'testing',
  17952. fn: function (){
  17953. var self=this;
  17954. return smalltalk.withContext(function($ctx1) {
  17955. return false;
  17956. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.Node)})},
  17957. args: [],
  17958. source: "isAssignmentNode\x0a\x09^ false",
  17959. messageSends: [],
  17960. referencedClasses: []
  17961. }),
  17962. smalltalk.Node);
  17963. smalltalk.addMethod(
  17964. smalltalk.method({
  17965. selector: "isBlockNode",
  17966. category: 'testing',
  17967. fn: function (){
  17968. var self=this;
  17969. return smalltalk.withContext(function($ctx1) {
  17970. return false;
  17971. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.Node)})},
  17972. args: [],
  17973. source: "isBlockNode\x0a\x09^false",
  17974. messageSends: [],
  17975. referencedClasses: []
  17976. }),
  17977. smalltalk.Node);
  17978. smalltalk.addMethod(
  17979. smalltalk.method({
  17980. selector: "isBlockSequenceNode",
  17981. category: 'testing',
  17982. fn: function (){
  17983. var self=this;
  17984. return smalltalk.withContext(function($ctx1) {
  17985. return false;
  17986. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.Node)})},
  17987. args: [],
  17988. source: "isBlockSequenceNode\x0a\x09^false",
  17989. messageSends: [],
  17990. referencedClasses: []
  17991. }),
  17992. smalltalk.Node);
  17993. smalltalk.addMethod(
  17994. smalltalk.method({
  17995. selector: "isImmutable",
  17996. category: 'testing',
  17997. fn: function (){
  17998. var self=this;
  17999. return smalltalk.withContext(function($ctx1) {
  18000. return false;
  18001. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Node)})},
  18002. args: [],
  18003. source: "isImmutable\x0a\x09^false",
  18004. messageSends: [],
  18005. referencedClasses: []
  18006. }),
  18007. smalltalk.Node);
  18008. smalltalk.addMethod(
  18009. smalltalk.method({
  18010. selector: "isJSStatementNode",
  18011. category: 'testing',
  18012. fn: function (){
  18013. var self=this;
  18014. return smalltalk.withContext(function($ctx1) {
  18015. return false;
  18016. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.Node)})},
  18017. args: [],
  18018. source: "isJSStatementNode\x0a\x09^ false",
  18019. messageSends: [],
  18020. referencedClasses: []
  18021. }),
  18022. smalltalk.Node);
  18023. smalltalk.addMethod(
  18024. smalltalk.method({
  18025. selector: "isNode",
  18026. category: 'testing',
  18027. fn: function (){
  18028. var self=this;
  18029. return smalltalk.withContext(function($ctx1) {
  18030. return true;
  18031. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Node)})},
  18032. args: [],
  18033. source: "isNode\x0a\x09^ true",
  18034. messageSends: [],
  18035. referencedClasses: []
  18036. }),
  18037. smalltalk.Node);
  18038. smalltalk.addMethod(
  18039. smalltalk.method({
  18040. selector: "isReturnNode",
  18041. category: 'testing',
  18042. fn: function (){
  18043. var self=this;
  18044. return smalltalk.withContext(function($ctx1) {
  18045. return false;
  18046. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.Node)})},
  18047. args: [],
  18048. source: "isReturnNode\x0a\x09^false",
  18049. messageSends: [],
  18050. referencedClasses: []
  18051. }),
  18052. smalltalk.Node);
  18053. smalltalk.addMethod(
  18054. smalltalk.method({
  18055. selector: "isSendNode",
  18056. category: 'testing',
  18057. fn: function (){
  18058. var self=this;
  18059. return smalltalk.withContext(function($ctx1) {
  18060. return false;
  18061. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.Node)})},
  18062. args: [],
  18063. source: "isSendNode\x0a\x09^false",
  18064. messageSends: [],
  18065. referencedClasses: []
  18066. }),
  18067. smalltalk.Node);
  18068. smalltalk.addMethod(
  18069. smalltalk.method({
  18070. selector: "isValueNode",
  18071. category: 'testing',
  18072. fn: function (){
  18073. var self=this;
  18074. return smalltalk.withContext(function($ctx1) {
  18075. return false;
  18076. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.Node)})},
  18077. args: [],
  18078. source: "isValueNode\x0a\x09^false",
  18079. messageSends: [],
  18080. referencedClasses: []
  18081. }),
  18082. smalltalk.Node);
  18083. smalltalk.addMethod(
  18084. smalltalk.method({
  18085. selector: "nextNode",
  18086. category: 'accessing',
  18087. fn: function (){
  18088. var self=this;
  18089. return smalltalk.withContext(function($ctx1) {
  18090. var $2,$1;
  18091. $2=self._parent();
  18092. if(($receiver = $2) == nil || $receiver == undefined){
  18093. $1=$2;
  18094. } else {
  18095. var node;
  18096. node=$receiver;
  18097. $1=_st(node)._nextNode_(self);
  18098. };
  18099. return $1;
  18100. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.Node)})},
  18101. args: [],
  18102. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  18103. messageSends: ["ifNotNil:", "nextNode:", "parent"],
  18104. referencedClasses: []
  18105. }),
  18106. smalltalk.Node);
  18107. smalltalk.addMethod(
  18108. smalltalk.method({
  18109. selector: "nextNode:",
  18110. category: 'accessing',
  18111. fn: function (aNode){
  18112. var self=this;
  18113. return smalltalk.withContext(function($ctx1) {
  18114. var $1;
  18115. $1=_st(self._nodes())._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  18116. return smalltalk.withContext(function($ctx2) {
  18117. return nil;
  18118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18119. return $1;
  18120. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode},smalltalk.Node)})},
  18121. args: ["aNode"],
  18122. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ nil ]",
  18123. messageSends: ["at:ifAbsent:", "+", "indexOf:", "nodes"],
  18124. referencedClasses: []
  18125. }),
  18126. smalltalk.Node);
  18127. smalltalk.addMethod(
  18128. smalltalk.method({
  18129. selector: "nodes",
  18130. category: 'accessing',
  18131. fn: function (){
  18132. var self=this;
  18133. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18134. return smalltalk.withContext(function($ctx1) {
  18135. var $2,$1;
  18136. $2=self["@nodes"];
  18137. if(($receiver = $2) == nil || $receiver == undefined){
  18138. self["@nodes"]=_st($Array())._new();
  18139. $1=self["@nodes"];
  18140. } else {
  18141. $1=$2;
  18142. };
  18143. return $1;
  18144. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.Node)})},
  18145. args: [],
  18146. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  18147. messageSends: ["ifNil:", "new"],
  18148. referencedClasses: ["Array"]
  18149. }),
  18150. smalltalk.Node);
  18151. smalltalk.addMethod(
  18152. smalltalk.method({
  18153. selector: "nodes:",
  18154. category: 'building',
  18155. fn: function (aCollection){
  18156. var self=this;
  18157. return smalltalk.withContext(function($ctx1) {
  18158. self["@nodes"]=aCollection;
  18159. _st(aCollection)._do_((function(each){
  18160. return smalltalk.withContext(function($ctx2) {
  18161. return _st(each)._parent_(self);
  18162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  18163. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},smalltalk.Node)})},
  18164. args: ["aCollection"],
  18165. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  18166. messageSends: ["do:", "parent:"],
  18167. referencedClasses: []
  18168. }),
  18169. smalltalk.Node);
  18170. smalltalk.addMethod(
  18171. smalltalk.method({
  18172. selector: "parent",
  18173. category: 'accessing',
  18174. fn: function (){
  18175. var self=this;
  18176. return smalltalk.withContext(function($ctx1) {
  18177. var $1;
  18178. $1=self["@parent"];
  18179. return $1;
  18180. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.Node)})},
  18181. args: [],
  18182. source: "parent\x0a\x09^ parent",
  18183. messageSends: [],
  18184. referencedClasses: []
  18185. }),
  18186. smalltalk.Node);
  18187. smalltalk.addMethod(
  18188. smalltalk.method({
  18189. selector: "parent:",
  18190. category: 'accessing',
  18191. fn: function (aNode){
  18192. var self=this;
  18193. return smalltalk.withContext(function($ctx1) {
  18194. self["@parent"]=aNode;
  18195. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{aNode:aNode},smalltalk.Node)})},
  18196. args: ["aNode"],
  18197. source: "parent: aNode\x0a\x09parent := aNode",
  18198. messageSends: [],
  18199. referencedClasses: []
  18200. }),
  18201. smalltalk.Node);
  18202. smalltalk.addMethod(
  18203. smalltalk.method({
  18204. selector: "position",
  18205. category: 'accessing',
  18206. fn: function (){
  18207. var self=this;
  18208. return smalltalk.withContext(function($ctx1) {
  18209. var $2,$3,$1;
  18210. $2=self["@position"];
  18211. if(($receiver = $2) == nil || $receiver == undefined){
  18212. $3=self._parent();
  18213. if(($receiver = $3) == nil || $receiver == undefined){
  18214. $1=$3;
  18215. } else {
  18216. var node;
  18217. node=$receiver;
  18218. $1=_st(node)._position();
  18219. };
  18220. } else {
  18221. $1=$2;
  18222. };
  18223. return $1;
  18224. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Node)})},
  18225. args: [],
  18226. 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 ] ]",
  18227. messageSends: ["ifNil:", "ifNotNil:", "position", "parent"],
  18228. referencedClasses: []
  18229. }),
  18230. smalltalk.Node);
  18231. smalltalk.addMethod(
  18232. smalltalk.method({
  18233. selector: "position:",
  18234. category: 'building',
  18235. fn: function (aPosition){
  18236. var self=this;
  18237. return smalltalk.withContext(function($ctx1) {
  18238. self["@position"]=aPosition;
  18239. return self}, function($ctx1) {$ctx1.fill(self,"position:",{aPosition:aPosition},smalltalk.Node)})},
  18240. args: ["aPosition"],
  18241. source: "position: aPosition\x0a\x09position := aPosition",
  18242. messageSends: [],
  18243. referencedClasses: []
  18244. }),
  18245. smalltalk.Node);
  18246. smalltalk.addMethod(
  18247. smalltalk.method({
  18248. selector: "shouldBeAliased",
  18249. category: 'accessing',
  18250. fn: function (){
  18251. var self=this;
  18252. return smalltalk.withContext(function($ctx1) {
  18253. var $2,$1;
  18254. $2=self["@shouldBeAliased"];
  18255. if(($receiver = $2) == nil || $receiver == undefined){
  18256. $1=false;
  18257. } else {
  18258. $1=$2;
  18259. };
  18260. return $1;
  18261. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},smalltalk.Node)})},
  18262. args: [],
  18263. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  18264. messageSends: ["ifNil:"],
  18265. referencedClasses: []
  18266. }),
  18267. smalltalk.Node);
  18268. smalltalk.addMethod(
  18269. smalltalk.method({
  18270. selector: "shouldBeAliased:",
  18271. category: 'accessing',
  18272. fn: function (aBoolean){
  18273. var self=this;
  18274. return smalltalk.withContext(function($ctx1) {
  18275. self["@shouldBeAliased"]=aBoolean;
  18276. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased:",{aBoolean:aBoolean},smalltalk.Node)})},
  18277. args: ["aBoolean"],
  18278. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  18279. messageSends: [],
  18280. referencedClasses: []
  18281. }),
  18282. smalltalk.Node);
  18283. smalltalk.addMethod(
  18284. smalltalk.method({
  18285. selector: "shouldBeInlined",
  18286. category: 'accessing',
  18287. fn: function (){
  18288. var self=this;
  18289. return smalltalk.withContext(function($ctx1) {
  18290. var $2,$1;
  18291. $2=self["@shouldBeInlined"];
  18292. if(($receiver = $2) == nil || $receiver == undefined){
  18293. $1=false;
  18294. } else {
  18295. $1=$2;
  18296. };
  18297. return $1;
  18298. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},smalltalk.Node)})},
  18299. args: [],
  18300. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  18301. messageSends: ["ifNil:"],
  18302. referencedClasses: []
  18303. }),
  18304. smalltalk.Node);
  18305. smalltalk.addMethod(
  18306. smalltalk.method({
  18307. selector: "shouldBeInlined:",
  18308. category: 'accessing',
  18309. fn: function (aBoolean){
  18310. var self=this;
  18311. return smalltalk.withContext(function($ctx1) {
  18312. self["@shouldBeInlined"]=aBoolean;
  18313. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined:",{aBoolean:aBoolean},smalltalk.Node)})},
  18314. args: ["aBoolean"],
  18315. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  18316. messageSends: [],
  18317. referencedClasses: []
  18318. }),
  18319. smalltalk.Node);
  18320. smalltalk.addMethod(
  18321. smalltalk.method({
  18322. selector: "stopOnStepping",
  18323. category: 'testing',
  18324. fn: function (){
  18325. var self=this;
  18326. return smalltalk.withContext(function($ctx1) {
  18327. return false;
  18328. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.Node)})},
  18329. args: [],
  18330. source: "stopOnStepping\x0a\x09^ false",
  18331. messageSends: [],
  18332. referencedClasses: []
  18333. }),
  18334. smalltalk.Node);
  18335. smalltalk.addMethod(
  18336. smalltalk.method({
  18337. selector: "subtreeNeedsAliasing",
  18338. category: 'testing',
  18339. fn: function (){
  18340. var self=this;
  18341. return smalltalk.withContext(function($ctx1) {
  18342. var $1;
  18343. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  18344. return smalltalk.withContext(function($ctx2) {
  18345. return self._shouldBeInlined();
  18346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._or_((function(){
  18347. return smalltalk.withContext(function($ctx2) {
  18348. return _st(_st(self._nodes())._detect_ifNone_((function(each){
  18349. return smalltalk.withContext(function($ctx3) {
  18350. return _st(each)._subtreeNeedsAliasing();
  18351. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  18352. return smalltalk.withContext(function($ctx3) {
  18353. return false;
  18354. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))).__tild_eq(false);
  18355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18356. return $1;
  18357. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.Node)})},
  18358. args: [],
  18359. source: "subtreeNeedsAliasing\x0a\x09^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]",
  18360. messageSends: ["or:", "~=", "detect:ifNone:", "subtreeNeedsAliasing", "nodes", "shouldBeInlined", "shouldBeAliased"],
  18361. referencedClasses: []
  18362. }),
  18363. smalltalk.Node);
  18364. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler-AST');
  18365. smalltalk.AssignmentNode.comment="I represent an assignment node.";
  18366. smalltalk.addMethod(
  18367. smalltalk.method({
  18368. selector: "accept:",
  18369. category: 'visiting',
  18370. fn: function (aVisitor){
  18371. var self=this;
  18372. return smalltalk.withContext(function($ctx1) {
  18373. var $1;
  18374. $1=_st(aVisitor)._visitAssignmentNode_(self);
  18375. return $1;
  18376. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.AssignmentNode)})},
  18377. args: ["aVisitor"],
  18378. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  18379. messageSends: ["visitAssignmentNode:"],
  18380. referencedClasses: []
  18381. }),
  18382. smalltalk.AssignmentNode);
  18383. smalltalk.addMethod(
  18384. smalltalk.method({
  18385. selector: "isAssignmentNode",
  18386. category: 'testing',
  18387. fn: function (){
  18388. var self=this;
  18389. return smalltalk.withContext(function($ctx1) {
  18390. return true;
  18391. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.AssignmentNode)})},
  18392. args: [],
  18393. source: "isAssignmentNode\x0a\x09^ true",
  18394. messageSends: [],
  18395. referencedClasses: []
  18396. }),
  18397. smalltalk.AssignmentNode);
  18398. smalltalk.addMethod(
  18399. smalltalk.method({
  18400. selector: "left",
  18401. category: 'accessing',
  18402. fn: function (){
  18403. var self=this;
  18404. return smalltalk.withContext(function($ctx1) {
  18405. var $1;
  18406. $1=self["@left"];
  18407. return $1;
  18408. }, function($ctx1) {$ctx1.fill(self,"left",{},smalltalk.AssignmentNode)})},
  18409. args: [],
  18410. source: "left\x0a\x09^left",
  18411. messageSends: [],
  18412. referencedClasses: []
  18413. }),
  18414. smalltalk.AssignmentNode);
  18415. smalltalk.addMethod(
  18416. smalltalk.method({
  18417. selector: "left:",
  18418. category: 'accessing',
  18419. fn: function (aNode){
  18420. var self=this;
  18421. return smalltalk.withContext(function($ctx1) {
  18422. self["@left"]=aNode;
  18423. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},smalltalk.AssignmentNode)})},
  18424. args: ["aNode"],
  18425. source: "left: aNode\x0a\x09left := aNode",
  18426. messageSends: [],
  18427. referencedClasses: []
  18428. }),
  18429. smalltalk.AssignmentNode);
  18430. smalltalk.addMethod(
  18431. smalltalk.method({
  18432. selector: "nodes",
  18433. category: 'accessing',
  18434. fn: function (){
  18435. var self=this;
  18436. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18437. return smalltalk.withContext(function($ctx1) {
  18438. var $1;
  18439. $1=_st($Array())._with_with_(self._left(),self._right());
  18440. return $1;
  18441. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.AssignmentNode)})},
  18442. args: [],
  18443. source: "nodes\x0a\x09^ Array with: self left with: self right",
  18444. messageSends: ["with:with:", "left", "right"],
  18445. referencedClasses: ["Array"]
  18446. }),
  18447. smalltalk.AssignmentNode);
  18448. smalltalk.addMethod(
  18449. smalltalk.method({
  18450. selector: "right",
  18451. category: 'accessing',
  18452. fn: function (){
  18453. var self=this;
  18454. return smalltalk.withContext(function($ctx1) {
  18455. var $1;
  18456. $1=self["@right"];
  18457. return $1;
  18458. }, function($ctx1) {$ctx1.fill(self,"right",{},smalltalk.AssignmentNode)})},
  18459. args: [],
  18460. source: "right\x0a\x09^right",
  18461. messageSends: [],
  18462. referencedClasses: []
  18463. }),
  18464. smalltalk.AssignmentNode);
  18465. smalltalk.addMethod(
  18466. smalltalk.method({
  18467. selector: "right:",
  18468. category: 'accessing',
  18469. fn: function (aNode){
  18470. var self=this;
  18471. return smalltalk.withContext(function($ctx1) {
  18472. self["@right"]=aNode;
  18473. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},smalltalk.AssignmentNode)})},
  18474. args: ["aNode"],
  18475. source: "right: aNode\x0a\x09right := aNode",
  18476. messageSends: [],
  18477. referencedClasses: []
  18478. }),
  18479. smalltalk.AssignmentNode);
  18480. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'scope'], 'Compiler-AST');
  18481. smalltalk.BlockNode.comment="I represent an block closure node.";
  18482. smalltalk.addMethod(
  18483. smalltalk.method({
  18484. selector: "accept:",
  18485. category: 'visiting',
  18486. fn: function (aVisitor){
  18487. var self=this;
  18488. return smalltalk.withContext(function($ctx1) {
  18489. var $1;
  18490. $1=_st(aVisitor)._visitBlockNode_(self);
  18491. return $1;
  18492. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockNode)})},
  18493. args: ["aVisitor"],
  18494. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  18495. messageSends: ["visitBlockNode:"],
  18496. referencedClasses: []
  18497. }),
  18498. smalltalk.BlockNode);
  18499. smalltalk.addMethod(
  18500. smalltalk.method({
  18501. selector: "isBlockNode",
  18502. category: 'testing',
  18503. fn: function (){
  18504. var self=this;
  18505. return smalltalk.withContext(function($ctx1) {
  18506. return true;
  18507. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.BlockNode)})},
  18508. args: [],
  18509. source: "isBlockNode\x0a\x09^true",
  18510. messageSends: [],
  18511. referencedClasses: []
  18512. }),
  18513. smalltalk.BlockNode);
  18514. smalltalk.addMethod(
  18515. smalltalk.method({
  18516. selector: "parameters",
  18517. category: 'accessing',
  18518. fn: function (){
  18519. var self=this;
  18520. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  18521. return smalltalk.withContext(function($ctx1) {
  18522. var $2,$1;
  18523. $2=self["@parameters"];
  18524. if(($receiver = $2) == nil || $receiver == undefined){
  18525. self["@parameters"]=_st($Array())._new();
  18526. $1=self["@parameters"];
  18527. } else {
  18528. $1=$2;
  18529. };
  18530. return $1;
  18531. }, function($ctx1) {$ctx1.fill(self,"parameters",{},smalltalk.BlockNode)})},
  18532. args: [],
  18533. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  18534. messageSends: ["ifNil:", "new"],
  18535. referencedClasses: ["Array"]
  18536. }),
  18537. smalltalk.BlockNode);
  18538. smalltalk.addMethod(
  18539. smalltalk.method({
  18540. selector: "parameters:",
  18541. category: 'accessing',
  18542. fn: function (aCollection){
  18543. var self=this;
  18544. return smalltalk.withContext(function($ctx1) {
  18545. self["@parameters"]=aCollection;
  18546. return self}, function($ctx1) {$ctx1.fill(self,"parameters:",{aCollection:aCollection},smalltalk.BlockNode)})},
  18547. args: ["aCollection"],
  18548. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  18549. messageSends: [],
  18550. referencedClasses: []
  18551. }),
  18552. smalltalk.BlockNode);
  18553. smalltalk.addMethod(
  18554. smalltalk.method({
  18555. selector: "scope",
  18556. category: 'accessing',
  18557. fn: function (){
  18558. var self=this;
  18559. return smalltalk.withContext(function($ctx1) {
  18560. var $1;
  18561. $1=self["@scope"];
  18562. return $1;
  18563. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.BlockNode)})},
  18564. args: [],
  18565. source: "scope\x0a\x09^ scope",
  18566. messageSends: [],
  18567. referencedClasses: []
  18568. }),
  18569. smalltalk.BlockNode);
  18570. smalltalk.addMethod(
  18571. smalltalk.method({
  18572. selector: "scope:",
  18573. category: 'accessing',
  18574. fn: function (aLexicalScope){
  18575. var self=this;
  18576. return smalltalk.withContext(function($ctx1) {
  18577. self["@scope"]=aLexicalScope;
  18578. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.BlockNode)})},
  18579. args: ["aLexicalScope"],
  18580. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  18581. messageSends: [],
  18582. referencedClasses: []
  18583. }),
  18584. smalltalk.BlockNode);
  18585. smalltalk.addMethod(
  18586. smalltalk.method({
  18587. selector: "subtreeNeedsAliasing",
  18588. category: 'testing',
  18589. fn: function (){
  18590. var self=this;
  18591. return smalltalk.withContext(function($ctx1) {
  18592. var $1;
  18593. $1=_st(self._shouldBeAliased())._or_((function(){
  18594. return smalltalk.withContext(function($ctx2) {
  18595. return self._shouldBeInlined();
  18596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  18597. return $1;
  18598. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.BlockNode)})},
  18599. args: [],
  18600. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  18601. messageSends: ["or:", "shouldBeInlined", "shouldBeAliased"],
  18602. referencedClasses: []
  18603. }),
  18604. smalltalk.BlockNode);
  18605. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler-AST');
  18606. smalltalk.CascadeNode.comment="I represent an cascade node.";
  18607. smalltalk.addMethod(
  18608. smalltalk.method({
  18609. selector: "accept:",
  18610. category: 'visiting',
  18611. fn: function (aVisitor){
  18612. var self=this;
  18613. return smalltalk.withContext(function($ctx1) {
  18614. var $1;
  18615. $1=_st(aVisitor)._visitCascadeNode_(self);
  18616. return $1;
  18617. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.CascadeNode)})},
  18618. args: ["aVisitor"],
  18619. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  18620. messageSends: ["visitCascadeNode:"],
  18621. referencedClasses: []
  18622. }),
  18623. smalltalk.CascadeNode);
  18624. smalltalk.addMethod(
  18625. smalltalk.method({
  18626. selector: "receiver",
  18627. category: 'accessing',
  18628. fn: function (){
  18629. var self=this;
  18630. return smalltalk.withContext(function($ctx1) {
  18631. var $1;
  18632. $1=self["@receiver"];
  18633. return $1;
  18634. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.CascadeNode)})},
  18635. args: [],
  18636. source: "receiver\x0a\x09^receiver",
  18637. messageSends: [],
  18638. referencedClasses: []
  18639. }),
  18640. smalltalk.CascadeNode);
  18641. smalltalk.addMethod(
  18642. smalltalk.method({
  18643. selector: "receiver:",
  18644. category: 'accessing',
  18645. fn: function (aNode){
  18646. var self=this;
  18647. return smalltalk.withContext(function($ctx1) {
  18648. self["@receiver"]=aNode;
  18649. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.CascadeNode)})},
  18650. args: ["aNode"],
  18651. source: "receiver: aNode\x0a\x09receiver := aNode",
  18652. messageSends: [],
  18653. referencedClasses: []
  18654. }),
  18655. smalltalk.CascadeNode);
  18656. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler-AST');
  18657. smalltalk.DynamicArrayNode.comment="I represent an dynamic array node.";
  18658. smalltalk.addMethod(
  18659. smalltalk.method({
  18660. selector: "accept:",
  18661. category: 'visiting',
  18662. fn: function (aVisitor){
  18663. var self=this;
  18664. return smalltalk.withContext(function($ctx1) {
  18665. var $1;
  18666. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  18667. return $1;
  18668. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicArrayNode)})},
  18669. args: ["aVisitor"],
  18670. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  18671. messageSends: ["visitDynamicArrayNode:"],
  18672. referencedClasses: []
  18673. }),
  18674. smalltalk.DynamicArrayNode);
  18675. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler-AST');
  18676. smalltalk.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  18677. smalltalk.addMethod(
  18678. smalltalk.method({
  18679. selector: "accept:",
  18680. category: 'visiting',
  18681. fn: function (aVisitor){
  18682. var self=this;
  18683. return smalltalk.withContext(function($ctx1) {
  18684. var $1;
  18685. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  18686. return $1;
  18687. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicDictionaryNode)})},
  18688. args: ["aVisitor"],
  18689. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  18690. messageSends: ["visitDynamicDictionaryNode:"],
  18691. referencedClasses: []
  18692. }),
  18693. smalltalk.DynamicDictionaryNode);
  18694. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler-AST');
  18695. smalltalk.JSStatementNode.comment="I represent an JavaScript statement node.";
  18696. smalltalk.addMethod(
  18697. smalltalk.method({
  18698. selector: "accept:",
  18699. category: 'visiting',
  18700. fn: function (aVisitor){
  18701. var self=this;
  18702. return smalltalk.withContext(function($ctx1) {
  18703. var $1;
  18704. $1=_st(aVisitor)._visitJSStatementNode_(self);
  18705. return $1;
  18706. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.JSStatementNode)})},
  18707. args: ["aVisitor"],
  18708. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  18709. messageSends: ["visitJSStatementNode:"],
  18710. referencedClasses: []
  18711. }),
  18712. smalltalk.JSStatementNode);
  18713. smalltalk.addMethod(
  18714. smalltalk.method({
  18715. selector: "isJSStatementNode",
  18716. category: 'testing',
  18717. fn: function (){
  18718. var self=this;
  18719. return smalltalk.withContext(function($ctx1) {
  18720. return true;
  18721. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.JSStatementNode)})},
  18722. args: [],
  18723. source: "isJSStatementNode\x0a\x09^ true",
  18724. messageSends: [],
  18725. referencedClasses: []
  18726. }),
  18727. smalltalk.JSStatementNode);
  18728. smalltalk.addMethod(
  18729. smalltalk.method({
  18730. selector: "source",
  18731. category: 'accessing',
  18732. fn: function (){
  18733. var self=this;
  18734. return smalltalk.withContext(function($ctx1) {
  18735. var $2,$1;
  18736. $2=self["@source"];
  18737. if(($receiver = $2) == nil || $receiver == undefined){
  18738. $1="";
  18739. } else {
  18740. $1=$2;
  18741. };
  18742. return $1;
  18743. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.JSStatementNode)})},
  18744. args: [],
  18745. source: "source\x0a\x09^source ifNil: ['']",
  18746. messageSends: ["ifNil:"],
  18747. referencedClasses: []
  18748. }),
  18749. smalltalk.JSStatementNode);
  18750. smalltalk.addMethod(
  18751. smalltalk.method({
  18752. selector: "source:",
  18753. category: 'accessing',
  18754. fn: function (aString){
  18755. var self=this;
  18756. return smalltalk.withContext(function($ctx1) {
  18757. self["@source"]=aString;
  18758. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.JSStatementNode)})},
  18759. args: ["aString"],
  18760. source: "source: aString\x0a\x09source := aString",
  18761. messageSends: [],
  18762. referencedClasses: []
  18763. }),
  18764. smalltalk.JSStatementNode);
  18765. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'messageSends', 'superSends'], 'Compiler-AST');
  18766. smalltalk.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  18767. smalltalk.addMethod(
  18768. smalltalk.method({
  18769. selector: "accept:",
  18770. category: 'visiting',
  18771. fn: function (aVisitor){
  18772. var self=this;
  18773. return smalltalk.withContext(function($ctx1) {
  18774. var $1;
  18775. $1=_st(aVisitor)._visitMethodNode_(self);
  18776. return $1;
  18777. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.MethodNode)})},
  18778. args: ["aVisitor"],
  18779. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  18780. messageSends: ["visitMethodNode:"],
  18781. referencedClasses: []
  18782. }),
  18783. smalltalk.MethodNode);
  18784. smalltalk.addMethod(
  18785. smalltalk.method({
  18786. selector: "arguments",
  18787. category: 'accessing',
  18788. fn: function (){
  18789. var self=this;
  18790. return smalltalk.withContext(function($ctx1) {
  18791. var $2,$1;
  18792. $2=self["@arguments"];
  18793. if(($receiver = $2) == nil || $receiver == undefined){
  18794. $1=[];
  18795. } else {
  18796. $1=$2;
  18797. };
  18798. return $1;
  18799. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MethodNode)})},
  18800. args: [],
  18801. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  18802. messageSends: ["ifNil:"],
  18803. referencedClasses: []
  18804. }),
  18805. smalltalk.MethodNode);
  18806. smalltalk.addMethod(
  18807. smalltalk.method({
  18808. selector: "arguments:",
  18809. category: 'accessing',
  18810. fn: function (aCollection){
  18811. var self=this;
  18812. return smalltalk.withContext(function($ctx1) {
  18813. self["@arguments"]=aCollection;
  18814. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18815. args: ["aCollection"],
  18816. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  18817. messageSends: [],
  18818. referencedClasses: []
  18819. }),
  18820. smalltalk.MethodNode);
  18821. smalltalk.addMethod(
  18822. smalltalk.method({
  18823. selector: "classReferences",
  18824. category: 'accessing',
  18825. fn: function (){
  18826. var self=this;
  18827. return smalltalk.withContext(function($ctx1) {
  18828. var $1;
  18829. $1=self["@classReferences"];
  18830. return $1;
  18831. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.MethodNode)})},
  18832. args: [],
  18833. source: "classReferences\x0a\x09^ classReferences",
  18834. messageSends: [],
  18835. referencedClasses: []
  18836. }),
  18837. smalltalk.MethodNode);
  18838. smalltalk.addMethod(
  18839. smalltalk.method({
  18840. selector: "classReferences:",
  18841. category: 'accessing',
  18842. fn: function (aCollection){
  18843. var self=this;
  18844. return smalltalk.withContext(function($ctx1) {
  18845. self["@classReferences"]=aCollection;
  18846. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18847. args: ["aCollection"],
  18848. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  18849. messageSends: [],
  18850. referencedClasses: []
  18851. }),
  18852. smalltalk.MethodNode);
  18853. smalltalk.addMethod(
  18854. smalltalk.method({
  18855. selector: "extent",
  18856. category: 'accessing',
  18857. fn: function (){
  18858. var self=this;
  18859. return smalltalk.withContext(function($ctx1) {
  18860. var $1;
  18861. $1=_st(_st(_st(self._source())._lines())._size()).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__plus((1)));
  18862. return $1;
  18863. }, function($ctx1) {$ctx1.fill(self,"extent",{},smalltalk.MethodNode)})},
  18864. args: [],
  18865. source: "extent\x0a\x09^ self source lines size @ (self source lines last size + 1)",
  18866. messageSends: ["@", "+", "size", "last", "lines", "source"],
  18867. referencedClasses: []
  18868. }),
  18869. smalltalk.MethodNode);
  18870. smalltalk.addMethod(
  18871. smalltalk.method({
  18872. selector: "messageSends",
  18873. category: 'accessing',
  18874. fn: function (){
  18875. var self=this;
  18876. return smalltalk.withContext(function($ctx1) {
  18877. var $1;
  18878. $1=self["@messageSends"];
  18879. return $1;
  18880. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.MethodNode)})},
  18881. args: [],
  18882. source: "messageSends\x0a\x09^ messageSends",
  18883. messageSends: [],
  18884. referencedClasses: []
  18885. }),
  18886. smalltalk.MethodNode);
  18887. smalltalk.addMethod(
  18888. smalltalk.method({
  18889. selector: "messageSends:",
  18890. category: 'accessing',
  18891. fn: function (aCollection){
  18892. var self=this;
  18893. return smalltalk.withContext(function($ctx1) {
  18894. self["@messageSends"]=aCollection;
  18895. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  18896. args: ["aCollection"],
  18897. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  18898. messageSends: [],
  18899. referencedClasses: []
  18900. }),
  18901. smalltalk.MethodNode);
  18902. smalltalk.addMethod(
  18903. smalltalk.method({
  18904. selector: "scope",
  18905. category: 'accessing',
  18906. fn: function (){
  18907. var self=this;
  18908. return smalltalk.withContext(function($ctx1) {
  18909. var $1;
  18910. $1=self["@scope"];
  18911. return $1;
  18912. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.MethodNode)})},
  18913. args: [],
  18914. source: "scope\x0a\x09^ scope",
  18915. messageSends: [],
  18916. referencedClasses: []
  18917. }),
  18918. smalltalk.MethodNode);
  18919. smalltalk.addMethod(
  18920. smalltalk.method({
  18921. selector: "scope:",
  18922. category: 'accessing',
  18923. fn: function (aMethodScope){
  18924. var self=this;
  18925. return smalltalk.withContext(function($ctx1) {
  18926. self["@scope"]=aMethodScope;
  18927. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aMethodScope:aMethodScope},smalltalk.MethodNode)})},
  18928. args: ["aMethodScope"],
  18929. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  18930. messageSends: [],
  18931. referencedClasses: []
  18932. }),
  18933. smalltalk.MethodNode);
  18934. smalltalk.addMethod(
  18935. smalltalk.method({
  18936. selector: "selector",
  18937. category: 'accessing',
  18938. fn: function (){
  18939. var self=this;
  18940. return smalltalk.withContext(function($ctx1) {
  18941. var $1;
  18942. $1=self["@selector"];
  18943. return $1;
  18944. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodNode)})},
  18945. args: [],
  18946. source: "selector\x0a\x09^selector",
  18947. messageSends: [],
  18948. referencedClasses: []
  18949. }),
  18950. smalltalk.MethodNode);
  18951. smalltalk.addMethod(
  18952. smalltalk.method({
  18953. selector: "selector:",
  18954. category: 'accessing',
  18955. fn: function (aString){
  18956. var self=this;
  18957. return smalltalk.withContext(function($ctx1) {
  18958. self["@selector"]=aString;
  18959. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MethodNode)})},
  18960. args: ["aString"],
  18961. source: "selector: aString\x0a\x09selector := aString",
  18962. messageSends: [],
  18963. referencedClasses: []
  18964. }),
  18965. smalltalk.MethodNode);
  18966. smalltalk.addMethod(
  18967. smalltalk.method({
  18968. selector: "source",
  18969. category: 'accessing',
  18970. fn: function (){
  18971. var self=this;
  18972. return smalltalk.withContext(function($ctx1) {
  18973. var $1;
  18974. $1=self["@source"];
  18975. return $1;
  18976. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.MethodNode)})},
  18977. args: [],
  18978. source: "source\x0a\x09^source",
  18979. messageSends: [],
  18980. referencedClasses: []
  18981. }),
  18982. smalltalk.MethodNode);
  18983. smalltalk.addMethod(
  18984. smalltalk.method({
  18985. selector: "source:",
  18986. category: 'accessing',
  18987. fn: function (aString){
  18988. var self=this;
  18989. return smalltalk.withContext(function($ctx1) {
  18990. self["@source"]=aString;
  18991. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.MethodNode)})},
  18992. args: ["aString"],
  18993. source: "source: aString\x0a\x09source := aString",
  18994. messageSends: [],
  18995. referencedClasses: []
  18996. }),
  18997. smalltalk.MethodNode);
  18998. smalltalk.addMethod(
  18999. smalltalk.method({
  19000. selector: "superSends",
  19001. category: 'accessing',
  19002. fn: function (){
  19003. var self=this;
  19004. return smalltalk.withContext(function($ctx1) {
  19005. var $1;
  19006. $1=self["@superSends"];
  19007. return $1;
  19008. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.MethodNode)})},
  19009. args: [],
  19010. source: "superSends\x0a\x09^ superSends",
  19011. messageSends: [],
  19012. referencedClasses: []
  19013. }),
  19014. smalltalk.MethodNode);
  19015. smalltalk.addMethod(
  19016. smalltalk.method({
  19017. selector: "superSends:",
  19018. category: 'accessing',
  19019. fn: function (aCollection){
  19020. var self=this;
  19021. return smalltalk.withContext(function($ctx1) {
  19022. self["@superSends"]=aCollection;
  19023. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  19024. args: ["aCollection"],
  19025. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  19026. messageSends: [],
  19027. referencedClasses: []
  19028. }),
  19029. smalltalk.MethodNode);
  19030. smalltalk.addClass('ReturnNode', smalltalk.Node, ['scope'], 'Compiler-AST');
  19031. smalltalk.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  19032. smalltalk.addMethod(
  19033. smalltalk.method({
  19034. selector: "accept:",
  19035. category: 'visiting',
  19036. fn: function (aVisitor){
  19037. var self=this;
  19038. return smalltalk.withContext(function($ctx1) {
  19039. var $1;
  19040. $1=_st(aVisitor)._visitReturnNode_(self);
  19041. return $1;
  19042. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ReturnNode)})},
  19043. args: ["aVisitor"],
  19044. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  19045. messageSends: ["visitReturnNode:"],
  19046. referencedClasses: []
  19047. }),
  19048. smalltalk.ReturnNode);
  19049. smalltalk.addMethod(
  19050. smalltalk.method({
  19051. selector: "isReturnNode",
  19052. category: 'testing',
  19053. fn: function (){
  19054. var self=this;
  19055. return smalltalk.withContext(function($ctx1) {
  19056. return true;
  19057. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.ReturnNode)})},
  19058. args: [],
  19059. source: "isReturnNode\x0a\x09^ true",
  19060. messageSends: [],
  19061. referencedClasses: []
  19062. }),
  19063. smalltalk.ReturnNode);
  19064. smalltalk.addMethod(
  19065. smalltalk.method({
  19066. selector: "nonLocalReturn",
  19067. category: 'testing',
  19068. fn: function (){
  19069. var self=this;
  19070. return smalltalk.withContext(function($ctx1) {
  19071. var $1;
  19072. $1=_st(_st(self._scope())._isMethodScope())._not();
  19073. return $1;
  19074. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},smalltalk.ReturnNode)})},
  19075. args: [],
  19076. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  19077. messageSends: ["not", "isMethodScope", "scope"],
  19078. referencedClasses: []
  19079. }),
  19080. smalltalk.ReturnNode);
  19081. smalltalk.addMethod(
  19082. smalltalk.method({
  19083. selector: "scope",
  19084. category: 'accessing',
  19085. fn: function (){
  19086. var self=this;
  19087. return smalltalk.withContext(function($ctx1) {
  19088. var $1;
  19089. $1=self["@scope"];
  19090. return $1;
  19091. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ReturnNode)})},
  19092. args: [],
  19093. source: "scope\x0a\x09^ scope",
  19094. messageSends: [],
  19095. referencedClasses: []
  19096. }),
  19097. smalltalk.ReturnNode);
  19098. smalltalk.addMethod(
  19099. smalltalk.method({
  19100. selector: "scope:",
  19101. category: 'accessing',
  19102. fn: function (aLexicalScope){
  19103. var self=this;
  19104. return smalltalk.withContext(function($ctx1) {
  19105. self["@scope"]=aLexicalScope;
  19106. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.ReturnNode)})},
  19107. args: ["aLexicalScope"],
  19108. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  19109. messageSends: [],
  19110. referencedClasses: []
  19111. }),
  19112. smalltalk.ReturnNode);
  19113. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  19114. smalltalk.SendNode.comment="I represent an message send node.";
  19115. smalltalk.addMethod(
  19116. smalltalk.method({
  19117. selector: "accept:",
  19118. category: 'visiting',
  19119. fn: function (aVisitor){
  19120. var self=this;
  19121. return smalltalk.withContext(function($ctx1) {
  19122. var $1;
  19123. $1=_st(aVisitor)._visitSendNode_(self);
  19124. return $1;
  19125. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SendNode)})},
  19126. args: ["aVisitor"],
  19127. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  19128. messageSends: ["visitSendNode:"],
  19129. referencedClasses: []
  19130. }),
  19131. smalltalk.SendNode);
  19132. smalltalk.addMethod(
  19133. smalltalk.method({
  19134. selector: "arguments",
  19135. category: 'accessing',
  19136. fn: function (){
  19137. var self=this;
  19138. return smalltalk.withContext(function($ctx1) {
  19139. var $2,$1;
  19140. $2=self["@arguments"];
  19141. if(($receiver = $2) == nil || $receiver == undefined){
  19142. self["@arguments"]=[];
  19143. $1=self["@arguments"];
  19144. } else {
  19145. $1=$2;
  19146. };
  19147. return $1;
  19148. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.SendNode)})},
  19149. args: [],
  19150. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  19151. messageSends: ["ifNil:"],
  19152. referencedClasses: []
  19153. }),
  19154. smalltalk.SendNode);
  19155. smalltalk.addMethod(
  19156. smalltalk.method({
  19157. selector: "arguments:",
  19158. category: 'accessing',
  19159. fn: function (aCollection){
  19160. var self=this;
  19161. return smalltalk.withContext(function($ctx1) {
  19162. self["@arguments"]=aCollection;
  19163. _st(aCollection)._do_((function(each){
  19164. return smalltalk.withContext(function($ctx2) {
  19165. return _st(each)._parent_(self);
  19166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  19167. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.SendNode)})},
  19168. args: ["aCollection"],
  19169. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  19170. messageSends: ["do:", "parent:"],
  19171. referencedClasses: []
  19172. }),
  19173. smalltalk.SendNode);
  19174. smalltalk.addMethod(
  19175. smalltalk.method({
  19176. selector: "cascadeNodeWithMessages:",
  19177. category: 'accessing',
  19178. fn: function (aCollection){
  19179. var self=this;
  19180. var first;
  19181. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  19182. function $CascadeNode(){return smalltalk.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  19183. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19184. return smalltalk.withContext(function($ctx1) {
  19185. var $1,$2,$4,$5,$3;
  19186. $1=_st($SendNode())._new();
  19187. _st($1)._selector_(self._selector());
  19188. _st($1)._arguments_(self._arguments());
  19189. $2=_st($1)._yourself();
  19190. first=$2;
  19191. $4=_st($CascadeNode())._new();
  19192. _st($4)._receiver_(self._receiver());
  19193. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  19194. $5=_st($4)._yourself();
  19195. $3=$5;
  19196. return $3;
  19197. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},smalltalk.SendNode)})},
  19198. args: ["aCollection"],
  19199. 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",
  19200. messageSends: ["selector:", "selector", "new", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  19201. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  19202. }),
  19203. smalltalk.SendNode);
  19204. smalltalk.addMethod(
  19205. smalltalk.method({
  19206. selector: "index",
  19207. category: 'accessing',
  19208. fn: function (){
  19209. var self=this;
  19210. return smalltalk.withContext(function($ctx1) {
  19211. var $1;
  19212. $1=self["@index"];
  19213. return $1;
  19214. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.SendNode)})},
  19215. args: [],
  19216. source: "index\x0a\x09^ index",
  19217. messageSends: [],
  19218. referencedClasses: []
  19219. }),
  19220. smalltalk.SendNode);
  19221. smalltalk.addMethod(
  19222. smalltalk.method({
  19223. selector: "index:",
  19224. category: 'accessing',
  19225. fn: function (anInteger){
  19226. var self=this;
  19227. return smalltalk.withContext(function($ctx1) {
  19228. self["@index"]=anInteger;
  19229. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.SendNode)})},
  19230. args: ["anInteger"],
  19231. source: "index: anInteger\x0a\x09index := anInteger",
  19232. messageSends: [],
  19233. referencedClasses: []
  19234. }),
  19235. smalltalk.SendNode);
  19236. smalltalk.addMethod(
  19237. smalltalk.method({
  19238. selector: "isSendNode",
  19239. category: 'testing',
  19240. fn: function (){
  19241. var self=this;
  19242. return smalltalk.withContext(function($ctx1) {
  19243. return true;
  19244. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.SendNode)})},
  19245. args: [],
  19246. source: "isSendNode\x0a\x09^ true",
  19247. messageSends: [],
  19248. referencedClasses: []
  19249. }),
  19250. smalltalk.SendNode);
  19251. smalltalk.addMethod(
  19252. smalltalk.method({
  19253. selector: "nodes",
  19254. category: 'accessing',
  19255. fn: function (){
  19256. var self=this;
  19257. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19258. return smalltalk.withContext(function($ctx1) {
  19259. var $2,$3,$1;
  19260. $2=_st($Array())._withAll_(self._arguments());
  19261. _st($2)._add_(self._receiver());
  19262. $3=_st($2)._yourself();
  19263. $1=$3;
  19264. return $1;
  19265. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.SendNode)})},
  19266. args: [],
  19267. source: "nodes\x0a\x09^ (Array withAll: self arguments)\x0a\x09\x09add: self receiver;\x0a\x09\x09yourself",
  19268. messageSends: ["add:", "receiver", "withAll:", "arguments", "yourself"],
  19269. referencedClasses: ["Array"]
  19270. }),
  19271. smalltalk.SendNode);
  19272. smalltalk.addMethod(
  19273. smalltalk.method({
  19274. selector: "receiver",
  19275. category: 'accessing',
  19276. fn: function (){
  19277. var self=this;
  19278. return smalltalk.withContext(function($ctx1) {
  19279. var $1;
  19280. $1=self["@receiver"];
  19281. return $1;
  19282. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.SendNode)})},
  19283. args: [],
  19284. source: "receiver\x0a\x09^receiver",
  19285. messageSends: [],
  19286. referencedClasses: []
  19287. }),
  19288. smalltalk.SendNode);
  19289. smalltalk.addMethod(
  19290. smalltalk.method({
  19291. selector: "receiver:",
  19292. category: 'accessing',
  19293. fn: function (aNode){
  19294. var self=this;
  19295. return smalltalk.withContext(function($ctx1) {
  19296. var $1;
  19297. self["@receiver"]=aNode;
  19298. $1=_st(aNode)._isNode();
  19299. if(smalltalk.assert($1)){
  19300. _st(aNode)._parent_(self);
  19301. };
  19302. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.SendNode)})},
  19303. args: ["aNode"],
  19304. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  19305. messageSends: ["ifTrue:", "parent:", "isNode"],
  19306. referencedClasses: []
  19307. }),
  19308. smalltalk.SendNode);
  19309. smalltalk.addMethod(
  19310. smalltalk.method({
  19311. selector: "selector",
  19312. category: 'accessing',
  19313. fn: function (){
  19314. var self=this;
  19315. return smalltalk.withContext(function($ctx1) {
  19316. var $1;
  19317. $1=self["@selector"];
  19318. return $1;
  19319. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.SendNode)})},
  19320. args: [],
  19321. source: "selector\x0a\x09^selector",
  19322. messageSends: [],
  19323. referencedClasses: []
  19324. }),
  19325. smalltalk.SendNode);
  19326. smalltalk.addMethod(
  19327. smalltalk.method({
  19328. selector: "selector:",
  19329. category: 'accessing',
  19330. fn: function (aString){
  19331. var self=this;
  19332. return smalltalk.withContext(function($ctx1) {
  19333. self["@selector"]=aString;
  19334. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.SendNode)})},
  19335. args: ["aString"],
  19336. source: "selector: aString\x0a\x09selector := aString",
  19337. messageSends: [],
  19338. referencedClasses: []
  19339. }),
  19340. smalltalk.SendNode);
  19341. smalltalk.addMethod(
  19342. smalltalk.method({
  19343. selector: "stopOnStepping",
  19344. category: 'testing',
  19345. fn: function (){
  19346. var self=this;
  19347. return smalltalk.withContext(function($ctx1) {
  19348. return true;
  19349. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.SendNode)})},
  19350. args: [],
  19351. source: "stopOnStepping\x0a\x09^ true",
  19352. messageSends: [],
  19353. referencedClasses: []
  19354. }),
  19355. smalltalk.SendNode);
  19356. smalltalk.addMethod(
  19357. smalltalk.method({
  19358. selector: "superSend",
  19359. category: 'accessing',
  19360. fn: function (){
  19361. var self=this;
  19362. return smalltalk.withContext(function($ctx1) {
  19363. var $2,$1;
  19364. $2=self["@superSend"];
  19365. if(($receiver = $2) == nil || $receiver == undefined){
  19366. $1=false;
  19367. } else {
  19368. $1=$2;
  19369. };
  19370. return $1;
  19371. }, function($ctx1) {$ctx1.fill(self,"superSend",{},smalltalk.SendNode)})},
  19372. args: [],
  19373. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  19374. messageSends: ["ifNil:"],
  19375. referencedClasses: []
  19376. }),
  19377. smalltalk.SendNode);
  19378. smalltalk.addMethod(
  19379. smalltalk.method({
  19380. selector: "superSend:",
  19381. category: 'accessing',
  19382. fn: function (aBoolean){
  19383. var self=this;
  19384. return smalltalk.withContext(function($ctx1) {
  19385. self["@superSend"]=aBoolean;
  19386. return self}, function($ctx1) {$ctx1.fill(self,"superSend:",{aBoolean:aBoolean},smalltalk.SendNode)})},
  19387. args: ["aBoolean"],
  19388. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  19389. messageSends: [],
  19390. referencedClasses: []
  19391. }),
  19392. smalltalk.SendNode);
  19393. smalltalk.addMethod(
  19394. smalltalk.method({
  19395. selector: "valueForReceiver:",
  19396. category: 'accessing',
  19397. fn: function (anObject){
  19398. var self=this;
  19399. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  19400. return smalltalk.withContext(function($ctx1) {
  19401. var $2,$3,$5,$4,$6,$1;
  19402. $2=_st($SendNode())._new();
  19403. _st($2)._position_(self._position());
  19404. $3=$2;
  19405. $5=self._receiver();
  19406. if(($receiver = $5) == nil || $receiver == undefined){
  19407. $4=anObject;
  19408. } else {
  19409. $4=_st(self._receiver())._valueForReceiver_(anObject);
  19410. };
  19411. _st($3)._receiver_($4);
  19412. _st($2)._selector_(self._selector());
  19413. _st($2)._arguments_(self._arguments());
  19414. $6=_st($2)._yourself();
  19415. $1=$6;
  19416. return $1;
  19417. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},smalltalk.SendNode)})},
  19418. args: ["anObject"],
  19419. source: "valueForReceiver: anObject\x0a\x09^SendNode new\x0a\x09\x09position: self position;\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",
  19420. messageSends: ["position:", "position", "new", "receiver:", "ifNil:ifNotNil:", "valueForReceiver:", "receiver", "selector:", "selector", "arguments:", "arguments", "yourself"],
  19421. referencedClasses: ["SendNode"]
  19422. }),
  19423. smalltalk.SendNode);
  19424. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps', 'scope'], 'Compiler-AST');
  19425. smalltalk.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).";
  19426. smalltalk.addMethod(
  19427. smalltalk.method({
  19428. selector: "accept:",
  19429. category: 'visiting',
  19430. fn: function (aVisitor){
  19431. var self=this;
  19432. return smalltalk.withContext(function($ctx1) {
  19433. var $1;
  19434. $1=_st(aVisitor)._visitSequenceNode_(self);
  19435. return $1;
  19436. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SequenceNode)})},
  19437. args: ["aVisitor"],
  19438. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  19439. messageSends: ["visitSequenceNode:"],
  19440. referencedClasses: []
  19441. }),
  19442. smalltalk.SequenceNode);
  19443. smalltalk.addMethod(
  19444. smalltalk.method({
  19445. selector: "asBlockSequenceNode",
  19446. category: 'testing',
  19447. fn: function (){
  19448. var self=this;
  19449. function $BlockSequenceNode(){return smalltalk.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  19450. return smalltalk.withContext(function($ctx1) {
  19451. var $2,$3,$1;
  19452. $2=_st($BlockSequenceNode())._new();
  19453. _st($2)._position_(self._position());
  19454. _st($2)._nodes_(self._nodes());
  19455. _st($2)._temps_(self._temps());
  19456. $3=_st($2)._yourself();
  19457. $1=$3;
  19458. return $1;
  19459. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},smalltalk.SequenceNode)})},
  19460. args: [],
  19461. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  19462. messageSends: ["position:", "position", "new", "nodes:", "nodes", "temps:", "temps", "yourself"],
  19463. referencedClasses: ["BlockSequenceNode"]
  19464. }),
  19465. smalltalk.SequenceNode);
  19466. smalltalk.addMethod(
  19467. smalltalk.method({
  19468. selector: "scope",
  19469. category: 'accessing',
  19470. fn: function (){
  19471. var self=this;
  19472. return smalltalk.withContext(function($ctx1) {
  19473. var $1;
  19474. $1=self["@scope"];
  19475. return $1;
  19476. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.SequenceNode)})},
  19477. args: [],
  19478. source: "scope\x0a\x09^ scope",
  19479. messageSends: [],
  19480. referencedClasses: []
  19481. }),
  19482. smalltalk.SequenceNode);
  19483. smalltalk.addMethod(
  19484. smalltalk.method({
  19485. selector: "scope:",
  19486. category: 'accessing',
  19487. fn: function (aLexicalScope){
  19488. var self=this;
  19489. return smalltalk.withContext(function($ctx1) {
  19490. self["@scope"]=aLexicalScope;
  19491. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.SequenceNode)})},
  19492. args: ["aLexicalScope"],
  19493. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  19494. messageSends: [],
  19495. referencedClasses: []
  19496. }),
  19497. smalltalk.SequenceNode);
  19498. smalltalk.addMethod(
  19499. smalltalk.method({
  19500. selector: "temps",
  19501. category: 'accessing',
  19502. fn: function (){
  19503. var self=this;
  19504. return smalltalk.withContext(function($ctx1) {
  19505. var $2,$1;
  19506. $2=self["@temps"];
  19507. if(($receiver = $2) == nil || $receiver == undefined){
  19508. $1=[];
  19509. } else {
  19510. $1=$2;
  19511. };
  19512. return $1;
  19513. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.SequenceNode)})},
  19514. args: [],
  19515. source: "temps\x0a\x09^temps ifNil: [#()]",
  19516. messageSends: ["ifNil:"],
  19517. referencedClasses: []
  19518. }),
  19519. smalltalk.SequenceNode);
  19520. smalltalk.addMethod(
  19521. smalltalk.method({
  19522. selector: "temps:",
  19523. category: 'accessing',
  19524. fn: function (aCollection){
  19525. var self=this;
  19526. return smalltalk.withContext(function($ctx1) {
  19527. self["@temps"]=aCollection;
  19528. return self}, function($ctx1) {$ctx1.fill(self,"temps:",{aCollection:aCollection},smalltalk.SequenceNode)})},
  19529. args: ["aCollection"],
  19530. source: "temps: aCollection\x0a\x09temps := aCollection",
  19531. messageSends: [],
  19532. referencedClasses: []
  19533. }),
  19534. smalltalk.SequenceNode);
  19535. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler-AST');
  19536. smalltalk.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  19537. smalltalk.addMethod(
  19538. smalltalk.method({
  19539. selector: "accept:",
  19540. category: 'visiting',
  19541. fn: function (aVisitor){
  19542. var self=this;
  19543. return smalltalk.withContext(function($ctx1) {
  19544. var $1;
  19545. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  19546. return $1;
  19547. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockSequenceNode)})},
  19548. args: ["aVisitor"],
  19549. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  19550. messageSends: ["visitBlockSequenceNode:"],
  19551. referencedClasses: []
  19552. }),
  19553. smalltalk.BlockSequenceNode);
  19554. smalltalk.addMethod(
  19555. smalltalk.method({
  19556. selector: "isBlockSequenceNode",
  19557. category: 'testing',
  19558. fn: function (){
  19559. var self=this;
  19560. return smalltalk.withContext(function($ctx1) {
  19561. return true;
  19562. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.BlockSequenceNode)})},
  19563. args: [],
  19564. source: "isBlockSequenceNode\x0a\x09^true",
  19565. messageSends: [],
  19566. referencedClasses: []
  19567. }),
  19568. smalltalk.BlockSequenceNode);
  19569. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler-AST');
  19570. smalltalk.ValueNode.comment="I represent a value node.";
  19571. smalltalk.addMethod(
  19572. smalltalk.method({
  19573. selector: "accept:",
  19574. category: 'visiting',
  19575. fn: function (aVisitor){
  19576. var self=this;
  19577. return smalltalk.withContext(function($ctx1) {
  19578. var $1;
  19579. $1=_st(aVisitor)._visitValueNode_(self);
  19580. return $1;
  19581. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ValueNode)})},
  19582. args: ["aVisitor"],
  19583. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  19584. messageSends: ["visitValueNode:"],
  19585. referencedClasses: []
  19586. }),
  19587. smalltalk.ValueNode);
  19588. smalltalk.addMethod(
  19589. smalltalk.method({
  19590. selector: "isImmutable",
  19591. category: 'testing',
  19592. fn: function (){
  19593. var self=this;
  19594. return smalltalk.withContext(function($ctx1) {
  19595. var $1;
  19596. $1=_st(self._value())._isImmutable();
  19597. return $1;
  19598. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.ValueNode)})},
  19599. args: [],
  19600. source: "isImmutable\x0a\x09^ self value isImmutable",
  19601. messageSends: ["isImmutable", "value"],
  19602. referencedClasses: []
  19603. }),
  19604. smalltalk.ValueNode);
  19605. smalltalk.addMethod(
  19606. smalltalk.method({
  19607. selector: "isValueNode",
  19608. category: 'testing',
  19609. fn: function (){
  19610. var self=this;
  19611. return smalltalk.withContext(function($ctx1) {
  19612. return true;
  19613. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.ValueNode)})},
  19614. args: [],
  19615. source: "isValueNode\x0a\x09^true",
  19616. messageSends: [],
  19617. referencedClasses: []
  19618. }),
  19619. smalltalk.ValueNode);
  19620. smalltalk.addMethod(
  19621. smalltalk.method({
  19622. selector: "value",
  19623. category: 'accessing',
  19624. fn: function (){
  19625. var self=this;
  19626. return smalltalk.withContext(function($ctx1) {
  19627. var $1;
  19628. $1=self["@value"];
  19629. return $1;
  19630. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.ValueNode)})},
  19631. args: [],
  19632. source: "value\x0a\x09^value",
  19633. messageSends: [],
  19634. referencedClasses: []
  19635. }),
  19636. smalltalk.ValueNode);
  19637. smalltalk.addMethod(
  19638. smalltalk.method({
  19639. selector: "value:",
  19640. category: 'accessing',
  19641. fn: function (anObject){
  19642. var self=this;
  19643. return smalltalk.withContext(function($ctx1) {
  19644. self["@value"]=anObject;
  19645. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.ValueNode)})},
  19646. args: ["anObject"],
  19647. source: "value: anObject\x0a\x09value := anObject",
  19648. messageSends: [],
  19649. referencedClasses: []
  19650. }),
  19651. smalltalk.ValueNode);
  19652. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  19653. smalltalk.VariableNode.comment="I represent an variable node.";
  19654. smalltalk.addMethod(
  19655. smalltalk.method({
  19656. selector: "accept:",
  19657. category: 'visiting',
  19658. fn: function (aVisitor){
  19659. var self=this;
  19660. return smalltalk.withContext(function($ctx1) {
  19661. var $1;
  19662. $1=_st(aVisitor)._visitVariableNode_(self);
  19663. return $1;
  19664. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.VariableNode)})},
  19665. args: ["aVisitor"],
  19666. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  19667. messageSends: ["visitVariableNode:"],
  19668. referencedClasses: []
  19669. }),
  19670. smalltalk.VariableNode);
  19671. smalltalk.addMethod(
  19672. smalltalk.method({
  19673. selector: "alias",
  19674. category: 'accessing',
  19675. fn: function (){
  19676. var self=this;
  19677. return smalltalk.withContext(function($ctx1) {
  19678. var $1;
  19679. $1=_st(self._binding())._alias();
  19680. return $1;
  19681. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.VariableNode)})},
  19682. args: [],
  19683. source: "alias\x0a\x09^ self binding alias",
  19684. messageSends: ["alias", "binding"],
  19685. referencedClasses: []
  19686. }),
  19687. smalltalk.VariableNode);
  19688. smalltalk.addMethod(
  19689. smalltalk.method({
  19690. selector: "assigned",
  19691. category: 'accessing',
  19692. fn: function (){
  19693. var self=this;
  19694. return smalltalk.withContext(function($ctx1) {
  19695. var $2,$1;
  19696. $2=self["@assigned"];
  19697. if(($receiver = $2) == nil || $receiver == undefined){
  19698. $1=false;
  19699. } else {
  19700. $1=$2;
  19701. };
  19702. return $1;
  19703. }, function($ctx1) {$ctx1.fill(self,"assigned",{},smalltalk.VariableNode)})},
  19704. args: [],
  19705. source: "assigned\x0a\x09^assigned ifNil: [false]",
  19706. messageSends: ["ifNil:"],
  19707. referencedClasses: []
  19708. }),
  19709. smalltalk.VariableNode);
  19710. smalltalk.addMethod(
  19711. smalltalk.method({
  19712. selector: "assigned:",
  19713. category: 'accessing',
  19714. fn: function (aBoolean){
  19715. var self=this;
  19716. return smalltalk.withContext(function($ctx1) {
  19717. self["@assigned"]=aBoolean;
  19718. return self}, function($ctx1) {$ctx1.fill(self,"assigned:",{aBoolean:aBoolean},smalltalk.VariableNode)})},
  19719. args: ["aBoolean"],
  19720. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  19721. messageSends: [],
  19722. referencedClasses: []
  19723. }),
  19724. smalltalk.VariableNode);
  19725. smalltalk.addMethod(
  19726. smalltalk.method({
  19727. selector: "beAssigned",
  19728. category: 'accessing',
  19729. fn: function (){
  19730. var self=this;
  19731. return smalltalk.withContext(function($ctx1) {
  19732. _st(self._binding())._validateAssignment();
  19733. self["@assigned"]=true;
  19734. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},smalltalk.VariableNode)})},
  19735. args: [],
  19736. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  19737. messageSends: ["validateAssignment", "binding"],
  19738. referencedClasses: []
  19739. }),
  19740. smalltalk.VariableNode);
  19741. smalltalk.addMethod(
  19742. smalltalk.method({
  19743. selector: "binding",
  19744. category: 'accessing',
  19745. fn: function (){
  19746. var self=this;
  19747. return smalltalk.withContext(function($ctx1) {
  19748. var $1;
  19749. $1=self["@binding"];
  19750. return $1;
  19751. }, function($ctx1) {$ctx1.fill(self,"binding",{},smalltalk.VariableNode)})},
  19752. args: [],
  19753. source: "binding\x0a\x09^ binding",
  19754. messageSends: [],
  19755. referencedClasses: []
  19756. }),
  19757. smalltalk.VariableNode);
  19758. smalltalk.addMethod(
  19759. smalltalk.method({
  19760. selector: "binding:",
  19761. category: 'accessing',
  19762. fn: function (aScopeVar){
  19763. var self=this;
  19764. return smalltalk.withContext(function($ctx1) {
  19765. self["@binding"]=aScopeVar;
  19766. return self}, function($ctx1) {$ctx1.fill(self,"binding:",{aScopeVar:aScopeVar},smalltalk.VariableNode)})},
  19767. args: ["aScopeVar"],
  19768. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  19769. messageSends: [],
  19770. referencedClasses: []
  19771. }),
  19772. smalltalk.VariableNode);
  19773. smalltalk.addMethod(
  19774. smalltalk.method({
  19775. selector: "isImmutable",
  19776. category: 'testing',
  19777. fn: function (){
  19778. var self=this;
  19779. return smalltalk.withContext(function($ctx1) {
  19780. return false;
  19781. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.VariableNode)})},
  19782. args: [],
  19783. source: "isImmutable\x0a\x09^false",
  19784. messageSends: [],
  19785. referencedClasses: []
  19786. }),
  19787. smalltalk.VariableNode);
  19788. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler-AST');
  19789. smalltalk.ClassReferenceNode.comment="I represent an class reference node.";
  19790. smalltalk.addMethod(
  19791. smalltalk.method({
  19792. selector: "accept:",
  19793. category: 'visiting',
  19794. fn: function (aVisitor){
  19795. var self=this;
  19796. return smalltalk.withContext(function($ctx1) {
  19797. var $1;
  19798. $1=_st(aVisitor)._visitClassReferenceNode_(self);
  19799. return $1;
  19800. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ClassReferenceNode)})},
  19801. args: ["aVisitor"],
  19802. source: "accept: aVisitor\x0a\x09^ aVisitor visitClassReferenceNode: self",
  19803. messageSends: ["visitClassReferenceNode:"],
  19804. referencedClasses: []
  19805. }),
  19806. smalltalk.ClassReferenceNode);
  19807. smalltalk.addMethod(
  19808. smalltalk.method({
  19809. selector: "isNode",
  19810. category: '*Compiler-AST',
  19811. fn: function (){
  19812. var self=this;
  19813. return smalltalk.withContext(function($ctx1) {
  19814. return false;
  19815. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Object)})},
  19816. args: [],
  19817. source: "isNode\x0a\x09^ false",
  19818. messageSends: [],
  19819. referencedClasses: []
  19820. }),
  19821. smalltalk.Object);
  19822. smalltalk.addMethod(
  19823. smalltalk.method({
  19824. selector: "ast",
  19825. category: '*Compiler-AST',
  19826. fn: function (){
  19827. var self=this;
  19828. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19829. return smalltalk.withContext(function($ctx1) {
  19830. var $1;
  19831. _st(self._source())._ifEmpty_((function(){
  19832. return smalltalk.withContext(function($ctx2) {
  19833. return self._error_("Method source is empty");
  19834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  19835. $1=_st(_st($Smalltalk())._current())._parse_(self._source());
  19836. return $1;
  19837. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.CompiledMethod)})},
  19838. args: [],
  19839. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk current parse: self source",
  19840. messageSends: ["ifEmpty:", "error:", "source", "parse:", "current"],
  19841. referencedClasses: ["Smalltalk"]
  19842. }),
  19843. smalltalk.CompiledMethod);
  19844. smalltalk.addPackage('Compiler-IR');
  19845. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  19846. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  19847. smalltalk.addMethod(
  19848. smalltalk.method({
  19849. selector: "alias:",
  19850. category: 'visiting',
  19851. fn: function (aNode){
  19852. var self=this;
  19853. var variable;
  19854. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  19855. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  19856. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  19857. return smalltalk.withContext(function($ctx1) {
  19858. var $1,$2,$3,$4,$5,$6,$7;
  19859. $1=_st(aNode)._isImmutable();
  19860. if(smalltalk.assert($1)){
  19861. $2=self._visit_(aNode);
  19862. return $2;
  19863. };
  19864. $3=_st($IRVariable())._new();
  19865. _st($3)._variable_(_st(_st($AliasVar())._new())._name_("$".__comma(self._nextAlias())));
  19866. $4=_st($3)._yourself();
  19867. variable=$4;
  19868. $5=_st($IRAssignment())._new();
  19869. _st($5)._add_(variable);
  19870. _st($5)._add_(self._visit_(aNode));
  19871. $6=_st($5)._yourself();
  19872. _st(self._sequence())._add_($6);
  19873. _st(_st(self._method())._internalVariables())._add_(variable);
  19874. $7=variable;
  19875. return $7;
  19876. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},smalltalk.IRASTTranslator)})},
  19877. args: ["aNode"],
  19878. 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",
  19879. messageSends: ["ifTrue:", "visit:", "isImmutable", "variable:", "name:", ",", "nextAlias", "new", "yourself", "add:", "sequence", "internalVariables", "method"],
  19880. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  19881. }),
  19882. smalltalk.IRASTTranslator);
  19883. smalltalk.addMethod(
  19884. smalltalk.method({
  19885. selector: "aliasTemporally:",
  19886. category: 'visiting',
  19887. fn: function (aCollection){
  19888. var self=this;
  19889. var threshold,result;
  19890. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  19891. return smalltalk.withContext(function($ctx1) {
  19892. var $1,$2,$4,$3,$5;
  19893. threshold=(0);
  19894. _st(aCollection)._withIndexDo_((function(each,i){
  19895. return smalltalk.withContext(function($ctx2) {
  19896. $1=_st(each)._subtreeNeedsAliasing();
  19897. if(smalltalk.assert($1)){
  19898. threshold=i;
  19899. return threshold;
  19900. };
  19901. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  19902. result=_st($OrderedCollection())._new();
  19903. _st(aCollection)._withIndexDo_((function(each,i){
  19904. return smalltalk.withContext(function($ctx2) {
  19905. $2=result;
  19906. $4=_st(i).__lt_eq(threshold);
  19907. if(smalltalk.assert($4)){
  19908. $3=self._alias_(each);
  19909. } else {
  19910. $3=self._visit_(each);
  19911. };
  19912. return _st($2)._add_($3);
  19913. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  19914. $5=result;
  19915. return $5;
  19916. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},smalltalk.IRASTTranslator)})},
  19917. args: ["aCollection"],
  19918. 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",
  19919. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "alias:", "visit:", "<="],
  19920. referencedClasses: ["OrderedCollection"]
  19921. }),
  19922. smalltalk.IRASTTranslator);
  19923. smalltalk.addMethod(
  19924. smalltalk.method({
  19925. selector: "method",
  19926. category: 'accessing',
  19927. fn: function (){
  19928. var self=this;
  19929. return smalltalk.withContext(function($ctx1) {
  19930. var $1;
  19931. $1=self["@method"];
  19932. return $1;
  19933. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRASTTranslator)})},
  19934. args: [],
  19935. source: "method\x0a\x09^ method",
  19936. messageSends: [],
  19937. referencedClasses: []
  19938. }),
  19939. smalltalk.IRASTTranslator);
  19940. smalltalk.addMethod(
  19941. smalltalk.method({
  19942. selector: "method:",
  19943. category: 'accessing',
  19944. fn: function (anIRMethod){
  19945. var self=this;
  19946. return smalltalk.withContext(function($ctx1) {
  19947. self["@method"]=anIRMethod;
  19948. return self}, function($ctx1) {$ctx1.fill(self,"method:",{anIRMethod:anIRMethod},smalltalk.IRASTTranslator)})},
  19949. args: ["anIRMethod"],
  19950. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  19951. messageSends: [],
  19952. referencedClasses: []
  19953. }),
  19954. smalltalk.IRASTTranslator);
  19955. smalltalk.addMethod(
  19956. smalltalk.method({
  19957. selector: "nextAlias",
  19958. category: 'accessing',
  19959. fn: function (){
  19960. var self=this;
  19961. return smalltalk.withContext(function($ctx1) {
  19962. var $1,$2;
  19963. $1=self["@nextAlias"];
  19964. if(($receiver = $1) == nil || $receiver == undefined){
  19965. self["@nextAlias"]=(0);
  19966. self["@nextAlias"];
  19967. } else {
  19968. $1;
  19969. };
  19970. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  19971. $2=_st(self["@nextAlias"])._asString();
  19972. return $2;
  19973. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},smalltalk.IRASTTranslator)})},
  19974. args: [],
  19975. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  19976. messageSends: ["ifNil:", "+", "asString"],
  19977. referencedClasses: []
  19978. }),
  19979. smalltalk.IRASTTranslator);
  19980. smalltalk.addMethod(
  19981. smalltalk.method({
  19982. selector: "sequence",
  19983. category: 'accessing',
  19984. fn: function (){
  19985. var self=this;
  19986. return smalltalk.withContext(function($ctx1) {
  19987. var $1;
  19988. $1=self["@sequence"];
  19989. return $1;
  19990. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRASTTranslator)})},
  19991. args: [],
  19992. source: "sequence\x0a\x09^ sequence",
  19993. messageSends: [],
  19994. referencedClasses: []
  19995. }),
  19996. smalltalk.IRASTTranslator);
  19997. smalltalk.addMethod(
  19998. smalltalk.method({
  19999. selector: "sequence:",
  20000. category: 'accessing',
  20001. fn: function (anIRSequence){
  20002. var self=this;
  20003. return smalltalk.withContext(function($ctx1) {
  20004. self["@sequence"]=anIRSequence;
  20005. return self}, function($ctx1) {$ctx1.fill(self,"sequence:",{anIRSequence:anIRSequence},smalltalk.IRASTTranslator)})},
  20006. args: ["anIRSequence"],
  20007. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  20008. messageSends: [],
  20009. referencedClasses: []
  20010. }),
  20011. smalltalk.IRASTTranslator);
  20012. smalltalk.addMethod(
  20013. smalltalk.method({
  20014. selector: "source",
  20015. category: 'accessing',
  20016. fn: function (){
  20017. var self=this;
  20018. return smalltalk.withContext(function($ctx1) {
  20019. var $1;
  20020. $1=self["@source"];
  20021. return $1;
  20022. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRASTTranslator)})},
  20023. args: [],
  20024. source: "source\x0a\x09^ source",
  20025. messageSends: [],
  20026. referencedClasses: []
  20027. }),
  20028. smalltalk.IRASTTranslator);
  20029. smalltalk.addMethod(
  20030. smalltalk.method({
  20031. selector: "source:",
  20032. category: 'accessing',
  20033. fn: function (aString){
  20034. var self=this;
  20035. return smalltalk.withContext(function($ctx1) {
  20036. self["@source"]=aString;
  20037. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRASTTranslator)})},
  20038. args: ["aString"],
  20039. source: "source: aString\x0a\x09source := aString",
  20040. messageSends: [],
  20041. referencedClasses: []
  20042. }),
  20043. smalltalk.IRASTTranslator);
  20044. smalltalk.addMethod(
  20045. smalltalk.method({
  20046. selector: "theClass",
  20047. category: 'accessing',
  20048. fn: function (){
  20049. var self=this;
  20050. return smalltalk.withContext(function($ctx1) {
  20051. var $1;
  20052. $1=self["@theClass"];
  20053. return $1;
  20054. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRASTTranslator)})},
  20055. args: [],
  20056. source: "theClass\x0a\x09^ theClass",
  20057. messageSends: [],
  20058. referencedClasses: []
  20059. }),
  20060. smalltalk.IRASTTranslator);
  20061. smalltalk.addMethod(
  20062. smalltalk.method({
  20063. selector: "theClass:",
  20064. category: 'accessing',
  20065. fn: function (aClass){
  20066. var self=this;
  20067. return smalltalk.withContext(function($ctx1) {
  20068. self["@theClass"]=aClass;
  20069. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRASTTranslator)})},
  20070. args: ["aClass"],
  20071. source: "theClass: aClass\x0a\x09theClass := aClass",
  20072. messageSends: [],
  20073. referencedClasses: []
  20074. }),
  20075. smalltalk.IRASTTranslator);
  20076. smalltalk.addMethod(
  20077. smalltalk.method({
  20078. selector: "visitAssignmentNode:",
  20079. category: 'visiting',
  20080. fn: function (aNode){
  20081. var self=this;
  20082. var left,right,assignment;
  20083. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  20084. return smalltalk.withContext(function($ctx1) {
  20085. var $1,$2,$3;
  20086. right=self._visit_(_st(aNode)._right());
  20087. left=self._visit_(_st(aNode)._left());
  20088. $1=_st($IRAssignment())._new();
  20089. _st($1)._add_(left);
  20090. _st($1)._add_(right);
  20091. $2=_st($1)._yourself();
  20092. _st(self._sequence())._add_($2);
  20093. $3=left;
  20094. return $3;
  20095. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},smalltalk.IRASTTranslator)})},
  20096. args: ["aNode"],
  20097. 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",
  20098. messageSends: ["visit:", "right", "left", "add:", "new", "yourself", "sequence"],
  20099. referencedClasses: ["IRAssignment"]
  20100. }),
  20101. smalltalk.IRASTTranslator);
  20102. smalltalk.addMethod(
  20103. smalltalk.method({
  20104. selector: "visitBlockNode:",
  20105. category: 'visiting',
  20106. fn: function (aNode){
  20107. var self=this;
  20108. var closure;
  20109. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  20110. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  20111. return smalltalk.withContext(function($ctx1) {
  20112. var $1,$2,$3,$4,$5;
  20113. $1=_st($IRClosure())._new();
  20114. _st($1)._arguments_(_st(aNode)._parameters());
  20115. _st($1)._scope_(_st(aNode)._scope());
  20116. $2=_st($1)._yourself();
  20117. closure=$2;
  20118. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  20119. return smalltalk.withContext(function($ctx2) {
  20120. $3=_st($IRTempDeclaration())._new();
  20121. _st($3)._name_(_st(each)._name());
  20122. _st($3)._scope_(_st(aNode)._scope());
  20123. $4=_st($3)._yourself();
  20124. return _st(closure)._add_($4);
  20125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20126. _st(_st(aNode)._nodes())._do_((function(each){
  20127. return smalltalk.withContext(function($ctx2) {
  20128. return _st(closure)._add_(self._visit_(each));
  20129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20130. $5=closure;
  20131. return $5;
  20132. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},smalltalk.IRASTTranslator)})},
  20133. args: ["aNode"],
  20134. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\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",
  20135. messageSends: ["arguments:", "parameters", "new", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "temps", "visit:", "nodes"],
  20136. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  20137. }),
  20138. smalltalk.IRASTTranslator);
  20139. smalltalk.addMethod(
  20140. smalltalk.method({
  20141. selector: "visitBlockSequenceNode:",
  20142. category: 'visiting',
  20143. fn: function (aNode){
  20144. var self=this;
  20145. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  20146. function $IRBlockReturn(){return smalltalk.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  20147. return smalltalk.withContext(function($ctx1) {
  20148. var $2,$3,$4,$1;
  20149. $1=self._withSequence_do_(_st($IRBlockSequence())._new(),(function(){
  20150. return smalltalk.withContext(function($ctx2) {
  20151. return _st(_st(aNode)._nodes())._ifNotEmpty_((function(){
  20152. return smalltalk.withContext(function($ctx3) {
  20153. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  20154. return smalltalk.withContext(function($ctx4) {
  20155. return _st(self._sequence())._add_(self._visit_(each));
  20156. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  20157. $2=_st(_st(_st(aNode)._nodes())._last())._isReturnNode();
  20158. if(smalltalk.assert($2)){
  20159. return _st(self._sequence())._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  20160. } else {
  20161. $3=_st($IRBlockReturn())._new();
  20162. _st($3)._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  20163. $4=_st($3)._yourself();
  20164. return _st(self._sequence())._add_($4);
  20165. };
  20166. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  20167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  20168. return $1;
  20169. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20170. args: ["aNode"],
  20171. 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 visit: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visit: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visit: aNode nodes last) ]]]",
  20172. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "do:", "add:", "visit:", "sequence", "allButLast", "nodes", "ifFalse:ifTrue:", "last", "yourself", "isReturnNode"],
  20173. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  20174. }),
  20175. smalltalk.IRASTTranslator);
  20176. smalltalk.addMethod(
  20177. smalltalk.method({
  20178. selector: "visitCascadeNode:",
  20179. category: 'visiting',
  20180. fn: function (aNode){
  20181. var self=this;
  20182. var alias;
  20183. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  20184. return smalltalk.withContext(function($ctx1) {
  20185. var $1,$2;
  20186. $1=_st(_st(aNode)._receiver())._isImmutable();
  20187. if(! smalltalk.assert($1)){
  20188. alias=self._alias_(_st(aNode)._receiver());
  20189. alias;
  20190. _st(_st(aNode)._nodes())._do_((function(each){
  20191. return smalltalk.withContext(function($ctx2) {
  20192. return _st(each)._receiver_(_st(_st($VariableNode())._new())._binding_(_st(alias)._variable()));
  20193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20194. };
  20195. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  20196. return smalltalk.withContext(function($ctx2) {
  20197. return _st(self._sequence())._add_(self._visit_(each));
  20198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20199. $2=self._alias_(_st(_st(aNode)._nodes())._last());
  20200. return $2;
  20201. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias},smalltalk.IRASTTranslator)})},
  20202. args: ["aNode"],
  20203. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isImmutable ifFalse: [\x0a\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: (VariableNode new binding: alias variable) ]].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  20204. messageSends: ["ifFalse:", "alias:", "receiver", "do:", "receiver:", "binding:", "variable", "new", "nodes", "isImmutable", "add:", "visit:", "sequence", "allButLast", "last"],
  20205. referencedClasses: ["VariableNode"]
  20206. }),
  20207. smalltalk.IRASTTranslator);
  20208. smalltalk.addMethod(
  20209. smalltalk.method({
  20210. selector: "visitDynamicArrayNode:",
  20211. category: 'visiting',
  20212. fn: function (aNode){
  20213. var self=this;
  20214. var array;
  20215. function $IRDynamicArray(){return smalltalk.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  20216. return smalltalk.withContext(function($ctx1) {
  20217. var $1;
  20218. array=_st($IRDynamicArray())._new();
  20219. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  20220. return smalltalk.withContext(function($ctx2) {
  20221. return _st(array)._add_(each);
  20222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20223. $1=array;
  20224. return $1;
  20225. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.IRASTTranslator)})},
  20226. args: ["aNode"],
  20227. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | array add: each].\x0a\x09^ array",
  20228. messageSends: ["new", "do:", "add:", "aliasTemporally:", "nodes"],
  20229. referencedClasses: ["IRDynamicArray"]
  20230. }),
  20231. smalltalk.IRASTTranslator);
  20232. smalltalk.addMethod(
  20233. smalltalk.method({
  20234. selector: "visitDynamicDictionaryNode:",
  20235. category: 'visiting',
  20236. fn: function (aNode){
  20237. var self=this;
  20238. var dictionary;
  20239. function $IRDynamicDictionary(){return smalltalk.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  20240. return smalltalk.withContext(function($ctx1) {
  20241. var $1;
  20242. dictionary=_st($IRDynamicDictionary())._new();
  20243. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  20244. return smalltalk.withContext(function($ctx2) {
  20245. return _st(dictionary)._add_(each);
  20246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20247. $1=dictionary;
  20248. return $1;
  20249. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},smalltalk.IRASTTranslator)})},
  20250. args: ["aNode"],
  20251. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | dictionary add: each].\x0a\x09^ dictionary",
  20252. messageSends: ["new", "do:", "add:", "aliasTemporally:", "nodes"],
  20253. referencedClasses: ["IRDynamicDictionary"]
  20254. }),
  20255. smalltalk.IRASTTranslator);
  20256. smalltalk.addMethod(
  20257. smalltalk.method({
  20258. selector: "visitJSStatementNode:",
  20259. category: 'visiting',
  20260. fn: function (aNode){
  20261. var self=this;
  20262. function $IRVerbatim(){return smalltalk.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  20263. return smalltalk.withContext(function($ctx1) {
  20264. var $2,$3,$1;
  20265. $2=_st($IRVerbatim())._new();
  20266. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  20267. $3=_st($2)._yourself();
  20268. $1=$3;
  20269. return $1;
  20270. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20271. args: ["aNode"],
  20272. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  20273. messageSends: ["source:", "crlfSanitized", "source", "new", "yourself"],
  20274. referencedClasses: ["IRVerbatim"]
  20275. }),
  20276. smalltalk.IRASTTranslator);
  20277. smalltalk.addMethod(
  20278. smalltalk.method({
  20279. selector: "visitMethodNode:",
  20280. category: 'visiting',
  20281. fn: function (aNode){
  20282. var self=this;
  20283. function $IRMethod(){return smalltalk.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  20284. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  20285. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  20286. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  20287. return smalltalk.withContext(function($ctx1) {
  20288. var $1,$2,$3,$4,$5,$6,$7,$8;
  20289. $1=_st($IRMethod())._new();
  20290. _st($1)._source_(_st(self._source())._crlfSanitized());
  20291. _st($1)._theClass_(self._theClass());
  20292. _st($1)._arguments_(_st(aNode)._arguments());
  20293. _st($1)._selector_(_st(aNode)._selector());
  20294. _st($1)._messageSends_(_st(aNode)._messageSends());
  20295. _st($1)._superSends_(_st(aNode)._superSends());
  20296. _st($1)._classReferences_(_st(aNode)._classReferences());
  20297. _st($1)._scope_(_st(aNode)._scope());
  20298. $2=_st($1)._yourself();
  20299. self._method_($2);
  20300. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  20301. return smalltalk.withContext(function($ctx2) {
  20302. $3=_st($IRTempDeclaration())._new();
  20303. _st($3)._name_(_st(each)._name());
  20304. _st($3)._scope_(_st(aNode)._scope());
  20305. $4=_st($3)._yourself();
  20306. return _st(self._method())._add_($4);
  20307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20308. _st(_st(aNode)._nodes())._do_((function(each){
  20309. return smalltalk.withContext(function($ctx2) {
  20310. return _st(self._method())._add_(self._visit_(each));
  20311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20312. $5=_st(_st(aNode)._scope())._hasLocalReturn();
  20313. if(! smalltalk.assert($5)){
  20314. $6=_st($IRVariable())._new();
  20315. _st($6)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  20316. $7=_st($6)._yourself();
  20317. _st(_st(self._method())._add_(_st($IRReturn())._new()))._add_($7);
  20318. };
  20319. $8=self._method();
  20320. return $8;
  20321. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20322. args: ["aNode"],
  20323. 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\x09messageSends: aNode messageSends;\x0a\x09\x09superSends: aNode superSends;\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",
  20324. messageSends: ["method:", "source:", "crlfSanitized", "source", "new", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "superSends:", "superSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "method", "temps", "visit:", "nodes", "ifFalse:", "variable:", "at:", "pseudoVars", "hasLocalReturn"],
  20325. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRVariable", "IRReturn"]
  20326. }),
  20327. smalltalk.IRASTTranslator);
  20328. smalltalk.addMethod(
  20329. smalltalk.method({
  20330. selector: "visitReturnNode:",
  20331. category: 'visiting',
  20332. fn: function (aNode){
  20333. var self=this;
  20334. var return_;
  20335. function $IRNonLocalReturn(){return smalltalk.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  20336. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  20337. return smalltalk.withContext(function($ctx1) {
  20338. var $1,$2;
  20339. $1=_st(aNode)._nonLocalReturn();
  20340. if(smalltalk.assert($1)){
  20341. return_=_st($IRNonLocalReturn())._new();
  20342. } else {
  20343. return_=_st($IRReturn())._new();
  20344. };
  20345. _st(return_)._scope_(_st(aNode)._scope());
  20346. _st(_st(aNode)._nodes())._do_((function(each){
  20347. return smalltalk.withContext(function($ctx2) {
  20348. return _st(return_)._add_(self._alias_(each));
  20349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20350. $2=return_;
  20351. return $2;
  20352. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},smalltalk.IRASTTranslator)})},
  20353. args: ["aNode"],
  20354. 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",
  20355. messageSends: ["ifTrue:ifFalse:", "new", "nonLocalReturn", "scope:", "scope", "do:", "add:", "alias:", "nodes"],
  20356. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  20357. }),
  20358. smalltalk.IRASTTranslator);
  20359. smalltalk.addMethod(
  20360. smalltalk.method({
  20361. selector: "visitSendNode:",
  20362. category: 'visiting',
  20363. fn: function (aNode){
  20364. var self=this;
  20365. var send,all,receiver,arguments;
  20366. function $IRSend(){return smalltalk.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  20367. return smalltalk.withContext(function($ctx1) {
  20368. var $1,$2,$3,$4;
  20369. send=_st($IRSend())._new();
  20370. $1=send;
  20371. _st($1)._selector_(_st(aNode)._selector());
  20372. $2=_st($1)._index_(_st(aNode)._index());
  20373. $3=_st(aNode)._superSend();
  20374. if(smalltalk.assert($3)){
  20375. _st(send)._classSend_(_st(self._theClass())._superclass());
  20376. };
  20377. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  20378. receiver=_st(all)._first();
  20379. arguments=_st(all)._allButFirst();
  20380. _st(send)._add_(receiver);
  20381. _st(arguments)._do_((function(each){
  20382. return smalltalk.withContext(function($ctx2) {
  20383. return _st(send)._add_(each);
  20384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  20385. $4=send;
  20386. return $4;
  20387. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},smalltalk.IRASTTranslator)})},
  20388. args: ["aNode"],
  20389. 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",
  20390. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "classSend:", "superclass", "theClass", "superSend", "aliasTemporally:", ",", "arguments", "receiver", "first", "allButFirst", "add:", "do:"],
  20391. referencedClasses: ["IRSend"]
  20392. }),
  20393. smalltalk.IRASTTranslator);
  20394. smalltalk.addMethod(
  20395. smalltalk.method({
  20396. selector: "visitSequenceNode:",
  20397. category: 'visiting',
  20398. fn: function (aNode){
  20399. var self=this;
  20400. function $IRSequence(){return smalltalk.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  20401. return smalltalk.withContext(function($ctx1) {
  20402. var $2,$1;
  20403. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  20404. return smalltalk.withContext(function($ctx2) {
  20405. return _st(_st(aNode)._nodes())._do_((function(each){
  20406. var instruction;
  20407. return smalltalk.withContext(function($ctx3) {
  20408. instruction=self._visit_(each);
  20409. instruction;
  20410. $2=_st(instruction)._isVariable();
  20411. if(! smalltalk.assert($2)){
  20412. return _st(self._sequence())._add_(instruction);
  20413. };
  20414. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2)})}));
  20415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  20416. return $1;
  20417. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20418. args: ["aNode"],
  20419. 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 visit: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ]]]",
  20420. messageSends: ["withSequence:do:", "new", "do:", "visit:", "ifFalse:", "add:", "sequence", "isVariable", "nodes"],
  20421. referencedClasses: ["IRSequence"]
  20422. }),
  20423. smalltalk.IRASTTranslator);
  20424. smalltalk.addMethod(
  20425. smalltalk.method({
  20426. selector: "visitValueNode:",
  20427. category: 'visiting',
  20428. fn: function (aNode){
  20429. var self=this;
  20430. function $IRValue(){return smalltalk.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  20431. return smalltalk.withContext(function($ctx1) {
  20432. var $2,$3,$1;
  20433. $2=_st($IRValue())._new();
  20434. _st($2)._value_(_st(aNode)._value());
  20435. $3=_st($2)._yourself();
  20436. $1=$3;
  20437. return $1;
  20438. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20439. args: ["aNode"],
  20440. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  20441. messageSends: ["value:", "value", "new", "yourself"],
  20442. referencedClasses: ["IRValue"]
  20443. }),
  20444. smalltalk.IRASTTranslator);
  20445. smalltalk.addMethod(
  20446. smalltalk.method({
  20447. selector: "visitVariableNode:",
  20448. category: 'visiting',
  20449. fn: function (aNode){
  20450. var self=this;
  20451. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  20452. return smalltalk.withContext(function($ctx1) {
  20453. var $2,$3,$1;
  20454. $2=_st($IRVariable())._new();
  20455. _st($2)._variable_(_st(aNode)._binding());
  20456. $3=_st($2)._yourself();
  20457. $1=$3;
  20458. return $1;
  20459. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  20460. args: ["aNode"],
  20461. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  20462. messageSends: ["variable:", "binding", "new", "yourself"],
  20463. referencedClasses: ["IRVariable"]
  20464. }),
  20465. smalltalk.IRASTTranslator);
  20466. smalltalk.addMethod(
  20467. smalltalk.method({
  20468. selector: "withSequence:do:",
  20469. category: 'accessing',
  20470. fn: function (aSequence,aBlock){
  20471. var self=this;
  20472. var outerSequence;
  20473. return smalltalk.withContext(function($ctx1) {
  20474. var $1;
  20475. outerSequence=self._sequence();
  20476. self._sequence_(aSequence);
  20477. _st(aBlock)._value();
  20478. self._sequence_(outerSequence);
  20479. $1=aSequence;
  20480. return $1;
  20481. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},smalltalk.IRASTTranslator)})},
  20482. args: ["aSequence", "aBlock"],
  20483. 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",
  20484. messageSends: ["sequence", "sequence:", "value"],
  20485. referencedClasses: []
  20486. }),
  20487. smalltalk.IRASTTranslator);
  20488. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  20489. smalltalk.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.";
  20490. smalltalk.addMethod(
  20491. smalltalk.method({
  20492. selector: "accept:",
  20493. category: 'visiting',
  20494. fn: function (aVisitor){
  20495. var self=this;
  20496. return smalltalk.withContext(function($ctx1) {
  20497. var $1;
  20498. $1=_st(aVisitor)._visitIRInstruction_(self);
  20499. return $1;
  20500. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInstruction)})},
  20501. args: ["aVisitor"],
  20502. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  20503. messageSends: ["visitIRInstruction:"],
  20504. referencedClasses: []
  20505. }),
  20506. smalltalk.IRInstruction);
  20507. smalltalk.addMethod(
  20508. smalltalk.method({
  20509. selector: "add:",
  20510. category: 'building',
  20511. fn: function (anObject){
  20512. var self=this;
  20513. return smalltalk.withContext(function($ctx1) {
  20514. var $1;
  20515. _st(anObject)._parent_(self);
  20516. $1=_st(self._instructions())._add_(anObject);
  20517. return $1;
  20518. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.IRInstruction)})},
  20519. args: ["anObject"],
  20520. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  20521. messageSends: ["parent:", "add:", "instructions"],
  20522. referencedClasses: []
  20523. }),
  20524. smalltalk.IRInstruction);
  20525. smalltalk.addMethod(
  20526. smalltalk.method({
  20527. selector: "canBeAssigned",
  20528. category: 'testing',
  20529. fn: function (){
  20530. var self=this;
  20531. return smalltalk.withContext(function($ctx1) {
  20532. return true;
  20533. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRInstruction)})},
  20534. args: [],
  20535. source: "canBeAssigned\x0a\x09^ true",
  20536. messageSends: [],
  20537. referencedClasses: []
  20538. }),
  20539. smalltalk.IRInstruction);
  20540. smalltalk.addMethod(
  20541. smalltalk.method({
  20542. selector: "instructions",
  20543. category: 'accessing',
  20544. fn: function (){
  20545. var self=this;
  20546. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20547. return smalltalk.withContext(function($ctx1) {
  20548. var $2,$1;
  20549. $2=self["@instructions"];
  20550. if(($receiver = $2) == nil || $receiver == undefined){
  20551. self["@instructions"]=_st($OrderedCollection())._new();
  20552. $1=self["@instructions"];
  20553. } else {
  20554. $1=$2;
  20555. };
  20556. return $1;
  20557. }, function($ctx1) {$ctx1.fill(self,"instructions",{},smalltalk.IRInstruction)})},
  20558. args: [],
  20559. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  20560. messageSends: ["ifNil:", "new"],
  20561. referencedClasses: ["OrderedCollection"]
  20562. }),
  20563. smalltalk.IRInstruction);
  20564. smalltalk.addMethod(
  20565. smalltalk.method({
  20566. selector: "isClosure",
  20567. category: 'testing',
  20568. fn: function (){
  20569. var self=this;
  20570. return smalltalk.withContext(function($ctx1) {
  20571. return false;
  20572. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRInstruction)})},
  20573. args: [],
  20574. source: "isClosure\x0a\x09^ false",
  20575. messageSends: [],
  20576. referencedClasses: []
  20577. }),
  20578. smalltalk.IRInstruction);
  20579. smalltalk.addMethod(
  20580. smalltalk.method({
  20581. selector: "isInlined",
  20582. category: 'testing',
  20583. fn: function (){
  20584. var self=this;
  20585. return smalltalk.withContext(function($ctx1) {
  20586. return false;
  20587. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInstruction)})},
  20588. args: [],
  20589. source: "isInlined\x0a\x09^ false",
  20590. messageSends: [],
  20591. referencedClasses: []
  20592. }),
  20593. smalltalk.IRInstruction);
  20594. smalltalk.addMethod(
  20595. smalltalk.method({
  20596. selector: "isLocalReturn",
  20597. category: 'testing',
  20598. fn: function (){
  20599. var self=this;
  20600. return smalltalk.withContext(function($ctx1) {
  20601. return false;
  20602. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRInstruction)})},
  20603. args: [],
  20604. source: "isLocalReturn\x0a\x09^ false",
  20605. messageSends: [],
  20606. referencedClasses: []
  20607. }),
  20608. smalltalk.IRInstruction);
  20609. smalltalk.addMethod(
  20610. smalltalk.method({
  20611. selector: "isMethod",
  20612. category: 'testing',
  20613. fn: function (){
  20614. var self=this;
  20615. return smalltalk.withContext(function($ctx1) {
  20616. return false;
  20617. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRInstruction)})},
  20618. args: [],
  20619. source: "isMethod\x0a\x09^ false",
  20620. messageSends: [],
  20621. referencedClasses: []
  20622. }),
  20623. smalltalk.IRInstruction);
  20624. smalltalk.addMethod(
  20625. smalltalk.method({
  20626. selector: "isReturn",
  20627. category: 'testing',
  20628. fn: function (){
  20629. var self=this;
  20630. return smalltalk.withContext(function($ctx1) {
  20631. return false;
  20632. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRInstruction)})},
  20633. args: [],
  20634. source: "isReturn\x0a\x09^ false",
  20635. messageSends: [],
  20636. referencedClasses: []
  20637. }),
  20638. smalltalk.IRInstruction);
  20639. smalltalk.addMethod(
  20640. smalltalk.method({
  20641. selector: "isSend",
  20642. category: 'testing',
  20643. fn: function (){
  20644. var self=this;
  20645. return smalltalk.withContext(function($ctx1) {
  20646. return false;
  20647. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRInstruction)})},
  20648. args: [],
  20649. source: "isSend\x0a\x09^ false",
  20650. messageSends: [],
  20651. referencedClasses: []
  20652. }),
  20653. smalltalk.IRInstruction);
  20654. smalltalk.addMethod(
  20655. smalltalk.method({
  20656. selector: "isSequence",
  20657. category: 'testing',
  20658. fn: function (){
  20659. var self=this;
  20660. return smalltalk.withContext(function($ctx1) {
  20661. return false;
  20662. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRInstruction)})},
  20663. args: [],
  20664. source: "isSequence\x0a\x09^ false",
  20665. messageSends: [],
  20666. referencedClasses: []
  20667. }),
  20668. smalltalk.IRInstruction);
  20669. smalltalk.addMethod(
  20670. smalltalk.method({
  20671. selector: "isTempDeclaration",
  20672. category: 'testing',
  20673. fn: function (){
  20674. var self=this;
  20675. return smalltalk.withContext(function($ctx1) {
  20676. return false;
  20677. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRInstruction)})},
  20678. args: [],
  20679. source: "isTempDeclaration\x0a\x09^ false",
  20680. messageSends: [],
  20681. referencedClasses: []
  20682. }),
  20683. smalltalk.IRInstruction);
  20684. smalltalk.addMethod(
  20685. smalltalk.method({
  20686. selector: "isVariable",
  20687. category: 'testing',
  20688. fn: function (){
  20689. var self=this;
  20690. return smalltalk.withContext(function($ctx1) {
  20691. return false;
  20692. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRInstruction)})},
  20693. args: [],
  20694. source: "isVariable\x0a\x09^ false",
  20695. messageSends: [],
  20696. referencedClasses: []
  20697. }),
  20698. smalltalk.IRInstruction);
  20699. smalltalk.addMethod(
  20700. smalltalk.method({
  20701. selector: "method",
  20702. category: 'accessing',
  20703. fn: function (){
  20704. var self=this;
  20705. return smalltalk.withContext(function($ctx1) {
  20706. var $1;
  20707. $1=_st(self._parent())._method();
  20708. return $1;
  20709. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRInstruction)})},
  20710. args: [],
  20711. source: "method\x0a\x09^ self parent method",
  20712. messageSends: ["method", "parent"],
  20713. referencedClasses: []
  20714. }),
  20715. smalltalk.IRInstruction);
  20716. smalltalk.addMethod(
  20717. smalltalk.method({
  20718. selector: "needsBoxingAsReceiver",
  20719. category: 'testing',
  20720. fn: function (){
  20721. var self=this;
  20722. return smalltalk.withContext(function($ctx1) {
  20723. return true;
  20724. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRInstruction)})},
  20725. args: [],
  20726. source: "needsBoxingAsReceiver\x0a\x09^ true",
  20727. messageSends: [],
  20728. referencedClasses: []
  20729. }),
  20730. smalltalk.IRInstruction);
  20731. smalltalk.addMethod(
  20732. smalltalk.method({
  20733. selector: "parent",
  20734. category: 'accessing',
  20735. fn: function (){
  20736. var self=this;
  20737. return smalltalk.withContext(function($ctx1) {
  20738. var $1;
  20739. $1=self["@parent"];
  20740. return $1;
  20741. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.IRInstruction)})},
  20742. args: [],
  20743. source: "parent\x0a\x09^ parent",
  20744. messageSends: [],
  20745. referencedClasses: []
  20746. }),
  20747. smalltalk.IRInstruction);
  20748. smalltalk.addMethod(
  20749. smalltalk.method({
  20750. selector: "parent:",
  20751. category: 'accessing',
  20752. fn: function (anIRInstruction){
  20753. var self=this;
  20754. return smalltalk.withContext(function($ctx1) {
  20755. self["@parent"]=anIRInstruction;
  20756. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20757. args: ["anIRInstruction"],
  20758. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  20759. messageSends: [],
  20760. referencedClasses: []
  20761. }),
  20762. smalltalk.IRInstruction);
  20763. smalltalk.addMethod(
  20764. smalltalk.method({
  20765. selector: "remove",
  20766. category: 'building',
  20767. fn: function (){
  20768. var self=this;
  20769. return smalltalk.withContext(function($ctx1) {
  20770. _st(self._parent())._remove_(self);
  20771. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},smalltalk.IRInstruction)})},
  20772. args: [],
  20773. source: "remove\x0a\x09self parent remove: self",
  20774. messageSends: ["remove:", "parent"],
  20775. referencedClasses: []
  20776. }),
  20777. smalltalk.IRInstruction);
  20778. smalltalk.addMethod(
  20779. smalltalk.method({
  20780. selector: "remove:",
  20781. category: 'building',
  20782. fn: function (anIRInstruction){
  20783. var self=this;
  20784. return smalltalk.withContext(function($ctx1) {
  20785. _st(self._instructions())._remove_(anIRInstruction);
  20786. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20787. args: ["anIRInstruction"],
  20788. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  20789. messageSends: ["remove:", "instructions"],
  20790. referencedClasses: []
  20791. }),
  20792. smalltalk.IRInstruction);
  20793. smalltalk.addMethod(
  20794. smalltalk.method({
  20795. selector: "replace:with:",
  20796. category: 'building',
  20797. fn: function (anIRInstruction,anotherIRInstruction){
  20798. var self=this;
  20799. return smalltalk.withContext(function($ctx1) {
  20800. _st(anotherIRInstruction)._parent_(self);
  20801. _st(self._instructions())._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  20802. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRInstruction)})},
  20803. args: ["anIRInstruction", "anotherIRInstruction"],
  20804. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  20805. messageSends: ["parent:", "at:put:", "indexOf:", "instructions"],
  20806. referencedClasses: []
  20807. }),
  20808. smalltalk.IRInstruction);
  20809. smalltalk.addMethod(
  20810. smalltalk.method({
  20811. selector: "replaceWith:",
  20812. category: 'building',
  20813. fn: function (anIRInstruction){
  20814. var self=this;
  20815. return smalltalk.withContext(function($ctx1) {
  20816. _st(self._parent())._replace_with_(self,anIRInstruction);
  20817. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  20818. args: ["anIRInstruction"],
  20819. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  20820. messageSends: ["replace:with:", "parent"],
  20821. referencedClasses: []
  20822. }),
  20823. smalltalk.IRInstruction);
  20824. smalltalk.addMethod(
  20825. smalltalk.method({
  20826. selector: "on:",
  20827. category: 'instance creation',
  20828. fn: function (aBuilder){
  20829. var self=this;
  20830. return smalltalk.withContext(function($ctx1) {
  20831. var $2,$3,$1;
  20832. $2=self._new();
  20833. _st($2)._builder_(aBuilder);
  20834. $3=_st($2)._yourself();
  20835. $1=$3;
  20836. return $1;
  20837. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},smalltalk.IRInstruction.klass)})},
  20838. args: ["aBuilder"],
  20839. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  20840. messageSends: ["builder:", "new", "yourself"],
  20841. referencedClasses: []
  20842. }),
  20843. smalltalk.IRInstruction.klass);
  20844. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  20845. smalltalk.addMethod(
  20846. smalltalk.method({
  20847. selector: "accept:",
  20848. category: 'visiting',
  20849. fn: function (aVisitor){
  20850. var self=this;
  20851. return smalltalk.withContext(function($ctx1) {
  20852. var $1;
  20853. $1=_st(aVisitor)._visitIRAssignment_(self);
  20854. return $1;
  20855. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRAssignment)})},
  20856. args: ["aVisitor"],
  20857. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  20858. messageSends: ["visitIRAssignment:"],
  20859. referencedClasses: []
  20860. }),
  20861. smalltalk.IRAssignment);
  20862. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  20863. smalltalk.addMethod(
  20864. smalltalk.method({
  20865. selector: "accept:",
  20866. category: 'visiting',
  20867. fn: function (aVisitor){
  20868. var self=this;
  20869. return smalltalk.withContext(function($ctx1) {
  20870. var $1;
  20871. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  20872. return $1;
  20873. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicArray)})},
  20874. args: ["aVisitor"],
  20875. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  20876. messageSends: ["visitIRDynamicArray:"],
  20877. referencedClasses: []
  20878. }),
  20879. smalltalk.IRDynamicArray);
  20880. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  20881. smalltalk.addMethod(
  20882. smalltalk.method({
  20883. selector: "accept:",
  20884. category: 'visiting',
  20885. fn: function (aVisitor){
  20886. var self=this;
  20887. return smalltalk.withContext(function($ctx1) {
  20888. var $1;
  20889. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  20890. return $1;
  20891. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicDictionary)})},
  20892. args: ["aVisitor"],
  20893. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  20894. messageSends: ["visitIRDynamicDictionary:"],
  20895. referencedClasses: []
  20896. }),
  20897. smalltalk.IRDynamicDictionary);
  20898. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  20899. smalltalk.addMethod(
  20900. smalltalk.method({
  20901. selector: "scope",
  20902. category: 'accessing',
  20903. fn: function (){
  20904. var self=this;
  20905. return smalltalk.withContext(function($ctx1) {
  20906. var $1;
  20907. $1=self["@scope"];
  20908. return $1;
  20909. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.IRScopedInstruction)})},
  20910. args: [],
  20911. source: "scope\x0a\x09^ scope",
  20912. messageSends: [],
  20913. referencedClasses: []
  20914. }),
  20915. smalltalk.IRScopedInstruction);
  20916. smalltalk.addMethod(
  20917. smalltalk.method({
  20918. selector: "scope:",
  20919. category: 'accessing',
  20920. fn: function (aScope){
  20921. var self=this;
  20922. return smalltalk.withContext(function($ctx1) {
  20923. self["@scope"]=aScope;
  20924. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRScopedInstruction)})},
  20925. args: ["aScope"],
  20926. source: "scope: aScope\x0a\x09scope := aScope",
  20927. messageSends: [],
  20928. referencedClasses: []
  20929. }),
  20930. smalltalk.IRScopedInstruction);
  20931. smalltalk.addClass('IRClosureInstruction', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  20932. smalltalk.addMethod(
  20933. smalltalk.method({
  20934. selector: "arguments",
  20935. category: 'accessing',
  20936. fn: function (){
  20937. var self=this;
  20938. return smalltalk.withContext(function($ctx1) {
  20939. var $2,$1;
  20940. $2=self["@arguments"];
  20941. if(($receiver = $2) == nil || $receiver == undefined){
  20942. $1=[];
  20943. } else {
  20944. $1=$2;
  20945. };
  20946. return $1;
  20947. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.IRClosureInstruction)})},
  20948. args: [],
  20949. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  20950. messageSends: ["ifNil:"],
  20951. referencedClasses: []
  20952. }),
  20953. smalltalk.IRClosureInstruction);
  20954. smalltalk.addMethod(
  20955. smalltalk.method({
  20956. selector: "arguments:",
  20957. category: 'accessing',
  20958. fn: function (aCollection){
  20959. var self=this;
  20960. return smalltalk.withContext(function($ctx1) {
  20961. self["@arguments"]=aCollection;
  20962. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.IRClosureInstruction)})},
  20963. args: ["aCollection"],
  20964. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  20965. messageSends: [],
  20966. referencedClasses: []
  20967. }),
  20968. smalltalk.IRClosureInstruction);
  20969. smalltalk.addMethod(
  20970. smalltalk.method({
  20971. selector: "locals",
  20972. category: 'accessing',
  20973. fn: function (){
  20974. var self=this;
  20975. return smalltalk.withContext(function($ctx1) {
  20976. var $2,$3,$1;
  20977. $2=_st(self._arguments())._copy();
  20978. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  20979. return smalltalk.withContext(function($ctx2) {
  20980. return _st(each)._name();
  20981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  20982. $3=_st($2)._yourself();
  20983. $1=$3;
  20984. return $1;
  20985. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.IRClosureInstruction)})},
  20986. args: [],
  20987. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  20988. messageSends: ["addAll:", "collect:", "name", "tempDeclarations", "copy", "arguments", "yourself"],
  20989. referencedClasses: []
  20990. }),
  20991. smalltalk.IRClosureInstruction);
  20992. smalltalk.addMethod(
  20993. smalltalk.method({
  20994. selector: "scope:",
  20995. category: 'accessing',
  20996. fn: function (aScope){
  20997. var self=this;
  20998. return smalltalk.withContext(function($ctx1) {
  20999. smalltalk.IRScopedInstruction.fn.prototype._scope_.apply(_st(self), [aScope]);
  21000. _st(aScope)._instruction_(self);
  21001. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRClosureInstruction)})},
  21002. args: ["aScope"],
  21003. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  21004. messageSends: ["scope:", "instruction:"],
  21005. referencedClasses: []
  21006. }),
  21007. smalltalk.IRClosureInstruction);
  21008. smalltalk.addMethod(
  21009. smalltalk.method({
  21010. selector: "tempDeclarations",
  21011. category: 'accessing',
  21012. fn: function (){
  21013. var self=this;
  21014. return smalltalk.withContext(function($ctx1) {
  21015. var $1;
  21016. $1=_st(self._instructions())._select_((function(each){
  21017. return smalltalk.withContext(function($ctx2) {
  21018. return _st(each)._isTempDeclaration();
  21019. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  21020. return $1;
  21021. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},smalltalk.IRClosureInstruction)})},
  21022. args: [],
  21023. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  21024. messageSends: ["select:", "isTempDeclaration", "instructions"],
  21025. referencedClasses: []
  21026. }),
  21027. smalltalk.IRClosureInstruction);
  21028. smalltalk.addClass('IRClosure', smalltalk.IRClosureInstruction, [], 'Compiler-IR');
  21029. smalltalk.addMethod(
  21030. smalltalk.method({
  21031. selector: "accept:",
  21032. category: 'visiting',
  21033. fn: function (aVisitor){
  21034. var self=this;
  21035. return smalltalk.withContext(function($ctx1) {
  21036. var $1;
  21037. $1=_st(aVisitor)._visitIRClosure_(self);
  21038. return $1;
  21039. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRClosure)})},
  21040. args: ["aVisitor"],
  21041. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  21042. messageSends: ["visitIRClosure:"],
  21043. referencedClasses: []
  21044. }),
  21045. smalltalk.IRClosure);
  21046. smalltalk.addMethod(
  21047. smalltalk.method({
  21048. selector: "isClosure",
  21049. category: 'testing',
  21050. fn: function (){
  21051. var self=this;
  21052. return smalltalk.withContext(function($ctx1) {
  21053. return true;
  21054. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRClosure)})},
  21055. args: [],
  21056. source: "isClosure\x0a\x09^ true",
  21057. messageSends: [],
  21058. referencedClasses: []
  21059. }),
  21060. smalltalk.IRClosure);
  21061. smalltalk.addMethod(
  21062. smalltalk.method({
  21063. selector: "sequence",
  21064. category: 'accessing',
  21065. fn: function (){
  21066. var self=this;
  21067. return smalltalk.withContext(function($ctx1) {
  21068. var $1;
  21069. $1=_st(self._instructions())._last();
  21070. return $1;
  21071. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRClosure)})},
  21072. args: [],
  21073. source: "sequence\x0a\x09^ self instructions last",
  21074. messageSends: ["last", "instructions"],
  21075. referencedClasses: []
  21076. }),
  21077. smalltalk.IRClosure);
  21078. smalltalk.addClass('IRMethod', smalltalk.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'messageSends', 'superSends', 'internalVariables'], 'Compiler-IR');
  21079. smalltalk.IRMethod.comment="I am a method instruction";
  21080. smalltalk.addMethod(
  21081. smalltalk.method({
  21082. selector: "accept:",
  21083. category: 'visiting',
  21084. fn: function (aVisitor){
  21085. var self=this;
  21086. return smalltalk.withContext(function($ctx1) {
  21087. var $1;
  21088. $1=_st(aVisitor)._visitIRMethod_(self);
  21089. return $1;
  21090. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRMethod)})},
  21091. args: ["aVisitor"],
  21092. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  21093. messageSends: ["visitIRMethod:"],
  21094. referencedClasses: []
  21095. }),
  21096. smalltalk.IRMethod);
  21097. smalltalk.addMethod(
  21098. smalltalk.method({
  21099. selector: "classReferences",
  21100. category: 'accessing',
  21101. fn: function (){
  21102. var self=this;
  21103. return smalltalk.withContext(function($ctx1) {
  21104. var $1;
  21105. $1=self["@classReferences"];
  21106. return $1;
  21107. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.IRMethod)})},
  21108. args: [],
  21109. source: "classReferences\x0a\x09^ classReferences",
  21110. messageSends: [],
  21111. referencedClasses: []
  21112. }),
  21113. smalltalk.IRMethod);
  21114. smalltalk.addMethod(
  21115. smalltalk.method({
  21116. selector: "classReferences:",
  21117. category: 'accessing',
  21118. fn: function (aCollection){
  21119. var self=this;
  21120. return smalltalk.withContext(function($ctx1) {
  21121. self["@classReferences"]=aCollection;
  21122. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21123. args: ["aCollection"],
  21124. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  21125. messageSends: [],
  21126. referencedClasses: []
  21127. }),
  21128. smalltalk.IRMethod);
  21129. smalltalk.addMethod(
  21130. smalltalk.method({
  21131. selector: "internalVariables",
  21132. category: 'accessing',
  21133. fn: function (){
  21134. var self=this;
  21135. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  21136. return smalltalk.withContext(function($ctx1) {
  21137. var $2,$1;
  21138. $2=self["@internalVariables"];
  21139. if(($receiver = $2) == nil || $receiver == undefined){
  21140. self["@internalVariables"]=_st($Set())._new();
  21141. $1=self["@internalVariables"];
  21142. } else {
  21143. $1=$2;
  21144. };
  21145. return $1;
  21146. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},smalltalk.IRMethod)})},
  21147. args: [],
  21148. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  21149. messageSends: ["ifNil:", "new"],
  21150. referencedClasses: ["Set"]
  21151. }),
  21152. smalltalk.IRMethod);
  21153. smalltalk.addMethod(
  21154. smalltalk.method({
  21155. selector: "isMethod",
  21156. category: 'accessing',
  21157. fn: function (){
  21158. var self=this;
  21159. return smalltalk.withContext(function($ctx1) {
  21160. return true;
  21161. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRMethod)})},
  21162. args: [],
  21163. source: "isMethod\x0a\x09^ true",
  21164. messageSends: [],
  21165. referencedClasses: []
  21166. }),
  21167. smalltalk.IRMethod);
  21168. smalltalk.addMethod(
  21169. smalltalk.method({
  21170. selector: "messageSends",
  21171. category: 'accessing',
  21172. fn: function (){
  21173. var self=this;
  21174. return smalltalk.withContext(function($ctx1) {
  21175. var $1;
  21176. $1=self["@messageSends"];
  21177. return $1;
  21178. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.IRMethod)})},
  21179. args: [],
  21180. source: "messageSends\x0a\x09^ messageSends",
  21181. messageSends: [],
  21182. referencedClasses: []
  21183. }),
  21184. smalltalk.IRMethod);
  21185. smalltalk.addMethod(
  21186. smalltalk.method({
  21187. selector: "messageSends:",
  21188. category: 'accessing',
  21189. fn: function (aCollection){
  21190. var self=this;
  21191. return smalltalk.withContext(function($ctx1) {
  21192. self["@messageSends"]=aCollection;
  21193. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21194. args: ["aCollection"],
  21195. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  21196. messageSends: [],
  21197. referencedClasses: []
  21198. }),
  21199. smalltalk.IRMethod);
  21200. smalltalk.addMethod(
  21201. smalltalk.method({
  21202. selector: "method",
  21203. category: 'accessing',
  21204. fn: function (){
  21205. var self=this;
  21206. return smalltalk.withContext(function($ctx1) {
  21207. var $1;
  21208. $1=self;
  21209. return $1;
  21210. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRMethod)})},
  21211. args: [],
  21212. source: "method\x0a\x09^ self",
  21213. messageSends: [],
  21214. referencedClasses: []
  21215. }),
  21216. smalltalk.IRMethod);
  21217. smalltalk.addMethod(
  21218. smalltalk.method({
  21219. selector: "selector",
  21220. category: 'accessing',
  21221. fn: function (){
  21222. var self=this;
  21223. return smalltalk.withContext(function($ctx1) {
  21224. var $1;
  21225. $1=self["@selector"];
  21226. return $1;
  21227. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRMethod)})},
  21228. args: [],
  21229. source: "selector\x0a\x09^ selector",
  21230. messageSends: [],
  21231. referencedClasses: []
  21232. }),
  21233. smalltalk.IRMethod);
  21234. smalltalk.addMethod(
  21235. smalltalk.method({
  21236. selector: "selector:",
  21237. category: 'accessing',
  21238. fn: function (aString){
  21239. var self=this;
  21240. return smalltalk.withContext(function($ctx1) {
  21241. self["@selector"]=aString;
  21242. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRMethod)})},
  21243. args: ["aString"],
  21244. source: "selector: aString\x0a\x09selector := aString",
  21245. messageSends: [],
  21246. referencedClasses: []
  21247. }),
  21248. smalltalk.IRMethod);
  21249. smalltalk.addMethod(
  21250. smalltalk.method({
  21251. selector: "source",
  21252. category: 'accessing',
  21253. fn: function (){
  21254. var self=this;
  21255. return smalltalk.withContext(function($ctx1) {
  21256. var $1;
  21257. $1=self["@source"];
  21258. return $1;
  21259. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRMethod)})},
  21260. args: [],
  21261. source: "source\x0a\x09^ source",
  21262. messageSends: [],
  21263. referencedClasses: []
  21264. }),
  21265. smalltalk.IRMethod);
  21266. smalltalk.addMethod(
  21267. smalltalk.method({
  21268. selector: "source:",
  21269. category: 'accessing',
  21270. fn: function (aString){
  21271. var self=this;
  21272. return smalltalk.withContext(function($ctx1) {
  21273. self["@source"]=aString;
  21274. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRMethod)})},
  21275. args: ["aString"],
  21276. source: "source: aString\x0a\x09source := aString",
  21277. messageSends: [],
  21278. referencedClasses: []
  21279. }),
  21280. smalltalk.IRMethod);
  21281. smalltalk.addMethod(
  21282. smalltalk.method({
  21283. selector: "superSends",
  21284. category: 'accessing',
  21285. fn: function (){
  21286. var self=this;
  21287. return smalltalk.withContext(function($ctx1) {
  21288. var $1;
  21289. $1=self["@superSends"];
  21290. return $1;
  21291. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.IRMethod)})},
  21292. args: [],
  21293. source: "superSends\x0a\x09^ superSends",
  21294. messageSends: [],
  21295. referencedClasses: []
  21296. }),
  21297. smalltalk.IRMethod);
  21298. smalltalk.addMethod(
  21299. smalltalk.method({
  21300. selector: "superSends:",
  21301. category: 'accessing',
  21302. fn: function (aCollection){
  21303. var self=this;
  21304. return smalltalk.withContext(function($ctx1) {
  21305. self["@superSends"]=aCollection;
  21306. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  21307. args: ["aCollection"],
  21308. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  21309. messageSends: [],
  21310. referencedClasses: []
  21311. }),
  21312. smalltalk.IRMethod);
  21313. smalltalk.addMethod(
  21314. smalltalk.method({
  21315. selector: "theClass",
  21316. category: 'accessing',
  21317. fn: function (){
  21318. var self=this;
  21319. return smalltalk.withContext(function($ctx1) {
  21320. var $1;
  21321. $1=self["@theClass"];
  21322. return $1;
  21323. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRMethod)})},
  21324. args: [],
  21325. source: "theClass\x0a\x09^ theClass",
  21326. messageSends: [],
  21327. referencedClasses: []
  21328. }),
  21329. smalltalk.IRMethod);
  21330. smalltalk.addMethod(
  21331. smalltalk.method({
  21332. selector: "theClass:",
  21333. category: 'accessing',
  21334. fn: function (aClass){
  21335. var self=this;
  21336. return smalltalk.withContext(function($ctx1) {
  21337. self["@theClass"]=aClass;
  21338. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRMethod)})},
  21339. args: ["aClass"],
  21340. source: "theClass: aClass\x0a\x09theClass := aClass",
  21341. messageSends: [],
  21342. referencedClasses: []
  21343. }),
  21344. smalltalk.IRMethod);
  21345. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  21346. smalltalk.IRReturn.comment="I am a local return instruction.";
  21347. smalltalk.addMethod(
  21348. smalltalk.method({
  21349. selector: "accept:",
  21350. category: 'visiting',
  21351. fn: function (aVisitor){
  21352. var self=this;
  21353. return smalltalk.withContext(function($ctx1) {
  21354. var $1;
  21355. $1=_st(aVisitor)._visitIRReturn_(self);
  21356. return $1;
  21357. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRReturn)})},
  21358. args: ["aVisitor"],
  21359. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  21360. messageSends: ["visitIRReturn:"],
  21361. referencedClasses: []
  21362. }),
  21363. smalltalk.IRReturn);
  21364. smalltalk.addMethod(
  21365. smalltalk.method({
  21366. selector: "canBeAssigned",
  21367. category: 'testing',
  21368. fn: function (){
  21369. var self=this;
  21370. return smalltalk.withContext(function($ctx1) {
  21371. return false;
  21372. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRReturn)})},
  21373. args: [],
  21374. source: "canBeAssigned\x0a\x09^ false",
  21375. messageSends: [],
  21376. referencedClasses: []
  21377. }),
  21378. smalltalk.IRReturn);
  21379. smalltalk.addMethod(
  21380. smalltalk.method({
  21381. selector: "isBlockReturn",
  21382. category: 'testing',
  21383. fn: function (){
  21384. var self=this;
  21385. return smalltalk.withContext(function($ctx1) {
  21386. return false;
  21387. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRReturn)})},
  21388. args: [],
  21389. source: "isBlockReturn\x0a\x09^ false",
  21390. messageSends: [],
  21391. referencedClasses: []
  21392. }),
  21393. smalltalk.IRReturn);
  21394. smalltalk.addMethod(
  21395. smalltalk.method({
  21396. selector: "isLocalReturn",
  21397. category: 'testing',
  21398. fn: function (){
  21399. var self=this;
  21400. return smalltalk.withContext(function($ctx1) {
  21401. return true;
  21402. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRReturn)})},
  21403. args: [],
  21404. source: "isLocalReturn\x0a\x09^ true",
  21405. messageSends: [],
  21406. referencedClasses: []
  21407. }),
  21408. smalltalk.IRReturn);
  21409. smalltalk.addMethod(
  21410. smalltalk.method({
  21411. selector: "isNonLocalReturn",
  21412. category: 'testing',
  21413. fn: function (){
  21414. var self=this;
  21415. return smalltalk.withContext(function($ctx1) {
  21416. var $1;
  21417. $1=_st(self._isLocalReturn())._not();
  21418. return $1;
  21419. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},smalltalk.IRReturn)})},
  21420. args: [],
  21421. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  21422. messageSends: ["not", "isLocalReturn"],
  21423. referencedClasses: []
  21424. }),
  21425. smalltalk.IRReturn);
  21426. smalltalk.addMethod(
  21427. smalltalk.method({
  21428. selector: "isReturn",
  21429. category: 'testing',
  21430. fn: function (){
  21431. var self=this;
  21432. return smalltalk.withContext(function($ctx1) {
  21433. return true;
  21434. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRReturn)})},
  21435. args: [],
  21436. source: "isReturn\x0a\x09^ true",
  21437. messageSends: [],
  21438. referencedClasses: []
  21439. }),
  21440. smalltalk.IRReturn);
  21441. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  21442. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  21443. smalltalk.addMethod(
  21444. smalltalk.method({
  21445. selector: "accept:",
  21446. category: 'visiting',
  21447. fn: function (aVisitor){
  21448. var self=this;
  21449. return smalltalk.withContext(function($ctx1) {
  21450. var $1;
  21451. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  21452. return $1;
  21453. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockReturn)})},
  21454. args: ["aVisitor"],
  21455. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  21456. messageSends: ["visitIRBlockReturn:"],
  21457. referencedClasses: []
  21458. }),
  21459. smalltalk.IRBlockReturn);
  21460. smalltalk.addMethod(
  21461. smalltalk.method({
  21462. selector: "isBlockReturn",
  21463. category: 'testing',
  21464. fn: function (){
  21465. var self=this;
  21466. return smalltalk.withContext(function($ctx1) {
  21467. return true;
  21468. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRBlockReturn)})},
  21469. args: [],
  21470. source: "isBlockReturn\x0a\x09^ true",
  21471. messageSends: [],
  21472. referencedClasses: []
  21473. }),
  21474. smalltalk.IRBlockReturn);
  21475. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  21476. smalltalk.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  21477. smalltalk.addMethod(
  21478. smalltalk.method({
  21479. selector: "accept:",
  21480. category: 'visiting',
  21481. fn: function (aVisitor){
  21482. var self=this;
  21483. return smalltalk.withContext(function($ctx1) {
  21484. var $1;
  21485. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  21486. return $1;
  21487. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRNonLocalReturn)})},
  21488. args: ["aVisitor"],
  21489. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  21490. messageSends: ["visitIRNonLocalReturn:"],
  21491. referencedClasses: []
  21492. }),
  21493. smalltalk.IRNonLocalReturn);
  21494. smalltalk.addMethod(
  21495. smalltalk.method({
  21496. selector: "isLocalReturn",
  21497. category: 'testing',
  21498. fn: function (){
  21499. var self=this;
  21500. return smalltalk.withContext(function($ctx1) {
  21501. return false;
  21502. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRNonLocalReturn)})},
  21503. args: [],
  21504. source: "isLocalReturn\x0a\x09^ false",
  21505. messageSends: [],
  21506. referencedClasses: []
  21507. }),
  21508. smalltalk.IRNonLocalReturn);
  21509. smalltalk.addClass('IRTempDeclaration', smalltalk.IRScopedInstruction, ['name'], 'Compiler-IR');
  21510. smalltalk.addMethod(
  21511. smalltalk.method({
  21512. selector: "accept:",
  21513. category: 'visiting',
  21514. fn: function (aVisitor){
  21515. var self=this;
  21516. return smalltalk.withContext(function($ctx1) {
  21517. var $1;
  21518. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  21519. return $1;
  21520. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRTempDeclaration)})},
  21521. args: ["aVisitor"],
  21522. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  21523. messageSends: ["visitIRTempDeclaration:"],
  21524. referencedClasses: []
  21525. }),
  21526. smalltalk.IRTempDeclaration);
  21527. smalltalk.addMethod(
  21528. smalltalk.method({
  21529. selector: "isTempDeclaration",
  21530. category: 'testing',
  21531. fn: function (){
  21532. var self=this;
  21533. return smalltalk.withContext(function($ctx1) {
  21534. return true;
  21535. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRTempDeclaration)})},
  21536. args: [],
  21537. source: "isTempDeclaration\x0a\x09^ true",
  21538. messageSends: [],
  21539. referencedClasses: []
  21540. }),
  21541. smalltalk.IRTempDeclaration);
  21542. smalltalk.addMethod(
  21543. smalltalk.method({
  21544. selector: "name",
  21545. category: 'accessing',
  21546. fn: function (){
  21547. var self=this;
  21548. return smalltalk.withContext(function($ctx1) {
  21549. var $1;
  21550. $1=self["@name"];
  21551. return $1;
  21552. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.IRTempDeclaration)})},
  21553. args: [],
  21554. source: "name\x0a\x09^ name",
  21555. messageSends: [],
  21556. referencedClasses: []
  21557. }),
  21558. smalltalk.IRTempDeclaration);
  21559. smalltalk.addMethod(
  21560. smalltalk.method({
  21561. selector: "name:",
  21562. category: 'accessing',
  21563. fn: function (aString){
  21564. var self=this;
  21565. return smalltalk.withContext(function($ctx1) {
  21566. self["@name"]=aString;
  21567. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.IRTempDeclaration)})},
  21568. args: ["aString"],
  21569. source: "name: aString\x0a\x09name := aString",
  21570. messageSends: [],
  21571. referencedClasses: []
  21572. }),
  21573. smalltalk.IRTempDeclaration);
  21574. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  21575. smalltalk.IRSend.comment="I am a message send instruction.";
  21576. smalltalk.addMethod(
  21577. smalltalk.method({
  21578. selector: "accept:",
  21579. category: 'visiting',
  21580. fn: function (aVisitor){
  21581. var self=this;
  21582. return smalltalk.withContext(function($ctx1) {
  21583. var $1;
  21584. $1=_st(aVisitor)._visitIRSend_(self);
  21585. return $1;
  21586. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSend)})},
  21587. args: ["aVisitor"],
  21588. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  21589. messageSends: ["visitIRSend:"],
  21590. referencedClasses: []
  21591. }),
  21592. smalltalk.IRSend);
  21593. smalltalk.addMethod(
  21594. smalltalk.method({
  21595. selector: "classSend",
  21596. category: 'accessing',
  21597. fn: function (){
  21598. var self=this;
  21599. return smalltalk.withContext(function($ctx1) {
  21600. var $1;
  21601. $1=self["@classSend"];
  21602. return $1;
  21603. }, function($ctx1) {$ctx1.fill(self,"classSend",{},smalltalk.IRSend)})},
  21604. args: [],
  21605. source: "classSend\x0a\x09^ classSend",
  21606. messageSends: [],
  21607. referencedClasses: []
  21608. }),
  21609. smalltalk.IRSend);
  21610. smalltalk.addMethod(
  21611. smalltalk.method({
  21612. selector: "classSend:",
  21613. category: 'accessing',
  21614. fn: function (aClass){
  21615. var self=this;
  21616. return smalltalk.withContext(function($ctx1) {
  21617. self["@classSend"]=aClass;
  21618. return self}, function($ctx1) {$ctx1.fill(self,"classSend:",{aClass:aClass},smalltalk.IRSend)})},
  21619. args: ["aClass"],
  21620. source: "classSend: aClass\x0a\x09classSend := aClass",
  21621. messageSends: [],
  21622. referencedClasses: []
  21623. }),
  21624. smalltalk.IRSend);
  21625. smalltalk.addMethod(
  21626. smalltalk.method({
  21627. selector: "index",
  21628. category: 'accessing',
  21629. fn: function (){
  21630. var self=this;
  21631. return smalltalk.withContext(function($ctx1) {
  21632. var $1;
  21633. $1=self["@index"];
  21634. return $1;
  21635. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.IRSend)})},
  21636. args: [],
  21637. source: "index\x0a\x09^ index",
  21638. messageSends: [],
  21639. referencedClasses: []
  21640. }),
  21641. smalltalk.IRSend);
  21642. smalltalk.addMethod(
  21643. smalltalk.method({
  21644. selector: "index:",
  21645. category: 'accessing',
  21646. fn: function (anInteger){
  21647. var self=this;
  21648. return smalltalk.withContext(function($ctx1) {
  21649. self["@index"]=anInteger;
  21650. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.IRSend)})},
  21651. args: ["anInteger"],
  21652. source: "index: anInteger\x0a\x09index := anInteger",
  21653. messageSends: [],
  21654. referencedClasses: []
  21655. }),
  21656. smalltalk.IRSend);
  21657. smalltalk.addMethod(
  21658. smalltalk.method({
  21659. selector: "isSend",
  21660. category: 'testing',
  21661. fn: function (){
  21662. var self=this;
  21663. return smalltalk.withContext(function($ctx1) {
  21664. return true;
  21665. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRSend)})},
  21666. args: [],
  21667. source: "isSend\x0a\x09^ true",
  21668. messageSends: [],
  21669. referencedClasses: []
  21670. }),
  21671. smalltalk.IRSend);
  21672. smalltalk.addMethod(
  21673. smalltalk.method({
  21674. selector: "selector",
  21675. category: 'accessing',
  21676. fn: function (){
  21677. var self=this;
  21678. return smalltalk.withContext(function($ctx1) {
  21679. var $1;
  21680. $1=self["@selector"];
  21681. return $1;
  21682. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRSend)})},
  21683. args: [],
  21684. source: "selector\x0a\x09^ selector",
  21685. messageSends: [],
  21686. referencedClasses: []
  21687. }),
  21688. smalltalk.IRSend);
  21689. smalltalk.addMethod(
  21690. smalltalk.method({
  21691. selector: "selector:",
  21692. category: 'accessing',
  21693. fn: function (aString){
  21694. var self=this;
  21695. return smalltalk.withContext(function($ctx1) {
  21696. self["@selector"]=aString;
  21697. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRSend)})},
  21698. args: ["aString"],
  21699. source: "selector: aString\x0a\x09selector := aString",
  21700. messageSends: [],
  21701. referencedClasses: []
  21702. }),
  21703. smalltalk.IRSend);
  21704. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  21705. smalltalk.addMethod(
  21706. smalltalk.method({
  21707. selector: "accept:",
  21708. category: 'visiting',
  21709. fn: function (aVisitor){
  21710. var self=this;
  21711. return smalltalk.withContext(function($ctx1) {
  21712. var $1;
  21713. $1=_st(aVisitor)._visitIRSequence_(self);
  21714. return $1;
  21715. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSequence)})},
  21716. args: ["aVisitor"],
  21717. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  21718. messageSends: ["visitIRSequence:"],
  21719. referencedClasses: []
  21720. }),
  21721. smalltalk.IRSequence);
  21722. smalltalk.addMethod(
  21723. smalltalk.method({
  21724. selector: "isSequence",
  21725. category: 'testing',
  21726. fn: function (){
  21727. var self=this;
  21728. return smalltalk.withContext(function($ctx1) {
  21729. return true;
  21730. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRSequence)})},
  21731. args: [],
  21732. source: "isSequence\x0a\x09^ true",
  21733. messageSends: [],
  21734. referencedClasses: []
  21735. }),
  21736. smalltalk.IRSequence);
  21737. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  21738. smalltalk.addMethod(
  21739. smalltalk.method({
  21740. selector: "accept:",
  21741. category: 'visiting',
  21742. fn: function (aVisitor){
  21743. var self=this;
  21744. return smalltalk.withContext(function($ctx1) {
  21745. var $1;
  21746. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  21747. return $1;
  21748. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockSequence)})},
  21749. args: ["aVisitor"],
  21750. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  21751. messageSends: ["visitIRBlockSequence:"],
  21752. referencedClasses: []
  21753. }),
  21754. smalltalk.IRBlockSequence);
  21755. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  21756. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  21757. smalltalk.addMethod(
  21758. smalltalk.method({
  21759. selector: "accept:",
  21760. category: 'visiting',
  21761. fn: function (aVisitor){
  21762. var self=this;
  21763. return smalltalk.withContext(function($ctx1) {
  21764. var $1;
  21765. $1=_st(aVisitor)._visitIRValue_(self);
  21766. return $1;
  21767. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRValue)})},
  21768. args: ["aVisitor"],
  21769. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  21770. messageSends: ["visitIRValue:"],
  21771. referencedClasses: []
  21772. }),
  21773. smalltalk.IRValue);
  21774. smalltalk.addMethod(
  21775. smalltalk.method({
  21776. selector: "needsBoxingAsReceiver",
  21777. category: 'testing',
  21778. fn: function (){
  21779. var self=this;
  21780. return smalltalk.withContext(function($ctx1) {
  21781. return false;
  21782. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRValue)})},
  21783. args: [],
  21784. source: "needsBoxingAsReceiver\x0a\x09^ false",
  21785. messageSends: [],
  21786. referencedClasses: []
  21787. }),
  21788. smalltalk.IRValue);
  21789. smalltalk.addMethod(
  21790. smalltalk.method({
  21791. selector: "value",
  21792. category: 'accessing',
  21793. fn: function (){
  21794. var self=this;
  21795. return smalltalk.withContext(function($ctx1) {
  21796. var $1;
  21797. $1=self["@value"];
  21798. return $1;
  21799. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.IRValue)})},
  21800. args: [],
  21801. source: "value\x0a\x09^value",
  21802. messageSends: [],
  21803. referencedClasses: []
  21804. }),
  21805. smalltalk.IRValue);
  21806. smalltalk.addMethod(
  21807. smalltalk.method({
  21808. selector: "value:",
  21809. category: 'accessing',
  21810. fn: function (aString){
  21811. var self=this;
  21812. return smalltalk.withContext(function($ctx1) {
  21813. self["@value"]=aString;
  21814. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},smalltalk.IRValue)})},
  21815. args: ["aString"],
  21816. source: "value: aString\x0a\x09value := aString",
  21817. messageSends: [],
  21818. referencedClasses: []
  21819. }),
  21820. smalltalk.IRValue);
  21821. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  21822. smalltalk.IRVariable.comment="I am a variable instruction.";
  21823. smalltalk.addMethod(
  21824. smalltalk.method({
  21825. selector: "accept:",
  21826. category: 'visiting',
  21827. fn: function (aVisitor){
  21828. var self=this;
  21829. return smalltalk.withContext(function($ctx1) {
  21830. var $1;
  21831. $1=_st(aVisitor)._visitIRVariable_(self);
  21832. return $1;
  21833. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVariable)})},
  21834. args: ["aVisitor"],
  21835. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  21836. messageSends: ["visitIRVariable:"],
  21837. referencedClasses: []
  21838. }),
  21839. smalltalk.IRVariable);
  21840. smalltalk.addMethod(
  21841. smalltalk.method({
  21842. selector: "isVariable",
  21843. category: 'testing',
  21844. fn: function (){
  21845. var self=this;
  21846. return smalltalk.withContext(function($ctx1) {
  21847. return true;
  21848. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRVariable)})},
  21849. args: [],
  21850. source: "isVariable\x0a\x09^ true",
  21851. messageSends: [],
  21852. referencedClasses: []
  21853. }),
  21854. smalltalk.IRVariable);
  21855. smalltalk.addMethod(
  21856. smalltalk.method({
  21857. selector: "needsBoxingAsReceiver",
  21858. category: 'testing',
  21859. fn: function (){
  21860. var self=this;
  21861. return smalltalk.withContext(function($ctx1) {
  21862. var $1;
  21863. $1=_st(_st(self._variable())._isPseudoVar())._not();
  21864. return $1;
  21865. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRVariable)})},
  21866. args: [],
  21867. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  21868. messageSends: ["not", "isPseudoVar", "variable"],
  21869. referencedClasses: []
  21870. }),
  21871. smalltalk.IRVariable);
  21872. smalltalk.addMethod(
  21873. smalltalk.method({
  21874. selector: "variable",
  21875. category: 'accessing',
  21876. fn: function (){
  21877. var self=this;
  21878. return smalltalk.withContext(function($ctx1) {
  21879. var $1;
  21880. $1=self["@variable"];
  21881. return $1;
  21882. }, function($ctx1) {$ctx1.fill(self,"variable",{},smalltalk.IRVariable)})},
  21883. args: [],
  21884. source: "variable\x0a\x09^ variable",
  21885. messageSends: [],
  21886. referencedClasses: []
  21887. }),
  21888. smalltalk.IRVariable);
  21889. smalltalk.addMethod(
  21890. smalltalk.method({
  21891. selector: "variable:",
  21892. category: 'accessing',
  21893. fn: function (aScopeVariable){
  21894. var self=this;
  21895. return smalltalk.withContext(function($ctx1) {
  21896. self["@variable"]=aScopeVariable;
  21897. return self}, function($ctx1) {$ctx1.fill(self,"variable:",{aScopeVariable:aScopeVariable},smalltalk.IRVariable)})},
  21898. args: ["aScopeVariable"],
  21899. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  21900. messageSends: [],
  21901. referencedClasses: []
  21902. }),
  21903. smalltalk.IRVariable);
  21904. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  21905. smalltalk.addMethod(
  21906. smalltalk.method({
  21907. selector: "accept:",
  21908. category: 'visiting',
  21909. fn: function (aVisitor){
  21910. var self=this;
  21911. return smalltalk.withContext(function($ctx1) {
  21912. var $1;
  21913. $1=_st(aVisitor)._visitIRVerbatim_(self);
  21914. return $1;
  21915. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVerbatim)})},
  21916. args: ["aVisitor"],
  21917. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  21918. messageSends: ["visitIRVerbatim:"],
  21919. referencedClasses: []
  21920. }),
  21921. smalltalk.IRVerbatim);
  21922. smalltalk.addMethod(
  21923. smalltalk.method({
  21924. selector: "source",
  21925. category: 'accessing',
  21926. fn: function (){
  21927. var self=this;
  21928. return smalltalk.withContext(function($ctx1) {
  21929. var $1;
  21930. $1=self["@source"];
  21931. return $1;
  21932. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRVerbatim)})},
  21933. args: [],
  21934. source: "source\x0a\x09^ source",
  21935. messageSends: [],
  21936. referencedClasses: []
  21937. }),
  21938. smalltalk.IRVerbatim);
  21939. smalltalk.addMethod(
  21940. smalltalk.method({
  21941. selector: "source:",
  21942. category: 'accessing',
  21943. fn: function (aString){
  21944. var self=this;
  21945. return smalltalk.withContext(function($ctx1) {
  21946. self["@source"]=aString;
  21947. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRVerbatim)})},
  21948. args: ["aString"],
  21949. source: "source: aString\x0a\x09source := aString",
  21950. messageSends: [],
  21951. referencedClasses: []
  21952. }),
  21953. smalltalk.IRVerbatim);
  21954. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  21955. smalltalk.addMethod(
  21956. smalltalk.method({
  21957. selector: "visit:",
  21958. category: 'visiting',
  21959. fn: function (anIRInstruction){
  21960. var self=this;
  21961. return smalltalk.withContext(function($ctx1) {
  21962. var $1;
  21963. $1=_st(anIRInstruction)._accept_(self);
  21964. return $1;
  21965. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  21966. args: ["anIRInstruction"],
  21967. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  21968. messageSends: ["accept:"],
  21969. referencedClasses: []
  21970. }),
  21971. smalltalk.IRVisitor);
  21972. smalltalk.addMethod(
  21973. smalltalk.method({
  21974. selector: "visitIRAssignment:",
  21975. category: 'visiting',
  21976. fn: function (anIRAssignment){
  21977. var self=this;
  21978. return smalltalk.withContext(function($ctx1) {
  21979. var $1;
  21980. $1=self._visitIRInstruction_(anIRAssignment);
  21981. return $1;
  21982. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRVisitor)})},
  21983. args: ["anIRAssignment"],
  21984. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  21985. messageSends: ["visitIRInstruction:"],
  21986. referencedClasses: []
  21987. }),
  21988. smalltalk.IRVisitor);
  21989. smalltalk.addMethod(
  21990. smalltalk.method({
  21991. selector: "visitIRBlockReturn:",
  21992. category: 'visiting',
  21993. fn: function (anIRBlockReturn){
  21994. var self=this;
  21995. return smalltalk.withContext(function($ctx1) {
  21996. var $1;
  21997. $1=self._visitIRReturn_(anIRBlockReturn);
  21998. return $1;
  21999. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},smalltalk.IRVisitor)})},
  22000. args: ["anIRBlockReturn"],
  22001. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  22002. messageSends: ["visitIRReturn:"],
  22003. referencedClasses: []
  22004. }),
  22005. smalltalk.IRVisitor);
  22006. smalltalk.addMethod(
  22007. smalltalk.method({
  22008. selector: "visitIRBlockSequence:",
  22009. category: 'visiting',
  22010. fn: function (anIRBlockSequence){
  22011. var self=this;
  22012. return smalltalk.withContext(function($ctx1) {
  22013. var $1;
  22014. $1=self._visitIRSequence_(anIRBlockSequence);
  22015. return $1;
  22016. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},smalltalk.IRVisitor)})},
  22017. args: ["anIRBlockSequence"],
  22018. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  22019. messageSends: ["visitIRSequence:"],
  22020. referencedClasses: []
  22021. }),
  22022. smalltalk.IRVisitor);
  22023. smalltalk.addMethod(
  22024. smalltalk.method({
  22025. selector: "visitIRClosure:",
  22026. category: 'visiting',
  22027. fn: function (anIRClosure){
  22028. var self=this;
  22029. return smalltalk.withContext(function($ctx1) {
  22030. var $1;
  22031. $1=self._visitIRInstruction_(anIRClosure);
  22032. return $1;
  22033. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRVisitor)})},
  22034. args: ["anIRClosure"],
  22035. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  22036. messageSends: ["visitIRInstruction:"],
  22037. referencedClasses: []
  22038. }),
  22039. smalltalk.IRVisitor);
  22040. smalltalk.addMethod(
  22041. smalltalk.method({
  22042. selector: "visitIRDynamicArray:",
  22043. category: 'visiting',
  22044. fn: function (anIRDynamicArray){
  22045. var self=this;
  22046. return smalltalk.withContext(function($ctx1) {
  22047. var $1;
  22048. $1=self._visitIRInstruction_(anIRDynamicArray);
  22049. return $1;
  22050. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRVisitor)})},
  22051. args: ["anIRDynamicArray"],
  22052. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  22053. messageSends: ["visitIRInstruction:"],
  22054. referencedClasses: []
  22055. }),
  22056. smalltalk.IRVisitor);
  22057. smalltalk.addMethod(
  22058. smalltalk.method({
  22059. selector: "visitIRDynamicDictionary:",
  22060. category: 'visiting',
  22061. fn: function (anIRDynamicDictionary){
  22062. var self=this;
  22063. return smalltalk.withContext(function($ctx1) {
  22064. var $1;
  22065. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  22066. return $1;
  22067. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRVisitor)})},
  22068. args: ["anIRDynamicDictionary"],
  22069. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  22070. messageSends: ["visitIRInstruction:"],
  22071. referencedClasses: []
  22072. }),
  22073. smalltalk.IRVisitor);
  22074. smalltalk.addMethod(
  22075. smalltalk.method({
  22076. selector: "visitIRInlinedClosure:",
  22077. category: 'visiting',
  22078. fn: function (anIRInlinedClosure){
  22079. var self=this;
  22080. return smalltalk.withContext(function($ctx1) {
  22081. var $1;
  22082. $1=self._visitIRClosure_(anIRInlinedClosure);
  22083. return $1;
  22084. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRVisitor)})},
  22085. args: ["anIRInlinedClosure"],
  22086. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  22087. messageSends: ["visitIRClosure:"],
  22088. referencedClasses: []
  22089. }),
  22090. smalltalk.IRVisitor);
  22091. smalltalk.addMethod(
  22092. smalltalk.method({
  22093. selector: "visitIRInlinedSequence:",
  22094. category: 'visiting',
  22095. fn: function (anIRInlinedSequence){
  22096. var self=this;
  22097. return smalltalk.withContext(function($ctx1) {
  22098. var $1;
  22099. $1=self._visitIRSequence_(anIRInlinedSequence);
  22100. return $1;
  22101. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRVisitor)})},
  22102. args: ["anIRInlinedSequence"],
  22103. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  22104. messageSends: ["visitIRSequence:"],
  22105. referencedClasses: []
  22106. }),
  22107. smalltalk.IRVisitor);
  22108. smalltalk.addMethod(
  22109. smalltalk.method({
  22110. selector: "visitIRInstruction:",
  22111. category: 'visiting',
  22112. fn: function (anIRInstruction){
  22113. var self=this;
  22114. return smalltalk.withContext(function($ctx1) {
  22115. var $1;
  22116. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  22117. return smalltalk.withContext(function($ctx2) {
  22118. return self._visit_(each);
  22119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  22120. $1=anIRInstruction;
  22121. return $1;
  22122. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  22123. args: ["anIRInstruction"],
  22124. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  22125. messageSends: ["do:", "visit:", "instructions"],
  22126. referencedClasses: []
  22127. }),
  22128. smalltalk.IRVisitor);
  22129. smalltalk.addMethod(
  22130. smalltalk.method({
  22131. selector: "visitIRMethod:",
  22132. category: 'visiting',
  22133. fn: function (anIRMethod){
  22134. var self=this;
  22135. return smalltalk.withContext(function($ctx1) {
  22136. var $1;
  22137. $1=self._visitIRInstruction_(anIRMethod);
  22138. return $1;
  22139. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRVisitor)})},
  22140. args: ["anIRMethod"],
  22141. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  22142. messageSends: ["visitIRInstruction:"],
  22143. referencedClasses: []
  22144. }),
  22145. smalltalk.IRVisitor);
  22146. smalltalk.addMethod(
  22147. smalltalk.method({
  22148. selector: "visitIRNonLocalReturn:",
  22149. category: 'visiting',
  22150. fn: function (anIRNonLocalReturn){
  22151. var self=this;
  22152. return smalltalk.withContext(function($ctx1) {
  22153. var $1;
  22154. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  22155. return $1;
  22156. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRVisitor)})},
  22157. args: ["anIRNonLocalReturn"],
  22158. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  22159. messageSends: ["visitIRInstruction:"],
  22160. referencedClasses: []
  22161. }),
  22162. smalltalk.IRVisitor);
  22163. smalltalk.addMethod(
  22164. smalltalk.method({
  22165. selector: "visitIRNonLocalReturnHandling:",
  22166. category: 'visiting',
  22167. fn: function (anIRNonLocalReturnHandling){
  22168. var self=this;
  22169. return smalltalk.withContext(function($ctx1) {
  22170. var $1;
  22171. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  22172. return $1;
  22173. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},smalltalk.IRVisitor)})},
  22174. args: ["anIRNonLocalReturnHandling"],
  22175. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  22176. messageSends: ["visitIRInstruction:"],
  22177. referencedClasses: []
  22178. }),
  22179. smalltalk.IRVisitor);
  22180. smalltalk.addMethod(
  22181. smalltalk.method({
  22182. selector: "visitIRReturn:",
  22183. category: 'visiting',
  22184. fn: function (anIRReturn){
  22185. var self=this;
  22186. return smalltalk.withContext(function($ctx1) {
  22187. var $1;
  22188. $1=self._visitIRInstruction_(anIRReturn);
  22189. return $1;
  22190. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRVisitor)})},
  22191. args: ["anIRReturn"],
  22192. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  22193. messageSends: ["visitIRInstruction:"],
  22194. referencedClasses: []
  22195. }),
  22196. smalltalk.IRVisitor);
  22197. smalltalk.addMethod(
  22198. smalltalk.method({
  22199. selector: "visitIRSend:",
  22200. category: 'visiting',
  22201. fn: function (anIRSend){
  22202. var self=this;
  22203. return smalltalk.withContext(function($ctx1) {
  22204. var $1;
  22205. $1=self._visitIRInstruction_(anIRSend);
  22206. return $1;
  22207. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRVisitor)})},
  22208. args: ["anIRSend"],
  22209. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  22210. messageSends: ["visitIRInstruction:"],
  22211. referencedClasses: []
  22212. }),
  22213. smalltalk.IRVisitor);
  22214. smalltalk.addMethod(
  22215. smalltalk.method({
  22216. selector: "visitIRSequence:",
  22217. category: 'visiting',
  22218. fn: function (anIRSequence){
  22219. var self=this;
  22220. return smalltalk.withContext(function($ctx1) {
  22221. var $1;
  22222. $1=self._visitIRInstruction_(anIRSequence);
  22223. return $1;
  22224. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRVisitor)})},
  22225. args: ["anIRSequence"],
  22226. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  22227. messageSends: ["visitIRInstruction:"],
  22228. referencedClasses: []
  22229. }),
  22230. smalltalk.IRVisitor);
  22231. smalltalk.addMethod(
  22232. smalltalk.method({
  22233. selector: "visitIRTempDeclaration:",
  22234. category: 'visiting',
  22235. fn: function (anIRTempDeclaration){
  22236. var self=this;
  22237. return smalltalk.withContext(function($ctx1) {
  22238. var $1;
  22239. $1=self._visitIRInstruction_(anIRTempDeclaration);
  22240. return $1;
  22241. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRVisitor)})},
  22242. args: ["anIRTempDeclaration"],
  22243. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  22244. messageSends: ["visitIRInstruction:"],
  22245. referencedClasses: []
  22246. }),
  22247. smalltalk.IRVisitor);
  22248. smalltalk.addMethod(
  22249. smalltalk.method({
  22250. selector: "visitIRValue:",
  22251. category: 'visiting',
  22252. fn: function (anIRValue){
  22253. var self=this;
  22254. return smalltalk.withContext(function($ctx1) {
  22255. var $1;
  22256. $1=self._visitIRInstruction_(anIRValue);
  22257. return $1;
  22258. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRVisitor)})},
  22259. args: ["anIRValue"],
  22260. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  22261. messageSends: ["visitIRInstruction:"],
  22262. referencedClasses: []
  22263. }),
  22264. smalltalk.IRVisitor);
  22265. smalltalk.addMethod(
  22266. smalltalk.method({
  22267. selector: "visitIRVariable:",
  22268. category: 'visiting',
  22269. fn: function (anIRVariable){
  22270. var self=this;
  22271. return smalltalk.withContext(function($ctx1) {
  22272. var $1;
  22273. $1=self._visitIRInstruction_(anIRVariable);
  22274. return $1;
  22275. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRVisitor)})},
  22276. args: ["anIRVariable"],
  22277. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  22278. messageSends: ["visitIRInstruction:"],
  22279. referencedClasses: []
  22280. }),
  22281. smalltalk.IRVisitor);
  22282. smalltalk.addMethod(
  22283. smalltalk.method({
  22284. selector: "visitIRVerbatim:",
  22285. category: 'visiting',
  22286. fn: function (anIRVerbatim){
  22287. var self=this;
  22288. return smalltalk.withContext(function($ctx1) {
  22289. var $1;
  22290. $1=self._visitIRInstruction_(anIRVerbatim);
  22291. return $1;
  22292. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRVisitor)})},
  22293. args: ["anIRVerbatim"],
  22294. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  22295. messageSends: ["visitIRInstruction:"],
  22296. referencedClasses: []
  22297. }),
  22298. smalltalk.IRVisitor);
  22299. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  22300. smalltalk.addMethod(
  22301. smalltalk.method({
  22302. selector: "contents",
  22303. category: 'accessing',
  22304. fn: function (){
  22305. var self=this;
  22306. return smalltalk.withContext(function($ctx1) {
  22307. var $1;
  22308. $1=_st(self._stream())._contents();
  22309. return $1;
  22310. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.IRJSTranslator)})},
  22311. args: [],
  22312. source: "contents\x0a\x09^ self stream contents",
  22313. messageSends: ["contents", "stream"],
  22314. referencedClasses: []
  22315. }),
  22316. smalltalk.IRJSTranslator);
  22317. smalltalk.addMethod(
  22318. smalltalk.method({
  22319. selector: "initialize",
  22320. category: 'initialization',
  22321. fn: function (){
  22322. var self=this;
  22323. function $JSStream(){return smalltalk.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  22324. return smalltalk.withContext(function($ctx1) {
  22325. smalltalk.IRVisitor.fn.prototype._initialize.apply(_st(self), []);
  22326. self["@stream"]=_st($JSStream())._new();
  22327. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.IRJSTranslator)})},
  22328. args: [],
  22329. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  22330. messageSends: ["initialize", "new"],
  22331. referencedClasses: ["JSStream"]
  22332. }),
  22333. smalltalk.IRJSTranslator);
  22334. smalltalk.addMethod(
  22335. smalltalk.method({
  22336. selector: "stream",
  22337. category: 'accessing',
  22338. fn: function (){
  22339. var self=this;
  22340. return smalltalk.withContext(function($ctx1) {
  22341. var $1;
  22342. $1=self["@stream"];
  22343. return $1;
  22344. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.IRJSTranslator)})},
  22345. args: [],
  22346. source: "stream\x0a\x09^ stream",
  22347. messageSends: [],
  22348. referencedClasses: []
  22349. }),
  22350. smalltalk.IRJSTranslator);
  22351. smalltalk.addMethod(
  22352. smalltalk.method({
  22353. selector: "stream:",
  22354. category: 'accessing',
  22355. fn: function (aStream){
  22356. var self=this;
  22357. return smalltalk.withContext(function($ctx1) {
  22358. self["@stream"]=aStream;
  22359. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.IRJSTranslator)})},
  22360. args: ["aStream"],
  22361. source: "stream: aStream\x0a\x09stream := aStream",
  22362. messageSends: [],
  22363. referencedClasses: []
  22364. }),
  22365. smalltalk.IRJSTranslator);
  22366. smalltalk.addMethod(
  22367. smalltalk.method({
  22368. selector: "visitIRAssignment:",
  22369. category: 'visiting',
  22370. fn: function (anIRAssignment){
  22371. var self=this;
  22372. return smalltalk.withContext(function($ctx1) {
  22373. self._visit_(_st(_st(anIRAssignment)._instructions())._first());
  22374. _st(self._stream())._nextPutAssignment();
  22375. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  22376. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRJSTranslator)})},
  22377. args: ["anIRAssignment"],
  22378. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  22379. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  22380. referencedClasses: []
  22381. }),
  22382. smalltalk.IRJSTranslator);
  22383. smalltalk.addMethod(
  22384. smalltalk.method({
  22385. selector: "visitIRClosure:",
  22386. category: 'visiting',
  22387. fn: function (anIRClosure){
  22388. var self=this;
  22389. return smalltalk.withContext(function($ctx1) {
  22390. _st(self._stream())._nextPutClosureWith_arguments_((function(){
  22391. return smalltalk.withContext(function($ctx2) {
  22392. _st(self._stream())._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  22393. return smalltalk.withContext(function($ctx3) {
  22394. return _st(_st(each)._name())._asVariableName();
  22395. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})})));
  22396. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  22397. return smalltalk.withContext(function($ctx3) {
  22398. return smalltalk.IRVisitor.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]);
  22399. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  22400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),_st(anIRClosure)._arguments());
  22401. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRJSTranslator)})},
  22402. args: ["anIRClosure"],
  22403. 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",
  22404. messageSends: ["nextPutClosureWith:arguments:", "nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  22405. referencedClasses: []
  22406. }),
  22407. smalltalk.IRJSTranslator);
  22408. smalltalk.addMethod(
  22409. smalltalk.method({
  22410. selector: "visitIRDynamicArray:",
  22411. category: 'visiting',
  22412. fn: function (anIRDynamicArray){
  22413. var self=this;
  22414. return smalltalk.withContext(function($ctx1) {
  22415. _st(self._stream())._nextPutAll_("[");
  22416. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  22417. return smalltalk.withContext(function($ctx2) {
  22418. return self._visit_(each);
  22419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22420. return smalltalk.withContext(function($ctx2) {
  22421. return _st(self._stream())._nextPutAll_(",");
  22422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22423. _st(self["@stream"])._nextPutAll_("]");
  22424. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRJSTranslator)})},
  22425. args: ["anIRDynamicArray"],
  22426. 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: ']'",
  22427. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  22428. referencedClasses: []
  22429. }),
  22430. smalltalk.IRJSTranslator);
  22431. smalltalk.addMethod(
  22432. smalltalk.method({
  22433. selector: "visitIRDynamicDictionary:",
  22434. category: 'visiting',
  22435. fn: function (anIRDynamicDictionary){
  22436. var self=this;
  22437. return smalltalk.withContext(function($ctx1) {
  22438. _st(self._stream())._nextPutAll_("smalltalk.HashedCollection._from_([");
  22439. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  22440. return smalltalk.withContext(function($ctx2) {
  22441. return self._visit_(each);
  22442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22443. return smalltalk.withContext(function($ctx2) {
  22444. return _st(self._stream())._nextPutAll_(",");
  22445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22446. _st(self._stream())._nextPutAll_("])");
  22447. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRJSTranslator)})},
  22448. args: ["anIRDynamicDictionary"],
  22449. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'smalltalk.HashedCollection._from_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  22450. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  22451. referencedClasses: []
  22452. }),
  22453. smalltalk.IRJSTranslator);
  22454. smalltalk.addMethod(
  22455. smalltalk.method({
  22456. selector: "visitIRMethod:",
  22457. category: 'visiting',
  22458. fn: function (anIRMethod){
  22459. var self=this;
  22460. return smalltalk.withContext(function($ctx1) {
  22461. var $1,$2;
  22462. _st(self._stream())._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  22463. return smalltalk.withContext(function($ctx2) {
  22464. return _st(self._stream())._nextPutFunctionWith_arguments_((function(){
  22465. return smalltalk.withContext(function($ctx3) {
  22466. _st(self._stream())._nextPutVars_(_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  22467. return smalltalk.withContext(function($ctx4) {
  22468. return _st(_st(each)._name())._asVariableName();
  22469. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})})));
  22470. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  22471. return smalltalk.withContext(function($ctx4) {
  22472. return _st(self._stream())._nextPutClassRefFunction_(each);
  22473. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  22474. return _st(self._stream())._nextPutContextFor_during_(anIRMethod,(function(){
  22475. return smalltalk.withContext(function($ctx4) {
  22476. $1=_st(_st(anIRMethod)._internalVariables())._notEmpty();
  22477. if(smalltalk.assert($1)){
  22478. _st(self._stream())._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asArray())._collect_((function(each){
  22479. return smalltalk.withContext(function($ctx5) {
  22480. return _st(_st(each)._variable())._alias();
  22481. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4)})})));
  22482. };
  22483. $2=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  22484. if(smalltalk.assert($2)){
  22485. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  22486. return smalltalk.withContext(function($ctx5) {
  22487. return smalltalk.IRVisitor.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  22488. }, function($ctx5) {$ctx5.fillBlock({},$ctx4)})}));
  22489. } else {
  22490. return smalltalk.IRVisitor.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  22491. };
  22492. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  22493. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}),_st(anIRMethod)._arguments());
  22494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22495. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRJSTranslator)})},
  22496. args: ["anIRMethod"],
  22497. 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 ]",
  22498. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "do:", "nextPutClassRefFunction:", "classReferences", "nextPutContextFor:during:", "ifTrue:", "alias", "variable", "asArray", "internalVariables", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  22499. referencedClasses: []
  22500. }),
  22501. smalltalk.IRJSTranslator);
  22502. smalltalk.addMethod(
  22503. smalltalk.method({
  22504. selector: "visitIRNonLocalReturn:",
  22505. category: 'visiting',
  22506. fn: function (anIRNonLocalReturn){
  22507. var self=this;
  22508. return smalltalk.withContext(function($ctx1) {
  22509. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  22510. return smalltalk.withContext(function($ctx2) {
  22511. return smalltalk.IRVisitor.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  22512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22513. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRJSTranslator)})},
  22514. args: ["anIRNonLocalReturn"],
  22515. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  22516. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  22517. referencedClasses: []
  22518. }),
  22519. smalltalk.IRJSTranslator);
  22520. smalltalk.addMethod(
  22521. smalltalk.method({
  22522. selector: "visitIRReturn:",
  22523. category: 'visiting',
  22524. fn: function (anIRReturn){
  22525. var self=this;
  22526. return smalltalk.withContext(function($ctx1) {
  22527. _st(self._stream())._nextPutReturnWith_((function(){
  22528. return smalltalk.withContext(function($ctx2) {
  22529. return smalltalk.IRVisitor.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  22530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22531. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRJSTranslator)})},
  22532. args: ["anIRReturn"],
  22533. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  22534. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  22535. referencedClasses: []
  22536. }),
  22537. smalltalk.IRJSTranslator);
  22538. smalltalk.addMethod(
  22539. smalltalk.method({
  22540. selector: "visitIRSend:",
  22541. category: 'visiting',
  22542. fn: function (anIRSend){
  22543. var self=this;
  22544. return smalltalk.withContext(function($ctx1) {
  22545. var $1;
  22546. $1=_st(anIRSend)._classSend();
  22547. if(($receiver = $1) == nil || $receiver == undefined){
  22548. self._visitSend_(anIRSend);
  22549. } else {
  22550. self._visitSuperSend_(anIRSend);
  22551. };
  22552. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22553. args: ["anIRSend"],
  22554. source: "visitIRSend: anIRSend\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ]",
  22555. messageSends: ["ifNil:ifNotNil:", "visitSend:", "visitSuperSend:", "classSend"],
  22556. referencedClasses: []
  22557. }),
  22558. smalltalk.IRJSTranslator);
  22559. smalltalk.addMethod(
  22560. smalltalk.method({
  22561. selector: "visitIRSequence:",
  22562. category: 'visiting',
  22563. fn: function (anIRSequence){
  22564. var self=this;
  22565. return smalltalk.withContext(function($ctx1) {
  22566. _st(self._stream())._nextPutSequenceWith_((function(){
  22567. return smalltalk.withContext(function($ctx2) {
  22568. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  22569. return smalltalk.withContext(function($ctx3) {
  22570. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  22571. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  22572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22573. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRJSTranslator)})},
  22574. args: ["anIRSequence"],
  22575. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  22576. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  22577. referencedClasses: []
  22578. }),
  22579. smalltalk.IRJSTranslator);
  22580. smalltalk.addMethod(
  22581. smalltalk.method({
  22582. selector: "visitIRTempDeclaration:",
  22583. category: 'visiting',
  22584. fn: function (anIRTempDeclaration){
  22585. var self=this;
  22586. return smalltalk.withContext(function($ctx1) {
  22587. return self}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRJSTranslator)})},
  22588. args: ["anIRTempDeclaration"],
  22589. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  22590. messageSends: [],
  22591. referencedClasses: []
  22592. }),
  22593. smalltalk.IRJSTranslator);
  22594. smalltalk.addMethod(
  22595. smalltalk.method({
  22596. selector: "visitIRValue:",
  22597. category: 'visiting',
  22598. fn: function (anIRValue){
  22599. var self=this;
  22600. return smalltalk.withContext(function($ctx1) {
  22601. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  22602. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRJSTranslator)})},
  22603. args: ["anIRValue"],
  22604. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  22605. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  22606. referencedClasses: []
  22607. }),
  22608. smalltalk.IRJSTranslator);
  22609. smalltalk.addMethod(
  22610. smalltalk.method({
  22611. selector: "visitIRVariable:",
  22612. category: 'visiting',
  22613. fn: function (anIRVariable){
  22614. var self=this;
  22615. return smalltalk.withContext(function($ctx1) {
  22616. var $1;
  22617. $1=_st(_st(_st(anIRVariable)._variable())._name()).__eq("thisContext");
  22618. if(smalltalk.assert($1)){
  22619. _st(self._stream())._nextPutAll_("smalltalk.getThisContext()");
  22620. } else {
  22621. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  22622. };
  22623. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRJSTranslator)})},
  22624. args: ["anIRVariable"],
  22625. 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 ]",
  22626. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  22627. referencedClasses: []
  22628. }),
  22629. smalltalk.IRJSTranslator);
  22630. smalltalk.addMethod(
  22631. smalltalk.method({
  22632. selector: "visitIRVerbatim:",
  22633. category: 'visiting',
  22634. fn: function (anIRVerbatim){
  22635. var self=this;
  22636. return smalltalk.withContext(function($ctx1) {
  22637. _st(self._stream())._nextPutStatementWith_((function(){
  22638. return smalltalk.withContext(function($ctx2) {
  22639. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  22640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22641. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRJSTranslator)})},
  22642. args: ["anIRVerbatim"],
  22643. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  22644. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  22645. referencedClasses: []
  22646. }),
  22647. smalltalk.IRJSTranslator);
  22648. smalltalk.addMethod(
  22649. smalltalk.method({
  22650. selector: "visitReceiver:",
  22651. category: 'visiting',
  22652. fn: function (anIRInstruction){
  22653. var self=this;
  22654. return smalltalk.withContext(function($ctx1) {
  22655. var $1,$2;
  22656. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  22657. if(! smalltalk.assert($1)){
  22658. $2=self._visit_(anIRInstruction);
  22659. return $2;
  22660. };
  22661. _st(self._stream())._nextPutAll_("_st(");
  22662. self._visit_(anIRInstruction);
  22663. _st(self._stream())._nextPutAll_(")");
  22664. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},smalltalk.IRJSTranslator)})},
  22665. args: ["anIRInstruction"],
  22666. 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: ')'",
  22667. messageSends: ["ifFalse:", "visit:", "needsBoxingAsReceiver", "nextPutAll:", "stream"],
  22668. referencedClasses: []
  22669. }),
  22670. smalltalk.IRJSTranslator);
  22671. smalltalk.addMethod(
  22672. smalltalk.method({
  22673. selector: "visitSend:",
  22674. category: 'visiting',
  22675. fn: function (anIRSend){
  22676. var self=this;
  22677. return smalltalk.withContext(function($ctx1) {
  22678. self._visitReceiver_(_st(_st(anIRSend)._instructions())._first());
  22679. _st(self._stream())._nextPutAll_(_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
  22680. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  22681. return smalltalk.withContext(function($ctx2) {
  22682. return self._visit_(each);
  22683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22684. return smalltalk.withContext(function($ctx2) {
  22685. return _st(self._stream())._nextPutAll_(",");
  22686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22687. _st(self._stream())._nextPutAll_(")");
  22688. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22689. args: ["anIRSend"],
  22690. 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: ')'",
  22691. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", ",", "asSelector", "selector", "stream", "do:separatedBy:", "visit:", "allButFirst"],
  22692. referencedClasses: []
  22693. }),
  22694. smalltalk.IRJSTranslator);
  22695. smalltalk.addMethod(
  22696. smalltalk.method({
  22697. selector: "visitSuperSend:",
  22698. category: 'visiting',
  22699. fn: function (anIRSend){
  22700. var self=this;
  22701. return smalltalk.withContext(function($ctx1) {
  22702. var $1,$2;
  22703. $1=self._stream();
  22704. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._classSend())._asJavascript()).__comma(".fn.prototype."));
  22705. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
  22706. $2=_st($1)._nextPutAll_("_st(");
  22707. self._visit_(_st(_st(anIRSend)._instructions())._first());
  22708. _st(self._stream())._nextPutAll_("), [");
  22709. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  22710. return smalltalk.withContext(function($ctx2) {
  22711. return self._visit_(each);
  22712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22713. return smalltalk.withContext(function($ctx2) {
  22714. return _st(self._stream())._nextPutAll_(",");
  22715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22716. _st(self._stream())._nextPutAll_("])");
  22717. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  22718. args: ["anIRSend"],
  22719. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: anIRSend classSend asJavascript, '.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: '])'",
  22720. messageSends: ["nextPutAll:", ",", "asJavascript", "classSend", "stream", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"],
  22721. referencedClasses: []
  22722. }),
  22723. smalltalk.IRJSTranslator);
  22724. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  22725. smalltalk.addMethod(
  22726. smalltalk.method({
  22727. selector: "contents",
  22728. category: 'accessing',
  22729. fn: function (){
  22730. var self=this;
  22731. return smalltalk.withContext(function($ctx1) {
  22732. var $1;
  22733. $1=_st(self["@stream"])._contents();
  22734. return $1;
  22735. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.JSStream)})},
  22736. args: [],
  22737. source: "contents\x0a\x09^ stream contents",
  22738. messageSends: ["contents"],
  22739. referencedClasses: []
  22740. }),
  22741. smalltalk.JSStream);
  22742. smalltalk.addMethod(
  22743. smalltalk.method({
  22744. selector: "initialize",
  22745. category: 'initialization',
  22746. fn: function (){
  22747. var self=this;
  22748. return smalltalk.withContext(function($ctx1) {
  22749. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  22750. self["@stream"]=""._writeStream();
  22751. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.JSStream)})},
  22752. args: [],
  22753. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  22754. messageSends: ["initialize", "writeStream"],
  22755. referencedClasses: []
  22756. }),
  22757. smalltalk.JSStream);
  22758. smalltalk.addMethod(
  22759. smalltalk.method({
  22760. selector: "lf",
  22761. category: 'streaming',
  22762. fn: function (){
  22763. var self=this;
  22764. return smalltalk.withContext(function($ctx1) {
  22765. _st(self["@stream"])._lf();
  22766. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.JSStream)})},
  22767. args: [],
  22768. source: "lf\x0a\x09stream lf",
  22769. messageSends: ["lf"],
  22770. referencedClasses: []
  22771. }),
  22772. smalltalk.JSStream);
  22773. smalltalk.addMethod(
  22774. smalltalk.method({
  22775. selector: "nextPut:",
  22776. category: 'streaming',
  22777. fn: function (aString){
  22778. var self=this;
  22779. return smalltalk.withContext(function($ctx1) {
  22780. _st(self["@stream"])._nextPut_(aString);
  22781. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.JSStream)})},
  22782. args: ["aString"],
  22783. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  22784. messageSends: ["nextPut:"],
  22785. referencedClasses: []
  22786. }),
  22787. smalltalk.JSStream);
  22788. smalltalk.addMethod(
  22789. smalltalk.method({
  22790. selector: "nextPutAll:",
  22791. category: 'streaming',
  22792. fn: function (aString){
  22793. var self=this;
  22794. return smalltalk.withContext(function($ctx1) {
  22795. _st(self["@stream"])._nextPutAll_(aString);
  22796. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},smalltalk.JSStream)})},
  22797. args: ["aString"],
  22798. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  22799. messageSends: ["nextPutAll:"],
  22800. referencedClasses: []
  22801. }),
  22802. smalltalk.JSStream);
  22803. smalltalk.addMethod(
  22804. smalltalk.method({
  22805. selector: "nextPutAssignment",
  22806. category: 'streaming',
  22807. fn: function (){
  22808. var self=this;
  22809. return smalltalk.withContext(function($ctx1) {
  22810. _st(self["@stream"])._nextPutAll_("=");
  22811. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},smalltalk.JSStream)})},
  22812. args: [],
  22813. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  22814. messageSends: ["nextPutAll:"],
  22815. referencedClasses: []
  22816. }),
  22817. smalltalk.JSStream);
  22818. smalltalk.addMethod(
  22819. smalltalk.method({
  22820. selector: "nextPutBlockContextFor:during:",
  22821. category: 'streaming',
  22822. fn: function (anIRClosure,aBlock){
  22823. var self=this;
  22824. return smalltalk.withContext(function($ctx1) {
  22825. var $1,$2,$3,$4,$5,$6,$7,$8;
  22826. $1=self;
  22827. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  22828. $2=_st($1)._lf();
  22829. _st(aBlock)._value();
  22830. $3=self;
  22831. _st($3)._nextPutAll_(_st("}, function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  22832. $4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fillBlock({"));
  22833. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  22834. return smalltalk.withContext(function($ctx2) {
  22835. $5=self;
  22836. _st($5)._nextPutAll_(_st(each)._asVariableName());
  22837. _st($5)._nextPutAll_(":");
  22838. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  22839. return $6;
  22840. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22841. return smalltalk.withContext(function($ctx2) {
  22842. return self._nextPutAll_(",");
  22843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22844. $7=self;
  22845. _st($7)._nextPutAll_("},");
  22846. $8=_st($7)._nextPutAll_(_st(_st(_st(_st(anIRClosure)._scope())._outerScope())._alias()).__comma(")})"));
  22847. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},smalltalk.JSStream)})},
  22848. args: ["anIRClosure", "aBlock"],
  22849. source: "nextPutBlockContextFor: anIRClosure during: aBlock\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, ')})'",
  22850. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "do:separatedBy:", "asVariableName", "locals", "outerScope"],
  22851. referencedClasses: []
  22852. }),
  22853. smalltalk.JSStream);
  22854. smalltalk.addMethod(
  22855. smalltalk.method({
  22856. selector: "nextPutClassRefFunction:",
  22857. category: 'streaming',
  22858. fn: function (aString){
  22859. var self=this;
  22860. return smalltalk.withContext(function($ctx1) {
  22861. var $1,$2;
  22862. $1=self["@stream"];
  22863. _st($1)._nextPutAll_("function $");
  22864. _st($1)._nextPutAll_(aString);
  22865. _st($1)._nextPutAll_("(){return smalltalk.");
  22866. _st($1)._nextPutAll_(aString);
  22867. _st($1)._nextPutAll_("||(typeof ");
  22868. _st($1)._nextPutAll_(aString);
  22869. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  22870. _st($1)._nextPutAll_(aString);
  22871. _st($1)._nextPutAll_(")}");
  22872. $2=_st($1)._lf();
  22873. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},smalltalk.JSStream)})},
  22874. args: ["aString"],
  22875. 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 smalltalk.';\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",
  22876. messageSends: ["nextPutAll:", "lf"],
  22877. referencedClasses: []
  22878. }),
  22879. smalltalk.JSStream);
  22880. smalltalk.addMethod(
  22881. smalltalk.method({
  22882. selector: "nextPutClosureWith:arguments:",
  22883. category: 'streaming',
  22884. fn: function (aBlock,anArray){
  22885. var self=this;
  22886. return smalltalk.withContext(function($ctx1) {
  22887. var $1,$2;
  22888. _st(self["@stream"])._nextPutAll_("(function(");
  22889. _st(anArray)._do_separatedBy_((function(each){
  22890. return smalltalk.withContext(function($ctx2) {
  22891. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  22892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22893. return smalltalk.withContext(function($ctx2) {
  22894. return _st(self["@stream"])._nextPut_(",");
  22895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22896. $1=self["@stream"];
  22897. _st($1)._nextPutAll_("){");
  22898. $2=_st($1)._lf();
  22899. _st(aBlock)._value();
  22900. _st(self["@stream"])._nextPutAll_("})");
  22901. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  22902. args: ["aBlock", "anArray"],
  22903. 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: '})'",
  22904. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  22905. referencedClasses: []
  22906. }),
  22907. smalltalk.JSStream);
  22908. smalltalk.addMethod(
  22909. smalltalk.method({
  22910. selector: "nextPutContextFor:during:",
  22911. category: 'streaming',
  22912. fn: function (aMethod,aBlock){
  22913. var self=this;
  22914. return smalltalk.withContext(function($ctx1) {
  22915. var $1,$2,$3,$4,$5,$6,$7,$8;
  22916. $1=self;
  22917. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") { "));
  22918. $2=_st($1)._lf();
  22919. _st(aBlock)._value();
  22920. $3=self;
  22921. _st($3)._nextPutAll_(_st(_st("}, function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") {")).__comma(_st(_st(aMethod)._scope())._alias()));
  22922. $4=_st($3)._nextPutAll_(_st(".fill(self,".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(",{"));
  22923. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  22924. return smalltalk.withContext(function($ctx2) {
  22925. $5=self;
  22926. _st($5)._nextPutAll_(_st(each)._asVariableName());
  22927. _st($5)._nextPutAll_(":");
  22928. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  22929. return $6;
  22930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22931. return smalltalk.withContext(function($ctx2) {
  22932. return self._nextPutAll_(",");
  22933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22934. $7=self;
  22935. _st($7)._nextPutAll_("},");
  22936. _st($7)._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  22937. $8=_st($7)._nextPutAll_(")})");
  22938. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  22939. args: ["aMethod", "aBlock"],
  22940. source: "nextPutContextFor: aMethod during: aBlock\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: ')})'",
  22941. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "asJavascript", "selector", "do:separatedBy:", "asVariableName", "locals", "theClass"],
  22942. referencedClasses: []
  22943. }),
  22944. smalltalk.JSStream);
  22945. smalltalk.addMethod(
  22946. smalltalk.method({
  22947. selector: "nextPutFunctionWith:arguments:",
  22948. category: 'streaming',
  22949. fn: function (aBlock,anArray){
  22950. var self=this;
  22951. return smalltalk.withContext(function($ctx1) {
  22952. var $1,$2,$3,$4;
  22953. _st(self["@stream"])._nextPutAll_("fn: function(");
  22954. _st(anArray)._do_separatedBy_((function(each){
  22955. return smalltalk.withContext(function($ctx2) {
  22956. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  22957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  22958. return smalltalk.withContext(function($ctx2) {
  22959. return _st(self["@stream"])._nextPut_(",");
  22960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  22961. $1=self["@stream"];
  22962. _st($1)._nextPutAll_("){");
  22963. $2=_st($1)._lf();
  22964. $3=self["@stream"];
  22965. _st($3)._nextPutAll_("var self=this;");
  22966. $4=_st($3)._lf();
  22967. _st(aBlock)._value();
  22968. _st(self["@stream"])._nextPutAll_("}");
  22969. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  22970. args: ["aBlock", "anArray"],
  22971. 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: '}'",
  22972. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  22973. referencedClasses: []
  22974. }),
  22975. smalltalk.JSStream);
  22976. smalltalk.addMethod(
  22977. smalltalk.method({
  22978. selector: "nextPutIf:with:",
  22979. category: 'streaming',
  22980. fn: function (aBlock,anotherBlock){
  22981. var self=this;
  22982. return smalltalk.withContext(function($ctx1) {
  22983. var $1,$2;
  22984. _st(self["@stream"])._nextPutAll_("if(");
  22985. _st(aBlock)._value();
  22986. $1=self["@stream"];
  22987. _st($1)._nextPutAll_("){");
  22988. $2=_st($1)._lf();
  22989. _st(anotherBlock)._value();
  22990. _st(self["@stream"])._nextPutAll_("}");
  22991. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSStream)})},
  22992. args: ["aBlock", "anotherBlock"],
  22993. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  22994. messageSends: ["nextPutAll:", "value", "lf"],
  22995. referencedClasses: []
  22996. }),
  22997. smalltalk.JSStream);
  22998. smalltalk.addMethod(
  22999. smalltalk.method({
  23000. selector: "nextPutIfElse:with:with:",
  23001. category: 'streaming',
  23002. fn: function (aBlock,ifBlock,elseBlock){
  23003. var self=this;
  23004. return smalltalk.withContext(function($ctx1) {
  23005. var $1,$2,$3,$4;
  23006. _st(self["@stream"])._nextPutAll_("if(");
  23007. _st(aBlock)._value();
  23008. $1=self["@stream"];
  23009. _st($1)._nextPutAll_("){");
  23010. $2=_st($1)._lf();
  23011. _st(ifBlock)._value();
  23012. $3=self["@stream"];
  23013. _st($3)._nextPutAll_("} else {");
  23014. $4=_st($3)._lf();
  23015. _st(elseBlock)._value();
  23016. _st(self["@stream"])._nextPutAll_("}");
  23017. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},smalltalk.JSStream)})},
  23018. args: ["aBlock", "ifBlock", "elseBlock"],
  23019. 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: '}'",
  23020. messageSends: ["nextPutAll:", "value", "lf"],
  23021. referencedClasses: []
  23022. }),
  23023. smalltalk.JSStream);
  23024. smalltalk.addMethod(
  23025. smalltalk.method({
  23026. selector: "nextPutMethodDeclaration:with:",
  23027. category: 'streaming',
  23028. fn: function (aMethod,aBlock){
  23029. var self=this;
  23030. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  23031. return smalltalk.withContext(function($ctx1) {
  23032. var $1,$2,$3,$4,$5,$6;
  23033. $1=self["@stream"];
  23034. _st($1)._nextPutAll_("smalltalk.method({");
  23035. _st($1)._lf();
  23036. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  23037. _st($1)._lf();
  23038. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  23039. $2=_st($1)._lf();
  23040. _st(aBlock)._value();
  23041. $3=self["@stream"];
  23042. _st($3)._nextPutAll_(_st(",".__comma(_st($String())._lf())).__comma("messageSends: "));
  23043. _st($3)._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
  23044. _st($3)._lf();
  23045. _st($3)._nextPutAll_(_st("args: ".__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  23046. return smalltalk.withContext(function($ctx2) {
  23047. return _st(each)._value();
  23048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._asArray())._asJavascript())).__comma(","));
  23049. _st($3)._lf();
  23050. $4=_st($3)._nextPutAll_("referencedClasses: [");
  23051. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  23052. return smalltalk.withContext(function($ctx2) {
  23053. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  23054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  23055. return smalltalk.withContext(function($ctx2) {
  23056. return _st(self["@stream"])._nextPutAll_(",");
  23057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23058. $5=self["@stream"];
  23059. _st($5)._nextPutAll_("]");
  23060. $6=_st($5)._nextPutAll_("})");
  23061. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  23062. args: ["aMethod", "aBlock"],
  23063. 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: '})'",
  23064. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  23065. referencedClasses: ["String"]
  23066. }),
  23067. smalltalk.JSStream);
  23068. smalltalk.addMethod(
  23069. smalltalk.method({
  23070. selector: "nextPutNonLocalReturnHandlingWith:",
  23071. category: 'streaming',
  23072. fn: function (aBlock){
  23073. var self=this;
  23074. return smalltalk.withContext(function($ctx1) {
  23075. var $1,$2,$3,$4;
  23076. $1=self["@stream"];
  23077. _st($1)._nextPutAll_("var $early={};");
  23078. _st($1)._lf();
  23079. _st($1)._nextPutAll_("try {");
  23080. $2=_st($1)._lf();
  23081. _st(aBlock)._value();
  23082. $3=self["@stream"];
  23083. _st($3)._nextPutAll_("}");
  23084. _st($3)._lf();
  23085. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  23086. $4=_st($3)._lf();
  23087. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23088. args: ["aBlock"],
  23089. 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",
  23090. messageSends: ["nextPutAll:", "lf", "value"],
  23091. referencedClasses: []
  23092. }),
  23093. smalltalk.JSStream);
  23094. smalltalk.addMethod(
  23095. smalltalk.method({
  23096. selector: "nextPutNonLocalReturnWith:",
  23097. category: 'streaming',
  23098. fn: function (aBlock){
  23099. var self=this;
  23100. return smalltalk.withContext(function($ctx1) {
  23101. _st(self["@stream"])._nextPutAll_("throw $early=[");
  23102. _st(aBlock)._value();
  23103. _st(self["@stream"])._nextPutAll_("]");
  23104. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23105. args: ["aBlock"],
  23106. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  23107. messageSends: ["nextPutAll:", "value"],
  23108. referencedClasses: []
  23109. }),
  23110. smalltalk.JSStream);
  23111. smalltalk.addMethod(
  23112. smalltalk.method({
  23113. selector: "nextPutReturn",
  23114. category: 'streaming',
  23115. fn: function (){
  23116. var self=this;
  23117. return smalltalk.withContext(function($ctx1) {
  23118. _st(self["@stream"])._nextPutAll_("return ");
  23119. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},smalltalk.JSStream)})},
  23120. args: [],
  23121. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  23122. messageSends: ["nextPutAll:"],
  23123. referencedClasses: []
  23124. }),
  23125. smalltalk.JSStream);
  23126. smalltalk.addMethod(
  23127. smalltalk.method({
  23128. selector: "nextPutReturnWith:",
  23129. category: 'streaming',
  23130. fn: function (aBlock){
  23131. var self=this;
  23132. return smalltalk.withContext(function($ctx1) {
  23133. self._nextPutReturn();
  23134. _st(aBlock)._value();
  23135. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23136. args: ["aBlock"],
  23137. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  23138. messageSends: ["nextPutReturn", "value"],
  23139. referencedClasses: []
  23140. }),
  23141. smalltalk.JSStream);
  23142. smalltalk.addMethod(
  23143. smalltalk.method({
  23144. selector: "nextPutSequenceWith:",
  23145. category: 'streaming',
  23146. fn: function (aBlock){
  23147. var self=this;
  23148. return smalltalk.withContext(function($ctx1) {
  23149. _st(aBlock)._value();
  23150. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23151. args: ["aBlock"],
  23152. 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",
  23153. messageSends: ["value"],
  23154. referencedClasses: []
  23155. }),
  23156. smalltalk.JSStream);
  23157. smalltalk.addMethod(
  23158. smalltalk.method({
  23159. selector: "nextPutStatement:with:",
  23160. category: 'streaming',
  23161. fn: function (anInteger,aBlock){
  23162. var self=this;
  23163. return smalltalk.withContext(function($ctx1) {
  23164. var $1,$2,$3,$4;
  23165. $1=self["@stream"];
  23166. _st($1)._nextPutAll_(_st("case ".__comma(_st(anInteger)._asString())).__comma(":"));
  23167. $2=_st($1)._lf();
  23168. self._nextPutStatementWith_(aBlock);
  23169. $3=self["@stream"];
  23170. _st($3)._nextPutAll_(_st("smalltalk.thisContext.pc=".__comma(_st(_st(anInteger).__plus((1)))._asString())).__comma(";"));
  23171. $4=_st($3)._lf();
  23172. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatement:with:",{anInteger:anInteger,aBlock:aBlock},smalltalk.JSStream)})},
  23173. args: ["anInteger", "aBlock"],
  23174. source: "nextPutStatement: anInteger with: aBlock\x0a\x09stream nextPutAll: 'case ', anInteger asString, ':'; lf.\x0a\x09self nextPutStatementWith: aBlock.\x0a\x09stream nextPutAll: 'smalltalk.thisContext.pc=', (anInteger + 1) asString, ';'; lf",
  23175. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  23176. referencedClasses: []
  23177. }),
  23178. smalltalk.JSStream);
  23179. smalltalk.addMethod(
  23180. smalltalk.method({
  23181. selector: "nextPutStatementWith:",
  23182. category: 'streaming',
  23183. fn: function (aBlock){
  23184. var self=this;
  23185. return smalltalk.withContext(function($ctx1) {
  23186. var $1,$2;
  23187. _st(aBlock)._value();
  23188. $1=self["@stream"];
  23189. _st($1)._nextPutAll_(";");
  23190. $2=_st($1)._lf();
  23191. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  23192. args: ["aBlock"],
  23193. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  23194. messageSends: ["value", "nextPutAll:", "lf"],
  23195. referencedClasses: []
  23196. }),
  23197. smalltalk.JSStream);
  23198. smalltalk.addMethod(
  23199. smalltalk.method({
  23200. selector: "nextPutVars:",
  23201. category: 'streaming',
  23202. fn: function (aCollection){
  23203. var self=this;
  23204. return smalltalk.withContext(function($ctx1) {
  23205. var $1,$2,$3;
  23206. var $early={};
  23207. try {
  23208. _st(aCollection)._ifEmpty_((function(){
  23209. return smalltalk.withContext(function($ctx2) {
  23210. $1=self;
  23211. throw $early=[$1];
  23212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23213. _st(self["@stream"])._nextPutAll_("var ");
  23214. _st(aCollection)._do_separatedBy_((function(each){
  23215. return smalltalk.withContext(function($ctx2) {
  23216. return _st(self["@stream"])._nextPutAll_(each);
  23217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  23218. return smalltalk.withContext(function($ctx2) {
  23219. return _st(self["@stream"])._nextPutAll_(",");
  23220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23221. $2=self["@stream"];
  23222. _st($2)._nextPutAll_(";");
  23223. $3=_st($2)._lf();
  23224. return self}
  23225. catch(e) {if(e===$early)return e[0]; throw e}
  23226. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},smalltalk.JSStream)})},
  23227. args: ["aCollection"],
  23228. 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",
  23229. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  23230. referencedClasses: []
  23231. }),
  23232. smalltalk.JSStream);
  23233. smalltalk.addMethod(
  23234. smalltalk.method({
  23235. selector: "appendToInstruction:",
  23236. category: '*Compiler-IR',
  23237. fn: function (anIRInstruction){
  23238. var self=this;
  23239. return smalltalk.withContext(function($ctx1) {
  23240. _st(anIRInstruction)._appendBlock_(self);
  23241. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},smalltalk.BlockClosure)})},
  23242. args: ["anIRInstruction"],
  23243. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  23244. messageSends: ["appendBlock:"],
  23245. referencedClasses: []
  23246. }),
  23247. smalltalk.BlockClosure);
  23248. smalltalk.addMethod(
  23249. smalltalk.method({
  23250. selector: "asVariableName",
  23251. category: '*Compiler-IR',
  23252. fn: function (){
  23253. var self=this;
  23254. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23255. return smalltalk.withContext(function($ctx1) {
  23256. var $2,$1;
  23257. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(self);
  23258. if(smalltalk.assert($2)){
  23259. $1=self.__comma("_");
  23260. } else {
  23261. $1=self;
  23262. };
  23263. return $1;
  23264. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
  23265. args: [],
  23266. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  23267. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  23268. referencedClasses: ["Smalltalk"]
  23269. }),
  23270. smalltalk.String);
  23271. smalltalk.addPackage('Compiler-Inlining');
  23272. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  23273. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  23274. smalltalk.addMethod(
  23275. smalltalk.method({
  23276. selector: "accept:",
  23277. category: 'visiting',
  23278. fn: function (aVisitor){
  23279. var self=this;
  23280. return smalltalk.withContext(function($ctx1) {
  23281. var $1;
  23282. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  23283. return $1;
  23284. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedAssignment)})},
  23285. args: ["aVisitor"],
  23286. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  23287. messageSends: ["visitIRInlinedAssignment:"],
  23288. referencedClasses: []
  23289. }),
  23290. smalltalk.IRInlinedAssignment);
  23291. smalltalk.addMethod(
  23292. smalltalk.method({
  23293. selector: "isInlined",
  23294. category: 'testing',
  23295. fn: function (){
  23296. var self=this;
  23297. return smalltalk.withContext(function($ctx1) {
  23298. return true;
  23299. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedAssignment)})},
  23300. args: [],
  23301. source: "isInlined\x0a\x09^ true",
  23302. messageSends: [],
  23303. referencedClasses: []
  23304. }),
  23305. smalltalk.IRInlinedAssignment);
  23306. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  23307. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  23308. smalltalk.addMethod(
  23309. smalltalk.method({
  23310. selector: "accept:",
  23311. category: 'visiting',
  23312. fn: function (aVisitor){
  23313. var self=this;
  23314. return smalltalk.withContext(function($ctx1) {
  23315. _st(aVisitor)._visitIRInlinedClosure_(self);
  23316. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedClosure)})},
  23317. args: ["aVisitor"],
  23318. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  23319. messageSends: ["visitIRInlinedClosure:"],
  23320. referencedClasses: []
  23321. }),
  23322. smalltalk.IRInlinedClosure);
  23323. smalltalk.addMethod(
  23324. smalltalk.method({
  23325. selector: "isInlined",
  23326. category: 'testing',
  23327. fn: function (){
  23328. var self=this;
  23329. return smalltalk.withContext(function($ctx1) {
  23330. return true;
  23331. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedClosure)})},
  23332. args: [],
  23333. source: "isInlined\x0a\x09^ true",
  23334. messageSends: [],
  23335. referencedClasses: []
  23336. }),
  23337. smalltalk.IRInlinedClosure);
  23338. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  23339. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  23340. smalltalk.addMethod(
  23341. smalltalk.method({
  23342. selector: "accept:",
  23343. category: 'visiting',
  23344. fn: function (aVisitor){
  23345. var self=this;
  23346. return smalltalk.withContext(function($ctx1) {
  23347. var $1;
  23348. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  23349. return $1;
  23350. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedReturn)})},
  23351. args: ["aVisitor"],
  23352. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  23353. messageSends: ["visitIRInlinedReturn:"],
  23354. referencedClasses: []
  23355. }),
  23356. smalltalk.IRInlinedReturn);
  23357. smalltalk.addMethod(
  23358. smalltalk.method({
  23359. selector: "isInlined",
  23360. category: 'testing',
  23361. fn: function (){
  23362. var self=this;
  23363. return smalltalk.withContext(function($ctx1) {
  23364. return true;
  23365. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedReturn)})},
  23366. args: [],
  23367. source: "isInlined\x0a\x09^ true",
  23368. messageSends: [],
  23369. referencedClasses: []
  23370. }),
  23371. smalltalk.IRInlinedReturn);
  23372. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  23373. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  23374. smalltalk.addMethod(
  23375. smalltalk.method({
  23376. selector: "accept:",
  23377. category: 'visiting',
  23378. fn: function (aVisitor){
  23379. var self=this;
  23380. return smalltalk.withContext(function($ctx1) {
  23381. _st(aVisitor)._visitInlinedSend_(self);
  23382. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSend)})},
  23383. args: ["aVisitor"],
  23384. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  23385. messageSends: ["visitInlinedSend:"],
  23386. referencedClasses: []
  23387. }),
  23388. smalltalk.IRInlinedSend);
  23389. smalltalk.addMethod(
  23390. smalltalk.method({
  23391. selector: "isInlined",
  23392. category: 'testing',
  23393. fn: function (){
  23394. var self=this;
  23395. return smalltalk.withContext(function($ctx1) {
  23396. return true;
  23397. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSend)})},
  23398. args: [],
  23399. source: "isInlined\x0a\x09^ true",
  23400. messageSends: [],
  23401. referencedClasses: []
  23402. }),
  23403. smalltalk.IRInlinedSend);
  23404. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23405. smalltalk.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  23406. smalltalk.addMethod(
  23407. smalltalk.method({
  23408. selector: "accept:",
  23409. category: 'visiting',
  23410. fn: function (aVisitor){
  23411. var self=this;
  23412. return smalltalk.withContext(function($ctx1) {
  23413. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  23414. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfFalse)})},
  23415. args: ["aVisitor"],
  23416. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  23417. messageSends: ["visitIRInlinedIfFalse:"],
  23418. referencedClasses: []
  23419. }),
  23420. smalltalk.IRInlinedIfFalse);
  23421. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23422. smalltalk.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  23423. smalltalk.addMethod(
  23424. smalltalk.method({
  23425. selector: "accept:",
  23426. category: 'visiting',
  23427. fn: function (aVisitor){
  23428. var self=this;
  23429. return smalltalk.withContext(function($ctx1) {
  23430. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  23431. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfNilIfNotNil)})},
  23432. args: ["aVisitor"],
  23433. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  23434. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  23435. referencedClasses: []
  23436. }),
  23437. smalltalk.IRInlinedIfNilIfNotNil);
  23438. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23439. smalltalk.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  23440. smalltalk.addMethod(
  23441. smalltalk.method({
  23442. selector: "accept:",
  23443. category: 'visiting',
  23444. fn: function (aVisitor){
  23445. var self=this;
  23446. return smalltalk.withContext(function($ctx1) {
  23447. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  23448. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrue)})},
  23449. args: ["aVisitor"],
  23450. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  23451. messageSends: ["visitIRInlinedIfTrue:"],
  23452. referencedClasses: []
  23453. }),
  23454. smalltalk.IRInlinedIfTrue);
  23455. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  23456. smalltalk.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  23457. smalltalk.addMethod(
  23458. smalltalk.method({
  23459. selector: "accept:",
  23460. category: 'visiting',
  23461. fn: function (aVisitor){
  23462. var self=this;
  23463. return smalltalk.withContext(function($ctx1) {
  23464. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  23465. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrueIfFalse)})},
  23466. args: ["aVisitor"],
  23467. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  23468. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  23469. referencedClasses: []
  23470. }),
  23471. smalltalk.IRInlinedIfTrueIfFalse);
  23472. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  23473. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  23474. smalltalk.addMethod(
  23475. smalltalk.method({
  23476. selector: "accept:",
  23477. category: 'visiting',
  23478. fn: function (aVisitor){
  23479. var self=this;
  23480. return smalltalk.withContext(function($ctx1) {
  23481. _st(aVisitor)._visitIRInlinedSequence_(self);
  23482. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSequence)})},
  23483. args: ["aVisitor"],
  23484. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  23485. messageSends: ["visitIRInlinedSequence:"],
  23486. referencedClasses: []
  23487. }),
  23488. smalltalk.IRInlinedSequence);
  23489. smalltalk.addMethod(
  23490. smalltalk.method({
  23491. selector: "isInlined",
  23492. category: 'testing',
  23493. fn: function (){
  23494. var self=this;
  23495. return smalltalk.withContext(function($ctx1) {
  23496. return true;
  23497. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSequence)})},
  23498. args: [],
  23499. source: "isInlined\x0a\x09^ true",
  23500. messageSends: [],
  23501. referencedClasses: []
  23502. }),
  23503. smalltalk.IRInlinedSequence);
  23504. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  23505. smalltalk.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`";
  23506. smalltalk.addMethod(
  23507. smalltalk.method({
  23508. selector: "assignmentInliner",
  23509. category: 'factory',
  23510. fn: function (){
  23511. var self=this;
  23512. function $IRAssignmentInliner(){return smalltalk.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  23513. return smalltalk.withContext(function($ctx1) {
  23514. var $2,$3,$1;
  23515. $2=_st($IRAssignmentInliner())._new();
  23516. _st($2)._translator_(self);
  23517. $3=_st($2)._yourself();
  23518. $1=$3;
  23519. return $1;
  23520. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},smalltalk.IRInliner)})},
  23521. args: [],
  23522. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23523. messageSends: ["translator:", "new", "yourself"],
  23524. referencedClasses: ["IRAssignmentInliner"]
  23525. }),
  23526. smalltalk.IRInliner);
  23527. smalltalk.addMethod(
  23528. smalltalk.method({
  23529. selector: "returnInliner",
  23530. category: 'factory',
  23531. fn: function (){
  23532. var self=this;
  23533. function $IRReturnInliner(){return smalltalk.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  23534. return smalltalk.withContext(function($ctx1) {
  23535. var $2,$3,$1;
  23536. $2=_st($IRReturnInliner())._new();
  23537. _st($2)._translator_(self);
  23538. $3=_st($2)._yourself();
  23539. $1=$3;
  23540. return $1;
  23541. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},smalltalk.IRInliner)})},
  23542. args: [],
  23543. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23544. messageSends: ["translator:", "new", "yourself"],
  23545. referencedClasses: ["IRReturnInliner"]
  23546. }),
  23547. smalltalk.IRInliner);
  23548. smalltalk.addMethod(
  23549. smalltalk.method({
  23550. selector: "sendInliner",
  23551. category: 'factory',
  23552. fn: function (){
  23553. var self=this;
  23554. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  23555. return smalltalk.withContext(function($ctx1) {
  23556. var $2,$3,$1;
  23557. $2=_st($IRSendInliner())._new();
  23558. _st($2)._translator_(self);
  23559. $3=_st($2)._yourself();
  23560. $1=$3;
  23561. return $1;
  23562. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},smalltalk.IRInliner)})},
  23563. args: [],
  23564. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  23565. messageSends: ["translator:", "new", "yourself"],
  23566. referencedClasses: ["IRSendInliner"]
  23567. }),
  23568. smalltalk.IRInliner);
  23569. smalltalk.addMethod(
  23570. smalltalk.method({
  23571. selector: "shouldInlineAssignment:",
  23572. category: 'testing',
  23573. fn: function (anIRAssignment){
  23574. var self=this;
  23575. return smalltalk.withContext(function($ctx1) {
  23576. var $1;
  23577. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  23578. return smalltalk.withContext(function($ctx2) {
  23579. return _st(_st(_st(_st(anIRAssignment)._instructions())._last())._isSend())._and_((function(){
  23580. return smalltalk.withContext(function($ctx3) {
  23581. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  23582. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  23583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23584. return $1;
  23585. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  23586. args: ["anIRAssignment"],
  23587. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  23588. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
  23589. referencedClasses: []
  23590. }),
  23591. smalltalk.IRInliner);
  23592. smalltalk.addMethod(
  23593. smalltalk.method({
  23594. selector: "shouldInlineReturn:",
  23595. category: 'testing',
  23596. fn: function (anIRReturn){
  23597. var self=this;
  23598. return smalltalk.withContext(function($ctx1) {
  23599. var $1;
  23600. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  23601. return smalltalk.withContext(function($ctx2) {
  23602. return _st(_st(_st(_st(anIRReturn)._instructions())._first())._isSend())._and_((function(){
  23603. return smalltalk.withContext(function($ctx3) {
  23604. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  23605. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  23606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23607. return $1;
  23608. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  23609. args: ["anIRReturn"],
  23610. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  23611. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
  23612. referencedClasses: []
  23613. }),
  23614. smalltalk.IRInliner);
  23615. smalltalk.addMethod(
  23616. smalltalk.method({
  23617. selector: "shouldInlineSend:",
  23618. category: 'testing',
  23619. fn: function (anIRSend){
  23620. var self=this;
  23621. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  23622. return smalltalk.withContext(function($ctx1) {
  23623. var $1;
  23624. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  23625. return smalltalk.withContext(function($ctx2) {
  23626. return _st($IRSendInliner())._shouldInline_(anIRSend);
  23627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23628. return $1;
  23629. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  23630. args: ["anIRSend"],
  23631. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  23632. messageSends: ["and:", "shouldInline:", "not", "isInlined"],
  23633. referencedClasses: ["IRSendInliner"]
  23634. }),
  23635. smalltalk.IRInliner);
  23636. smalltalk.addMethod(
  23637. smalltalk.method({
  23638. selector: "transformNonLocalReturn:",
  23639. category: 'visiting',
  23640. fn: function (anIRNonLocalReturn){
  23641. var self=this;
  23642. var localReturn;
  23643. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  23644. return smalltalk.withContext(function($ctx1) {
  23645. var $1,$2,$3,$4,$5;
  23646. $1=_st(_st(anIRNonLocalReturn)._scope())._canInlineNonLocalReturns();
  23647. if(smalltalk.assert($1)){
  23648. _st(_st(_st(anIRNonLocalReturn)._scope())._methodScope())._removeNonLocalReturn_(_st(anIRNonLocalReturn)._scope());
  23649. $2=_st($IRReturn())._new();
  23650. _st($2)._scope_(_st(anIRNonLocalReturn)._scope());
  23651. $3=_st($2)._yourself();
  23652. localReturn=$3;
  23653. localReturn;
  23654. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  23655. return smalltalk.withContext(function($ctx2) {
  23656. return _st(localReturn)._add_(each);
  23657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23658. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  23659. $4=localReturn;
  23660. return $4;
  23661. };
  23662. $5=smalltalk.IRVisitor.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  23663. return $5;
  23664. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},smalltalk.IRInliner)})},
  23665. args: ["anIRNonLocalReturn"],
  23666. 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",
  23667. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
  23668. referencedClasses: ["IRReturn"]
  23669. }),
  23670. smalltalk.IRInliner);
  23671. smalltalk.addMethod(
  23672. smalltalk.method({
  23673. selector: "visitIRAssignment:",
  23674. category: 'visiting',
  23675. fn: function (anIRAssignment){
  23676. var self=this;
  23677. return smalltalk.withContext(function($ctx1) {
  23678. var $2,$1;
  23679. $2=self._shouldInlineAssignment_(anIRAssignment);
  23680. if(smalltalk.assert($2)){
  23681. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  23682. } else {
  23683. $1=smalltalk.IRVisitor.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]);
  23684. };
  23685. return $1;
  23686. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  23687. args: ["anIRAssignment"],
  23688. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  23689. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
  23690. referencedClasses: []
  23691. }),
  23692. smalltalk.IRInliner);
  23693. smalltalk.addMethod(
  23694. smalltalk.method({
  23695. selector: "visitIRNonLocalReturn:",
  23696. category: 'visiting',
  23697. fn: function (anIRNonLocalReturn){
  23698. var self=this;
  23699. return smalltalk.withContext(function($ctx1) {
  23700. var $1;
  23701. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  23702. return $1;
  23703. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRInliner)})},
  23704. args: ["anIRNonLocalReturn"],
  23705. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  23706. messageSends: ["transformNonLocalReturn:"],
  23707. referencedClasses: []
  23708. }),
  23709. smalltalk.IRInliner);
  23710. smalltalk.addMethod(
  23711. smalltalk.method({
  23712. selector: "visitIRReturn:",
  23713. category: 'visiting',
  23714. fn: function (anIRReturn){
  23715. var self=this;
  23716. return smalltalk.withContext(function($ctx1) {
  23717. var $2,$1;
  23718. $2=self._shouldInlineReturn_(anIRReturn);
  23719. if(smalltalk.assert($2)){
  23720. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  23721. } else {
  23722. $1=smalltalk.IRVisitor.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  23723. };
  23724. return $1;
  23725. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  23726. args: ["anIRReturn"],
  23727. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  23728. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
  23729. referencedClasses: []
  23730. }),
  23731. smalltalk.IRInliner);
  23732. smalltalk.addMethod(
  23733. smalltalk.method({
  23734. selector: "visitIRSend:",
  23735. category: 'visiting',
  23736. fn: function (anIRSend){
  23737. var self=this;
  23738. return smalltalk.withContext(function($ctx1) {
  23739. var $2,$1;
  23740. $2=self._shouldInlineSend_(anIRSend);
  23741. if(smalltalk.assert($2)){
  23742. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  23743. } else {
  23744. $1=smalltalk.IRVisitor.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]);
  23745. };
  23746. return $1;
  23747. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  23748. args: ["anIRSend"],
  23749. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  23750. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
  23751. referencedClasses: []
  23752. }),
  23753. smalltalk.IRInliner);
  23754. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  23755. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  23756. smalltalk.addMethod(
  23757. smalltalk.method({
  23758. selector: "visitIRInlinedAssignment:",
  23759. category: 'visiting',
  23760. fn: function (anIRInlinedAssignment){
  23761. var self=this;
  23762. return smalltalk.withContext(function($ctx1) {
  23763. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  23764. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},smalltalk.IRInliningJSTranslator)})},
  23765. args: ["anIRInlinedAssignment"],
  23766. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  23767. messageSends: ["visit:", "last", "instructions"],
  23768. referencedClasses: []
  23769. }),
  23770. smalltalk.IRInliningJSTranslator);
  23771. smalltalk.addMethod(
  23772. smalltalk.method({
  23773. selector: "visitIRInlinedClosure:",
  23774. category: 'visiting',
  23775. fn: function (anIRInlinedClosure){
  23776. var self=this;
  23777. return smalltalk.withContext(function($ctx1) {
  23778. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  23779. return smalltalk.withContext(function($ctx2) {
  23780. return _st(_st(each)._name())._asVariableName();
  23781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  23782. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  23783. return smalltalk.withContext(function($ctx2) {
  23784. return self._visit_(each);
  23785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23786. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRInliningJSTranslator)})},
  23787. args: ["anIRInlinedClosure"],
  23788. 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 ]",
  23789. messageSends: ["nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "do:", "visit:", "instructions"],
  23790. referencedClasses: []
  23791. }),
  23792. smalltalk.IRInliningJSTranslator);
  23793. smalltalk.addMethod(
  23794. smalltalk.method({
  23795. selector: "visitIRInlinedIfFalse:",
  23796. category: 'visiting',
  23797. fn: function (anIRInlinedIfFalse){
  23798. var self=this;
  23799. return smalltalk.withContext(function($ctx1) {
  23800. _st(self._stream())._nextPutIf_with_((function(){
  23801. return smalltalk.withContext(function($ctx2) {
  23802. _st(self._stream())._nextPutAll_("! smalltalk.assert(");
  23803. self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first());
  23804. return _st(self._stream())._nextPutAll_(")");
  23805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23806. return smalltalk.withContext(function($ctx2) {
  23807. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  23808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23809. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},smalltalk.IRInliningJSTranslator)})},
  23810. args: ["anIRInlinedIfFalse"],
  23811. 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 ]",
  23812. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23813. referencedClasses: []
  23814. }),
  23815. smalltalk.IRInliningJSTranslator);
  23816. smalltalk.addMethod(
  23817. smalltalk.method({
  23818. selector: "visitIRInlinedIfNil:",
  23819. category: 'visiting',
  23820. fn: function (anIRInlinedIfNil){
  23821. var self=this;
  23822. return smalltalk.withContext(function($ctx1) {
  23823. _st(self._stream())._nextPutIf_with_((function(){
  23824. return smalltalk.withContext(function($ctx2) {
  23825. _st(self._stream())._nextPutAll_("($receiver = ");
  23826. self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first());
  23827. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  23828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23829. return smalltalk.withContext(function($ctx2) {
  23830. return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  23831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23832. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},smalltalk.IRInliningJSTranslator)})},
  23833. args: ["anIRInlinedIfNil"],
  23834. 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 == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
  23835. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23836. referencedClasses: []
  23837. }),
  23838. smalltalk.IRInliningJSTranslator);
  23839. smalltalk.addMethod(
  23840. smalltalk.method({
  23841. selector: "visitIRInlinedIfNilIfNotNil:",
  23842. category: 'visiting',
  23843. fn: function (anIRInlinedIfNilIfNotNil){
  23844. var self=this;
  23845. return smalltalk.withContext(function($ctx1) {
  23846. _st(self._stream())._nextPutIfElse_with_with_((function(){
  23847. return smalltalk.withContext(function($ctx2) {
  23848. _st(self._stream())._nextPutAll_("($receiver = ");
  23849. self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first());
  23850. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  23851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23852. return smalltalk.withContext(function($ctx2) {
  23853. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second());
  23854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23855. return smalltalk.withContext(function($ctx2) {
  23856. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  23857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23858. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},smalltalk.IRInliningJSTranslator)})},
  23859. args: ["anIRInlinedIfNilIfNotNil"],
  23860. 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 == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  23861. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  23862. referencedClasses: []
  23863. }),
  23864. smalltalk.IRInliningJSTranslator);
  23865. smalltalk.addMethod(
  23866. smalltalk.method({
  23867. selector: "visitIRInlinedIfTrue:",
  23868. category: 'visiting',
  23869. fn: function (anIRInlinedIfTrue){
  23870. var self=this;
  23871. return smalltalk.withContext(function($ctx1) {
  23872. _st(self._stream())._nextPutIf_with_((function(){
  23873. return smalltalk.withContext(function($ctx2) {
  23874. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  23875. self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first());
  23876. return _st(self._stream())._nextPutAll_(")");
  23877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23878. return smalltalk.withContext(function($ctx2) {
  23879. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  23880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23881. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},smalltalk.IRInliningJSTranslator)})},
  23882. args: ["anIRInlinedIfTrue"],
  23883. 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 ]",
  23884. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  23885. referencedClasses: []
  23886. }),
  23887. smalltalk.IRInliningJSTranslator);
  23888. smalltalk.addMethod(
  23889. smalltalk.method({
  23890. selector: "visitIRInlinedIfTrueIfFalse:",
  23891. category: 'visiting',
  23892. fn: function (anIRInlinedIfTrueIfFalse){
  23893. var self=this;
  23894. return smalltalk.withContext(function($ctx1) {
  23895. _st(self._stream())._nextPutIfElse_with_with_((function(){
  23896. return smalltalk.withContext(function($ctx2) {
  23897. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  23898. self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first());
  23899. return _st(self._stream())._nextPutAll_(")");
  23900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23901. return smalltalk.withContext(function($ctx2) {
  23902. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second());
  23903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  23904. return smalltalk.withContext(function($ctx2) {
  23905. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  23906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23907. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},smalltalk.IRInliningJSTranslator)})},
  23908. args: ["anIRInlinedIfTrueIfFalse"],
  23909. 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 ]",
  23910. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  23911. referencedClasses: []
  23912. }),
  23913. smalltalk.IRInliningJSTranslator);
  23914. smalltalk.addMethod(
  23915. smalltalk.method({
  23916. selector: "visitIRInlinedNonLocalReturn:",
  23917. category: 'visiting',
  23918. fn: function (anIRInlinedReturn){
  23919. var self=this;
  23920. return smalltalk.withContext(function($ctx1) {
  23921. _st(self._stream())._nextPutStatementWith_((function(){
  23922. return smalltalk.withContext(function($ctx2) {
  23923. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  23924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23925. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  23926. return smalltalk.withContext(function($ctx2) {
  23927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  23928. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  23929. args: ["anIRInlinedReturn"],
  23930. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  23931. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
  23932. referencedClasses: []
  23933. }),
  23934. smalltalk.IRInliningJSTranslator);
  23935. smalltalk.addMethod(
  23936. smalltalk.method({
  23937. selector: "visitIRInlinedReturn:",
  23938. category: 'visiting',
  23939. fn: function (anIRInlinedReturn){
  23940. var self=this;
  23941. return smalltalk.withContext(function($ctx1) {
  23942. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  23943. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  23944. args: ["anIRInlinedReturn"],
  23945. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  23946. messageSends: ["visit:", "last", "instructions"],
  23947. referencedClasses: []
  23948. }),
  23949. smalltalk.IRInliningJSTranslator);
  23950. smalltalk.addMethod(
  23951. smalltalk.method({
  23952. selector: "visitIRInlinedSequence:",
  23953. category: 'visiting',
  23954. fn: function (anIRInlinedSequence){
  23955. var self=this;
  23956. return smalltalk.withContext(function($ctx1) {
  23957. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  23958. return smalltalk.withContext(function($ctx2) {
  23959. return _st(self._stream())._nextPutStatementWith_((function(){
  23960. return smalltalk.withContext(function($ctx3) {
  23961. return self._visit_(each);
  23962. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  23963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  23964. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRInliningJSTranslator)})},
  23965. args: ["anIRInlinedSequence"],
  23966. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  23967. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  23968. referencedClasses: []
  23969. }),
  23970. smalltalk.IRInliningJSTranslator);
  23971. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  23972. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  23973. smalltalk.addMethod(
  23974. smalltalk.method({
  23975. selector: "ifFalse:",
  23976. category: 'inlining',
  23977. fn: function (anIRInstruction){
  23978. var self=this;
  23979. function $IRInlinedIfFalse(){return smalltalk.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  23980. return smalltalk.withContext(function($ctx1) {
  23981. var $1;
  23982. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  23983. return $1;
  23984. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  23985. args: ["anIRInstruction"],
  23986. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  23987. messageSends: ["inlinedSend:with:", "new"],
  23988. referencedClasses: ["IRInlinedIfFalse"]
  23989. }),
  23990. smalltalk.IRSendInliner);
  23991. smalltalk.addMethod(
  23992. smalltalk.method({
  23993. selector: "ifFalse:ifTrue:",
  23994. category: 'inlining',
  23995. fn: function (anIRInstruction,anotherIRInstruction){
  23996. var self=this;
  23997. return smalltalk.withContext(function($ctx1) {
  23998. var $1;
  23999. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  24000. return $1;
  24001. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24002. args: ["anIRInstruction", "anotherIRInstruction"],
  24003. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  24004. messageSends: ["perform:withArguments:"],
  24005. referencedClasses: []
  24006. }),
  24007. smalltalk.IRSendInliner);
  24008. smalltalk.addMethod(
  24009. smalltalk.method({
  24010. selector: "ifNil:",
  24011. category: 'inlining',
  24012. fn: function (anIRInstruction){
  24013. var self=this;
  24014. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24015. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  24016. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  24017. return smalltalk.withContext(function($ctx1) {
  24018. var $2,$3,$4,$5,$1;
  24019. $2=_st($IRClosure())._new();
  24020. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  24021. $3=_st($IRBlockSequence())._new();
  24022. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24023. $4=_st($3)._yourself();
  24024. _st($2)._add_($4);
  24025. $5=_st($2)._yourself();
  24026. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,$5);
  24027. return $1;
  24028. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24029. args: ["anIRInstruction"],
  24030. 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)",
  24031. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  24032. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  24033. }),
  24034. smalltalk.IRSendInliner);
  24035. smalltalk.addMethod(
  24036. smalltalk.method({
  24037. selector: "ifNil:ifNotNil:",
  24038. category: 'inlining',
  24039. fn: function (anIRInstruction,anotherIRInstruction){
  24040. var self=this;
  24041. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24042. return smalltalk.withContext(function($ctx1) {
  24043. var $1;
  24044. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  24045. return $1;
  24046. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24047. args: ["anIRInstruction", "anotherIRInstruction"],
  24048. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  24049. messageSends: ["inlinedSend:with:with:", "new"],
  24050. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  24051. }),
  24052. smalltalk.IRSendInliner);
  24053. smalltalk.addMethod(
  24054. smalltalk.method({
  24055. selector: "ifNotNil:",
  24056. category: 'inlining',
  24057. fn: function (anIRInstruction){
  24058. var self=this;
  24059. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24060. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  24061. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  24062. return smalltalk.withContext(function($ctx1) {
  24063. var $2,$3,$4,$5,$1;
  24064. $2=_st($IRClosure())._new();
  24065. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  24066. $3=_st($IRBlockSequence())._new();
  24067. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24068. $4=_st($3)._yourself();
  24069. _st($2)._add_($4);
  24070. $5=_st($2)._yourself();
  24071. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),$5,anIRInstruction);
  24072. return $1;
  24073. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24074. args: ["anIRInstruction"],
  24075. 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",
  24076. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  24077. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  24078. }),
  24079. smalltalk.IRSendInliner);
  24080. smalltalk.addMethod(
  24081. smalltalk.method({
  24082. selector: "ifNotNil:ifNil:",
  24083. category: 'inlining',
  24084. fn: function (anIRInstruction,anotherIRInstruction){
  24085. var self=this;
  24086. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  24087. return smalltalk.withContext(function($ctx1) {
  24088. var $1;
  24089. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  24090. return $1;
  24091. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24092. args: ["anIRInstruction", "anotherIRInstruction"],
  24093. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  24094. messageSends: ["inlinedSend:with:with:", "new"],
  24095. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  24096. }),
  24097. smalltalk.IRSendInliner);
  24098. smalltalk.addMethod(
  24099. smalltalk.method({
  24100. selector: "ifTrue:",
  24101. category: 'inlining',
  24102. fn: function (anIRInstruction){
  24103. var self=this;
  24104. function $IRInlinedIfTrue(){return smalltalk.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  24105. return smalltalk.withContext(function($ctx1) {
  24106. var $1;
  24107. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  24108. return $1;
  24109. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  24110. args: ["anIRInstruction"],
  24111. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  24112. messageSends: ["inlinedSend:with:", "new"],
  24113. referencedClasses: ["IRInlinedIfTrue"]
  24114. }),
  24115. smalltalk.IRSendInliner);
  24116. smalltalk.addMethod(
  24117. smalltalk.method({
  24118. selector: "ifTrue:ifFalse:",
  24119. category: 'inlining',
  24120. fn: function (anIRInstruction,anotherIRInstruction){
  24121. var self=this;
  24122. function $IRInlinedIfTrueIfFalse(){return smalltalk.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  24123. return smalltalk.withContext(function($ctx1) {
  24124. var $1;
  24125. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  24126. return $1;
  24127. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  24128. args: ["anIRInstruction", "anotherIRInstruction"],
  24129. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  24130. messageSends: ["inlinedSend:with:with:", "new"],
  24131. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  24132. }),
  24133. smalltalk.IRSendInliner);
  24134. smalltalk.addMethod(
  24135. smalltalk.method({
  24136. selector: "inlineClosure:",
  24137. category: 'inlining',
  24138. fn: function (anIRClosure){
  24139. var self=this;
  24140. var inlinedClosure,sequence,statements;
  24141. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  24142. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  24143. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  24144. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24145. return smalltalk.withContext(function($ctx1) {
  24146. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  24147. inlinedClosure=self._inlinedClosure();
  24148. _st(inlinedClosure)._scope_(_st(anIRClosure)._scope());
  24149. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  24150. return smalltalk.withContext(function($ctx2) {
  24151. return _st(inlinedClosure)._add_(each);
  24152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24153. sequence=self._inlinedSequence();
  24154. _st(_st(anIRClosure)._arguments())._do_((function(each){
  24155. return smalltalk.withContext(function($ctx2) {
  24156. $1=_st($IRTempDeclaration())._new();
  24157. _st($1)._name_(each);
  24158. $2=_st($1)._yourself();
  24159. _st(inlinedClosure)._add_($2);
  24160. $3=_st($IRAssignment())._new();
  24161. $4=_st($AliasVar())._new();
  24162. _st($4)._scope_(_st(inlinedClosure)._scope());
  24163. _st($4)._name_(each);
  24164. $5=_st($4)._yourself();
  24165. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($5));
  24166. $6=_st($AliasVar())._new();
  24167. _st($6)._scope_(_st(inlinedClosure)._scope());
  24168. _st($6)._name_("$receiver");
  24169. $7=_st($6)._yourself();
  24170. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($7));
  24171. $8=_st($3)._yourself();
  24172. return _st(sequence)._add_($8);
  24173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24174. _st(inlinedClosure)._add_(sequence);
  24175. statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions();
  24176. _st(statements)._ifNotEmpty_((function(){
  24177. return smalltalk.withContext(function($ctx2) {
  24178. _st(_st(statements)._allButLast())._do_((function(each){
  24179. return smalltalk.withContext(function($ctx3) {
  24180. return _st(sequence)._add_(each);
  24181. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  24182. $9=_st(_st(_st(statements)._last())._isReturn())._and_((function(){
  24183. return smalltalk.withContext(function($ctx3) {
  24184. return _st(_st(statements)._last())._isBlockReturn();
  24185. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  24186. if(smalltalk.assert($9)){
  24187. return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first());
  24188. } else {
  24189. return _st(sequence)._add_(_st(statements)._last());
  24190. };
  24191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24192. $10=inlinedClosure;
  24193. return $10;
  24194. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},smalltalk.IRSendInliner)})},
  24195. args: ["anIRClosure"],
  24196. 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",
  24197. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "add:", "tempDeclarations", "inlinedSequence", "name:", "new", "yourself", "variable:", "arguments", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"],
  24198. referencedClasses: ["IRTempDeclaration", "AliasVar", "IRVariable", "IRAssignment"]
  24199. }),
  24200. smalltalk.IRSendInliner);
  24201. smalltalk.addMethod(
  24202. smalltalk.method({
  24203. selector: "inlineSend:",
  24204. category: 'inlining',
  24205. fn: function (anIRSend){
  24206. var self=this;
  24207. return smalltalk.withContext(function($ctx1) {
  24208. var $1;
  24209. self._send_(anIRSend);
  24210. $1=self._perform_withArguments_(_st(self._send())._selector(),_st(_st(self._send())._instructions())._allButFirst());
  24211. return $1;
  24212. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  24213. args: ["anIRSend"],
  24214. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  24215. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  24216. referencedClasses: []
  24217. }),
  24218. smalltalk.IRSendInliner);
  24219. smalltalk.addMethod(
  24220. smalltalk.method({
  24221. selector: "inlinedClosure",
  24222. category: 'factory',
  24223. fn: function (){
  24224. var self=this;
  24225. function $IRInlinedClosure(){return smalltalk.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  24226. return smalltalk.withContext(function($ctx1) {
  24227. var $1;
  24228. $1=_st($IRInlinedClosure())._new();
  24229. return $1;
  24230. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},smalltalk.IRSendInliner)})},
  24231. args: [],
  24232. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  24233. messageSends: ["new"],
  24234. referencedClasses: ["IRInlinedClosure"]
  24235. }),
  24236. smalltalk.IRSendInliner);
  24237. smalltalk.addMethod(
  24238. smalltalk.method({
  24239. selector: "inlinedSend:with:",
  24240. category: 'inlining',
  24241. fn: function (inlinedSend,anIRInstruction){
  24242. var self=this;
  24243. var inlinedClosure;
  24244. return smalltalk.withContext(function($ctx1) {
  24245. var $1,$2,$3,$4,$5;
  24246. $1=_st(anIRInstruction)._isClosure();
  24247. if(! smalltalk.assert($1)){
  24248. self._inliningError_("Message argument should be a block");
  24249. };
  24250. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  24251. if(! smalltalk.assert($2)){
  24252. self._inliningError_("Inlined block should have zero argument");
  24253. };
  24254. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  24255. $3=inlinedSend;
  24256. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24257. $4=_st($3)._add_(inlinedClosure);
  24258. _st(self._send())._replaceWith_(inlinedSend);
  24259. $5=inlinedSend;
  24260. return $5;
  24261. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},smalltalk.IRSendInliner)})},
  24262. args: ["inlinedSend", "anIRInstruction"],
  24263. 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",
  24264. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  24265. referencedClasses: []
  24266. }),
  24267. smalltalk.IRSendInliner);
  24268. smalltalk.addMethod(
  24269. smalltalk.method({
  24270. selector: "inlinedSend:with:with:",
  24271. category: 'inlining',
  24272. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  24273. var self=this;
  24274. var inlinedClosure1,inlinedClosure2;
  24275. return smalltalk.withContext(function($ctx1) {
  24276. var $1,$2,$3,$4,$5;
  24277. $1=_st(anIRInstruction)._isClosure();
  24278. if(! smalltalk.assert($1)){
  24279. self._inliningError_("Message argument should be a block");
  24280. };
  24281. $2=_st(anotherIRInstruction)._isClosure();
  24282. if(! smalltalk.assert($2)){
  24283. self._inliningError_("Message argument should be a block");
  24284. };
  24285. inlinedClosure1=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  24286. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  24287. $3=inlinedSend;
  24288. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  24289. _st($3)._add_(inlinedClosure1);
  24290. $4=_st($3)._add_(inlinedClosure2);
  24291. _st(self._send())._replaceWith_(inlinedSend);
  24292. $5=inlinedSend;
  24293. return $5;
  24294. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},smalltalk.IRSendInliner)})},
  24295. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  24296. 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",
  24297. messageSends: ["ifFalse:", "inliningError:", "isClosure", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  24298. referencedClasses: []
  24299. }),
  24300. smalltalk.IRSendInliner);
  24301. smalltalk.addMethod(
  24302. smalltalk.method({
  24303. selector: "inlinedSequence",
  24304. category: 'factory',
  24305. fn: function (){
  24306. var self=this;
  24307. function $IRInlinedSequence(){return smalltalk.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  24308. return smalltalk.withContext(function($ctx1) {
  24309. var $1;
  24310. $1=_st($IRInlinedSequence())._new();
  24311. return $1;
  24312. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},smalltalk.IRSendInliner)})},
  24313. args: [],
  24314. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  24315. messageSends: ["new"],
  24316. referencedClasses: ["IRInlinedSequence"]
  24317. }),
  24318. smalltalk.IRSendInliner);
  24319. smalltalk.addMethod(
  24320. smalltalk.method({
  24321. selector: "inliningError:",
  24322. category: 'error handling',
  24323. fn: function (aString){
  24324. var self=this;
  24325. function $InliningError(){return smalltalk.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  24326. return smalltalk.withContext(function($ctx1) {
  24327. _st($InliningError())._signal_(aString);
  24328. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},smalltalk.IRSendInliner)})},
  24329. args: ["aString"],
  24330. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  24331. messageSends: ["signal:"],
  24332. referencedClasses: ["InliningError"]
  24333. }),
  24334. smalltalk.IRSendInliner);
  24335. smalltalk.addMethod(
  24336. smalltalk.method({
  24337. selector: "send",
  24338. category: 'accessing',
  24339. fn: function (){
  24340. var self=this;
  24341. return smalltalk.withContext(function($ctx1) {
  24342. var $1;
  24343. $1=self["@send"];
  24344. return $1;
  24345. }, function($ctx1) {$ctx1.fill(self,"send",{},smalltalk.IRSendInliner)})},
  24346. args: [],
  24347. source: "send\x0a\x09^ send",
  24348. messageSends: [],
  24349. referencedClasses: []
  24350. }),
  24351. smalltalk.IRSendInliner);
  24352. smalltalk.addMethod(
  24353. smalltalk.method({
  24354. selector: "send:",
  24355. category: 'accessing',
  24356. fn: function (anIRSend){
  24357. var self=this;
  24358. return smalltalk.withContext(function($ctx1) {
  24359. self["@send"]=anIRSend;
  24360. return self}, function($ctx1) {$ctx1.fill(self,"send:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  24361. args: ["anIRSend"],
  24362. source: "send: anIRSend\x0a\x09send := anIRSend",
  24363. messageSends: [],
  24364. referencedClasses: []
  24365. }),
  24366. smalltalk.IRSendInliner);
  24367. smalltalk.addMethod(
  24368. smalltalk.method({
  24369. selector: "translator",
  24370. category: 'accessing',
  24371. fn: function (){
  24372. var self=this;
  24373. return smalltalk.withContext(function($ctx1) {
  24374. var $1;
  24375. $1=self["@translator"];
  24376. return $1;
  24377. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.IRSendInliner)})},
  24378. args: [],
  24379. source: "translator\x0a\x09^ translator",
  24380. messageSends: [],
  24381. referencedClasses: []
  24382. }),
  24383. smalltalk.IRSendInliner);
  24384. smalltalk.addMethod(
  24385. smalltalk.method({
  24386. selector: "translator:",
  24387. category: 'accessing',
  24388. fn: function (anASTTranslator){
  24389. var self=this;
  24390. return smalltalk.withContext(function($ctx1) {
  24391. self["@translator"]=anASTTranslator;
  24392. return self}, function($ctx1) {$ctx1.fill(self,"translator:",{anASTTranslator:anASTTranslator},smalltalk.IRSendInliner)})},
  24393. args: ["anASTTranslator"],
  24394. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  24395. messageSends: [],
  24396. referencedClasses: []
  24397. }),
  24398. smalltalk.IRSendInliner);
  24399. smalltalk.addMethod(
  24400. smalltalk.method({
  24401. selector: "inlinedSelectors",
  24402. category: 'accessing',
  24403. fn: function (){
  24404. var self=this;
  24405. return smalltalk.withContext(function($ctx1) {
  24406. var $1;
  24407. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  24408. return $1;
  24409. }, function($ctx1) {$ctx1.fill(self,"inlinedSelectors",{},smalltalk.IRSendInliner.klass)})},
  24410. args: [],
  24411. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  24412. messageSends: [],
  24413. referencedClasses: []
  24414. }),
  24415. smalltalk.IRSendInliner.klass);
  24416. smalltalk.addMethod(
  24417. smalltalk.method({
  24418. selector: "shouldInline:",
  24419. category: 'accessing',
  24420. fn: function (anIRInstruction){
  24421. var self=this;
  24422. return smalltalk.withContext(function($ctx1) {
  24423. var $1,$2;
  24424. var $early={};
  24425. try {
  24426. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  24427. if(! smalltalk.assert($1)){
  24428. return false;
  24429. };
  24430. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  24431. return smalltalk.withContext(function($ctx2) {
  24432. $2=_st(each)._isClosure();
  24433. if(! smalltalk.assert($2)){
  24434. throw $early=[false];
  24435. };
  24436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24437. return true;
  24438. }
  24439. catch(e) {if(e===$early)return e[0]; throw e}
  24440. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner.klass)})},
  24441. args: ["anIRInstruction"],
  24442. 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",
  24443. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
  24444. referencedClasses: []
  24445. }),
  24446. smalltalk.IRSendInliner.klass);
  24447. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  24448. smalltalk.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};";
  24449. smalltalk.addMethod(
  24450. smalltalk.method({
  24451. selector: "assignment",
  24452. category: 'accessing',
  24453. fn: function (){
  24454. var self=this;
  24455. return smalltalk.withContext(function($ctx1) {
  24456. var $1;
  24457. $1=self["@assignment"];
  24458. return $1;
  24459. }, function($ctx1) {$ctx1.fill(self,"assignment",{},smalltalk.IRAssignmentInliner)})},
  24460. args: [],
  24461. source: "assignment\x0a\x09^ assignment",
  24462. messageSends: [],
  24463. referencedClasses: []
  24464. }),
  24465. smalltalk.IRAssignmentInliner);
  24466. smalltalk.addMethod(
  24467. smalltalk.method({
  24468. selector: "assignment:",
  24469. category: 'accessing',
  24470. fn: function (aNode){
  24471. var self=this;
  24472. return smalltalk.withContext(function($ctx1) {
  24473. self["@assignment"]=aNode;
  24474. return self}, function($ctx1) {$ctx1.fill(self,"assignment:",{aNode:aNode},smalltalk.IRAssignmentInliner)})},
  24475. args: ["aNode"],
  24476. source: "assignment: aNode\x0a\x09assignment := aNode",
  24477. messageSends: [],
  24478. referencedClasses: []
  24479. }),
  24480. smalltalk.IRAssignmentInliner);
  24481. smalltalk.addMethod(
  24482. smalltalk.method({
  24483. selector: "inlineAssignment:",
  24484. category: 'inlining',
  24485. fn: function (anIRAssignment){
  24486. var self=this;
  24487. var inlinedAssignment;
  24488. function $IRInlinedAssignment(){return smalltalk.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  24489. return smalltalk.withContext(function($ctx1) {
  24490. var $1;
  24491. self._assignment_(anIRAssignment);
  24492. inlinedAssignment=_st($IRInlinedAssignment())._new();
  24493. _st(_st(anIRAssignment)._instructions())._do_((function(each){
  24494. return smalltalk.withContext(function($ctx2) {
  24495. return _st(inlinedAssignment)._add_(each);
  24496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24497. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  24498. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  24499. $1=inlinedAssignment;
  24500. return $1;
  24501. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},smalltalk.IRAssignmentInliner)})},
  24502. args: ["anIRAssignment"],
  24503. 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",
  24504. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  24505. referencedClasses: ["IRInlinedAssignment"]
  24506. }),
  24507. smalltalk.IRAssignmentInliner);
  24508. smalltalk.addMethod(
  24509. smalltalk.method({
  24510. selector: "inlineClosure:",
  24511. category: 'inlining',
  24512. fn: function (anIRClosure){
  24513. var self=this;
  24514. var inlinedClosure,statements;
  24515. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24516. return smalltalk.withContext(function($ctx1) {
  24517. var $1,$2,$3,$4;
  24518. inlinedClosure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  24519. statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions();
  24520. _st(statements)._ifNotEmpty_((function(){
  24521. return smalltalk.withContext(function($ctx2) {
  24522. $1=_st(_st(statements)._last())._canBeAssigned();
  24523. if(smalltalk.assert($1)){
  24524. $2=_st($IRAssignment())._new();
  24525. _st($2)._add_(_st(_st(self._assignment())._instructions())._first());
  24526. _st($2)._add_(_st(_st(statements)._last())._copy());
  24527. $3=_st($2)._yourself();
  24528. return _st(_st(statements)._last())._replaceWith_($3);
  24529. };
  24530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24531. $4=inlinedClosure;
  24532. return $4;
  24533. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},smalltalk.IRAssignmentInliner)})},
  24534. args: ["anIRClosure"],
  24535. 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",
  24536. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"],
  24537. referencedClasses: ["IRAssignment"]
  24538. }),
  24539. smalltalk.IRAssignmentInliner);
  24540. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  24541. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  24542. smalltalk.addMethod(
  24543. smalltalk.method({
  24544. selector: "inlineClosure:",
  24545. category: 'inlining',
  24546. fn: function (anIRClosure){
  24547. var self=this;
  24548. var closure,statements;
  24549. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  24550. return smalltalk.withContext(function($ctx1) {
  24551. var $1,$2,$3,$4;
  24552. closure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  24553. statements=_st(_st(_st(closure)._instructions())._last())._instructions();
  24554. _st(statements)._ifNotEmpty_((function(){
  24555. return smalltalk.withContext(function($ctx2) {
  24556. $1=_st(_st(statements)._last())._isReturn();
  24557. if(! smalltalk.assert($1)){
  24558. $2=_st($IRReturn())._new();
  24559. _st($2)._add_(_st(_st(statements)._last())._copy());
  24560. $3=_st($2)._yourself();
  24561. return _st(_st(statements)._last())._replaceWith_($3);
  24562. };
  24563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24564. $4=closure;
  24565. return $4;
  24566. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},smalltalk.IRReturnInliner)})},
  24567. args: ["anIRClosure"],
  24568. 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",
  24569. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"],
  24570. referencedClasses: ["IRReturn"]
  24571. }),
  24572. smalltalk.IRReturnInliner);
  24573. smalltalk.addMethod(
  24574. smalltalk.method({
  24575. selector: "inlineReturn:",
  24576. category: 'inlining',
  24577. fn: function (anIRReturn){
  24578. var self=this;
  24579. var return_;
  24580. return smalltalk.withContext(function($ctx1) {
  24581. var $1;
  24582. return_=self._inlinedReturn();
  24583. _st(_st(anIRReturn)._instructions())._do_((function(each){
  24584. return smalltalk.withContext(function($ctx2) {
  24585. return _st(return_)._add_(each);
  24586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  24587. _st(anIRReturn)._replaceWith_(return_);
  24588. self._inlineSend_(_st(_st(return_)._instructions())._last());
  24589. $1=return_;
  24590. return $1;
  24591. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},smalltalk.IRReturnInliner)})},
  24592. args: ["anIRReturn"],
  24593. 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",
  24594. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  24595. referencedClasses: []
  24596. }),
  24597. smalltalk.IRReturnInliner);
  24598. smalltalk.addMethod(
  24599. smalltalk.method({
  24600. selector: "inlinedReturn",
  24601. category: 'factory',
  24602. fn: function (){
  24603. var self=this;
  24604. function $IRInlinedReturn(){return smalltalk.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  24605. return smalltalk.withContext(function($ctx1) {
  24606. var $1;
  24607. $1=_st($IRInlinedReturn())._new();
  24608. return $1;
  24609. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},smalltalk.IRReturnInliner)})},
  24610. args: [],
  24611. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  24612. messageSends: ["new"],
  24613. referencedClasses: ["IRInlinedReturn"]
  24614. }),
  24615. smalltalk.IRReturnInliner);
  24616. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  24617. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  24618. smalltalk.addMethod(
  24619. smalltalk.method({
  24620. selector: "compileNode:",
  24621. category: 'compiling',
  24622. fn: function (aNode){
  24623. var self=this;
  24624. var ir,stream;
  24625. return smalltalk.withContext(function($ctx1) {
  24626. var $2,$3,$1;
  24627. _st(self._semanticAnalyzer())._visit_(aNode);
  24628. ir=_st(self._translator())._visit_(aNode);
  24629. _st(self._inliner())._visit_(ir);
  24630. $2=self._irTranslator();
  24631. _st($2)._visit_(ir);
  24632. $3=_st($2)._contents();
  24633. $1=$3;
  24634. return $1;
  24635. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.InliningCodeGenerator)})},
  24636. args: ["aNode"],
  24637. 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\x09visit: ir;\x0a\x09\x09contents",
  24638. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
  24639. referencedClasses: []
  24640. }),
  24641. smalltalk.InliningCodeGenerator);
  24642. smalltalk.addMethod(
  24643. smalltalk.method({
  24644. selector: "inliner",
  24645. category: 'compiling',
  24646. fn: function (){
  24647. var self=this;
  24648. function $IRInliner(){return smalltalk.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  24649. return smalltalk.withContext(function($ctx1) {
  24650. var $1;
  24651. $1=_st($IRInliner())._new();
  24652. return $1;
  24653. }, function($ctx1) {$ctx1.fill(self,"inliner",{},smalltalk.InliningCodeGenerator)})},
  24654. args: [],
  24655. source: "inliner\x0a\x09^ IRInliner new",
  24656. messageSends: ["new"],
  24657. referencedClasses: ["IRInliner"]
  24658. }),
  24659. smalltalk.InliningCodeGenerator);
  24660. smalltalk.addMethod(
  24661. smalltalk.method({
  24662. selector: "irTranslator",
  24663. category: 'compiling',
  24664. fn: function (){
  24665. var self=this;
  24666. function $IRInliningJSTranslator(){return smalltalk.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  24667. return smalltalk.withContext(function($ctx1) {
  24668. var $1;
  24669. $1=_st($IRInliningJSTranslator())._new();
  24670. return $1;
  24671. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.InliningCodeGenerator)})},
  24672. args: [],
  24673. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  24674. messageSends: ["new"],
  24675. referencedClasses: ["IRInliningJSTranslator"]
  24676. }),
  24677. smalltalk.InliningCodeGenerator);
  24678. smalltalk.addPackage('Compiler-Semantic');
  24679. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
  24680. smalltalk.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.";
  24681. smalltalk.addMethod(
  24682. smalltalk.method({
  24683. selector: "addArg:",
  24684. category: 'adding',
  24685. fn: function (aString){
  24686. var self=this;
  24687. function $ArgVar(){return smalltalk.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  24688. return smalltalk.withContext(function($ctx1) {
  24689. _st(self._args())._at_put_(aString,_st($ArgVar())._on_(aString));
  24690. _st(_st(self._args())._at_(aString))._scope_(self);
  24691. return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},smalltalk.LexicalScope)})},
  24692. args: ["aString"],
  24693. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  24694. messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
  24695. referencedClasses: ["ArgVar"]
  24696. }),
  24697. smalltalk.LexicalScope);
  24698. smalltalk.addMethod(
  24699. smalltalk.method({
  24700. selector: "addTemp:",
  24701. category: 'adding',
  24702. fn: function (aString){
  24703. var self=this;
  24704. function $TempVar(){return smalltalk.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  24705. return smalltalk.withContext(function($ctx1) {
  24706. _st(self._temps())._at_put_(aString,_st($TempVar())._on_(aString));
  24707. _st(_st(self._temps())._at_(aString))._scope_(self);
  24708. return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},smalltalk.LexicalScope)})},
  24709. args: ["aString"],
  24710. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  24711. messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
  24712. referencedClasses: ["TempVar"]
  24713. }),
  24714. smalltalk.LexicalScope);
  24715. smalltalk.addMethod(
  24716. smalltalk.method({
  24717. selector: "alias",
  24718. category: 'accessing',
  24719. fn: function (){
  24720. var self=this;
  24721. return smalltalk.withContext(function($ctx1) {
  24722. var $1;
  24723. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  24724. return $1;
  24725. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.LexicalScope)})},
  24726. args: [],
  24727. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  24728. messageSends: [",", "asString", "scopeLevel"],
  24729. referencedClasses: []
  24730. }),
  24731. smalltalk.LexicalScope);
  24732. smalltalk.addMethod(
  24733. smalltalk.method({
  24734. selector: "allVariableNames",
  24735. category: 'accessing',
  24736. fn: function (){
  24737. var self=this;
  24738. return smalltalk.withContext(function($ctx1) {
  24739. var $1;
  24740. $1=_st(_st(self._args())._keys()).__comma(_st(self._temps())._keys());
  24741. return $1;
  24742. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.LexicalScope)})},
  24743. args: [],
  24744. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  24745. messageSends: [",", "keys", "temps", "args"],
  24746. referencedClasses: []
  24747. }),
  24748. smalltalk.LexicalScope);
  24749. smalltalk.addMethod(
  24750. smalltalk.method({
  24751. selector: "args",
  24752. category: 'accessing',
  24753. fn: function (){
  24754. var self=this;
  24755. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  24756. return smalltalk.withContext(function($ctx1) {
  24757. var $2,$1;
  24758. $2=self["@args"];
  24759. if(($receiver = $2) == nil || $receiver == undefined){
  24760. self["@args"]=_st($Dictionary())._new();
  24761. $1=self["@args"];
  24762. } else {
  24763. $1=$2;
  24764. };
  24765. return $1;
  24766. }, function($ctx1) {$ctx1.fill(self,"args",{},smalltalk.LexicalScope)})},
  24767. args: [],
  24768. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  24769. messageSends: ["ifNil:", "new"],
  24770. referencedClasses: ["Dictionary"]
  24771. }),
  24772. smalltalk.LexicalScope);
  24773. smalltalk.addMethod(
  24774. smalltalk.method({
  24775. selector: "bindingFor:",
  24776. category: 'accessing',
  24777. fn: function (aStringOrNode){
  24778. var self=this;
  24779. return smalltalk.withContext(function($ctx1) {
  24780. var $1;
  24781. $1=_st(self._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24782. return smalltalk.withContext(function($ctx2) {
  24783. return _st(self._args())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24784. return smalltalk.withContext(function($ctx3) {
  24785. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  24786. return smalltalk.withContext(function($ctx4) {
  24787. return nil;
  24788. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  24789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  24790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24791. return $1;
  24792. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},smalltalk.LexicalScope)})},
  24793. args: ["aStringOrNode"],
  24794. 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 ]]]",
  24795. messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
  24796. referencedClasses: []
  24797. }),
  24798. smalltalk.LexicalScope);
  24799. smalltalk.addMethod(
  24800. smalltalk.method({
  24801. selector: "canInlineNonLocalReturns",
  24802. category: 'testing',
  24803. fn: function (){
  24804. var self=this;
  24805. return smalltalk.withContext(function($ctx1) {
  24806. var $1;
  24807. $1=_st(self._isInlined())._and_((function(){
  24808. return smalltalk.withContext(function($ctx2) {
  24809. return _st(self._outerScope())._canInlineNonLocalReturns();
  24810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24811. return $1;
  24812. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.LexicalScope)})},
  24813. args: [],
  24814. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  24815. messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
  24816. referencedClasses: []
  24817. }),
  24818. smalltalk.LexicalScope);
  24819. smalltalk.addMethod(
  24820. smalltalk.method({
  24821. selector: "instruction",
  24822. category: 'accessing',
  24823. fn: function (){
  24824. var self=this;
  24825. return smalltalk.withContext(function($ctx1) {
  24826. var $1;
  24827. $1=self["@instruction"];
  24828. return $1;
  24829. }, function($ctx1) {$ctx1.fill(self,"instruction",{},smalltalk.LexicalScope)})},
  24830. args: [],
  24831. source: "instruction\x0a\x09^ instruction",
  24832. messageSends: [],
  24833. referencedClasses: []
  24834. }),
  24835. smalltalk.LexicalScope);
  24836. smalltalk.addMethod(
  24837. smalltalk.method({
  24838. selector: "instruction:",
  24839. category: 'accessing',
  24840. fn: function (anIRInstruction){
  24841. var self=this;
  24842. return smalltalk.withContext(function($ctx1) {
  24843. self["@instruction"]=anIRInstruction;
  24844. return self}, function($ctx1) {$ctx1.fill(self,"instruction:",{anIRInstruction:anIRInstruction},smalltalk.LexicalScope)})},
  24845. args: ["anIRInstruction"],
  24846. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  24847. messageSends: [],
  24848. referencedClasses: []
  24849. }),
  24850. smalltalk.LexicalScope);
  24851. smalltalk.addMethod(
  24852. smalltalk.method({
  24853. selector: "isBlockScope",
  24854. category: 'testing',
  24855. fn: function (){
  24856. var self=this;
  24857. return smalltalk.withContext(function($ctx1) {
  24858. var $1;
  24859. $1=_st(self._isMethodScope())._not();
  24860. return $1;
  24861. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},smalltalk.LexicalScope)})},
  24862. args: [],
  24863. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  24864. messageSends: ["not", "isMethodScope"],
  24865. referencedClasses: []
  24866. }),
  24867. smalltalk.LexicalScope);
  24868. smalltalk.addMethod(
  24869. smalltalk.method({
  24870. selector: "isInlined",
  24871. category: 'testing',
  24872. fn: function (){
  24873. var self=this;
  24874. return smalltalk.withContext(function($ctx1) {
  24875. var $1;
  24876. $1=_st(_st(self._instruction())._notNil())._and_((function(){
  24877. return smalltalk.withContext(function($ctx2) {
  24878. return _st(self._instruction())._isInlined();
  24879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  24880. return $1;
  24881. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.LexicalScope)})},
  24882. args: [],
  24883. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  24884. messageSends: ["and:", "isInlined", "instruction", "notNil"],
  24885. referencedClasses: []
  24886. }),
  24887. smalltalk.LexicalScope);
  24888. smalltalk.addMethod(
  24889. smalltalk.method({
  24890. selector: "isMethodScope",
  24891. category: 'testing',
  24892. fn: function (){
  24893. var self=this;
  24894. return smalltalk.withContext(function($ctx1) {
  24895. return false;
  24896. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.LexicalScope)})},
  24897. args: [],
  24898. source: "isMethodScope\x0a\x09^ false",
  24899. messageSends: [],
  24900. referencedClasses: []
  24901. }),
  24902. smalltalk.LexicalScope);
  24903. smalltalk.addMethod(
  24904. smalltalk.method({
  24905. selector: "lookupVariable:",
  24906. category: 'accessing',
  24907. fn: function (aNode){
  24908. var self=this;
  24909. var lookup;
  24910. return smalltalk.withContext(function($ctx1) {
  24911. var $1,$2,$3;
  24912. lookup=self._bindingFor_(aNode);
  24913. $1=lookup;
  24914. if(($receiver = $1) == nil || $receiver == undefined){
  24915. $2=self._outerScope();
  24916. if(($receiver = $2) == nil || $receiver == undefined){
  24917. lookup=$2;
  24918. } else {
  24919. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  24920. };
  24921. lookup;
  24922. } else {
  24923. $1;
  24924. };
  24925. $3=lookup;
  24926. return $3;
  24927. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},smalltalk.LexicalScope)})},
  24928. args: ["aNode"],
  24929. 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",
  24930. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
  24931. referencedClasses: []
  24932. }),
  24933. smalltalk.LexicalScope);
  24934. smalltalk.addMethod(
  24935. smalltalk.method({
  24936. selector: "methodScope",
  24937. category: 'accessing',
  24938. fn: function (){
  24939. var self=this;
  24940. return smalltalk.withContext(function($ctx1) {
  24941. var $2,$1;
  24942. $2=self._outerScope();
  24943. if(($receiver = $2) == nil || $receiver == undefined){
  24944. $1=$2;
  24945. } else {
  24946. $1=_st(self._outerScope())._methodScope();
  24947. };
  24948. return $1;
  24949. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.LexicalScope)})},
  24950. args: [],
  24951. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  24952. messageSends: ["ifNotNil:", "methodScope", "outerScope"],
  24953. referencedClasses: []
  24954. }),
  24955. smalltalk.LexicalScope);
  24956. smalltalk.addMethod(
  24957. smalltalk.method({
  24958. selector: "node",
  24959. category: 'accessing',
  24960. fn: function (){
  24961. var self=this;
  24962. return smalltalk.withContext(function($ctx1) {
  24963. var $1;
  24964. $1=self["@node"];
  24965. return $1;
  24966. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.LexicalScope)})},
  24967. args: [],
  24968. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  24969. messageSends: [],
  24970. referencedClasses: []
  24971. }),
  24972. smalltalk.LexicalScope);
  24973. smalltalk.addMethod(
  24974. smalltalk.method({
  24975. selector: "node:",
  24976. category: 'accessing',
  24977. fn: function (aNode){
  24978. var self=this;
  24979. return smalltalk.withContext(function($ctx1) {
  24980. self["@node"]=aNode;
  24981. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.LexicalScope)})},
  24982. args: ["aNode"],
  24983. source: "node: aNode\x0a\x09node := aNode",
  24984. messageSends: [],
  24985. referencedClasses: []
  24986. }),
  24987. smalltalk.LexicalScope);
  24988. smalltalk.addMethod(
  24989. smalltalk.method({
  24990. selector: "outerScope",
  24991. category: 'accessing',
  24992. fn: function (){
  24993. var self=this;
  24994. return smalltalk.withContext(function($ctx1) {
  24995. var $1;
  24996. $1=self["@outerScope"];
  24997. return $1;
  24998. }, function($ctx1) {$ctx1.fill(self,"outerScope",{},smalltalk.LexicalScope)})},
  24999. args: [],
  25000. source: "outerScope\x0a\x09^ outerScope",
  25001. messageSends: [],
  25002. referencedClasses: []
  25003. }),
  25004. smalltalk.LexicalScope);
  25005. smalltalk.addMethod(
  25006. smalltalk.method({
  25007. selector: "outerScope:",
  25008. category: 'accessing',
  25009. fn: function (aLexicalScope){
  25010. var self=this;
  25011. return smalltalk.withContext(function($ctx1) {
  25012. self["@outerScope"]=aLexicalScope;
  25013. return self}, function($ctx1) {$ctx1.fill(self,"outerScope:",{aLexicalScope:aLexicalScope},smalltalk.LexicalScope)})},
  25014. args: ["aLexicalScope"],
  25015. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  25016. messageSends: [],
  25017. referencedClasses: []
  25018. }),
  25019. smalltalk.LexicalScope);
  25020. smalltalk.addMethod(
  25021. smalltalk.method({
  25022. selector: "pseudoVars",
  25023. category: 'accessing',
  25024. fn: function (){
  25025. var self=this;
  25026. return smalltalk.withContext(function($ctx1) {
  25027. var $1;
  25028. $1=_st(self._methodScope())._pseudoVars();
  25029. return $1;
  25030. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.LexicalScope)})},
  25031. args: [],
  25032. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  25033. messageSends: ["pseudoVars", "methodScope"],
  25034. referencedClasses: []
  25035. }),
  25036. smalltalk.LexicalScope);
  25037. smalltalk.addMethod(
  25038. smalltalk.method({
  25039. selector: "scopeLevel",
  25040. category: 'accessing',
  25041. fn: function (){
  25042. var self=this;
  25043. return smalltalk.withContext(function($ctx1) {
  25044. var $1,$2,$3,$4;
  25045. $1=self._outerScope();
  25046. if(($receiver = $1) == nil || $receiver == undefined){
  25047. return (1);
  25048. } else {
  25049. $1;
  25050. };
  25051. $2=self._isInlined();
  25052. if(smalltalk.assert($2)){
  25053. $3=_st(self._outerScope())._scopeLevel();
  25054. return $3;
  25055. };
  25056. $4=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  25057. return $4;
  25058. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},smalltalk.LexicalScope)})},
  25059. args: [],
  25060. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  25061. messageSends: ["ifNil:", "outerScope", "ifTrue:", "scopeLevel", "isInlined", "+"],
  25062. referencedClasses: []
  25063. }),
  25064. smalltalk.LexicalScope);
  25065. smalltalk.addMethod(
  25066. smalltalk.method({
  25067. selector: "temps",
  25068. category: 'accessing',
  25069. fn: function (){
  25070. var self=this;
  25071. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25072. return smalltalk.withContext(function($ctx1) {
  25073. var $2,$1;
  25074. $2=self["@temps"];
  25075. if(($receiver = $2) == nil || $receiver == undefined){
  25076. self["@temps"]=_st($Dictionary())._new();
  25077. $1=self["@temps"];
  25078. } else {
  25079. $1=$2;
  25080. };
  25081. return $1;
  25082. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.LexicalScope)})},
  25083. args: [],
  25084. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  25085. messageSends: ["ifNil:", "new"],
  25086. referencedClasses: ["Dictionary"]
  25087. }),
  25088. smalltalk.LexicalScope);
  25089. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  25090. smalltalk.MethodLexicalScope.comment="I represent a method scope.";
  25091. smalltalk.addMethod(
  25092. smalltalk.method({
  25093. selector: "addIVar:",
  25094. category: 'adding',
  25095. fn: function (aString){
  25096. var self=this;
  25097. function $InstanceVar(){return smalltalk.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  25098. return smalltalk.withContext(function($ctx1) {
  25099. _st(self._iVars())._at_put_(aString,_st($InstanceVar())._on_(aString));
  25100. _st(_st(self._iVars())._at_(aString))._scope_(self);
  25101. return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},smalltalk.MethodLexicalScope)})},
  25102. args: ["aString"],
  25103. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  25104. messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
  25105. referencedClasses: ["InstanceVar"]
  25106. }),
  25107. smalltalk.MethodLexicalScope);
  25108. smalltalk.addMethod(
  25109. smalltalk.method({
  25110. selector: "addNonLocalReturn:",
  25111. category: 'adding',
  25112. fn: function (aScope){
  25113. var self=this;
  25114. return smalltalk.withContext(function($ctx1) {
  25115. _st(self._nonLocalReturns())._add_(aScope);
  25116. return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  25117. args: ["aScope"],
  25118. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  25119. messageSends: ["add:", "nonLocalReturns"],
  25120. referencedClasses: []
  25121. }),
  25122. smalltalk.MethodLexicalScope);
  25123. smalltalk.addMethod(
  25124. smalltalk.method({
  25125. selector: "allVariableNames",
  25126. category: 'accessing',
  25127. fn: function (){
  25128. var self=this;
  25129. return smalltalk.withContext(function($ctx1) {
  25130. var $1;
  25131. $1=_st(smalltalk.LexicalScope.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(self._iVars())._keys());
  25132. return $1;
  25133. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.MethodLexicalScope)})},
  25134. args: [],
  25135. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  25136. messageSends: [",", "keys", "iVars", "allVariableNames"],
  25137. referencedClasses: []
  25138. }),
  25139. smalltalk.MethodLexicalScope);
  25140. smalltalk.addMethod(
  25141. smalltalk.method({
  25142. selector: "bindingFor:",
  25143. category: 'accessing',
  25144. fn: function (aNode){
  25145. var self=this;
  25146. return smalltalk.withContext(function($ctx1) {
  25147. var $2,$1;
  25148. $2=smalltalk.LexicalScope.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
  25149. if(($receiver = $2) == nil || $receiver == undefined){
  25150. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  25151. return smalltalk.withContext(function($ctx2) {
  25152. return nil;
  25153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25154. } else {
  25155. $1=$2;
  25156. };
  25157. return $1;
  25158. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},smalltalk.MethodLexicalScope)})},
  25159. args: ["aNode"],
  25160. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  25161. messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
  25162. referencedClasses: []
  25163. }),
  25164. smalltalk.MethodLexicalScope);
  25165. smalltalk.addMethod(
  25166. smalltalk.method({
  25167. selector: "canInlineNonLocalReturns",
  25168. category: 'testing',
  25169. fn: function (){
  25170. var self=this;
  25171. return smalltalk.withContext(function($ctx1) {
  25172. return true;
  25173. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  25174. args: [],
  25175. source: "canInlineNonLocalReturns\x0a\x09^ true",
  25176. messageSends: [],
  25177. referencedClasses: []
  25178. }),
  25179. smalltalk.MethodLexicalScope);
  25180. smalltalk.addMethod(
  25181. smalltalk.method({
  25182. selector: "hasLocalReturn",
  25183. category: 'testing',
  25184. fn: function (){
  25185. var self=this;
  25186. return smalltalk.withContext(function($ctx1) {
  25187. var $1;
  25188. $1=self._localReturn();
  25189. return $1;
  25190. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},smalltalk.MethodLexicalScope)})},
  25191. args: [],
  25192. source: "hasLocalReturn\x0a\x09^ self localReturn",
  25193. messageSends: ["localReturn"],
  25194. referencedClasses: []
  25195. }),
  25196. smalltalk.MethodLexicalScope);
  25197. smalltalk.addMethod(
  25198. smalltalk.method({
  25199. selector: "hasNonLocalReturn",
  25200. category: 'testing',
  25201. fn: function (){
  25202. var self=this;
  25203. return smalltalk.withContext(function($ctx1) {
  25204. var $1;
  25205. $1=_st(self._nonLocalReturns())._notEmpty();
  25206. return $1;
  25207. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},smalltalk.MethodLexicalScope)})},
  25208. args: [],
  25209. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  25210. messageSends: ["notEmpty", "nonLocalReturns"],
  25211. referencedClasses: []
  25212. }),
  25213. smalltalk.MethodLexicalScope);
  25214. smalltalk.addMethod(
  25215. smalltalk.method({
  25216. selector: "iVars",
  25217. category: 'accessing',
  25218. fn: function (){
  25219. var self=this;
  25220. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25221. return smalltalk.withContext(function($ctx1) {
  25222. var $2,$1;
  25223. $2=self["@iVars"];
  25224. if(($receiver = $2) == nil || $receiver == undefined){
  25225. self["@iVars"]=_st($Dictionary())._new();
  25226. $1=self["@iVars"];
  25227. } else {
  25228. $1=$2;
  25229. };
  25230. return $1;
  25231. }, function($ctx1) {$ctx1.fill(self,"iVars",{},smalltalk.MethodLexicalScope)})},
  25232. args: [],
  25233. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  25234. messageSends: ["ifNil:", "new"],
  25235. referencedClasses: ["Dictionary"]
  25236. }),
  25237. smalltalk.MethodLexicalScope);
  25238. smalltalk.addMethod(
  25239. smalltalk.method({
  25240. selector: "isMethodScope",
  25241. category: 'testing',
  25242. fn: function (){
  25243. var self=this;
  25244. return smalltalk.withContext(function($ctx1) {
  25245. return true;
  25246. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.MethodLexicalScope)})},
  25247. args: [],
  25248. source: "isMethodScope\x0a\x09^ true",
  25249. messageSends: [],
  25250. referencedClasses: []
  25251. }),
  25252. smalltalk.MethodLexicalScope);
  25253. smalltalk.addMethod(
  25254. smalltalk.method({
  25255. selector: "localReturn",
  25256. category: 'accessing',
  25257. fn: function (){
  25258. var self=this;
  25259. return smalltalk.withContext(function($ctx1) {
  25260. var $2,$1;
  25261. $2=self["@localReturn"];
  25262. if(($receiver = $2) == nil || $receiver == undefined){
  25263. $1=false;
  25264. } else {
  25265. $1=$2;
  25266. };
  25267. return $1;
  25268. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},smalltalk.MethodLexicalScope)})},
  25269. args: [],
  25270. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  25271. messageSends: ["ifNil:"],
  25272. referencedClasses: []
  25273. }),
  25274. smalltalk.MethodLexicalScope);
  25275. smalltalk.addMethod(
  25276. smalltalk.method({
  25277. selector: "localReturn:",
  25278. category: 'accessing',
  25279. fn: function (aBoolean){
  25280. var self=this;
  25281. return smalltalk.withContext(function($ctx1) {
  25282. self["@localReturn"]=aBoolean;
  25283. return self}, function($ctx1) {$ctx1.fill(self,"localReturn:",{aBoolean:aBoolean},smalltalk.MethodLexicalScope)})},
  25284. args: ["aBoolean"],
  25285. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  25286. messageSends: [],
  25287. referencedClasses: []
  25288. }),
  25289. smalltalk.MethodLexicalScope);
  25290. smalltalk.addMethod(
  25291. smalltalk.method({
  25292. selector: "methodScope",
  25293. category: 'accessing',
  25294. fn: function (){
  25295. var self=this;
  25296. return smalltalk.withContext(function($ctx1) {
  25297. var $1;
  25298. $1=self;
  25299. return $1;
  25300. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.MethodLexicalScope)})},
  25301. args: [],
  25302. source: "methodScope\x0a\x09^ self",
  25303. messageSends: [],
  25304. referencedClasses: []
  25305. }),
  25306. smalltalk.MethodLexicalScope);
  25307. smalltalk.addMethod(
  25308. smalltalk.method({
  25309. selector: "nonLocalReturns",
  25310. category: 'accessing',
  25311. fn: function (){
  25312. var self=this;
  25313. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  25314. return smalltalk.withContext(function($ctx1) {
  25315. var $2,$1;
  25316. $2=self["@nonLocalReturns"];
  25317. if(($receiver = $2) == nil || $receiver == undefined){
  25318. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  25319. $1=self["@nonLocalReturns"];
  25320. } else {
  25321. $1=$2;
  25322. };
  25323. return $1;
  25324. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  25325. args: [],
  25326. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  25327. messageSends: ["ifNil:", "new"],
  25328. referencedClasses: ["OrderedCollection"]
  25329. }),
  25330. smalltalk.MethodLexicalScope);
  25331. smalltalk.addMethod(
  25332. smalltalk.method({
  25333. selector: "pseudoVars",
  25334. category: 'accessing',
  25335. fn: function (){
  25336. var self=this;
  25337. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25338. function $PseudoVar(){return smalltalk.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  25339. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25340. return smalltalk.withContext(function($ctx1) {
  25341. var $1,$2,$3,$4;
  25342. $1=self["@pseudoVars"];
  25343. if(($receiver = $1) == nil || $receiver == undefined){
  25344. self["@pseudoVars"]=_st($Dictionary())._new();
  25345. self["@pseudoVars"];
  25346. _st(_st(_st($Smalltalk())._current())._pseudoVariableNames())._do_((function(each){
  25347. return smalltalk.withContext(function($ctx2) {
  25348. $2=_st($PseudoVar())._on_(each);
  25349. _st($2)._scope_(self._methodScope());
  25350. $3=_st($2)._yourself();
  25351. return _st(self["@pseudoVars"])._at_put_(each,$3);
  25352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  25353. } else {
  25354. $1;
  25355. };
  25356. $4=self["@pseudoVars"];
  25357. return $4;
  25358. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.MethodLexicalScope)})},
  25359. args: [],
  25360. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk current 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",
  25361. messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
  25362. referencedClasses: ["Dictionary", "PseudoVar", "Smalltalk"]
  25363. }),
  25364. smalltalk.MethodLexicalScope);
  25365. smalltalk.addMethod(
  25366. smalltalk.method({
  25367. selector: "removeNonLocalReturn:",
  25368. category: 'adding',
  25369. fn: function (aScope){
  25370. var self=this;
  25371. return smalltalk.withContext(function($ctx1) {
  25372. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  25373. return smalltalk.withContext(function($ctx2) {
  25374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25375. return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  25376. args: ["aScope"],
  25377. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  25378. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  25379. referencedClasses: []
  25380. }),
  25381. smalltalk.MethodLexicalScope);
  25382. smalltalk.addMethod(
  25383. smalltalk.method({
  25384. selector: "unknownVariables",
  25385. category: 'accessing',
  25386. fn: function (){
  25387. var self=this;
  25388. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  25389. return smalltalk.withContext(function($ctx1) {
  25390. var $2,$1;
  25391. $2=self["@unknownVariables"];
  25392. if(($receiver = $2) == nil || $receiver == undefined){
  25393. self["@unknownVariables"]=_st($OrderedCollection())._new();
  25394. $1=self["@unknownVariables"];
  25395. } else {
  25396. $1=$2;
  25397. };
  25398. return $1;
  25399. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.MethodLexicalScope)})},
  25400. args: [],
  25401. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  25402. messageSends: ["ifNil:", "new"],
  25403. referencedClasses: ["OrderedCollection"]
  25404. }),
  25405. smalltalk.MethodLexicalScope);
  25406. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  25407. smalltalk.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.";
  25408. smalltalk.addMethod(
  25409. smalltalk.method({
  25410. selector: "alias",
  25411. category: 'accessing',
  25412. fn: function (){
  25413. var self=this;
  25414. return smalltalk.withContext(function($ctx1) {
  25415. var $1;
  25416. $1=_st(self._name())._asVariableName();
  25417. return $1;
  25418. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ScopeVar)})},
  25419. args: [],
  25420. source: "alias\x0a\x09^ self name asVariableName",
  25421. messageSends: ["asVariableName", "name"],
  25422. referencedClasses: []
  25423. }),
  25424. smalltalk.ScopeVar);
  25425. smalltalk.addMethod(
  25426. smalltalk.method({
  25427. selector: "isArgVar",
  25428. category: 'testing',
  25429. fn: function (){
  25430. var self=this;
  25431. return smalltalk.withContext(function($ctx1) {
  25432. return false;
  25433. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ScopeVar)})},
  25434. args: [],
  25435. source: "isArgVar\x0a\x09^ false",
  25436. messageSends: [],
  25437. referencedClasses: []
  25438. }),
  25439. smalltalk.ScopeVar);
  25440. smalltalk.addMethod(
  25441. smalltalk.method({
  25442. selector: "isClassRefVar",
  25443. category: 'testing',
  25444. fn: function (){
  25445. var self=this;
  25446. return smalltalk.withContext(function($ctx1) {
  25447. return false;
  25448. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ScopeVar)})},
  25449. args: [],
  25450. source: "isClassRefVar\x0a\x09^ false",
  25451. messageSends: [],
  25452. referencedClasses: []
  25453. }),
  25454. smalltalk.ScopeVar);
  25455. smalltalk.addMethod(
  25456. smalltalk.method({
  25457. selector: "isInstanceVar",
  25458. category: 'testing',
  25459. fn: function (){
  25460. var self=this;
  25461. return smalltalk.withContext(function($ctx1) {
  25462. return false;
  25463. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.ScopeVar)})},
  25464. args: [],
  25465. source: "isInstanceVar\x0a\x09^ false",
  25466. messageSends: [],
  25467. referencedClasses: []
  25468. }),
  25469. smalltalk.ScopeVar);
  25470. smalltalk.addMethod(
  25471. smalltalk.method({
  25472. selector: "isPseudoVar",
  25473. category: 'testing',
  25474. fn: function (){
  25475. var self=this;
  25476. return smalltalk.withContext(function($ctx1) {
  25477. return false;
  25478. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.ScopeVar)})},
  25479. args: [],
  25480. source: "isPseudoVar\x0a\x09^ false",
  25481. messageSends: [],
  25482. referencedClasses: []
  25483. }),
  25484. smalltalk.ScopeVar);
  25485. smalltalk.addMethod(
  25486. smalltalk.method({
  25487. selector: "isTempVar",
  25488. category: 'testing',
  25489. fn: function (){
  25490. var self=this;
  25491. return smalltalk.withContext(function($ctx1) {
  25492. return false;
  25493. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.ScopeVar)})},
  25494. args: [],
  25495. source: "isTempVar\x0a\x09^ false",
  25496. messageSends: [],
  25497. referencedClasses: []
  25498. }),
  25499. smalltalk.ScopeVar);
  25500. smalltalk.addMethod(
  25501. smalltalk.method({
  25502. selector: "isUnknownVar",
  25503. category: 'testing',
  25504. fn: function (){
  25505. var self=this;
  25506. return smalltalk.withContext(function($ctx1) {
  25507. return false;
  25508. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.ScopeVar)})},
  25509. args: [],
  25510. source: "isUnknownVar\x0a\x09^ false",
  25511. messageSends: [],
  25512. referencedClasses: []
  25513. }),
  25514. smalltalk.ScopeVar);
  25515. smalltalk.addMethod(
  25516. smalltalk.method({
  25517. selector: "name",
  25518. category: 'accessing',
  25519. fn: function (){
  25520. var self=this;
  25521. return smalltalk.withContext(function($ctx1) {
  25522. var $1;
  25523. $1=self["@name"];
  25524. return $1;
  25525. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ScopeVar)})},
  25526. args: [],
  25527. source: "name\x0a\x09^ name",
  25528. messageSends: [],
  25529. referencedClasses: []
  25530. }),
  25531. smalltalk.ScopeVar);
  25532. smalltalk.addMethod(
  25533. smalltalk.method({
  25534. selector: "name:",
  25535. category: 'accessing',
  25536. fn: function (aString){
  25537. var self=this;
  25538. return smalltalk.withContext(function($ctx1) {
  25539. self["@name"]=aString;
  25540. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ScopeVar)})},
  25541. args: ["aString"],
  25542. source: "name: aString\x0a\x09name := aString",
  25543. messageSends: [],
  25544. referencedClasses: []
  25545. }),
  25546. smalltalk.ScopeVar);
  25547. smalltalk.addMethod(
  25548. smalltalk.method({
  25549. selector: "scope",
  25550. category: 'accessing',
  25551. fn: function (){
  25552. var self=this;
  25553. return smalltalk.withContext(function($ctx1) {
  25554. var $1;
  25555. $1=self["@scope"];
  25556. return $1;
  25557. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ScopeVar)})},
  25558. args: [],
  25559. source: "scope\x0a\x09^ scope",
  25560. messageSends: [],
  25561. referencedClasses: []
  25562. }),
  25563. smalltalk.ScopeVar);
  25564. smalltalk.addMethod(
  25565. smalltalk.method({
  25566. selector: "scope:",
  25567. category: 'accessing',
  25568. fn: function (aScope){
  25569. var self=this;
  25570. return smalltalk.withContext(function($ctx1) {
  25571. self["@scope"]=aScope;
  25572. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.ScopeVar)})},
  25573. args: ["aScope"],
  25574. source: "scope: aScope\x0a\x09scope := aScope",
  25575. messageSends: [],
  25576. referencedClasses: []
  25577. }),
  25578. smalltalk.ScopeVar);
  25579. smalltalk.addMethod(
  25580. smalltalk.method({
  25581. selector: "validateAssignment",
  25582. category: 'testing',
  25583. fn: function (){
  25584. var self=this;
  25585. function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  25586. return smalltalk.withContext(function($ctx1) {
  25587. var $1,$2,$3;
  25588. $1=_st(self._isArgVar())._or_((function(){
  25589. return smalltalk.withContext(function($ctx2) {
  25590. return self._isPseudoVar();
  25591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25592. if(smalltalk.assert($1)){
  25593. $2=_st($InvalidAssignmentError())._new();
  25594. _st($2)._variableName_(self._name());
  25595. $3=_st($2)._signal();
  25596. $3;
  25597. };
  25598. return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},smalltalk.ScopeVar)})},
  25599. args: [],
  25600. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  25601. messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
  25602. referencedClasses: ["InvalidAssignmentError"]
  25603. }),
  25604. smalltalk.ScopeVar);
  25605. smalltalk.addMethod(
  25606. smalltalk.method({
  25607. selector: "on:",
  25608. category: 'instance creation',
  25609. fn: function (aString){
  25610. var self=this;
  25611. return smalltalk.withContext(function($ctx1) {
  25612. var $2,$3,$1;
  25613. $2=self._new();
  25614. _st($2)._name_(aString);
  25615. $3=_st($2)._yourself();
  25616. $1=$3;
  25617. return $1;
  25618. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},smalltalk.ScopeVar.klass)})},
  25619. args: ["aString"],
  25620. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  25621. messageSends: ["name:", "new", "yourself"],
  25622. referencedClasses: []
  25623. }),
  25624. smalltalk.ScopeVar.klass);
  25625. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  25626. smalltalk.AliasVar.comment="I am an internally defined variable by the compiler";
  25627. smalltalk.addMethod(
  25628. smalltalk.method({
  25629. selector: "node",
  25630. category: 'accessing',
  25631. fn: function (){
  25632. var self=this;
  25633. return smalltalk.withContext(function($ctx1) {
  25634. var $1;
  25635. $1=self["@node"];
  25636. return $1;
  25637. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.AliasVar)})},
  25638. args: [],
  25639. source: "node\x0a\x09^ node",
  25640. messageSends: [],
  25641. referencedClasses: []
  25642. }),
  25643. smalltalk.AliasVar);
  25644. smalltalk.addMethod(
  25645. smalltalk.method({
  25646. selector: "node:",
  25647. category: 'accessing',
  25648. fn: function (aNode){
  25649. var self=this;
  25650. return smalltalk.withContext(function($ctx1) {
  25651. self["@node"]=aNode;
  25652. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.AliasVar)})},
  25653. args: ["aNode"],
  25654. source: "node: aNode\x0a\x09node := aNode",
  25655. messageSends: [],
  25656. referencedClasses: []
  25657. }),
  25658. smalltalk.AliasVar);
  25659. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25660. smalltalk.ArgVar.comment="I am an argument of a method or block.";
  25661. smalltalk.addMethod(
  25662. smalltalk.method({
  25663. selector: "isArgVar",
  25664. category: 'testing',
  25665. fn: function (){
  25666. var self=this;
  25667. return smalltalk.withContext(function($ctx1) {
  25668. return true;
  25669. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ArgVar)})},
  25670. args: [],
  25671. source: "isArgVar\x0a\x09^ true",
  25672. messageSends: [],
  25673. referencedClasses: []
  25674. }),
  25675. smalltalk.ArgVar);
  25676. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25677. smalltalk.ClassRefVar.comment="I am an class reference variable";
  25678. smalltalk.addMethod(
  25679. smalltalk.method({
  25680. selector: "alias",
  25681. category: 'accessing',
  25682. fn: function (){
  25683. var self=this;
  25684. return smalltalk.withContext(function($ctx1) {
  25685. var $1;
  25686. $1=_st("$".__comma(self._name())).__comma("()");
  25687. return $1;
  25688. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ClassRefVar)})},
  25689. args: [],
  25690. 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, '()'",
  25691. messageSends: [",", "name"],
  25692. referencedClasses: []
  25693. }),
  25694. smalltalk.ClassRefVar);
  25695. smalltalk.addMethod(
  25696. smalltalk.method({
  25697. selector: "isClassRefVar",
  25698. category: 'testing',
  25699. fn: function (){
  25700. var self=this;
  25701. return smalltalk.withContext(function($ctx1) {
  25702. return true;
  25703. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ClassRefVar)})},
  25704. args: [],
  25705. source: "isClassRefVar\x0a\x09^ true",
  25706. messageSends: [],
  25707. referencedClasses: []
  25708. }),
  25709. smalltalk.ClassRefVar);
  25710. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25711. smalltalk.InstanceVar.comment="I am an instance variable of a method or block.";
  25712. smalltalk.addMethod(
  25713. smalltalk.method({
  25714. selector: "alias",
  25715. category: 'testing',
  25716. fn: function (){
  25717. var self=this;
  25718. return smalltalk.withContext(function($ctx1) {
  25719. var $1;
  25720. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  25721. return $1;
  25722. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.InstanceVar)})},
  25723. args: [],
  25724. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  25725. messageSends: [",", "name"],
  25726. referencedClasses: []
  25727. }),
  25728. smalltalk.InstanceVar);
  25729. smalltalk.addMethod(
  25730. smalltalk.method({
  25731. selector: "isInstanceVar",
  25732. category: 'testing',
  25733. fn: function (){
  25734. var self=this;
  25735. return smalltalk.withContext(function($ctx1) {
  25736. return true;
  25737. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.InstanceVar)})},
  25738. args: [],
  25739. source: "isInstanceVar\x0a\x09^ true",
  25740. messageSends: [],
  25741. referencedClasses: []
  25742. }),
  25743. smalltalk.InstanceVar);
  25744. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25745. smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  25746. smalltalk.addMethod(
  25747. smalltalk.method({
  25748. selector: "alias",
  25749. category: 'accessing',
  25750. fn: function (){
  25751. var self=this;
  25752. return smalltalk.withContext(function($ctx1) {
  25753. var $1;
  25754. $1=self._name();
  25755. return $1;
  25756. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.PseudoVar)})},
  25757. args: [],
  25758. source: "alias\x0a\x09^ self name",
  25759. messageSends: ["name"],
  25760. referencedClasses: []
  25761. }),
  25762. smalltalk.PseudoVar);
  25763. smalltalk.addMethod(
  25764. smalltalk.method({
  25765. selector: "isPseudoVar",
  25766. category: 'testing',
  25767. fn: function (){
  25768. var self=this;
  25769. return smalltalk.withContext(function($ctx1) {
  25770. return true;
  25771. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.PseudoVar)})},
  25772. args: [],
  25773. source: "isPseudoVar\x0a\x09^ true",
  25774. messageSends: [],
  25775. referencedClasses: []
  25776. }),
  25777. smalltalk.PseudoVar);
  25778. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25779. smalltalk.TempVar.comment="I am an temporary variable of a method or block.";
  25780. smalltalk.addMethod(
  25781. smalltalk.method({
  25782. selector: "isTempVar",
  25783. category: 'testing',
  25784. fn: function (){
  25785. var self=this;
  25786. return smalltalk.withContext(function($ctx1) {
  25787. return true;
  25788. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.TempVar)})},
  25789. args: [],
  25790. source: "isTempVar\x0a\x09^ true",
  25791. messageSends: [],
  25792. referencedClasses: []
  25793. }),
  25794. smalltalk.TempVar);
  25795. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  25796. smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  25797. smalltalk.addMethod(
  25798. smalltalk.method({
  25799. selector: "isUnknownVar",
  25800. category: 'testing',
  25801. fn: function (){
  25802. var self=this;
  25803. return smalltalk.withContext(function($ctx1) {
  25804. return true;
  25805. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.UnknownVar)})},
  25806. args: [],
  25807. source: "isUnknownVar\x0a\x09^ true",
  25808. messageSends: [],
  25809. referencedClasses: []
  25810. }),
  25811. smalltalk.UnknownVar);
  25812. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  25813. smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  25814. smalltalk.addMethod(
  25815. smalltalk.method({
  25816. selector: "classReferences",
  25817. category: 'accessing',
  25818. fn: function (){
  25819. var self=this;
  25820. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  25821. return smalltalk.withContext(function($ctx1) {
  25822. var $2,$1;
  25823. $2=self["@classReferences"];
  25824. if(($receiver = $2) == nil || $receiver == undefined){
  25825. self["@classReferences"]=_st($Set())._new();
  25826. $1=self["@classReferences"];
  25827. } else {
  25828. $1=$2;
  25829. };
  25830. return $1;
  25831. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.SemanticAnalyzer)})},
  25832. args: [],
  25833. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  25834. messageSends: ["ifNil:", "new"],
  25835. referencedClasses: ["Set"]
  25836. }),
  25837. smalltalk.SemanticAnalyzer);
  25838. smalltalk.addMethod(
  25839. smalltalk.method({
  25840. selector: "errorShadowingVariable:",
  25841. category: 'error handling',
  25842. fn: function (aString){
  25843. var self=this;
  25844. function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  25845. return smalltalk.withContext(function($ctx1) {
  25846. var $1,$2;
  25847. $1=_st($ShadowingVariableError())._new();
  25848. _st($1)._variableName_(aString);
  25849. $2=_st($1)._signal();
  25850. return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  25851. args: ["aString"],
  25852. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  25853. messageSends: ["variableName:", "new", "signal"],
  25854. referencedClasses: ["ShadowingVariableError"]
  25855. }),
  25856. smalltalk.SemanticAnalyzer);
  25857. smalltalk.addMethod(
  25858. smalltalk.method({
  25859. selector: "errorUnknownVariable:",
  25860. category: 'error handling',
  25861. fn: function (aNode){
  25862. var self=this;
  25863. var identifier;
  25864. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  25865. return smalltalk.withContext(function($ctx1) {
  25866. var $1,$2,$3;
  25867. identifier=_st(aNode)._value();
  25868. $1=_st(_st(["jQuery", "window", "document", "process", "global"]._includes_(identifier))._not())._and_((function(){
  25869. return smalltalk.withContext(function($ctx2) {
  25870. return self._isVariableGloballyUndefined_(identifier);
  25871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  25872. if(smalltalk.assert($1)){
  25873. $2=_st($UnknownVariableError())._new();
  25874. _st($2)._variableName_(_st(aNode)._value());
  25875. $3=_st($2)._signal();
  25876. $3;
  25877. } else {
  25878. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  25879. };
  25880. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
  25881. args: ["aNode"],
  25882. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow four variable names in addition: `jQuery`, `window`, `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((#('jQuery' 'window' 'document' 'process' 'global') 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 ]",
  25883. messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:"],
  25884. referencedClasses: ["UnknownVariableError"]
  25885. }),
  25886. smalltalk.SemanticAnalyzer);
  25887. smalltalk.addMethod(
  25888. smalltalk.method({
  25889. selector: "isVariableGloballyUndefined:",
  25890. category: 'testing',
  25891. fn: function (aString){
  25892. var self=this;
  25893. return smalltalk.withContext(function($ctx1) {
  25894. return eval('typeof ' + aString + ' == "undefined"');
  25895. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  25896. args: ["aString"],
  25897. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  25898. messageSends: [],
  25899. referencedClasses: []
  25900. }),
  25901. smalltalk.SemanticAnalyzer);
  25902. smalltalk.addMethod(
  25903. smalltalk.method({
  25904. selector: "messageSends",
  25905. category: 'accessing',
  25906. fn: function (){
  25907. var self=this;
  25908. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25909. return smalltalk.withContext(function($ctx1) {
  25910. var $2,$1;
  25911. $2=self["@messageSends"];
  25912. if(($receiver = $2) == nil || $receiver == undefined){
  25913. self["@messageSends"]=_st($Dictionary())._new();
  25914. $1=self["@messageSends"];
  25915. } else {
  25916. $1=$2;
  25917. };
  25918. return $1;
  25919. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.SemanticAnalyzer)})},
  25920. args: [],
  25921. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  25922. messageSends: ["ifNil:", "new"],
  25923. referencedClasses: ["Dictionary"]
  25924. }),
  25925. smalltalk.SemanticAnalyzer);
  25926. smalltalk.addMethod(
  25927. smalltalk.method({
  25928. selector: "newBlockScope",
  25929. category: 'factory',
  25930. fn: function (){
  25931. var self=this;
  25932. function $LexicalScope(){return smalltalk.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  25933. return smalltalk.withContext(function($ctx1) {
  25934. var $1;
  25935. $1=self._newScopeOfClass_($LexicalScope());
  25936. return $1;
  25937. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},smalltalk.SemanticAnalyzer)})},
  25938. args: [],
  25939. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  25940. messageSends: ["newScopeOfClass:"],
  25941. referencedClasses: ["LexicalScope"]
  25942. }),
  25943. smalltalk.SemanticAnalyzer);
  25944. smalltalk.addMethod(
  25945. smalltalk.method({
  25946. selector: "newMethodScope",
  25947. category: 'factory',
  25948. fn: function (){
  25949. var self=this;
  25950. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  25951. return smalltalk.withContext(function($ctx1) {
  25952. var $1;
  25953. $1=self._newScopeOfClass_($MethodLexicalScope());
  25954. return $1;
  25955. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},smalltalk.SemanticAnalyzer)})},
  25956. args: [],
  25957. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  25958. messageSends: ["newScopeOfClass:"],
  25959. referencedClasses: ["MethodLexicalScope"]
  25960. }),
  25961. smalltalk.SemanticAnalyzer);
  25962. smalltalk.addMethod(
  25963. smalltalk.method({
  25964. selector: "newScopeOfClass:",
  25965. category: 'factory',
  25966. fn: function (aLexicalScopeClass){
  25967. var self=this;
  25968. return smalltalk.withContext(function($ctx1) {
  25969. var $2,$3,$1;
  25970. $2=_st(aLexicalScopeClass)._new();
  25971. _st($2)._outerScope_(self["@currentScope"]);
  25972. $3=_st($2)._yourself();
  25973. $1=$3;
  25974. return $1;
  25975. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},smalltalk.SemanticAnalyzer)})},
  25976. args: ["aLexicalScopeClass"],
  25977. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  25978. messageSends: ["outerScope:", "new", "yourself"],
  25979. referencedClasses: []
  25980. }),
  25981. smalltalk.SemanticAnalyzer);
  25982. smalltalk.addMethod(
  25983. smalltalk.method({
  25984. selector: "popScope",
  25985. category: 'scope',
  25986. fn: function (){
  25987. var self=this;
  25988. return smalltalk.withContext(function($ctx1) {
  25989. var $1;
  25990. $1=self["@currentScope"];
  25991. if(($receiver = $1) == nil || $receiver == undefined){
  25992. $1;
  25993. } else {
  25994. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  25995. self["@currentScope"];
  25996. };
  25997. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},smalltalk.SemanticAnalyzer)})},
  25998. args: [],
  25999. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  26000. messageSends: ["ifNotNil:", "outerScope"],
  26001. referencedClasses: []
  26002. }),
  26003. smalltalk.SemanticAnalyzer);
  26004. smalltalk.addMethod(
  26005. smalltalk.method({
  26006. selector: "pushScope:",
  26007. category: 'scope',
  26008. fn: function (aScope){
  26009. var self=this;
  26010. return smalltalk.withContext(function($ctx1) {
  26011. _st(aScope)._outerScope_(self["@currentScope"]);
  26012. self["@currentScope"]=aScope;
  26013. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},smalltalk.SemanticAnalyzer)})},
  26014. args: ["aScope"],
  26015. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  26016. messageSends: ["outerScope:"],
  26017. referencedClasses: []
  26018. }),
  26019. smalltalk.SemanticAnalyzer);
  26020. smalltalk.addMethod(
  26021. smalltalk.method({
  26022. selector: "superSends",
  26023. category: 'accessing',
  26024. fn: function (){
  26025. var self=this;
  26026. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26027. return smalltalk.withContext(function($ctx1) {
  26028. var $2,$1;
  26029. $2=self["@superSends"];
  26030. if(($receiver = $2) == nil || $receiver == undefined){
  26031. self["@superSends"]=_st($Dictionary())._new();
  26032. $1=self["@superSends"];
  26033. } else {
  26034. $1=$2;
  26035. };
  26036. return $1;
  26037. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.SemanticAnalyzer)})},
  26038. args: [],
  26039. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  26040. messageSends: ["ifNil:", "new"],
  26041. referencedClasses: ["Dictionary"]
  26042. }),
  26043. smalltalk.SemanticAnalyzer);
  26044. smalltalk.addMethod(
  26045. smalltalk.method({
  26046. selector: "theClass",
  26047. category: 'accessing',
  26048. fn: function (){
  26049. var self=this;
  26050. return smalltalk.withContext(function($ctx1) {
  26051. var $1;
  26052. $1=self["@theClass"];
  26053. return $1;
  26054. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SemanticAnalyzer)})},
  26055. args: [],
  26056. source: "theClass\x0a\x09^ theClass",
  26057. messageSends: [],
  26058. referencedClasses: []
  26059. }),
  26060. smalltalk.SemanticAnalyzer);
  26061. smalltalk.addMethod(
  26062. smalltalk.method({
  26063. selector: "theClass:",
  26064. category: 'accessing',
  26065. fn: function (aClass){
  26066. var self=this;
  26067. return smalltalk.withContext(function($ctx1) {
  26068. self["@theClass"]=aClass;
  26069. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SemanticAnalyzer)})},
  26070. args: ["aClass"],
  26071. source: "theClass: aClass\x0a\x09theClass := aClass",
  26072. messageSends: [],
  26073. referencedClasses: []
  26074. }),
  26075. smalltalk.SemanticAnalyzer);
  26076. smalltalk.addMethod(
  26077. smalltalk.method({
  26078. selector: "validateVariableScope:",
  26079. category: 'scope',
  26080. fn: function (aString){
  26081. var self=this;
  26082. return smalltalk.withContext(function($ctx1) {
  26083. var $1;
  26084. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  26085. if(($receiver = $1) == nil || $receiver == undefined){
  26086. $1;
  26087. } else {
  26088. self._errorShadowingVariable_(aString);
  26089. };
  26090. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  26091. args: ["aString"],
  26092. 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 ]",
  26093. messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
  26094. referencedClasses: []
  26095. }),
  26096. smalltalk.SemanticAnalyzer);
  26097. smalltalk.addMethod(
  26098. smalltalk.method({
  26099. selector: "visitAssignmentNode:",
  26100. category: 'visiting',
  26101. fn: function (aNode){
  26102. var self=this;
  26103. return smalltalk.withContext(function($ctx1) {
  26104. smalltalk.NodeVisitor.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  26105. _st(_st(aNode)._left())._beAssigned();
  26106. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26107. args: ["aNode"],
  26108. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  26109. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  26110. referencedClasses: []
  26111. }),
  26112. smalltalk.SemanticAnalyzer);
  26113. smalltalk.addMethod(
  26114. smalltalk.method({
  26115. selector: "visitBlockNode:",
  26116. category: 'visiting',
  26117. fn: function (aNode){
  26118. var self=this;
  26119. return smalltalk.withContext(function($ctx1) {
  26120. self._pushScope_(self._newBlockScope());
  26121. _st(aNode)._scope_(self["@currentScope"]);
  26122. _st(self["@currentScope"])._node_(aNode);
  26123. _st(_st(aNode)._parameters())._do_((function(each){
  26124. return smalltalk.withContext(function($ctx2) {
  26125. self._validateVariableScope_(each);
  26126. return _st(self["@currentScope"])._addArg_(each);
  26127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26128. smalltalk.NodeVisitor.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  26129. self._popScope();
  26130. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26131. args: ["aNode"],
  26132. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  26133. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
  26134. referencedClasses: []
  26135. }),
  26136. smalltalk.SemanticAnalyzer);
  26137. smalltalk.addMethod(
  26138. smalltalk.method({
  26139. selector: "visitCascadeNode:",
  26140. category: 'visiting',
  26141. fn: function (aNode){
  26142. var self=this;
  26143. return smalltalk.withContext(function($ctx1) {
  26144. var $1;
  26145. _st(_st(aNode)._nodes())._do_((function(each){
  26146. return smalltalk.withContext(function($ctx2) {
  26147. return _st(each)._receiver_(_st(aNode)._receiver());
  26148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26149. smalltalk.NodeVisitor.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  26150. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  26151. if(smalltalk.assert($1)){
  26152. _st(_st(aNode)._nodes())._do_((function(each){
  26153. return smalltalk.withContext(function($ctx2) {
  26154. return _st(each)._superSend_(true);
  26155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26156. };
  26157. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26158. args: ["aNode"],
  26159. source: "visitCascadeNode: aNode\x0a\x09\x22Populate the receiver into all children\x22\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09each receiver: aNode receiver ].\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ]]",
  26160. messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
  26161. referencedClasses: []
  26162. }),
  26163. smalltalk.SemanticAnalyzer);
  26164. smalltalk.addMethod(
  26165. smalltalk.method({
  26166. selector: "visitClassReferenceNode:",
  26167. category: 'visiting',
  26168. fn: function (aNode){
  26169. var self=this;
  26170. function $ClassRefVar(){return smalltalk.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  26171. return smalltalk.withContext(function($ctx1) {
  26172. var $1,$2;
  26173. _st(self._classReferences())._add_(_st(aNode)._value());
  26174. $1=_st($ClassRefVar())._new();
  26175. _st($1)._name_(_st(aNode)._value());
  26176. $2=_st($1)._yourself();
  26177. _st(aNode)._binding_($2);
  26178. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26179. args: ["aNode"],
  26180. source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
  26181. messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
  26182. referencedClasses: ["ClassRefVar"]
  26183. }),
  26184. smalltalk.SemanticAnalyzer);
  26185. smalltalk.addMethod(
  26186. smalltalk.method({
  26187. selector: "visitMethodNode:",
  26188. category: 'visiting',
  26189. fn: function (aNode){
  26190. var self=this;
  26191. return smalltalk.withContext(function($ctx1) {
  26192. var $1,$2;
  26193. self._pushScope_(self._newMethodScope());
  26194. _st(aNode)._scope_(self["@currentScope"]);
  26195. _st(self["@currentScope"])._node_(aNode);
  26196. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  26197. return smalltalk.withContext(function($ctx2) {
  26198. return _st(self["@currentScope"])._addIVar_(each);
  26199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26200. _st(_st(aNode)._arguments())._do_((function(each){
  26201. return smalltalk.withContext(function($ctx2) {
  26202. self._validateVariableScope_(each);
  26203. return _st(self["@currentScope"])._addArg_(each);
  26204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26205. smalltalk.NodeVisitor.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  26206. $1=aNode;
  26207. _st($1)._classReferences_(self._classReferences());
  26208. _st($1)._messageSends_(_st(self._messageSends())._keys());
  26209. $2=_st($1)._superSends_(_st(self._superSends())._keys());
  26210. self._popScope();
  26211. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26212. args: ["aNode"],
  26213. 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\x09messageSends: self messageSends keys;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  26214. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"],
  26215. referencedClasses: []
  26216. }),
  26217. smalltalk.SemanticAnalyzer);
  26218. smalltalk.addMethod(
  26219. smalltalk.method({
  26220. selector: "visitReturnNode:",
  26221. category: 'visiting',
  26222. fn: function (aNode){
  26223. var self=this;
  26224. return smalltalk.withContext(function($ctx1) {
  26225. var $1;
  26226. _st(aNode)._scope_(self["@currentScope"]);
  26227. $1=_st(self["@currentScope"])._isMethodScope();
  26228. if(smalltalk.assert($1)){
  26229. _st(self["@currentScope"])._localReturn_(true);
  26230. } else {
  26231. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  26232. };
  26233. smalltalk.NodeVisitor.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  26234. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26235. args: ["aNode"],
  26236. 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",
  26237. messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
  26238. referencedClasses: []
  26239. }),
  26240. smalltalk.SemanticAnalyzer);
  26241. smalltalk.addMethod(
  26242. smalltalk.method({
  26243. selector: "visitSendNode:",
  26244. category: 'visiting',
  26245. fn: function (aNode){
  26246. var self=this;
  26247. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  26248. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  26249. return smalltalk.withContext(function($ctx1) {
  26250. var $1,$2;
  26251. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  26252. if(smalltalk.assert($1)){
  26253. _st(aNode)._superSend_(true);
  26254. _st(_st(aNode)._receiver())._value_("self");
  26255. _st(self._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  26256. return smalltalk.withContext(function($ctx2) {
  26257. return _st($Set())._new();
  26258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26259. _st(_st(self._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  26260. } else {
  26261. $2=_st(_st($IRSendInliner())._inlinedSelectors())._includes_(_st(aNode)._selector());
  26262. if(smalltalk.assert($2)){
  26263. _st(aNode)._shouldBeInlined_(true);
  26264. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  26265. };
  26266. };
  26267. _st(self._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  26268. return smalltalk.withContext(function($ctx2) {
  26269. return _st($Set())._new();
  26270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26271. _st(_st(self._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  26272. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  26273. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  26274. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26275. args: ["aNode"],
  26276. 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 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",
  26277. messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "at:ifAbsentPut:", "selector", "new", "superSends", "add:", "at:", "ifTrue:", "shouldBeInlined:", "shouldBeAliased:", "includes:", "inlinedSelectors", "=", "value", "messageSends", "index:", "size", "visitSendNode:"],
  26278. referencedClasses: ["Set", "IRSendInliner"]
  26279. }),
  26280. smalltalk.SemanticAnalyzer);
  26281. smalltalk.addMethod(
  26282. smalltalk.method({
  26283. selector: "visitSequenceNode:",
  26284. category: 'visiting',
  26285. fn: function (aNode){
  26286. var self=this;
  26287. return smalltalk.withContext(function($ctx1) {
  26288. _st(_st(aNode)._temps())._do_((function(each){
  26289. return smalltalk.withContext(function($ctx2) {
  26290. self._validateVariableScope_(each);
  26291. return _st(self["@currentScope"])._addTemp_(each);
  26292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  26293. smalltalk.NodeVisitor.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  26294. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26295. args: ["aNode"],
  26296. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  26297. messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
  26298. referencedClasses: []
  26299. }),
  26300. smalltalk.SemanticAnalyzer);
  26301. smalltalk.addMethod(
  26302. smalltalk.method({
  26303. selector: "visitVariableNode:",
  26304. category: 'visiting',
  26305. fn: function (aNode){
  26306. var self=this;
  26307. function $UnknownVar(){return smalltalk.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  26308. return smalltalk.withContext(function($ctx1) {
  26309. var $1,$3,$4,$5,$2;
  26310. $1=aNode;
  26311. $3=_st(self["@currentScope"])._lookupVariable_(aNode);
  26312. if(($receiver = $3) == nil || $receiver == undefined){
  26313. self._errorUnknownVariable_(aNode);
  26314. $4=_st($UnknownVar())._new();
  26315. _st($4)._name_(_st(aNode)._value());
  26316. $5=_st($4)._yourself();
  26317. $2=$5;
  26318. } else {
  26319. $2=$3;
  26320. };
  26321. _st($1)._binding_($2);
  26322. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  26323. args: ["aNode"],
  26324. 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\x09aNode binding: ((currentScope lookupVariable: aNode) ifNil: [\x0a\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09UnknownVar new name: aNode value; yourself ])",
  26325. messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
  26326. referencedClasses: ["UnknownVar"]
  26327. }),
  26328. smalltalk.SemanticAnalyzer);
  26329. smalltalk.addMethod(
  26330. smalltalk.method({
  26331. selector: "on:",
  26332. category: 'instance creation',
  26333. fn: function (aClass){
  26334. var self=this;
  26335. return smalltalk.withContext(function($ctx1) {
  26336. var $2,$3,$1;
  26337. $2=self._new();
  26338. _st($2)._theClass_(aClass);
  26339. $3=_st($2)._yourself();
  26340. $1=$3;
  26341. return $1;
  26342. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},smalltalk.SemanticAnalyzer.klass)})},
  26343. args: ["aClass"],
  26344. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  26345. messageSends: ["theClass:", "new", "yourself"],
  26346. referencedClasses: []
  26347. }),
  26348. smalltalk.SemanticAnalyzer.klass);
  26349. smalltalk.addPackage('Compiler-Interpreter');
  26350. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
  26351. smalltalk.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)";
  26352. smalltalk.addMethod(
  26353. smalltalk.method({
  26354. selector: "asString",
  26355. category: 'converting',
  26356. fn: function (){
  26357. var self=this;
  26358. return smalltalk.withContext(function($ctx1) {
  26359. var $1;
  26360. $1=_st(self["@methodContext"])._asString();
  26361. return $1;
  26362. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AIContext)})},
  26363. args: [],
  26364. source: "asString\x0a\x09^ methodContext asString",
  26365. messageSends: ["asString"],
  26366. referencedClasses: []
  26367. }),
  26368. smalltalk.AIContext);
  26369. smalltalk.addMethod(
  26370. smalltalk.method({
  26371. selector: "home",
  26372. category: 'accessing',
  26373. fn: function (){
  26374. var self=this;
  26375. return smalltalk.withContext(function($ctx1) {
  26376. var $2,$1;
  26377. $2=self._isBlockContext();
  26378. if(smalltalk.assert($2)){
  26379. $1=_st(self._outerContext())._methodContext();
  26380. } else {
  26381. $1=self;
  26382. };
  26383. return $1;
  26384. }, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.AIContext)})},
  26385. args: [],
  26386. source: "home\x0a\x09^ self isBlockContext \x0a\x09\x09ifTrue: [ self outerContext methodContext ]\x0a\x09\x09ifFalse: [ self ]",
  26387. messageSends: ["ifTrue:ifFalse:", "methodContext", "outerContext", "isBlockContext"],
  26388. referencedClasses: []
  26389. }),
  26390. smalltalk.AIContext);
  26391. smalltalk.addMethod(
  26392. smalltalk.method({
  26393. selector: "initializeFromMethodContext:",
  26394. category: 'initialization',
  26395. fn: function (aMethodContext){
  26396. var self=this;
  26397. return smalltalk.withContext(function($ctx1) {
  26398. var $1,$2;
  26399. self["@methodContext"]=aMethodContext;
  26400. self._pc_(_st(aMethodContext)._pc());
  26401. self._receiver_(_st(aMethodContext)._receiver());
  26402. self._method_(_st(aMethodContext)._method());
  26403. $1=_st(aMethodContext)._outerContext();
  26404. if(($receiver = $1) == nil || $receiver == undefined){
  26405. $1;
  26406. } else {
  26407. var outer;
  26408. outer=$receiver;
  26409. $2=_st(outer)._methodContext();
  26410. if(($receiver = $2) == nil || $receiver == undefined){
  26411. $2;
  26412. } else {
  26413. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  26414. };
  26415. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  26416. return smalltalk.withContext(function($ctx2) {
  26417. return _st(self._locals())._at_put_(key,value);
  26418. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  26419. };
  26420. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  26421. args: ["aMethodContext"],
  26422. source: "initializeFromMethodContext: aMethodContext\x0a\x09methodContext := aMethodContext.\x0a\x09\x0a\x09self pc: aMethodContext pc.\x0a\x09self receiver: aMethodContext receiver.\x0a\x09self method: aMethodContext method.\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 ] ]",
  26423. messageSends: ["pc:", "pc", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "methodContext", "keysAndValuesDo:", "at:put:", "locals"],
  26424. referencedClasses: []
  26425. }),
  26426. smalltalk.AIContext);
  26427. smalltalk.addMethod(
  26428. smalltalk.method({
  26429. selector: "initializeLocals",
  26430. category: 'initialization',
  26431. fn: function (){
  26432. var self=this;
  26433. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26434. return smalltalk.withContext(function($ctx1) {
  26435. self["@locals"]=_st($Dictionary())._new();
  26436. _st(self["@locals"])._at_put_("thisContext",self);
  26437. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  26438. args: [],
  26439. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  26440. messageSends: ["new", "at:put:"],
  26441. referencedClasses: ["Dictionary"]
  26442. }),
  26443. smalltalk.AIContext);
  26444. smalltalk.addMethod(
  26445. smalltalk.method({
  26446. selector: "isBlockContext",
  26447. category: 'testing',
  26448. fn: function (){
  26449. var self=this;
  26450. return smalltalk.withContext(function($ctx1) {
  26451. var $1;
  26452. $1=_st(self["@methodContext"])._isBlockContext();
  26453. return $1;
  26454. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.AIContext)})},
  26455. args: [],
  26456. source: "isBlockContext\x0a\x09^ methodContext isBlockContext",
  26457. messageSends: ["isBlockContext"],
  26458. referencedClasses: []
  26459. }),
  26460. smalltalk.AIContext);
  26461. smalltalk.addMethod(
  26462. smalltalk.method({
  26463. selector: "localAt:",
  26464. category: 'accessing',
  26465. fn: function (aString){
  26466. var self=this;
  26467. return smalltalk.withContext(function($ctx1) {
  26468. var $1;
  26469. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  26470. return smalltalk.withContext(function($ctx2) {
  26471. return nil;
  26472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26473. return $1;
  26474. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  26475. args: ["aString"],
  26476. source: "localAt: aString\x0a\x09^ self locals at: aString ifAbsent: [ nil ]",
  26477. messageSends: ["at:ifAbsent:", "locals"],
  26478. referencedClasses: []
  26479. }),
  26480. smalltalk.AIContext);
  26481. smalltalk.addMethod(
  26482. smalltalk.method({
  26483. selector: "localAt:put:",
  26484. category: 'accessing',
  26485. fn: function (aString,anObject){
  26486. var self=this;
  26487. return smalltalk.withContext(function($ctx1) {
  26488. _st(self._locals())._at_put_(aString,anObject);
  26489. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  26490. args: ["aString", "anObject"],
  26491. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  26492. messageSends: ["at:put:", "locals"],
  26493. referencedClasses: []
  26494. }),
  26495. smalltalk.AIContext);
  26496. smalltalk.addMethod(
  26497. smalltalk.method({
  26498. selector: "locals",
  26499. category: 'accessing',
  26500. fn: function (){
  26501. var self=this;
  26502. return smalltalk.withContext(function($ctx1) {
  26503. var $1,$2;
  26504. $1=self["@locals"];
  26505. if(($receiver = $1) == nil || $receiver == undefined){
  26506. self._initializeLocals();
  26507. } else {
  26508. $1;
  26509. };
  26510. $2=self["@locals"];
  26511. return $2;
  26512. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  26513. args: [],
  26514. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  26515. messageSends: ["ifNil:", "initializeLocals"],
  26516. referencedClasses: []
  26517. }),
  26518. smalltalk.AIContext);
  26519. smalltalk.addMethod(
  26520. smalltalk.method({
  26521. selector: "method",
  26522. category: 'accessing',
  26523. fn: function (){
  26524. var self=this;
  26525. return smalltalk.withContext(function($ctx1) {
  26526. var $1;
  26527. $1=self["@method"];
  26528. return $1;
  26529. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  26530. args: [],
  26531. source: "method\x0a\x09^ method",
  26532. messageSends: [],
  26533. referencedClasses: []
  26534. }),
  26535. smalltalk.AIContext);
  26536. smalltalk.addMethod(
  26537. smalltalk.method({
  26538. selector: "method:",
  26539. category: 'accessing',
  26540. fn: function (aCompiledMethod){
  26541. var self=this;
  26542. return smalltalk.withContext(function($ctx1) {
  26543. self["@method"]=aCompiledMethod;
  26544. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  26545. args: ["aCompiledMethod"],
  26546. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  26547. messageSends: [],
  26548. referencedClasses: []
  26549. }),
  26550. smalltalk.AIContext);
  26551. smalltalk.addMethod(
  26552. smalltalk.method({
  26553. selector: "outerContext",
  26554. category: 'accessing',
  26555. fn: function (){
  26556. var self=this;
  26557. return smalltalk.withContext(function($ctx1) {
  26558. var $1;
  26559. $1=self["@outerContext"];
  26560. return $1;
  26561. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  26562. args: [],
  26563. source: "outerContext\x0a\x09^ outerContext",
  26564. messageSends: [],
  26565. referencedClasses: []
  26566. }),
  26567. smalltalk.AIContext);
  26568. smalltalk.addMethod(
  26569. smalltalk.method({
  26570. selector: "outerContext:",
  26571. category: 'accessing',
  26572. fn: function (anAIContext){
  26573. var self=this;
  26574. return smalltalk.withContext(function($ctx1) {
  26575. self["@outerContext"]=anAIContext;
  26576. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  26577. args: ["anAIContext"],
  26578. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext",
  26579. messageSends: [],
  26580. referencedClasses: []
  26581. }),
  26582. smalltalk.AIContext);
  26583. smalltalk.addMethod(
  26584. smalltalk.method({
  26585. selector: "pc",
  26586. category: 'accessing',
  26587. fn: function (){
  26588. var self=this;
  26589. return smalltalk.withContext(function($ctx1) {
  26590. var $2,$1;
  26591. $2=self["@pc"];
  26592. if(($receiver = $2) == nil || $receiver == undefined){
  26593. self["@pc"]=(0);
  26594. $1=self["@pc"];
  26595. } else {
  26596. $1=$2;
  26597. };
  26598. return $1;
  26599. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  26600. args: [],
  26601. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  26602. messageSends: ["ifNil:"],
  26603. referencedClasses: []
  26604. }),
  26605. smalltalk.AIContext);
  26606. smalltalk.addMethod(
  26607. smalltalk.method({
  26608. selector: "pc:",
  26609. category: 'accessing',
  26610. fn: function (anInteger){
  26611. var self=this;
  26612. return smalltalk.withContext(function($ctx1) {
  26613. self["@pc"]=anInteger;
  26614. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  26615. args: ["anInteger"],
  26616. source: "pc: anInteger\x0a\x09pc := anInteger",
  26617. messageSends: [],
  26618. referencedClasses: []
  26619. }),
  26620. smalltalk.AIContext);
  26621. smalltalk.addMethod(
  26622. smalltalk.method({
  26623. selector: "receiver",
  26624. category: 'accessing',
  26625. fn: function (){
  26626. var self=this;
  26627. return smalltalk.withContext(function($ctx1) {
  26628. var $1;
  26629. $1=self._localAt_("self");
  26630. return $1;
  26631. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  26632. args: [],
  26633. source: "receiver\x0a\x09^ self localAt: 'self'",
  26634. messageSends: ["localAt:"],
  26635. referencedClasses: []
  26636. }),
  26637. smalltalk.AIContext);
  26638. smalltalk.addMethod(
  26639. smalltalk.method({
  26640. selector: "receiver:",
  26641. category: 'accessing',
  26642. fn: function (anObject){
  26643. var self=this;
  26644. return smalltalk.withContext(function($ctx1) {
  26645. self._localAt_put_("self",anObject);
  26646. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  26647. args: ["anObject"],
  26648. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  26649. messageSends: ["localAt:put:"],
  26650. referencedClasses: []
  26651. }),
  26652. smalltalk.AIContext);
  26653. smalltalk.addMethod(
  26654. smalltalk.method({
  26655. selector: "selector",
  26656. category: 'accessing',
  26657. fn: function (){
  26658. var self=this;
  26659. return smalltalk.withContext(function($ctx1) {
  26660. var $2,$1;
  26661. $2=self._method();
  26662. if(($receiver = $2) == nil || $receiver == undefined){
  26663. $1=$2;
  26664. } else {
  26665. $1=_st(self._method())._selector();
  26666. };
  26667. return $1;
  26668. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  26669. args: [],
  26670. source: "selector\x0a\x09^ self method\x0a\x09\x09ifNotNil: [ self method selector ]",
  26671. messageSends: ["ifNotNil:", "selector", "method"],
  26672. referencedClasses: []
  26673. }),
  26674. smalltalk.AIContext);
  26675. smalltalk.addMethod(
  26676. smalltalk.method({
  26677. selector: "fromMethodContext:",
  26678. category: 'instance creation',
  26679. fn: function (aMethodContext){
  26680. var self=this;
  26681. return smalltalk.withContext(function($ctx1) {
  26682. var $2,$3,$1;
  26683. $2=self._new();
  26684. _st($2)._initializeFromMethodContext_(aMethodContext);
  26685. $3=_st($2)._yourself();
  26686. $1=$3;
  26687. return $1;
  26688. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  26689. args: ["aMethodContext"],
  26690. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  26691. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  26692. referencedClasses: []
  26693. }),
  26694. smalltalk.AIContext.klass);
  26695. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  26696. smalltalk.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTSteppingInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from a `MethodContext` 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.";
  26697. smalltalk.addMethod(
  26698. smalltalk.method({
  26699. selector: "atEnd",
  26700. category: 'testing',
  26701. fn: function (){
  26702. var self=this;
  26703. return smalltalk.withContext(function($ctx1) {
  26704. var $1;
  26705. $1=_st(self._interpreter())._atEnd();
  26706. return $1;
  26707. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  26708. args: [],
  26709. source: "atEnd\x0a\x09^ self interpreter atEnd",
  26710. messageSends: ["atEnd", "interpreter"],
  26711. referencedClasses: []
  26712. }),
  26713. smalltalk.ASTDebugger);
  26714. smalltalk.addMethod(
  26715. smalltalk.method({
  26716. selector: "buildAST",
  26717. category: 'initialization',
  26718. fn: function (){
  26719. var self=this;
  26720. var ast;
  26721. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26722. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  26723. return smalltalk.withContext(function($ctx1) {
  26724. var $1;
  26725. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  26726. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  26727. $1=ast;
  26728. return $1;
  26729. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  26730. args: [],
  26731. source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk current parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
  26732. messageSends: ["parse:", "source", "method", "current", "visit:", "on:", "class", "receiver", "context"],
  26733. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  26734. }),
  26735. smalltalk.ASTDebugger);
  26736. smalltalk.addMethod(
  26737. smalltalk.method({
  26738. selector: "context",
  26739. category: 'accessing',
  26740. fn: function (){
  26741. var self=this;
  26742. return smalltalk.withContext(function($ctx1) {
  26743. var $1;
  26744. $1=self["@context"];
  26745. return $1;
  26746. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  26747. args: [],
  26748. source: "context\x0a\x09^ context",
  26749. messageSends: [],
  26750. referencedClasses: []
  26751. }),
  26752. smalltalk.ASTDebugger);
  26753. smalltalk.addMethod(
  26754. smalltalk.method({
  26755. selector: "context:",
  26756. category: 'accessing',
  26757. fn: function (aContext){
  26758. var self=this;
  26759. return smalltalk.withContext(function($ctx1) {
  26760. self["@context"]=aContext;
  26761. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  26762. args: ["aContext"],
  26763. source: "context: aContext\x0a\x09context := aContext",
  26764. messageSends: [],
  26765. referencedClasses: []
  26766. }),
  26767. smalltalk.ASTDebugger);
  26768. smalltalk.addMethod(
  26769. smalltalk.method({
  26770. selector: "defaultInterpreterClass",
  26771. category: 'defaults',
  26772. fn: function (){
  26773. var self=this;
  26774. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  26775. return smalltalk.withContext(function($ctx1) {
  26776. var $1;
  26777. $1=$ASTSteppingInterpreter();
  26778. return $1;
  26779. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  26780. args: [],
  26781. source: "defaultInterpreterClass\x0a\x09^ ASTSteppingInterpreter",
  26782. messageSends: [],
  26783. referencedClasses: ["ASTSteppingInterpreter"]
  26784. }),
  26785. smalltalk.ASTDebugger);
  26786. smalltalk.addMethod(
  26787. smalltalk.method({
  26788. selector: "initializeInterpreter",
  26789. category: 'initialization',
  26790. fn: function (){
  26791. var self=this;
  26792. var ast,next;
  26793. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  26794. return smalltalk.withContext(function($ctx1) {
  26795. var $1,$2;
  26796. ast=self._buildAST();
  26797. $1=_st($ASTPCNodeVisitor())._new();
  26798. _st($1)._context_(self._context());
  26799. _st($1)._visit_(ast);
  26800. $2=_st($1)._currentNode();
  26801. next=$2;
  26802. _st(self._interpreter())._interpret_(next);
  26803. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  26804. args: [],
  26805. source: "initializeInterpreter\x0a\x09| ast next |\x0a\x09ast := self buildAST.\x0a\x09next := ASTPCNodeVisitor new\x0a\x09\x09context: self context;\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode.\x0a\x09self interpreter interpret: next",
  26806. messageSends: ["buildAST", "context:", "context", "new", "visit:", "currentNode", "interpret:", "interpreter"],
  26807. referencedClasses: ["ASTPCNodeVisitor"]
  26808. }),
  26809. smalltalk.ASTDebugger);
  26810. smalltalk.addMethod(
  26811. smalltalk.method({
  26812. selector: "initializeWithContext:",
  26813. category: 'initialization',
  26814. fn: function (aContext){
  26815. var self=this;
  26816. return smalltalk.withContext(function($ctx1) {
  26817. self._context_(aContext);
  26818. self._initializeInterpreter();
  26819. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  26820. args: ["aContext"],
  26821. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  26822. messageSends: ["context:", "initializeInterpreter"],
  26823. referencedClasses: []
  26824. }),
  26825. smalltalk.ASTDebugger);
  26826. smalltalk.addMethod(
  26827. smalltalk.method({
  26828. selector: "interpreter",
  26829. category: 'accessing',
  26830. fn: function (){
  26831. var self=this;
  26832. return smalltalk.withContext(function($ctx1) {
  26833. var $2,$1;
  26834. $2=self["@interpreter"];
  26835. if(($receiver = $2) == nil || $receiver == undefined){
  26836. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  26837. $1=self["@interpreter"];
  26838. } else {
  26839. $1=$2;
  26840. };
  26841. return $1;
  26842. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  26843. args: [],
  26844. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  26845. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  26846. referencedClasses: []
  26847. }),
  26848. smalltalk.ASTDebugger);
  26849. smalltalk.addMethod(
  26850. smalltalk.method({
  26851. selector: "interpreter:",
  26852. category: 'accessing',
  26853. fn: function (anInterpreter){
  26854. var self=this;
  26855. return smalltalk.withContext(function($ctx1) {
  26856. self["@interpreter"]=anInterpreter;
  26857. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  26858. args: ["anInterpreter"],
  26859. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  26860. messageSends: [],
  26861. referencedClasses: []
  26862. }),
  26863. smalltalk.ASTDebugger);
  26864. smalltalk.addMethod(
  26865. smalltalk.method({
  26866. selector: "method",
  26867. category: 'accessing',
  26868. fn: function (){
  26869. var self=this;
  26870. return smalltalk.withContext(function($ctx1) {
  26871. var $1;
  26872. $1=_st(self._context())._method();
  26873. return $1;
  26874. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  26875. args: [],
  26876. source: "method\x0a\x09^ self context method",
  26877. messageSends: ["method", "context"],
  26878. referencedClasses: []
  26879. }),
  26880. smalltalk.ASTDebugger);
  26881. smalltalk.addMethod(
  26882. smalltalk.method({
  26883. selector: "nextNode",
  26884. category: 'accessing',
  26885. fn: function (){
  26886. var self=this;
  26887. return smalltalk.withContext(function($ctx1) {
  26888. var $1;
  26889. $1=_st(self._interpreter())._nextNode();
  26890. return $1;
  26891. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  26892. args: [],
  26893. source: "nextNode\x0a\x09^ self interpreter nextNode",
  26894. messageSends: ["nextNode", "interpreter"],
  26895. referencedClasses: []
  26896. }),
  26897. smalltalk.ASTDebugger);
  26898. smalltalk.addMethod(
  26899. smalltalk.method({
  26900. selector: "proceed",
  26901. category: 'stepping',
  26902. fn: function (){
  26903. var self=this;
  26904. return smalltalk.withContext(function($ctx1) {
  26905. self._shouldBeImplemented();
  26906. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  26907. args: [],
  26908. source: "proceed\x0a\x09self shouldBeImplemented",
  26909. messageSends: ["shouldBeImplemented"],
  26910. referencedClasses: []
  26911. }),
  26912. smalltalk.ASTDebugger);
  26913. smalltalk.addMethod(
  26914. smalltalk.method({
  26915. selector: "restart",
  26916. category: 'stepping',
  26917. fn: function (){
  26918. var self=this;
  26919. return smalltalk.withContext(function($ctx1) {
  26920. self._shouldBeImplemented();
  26921. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  26922. args: [],
  26923. source: "restart\x0a\x09self shouldBeImplemented",
  26924. messageSends: ["shouldBeImplemented"],
  26925. referencedClasses: []
  26926. }),
  26927. smalltalk.ASTDebugger);
  26928. smalltalk.addMethod(
  26929. smalltalk.method({
  26930. selector: "step",
  26931. category: 'stepping',
  26932. fn: function (){
  26933. var self=this;
  26934. return smalltalk.withContext(function($ctx1) {
  26935. _st((function(){
  26936. return smalltalk.withContext(function($ctx2) {
  26937. return _st(_st(_st(_st(self._interpreter())._nextNode())._notNil())._and_((function(){
  26938. return smalltalk.withContext(function($ctx3) {
  26939. return _st(_st(self._interpreter())._nextNode())._stopOnStepping();
  26940. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})})))._or_((function(){
  26941. return smalltalk.withContext(function($ctx3) {
  26942. return _st(_st(self._interpreter())._atEnd())._not();
  26943. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  26944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  26945. return smalltalk.withContext(function($ctx2) {
  26946. _st(self._interpreter())._step();
  26947. return self._step();
  26948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  26949. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  26950. args: [],
  26951. source: "step\x0a\x09\x22The ASTSteppingInterpreter stops at each node interpretation.\x0a\x09One step will interpret nodes until:\x0a\x09- we get at the end\x0a\x09- the next node is a stepping node (send, assignment, etc.)\x22\x0a\x09\x0a\x09[ (self interpreter nextNode notNil and: [ self interpreter nextNode stopOnStepping ])\x0a\x09\x09or: [ self interpreter atEnd not ] ]\x0a\x09\x09\x09whileFalse: [\x0a\x09\x09\x09\x09self interpreter step.\x0a\x09\x09\x09\x09self step ]",
  26952. messageSends: ["whileFalse:", "step", "interpreter", "or:", "not", "atEnd", "and:", "stopOnStepping", "nextNode", "notNil"],
  26953. referencedClasses: []
  26954. }),
  26955. smalltalk.ASTDebugger);
  26956. smalltalk.addMethod(
  26957. smalltalk.method({
  26958. selector: "stepInto",
  26959. category: 'stepping',
  26960. fn: function (){
  26961. var self=this;
  26962. return smalltalk.withContext(function($ctx1) {
  26963. self._shouldBeImplemented();
  26964. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  26965. args: [],
  26966. source: "stepInto\x0a\x09self shouldBeImplemented",
  26967. messageSends: ["shouldBeImplemented"],
  26968. referencedClasses: []
  26969. }),
  26970. smalltalk.ASTDebugger);
  26971. smalltalk.addMethod(
  26972. smalltalk.method({
  26973. selector: "stepOver",
  26974. category: 'stepping',
  26975. fn: function (){
  26976. var self=this;
  26977. return smalltalk.withContext(function($ctx1) {
  26978. self._step();
  26979. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  26980. args: [],
  26981. source: "stepOver\x0a\x09self step",
  26982. messageSends: ["step"],
  26983. referencedClasses: []
  26984. }),
  26985. smalltalk.ASTDebugger);
  26986. smalltalk.addMethod(
  26987. smalltalk.method({
  26988. selector: "context:",
  26989. category: 'instance creation',
  26990. fn: function (aContext){
  26991. var self=this;
  26992. return smalltalk.withContext(function($ctx1) {
  26993. var $2,$3,$1;
  26994. $2=self._new();
  26995. _st($2)._initializeWithContext_(aContext);
  26996. $3=_st($2)._yourself();
  26997. $1=$3;
  26998. return $1;
  26999. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  27000. args: ["aContext"],
  27001. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  27002. messageSends: ["initializeWithContext:", "new", "yourself"],
  27003. referencedClasses: []
  27004. }),
  27005. smalltalk.ASTDebugger.klass);
  27006. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  27007. smalltalk.ASTInterpreter.comment="I am like a `NodeVisitor`, interpreting nodes one after each other.\x0aI am built using Continuation Passing Style for stepping purposes.\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09ASTInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09result \x22Answers 7\x22";
  27008. smalltalk.addMethod(
  27009. smalltalk.method({
  27010. selector: "assign:to:",
  27011. category: 'private',
  27012. fn: function (aNode,anObject){
  27013. var self=this;
  27014. return smalltalk.withContext(function($ctx1) {
  27015. var $2,$1;
  27016. $2=_st(_st(aNode)._binding())._isInstanceVar();
  27017. if(smalltalk.assert($2)){
  27018. $1=_st(_st(self._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  27019. } else {
  27020. $1=_st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  27021. };
  27022. return $1;
  27023. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  27024. args: ["aNode", "anObject"],
  27025. source: "assign: aNode to: anObject\x0a\x09^ aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  27026. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"],
  27027. referencedClasses: []
  27028. }),
  27029. smalltalk.ASTInterpreter);
  27030. smalltalk.addMethod(
  27031. smalltalk.method({
  27032. selector: "context",
  27033. category: 'accessing',
  27034. fn: function (){
  27035. var self=this;
  27036. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  27037. return smalltalk.withContext(function($ctx1) {
  27038. var $2,$1;
  27039. $2=self["@context"];
  27040. if(($receiver = $2) == nil || $receiver == undefined){
  27041. self["@context"]=_st($AIContext())._new();
  27042. $1=self["@context"];
  27043. } else {
  27044. $1=$2;
  27045. };
  27046. return $1;
  27047. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  27048. args: [],
  27049. source: "context\x0a\x09^ context ifNil: [ context := AIContext new ]",
  27050. messageSends: ["ifNil:", "new"],
  27051. referencedClasses: ["AIContext"]
  27052. }),
  27053. smalltalk.ASTInterpreter);
  27054. smalltalk.addMethod(
  27055. smalltalk.method({
  27056. selector: "context:",
  27057. category: 'accessing',
  27058. fn: function (anAIContext){
  27059. var self=this;
  27060. return smalltalk.withContext(function($ctx1) {
  27061. self["@context"]=anAIContext;
  27062. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  27063. args: ["anAIContext"],
  27064. source: "context: anAIContext\x0a\x09context := anAIContext",
  27065. messageSends: [],
  27066. referencedClasses: []
  27067. }),
  27068. smalltalk.ASTInterpreter);
  27069. smalltalk.addMethod(
  27070. smalltalk.method({
  27071. selector: "continue:value:",
  27072. category: 'private',
  27073. fn: function (aBlock,anObject){
  27074. var self=this;
  27075. return smalltalk.withContext(function($ctx1) {
  27076. self["@result"]=anObject;
  27077. _st(aBlock)._value_(anObject);
  27078. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  27079. args: ["aBlock", "anObject"],
  27080. source: "continue: aBlock value: anObject\x0a\x09result := anObject.\x0a\x09aBlock value: anObject",
  27081. messageSends: ["value:"],
  27082. referencedClasses: []
  27083. }),
  27084. smalltalk.ASTInterpreter);
  27085. smalltalk.addMethod(
  27086. smalltalk.method({
  27087. selector: "currentNode",
  27088. category: 'accessing',
  27089. fn: function (){
  27090. var self=this;
  27091. return smalltalk.withContext(function($ctx1) {
  27092. var $1;
  27093. $1=self["@currentNode"];
  27094. return $1;
  27095. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  27096. args: [],
  27097. source: "currentNode\x0a\x09^ currentNode",
  27098. messageSends: [],
  27099. referencedClasses: []
  27100. }),
  27101. smalltalk.ASTInterpreter);
  27102. smalltalk.addMethod(
  27103. smalltalk.method({
  27104. selector: "eval:",
  27105. category: 'private',
  27106. fn: function (aString){
  27107. var self=this;
  27108. var source,function_;
  27109. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  27110. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  27111. return smalltalk.withContext(function($ctx1) {
  27112. var $1,$2,$3;
  27113. source=_st($String())._streamContents_((function(str){
  27114. return smalltalk.withContext(function($ctx2) {
  27115. _st(str)._nextPutAll_("(function(");
  27116. _st(_st(_st(self._context())._locals())._keys())._do_separatedBy_((function(each){
  27117. return smalltalk.withContext(function($ctx3) {
  27118. return _st(str)._nextPutAll_(each);
  27119. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}),(function(){
  27120. return smalltalk.withContext(function($ctx3) {
  27121. return _st(str)._nextPutAll_(",");
  27122. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27123. $1=str;
  27124. _st($1)._nextPutAll_("){ return (function() {");
  27125. _st($1)._nextPutAll_(aString);
  27126. $2=_st($1)._nextPutAll_("})() })");
  27127. return $2;
  27128. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  27129. function_=_st(_st($Compiler())._new())._eval_(source);
  27130. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  27131. return $3;
  27132. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  27133. args: ["aString"],
  27134. 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",
  27135. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  27136. referencedClasses: ["String", "Compiler"]
  27137. }),
  27138. smalltalk.ASTInterpreter);
  27139. smalltalk.addMethod(
  27140. smalltalk.method({
  27141. selector: "initialize",
  27142. category: 'initialization',
  27143. fn: function (){
  27144. var self=this;
  27145. return smalltalk.withContext(function($ctx1) {
  27146. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  27147. self["@shouldReturn"]=false;
  27148. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  27149. args: [],
  27150. source: "initialize\x0a\x09super initialize.\x0a\x09shouldReturn := false",
  27151. messageSends: ["initialize"],
  27152. referencedClasses: []
  27153. }),
  27154. smalltalk.ASTInterpreter);
  27155. smalltalk.addMethod(
  27156. smalltalk.method({
  27157. selector: "interpret:",
  27158. category: 'interpreting',
  27159. fn: function (aNode){
  27160. var self=this;
  27161. return smalltalk.withContext(function($ctx1) {
  27162. self["@shouldReturn"]=false;
  27163. self._interpret_continue_(aNode,(function(value){
  27164. return smalltalk.withContext(function($ctx2) {
  27165. self["@result"]=value;
  27166. return self["@result"];
  27167. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27168. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  27169. args: ["aNode"],
  27170. source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a\x09self interpret: aNode continue: [ :value |\x0a\x09\x09result := value ]",
  27171. messageSends: ["interpret:continue:"],
  27172. referencedClasses: []
  27173. }),
  27174. smalltalk.ASTInterpreter);
  27175. smalltalk.addMethod(
  27176. smalltalk.method({
  27177. selector: "interpret:continue:",
  27178. category: 'interpreting',
  27179. fn: function (aNode,aBlock){
  27180. var self=this;
  27181. return smalltalk.withContext(function($ctx1) {
  27182. var $1,$2,$3;
  27183. $1=self["@shouldReturn"];
  27184. if(smalltalk.assert($1)){
  27185. $2=self;
  27186. return $2;
  27187. };
  27188. $3=_st(aNode)._isNode();
  27189. if(smalltalk.assert($3)){
  27190. self["@currentNode"]=aNode;
  27191. self["@currentNode"];
  27192. self._interpretNode_continue_(aNode,(function(value){
  27193. return smalltalk.withContext(function($ctx2) {
  27194. return self._continue_value_(aBlock,value);
  27195. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27196. } else {
  27197. self._continue_value_(aBlock,aNode);
  27198. };
  27199. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27200. args: ["aNode", "aBlock"],
  27201. source: "interpret: aNode continue: aBlock\x0a\x09shouldReturn ifTrue: [ ^ self ].\x0a\x0a\x09aNode isNode\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09currentNode := aNode.\x0a\x09\x09\x09self interpretNode: aNode continue: [ :value |\x0a\x09\x09\x09\x09self continue: aBlock value: value ] ]\x0a\x09\x09ifFalse: [ self continue: aBlock value: aNode ]",
  27202. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"],
  27203. referencedClasses: []
  27204. }),
  27205. smalltalk.ASTInterpreter);
  27206. smalltalk.addMethod(
  27207. smalltalk.method({
  27208. selector: "interpretAll:continue:",
  27209. category: 'private',
  27210. fn: function (aCollection,aBlock){
  27211. var self=this;
  27212. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27213. return smalltalk.withContext(function($ctx1) {
  27214. self._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  27215. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27216. args: ["aCollection", "aBlock"],
  27217. source: "interpretAll: aCollection continue: aBlock\x0a\x09self\x0a\x09\x09interpretAll: aCollection\x0a\x09\x09continue: aBlock\x0a\x09\x09result: OrderedCollection new",
  27218. messageSends: ["interpretAll:continue:result:", "new"],
  27219. referencedClasses: ["OrderedCollection"]
  27220. }),
  27221. smalltalk.ASTInterpreter);
  27222. smalltalk.addMethod(
  27223. smalltalk.method({
  27224. selector: "interpretAll:continue:result:",
  27225. category: 'private',
  27226. fn: function (nodes,aBlock,aCollection){
  27227. var self=this;
  27228. return smalltalk.withContext(function($ctx1) {
  27229. var $1;
  27230. $1=_st(nodes)._isEmpty();
  27231. if(smalltalk.assert($1)){
  27232. self._continue_value_(aBlock,aCollection);
  27233. } else {
  27234. self._interpret_continue_(_st(nodes)._first(),(function(value){
  27235. return smalltalk.withContext(function($ctx2) {
  27236. return self._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  27237. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27238. };
  27239. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  27240. args: ["nodes", "aBlock", "aCollection"],
  27241. source: "interpretAll: nodes continue: aBlock result: aCollection\x0a\x09nodes isEmpty\x0a\x09\x09ifTrue: [ self continue: aBlock value: aCollection ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self interpret: nodes first continue: [:value |\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpretAll: nodes allButFirst\x0a\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09result: aCollection, { value } ] ]",
  27242. messageSends: ["ifTrue:ifFalse:", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"],
  27243. referencedClasses: []
  27244. }),
  27245. smalltalk.ASTInterpreter);
  27246. smalltalk.addMethod(
  27247. smalltalk.method({
  27248. selector: "interpretAssignmentNode:continue:",
  27249. category: 'interpreting',
  27250. fn: function (aNode,aBlock){
  27251. var self=this;
  27252. return smalltalk.withContext(function($ctx1) {
  27253. self._interpret_continue_(_st(aNode)._right(),(function(value){
  27254. return smalltalk.withContext(function($ctx2) {
  27255. return self._continue_value_(aBlock,self._assign_to_(_st(aNode)._left(),value));
  27256. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27257. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27258. args: ["aNode", "aBlock"],
  27259. source: "interpretAssignmentNode: aNode continue: aBlock\x0a\x09self interpret: aNode right continue: [ :value |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: (self assign: aNode left to: value) ]",
  27260. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"],
  27261. referencedClasses: []
  27262. }),
  27263. smalltalk.ASTInterpreter);
  27264. smalltalk.addMethod(
  27265. smalltalk.method({
  27266. selector: "interpretBlockNode:continue:",
  27267. category: 'interpreting',
  27268. fn: function (aNode,aBlock){
  27269. var self=this;
  27270. return smalltalk.withContext(function($ctx1) {
  27271. var $1,$2;
  27272. self._continue_value_(aBlock,(function(){
  27273. return smalltalk.withContext(function($ctx2) {
  27274. return self._withBlockContext_((function(){
  27275. return smalltalk.withContext(function($ctx3) {
  27276. $1=self;
  27277. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  27278. $2=_st($1)._result();
  27279. return $2;
  27280. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27282. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27283. args: ["aNode", "aBlock"],
  27284. source: "interpretBlockNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: [ \x0a\x09\x09\x09self withBlockContext: [ \x0a\x09\x09\x09\x09self interpret: aNode nodes first; result ] ]",
  27285. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"],
  27286. referencedClasses: []
  27287. }),
  27288. smalltalk.ASTInterpreter);
  27289. smalltalk.addMethod(
  27290. smalltalk.method({
  27291. selector: "interpretBlockSequenceNode:continue:",
  27292. category: 'interpreting',
  27293. fn: function (aNode,aBlock){
  27294. var self=this;
  27295. return smalltalk.withContext(function($ctx1) {
  27296. self._interpretSequenceNode_continue_(aNode,aBlock);
  27297. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27298. args: ["aNode", "aBlock"],
  27299. source: "interpretBlockSequenceNode: aNode continue: aBlock\x0a\x09self interpretSequenceNode: aNode continue: aBlock",
  27300. messageSends: ["interpretSequenceNode:continue:"],
  27301. referencedClasses: []
  27302. }),
  27303. smalltalk.ASTInterpreter);
  27304. smalltalk.addMethod(
  27305. smalltalk.method({
  27306. selector: "interpretCascadeNode:continue:",
  27307. category: 'interpreting',
  27308. fn: function (aNode,aBlock){
  27309. var self=this;
  27310. return smalltalk.withContext(function($ctx1) {
  27311. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  27312. return smalltalk.withContext(function($ctx2) {
  27313. _st(_st(aNode)._nodes())._do_((function(each){
  27314. return smalltalk.withContext(function($ctx3) {
  27315. return _st(each)._receiver_(receiver);
  27316. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  27317. return self._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  27318. return smalltalk.withContext(function($ctx3) {
  27319. return self._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  27320. return smalltalk.withContext(function($ctx4) {
  27321. return self._continue_value_(aBlock,val);
  27322. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx3)})}));
  27323. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  27324. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  27325. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27326. args: ["aNode", "aBlock"],
  27327. source: "interpretCascadeNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09\x22Only interpret the receiver once\x22\x0a\x09\x09aNode nodes do: [ :each | each receiver: receiver ].\x0a\x0a\x09\x09self\x0a\x09\x09\x09interpretAll: aNode nodes allButLast\x0a\x09\x09\x09continue: [\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpret: aNode nodes last\x0a\x09\x09\x09\x09\x09continue: [ :val | self continue: aBlock value: val ] ] ]",
  27328. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"],
  27329. referencedClasses: []
  27330. }),
  27331. smalltalk.ASTInterpreter);
  27332. smalltalk.addMethod(
  27333. smalltalk.method({
  27334. selector: "interpretClassReferenceNode:continue:",
  27335. category: 'interpreting',
  27336. fn: function (aNode,aBlock){
  27337. var self=this;
  27338. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27339. return smalltalk.withContext(function($ctx1) {
  27340. self._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  27341. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27342. args: ["aNode", "aBlock"],
  27343. source: "interpretClassReferenceNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: (Smalltalk current at: aNode value)",
  27344. messageSends: ["continue:value:", "at:", "value", "current"],
  27345. referencedClasses: ["Smalltalk"]
  27346. }),
  27347. smalltalk.ASTInterpreter);
  27348. smalltalk.addMethod(
  27349. smalltalk.method({
  27350. selector: "interpretDynamicArrayNode:continue:",
  27351. category: 'interpreting',
  27352. fn: function (aNode,aBlock){
  27353. var self=this;
  27354. return smalltalk.withContext(function($ctx1) {
  27355. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27356. return smalltalk.withContext(function($ctx2) {
  27357. return self._continue_value_(aBlock,array);
  27358. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27359. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27360. args: ["aNode", "aBlock"],
  27361. source: "interpretDynamicArrayNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: array ]",
  27362. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"],
  27363. referencedClasses: []
  27364. }),
  27365. smalltalk.ASTInterpreter);
  27366. smalltalk.addMethod(
  27367. smalltalk.method({
  27368. selector: "interpretDynamicDictionaryNode:continue:",
  27369. category: 'interpreting',
  27370. fn: function (aNode,aBlock){
  27371. var self=this;
  27372. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  27373. return smalltalk.withContext(function($ctx1) {
  27374. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27375. var hashedCollection;
  27376. return smalltalk.withContext(function($ctx2) {
  27377. hashedCollection=_st($HashedCollection())._new();
  27378. hashedCollection;
  27379. _st(array)._do_((function(each){
  27380. return smalltalk.withContext(function($ctx3) {
  27381. return _st(hashedCollection)._add_(each);
  27382. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  27383. return self._continue_value_(aBlock,hashedCollection);
  27384. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  27385. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27386. args: ["aNode", "aBlock"],
  27387. source: "interpretDynamicDictionaryNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array | | hashedCollection |\x0a\x09\x09hashedCollection := HashedCollection new.\x0a\x09\x09array do: [ :each | hashedCollection add: each ].\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: hashedCollection ]",
  27388. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"],
  27389. referencedClasses: ["HashedCollection"]
  27390. }),
  27391. smalltalk.ASTInterpreter);
  27392. smalltalk.addMethod(
  27393. smalltalk.method({
  27394. selector: "interpretJSStatementNode:continue:",
  27395. category: 'interpreting',
  27396. fn: function (aNode,aBlock){
  27397. var self=this;
  27398. return smalltalk.withContext(function($ctx1) {
  27399. self["@shouldReturn"]=true;
  27400. self._continue_value_(aBlock,self._eval_(_st(aNode)._source()));
  27401. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27402. args: ["aNode", "aBlock"],
  27403. source: "interpretJSStatementNode: aNode continue: aBlock\x0a\x09shouldReturn := true.\x0a\x09self continue: aBlock value: (self eval: aNode source)",
  27404. messageSends: ["continue:value:", "eval:", "source"],
  27405. referencedClasses: []
  27406. }),
  27407. smalltalk.ASTInterpreter);
  27408. smalltalk.addMethod(
  27409. smalltalk.method({
  27410. selector: "interpretMethodNode:continue:",
  27411. category: 'interpreting',
  27412. fn: function (aNode,aBlock){
  27413. var self=this;
  27414. return smalltalk.withContext(function($ctx1) {
  27415. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27416. return smalltalk.withContext(function($ctx2) {
  27417. return self._continue_value_(aBlock,_st(array)._first());
  27418. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27419. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27420. args: ["aNode", "aBlock"],
  27421. source: "interpretMethodNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array first ]",
  27422. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"],
  27423. referencedClasses: []
  27424. }),
  27425. smalltalk.ASTInterpreter);
  27426. smalltalk.addMethod(
  27427. smalltalk.method({
  27428. selector: "interpretNode:continue:",
  27429. category: 'interpreting',
  27430. fn: function (aNode,aBlock){
  27431. var self=this;
  27432. return smalltalk.withContext(function($ctx1) {
  27433. _st(aNode)._interpreter_continue_(self,aBlock);
  27434. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27435. args: ["aNode", "aBlock"],
  27436. source: "interpretNode: aNode continue: aBlock\x0a\x09aNode interpreter: self continue: aBlock",
  27437. messageSends: ["interpreter:continue:"],
  27438. referencedClasses: []
  27439. }),
  27440. smalltalk.ASTInterpreter);
  27441. smalltalk.addMethod(
  27442. smalltalk.method({
  27443. selector: "interpretReturnNode:continue:",
  27444. category: 'interpreting',
  27445. fn: function (aNode,aBlock){
  27446. var self=this;
  27447. return smalltalk.withContext(function($ctx1) {
  27448. self._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  27449. return smalltalk.withContext(function($ctx2) {
  27450. self["@shouldReturn"]=true;
  27451. self["@shouldReturn"];
  27452. return self._continue_value_(aBlock,value);
  27453. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  27454. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27455. args: ["aNode", "aBlock"],
  27456. source: "interpretReturnNode: aNode continue: aBlock\x0a\x09self interpret: aNode nodes first continue: [ :value |\x0a\x09\x09shouldReturn := true.\x0a\x09\x09self continue: aBlock value: value ]",
  27457. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"],
  27458. referencedClasses: []
  27459. }),
  27460. smalltalk.ASTInterpreter);
  27461. smalltalk.addMethod(
  27462. smalltalk.method({
  27463. selector: "interpretSendNode:continue:",
  27464. category: 'interpreting',
  27465. fn: function (aNode,aBlock){
  27466. var self=this;
  27467. return smalltalk.withContext(function($ctx1) {
  27468. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  27469. return smalltalk.withContext(function($ctx2) {
  27470. return self._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  27471. return smalltalk.withContext(function($ctx3) {
  27472. return self._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  27473. return smalltalk.withContext(function($ctx4) {
  27474. _st(self._context())._pc_(_st(_st(self._context())._pc()).__plus((1)));
  27475. return self._continue_value_(aBlock,self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend()));
  27476. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx3)})}));
  27477. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx2)})}));
  27478. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  27479. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27480. args: ["aNode", "aBlock"],
  27481. source: "interpretSendNode: aNode continue: aBlock\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09self interpretAll: aNode arguments continue: [ :args |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09messageFromSendNode: aNode\x0a\x09\x09\x09\x09arguments: args\x0a\x09\x09\x09\x09do: [ :message |\x0a\x09\x09\x09\x09\x09self context pc: self context pc + 1.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09\x09value: (self sendMessage: message to: receiver superSend: aNode superSend) ] ] ]",
  27482. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "+", "pc", "context", "continue:value:", "sendMessage:to:superSend:", "superSend"],
  27483. referencedClasses: []
  27484. }),
  27485. smalltalk.ASTInterpreter);
  27486. smalltalk.addMethod(
  27487. smalltalk.method({
  27488. selector: "interpretSequenceNode:continue:",
  27489. category: 'interpreting',
  27490. fn: function (aNode,aBlock){
  27491. var self=this;
  27492. return smalltalk.withContext(function($ctx1) {
  27493. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  27494. return smalltalk.withContext(function($ctx2) {
  27495. return self._continue_value_(aBlock,_st(array)._last());
  27496. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  27497. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27498. args: ["aNode", "aBlock"],
  27499. source: "interpretSequenceNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array last ]",
  27500. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"],
  27501. referencedClasses: []
  27502. }),
  27503. smalltalk.ASTInterpreter);
  27504. smalltalk.addMethod(
  27505. smalltalk.method({
  27506. selector: "interpretValueNode:continue:",
  27507. category: 'interpreting',
  27508. fn: function (aNode,aBlock){
  27509. var self=this;
  27510. return smalltalk.withContext(function($ctx1) {
  27511. self._continue_value_(aBlock,_st(aNode)._value());
  27512. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27513. args: ["aNode", "aBlock"],
  27514. source: "interpretValueNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: aNode value",
  27515. messageSends: ["continue:value:", "value"],
  27516. referencedClasses: []
  27517. }),
  27518. smalltalk.ASTInterpreter);
  27519. smalltalk.addMethod(
  27520. smalltalk.method({
  27521. selector: "interpretVariableNode:continue:",
  27522. category: 'interpreting',
  27523. fn: function (aNode,aBlock){
  27524. var self=this;
  27525. return smalltalk.withContext(function($ctx1) {
  27526. var $1,$2,$4,$3;
  27527. $1=self;
  27528. $2=aBlock;
  27529. $4=_st(_st(aNode)._binding())._isInstanceVar();
  27530. if(smalltalk.assert($4)){
  27531. $3=_st(_st(self._context())._receiver())._instVarAt_(_st(aNode)._value());
  27532. } else {
  27533. $3=_st(self._context())._localAt_(_st(aNode)._value());
  27534. };
  27535. _st($1)._continue_value_($2,$3);
  27536. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27537. args: ["aNode", "aBlock"],
  27538. source: "interpretVariableNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (aNode binding isInstanceVar\x0a\x09\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09\x09ifFalse: [ self context localAt: aNode value ])",
  27539. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"],
  27540. referencedClasses: []
  27541. }),
  27542. smalltalk.ASTInterpreter);
  27543. smalltalk.addMethod(
  27544. smalltalk.method({
  27545. selector: "messageFromSendNode:arguments:do:",
  27546. category: 'private',
  27547. fn: function (aSendNode,aCollection,aBlock){
  27548. var self=this;
  27549. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  27550. return smalltalk.withContext(function($ctx1) {
  27551. var $1,$2;
  27552. $1=_st($Message())._new();
  27553. _st($1)._selector_(_st(aSendNode)._selector());
  27554. _st($1)._arguments_(aCollection);
  27555. $2=_st($1)._yourself();
  27556. self._continue_value_(aBlock,$2);
  27557. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  27558. args: ["aSendNode", "aCollection", "aBlock"],
  27559. source: "messageFromSendNode: aSendNode arguments: aCollection do: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (Message new\x0a\x09\x09\x09selector: aSendNode selector;\x0a\x09\x09\x09arguments: aCollection;\x0a\x09\x09\x09yourself)",
  27560. messageSends: ["continue:value:", "selector:", "selector", "new", "arguments:", "yourself"],
  27561. referencedClasses: ["Message"]
  27562. }),
  27563. smalltalk.ASTInterpreter);
  27564. smalltalk.addMethod(
  27565. smalltalk.method({
  27566. selector: "result",
  27567. category: 'accessing',
  27568. fn: function (){
  27569. var self=this;
  27570. return smalltalk.withContext(function($ctx1) {
  27571. var $1;
  27572. $1=self["@result"];
  27573. return $1;
  27574. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  27575. args: [],
  27576. source: "result\x0a\x09^ result",
  27577. messageSends: [],
  27578. referencedClasses: []
  27579. }),
  27580. smalltalk.ASTInterpreter);
  27581. smalltalk.addMethod(
  27582. smalltalk.method({
  27583. selector: "sendMessage:to:superSend:",
  27584. category: 'private',
  27585. fn: function (aMessage,anObject,aBoolean){
  27586. var self=this;
  27587. var method;
  27588. return smalltalk.withContext(function($ctx1) {
  27589. var $1,$2,$3,$4,$5,$6;
  27590. var $early={};
  27591. try {
  27592. $1=aBoolean;
  27593. if(! smalltalk.assert($1)){
  27594. $2=_st(aMessage)._sendTo_(anObject);
  27595. return $2;
  27596. };
  27597. $3=_st(_st(anObject)._class())._superclass();
  27598. if(($receiver = $3) == nil || $receiver == undefined){
  27599. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  27600. return $4;
  27601. } else {
  27602. $3;
  27603. };
  27604. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  27605. return smalltalk.withContext(function($ctx2) {
  27606. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  27607. throw $early=[$5];
  27608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27609. $6=_st(_st(method)._fn())._applyTo_arguments_(anObject,_st(aMessage)._arguments());
  27610. return $6;
  27611. }
  27612. catch(e) {if(e===$early)return e[0]; throw e}
  27613. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  27614. args: ["aMessage", "anObject", "aBoolean"],
  27615. 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 fn applyTo: anObject arguments: aMessage arguments\x0a\x09\x09\x0a\x09\x0a\x09",
  27616. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "messageNotUnderstood:receiver:", "superclass", "class", "at:ifAbsent:", "selector", "methodDictionary", "applyTo:arguments:", "arguments", "fn"],
  27617. referencedClasses: []
  27618. }),
  27619. smalltalk.ASTInterpreter);
  27620. smalltalk.addMethod(
  27621. smalltalk.method({
  27622. selector: "shouldReturn",
  27623. category: 'testing',
  27624. fn: function (){
  27625. var self=this;
  27626. return smalltalk.withContext(function($ctx1) {
  27627. var $2,$1;
  27628. $2=self["@shouldReturn"];
  27629. if(($receiver = $2) == nil || $receiver == undefined){
  27630. $1=false;
  27631. } else {
  27632. $1=$2;
  27633. };
  27634. return $1;
  27635. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  27636. args: [],
  27637. source: "shouldReturn\x0a\x09^ shouldReturn ifNil: [ false ]",
  27638. messageSends: ["ifNil:"],
  27639. referencedClasses: []
  27640. }),
  27641. smalltalk.ASTInterpreter);
  27642. smalltalk.addMethod(
  27643. smalltalk.method({
  27644. selector: "withBlockContext:",
  27645. category: 'private',
  27646. fn: function (aBlock){
  27647. var self=this;
  27648. var blockResult;
  27649. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  27650. return smalltalk.withContext(function($ctx1) {
  27651. var $1,$2,$3;
  27652. $1=_st($AIContext())._new();
  27653. _st($1)._outerContext_(self._context());
  27654. $2=_st($1)._yourself();
  27655. self._context_($2);
  27656. blockResult=_st(aBlock)._value();
  27657. self._context_(_st(self._context())._outerContext());
  27658. $3=blockResult;
  27659. return $3;
  27660. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  27661. args: ["aBlock"],
  27662. source: "withBlockContext: aBlock\x0a\x09\x22Evaluate aBlock with a BlockContext:\x0a\x09- a context is pushed before aBlock evaluation.\x0a\x09- the context is poped after aBlock evaluation\x0a\x09- the result of aBlock evaluation is answered\x22\x0a\x09\x0a\x09| blockResult |\x0a\x09\x09\x09\x0a\x09self context: (AIContext new\x0a\x09\x09outerContext: self context;\x0a\x09\x09yourself).\x0a\x09\x0a\x09blockResult := aBlock value.\x0a\x09\x0a\x09self context: self context outerContext.\x0a\x09^ blockResult",
  27663. messageSends: ["context:", "outerContext:", "context", "new", "yourself", "value", "outerContext"],
  27664. referencedClasses: ["AIContext"]
  27665. }),
  27666. smalltalk.ASTInterpreter);
  27667. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  27668. smalltalk.ASTSteppingInterpreter.comment="I am an interpreter with stepping capabilities. The higher level `ASTDebugger` class should be used as a debugger model, as it provides convenience methods for debugging.\x0a\x0a## API\x0a\x0aUse `#step` to actually interpret the next node. Interpretation stops at each node evaluation, weither it's a message node or not.\x0a\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09interpreter := ASTSteppingInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09interpreter step; step.\x0a\x09interpreter step; step.\x0a\x09interpreter result.\x22Answers 1\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 3\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 7\x22";
  27669. smalltalk.addMethod(
  27670. smalltalk.method({
  27671. selector: "atEnd",
  27672. category: 'testing',
  27673. fn: function (){
  27674. var self=this;
  27675. return smalltalk.withContext(function($ctx1) {
  27676. var $1;
  27677. $1=_st(self._shouldReturn())._or_((function(){
  27678. return smalltalk.withContext(function($ctx2) {
  27679. return _st(self._nextNode()).__eq_eq(self._currentNode());
  27680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  27681. return $1;
  27682. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  27683. args: [],
  27684. source: "atEnd\x0a\x09^ self shouldReturn or: [ self nextNode == self currentNode ]",
  27685. messageSends: ["or:", "==", "currentNode", "nextNode", "shouldReturn"],
  27686. referencedClasses: []
  27687. }),
  27688. smalltalk.ASTSteppingInterpreter);
  27689. smalltalk.addMethod(
  27690. smalltalk.method({
  27691. selector: "initialize",
  27692. category: 'initialization',
  27693. fn: function (){
  27694. var self=this;
  27695. return smalltalk.withContext(function($ctx1) {
  27696. smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  27697. self["@continuation"]=(function(){
  27698. return smalltalk.withContext(function($ctx2) {
  27699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  27700. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  27701. args: [],
  27702. source: "initialize\x0a\x09super initialize.\x0a\x09continuation := []",
  27703. messageSends: ["initialize"],
  27704. referencedClasses: []
  27705. }),
  27706. smalltalk.ASTSteppingInterpreter);
  27707. smalltalk.addMethod(
  27708. smalltalk.method({
  27709. selector: "interpret:continue:",
  27710. category: 'interpreting',
  27711. fn: function (aNode,aBlock){
  27712. var self=this;
  27713. return smalltalk.withContext(function($ctx1) {
  27714. self["@nextNode"]=aNode;
  27715. self["@continuation"]=(function(){
  27716. return smalltalk.withContext(function($ctx2) {
  27717. return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  27718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  27719. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  27720. args: ["aNode", "aBlock"],
  27721. source: "interpret: aNode continue: aBlock\x0a\x09nextNode := aNode.\x0a\x09continuation := [\x0a\x09\x09super interpret: aNode continue: aBlock ]",
  27722. messageSends: ["interpret:continue:"],
  27723. referencedClasses: []
  27724. }),
  27725. smalltalk.ASTSteppingInterpreter);
  27726. smalltalk.addMethod(
  27727. smalltalk.method({
  27728. selector: "nextNode",
  27729. category: 'accessing',
  27730. fn: function (){
  27731. var self=this;
  27732. return smalltalk.withContext(function($ctx1) {
  27733. var $1;
  27734. $1=self["@nextNode"];
  27735. return $1;
  27736. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  27737. args: [],
  27738. source: "nextNode\x0a\x09^ nextNode",
  27739. messageSends: [],
  27740. referencedClasses: []
  27741. }),
  27742. smalltalk.ASTSteppingInterpreter);
  27743. smalltalk.addMethod(
  27744. smalltalk.method({
  27745. selector: "step",
  27746. category: 'stepping',
  27747. fn: function (){
  27748. var self=this;
  27749. return smalltalk.withContext(function($ctx1) {
  27750. _st(self["@continuation"])._value();
  27751. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  27752. args: [],
  27753. source: "step\x0a\x09continuation value",
  27754. messageSends: ["value"],
  27755. referencedClasses: []
  27756. }),
  27757. smalltalk.ASTSteppingInterpreter);
  27758. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'currentNode'], 'Compiler-Interpreter');
  27759. smalltalk.ASTPCNodeVisitor.comment="I visit an AST until I get to the current pc node 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 corresponding to the `pc` is answered by `#currentNode`";
  27760. smalltalk.addMethod(
  27761. smalltalk.method({
  27762. selector: "context",
  27763. category: 'accessing',
  27764. fn: function (){
  27765. var self=this;
  27766. return smalltalk.withContext(function($ctx1) {
  27767. var $1;
  27768. $1=self["@context"];
  27769. return $1;
  27770. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  27771. args: [],
  27772. source: "context\x0a\x09^ context",
  27773. messageSends: [],
  27774. referencedClasses: []
  27775. }),
  27776. smalltalk.ASTPCNodeVisitor);
  27777. smalltalk.addMethod(
  27778. smalltalk.method({
  27779. selector: "context:",
  27780. category: 'accessing',
  27781. fn: function (aContext){
  27782. var self=this;
  27783. return smalltalk.withContext(function($ctx1) {
  27784. self["@context"]=aContext;
  27785. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  27786. args: ["aContext"],
  27787. source: "context: aContext\x0a\x09context := aContext",
  27788. messageSends: [],
  27789. referencedClasses: []
  27790. }),
  27791. smalltalk.ASTPCNodeVisitor);
  27792. smalltalk.addMethod(
  27793. smalltalk.method({
  27794. selector: "currentNode",
  27795. category: 'accessing',
  27796. fn: function (){
  27797. var self=this;
  27798. return smalltalk.withContext(function($ctx1) {
  27799. var $1;
  27800. $1=self["@currentNode"];
  27801. return $1;
  27802. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  27803. args: [],
  27804. source: "currentNode\x0a\x09^ currentNode",
  27805. messageSends: [],
  27806. referencedClasses: []
  27807. }),
  27808. smalltalk.ASTPCNodeVisitor);
  27809. smalltalk.addMethod(
  27810. smalltalk.method({
  27811. selector: "pc",
  27812. category: 'accessing',
  27813. fn: function (){
  27814. var self=this;
  27815. return smalltalk.withContext(function($ctx1) {
  27816. var $2,$1;
  27817. $2=self["@pc"];
  27818. if(($receiver = $2) == nil || $receiver == undefined){
  27819. $1=(0);
  27820. } else {
  27821. $1=$2;
  27822. };
  27823. return $1;
  27824. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeVisitor)})},
  27825. args: [],
  27826. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  27827. messageSends: ["ifNil:"],
  27828. referencedClasses: []
  27829. }),
  27830. smalltalk.ASTPCNodeVisitor);
  27831. smalltalk.addMethod(
  27832. smalltalk.method({
  27833. selector: "pc:",
  27834. category: 'accessing',
  27835. fn: function (anInteger){
  27836. var self=this;
  27837. return smalltalk.withContext(function($ctx1) {
  27838. self["@pc"]=anInteger;
  27839. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitor)})},
  27840. args: ["anInteger"],
  27841. source: "pc: anInteger\x0a\x09pc := anInteger",
  27842. messageSends: [],
  27843. referencedClasses: []
  27844. }),
  27845. smalltalk.ASTPCNodeVisitor);
  27846. smalltalk.addMethod(
  27847. smalltalk.method({
  27848. selector: "useInlinings",
  27849. category: 'accessing',
  27850. fn: function (){
  27851. var self=this;
  27852. return smalltalk.withContext(function($ctx1) {
  27853. var $2,$1;
  27854. $2=self["@useInlinings"];
  27855. if(($receiver = $2) == nil || $receiver == undefined){
  27856. $1=true;
  27857. } else {
  27858. $1=$2;
  27859. };
  27860. return $1;
  27861. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeVisitor)})},
  27862. args: [],
  27863. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  27864. messageSends: ["ifNil:"],
  27865. referencedClasses: []
  27866. }),
  27867. smalltalk.ASTPCNodeVisitor);
  27868. smalltalk.addMethod(
  27869. smalltalk.method({
  27870. selector: "useInlinings:",
  27871. category: 'accessing',
  27872. fn: function (aBoolean){
  27873. var self=this;
  27874. return smalltalk.withContext(function($ctx1) {
  27875. self["@useInlinings"]=aBoolean;
  27876. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeVisitor)})},
  27877. args: ["aBoolean"],
  27878. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  27879. messageSends: [],
  27880. referencedClasses: []
  27881. }),
  27882. smalltalk.ASTPCNodeVisitor);
  27883. smalltalk.addMethod(
  27884. smalltalk.method({
  27885. selector: "visitJSStatementNode:",
  27886. category: 'visiting',
  27887. fn: function (aNode){
  27888. var self=this;
  27889. return smalltalk.withContext(function($ctx1) {
  27890. self["@currentNode"]=aNode;
  27891. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  27892. args: ["aNode"],
  27893. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  27894. messageSends: [],
  27895. referencedClasses: []
  27896. }),
  27897. smalltalk.ASTPCNodeVisitor);
  27898. smalltalk.addMethod(
  27899. smalltalk.method({
  27900. selector: "visitSendNode:",
  27901. category: 'visiting',
  27902. fn: function (aNode){
  27903. var self=this;
  27904. return smalltalk.withContext(function($ctx1) {
  27905. var $1,$2;
  27906. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  27907. $1=_st(self._pc()).__eq(_st(self._context())._pc());
  27908. if(! smalltalk.assert($1)){
  27909. $2=_st(aNode)._shouldBeInlined();
  27910. if(! smalltalk.assert($2)){
  27911. self._pc_(_st(self._pc()).__plus((1)));
  27912. self["@currentNode"]=aNode;
  27913. self["@currentNode"];
  27914. };
  27915. };
  27916. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  27917. args: ["aNode"],
  27918. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self pc = self context pc ifFalse: [\x0a\x09\x09aNode shouldBeInlined ifFalse: [ \x0a\x09\x09\x09self pc: self pc + 1.\x0a\x09\x09\x09currentNode := aNode ] ]",
  27919. messageSends: ["visitSendNode:", "ifFalse:", "pc:", "+", "pc", "shouldBeInlined", "=", "context"],
  27920. referencedClasses: []
  27921. }),
  27922. smalltalk.ASTPCNodeVisitor);
  27923. smalltalk.addMethod(
  27924. smalltalk.method({
  27925. selector: "interpreter:continue:",
  27926. category: '*Compiler-Interpreter',
  27927. fn: function (anInterpreter,aBlock){
  27928. var self=this;
  27929. return smalltalk.withContext(function($ctx1) {
  27930. var $1;
  27931. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  27932. return $1;
  27933. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  27934. args: ["anInterpreter", "aBlock"],
  27935. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretNode: self continue: aBlock",
  27936. messageSends: ["interpretNode:continue:"],
  27937. referencedClasses: []
  27938. }),
  27939. smalltalk.Node);
  27940. smalltalk.addMethod(
  27941. smalltalk.method({
  27942. selector: "isSteppingNode",
  27943. category: '*Compiler-Interpreter',
  27944. fn: function (){
  27945. var self=this;
  27946. return smalltalk.withContext(function($ctx1) {
  27947. return false;
  27948. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  27949. args: [],
  27950. source: "isSteppingNode\x0a\x09^ false",
  27951. messageSends: [],
  27952. referencedClasses: []
  27953. }),
  27954. smalltalk.Node);
  27955. smalltalk.addMethod(
  27956. smalltalk.method({
  27957. selector: "interpreter:continue:",
  27958. category: '*Compiler-Interpreter',
  27959. fn: function (anInterpreter,aBlock){
  27960. var self=this;
  27961. return smalltalk.withContext(function($ctx1) {
  27962. var $1;
  27963. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  27964. return $1;
  27965. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  27966. args: ["anInterpreter", "aBlock"],
  27967. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretAssignmentNode: self continue: aBlock",
  27968. messageSends: ["interpretAssignmentNode:continue:"],
  27969. referencedClasses: []
  27970. }),
  27971. smalltalk.AssignmentNode);
  27972. smalltalk.addMethod(
  27973. smalltalk.method({
  27974. selector: "isSteppingNode",
  27975. category: '*Compiler-Interpreter',
  27976. fn: function (){
  27977. var self=this;
  27978. return smalltalk.withContext(function($ctx1) {
  27979. return true;
  27980. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  27981. args: [],
  27982. source: "isSteppingNode\x0a\x09^ true",
  27983. messageSends: [],
  27984. referencedClasses: []
  27985. }),
  27986. smalltalk.AssignmentNode);
  27987. smalltalk.addMethod(
  27988. smalltalk.method({
  27989. selector: "interpreter:continue:",
  27990. category: '*Compiler-Interpreter',
  27991. fn: function (anInterpreter,aBlock){
  27992. var self=this;
  27993. return smalltalk.withContext(function($ctx1) {
  27994. var $1;
  27995. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  27996. return $1;
  27997. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  27998. args: ["anInterpreter", "aBlock"],
  27999. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockNode: self continue: aBlock",
  28000. messageSends: ["interpretBlockNode:continue:"],
  28001. referencedClasses: []
  28002. }),
  28003. smalltalk.BlockNode);
  28004. smalltalk.addMethod(
  28005. smalltalk.method({
  28006. selector: "isSteppingNode",
  28007. category: '*Compiler-Interpreter',
  28008. fn: function (){
  28009. var self=this;
  28010. return smalltalk.withContext(function($ctx1) {
  28011. return true;
  28012. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  28013. args: [],
  28014. source: "isSteppingNode\x0a\x09^ true",
  28015. messageSends: [],
  28016. referencedClasses: []
  28017. }),
  28018. smalltalk.BlockNode);
  28019. smalltalk.addMethod(
  28020. smalltalk.method({
  28021. selector: "interpreter:continue:",
  28022. category: '*Compiler-Interpreter',
  28023. fn: function (anInterpreter,aBlock){
  28024. var self=this;
  28025. return smalltalk.withContext(function($ctx1) {
  28026. var $1;
  28027. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  28028. return $1;
  28029. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  28030. args: ["anInterpreter", "aBlock"],
  28031. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretCascadeNode: self continue: aBlock",
  28032. messageSends: ["interpretCascadeNode:continue:"],
  28033. referencedClasses: []
  28034. }),
  28035. smalltalk.CascadeNode);
  28036. smalltalk.addMethod(
  28037. smalltalk.method({
  28038. selector: "interpreter:continue:",
  28039. category: '*Compiler-Interpreter',
  28040. fn: function (anInterpreter,aBlock){
  28041. var self=this;
  28042. return smalltalk.withContext(function($ctx1) {
  28043. var $1;
  28044. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  28045. return $1;
  28046. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  28047. args: ["anInterpreter", "aBlock"],
  28048. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicArrayNode: self continue: aBlock",
  28049. messageSends: ["interpretDynamicArrayNode:continue:"],
  28050. referencedClasses: []
  28051. }),
  28052. smalltalk.DynamicArrayNode);
  28053. smalltalk.addMethod(
  28054. smalltalk.method({
  28055. selector: "isSteppingNode",
  28056. category: '*Compiler-Interpreter',
  28057. fn: function (){
  28058. var self=this;
  28059. return smalltalk.withContext(function($ctx1) {
  28060. return true;
  28061. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  28062. args: [],
  28063. source: "isSteppingNode\x0a\x09^ true",
  28064. messageSends: [],
  28065. referencedClasses: []
  28066. }),
  28067. smalltalk.DynamicArrayNode);
  28068. smalltalk.addMethod(
  28069. smalltalk.method({
  28070. selector: "interpreter:continue:",
  28071. category: '*Compiler-Interpreter',
  28072. fn: function (anInterpreter,aBlock){
  28073. var self=this;
  28074. return smalltalk.withContext(function($ctx1) {
  28075. var $1;
  28076. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  28077. return $1;
  28078. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  28079. args: ["anInterpreter", "aBlock"],
  28080. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicDictionaryNode: self continue: aBlock",
  28081. messageSends: ["interpretDynamicDictionaryNode:continue:"],
  28082. referencedClasses: []
  28083. }),
  28084. smalltalk.DynamicDictionaryNode);
  28085. smalltalk.addMethod(
  28086. smalltalk.method({
  28087. selector: "isSteppingNode",
  28088. category: '*Compiler-Interpreter',
  28089. fn: function (){
  28090. var self=this;
  28091. return smalltalk.withContext(function($ctx1) {
  28092. return true;
  28093. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  28094. args: [],
  28095. source: "isSteppingNode\x0a\x09^ true",
  28096. messageSends: [],
  28097. referencedClasses: []
  28098. }),
  28099. smalltalk.DynamicDictionaryNode);
  28100. smalltalk.addMethod(
  28101. smalltalk.method({
  28102. selector: "interpreter:continue:",
  28103. category: '*Compiler-Interpreter',
  28104. fn: function (anInterpreter,aBlock){
  28105. var self=this;
  28106. return smalltalk.withContext(function($ctx1) {
  28107. var $1;
  28108. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  28109. return $1;
  28110. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  28111. args: ["anInterpreter", "aBlock"],
  28112. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretJSStatementNode: self continue: aBlock",
  28113. messageSends: ["interpretJSStatementNode:continue:"],
  28114. referencedClasses: []
  28115. }),
  28116. smalltalk.JSStatementNode);
  28117. smalltalk.addMethod(
  28118. smalltalk.method({
  28119. selector: "isSteppingNode",
  28120. category: '*Compiler-Interpreter',
  28121. fn: function (){
  28122. var self=this;
  28123. return smalltalk.withContext(function($ctx1) {
  28124. return true;
  28125. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  28126. args: [],
  28127. source: "isSteppingNode\x0a\x09^ true",
  28128. messageSends: [],
  28129. referencedClasses: []
  28130. }),
  28131. smalltalk.JSStatementNode);
  28132. smalltalk.addMethod(
  28133. smalltalk.method({
  28134. selector: "interpreter:continue:",
  28135. category: '*Compiler-Interpreter',
  28136. fn: function (anInterpreter,aBlock){
  28137. var self=this;
  28138. return smalltalk.withContext(function($ctx1) {
  28139. var $1;
  28140. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  28141. return $1;
  28142. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  28143. args: ["anInterpreter", "aBlock"],
  28144. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretMethodNode: self continue: aBlock",
  28145. messageSends: ["interpretMethodNode:continue:"],
  28146. referencedClasses: []
  28147. }),
  28148. smalltalk.MethodNode);
  28149. smalltalk.addMethod(
  28150. smalltalk.method({
  28151. selector: "interpreter:continue:",
  28152. category: '*Compiler-Interpreter',
  28153. fn: function (anInterpreter,aBlock){
  28154. var self=this;
  28155. return smalltalk.withContext(function($ctx1) {
  28156. var $1;
  28157. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  28158. return $1;
  28159. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  28160. args: ["anInterpreter", "aBlock"],
  28161. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretReturnNode: self continue: aBlock",
  28162. messageSends: ["interpretReturnNode:continue:"],
  28163. referencedClasses: []
  28164. }),
  28165. smalltalk.ReturnNode);
  28166. smalltalk.addMethod(
  28167. smalltalk.method({
  28168. selector: "interpreter:continue:",
  28169. category: '*Compiler-Interpreter',
  28170. fn: function (anInterpreter,aBlock){
  28171. var self=this;
  28172. return smalltalk.withContext(function($ctx1) {
  28173. var $1;
  28174. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  28175. return $1;
  28176. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  28177. args: ["anInterpreter", "aBlock"],
  28178. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSendNode: self continue: aBlock",
  28179. messageSends: ["interpretSendNode:continue:"],
  28180. referencedClasses: []
  28181. }),
  28182. smalltalk.SendNode);
  28183. smalltalk.addMethod(
  28184. smalltalk.method({
  28185. selector: "isSteppingNode",
  28186. category: '*Compiler-Interpreter',
  28187. fn: function (){
  28188. var self=this;
  28189. return smalltalk.withContext(function($ctx1) {
  28190. return true;
  28191. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  28192. args: [],
  28193. source: "isSteppingNode\x0a\x09^ true",
  28194. messageSends: [],
  28195. referencedClasses: []
  28196. }),
  28197. smalltalk.SendNode);
  28198. smalltalk.addMethod(
  28199. smalltalk.method({
  28200. selector: "interpreter:continue:",
  28201. category: '*Compiler-Interpreter',
  28202. fn: function (anInterpreter,aBlock){
  28203. var self=this;
  28204. return smalltalk.withContext(function($ctx1) {
  28205. var $1;
  28206. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  28207. return $1;
  28208. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  28209. args: ["anInterpreter", "aBlock"],
  28210. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSequenceNode: self continue: aBlock",
  28211. messageSends: ["interpretSequenceNode:continue:"],
  28212. referencedClasses: []
  28213. }),
  28214. smalltalk.SequenceNode);
  28215. smalltalk.addMethod(
  28216. smalltalk.method({
  28217. selector: "interpreter:continue:",
  28218. category: '*Compiler-Interpreter',
  28219. fn: function (anInterpreter,aBlock){
  28220. var self=this;
  28221. return smalltalk.withContext(function($ctx1) {
  28222. var $1;
  28223. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  28224. return $1;
  28225. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  28226. args: ["anInterpreter", "aBlock"],
  28227. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockSequenceNode: self continue: aBlock",
  28228. messageSends: ["interpretBlockSequenceNode:continue:"],
  28229. referencedClasses: []
  28230. }),
  28231. smalltalk.BlockSequenceNode);
  28232. smalltalk.addMethod(
  28233. smalltalk.method({
  28234. selector: "interpreter:continue:",
  28235. category: '*Compiler-Interpreter',
  28236. fn: function (anInterpreter,aBlock){
  28237. var self=this;
  28238. return smalltalk.withContext(function($ctx1) {
  28239. var $1;
  28240. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  28241. return $1;
  28242. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  28243. args: ["anInterpreter", "aBlock"],
  28244. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretValueNode: self continue: aBlock",
  28245. messageSends: ["interpretValueNode:continue:"],
  28246. referencedClasses: []
  28247. }),
  28248. smalltalk.ValueNode);
  28249. smalltalk.addMethod(
  28250. smalltalk.method({
  28251. selector: "interpreter:continue:",
  28252. category: '*Compiler-Interpreter',
  28253. fn: function (anInterpreter,aBlock){
  28254. var self=this;
  28255. return smalltalk.withContext(function($ctx1) {
  28256. var $1;
  28257. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  28258. return $1;
  28259. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  28260. args: ["anInterpreter", "aBlock"],
  28261. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretVariableNode: self continue: aBlock",
  28262. messageSends: ["interpretVariableNode:continue:"],
  28263. referencedClasses: []
  28264. }),
  28265. smalltalk.VariableNode);
  28266. smalltalk.addMethod(
  28267. smalltalk.method({
  28268. selector: "interpreter:continue:",
  28269. category: '*Compiler-Interpreter',
  28270. fn: function (anInterpreter,aBlock){
  28271. var self=this;
  28272. return smalltalk.withContext(function($ctx1) {
  28273. var $1;
  28274. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  28275. return $1;
  28276. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  28277. args: ["anInterpreter", "aBlock"],
  28278. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretClassReferenceNode: self continue: aBlock",
  28279. messageSends: ["interpretClassReferenceNode:continue:"],
  28280. referencedClasses: []
  28281. }),
  28282. smalltalk.ClassReferenceNode);
  28283. smalltalk.parser = (function(){
  28284. /*
  28285. * Generated by PEG.js 0.7.0.
  28286. *
  28287. * http://pegjs.majda.cz/
  28288. */
  28289. function quote(s) {
  28290. /*
  28291. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  28292. * string literal except for the closing quote character, backslash,
  28293. * carriage return, line separator, paragraph separator, and line feed.
  28294. * Any character may appear in the form of an escape sequence.
  28295. *
  28296. * For portability, we also escape escape all control and non-ASCII
  28297. * characters. Note that "\0" and "\v" escape sequences are not used
  28298. * because JSHint does not like the first and IE the second.
  28299. */
  28300. return '"' + s
  28301. .replace(/\\/g, '\\\\') // backslash
  28302. .replace(/"/g, '\\"') // closing quote character
  28303. .replace(/\x08/g, '\\b') // backspace
  28304. .replace(/\t/g, '\\t') // horizontal tab
  28305. .replace(/\n/g, '\\n') // line feed
  28306. .replace(/\f/g, '\\f') // form feed
  28307. .replace(/\r/g, '\\r') // carriage return
  28308. .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
  28309. + '"';
  28310. }
  28311. var result = {
  28312. /*
  28313. * Parses the input with a generated parser. If the parsing is successfull,
  28314. * returns a value explicitly or implicitly specified by the grammar from
  28315. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  28316. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  28317. */
  28318. parse: function(input, startRule) {
  28319. var parseFunctions = {
  28320. "separator": parse_separator,
  28321. "comments": parse_comments,
  28322. "ws": parse_ws,
  28323. "identifier": parse_identifier,
  28324. "varIdentifier": parse_varIdentifier,
  28325. "keyword": parse_keyword,
  28326. "selector": parse_selector,
  28327. "className": parse_className,
  28328. "string": parse_string,
  28329. "symbol": parse_symbol,
  28330. "bareSymbol": parse_bareSymbol,
  28331. "number": parse_number,
  28332. "hex": parse_hex,
  28333. "float": parse_float,
  28334. "integer": parse_integer,
  28335. "literalArray": parse_literalArray,
  28336. "bareLiteralArray": parse_bareLiteralArray,
  28337. "literalArrayRest": parse_literalArrayRest,
  28338. "dynamicArray": parse_dynamicArray,
  28339. "dynamicDictionary": parse_dynamicDictionary,
  28340. "pseudoVariable": parse_pseudoVariable,
  28341. "parseTimeLiteral": parse_parseTimeLiteral,
  28342. "runtimeLiteral": parse_runtimeLiteral,
  28343. "literal": parse_literal,
  28344. "variable": parse_variable,
  28345. "classReference": parse_classReference,
  28346. "reference": parse_reference,
  28347. "keywordPair": parse_keywordPair,
  28348. "binarySelector": parse_binarySelector,
  28349. "keywordPattern": parse_keywordPattern,
  28350. "binaryPattern": parse_binaryPattern,
  28351. "unaryPattern": parse_unaryPattern,
  28352. "expression": parse_expression,
  28353. "expressionList": parse_expressionList,
  28354. "expressions": parse_expressions,
  28355. "assignment": parse_assignment,
  28356. "ret": parse_ret,
  28357. "temps": parse_temps,
  28358. "blockParamList": parse_blockParamList,
  28359. "subexpression": parse_subexpression,
  28360. "statements": parse_statements,
  28361. "sequence": parse_sequence,
  28362. "stSequence": parse_stSequence,
  28363. "block": parse_block,
  28364. "operand": parse_operand,
  28365. "unaryMessage": parse_unaryMessage,
  28366. "unaryTail": parse_unaryTail,
  28367. "unarySend": parse_unarySend,
  28368. "binaryMessage": parse_binaryMessage,
  28369. "binaryTail": parse_binaryTail,
  28370. "binarySend": parse_binarySend,
  28371. "keywordMessage": parse_keywordMessage,
  28372. "keywordSend": parse_keywordSend,
  28373. "message": parse_message,
  28374. "cascade": parse_cascade,
  28375. "jsStatement": parse_jsStatement,
  28376. "method": parse_method
  28377. };
  28378. if (startRule !== undefined) {
  28379. if (parseFunctions[startRule] === undefined) {
  28380. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  28381. }
  28382. } else {
  28383. startRule = "method";
  28384. }
  28385. var pos = { offset: 0, line: 1, column: 1, seenCR: false };
  28386. var reportFailures = 0;
  28387. var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
  28388. var rightmostFailuresExpected = [];
  28389. var cache = {};
  28390. function padLeft(input, padding, length) {
  28391. var result = input;
  28392. var padLength = length - input.length;
  28393. for (var i = 0; i < padLength; i++) {
  28394. result = padding + result;
  28395. }
  28396. return result;
  28397. }
  28398. function escape(ch) {
  28399. var charCode = ch.charCodeAt(0);
  28400. var escapeChar;
  28401. var length;
  28402. if (charCode <= 0xFF) {
  28403. escapeChar = 'x';
  28404. length = 2;
  28405. } else {
  28406. escapeChar = 'u';
  28407. length = 4;
  28408. }
  28409. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  28410. }
  28411. function clone(object) {
  28412. var result = {};
  28413. for (var key in object) {
  28414. result[key] = object[key];
  28415. }
  28416. return result;
  28417. }
  28418. function advance(pos, n) {
  28419. var endOffset = pos.offset + n;
  28420. for (var offset = pos.offset; offset < endOffset; offset++) {
  28421. var ch = input.charAt(offset);
  28422. if (ch === "\n") {
  28423. if (!pos.seenCR) { pos.line++; }
  28424. pos.column = 1;
  28425. pos.seenCR = false;
  28426. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  28427. pos.line++;
  28428. pos.column = 1;
  28429. pos.seenCR = true;
  28430. } else {
  28431. pos.column++;
  28432. pos.seenCR = false;
  28433. }
  28434. }
  28435. pos.offset += n;
  28436. }
  28437. function matchFailed(failure) {
  28438. if (pos.offset < rightmostFailuresPos.offset) {
  28439. return;
  28440. }
  28441. if (pos.offset > rightmostFailuresPos.offset) {
  28442. rightmostFailuresPos = clone(pos);
  28443. rightmostFailuresExpected = [];
  28444. }
  28445. rightmostFailuresExpected.push(failure);
  28446. }
  28447. function parse_separator() {
  28448. var cacheKey = "separator@" + pos.offset;
  28449. var cachedResult = cache[cacheKey];
  28450. if (cachedResult) {
  28451. pos = clone(cachedResult.nextPos);
  28452. return cachedResult.result;
  28453. }
  28454. var result0, result1;
  28455. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  28456. result1 = input.charAt(pos.offset);
  28457. advance(pos, 1);
  28458. } else {
  28459. result1 = null;
  28460. if (reportFailures === 0) {
  28461. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  28462. }
  28463. }
  28464. if (result1 !== null) {
  28465. result0 = [];
  28466. while (result1 !== null) {
  28467. result0.push(result1);
  28468. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  28469. result1 = input.charAt(pos.offset);
  28470. advance(pos, 1);
  28471. } else {
  28472. result1 = null;
  28473. if (reportFailures === 0) {
  28474. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  28475. }
  28476. }
  28477. }
  28478. } else {
  28479. result0 = null;
  28480. }
  28481. cache[cacheKey] = {
  28482. nextPos: clone(pos),
  28483. result: result0
  28484. };
  28485. return result0;
  28486. }
  28487. function parse_comments() {
  28488. var cacheKey = "comments@" + pos.offset;
  28489. var cachedResult = cache[cacheKey];
  28490. if (cachedResult) {
  28491. pos = clone(cachedResult.nextPos);
  28492. return cachedResult.result;
  28493. }
  28494. var result0, result1, result2, result3;
  28495. var pos0;
  28496. pos0 = clone(pos);
  28497. if (/^["]/.test(input.charAt(pos.offset))) {
  28498. result1 = input.charAt(pos.offset);
  28499. advance(pos, 1);
  28500. } else {
  28501. result1 = null;
  28502. if (reportFailures === 0) {
  28503. matchFailed("[\"]");
  28504. }
  28505. }
  28506. if (result1 !== null) {
  28507. result2 = [];
  28508. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28509. result3 = input.charAt(pos.offset);
  28510. advance(pos, 1);
  28511. } else {
  28512. result3 = null;
  28513. if (reportFailures === 0) {
  28514. matchFailed("[^\"]");
  28515. }
  28516. }
  28517. while (result3 !== null) {
  28518. result2.push(result3);
  28519. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28520. result3 = input.charAt(pos.offset);
  28521. advance(pos, 1);
  28522. } else {
  28523. result3 = null;
  28524. if (reportFailures === 0) {
  28525. matchFailed("[^\"]");
  28526. }
  28527. }
  28528. }
  28529. if (result2 !== null) {
  28530. if (/^["]/.test(input.charAt(pos.offset))) {
  28531. result3 = input.charAt(pos.offset);
  28532. advance(pos, 1);
  28533. } else {
  28534. result3 = null;
  28535. if (reportFailures === 0) {
  28536. matchFailed("[\"]");
  28537. }
  28538. }
  28539. if (result3 !== null) {
  28540. result1 = [result1, result2, result3];
  28541. } else {
  28542. result1 = null;
  28543. pos = clone(pos0);
  28544. }
  28545. } else {
  28546. result1 = null;
  28547. pos = clone(pos0);
  28548. }
  28549. } else {
  28550. result1 = null;
  28551. pos = clone(pos0);
  28552. }
  28553. if (result1 !== null) {
  28554. result0 = [];
  28555. while (result1 !== null) {
  28556. result0.push(result1);
  28557. pos0 = clone(pos);
  28558. if (/^["]/.test(input.charAt(pos.offset))) {
  28559. result1 = input.charAt(pos.offset);
  28560. advance(pos, 1);
  28561. } else {
  28562. result1 = null;
  28563. if (reportFailures === 0) {
  28564. matchFailed("[\"]");
  28565. }
  28566. }
  28567. if (result1 !== null) {
  28568. result2 = [];
  28569. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28570. result3 = input.charAt(pos.offset);
  28571. advance(pos, 1);
  28572. } else {
  28573. result3 = null;
  28574. if (reportFailures === 0) {
  28575. matchFailed("[^\"]");
  28576. }
  28577. }
  28578. while (result3 !== null) {
  28579. result2.push(result3);
  28580. if (/^[^"]/.test(input.charAt(pos.offset))) {
  28581. result3 = input.charAt(pos.offset);
  28582. advance(pos, 1);
  28583. } else {
  28584. result3 = null;
  28585. if (reportFailures === 0) {
  28586. matchFailed("[^\"]");
  28587. }
  28588. }
  28589. }
  28590. if (result2 !== null) {
  28591. if (/^["]/.test(input.charAt(pos.offset))) {
  28592. result3 = input.charAt(pos.offset);
  28593. advance(pos, 1);
  28594. } else {
  28595. result3 = null;
  28596. if (reportFailures === 0) {
  28597. matchFailed("[\"]");
  28598. }
  28599. }
  28600. if (result3 !== null) {
  28601. result1 = [result1, result2, result3];
  28602. } else {
  28603. result1 = null;
  28604. pos = clone(pos0);
  28605. }
  28606. } else {
  28607. result1 = null;
  28608. pos = clone(pos0);
  28609. }
  28610. } else {
  28611. result1 = null;
  28612. pos = clone(pos0);
  28613. }
  28614. }
  28615. } else {
  28616. result0 = null;
  28617. }
  28618. cache[cacheKey] = {
  28619. nextPos: clone(pos),
  28620. result: result0
  28621. };
  28622. return result0;
  28623. }
  28624. function parse_ws() {
  28625. var cacheKey = "ws@" + pos.offset;
  28626. var cachedResult = cache[cacheKey];
  28627. if (cachedResult) {
  28628. pos = clone(cachedResult.nextPos);
  28629. return cachedResult.result;
  28630. }
  28631. var result0, result1;
  28632. result0 = [];
  28633. result1 = parse_separator();
  28634. if (result1 === null) {
  28635. result1 = parse_comments();
  28636. }
  28637. while (result1 !== null) {
  28638. result0.push(result1);
  28639. result1 = parse_separator();
  28640. if (result1 === null) {
  28641. result1 = parse_comments();
  28642. }
  28643. }
  28644. cache[cacheKey] = {
  28645. nextPos: clone(pos),
  28646. result: result0
  28647. };
  28648. return result0;
  28649. }
  28650. function parse_identifier() {
  28651. var cacheKey = "identifier@" + pos.offset;
  28652. var cachedResult = cache[cacheKey];
  28653. if (cachedResult) {
  28654. pos = clone(cachedResult.nextPos);
  28655. return cachedResult.result;
  28656. }
  28657. var result0, result1, result2;
  28658. var pos0, pos1;
  28659. pos0 = clone(pos);
  28660. pos1 = clone(pos);
  28661. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  28662. result0 = input.charAt(pos.offset);
  28663. advance(pos, 1);
  28664. } else {
  28665. result0 = null;
  28666. if (reportFailures === 0) {
  28667. matchFailed("[a-zA-Z]");
  28668. }
  28669. }
  28670. if (result0 !== null) {
  28671. result1 = [];
  28672. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28673. result2 = input.charAt(pos.offset);
  28674. advance(pos, 1);
  28675. } else {
  28676. result2 = null;
  28677. if (reportFailures === 0) {
  28678. matchFailed("[a-zA-Z0-9]");
  28679. }
  28680. }
  28681. while (result2 !== null) {
  28682. result1.push(result2);
  28683. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28684. result2 = input.charAt(pos.offset);
  28685. advance(pos, 1);
  28686. } else {
  28687. result2 = null;
  28688. if (reportFailures === 0) {
  28689. matchFailed("[a-zA-Z0-9]");
  28690. }
  28691. }
  28692. }
  28693. if (result1 !== null) {
  28694. result0 = [result0, result1];
  28695. } else {
  28696. result0 = null;
  28697. pos = clone(pos1);
  28698. }
  28699. } else {
  28700. result0 = null;
  28701. pos = clone(pos1);
  28702. }
  28703. if (result0 !== null) {
  28704. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28705. }
  28706. if (result0 === null) {
  28707. pos = clone(pos0);
  28708. }
  28709. cache[cacheKey] = {
  28710. nextPos: clone(pos),
  28711. result: result0
  28712. };
  28713. return result0;
  28714. }
  28715. function parse_varIdentifier() {
  28716. var cacheKey = "varIdentifier@" + pos.offset;
  28717. var cachedResult = cache[cacheKey];
  28718. if (cachedResult) {
  28719. pos = clone(cachedResult.nextPos);
  28720. return cachedResult.result;
  28721. }
  28722. var result0, result1, result2;
  28723. var pos0, pos1;
  28724. pos0 = clone(pos);
  28725. pos1 = clone(pos);
  28726. if (/^[a-z]/.test(input.charAt(pos.offset))) {
  28727. result0 = input.charAt(pos.offset);
  28728. advance(pos, 1);
  28729. } else {
  28730. result0 = null;
  28731. if (reportFailures === 0) {
  28732. matchFailed("[a-z]");
  28733. }
  28734. }
  28735. if (result0 !== null) {
  28736. result1 = [];
  28737. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28738. result2 = input.charAt(pos.offset);
  28739. advance(pos, 1);
  28740. } else {
  28741. result2 = null;
  28742. if (reportFailures === 0) {
  28743. matchFailed("[a-zA-Z0-9]");
  28744. }
  28745. }
  28746. while (result2 !== null) {
  28747. result1.push(result2);
  28748. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28749. result2 = input.charAt(pos.offset);
  28750. advance(pos, 1);
  28751. } else {
  28752. result2 = null;
  28753. if (reportFailures === 0) {
  28754. matchFailed("[a-zA-Z0-9]");
  28755. }
  28756. }
  28757. }
  28758. if (result1 !== null) {
  28759. result0 = [result0, result1];
  28760. } else {
  28761. result0 = null;
  28762. pos = clone(pos1);
  28763. }
  28764. } else {
  28765. result0 = null;
  28766. pos = clone(pos1);
  28767. }
  28768. if (result0 !== null) {
  28769. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28770. }
  28771. if (result0 === null) {
  28772. pos = clone(pos0);
  28773. }
  28774. cache[cacheKey] = {
  28775. nextPos: clone(pos),
  28776. result: result0
  28777. };
  28778. return result0;
  28779. }
  28780. function parse_keyword() {
  28781. var cacheKey = "keyword@" + pos.offset;
  28782. var cachedResult = cache[cacheKey];
  28783. if (cachedResult) {
  28784. pos = clone(cachedResult.nextPos);
  28785. return cachedResult.result;
  28786. }
  28787. var result0, result1;
  28788. var pos0, pos1;
  28789. pos0 = clone(pos);
  28790. pos1 = clone(pos);
  28791. result0 = parse_identifier();
  28792. if (result0 !== null) {
  28793. if (/^[:]/.test(input.charAt(pos.offset))) {
  28794. result1 = input.charAt(pos.offset);
  28795. advance(pos, 1);
  28796. } else {
  28797. result1 = null;
  28798. if (reportFailures === 0) {
  28799. matchFailed("[:]");
  28800. }
  28801. }
  28802. if (result1 !== null) {
  28803. result0 = [result0, result1];
  28804. } else {
  28805. result0 = null;
  28806. pos = clone(pos1);
  28807. }
  28808. } else {
  28809. result0 = null;
  28810. pos = clone(pos1);
  28811. }
  28812. if (result0 !== null) {
  28813. result0 = (function(offset, line, column, first, last) {return first + last;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28814. }
  28815. if (result0 === null) {
  28816. pos = clone(pos0);
  28817. }
  28818. cache[cacheKey] = {
  28819. nextPos: clone(pos),
  28820. result: result0
  28821. };
  28822. return result0;
  28823. }
  28824. function parse_selector() {
  28825. var cacheKey = "selector@" + pos.offset;
  28826. var cachedResult = cache[cacheKey];
  28827. if (cachedResult) {
  28828. pos = clone(cachedResult.nextPos);
  28829. return cachedResult.result;
  28830. }
  28831. var result0, result1, result2;
  28832. var pos0, pos1;
  28833. pos0 = clone(pos);
  28834. pos1 = clone(pos);
  28835. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  28836. result0 = input.charAt(pos.offset);
  28837. advance(pos, 1);
  28838. } else {
  28839. result0 = null;
  28840. if (reportFailures === 0) {
  28841. matchFailed("[a-zA-Z]");
  28842. }
  28843. }
  28844. if (result0 !== null) {
  28845. result1 = [];
  28846. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  28847. result2 = input.charAt(pos.offset);
  28848. advance(pos, 1);
  28849. } else {
  28850. result2 = null;
  28851. if (reportFailures === 0) {
  28852. matchFailed("[a-zA-Z0-9:]");
  28853. }
  28854. }
  28855. while (result2 !== null) {
  28856. result1.push(result2);
  28857. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  28858. result2 = input.charAt(pos.offset);
  28859. advance(pos, 1);
  28860. } else {
  28861. result2 = null;
  28862. if (reportFailures === 0) {
  28863. matchFailed("[a-zA-Z0-9:]");
  28864. }
  28865. }
  28866. }
  28867. if (result1 !== null) {
  28868. result0 = [result0, result1];
  28869. } else {
  28870. result0 = null;
  28871. pos = clone(pos1);
  28872. }
  28873. } else {
  28874. result0 = null;
  28875. pos = clone(pos1);
  28876. }
  28877. if (result0 !== null) {
  28878. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28879. }
  28880. if (result0 === null) {
  28881. pos = clone(pos0);
  28882. }
  28883. cache[cacheKey] = {
  28884. nextPos: clone(pos),
  28885. result: result0
  28886. };
  28887. return result0;
  28888. }
  28889. function parse_className() {
  28890. var cacheKey = "className@" + pos.offset;
  28891. var cachedResult = cache[cacheKey];
  28892. if (cachedResult) {
  28893. pos = clone(cachedResult.nextPos);
  28894. return cachedResult.result;
  28895. }
  28896. var result0, result1, result2;
  28897. var pos0, pos1;
  28898. pos0 = clone(pos);
  28899. pos1 = clone(pos);
  28900. if (/^[A-Z]/.test(input.charAt(pos.offset))) {
  28901. result0 = input.charAt(pos.offset);
  28902. advance(pos, 1);
  28903. } else {
  28904. result0 = null;
  28905. if (reportFailures === 0) {
  28906. matchFailed("[A-Z]");
  28907. }
  28908. }
  28909. if (result0 !== null) {
  28910. result1 = [];
  28911. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28912. result2 = input.charAt(pos.offset);
  28913. advance(pos, 1);
  28914. } else {
  28915. result2 = null;
  28916. if (reportFailures === 0) {
  28917. matchFailed("[a-zA-Z0-9]");
  28918. }
  28919. }
  28920. while (result2 !== null) {
  28921. result1.push(result2);
  28922. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  28923. result2 = input.charAt(pos.offset);
  28924. advance(pos, 1);
  28925. } else {
  28926. result2 = null;
  28927. if (reportFailures === 0) {
  28928. matchFailed("[a-zA-Z0-9]");
  28929. }
  28930. }
  28931. }
  28932. if (result1 !== null) {
  28933. result0 = [result0, result1];
  28934. } else {
  28935. result0 = null;
  28936. pos = clone(pos1);
  28937. }
  28938. } else {
  28939. result0 = null;
  28940. pos = clone(pos1);
  28941. }
  28942. if (result0 !== null) {
  28943. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  28944. }
  28945. if (result0 === null) {
  28946. pos = clone(pos0);
  28947. }
  28948. cache[cacheKey] = {
  28949. nextPos: clone(pos),
  28950. result: result0
  28951. };
  28952. return result0;
  28953. }
  28954. function parse_string() {
  28955. var cacheKey = "string@" + pos.offset;
  28956. var cachedResult = cache[cacheKey];
  28957. if (cachedResult) {
  28958. pos = clone(cachedResult.nextPos);
  28959. return cachedResult.result;
  28960. }
  28961. var result0, result1, result2;
  28962. var pos0, pos1, pos2;
  28963. pos0 = clone(pos);
  28964. pos1 = clone(pos);
  28965. if (/^[']/.test(input.charAt(pos.offset))) {
  28966. result0 = input.charAt(pos.offset);
  28967. advance(pos, 1);
  28968. } else {
  28969. result0 = null;
  28970. if (reportFailures === 0) {
  28971. matchFailed("[']");
  28972. }
  28973. }
  28974. if (result0 !== null) {
  28975. result1 = [];
  28976. pos2 = clone(pos);
  28977. if (input.substr(pos.offset, 2) === "''") {
  28978. result2 = "''";
  28979. advance(pos, 2);
  28980. } else {
  28981. result2 = null;
  28982. if (reportFailures === 0) {
  28983. matchFailed("\"''\"");
  28984. }
  28985. }
  28986. if (result2 !== null) {
  28987. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  28988. }
  28989. if (result2 === null) {
  28990. pos = clone(pos2);
  28991. }
  28992. if (result2 === null) {
  28993. if (/^[^']/.test(input.charAt(pos.offset))) {
  28994. result2 = input.charAt(pos.offset);
  28995. advance(pos, 1);
  28996. } else {
  28997. result2 = null;
  28998. if (reportFailures === 0) {
  28999. matchFailed("[^']");
  29000. }
  29001. }
  29002. }
  29003. while (result2 !== null) {
  29004. result1.push(result2);
  29005. pos2 = clone(pos);
  29006. if (input.substr(pos.offset, 2) === "''") {
  29007. result2 = "''";
  29008. advance(pos, 2);
  29009. } else {
  29010. result2 = null;
  29011. if (reportFailures === 0) {
  29012. matchFailed("\"''\"");
  29013. }
  29014. }
  29015. if (result2 !== null) {
  29016. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  29017. }
  29018. if (result2 === null) {
  29019. pos = clone(pos2);
  29020. }
  29021. if (result2 === null) {
  29022. if (/^[^']/.test(input.charAt(pos.offset))) {
  29023. result2 = input.charAt(pos.offset);
  29024. advance(pos, 1);
  29025. } else {
  29026. result2 = null;
  29027. if (reportFailures === 0) {
  29028. matchFailed("[^']");
  29029. }
  29030. }
  29031. }
  29032. }
  29033. if (result1 !== null) {
  29034. if (/^[']/.test(input.charAt(pos.offset))) {
  29035. result2 = input.charAt(pos.offset);
  29036. advance(pos, 1);
  29037. } else {
  29038. result2 = null;
  29039. if (reportFailures === 0) {
  29040. matchFailed("[']");
  29041. }
  29042. }
  29043. if (result2 !== null) {
  29044. result0 = [result0, result1, result2];
  29045. } else {
  29046. result0 = null;
  29047. pos = clone(pos1);
  29048. }
  29049. } else {
  29050. result0 = null;
  29051. pos = clone(pos1);
  29052. }
  29053. } else {
  29054. result0 = null;
  29055. pos = clone(pos1);
  29056. }
  29057. if (result0 !== null) {
  29058. result0 = (function(offset, line, column, val) {
  29059. return smalltalk.ValueNode._new()
  29060. ._position_((line).__at(column))
  29061. ._value_(val.join("").replace(/\"/ig, '"'));
  29062. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  29063. }
  29064. if (result0 === null) {
  29065. pos = clone(pos0);
  29066. }
  29067. cache[cacheKey] = {
  29068. nextPos: clone(pos),
  29069. result: result0
  29070. };
  29071. return result0;
  29072. }
  29073. function parse_symbol() {
  29074. var cacheKey = "symbol@" + pos.offset;
  29075. var cachedResult = cache[cacheKey];
  29076. if (cachedResult) {
  29077. pos = clone(cachedResult.nextPos);
  29078. return cachedResult.result;
  29079. }
  29080. var result0, result1;
  29081. var pos0, pos1;
  29082. pos0 = clone(pos);
  29083. pos1 = clone(pos);
  29084. if (input.charCodeAt(pos.offset) === 35) {
  29085. result0 = "#";
  29086. advance(pos, 1);
  29087. } else {
  29088. result0 = null;
  29089. if (reportFailures === 0) {
  29090. matchFailed("\"#\"");
  29091. }
  29092. }
  29093. if (result0 !== null) {
  29094. result1 = parse_bareSymbol();
  29095. if (result1 !== null) {
  29096. result0 = [result0, result1];
  29097. } else {
  29098. result0 = null;
  29099. pos = clone(pos1);
  29100. }
  29101. } else {
  29102. result0 = null;
  29103. pos = clone(pos1);
  29104. }
  29105. if (result0 !== null) {
  29106. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29107. }
  29108. if (result0 === null) {
  29109. pos = clone(pos0);
  29110. }
  29111. cache[cacheKey] = {
  29112. nextPos: clone(pos),
  29113. result: result0
  29114. };
  29115. return result0;
  29116. }
  29117. function parse_bareSymbol() {
  29118. var cacheKey = "bareSymbol@" + pos.offset;
  29119. var cachedResult = cache[cacheKey];
  29120. if (cachedResult) {
  29121. pos = clone(cachedResult.nextPos);
  29122. return cachedResult.result;
  29123. }
  29124. var result0;
  29125. var pos0, pos1;
  29126. pos0 = clone(pos);
  29127. result0 = parse_selector();
  29128. if (result0 === null) {
  29129. result0 = parse_binarySelector();
  29130. if (result0 === null) {
  29131. pos1 = clone(pos);
  29132. result0 = parse_string();
  29133. if (result0 !== null) {
  29134. result0 = (function(offset, line, column, node) {return node._value();})(pos1.offset, pos1.line, pos1.column, result0);
  29135. }
  29136. if (result0 === null) {
  29137. pos = clone(pos1);
  29138. }
  29139. }
  29140. }
  29141. if (result0 !== null) {
  29142. result0 = (function(offset, line, column, val) {
  29143. return smalltalk.ValueNode._new()
  29144. ._position_((line).__at(column))
  29145. ._value_(val);
  29146. })(pos0.offset, pos0.line, pos0.column, result0);
  29147. }
  29148. if (result0 === null) {
  29149. pos = clone(pos0);
  29150. }
  29151. cache[cacheKey] = {
  29152. nextPos: clone(pos),
  29153. result: result0
  29154. };
  29155. return result0;
  29156. }
  29157. function parse_number() {
  29158. var cacheKey = "number@" + pos.offset;
  29159. var cachedResult = cache[cacheKey];
  29160. if (cachedResult) {
  29161. pos = clone(cachedResult.nextPos);
  29162. return cachedResult.result;
  29163. }
  29164. var result0;
  29165. var pos0;
  29166. pos0 = clone(pos);
  29167. result0 = parse_hex();
  29168. if (result0 === null) {
  29169. result0 = parse_float();
  29170. if (result0 === null) {
  29171. result0 = parse_integer();
  29172. }
  29173. }
  29174. if (result0 !== null) {
  29175. result0 = (function(offset, line, column, n) {
  29176. return smalltalk.ValueNode._new()
  29177. ._position_((line).__at(column))
  29178. ._value_(n);
  29179. })(pos0.offset, pos0.line, pos0.column, result0);
  29180. }
  29181. if (result0 === null) {
  29182. pos = clone(pos0);
  29183. }
  29184. cache[cacheKey] = {
  29185. nextPos: clone(pos),
  29186. result: result0
  29187. };
  29188. return result0;
  29189. }
  29190. function parse_hex() {
  29191. var cacheKey = "hex@" + pos.offset;
  29192. var cachedResult = cache[cacheKey];
  29193. if (cachedResult) {
  29194. pos = clone(cachedResult.nextPos);
  29195. return cachedResult.result;
  29196. }
  29197. var result0, result1, result2, result3;
  29198. var pos0, pos1;
  29199. pos0 = clone(pos);
  29200. pos1 = clone(pos);
  29201. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29202. result0 = input.charAt(pos.offset);
  29203. advance(pos, 1);
  29204. } else {
  29205. result0 = null;
  29206. if (reportFailures === 0) {
  29207. matchFailed("[\\-]");
  29208. }
  29209. }
  29210. result0 = result0 !== null ? result0 : "";
  29211. if (result0 !== null) {
  29212. if (input.substr(pos.offset, 3) === "16r") {
  29213. result1 = "16r";
  29214. advance(pos, 3);
  29215. } else {
  29216. result1 = null;
  29217. if (reportFailures === 0) {
  29218. matchFailed("\"16r\"");
  29219. }
  29220. }
  29221. if (result1 !== null) {
  29222. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  29223. result3 = input.charAt(pos.offset);
  29224. advance(pos, 1);
  29225. } else {
  29226. result3 = null;
  29227. if (reportFailures === 0) {
  29228. matchFailed("[0-9a-fA-F]");
  29229. }
  29230. }
  29231. if (result3 !== null) {
  29232. result2 = [];
  29233. while (result3 !== null) {
  29234. result2.push(result3);
  29235. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  29236. result3 = input.charAt(pos.offset);
  29237. advance(pos, 1);
  29238. } else {
  29239. result3 = null;
  29240. if (reportFailures === 0) {
  29241. matchFailed("[0-9a-fA-F]");
  29242. }
  29243. }
  29244. }
  29245. } else {
  29246. result2 = null;
  29247. }
  29248. if (result2 !== null) {
  29249. result0 = [result0, result1, result2];
  29250. } else {
  29251. result0 = null;
  29252. pos = clone(pos1);
  29253. }
  29254. } else {
  29255. result0 = null;
  29256. pos = clone(pos1);
  29257. }
  29258. } else {
  29259. result0 = null;
  29260. pos = clone(pos1);
  29261. }
  29262. if (result0 !== null) {
  29263. result0 = (function(offset, line, column, neg, num) {return parseInt((neg + num.join("")), 16);})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  29264. }
  29265. if (result0 === null) {
  29266. pos = clone(pos0);
  29267. }
  29268. cache[cacheKey] = {
  29269. nextPos: clone(pos),
  29270. result: result0
  29271. };
  29272. return result0;
  29273. }
  29274. function parse_float() {
  29275. var cacheKey = "float@" + pos.offset;
  29276. var cachedResult = cache[cacheKey];
  29277. if (cachedResult) {
  29278. pos = clone(cachedResult.nextPos);
  29279. return cachedResult.result;
  29280. }
  29281. var result0, result1, result2, result3, result4;
  29282. var pos0, pos1;
  29283. pos0 = clone(pos);
  29284. pos1 = clone(pos);
  29285. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29286. result0 = input.charAt(pos.offset);
  29287. advance(pos, 1);
  29288. } else {
  29289. result0 = null;
  29290. if (reportFailures === 0) {
  29291. matchFailed("[\\-]");
  29292. }
  29293. }
  29294. result0 = result0 !== null ? result0 : "";
  29295. if (result0 !== null) {
  29296. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29297. result2 = input.charAt(pos.offset);
  29298. advance(pos, 1);
  29299. } else {
  29300. result2 = null;
  29301. if (reportFailures === 0) {
  29302. matchFailed("[0-9]");
  29303. }
  29304. }
  29305. if (result2 !== null) {
  29306. result1 = [];
  29307. while (result2 !== null) {
  29308. result1.push(result2);
  29309. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29310. result2 = input.charAt(pos.offset);
  29311. advance(pos, 1);
  29312. } else {
  29313. result2 = null;
  29314. if (reportFailures === 0) {
  29315. matchFailed("[0-9]");
  29316. }
  29317. }
  29318. }
  29319. } else {
  29320. result1 = null;
  29321. }
  29322. if (result1 !== null) {
  29323. if (input.charCodeAt(pos.offset) === 46) {
  29324. result2 = ".";
  29325. advance(pos, 1);
  29326. } else {
  29327. result2 = null;
  29328. if (reportFailures === 0) {
  29329. matchFailed("\".\"");
  29330. }
  29331. }
  29332. if (result2 !== null) {
  29333. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29334. result4 = input.charAt(pos.offset);
  29335. advance(pos, 1);
  29336. } else {
  29337. result4 = null;
  29338. if (reportFailures === 0) {
  29339. matchFailed("[0-9]");
  29340. }
  29341. }
  29342. if (result4 !== null) {
  29343. result3 = [];
  29344. while (result4 !== null) {
  29345. result3.push(result4);
  29346. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29347. result4 = input.charAt(pos.offset);
  29348. advance(pos, 1);
  29349. } else {
  29350. result4 = null;
  29351. if (reportFailures === 0) {
  29352. matchFailed("[0-9]");
  29353. }
  29354. }
  29355. }
  29356. } else {
  29357. result3 = null;
  29358. }
  29359. if (result3 !== null) {
  29360. result0 = [result0, result1, result2, result3];
  29361. } else {
  29362. result0 = null;
  29363. pos = clone(pos1);
  29364. }
  29365. } else {
  29366. result0 = null;
  29367. pos = clone(pos1);
  29368. }
  29369. } else {
  29370. result0 = null;
  29371. pos = clone(pos1);
  29372. }
  29373. } else {
  29374. result0 = null;
  29375. pos = clone(pos1);
  29376. }
  29377. if (result0 !== null) {
  29378. result0 = (function(offset, line, column, neg, digits, dec) {return parseFloat((neg + digits.join("") + "." + dec.join("")), 10);})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1], result0[3]);
  29379. }
  29380. if (result0 === null) {
  29381. pos = clone(pos0);
  29382. }
  29383. cache[cacheKey] = {
  29384. nextPos: clone(pos),
  29385. result: result0
  29386. };
  29387. return result0;
  29388. }
  29389. function parse_integer() {
  29390. var cacheKey = "integer@" + pos.offset;
  29391. var cachedResult = cache[cacheKey];
  29392. if (cachedResult) {
  29393. pos = clone(cachedResult.nextPos);
  29394. return cachedResult.result;
  29395. }
  29396. var result0, result1, result2;
  29397. var pos0, pos1;
  29398. pos0 = clone(pos);
  29399. pos1 = clone(pos);
  29400. if (/^[\-]/.test(input.charAt(pos.offset))) {
  29401. result0 = input.charAt(pos.offset);
  29402. advance(pos, 1);
  29403. } else {
  29404. result0 = null;
  29405. if (reportFailures === 0) {
  29406. matchFailed("[\\-]");
  29407. }
  29408. }
  29409. result0 = result0 !== null ? result0 : "";
  29410. if (result0 !== null) {
  29411. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29412. result2 = input.charAt(pos.offset);
  29413. advance(pos, 1);
  29414. } else {
  29415. result2 = null;
  29416. if (reportFailures === 0) {
  29417. matchFailed("[0-9]");
  29418. }
  29419. }
  29420. if (result2 !== null) {
  29421. result1 = [];
  29422. while (result2 !== null) {
  29423. result1.push(result2);
  29424. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  29425. result2 = input.charAt(pos.offset);
  29426. advance(pos, 1);
  29427. } else {
  29428. result2 = null;
  29429. if (reportFailures === 0) {
  29430. matchFailed("[0-9]");
  29431. }
  29432. }
  29433. }
  29434. } else {
  29435. result1 = null;
  29436. }
  29437. if (result1 !== null) {
  29438. result0 = [result0, result1];
  29439. } else {
  29440. result0 = null;
  29441. pos = clone(pos1);
  29442. }
  29443. } else {
  29444. result0 = null;
  29445. pos = clone(pos1);
  29446. }
  29447. if (result0 !== null) {
  29448. result0 = (function(offset, line, column, neg, digits) {return (parseInt(neg+digits.join(""), 10));})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  29449. }
  29450. if (result0 === null) {
  29451. pos = clone(pos0);
  29452. }
  29453. cache[cacheKey] = {
  29454. nextPos: clone(pos),
  29455. result: result0
  29456. };
  29457. return result0;
  29458. }
  29459. function parse_literalArray() {
  29460. var cacheKey = "literalArray@" + pos.offset;
  29461. var cachedResult = cache[cacheKey];
  29462. if (cachedResult) {
  29463. pos = clone(cachedResult.nextPos);
  29464. return cachedResult.result;
  29465. }
  29466. var result0, result1;
  29467. var pos0, pos1;
  29468. pos0 = clone(pos);
  29469. pos1 = clone(pos);
  29470. if (input.substr(pos.offset, 2) === "#(") {
  29471. result0 = "#(";
  29472. advance(pos, 2);
  29473. } else {
  29474. result0 = null;
  29475. if (reportFailures === 0) {
  29476. matchFailed("\"#(\"");
  29477. }
  29478. }
  29479. if (result0 !== null) {
  29480. result1 = parse_literalArrayRest();
  29481. if (result1 !== null) {
  29482. result0 = [result0, result1];
  29483. } else {
  29484. result0 = null;
  29485. pos = clone(pos1);
  29486. }
  29487. } else {
  29488. result0 = null;
  29489. pos = clone(pos1);
  29490. }
  29491. if (result0 !== null) {
  29492. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29493. }
  29494. if (result0 === null) {
  29495. pos = clone(pos0);
  29496. }
  29497. cache[cacheKey] = {
  29498. nextPos: clone(pos),
  29499. result: result0
  29500. };
  29501. return result0;
  29502. }
  29503. function parse_bareLiteralArray() {
  29504. var cacheKey = "bareLiteralArray@" + pos.offset;
  29505. var cachedResult = cache[cacheKey];
  29506. if (cachedResult) {
  29507. pos = clone(cachedResult.nextPos);
  29508. return cachedResult.result;
  29509. }
  29510. var result0, result1;
  29511. var pos0, pos1;
  29512. pos0 = clone(pos);
  29513. pos1 = clone(pos);
  29514. if (input.charCodeAt(pos.offset) === 40) {
  29515. result0 = "(";
  29516. advance(pos, 1);
  29517. } else {
  29518. result0 = null;
  29519. if (reportFailures === 0) {
  29520. matchFailed("\"(\"");
  29521. }
  29522. }
  29523. if (result0 !== null) {
  29524. result1 = parse_literalArrayRest();
  29525. if (result1 !== null) {
  29526. result0 = [result0, result1];
  29527. } else {
  29528. result0 = null;
  29529. pos = clone(pos1);
  29530. }
  29531. } else {
  29532. result0 = null;
  29533. pos = clone(pos1);
  29534. }
  29535. if (result0 !== null) {
  29536. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  29537. }
  29538. if (result0 === null) {
  29539. pos = clone(pos0);
  29540. }
  29541. cache[cacheKey] = {
  29542. nextPos: clone(pos),
  29543. result: result0
  29544. };
  29545. return result0;
  29546. }
  29547. function parse_literalArrayRest() {
  29548. var cacheKey = "literalArrayRest@" + pos.offset;
  29549. var cachedResult = cache[cacheKey];
  29550. if (cachedResult) {
  29551. pos = clone(cachedResult.nextPos);
  29552. return cachedResult.result;
  29553. }
  29554. var result0, result1, result2, result3;
  29555. var pos0, pos1, pos2, pos3;
  29556. pos0 = clone(pos);
  29557. pos1 = clone(pos);
  29558. result0 = parse_ws();
  29559. if (result0 !== null) {
  29560. result1 = [];
  29561. pos2 = clone(pos);
  29562. pos3 = clone(pos);
  29563. result2 = parse_parseTimeLiteral();
  29564. if (result2 === null) {
  29565. result2 = parse_bareLiteralArray();
  29566. if (result2 === null) {
  29567. result2 = parse_bareSymbol();
  29568. }
  29569. }
  29570. if (result2 !== null) {
  29571. result3 = parse_ws();
  29572. if (result3 !== null) {
  29573. result2 = [result2, result3];
  29574. } else {
  29575. result2 = null;
  29576. pos = clone(pos3);
  29577. }
  29578. } else {
  29579. result2 = null;
  29580. pos = clone(pos3);
  29581. }
  29582. if (result2 !== null) {
  29583. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  29584. }
  29585. if (result2 === null) {
  29586. pos = clone(pos2);
  29587. }
  29588. while (result2 !== null) {
  29589. result1.push(result2);
  29590. pos2 = clone(pos);
  29591. pos3 = clone(pos);
  29592. result2 = parse_parseTimeLiteral();
  29593. if (result2 === null) {
  29594. result2 = parse_bareLiteralArray();
  29595. if (result2 === null) {
  29596. result2 = parse_bareSymbol();
  29597. }
  29598. }
  29599. if (result2 !== null) {
  29600. result3 = parse_ws();
  29601. if (result3 !== null) {
  29602. result2 = [result2, result3];
  29603. } else {
  29604. result2 = null;
  29605. pos = clone(pos3);
  29606. }
  29607. } else {
  29608. result2 = null;
  29609. pos = clone(pos3);
  29610. }
  29611. if (result2 !== null) {
  29612. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  29613. }
  29614. if (result2 === null) {
  29615. pos = clone(pos2);
  29616. }
  29617. }
  29618. if (result1 !== null) {
  29619. result2 = parse_ws();
  29620. if (result2 !== null) {
  29621. if (input.charCodeAt(pos.offset) === 41) {
  29622. result3 = ")";
  29623. advance(pos, 1);
  29624. } else {
  29625. result3 = null;
  29626. if (reportFailures === 0) {
  29627. matchFailed("\")\"");
  29628. }
  29629. }
  29630. if (result3 !== null) {
  29631. result0 = [result0, result1, result2, result3];
  29632. } else {
  29633. result0 = null;
  29634. pos = clone(pos1);
  29635. }
  29636. } else {
  29637. result0 = null;
  29638. pos = clone(pos1);
  29639. }
  29640. } else {
  29641. result0 = null;
  29642. pos = clone(pos1);
  29643. }
  29644. } else {
  29645. result0 = null;
  29646. pos = clone(pos1);
  29647. }
  29648. if (result0 !== null) {
  29649. result0 = (function(offset, line, column, lits) {
  29650. return smalltalk.ValueNode._new()
  29651. ._position_((line).__at(column))
  29652. ._value_(lits);
  29653. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  29654. }
  29655. if (result0 === null) {
  29656. pos = clone(pos0);
  29657. }
  29658. cache[cacheKey] = {
  29659. nextPos: clone(pos),
  29660. result: result0
  29661. };
  29662. return result0;
  29663. }
  29664. function parse_dynamicArray() {
  29665. var cacheKey = "dynamicArray@" + pos.offset;
  29666. var cachedResult = cache[cacheKey];
  29667. if (cachedResult) {
  29668. pos = clone(cachedResult.nextPos);
  29669. return cachedResult.result;
  29670. }
  29671. var result0, result1, result2, result3, result4, result5;
  29672. var pos0, pos1;
  29673. pos0 = clone(pos);
  29674. pos1 = clone(pos);
  29675. if (input.charCodeAt(pos.offset) === 123) {
  29676. result0 = "{";
  29677. advance(pos, 1);
  29678. } else {
  29679. result0 = null;
  29680. if (reportFailures === 0) {
  29681. matchFailed("\"{\"");
  29682. }
  29683. }
  29684. if (result0 !== null) {
  29685. result1 = parse_ws();
  29686. if (result1 !== null) {
  29687. result2 = parse_expressions();
  29688. result2 = result2 !== null ? result2 : "";
  29689. if (result2 !== null) {
  29690. result3 = parse_ws();
  29691. if (result3 !== null) {
  29692. if (input.charCodeAt(pos.offset) === 46) {
  29693. result4 = ".";
  29694. advance(pos, 1);
  29695. } else {
  29696. result4 = null;
  29697. if (reportFailures === 0) {
  29698. matchFailed("\".\"");
  29699. }
  29700. }
  29701. result4 = result4 !== null ? result4 : "";
  29702. if (result4 !== null) {
  29703. if (input.charCodeAt(pos.offset) === 125) {
  29704. result5 = "}";
  29705. advance(pos, 1);
  29706. } else {
  29707. result5 = null;
  29708. if (reportFailures === 0) {
  29709. matchFailed("\"}\"");
  29710. }
  29711. }
  29712. if (result5 !== null) {
  29713. result0 = [result0, result1, result2, result3, result4, result5];
  29714. } else {
  29715. result0 = null;
  29716. pos = clone(pos1);
  29717. }
  29718. } else {
  29719. result0 = null;
  29720. pos = clone(pos1);
  29721. }
  29722. } else {
  29723. result0 = null;
  29724. pos = clone(pos1);
  29725. }
  29726. } else {
  29727. result0 = null;
  29728. pos = clone(pos1);
  29729. }
  29730. } else {
  29731. result0 = null;
  29732. pos = clone(pos1);
  29733. }
  29734. } else {
  29735. result0 = null;
  29736. pos = clone(pos1);
  29737. }
  29738. if (result0 !== null) {
  29739. result0 = (function(offset, line, column, expressions) {
  29740. return smalltalk.DynamicArrayNode._new()
  29741. ._position_((line).__at(column))
  29742. ._nodes_(expressions);
  29743. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  29744. }
  29745. if (result0 === null) {
  29746. pos = clone(pos0);
  29747. }
  29748. cache[cacheKey] = {
  29749. nextPos: clone(pos),
  29750. result: result0
  29751. };
  29752. return result0;
  29753. }
  29754. function parse_dynamicDictionary() {
  29755. var cacheKey = "dynamicDictionary@" + pos.offset;
  29756. var cachedResult = cache[cacheKey];
  29757. if (cachedResult) {
  29758. pos = clone(cachedResult.nextPos);
  29759. return cachedResult.result;
  29760. }
  29761. var result0, result1, result2, result3, result4;
  29762. var pos0, pos1;
  29763. pos0 = clone(pos);
  29764. pos1 = clone(pos);
  29765. if (input.substr(pos.offset, 2) === "#{") {
  29766. result0 = "#{";
  29767. advance(pos, 2);
  29768. } else {
  29769. result0 = null;
  29770. if (reportFailures === 0) {
  29771. matchFailed("\"#{\"");
  29772. }
  29773. }
  29774. if (result0 !== null) {
  29775. result1 = parse_ws();
  29776. if (result1 !== null) {
  29777. result2 = parse_expressions();
  29778. result2 = result2 !== null ? result2 : "";
  29779. if (result2 !== null) {
  29780. result3 = parse_ws();
  29781. if (result3 !== null) {
  29782. if (input.charCodeAt(pos.offset) === 125) {
  29783. result4 = "}";
  29784. advance(pos, 1);
  29785. } else {
  29786. result4 = null;
  29787. if (reportFailures === 0) {
  29788. matchFailed("\"}\"");
  29789. }
  29790. }
  29791. if (result4 !== null) {
  29792. result0 = [result0, result1, result2, result3, result4];
  29793. } else {
  29794. result0 = null;
  29795. pos = clone(pos1);
  29796. }
  29797. } else {
  29798. result0 = null;
  29799. pos = clone(pos1);
  29800. }
  29801. } else {
  29802. result0 = null;
  29803. pos = clone(pos1);
  29804. }
  29805. } else {
  29806. result0 = null;
  29807. pos = clone(pos1);
  29808. }
  29809. } else {
  29810. result0 = null;
  29811. pos = clone(pos1);
  29812. }
  29813. if (result0 !== null) {
  29814. result0 = (function(offset, line, column, expressions) {
  29815. return smalltalk.DynamicDictionaryNode._new()
  29816. ._position_((line).__at(column))
  29817. ._nodes_(expressions);
  29818. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  29819. }
  29820. if (result0 === null) {
  29821. pos = clone(pos0);
  29822. }
  29823. cache[cacheKey] = {
  29824. nextPos: clone(pos),
  29825. result: result0
  29826. };
  29827. return result0;
  29828. }
  29829. function parse_pseudoVariable() {
  29830. var cacheKey = "pseudoVariable@" + pos.offset;
  29831. var cachedResult = cache[cacheKey];
  29832. if (cachedResult) {
  29833. pos = clone(cachedResult.nextPos);
  29834. return cachedResult.result;
  29835. }
  29836. var result0;
  29837. var pos0, pos1;
  29838. pos0 = clone(pos);
  29839. pos1 = clone(pos);
  29840. if (input.substr(pos.offset, 4) === "true") {
  29841. result0 = "true";
  29842. advance(pos, 4);
  29843. } else {
  29844. result0 = null;
  29845. if (reportFailures === 0) {
  29846. matchFailed("\"true\"");
  29847. }
  29848. }
  29849. if (result0 !== null) {
  29850. result0 = (function(offset, line, column) {return true;})(pos1.offset, pos1.line, pos1.column);
  29851. }
  29852. if (result0 === null) {
  29853. pos = clone(pos1);
  29854. }
  29855. if (result0 === null) {
  29856. pos1 = clone(pos);
  29857. if (input.substr(pos.offset, 5) === "false") {
  29858. result0 = "false";
  29859. advance(pos, 5);
  29860. } else {
  29861. result0 = null;
  29862. if (reportFailures === 0) {
  29863. matchFailed("\"false\"");
  29864. }
  29865. }
  29866. if (result0 !== null) {
  29867. result0 = (function(offset, line, column) {return false;})(pos1.offset, pos1.line, pos1.column);
  29868. }
  29869. if (result0 === null) {
  29870. pos = clone(pos1);
  29871. }
  29872. if (result0 === null) {
  29873. pos1 = clone(pos);
  29874. if (input.substr(pos.offset, 3) === "nil") {
  29875. result0 = "nil";
  29876. advance(pos, 3);
  29877. } else {
  29878. result0 = null;
  29879. if (reportFailures === 0) {
  29880. matchFailed("\"nil\"");
  29881. }
  29882. }
  29883. if (result0 !== null) {
  29884. result0 = (function(offset, line, column) {return nil;})(pos1.offset, pos1.line, pos1.column);
  29885. }
  29886. if (result0 === null) {
  29887. pos = clone(pos1);
  29888. }
  29889. }
  29890. }
  29891. if (result0 !== null) {
  29892. result0 = (function(offset, line, column, val) {
  29893. return smalltalk.ValueNode._new()
  29894. ._position_((line).__at(column))
  29895. ._value_(val);
  29896. })(pos0.offset, pos0.line, pos0.column, result0);
  29897. }
  29898. if (result0 === null) {
  29899. pos = clone(pos0);
  29900. }
  29901. cache[cacheKey] = {
  29902. nextPos: clone(pos),
  29903. result: result0
  29904. };
  29905. return result0;
  29906. }
  29907. function parse_parseTimeLiteral() {
  29908. var cacheKey = "parseTimeLiteral@" + pos.offset;
  29909. var cachedResult = cache[cacheKey];
  29910. if (cachedResult) {
  29911. pos = clone(cachedResult.nextPos);
  29912. return cachedResult.result;
  29913. }
  29914. var result0;
  29915. result0 = parse_pseudoVariable();
  29916. if (result0 === null) {
  29917. result0 = parse_number();
  29918. if (result0 === null) {
  29919. result0 = parse_literalArray();
  29920. if (result0 === null) {
  29921. result0 = parse_string();
  29922. if (result0 === null) {
  29923. result0 = parse_symbol();
  29924. }
  29925. }
  29926. }
  29927. }
  29928. cache[cacheKey] = {
  29929. nextPos: clone(pos),
  29930. result: result0
  29931. };
  29932. return result0;
  29933. }
  29934. function parse_runtimeLiteral() {
  29935. var cacheKey = "runtimeLiteral@" + pos.offset;
  29936. var cachedResult = cache[cacheKey];
  29937. if (cachedResult) {
  29938. pos = clone(cachedResult.nextPos);
  29939. return cachedResult.result;
  29940. }
  29941. var result0;
  29942. result0 = parse_dynamicDictionary();
  29943. if (result0 === null) {
  29944. result0 = parse_dynamicArray();
  29945. if (result0 === null) {
  29946. result0 = parse_block();
  29947. }
  29948. }
  29949. cache[cacheKey] = {
  29950. nextPos: clone(pos),
  29951. result: result0
  29952. };
  29953. return result0;
  29954. }
  29955. function parse_literal() {
  29956. var cacheKey = "literal@" + pos.offset;
  29957. var cachedResult = cache[cacheKey];
  29958. if (cachedResult) {
  29959. pos = clone(cachedResult.nextPos);
  29960. return cachedResult.result;
  29961. }
  29962. var result0;
  29963. result0 = parse_runtimeLiteral();
  29964. if (result0 === null) {
  29965. result0 = parse_parseTimeLiteral();
  29966. }
  29967. cache[cacheKey] = {
  29968. nextPos: clone(pos),
  29969. result: result0
  29970. };
  29971. return result0;
  29972. }
  29973. function parse_variable() {
  29974. var cacheKey = "variable@" + pos.offset;
  29975. var cachedResult = cache[cacheKey];
  29976. if (cachedResult) {
  29977. pos = clone(cachedResult.nextPos);
  29978. return cachedResult.result;
  29979. }
  29980. var result0;
  29981. var pos0;
  29982. pos0 = clone(pos);
  29983. result0 = parse_varIdentifier();
  29984. if (result0 !== null) {
  29985. result0 = (function(offset, line, column, identifier) {
  29986. return smalltalk.VariableNode._new()
  29987. ._position_((line).__at(column))
  29988. ._value_(identifier);
  29989. })(pos0.offset, pos0.line, pos0.column, result0);
  29990. }
  29991. if (result0 === null) {
  29992. pos = clone(pos0);
  29993. }
  29994. cache[cacheKey] = {
  29995. nextPos: clone(pos),
  29996. result: result0
  29997. };
  29998. return result0;
  29999. }
  30000. function parse_classReference() {
  30001. var cacheKey = "classReference@" + pos.offset;
  30002. var cachedResult = cache[cacheKey];
  30003. if (cachedResult) {
  30004. pos = clone(cachedResult.nextPos);
  30005. return cachedResult.result;
  30006. }
  30007. var result0;
  30008. var pos0;
  30009. pos0 = clone(pos);
  30010. result0 = parse_className();
  30011. if (result0 !== null) {
  30012. result0 = (function(offset, line, column, className) {
  30013. return smalltalk.ClassReferenceNode._new()
  30014. ._position_((line).__at(column))
  30015. ._value_(className);
  30016. })(pos0.offset, pos0.line, pos0.column, result0);
  30017. }
  30018. if (result0 === null) {
  30019. pos = clone(pos0);
  30020. }
  30021. cache[cacheKey] = {
  30022. nextPos: clone(pos),
  30023. result: result0
  30024. };
  30025. return result0;
  30026. }
  30027. function parse_reference() {
  30028. var cacheKey = "reference@" + pos.offset;
  30029. var cachedResult = cache[cacheKey];
  30030. if (cachedResult) {
  30031. pos = clone(cachedResult.nextPos);
  30032. return cachedResult.result;
  30033. }
  30034. var result0;
  30035. result0 = parse_variable();
  30036. if (result0 === null) {
  30037. result0 = parse_classReference();
  30038. }
  30039. cache[cacheKey] = {
  30040. nextPos: clone(pos),
  30041. result: result0
  30042. };
  30043. return result0;
  30044. }
  30045. function parse_keywordPair() {
  30046. var cacheKey = "keywordPair@" + pos.offset;
  30047. var cachedResult = cache[cacheKey];
  30048. if (cachedResult) {
  30049. pos = clone(cachedResult.nextPos);
  30050. return cachedResult.result;
  30051. }
  30052. var result0, result1, result2, result3;
  30053. var pos0, pos1;
  30054. pos0 = clone(pos);
  30055. pos1 = clone(pos);
  30056. result0 = parse_keyword();
  30057. if (result0 !== null) {
  30058. result1 = parse_ws();
  30059. if (result1 !== null) {
  30060. result2 = parse_binarySend();
  30061. if (result2 !== null) {
  30062. result3 = parse_ws();
  30063. if (result3 !== null) {
  30064. result0 = [result0, result1, result2, result3];
  30065. } else {
  30066. result0 = null;
  30067. pos = clone(pos1);
  30068. }
  30069. } else {
  30070. result0 = null;
  30071. pos = clone(pos1);
  30072. }
  30073. } else {
  30074. result0 = null;
  30075. pos = clone(pos1);
  30076. }
  30077. } else {
  30078. result0 = null;
  30079. pos = clone(pos1);
  30080. }
  30081. if (result0 !== null) {
  30082. result0 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  30083. }
  30084. if (result0 === null) {
  30085. pos = clone(pos0);
  30086. }
  30087. cache[cacheKey] = {
  30088. nextPos: clone(pos),
  30089. result: result0
  30090. };
  30091. return result0;
  30092. }
  30093. function parse_binarySelector() {
  30094. var cacheKey = "binarySelector@" + pos.offset;
  30095. var cachedResult = cache[cacheKey];
  30096. if (cachedResult) {
  30097. pos = clone(cachedResult.nextPos);
  30098. return cachedResult.result;
  30099. }
  30100. var result0, result1;
  30101. var pos0;
  30102. pos0 = clone(pos);
  30103. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  30104. result1 = input.charAt(pos.offset);
  30105. advance(pos, 1);
  30106. } else {
  30107. result1 = null;
  30108. if (reportFailures === 0) {
  30109. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  30110. }
  30111. }
  30112. if (result1 !== null) {
  30113. result0 = [];
  30114. while (result1 !== null) {
  30115. result0.push(result1);
  30116. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  30117. result1 = input.charAt(pos.offset);
  30118. advance(pos, 1);
  30119. } else {
  30120. result1 = null;
  30121. if (reportFailures === 0) {
  30122. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  30123. }
  30124. }
  30125. }
  30126. } else {
  30127. result0 = null;
  30128. }
  30129. if (result0 !== null) {
  30130. result0 = (function(offset, line, column, bin) {return bin.join("");})(pos0.offset, pos0.line, pos0.column, result0);
  30131. }
  30132. if (result0 === null) {
  30133. pos = clone(pos0);
  30134. }
  30135. cache[cacheKey] = {
  30136. nextPos: clone(pos),
  30137. result: result0
  30138. };
  30139. return result0;
  30140. }
  30141. function parse_keywordPattern() {
  30142. var cacheKey = "keywordPattern@" + pos.offset;
  30143. var cachedResult = cache[cacheKey];
  30144. if (cachedResult) {
  30145. pos = clone(cachedResult.nextPos);
  30146. return cachedResult.result;
  30147. }
  30148. var result0, result1, result2, result3, result4;
  30149. var pos0, pos1, pos2;
  30150. pos0 = clone(pos);
  30151. pos1 = clone(pos);
  30152. pos2 = clone(pos);
  30153. result1 = parse_ws();
  30154. if (result1 !== null) {
  30155. result2 = parse_keyword();
  30156. if (result2 !== null) {
  30157. result3 = parse_ws();
  30158. if (result3 !== null) {
  30159. result4 = parse_identifier();
  30160. if (result4 !== null) {
  30161. result1 = [result1, result2, result3, result4];
  30162. } else {
  30163. result1 = null;
  30164. pos = clone(pos2);
  30165. }
  30166. } else {
  30167. result1 = null;
  30168. pos = clone(pos2);
  30169. }
  30170. } else {
  30171. result1 = null;
  30172. pos = clone(pos2);
  30173. }
  30174. } else {
  30175. result1 = null;
  30176. pos = clone(pos2);
  30177. }
  30178. if (result1 !== null) {
  30179. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  30180. }
  30181. if (result1 === null) {
  30182. pos = clone(pos1);
  30183. }
  30184. if (result1 !== null) {
  30185. result0 = [];
  30186. while (result1 !== null) {
  30187. result0.push(result1);
  30188. pos1 = clone(pos);
  30189. pos2 = clone(pos);
  30190. result1 = parse_ws();
  30191. if (result1 !== null) {
  30192. result2 = parse_keyword();
  30193. if (result2 !== null) {
  30194. result3 = parse_ws();
  30195. if (result3 !== null) {
  30196. result4 = parse_identifier();
  30197. if (result4 !== null) {
  30198. result1 = [result1, result2, result3, result4];
  30199. } else {
  30200. result1 = null;
  30201. pos = clone(pos2);
  30202. }
  30203. } else {
  30204. result1 = null;
  30205. pos = clone(pos2);
  30206. }
  30207. } else {
  30208. result1 = null;
  30209. pos = clone(pos2);
  30210. }
  30211. } else {
  30212. result1 = null;
  30213. pos = clone(pos2);
  30214. }
  30215. if (result1 !== null) {
  30216. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  30217. }
  30218. if (result1 === null) {
  30219. pos = clone(pos1);
  30220. }
  30221. }
  30222. } else {
  30223. result0 = null;
  30224. }
  30225. if (result0 !== null) {
  30226. result0 = (function(offset, line, column, pairs) {
  30227. var keywords = [];
  30228. var params = [];
  30229. var i = 0;
  30230. for(i = 0; i < pairs.length; i++){
  30231. keywords.push(pairs[i].key);
  30232. }
  30233. for(i = 0; i < pairs.length; i++){
  30234. params.push(pairs[i].arg);
  30235. }
  30236. return [keywords.join(""), params];
  30237. })(pos0.offset, pos0.line, pos0.column, result0);
  30238. }
  30239. if (result0 === null) {
  30240. pos = clone(pos0);
  30241. }
  30242. cache[cacheKey] = {
  30243. nextPos: clone(pos),
  30244. result: result0
  30245. };
  30246. return result0;
  30247. }
  30248. function parse_binaryPattern() {
  30249. var cacheKey = "binaryPattern@" + pos.offset;
  30250. var cachedResult = cache[cacheKey];
  30251. if (cachedResult) {
  30252. pos = clone(cachedResult.nextPos);
  30253. return cachedResult.result;
  30254. }
  30255. var result0, result1, result2, result3;
  30256. var pos0, pos1;
  30257. pos0 = clone(pos);
  30258. pos1 = clone(pos);
  30259. result0 = parse_ws();
  30260. if (result0 !== null) {
  30261. result1 = parse_binarySelector();
  30262. if (result1 !== null) {
  30263. result2 = parse_ws();
  30264. if (result2 !== null) {
  30265. result3 = parse_identifier();
  30266. if (result3 !== null) {
  30267. result0 = [result0, result1, result2, result3];
  30268. } else {
  30269. result0 = null;
  30270. pos = clone(pos1);
  30271. }
  30272. } else {
  30273. result0 = null;
  30274. pos = clone(pos1);
  30275. }
  30276. } else {
  30277. result0 = null;
  30278. pos = clone(pos1);
  30279. }
  30280. } else {
  30281. result0 = null;
  30282. pos = clone(pos1);
  30283. }
  30284. if (result0 !== null) {
  30285. result0 = (function(offset, line, column, selector, arg) {return [selector, [arg]];})(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  30286. }
  30287. if (result0 === null) {
  30288. pos = clone(pos0);
  30289. }
  30290. cache[cacheKey] = {
  30291. nextPos: clone(pos),
  30292. result: result0
  30293. };
  30294. return result0;
  30295. }
  30296. function parse_unaryPattern() {
  30297. var cacheKey = "unaryPattern@" + pos.offset;
  30298. var cachedResult = cache[cacheKey];
  30299. if (cachedResult) {
  30300. pos = clone(cachedResult.nextPos);
  30301. return cachedResult.result;
  30302. }
  30303. var result0, result1;
  30304. var pos0, pos1;
  30305. pos0 = clone(pos);
  30306. pos1 = clone(pos);
  30307. result0 = parse_ws();
  30308. if (result0 !== null) {
  30309. result1 = parse_identifier();
  30310. if (result1 !== null) {
  30311. result0 = [result0, result1];
  30312. } else {
  30313. result0 = null;
  30314. pos = clone(pos1);
  30315. }
  30316. } else {
  30317. result0 = null;
  30318. pos = clone(pos1);
  30319. }
  30320. if (result0 !== null) {
  30321. result0 = (function(offset, line, column, selector) {return [selector, []];})(pos0.offset, pos0.line, pos0.column, result0[1]);
  30322. }
  30323. if (result0 === null) {
  30324. pos = clone(pos0);
  30325. }
  30326. cache[cacheKey] = {
  30327. nextPos: clone(pos),
  30328. result: result0
  30329. };
  30330. return result0;
  30331. }
  30332. function parse_expression() {
  30333. var cacheKey = "expression@" + pos.offset;
  30334. var cachedResult = cache[cacheKey];
  30335. if (cachedResult) {
  30336. pos = clone(cachedResult.nextPos);
  30337. return cachedResult.result;
  30338. }
  30339. var result0;
  30340. result0 = parse_assignment();
  30341. if (result0 === null) {
  30342. result0 = parse_cascade();
  30343. if (result0 === null) {
  30344. result0 = parse_keywordSend();
  30345. if (result0 === null) {
  30346. result0 = parse_binarySend();
  30347. }
  30348. }
  30349. }
  30350. cache[cacheKey] = {
  30351. nextPos: clone(pos),
  30352. result: result0
  30353. };
  30354. return result0;
  30355. }
  30356. function parse_expressionList() {
  30357. var cacheKey = "expressionList@" + pos.offset;
  30358. var cachedResult = cache[cacheKey];
  30359. if (cachedResult) {
  30360. pos = clone(cachedResult.nextPos);
  30361. return cachedResult.result;
  30362. }
  30363. var result0, result1, result2, result3;
  30364. var pos0, pos1;
  30365. pos0 = clone(pos);
  30366. pos1 = clone(pos);
  30367. result0 = parse_ws();
  30368. if (result0 !== null) {
  30369. if (input.charCodeAt(pos.offset) === 46) {
  30370. result1 = ".";
  30371. advance(pos, 1);
  30372. } else {
  30373. result1 = null;
  30374. if (reportFailures === 0) {
  30375. matchFailed("\".\"");
  30376. }
  30377. }
  30378. if (result1 !== null) {
  30379. result2 = parse_ws();
  30380. if (result2 !== null) {
  30381. result3 = parse_expression();
  30382. if (result3 !== null) {
  30383. result0 = [result0, result1, result2, result3];
  30384. } else {
  30385. result0 = null;
  30386. pos = clone(pos1);
  30387. }
  30388. } else {
  30389. result0 = null;
  30390. pos = clone(pos1);
  30391. }
  30392. } else {
  30393. result0 = null;
  30394. pos = clone(pos1);
  30395. }
  30396. } else {
  30397. result0 = null;
  30398. pos = clone(pos1);
  30399. }
  30400. if (result0 !== null) {
  30401. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[3]);
  30402. }
  30403. if (result0 === null) {
  30404. pos = clone(pos0);
  30405. }
  30406. cache[cacheKey] = {
  30407. nextPos: clone(pos),
  30408. result: result0
  30409. };
  30410. return result0;
  30411. }
  30412. function parse_expressions() {
  30413. var cacheKey = "expressions@" + pos.offset;
  30414. var cachedResult = cache[cacheKey];
  30415. if (cachedResult) {
  30416. pos = clone(cachedResult.nextPos);
  30417. return cachedResult.result;
  30418. }
  30419. var result0, result1, result2;
  30420. var pos0, pos1;
  30421. pos0 = clone(pos);
  30422. pos1 = clone(pos);
  30423. result0 = parse_expression();
  30424. if (result0 !== null) {
  30425. result1 = [];
  30426. result2 = parse_expressionList();
  30427. while (result2 !== null) {
  30428. result1.push(result2);
  30429. result2 = parse_expressionList();
  30430. }
  30431. if (result1 !== null) {
  30432. result0 = [result0, result1];
  30433. } else {
  30434. result0 = null;
  30435. pos = clone(pos1);
  30436. }
  30437. } else {
  30438. result0 = null;
  30439. pos = clone(pos1);
  30440. }
  30441. if (result0 !== null) {
  30442. result0 = (function(offset, line, column, first, others) {
  30443. var result = [first];
  30444. for(var i = 0; i < others.length; i++) {
  30445. result.push(others[i]);
  30446. }
  30447. return result;
  30448. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30449. }
  30450. if (result0 === null) {
  30451. pos = clone(pos0);
  30452. }
  30453. cache[cacheKey] = {
  30454. nextPos: clone(pos),
  30455. result: result0
  30456. };
  30457. return result0;
  30458. }
  30459. function parse_assignment() {
  30460. var cacheKey = "assignment@" + pos.offset;
  30461. var cachedResult = cache[cacheKey];
  30462. if (cachedResult) {
  30463. pos = clone(cachedResult.nextPos);
  30464. return cachedResult.result;
  30465. }
  30466. var result0, result1, result2, result3, result4;
  30467. var pos0, pos1;
  30468. pos0 = clone(pos);
  30469. pos1 = clone(pos);
  30470. result0 = parse_variable();
  30471. if (result0 !== null) {
  30472. result1 = parse_ws();
  30473. if (result1 !== null) {
  30474. if (input.substr(pos.offset, 2) === ":=") {
  30475. result2 = ":=";
  30476. advance(pos, 2);
  30477. } else {
  30478. result2 = null;
  30479. if (reportFailures === 0) {
  30480. matchFailed("\":=\"");
  30481. }
  30482. }
  30483. if (result2 !== null) {
  30484. result3 = parse_ws();
  30485. if (result3 !== null) {
  30486. result4 = parse_expression();
  30487. if (result4 !== null) {
  30488. result0 = [result0, result1, result2, result3, result4];
  30489. } else {
  30490. result0 = null;
  30491. pos = clone(pos1);
  30492. }
  30493. } else {
  30494. result0 = null;
  30495. pos = clone(pos1);
  30496. }
  30497. } else {
  30498. result0 = null;
  30499. pos = clone(pos1);
  30500. }
  30501. } else {
  30502. result0 = null;
  30503. pos = clone(pos1);
  30504. }
  30505. } else {
  30506. result0 = null;
  30507. pos = clone(pos1);
  30508. }
  30509. if (result0 !== null) {
  30510. result0 = (function(offset, line, column, variable, expression) {
  30511. return smalltalk.AssignmentNode._new()
  30512. ._position_((line).__at(column))
  30513. ._left_(variable)
  30514. ._right_(expression);
  30515. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  30516. }
  30517. if (result0 === null) {
  30518. pos = clone(pos0);
  30519. }
  30520. cache[cacheKey] = {
  30521. nextPos: clone(pos),
  30522. result: result0
  30523. };
  30524. return result0;
  30525. }
  30526. function parse_ret() {
  30527. var cacheKey = "ret@" + pos.offset;
  30528. var cachedResult = cache[cacheKey];
  30529. if (cachedResult) {
  30530. pos = clone(cachedResult.nextPos);
  30531. return cachedResult.result;
  30532. }
  30533. var result0, result1, result2, result3, result4;
  30534. var pos0, pos1;
  30535. pos0 = clone(pos);
  30536. pos1 = clone(pos);
  30537. if (input.charCodeAt(pos.offset) === 94) {
  30538. result0 = "^";
  30539. advance(pos, 1);
  30540. } else {
  30541. result0 = null;
  30542. if (reportFailures === 0) {
  30543. matchFailed("\"^\"");
  30544. }
  30545. }
  30546. if (result0 !== null) {
  30547. result1 = parse_ws();
  30548. if (result1 !== null) {
  30549. result2 = parse_expression();
  30550. if (result2 !== null) {
  30551. result3 = parse_ws();
  30552. if (result3 !== null) {
  30553. if (input.charCodeAt(pos.offset) === 46) {
  30554. result4 = ".";
  30555. advance(pos, 1);
  30556. } else {
  30557. result4 = null;
  30558. if (reportFailures === 0) {
  30559. matchFailed("\".\"");
  30560. }
  30561. }
  30562. result4 = result4 !== null ? result4 : "";
  30563. if (result4 !== null) {
  30564. result0 = [result0, result1, result2, result3, result4];
  30565. } else {
  30566. result0 = null;
  30567. pos = clone(pos1);
  30568. }
  30569. } else {
  30570. result0 = null;
  30571. pos = clone(pos1);
  30572. }
  30573. } else {
  30574. result0 = null;
  30575. pos = clone(pos1);
  30576. }
  30577. } else {
  30578. result0 = null;
  30579. pos = clone(pos1);
  30580. }
  30581. } else {
  30582. result0 = null;
  30583. pos = clone(pos1);
  30584. }
  30585. if (result0 !== null) {
  30586. result0 = (function(offset, line, column, expression) {
  30587. return smalltalk.ReturnNode._new()
  30588. ._position_((line).__at(column))
  30589. ._nodes_([expression]);
  30590. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  30591. }
  30592. if (result0 === null) {
  30593. pos = clone(pos0);
  30594. }
  30595. cache[cacheKey] = {
  30596. nextPos: clone(pos),
  30597. result: result0
  30598. };
  30599. return result0;
  30600. }
  30601. function parse_temps() {
  30602. var cacheKey = "temps@" + pos.offset;
  30603. var cachedResult = cache[cacheKey];
  30604. if (cachedResult) {
  30605. pos = clone(cachedResult.nextPos);
  30606. return cachedResult.result;
  30607. }
  30608. var result0, result1, result2, result3, result4;
  30609. var pos0, pos1, pos2, pos3;
  30610. pos0 = clone(pos);
  30611. pos1 = clone(pos);
  30612. if (input.charCodeAt(pos.offset) === 124) {
  30613. result0 = "|";
  30614. advance(pos, 1);
  30615. } else {
  30616. result0 = null;
  30617. if (reportFailures === 0) {
  30618. matchFailed("\"|\"");
  30619. }
  30620. }
  30621. if (result0 !== null) {
  30622. result1 = [];
  30623. pos2 = clone(pos);
  30624. pos3 = clone(pos);
  30625. result2 = parse_ws();
  30626. if (result2 !== null) {
  30627. result3 = parse_identifier();
  30628. if (result3 !== null) {
  30629. result4 = parse_ws();
  30630. if (result4 !== null) {
  30631. result2 = [result2, result3, result4];
  30632. } else {
  30633. result2 = null;
  30634. pos = clone(pos3);
  30635. }
  30636. } else {
  30637. result2 = null;
  30638. pos = clone(pos3);
  30639. }
  30640. } else {
  30641. result2 = null;
  30642. pos = clone(pos3);
  30643. }
  30644. if (result2 !== null) {
  30645. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  30646. }
  30647. if (result2 === null) {
  30648. pos = clone(pos2);
  30649. }
  30650. while (result2 !== null) {
  30651. result1.push(result2);
  30652. pos2 = clone(pos);
  30653. pos3 = clone(pos);
  30654. result2 = parse_ws();
  30655. if (result2 !== null) {
  30656. result3 = parse_identifier();
  30657. if (result3 !== null) {
  30658. result4 = parse_ws();
  30659. if (result4 !== null) {
  30660. result2 = [result2, result3, result4];
  30661. } else {
  30662. result2 = null;
  30663. pos = clone(pos3);
  30664. }
  30665. } else {
  30666. result2 = null;
  30667. pos = clone(pos3);
  30668. }
  30669. } else {
  30670. result2 = null;
  30671. pos = clone(pos3);
  30672. }
  30673. if (result2 !== null) {
  30674. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  30675. }
  30676. if (result2 === null) {
  30677. pos = clone(pos2);
  30678. }
  30679. }
  30680. if (result1 !== null) {
  30681. if (input.charCodeAt(pos.offset) === 124) {
  30682. result2 = "|";
  30683. advance(pos, 1);
  30684. } else {
  30685. result2 = null;
  30686. if (reportFailures === 0) {
  30687. matchFailed("\"|\"");
  30688. }
  30689. }
  30690. if (result2 !== null) {
  30691. result0 = [result0, result1, result2];
  30692. } else {
  30693. result0 = null;
  30694. pos = clone(pos1);
  30695. }
  30696. } else {
  30697. result0 = null;
  30698. pos = clone(pos1);
  30699. }
  30700. } else {
  30701. result0 = null;
  30702. pos = clone(pos1);
  30703. }
  30704. if (result0 !== null) {
  30705. result0 = (function(offset, line, column, vars) {return vars;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  30706. }
  30707. if (result0 === null) {
  30708. pos = clone(pos0);
  30709. }
  30710. cache[cacheKey] = {
  30711. nextPos: clone(pos),
  30712. result: result0
  30713. };
  30714. return result0;
  30715. }
  30716. function parse_blockParamList() {
  30717. var cacheKey = "blockParamList@" + pos.offset;
  30718. var cachedResult = cache[cacheKey];
  30719. if (cachedResult) {
  30720. pos = clone(cachedResult.nextPos);
  30721. return cachedResult.result;
  30722. }
  30723. var result0, result1, result2, result3, result4;
  30724. var pos0, pos1, pos2, pos3;
  30725. pos0 = clone(pos);
  30726. pos1 = clone(pos);
  30727. pos2 = clone(pos);
  30728. pos3 = clone(pos);
  30729. result1 = parse_ws();
  30730. if (result1 !== null) {
  30731. if (input.charCodeAt(pos.offset) === 58) {
  30732. result2 = ":";
  30733. advance(pos, 1);
  30734. } else {
  30735. result2 = null;
  30736. if (reportFailures === 0) {
  30737. matchFailed("\":\"");
  30738. }
  30739. }
  30740. if (result2 !== null) {
  30741. result3 = parse_ws();
  30742. if (result3 !== null) {
  30743. result4 = parse_identifier();
  30744. if (result4 !== null) {
  30745. result1 = [result1, result2, result3, result4];
  30746. } else {
  30747. result1 = null;
  30748. pos = clone(pos3);
  30749. }
  30750. } else {
  30751. result1 = null;
  30752. pos = clone(pos3);
  30753. }
  30754. } else {
  30755. result1 = null;
  30756. pos = clone(pos3);
  30757. }
  30758. } else {
  30759. result1 = null;
  30760. pos = clone(pos3);
  30761. }
  30762. if (result1 !== null) {
  30763. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  30764. }
  30765. if (result1 === null) {
  30766. pos = clone(pos2);
  30767. }
  30768. if (result1 !== null) {
  30769. result0 = [];
  30770. while (result1 !== null) {
  30771. result0.push(result1);
  30772. pos2 = clone(pos);
  30773. pos3 = clone(pos);
  30774. result1 = parse_ws();
  30775. if (result1 !== null) {
  30776. if (input.charCodeAt(pos.offset) === 58) {
  30777. result2 = ":";
  30778. advance(pos, 1);
  30779. } else {
  30780. result2 = null;
  30781. if (reportFailures === 0) {
  30782. matchFailed("\":\"");
  30783. }
  30784. }
  30785. if (result2 !== null) {
  30786. result3 = parse_ws();
  30787. if (result3 !== null) {
  30788. result4 = parse_identifier();
  30789. if (result4 !== null) {
  30790. result1 = [result1, result2, result3, result4];
  30791. } else {
  30792. result1 = null;
  30793. pos = clone(pos3);
  30794. }
  30795. } else {
  30796. result1 = null;
  30797. pos = clone(pos3);
  30798. }
  30799. } else {
  30800. result1 = null;
  30801. pos = clone(pos3);
  30802. }
  30803. } else {
  30804. result1 = null;
  30805. pos = clone(pos3);
  30806. }
  30807. if (result1 !== null) {
  30808. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  30809. }
  30810. if (result1 === null) {
  30811. pos = clone(pos2);
  30812. }
  30813. }
  30814. } else {
  30815. result0 = null;
  30816. }
  30817. if (result0 !== null) {
  30818. result1 = parse_ws();
  30819. if (result1 !== null) {
  30820. if (input.charCodeAt(pos.offset) === 124) {
  30821. result2 = "|";
  30822. advance(pos, 1);
  30823. } else {
  30824. result2 = null;
  30825. if (reportFailures === 0) {
  30826. matchFailed("\"|\"");
  30827. }
  30828. }
  30829. if (result2 !== null) {
  30830. result0 = [result0, result1, result2];
  30831. } else {
  30832. result0 = null;
  30833. pos = clone(pos1);
  30834. }
  30835. } else {
  30836. result0 = null;
  30837. pos = clone(pos1);
  30838. }
  30839. } else {
  30840. result0 = null;
  30841. pos = clone(pos1);
  30842. }
  30843. if (result0 !== null) {
  30844. result0 = (function(offset, line, column, params) {return params;})(pos0.offset, pos0.line, pos0.column, result0[0]);
  30845. }
  30846. if (result0 === null) {
  30847. pos = clone(pos0);
  30848. }
  30849. cache[cacheKey] = {
  30850. nextPos: clone(pos),
  30851. result: result0
  30852. };
  30853. return result0;
  30854. }
  30855. function parse_subexpression() {
  30856. var cacheKey = "subexpression@" + pos.offset;
  30857. var cachedResult = cache[cacheKey];
  30858. if (cachedResult) {
  30859. pos = clone(cachedResult.nextPos);
  30860. return cachedResult.result;
  30861. }
  30862. var result0, result1, result2, result3, result4;
  30863. var pos0, pos1;
  30864. pos0 = clone(pos);
  30865. pos1 = clone(pos);
  30866. if (input.charCodeAt(pos.offset) === 40) {
  30867. result0 = "(";
  30868. advance(pos, 1);
  30869. } else {
  30870. result0 = null;
  30871. if (reportFailures === 0) {
  30872. matchFailed("\"(\"");
  30873. }
  30874. }
  30875. if (result0 !== null) {
  30876. result1 = parse_ws();
  30877. if (result1 !== null) {
  30878. result2 = parse_expression();
  30879. if (result2 !== null) {
  30880. result3 = parse_ws();
  30881. if (result3 !== null) {
  30882. if (input.charCodeAt(pos.offset) === 41) {
  30883. result4 = ")";
  30884. advance(pos, 1);
  30885. } else {
  30886. result4 = null;
  30887. if (reportFailures === 0) {
  30888. matchFailed("\")\"");
  30889. }
  30890. }
  30891. if (result4 !== null) {
  30892. result0 = [result0, result1, result2, result3, result4];
  30893. } else {
  30894. result0 = null;
  30895. pos = clone(pos1);
  30896. }
  30897. } else {
  30898. result0 = null;
  30899. pos = clone(pos1);
  30900. }
  30901. } else {
  30902. result0 = null;
  30903. pos = clone(pos1);
  30904. }
  30905. } else {
  30906. result0 = null;
  30907. pos = clone(pos1);
  30908. }
  30909. } else {
  30910. result0 = null;
  30911. pos = clone(pos1);
  30912. }
  30913. if (result0 !== null) {
  30914. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[2]);
  30915. }
  30916. if (result0 === null) {
  30917. pos = clone(pos0);
  30918. }
  30919. cache[cacheKey] = {
  30920. nextPos: clone(pos),
  30921. result: result0
  30922. };
  30923. return result0;
  30924. }
  30925. function parse_statements() {
  30926. var cacheKey = "statements@" + pos.offset;
  30927. var cachedResult = cache[cacheKey];
  30928. if (cachedResult) {
  30929. pos = clone(cachedResult.nextPos);
  30930. return cachedResult.result;
  30931. }
  30932. var result0, result1, result2, result3, result4, result5, result6;
  30933. var pos0, pos1;
  30934. pos0 = clone(pos);
  30935. pos1 = clone(pos);
  30936. result0 = parse_ret();
  30937. if (result0 !== null) {
  30938. result1 = [];
  30939. if (/^[.]/.test(input.charAt(pos.offset))) {
  30940. result2 = input.charAt(pos.offset);
  30941. advance(pos, 1);
  30942. } else {
  30943. result2 = null;
  30944. if (reportFailures === 0) {
  30945. matchFailed("[.]");
  30946. }
  30947. }
  30948. while (result2 !== null) {
  30949. result1.push(result2);
  30950. if (/^[.]/.test(input.charAt(pos.offset))) {
  30951. result2 = input.charAt(pos.offset);
  30952. advance(pos, 1);
  30953. } else {
  30954. result2 = null;
  30955. if (reportFailures === 0) {
  30956. matchFailed("[.]");
  30957. }
  30958. }
  30959. }
  30960. if (result1 !== null) {
  30961. result0 = [result0, result1];
  30962. } else {
  30963. result0 = null;
  30964. pos = clone(pos1);
  30965. }
  30966. } else {
  30967. result0 = null;
  30968. pos = clone(pos1);
  30969. }
  30970. if (result0 !== null) {
  30971. result0 = (function(offset, line, column, ret) {return [ret];})(pos0.offset, pos0.line, pos0.column, result0[0]);
  30972. }
  30973. if (result0 === null) {
  30974. pos = clone(pos0);
  30975. }
  30976. if (result0 === null) {
  30977. pos0 = clone(pos);
  30978. pos1 = clone(pos);
  30979. result0 = parse_expressions();
  30980. if (result0 !== null) {
  30981. result1 = parse_ws();
  30982. if (result1 !== null) {
  30983. if (/^[.]/.test(input.charAt(pos.offset))) {
  30984. result3 = input.charAt(pos.offset);
  30985. advance(pos, 1);
  30986. } else {
  30987. result3 = null;
  30988. if (reportFailures === 0) {
  30989. matchFailed("[.]");
  30990. }
  30991. }
  30992. if (result3 !== null) {
  30993. result2 = [];
  30994. while (result3 !== null) {
  30995. result2.push(result3);
  30996. if (/^[.]/.test(input.charAt(pos.offset))) {
  30997. result3 = input.charAt(pos.offset);
  30998. advance(pos, 1);
  30999. } else {
  31000. result3 = null;
  31001. if (reportFailures === 0) {
  31002. matchFailed("[.]");
  31003. }
  31004. }
  31005. }
  31006. } else {
  31007. result2 = null;
  31008. }
  31009. if (result2 !== null) {
  31010. result3 = parse_ws();
  31011. if (result3 !== null) {
  31012. result4 = parse_ret();
  31013. if (result4 !== null) {
  31014. result5 = [];
  31015. if (/^[.]/.test(input.charAt(pos.offset))) {
  31016. result6 = input.charAt(pos.offset);
  31017. advance(pos, 1);
  31018. } else {
  31019. result6 = null;
  31020. if (reportFailures === 0) {
  31021. matchFailed("[.]");
  31022. }
  31023. }
  31024. while (result6 !== null) {
  31025. result5.push(result6);
  31026. if (/^[.]/.test(input.charAt(pos.offset))) {
  31027. result6 = input.charAt(pos.offset);
  31028. advance(pos, 1);
  31029. } else {
  31030. result6 = null;
  31031. if (reportFailures === 0) {
  31032. matchFailed("[.]");
  31033. }
  31034. }
  31035. }
  31036. if (result5 !== null) {
  31037. result0 = [result0, result1, result2, result3, result4, result5];
  31038. } else {
  31039. result0 = null;
  31040. pos = clone(pos1);
  31041. }
  31042. } else {
  31043. result0 = null;
  31044. pos = clone(pos1);
  31045. }
  31046. } else {
  31047. result0 = null;
  31048. pos = clone(pos1);
  31049. }
  31050. } else {
  31051. result0 = null;
  31052. pos = clone(pos1);
  31053. }
  31054. } else {
  31055. result0 = null;
  31056. pos = clone(pos1);
  31057. }
  31058. } else {
  31059. result0 = null;
  31060. pos = clone(pos1);
  31061. }
  31062. if (result0 !== null) {
  31063. result0 = (function(offset, line, column, exps, ret) {
  31064. var expressions = exps;
  31065. expressions.push(ret);
  31066. return expressions;
  31067. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  31068. }
  31069. if (result0 === null) {
  31070. pos = clone(pos0);
  31071. }
  31072. if (result0 === null) {
  31073. pos0 = clone(pos);
  31074. pos1 = clone(pos);
  31075. result0 = parse_expressions();
  31076. result0 = result0 !== null ? result0 : "";
  31077. if (result0 !== null) {
  31078. result1 = [];
  31079. if (/^[.]/.test(input.charAt(pos.offset))) {
  31080. result2 = input.charAt(pos.offset);
  31081. advance(pos, 1);
  31082. } else {
  31083. result2 = null;
  31084. if (reportFailures === 0) {
  31085. matchFailed("[.]");
  31086. }
  31087. }
  31088. while (result2 !== null) {
  31089. result1.push(result2);
  31090. if (/^[.]/.test(input.charAt(pos.offset))) {
  31091. result2 = input.charAt(pos.offset);
  31092. advance(pos, 1);
  31093. } else {
  31094. result2 = null;
  31095. if (reportFailures === 0) {
  31096. matchFailed("[.]");
  31097. }
  31098. }
  31099. }
  31100. if (result1 !== null) {
  31101. result0 = [result0, result1];
  31102. } else {
  31103. result0 = null;
  31104. pos = clone(pos1);
  31105. }
  31106. } else {
  31107. result0 = null;
  31108. pos = clone(pos1);
  31109. }
  31110. if (result0 !== null) {
  31111. result0 = (function(offset, line, column, expressions) {
  31112. return expressions || [];
  31113. })(pos0.offset, pos0.line, pos0.column, result0[0]);
  31114. }
  31115. if (result0 === null) {
  31116. pos = clone(pos0);
  31117. }
  31118. }
  31119. }
  31120. cache[cacheKey] = {
  31121. nextPos: clone(pos),
  31122. result: result0
  31123. };
  31124. return result0;
  31125. }
  31126. function parse_sequence() {
  31127. var cacheKey = "sequence@" + pos.offset;
  31128. var cachedResult = cache[cacheKey];
  31129. if (cachedResult) {
  31130. pos = clone(cachedResult.nextPos);
  31131. return cachedResult.result;
  31132. }
  31133. var result0;
  31134. result0 = parse_jsStatement();
  31135. if (result0 === null) {
  31136. result0 = parse_stSequence();
  31137. }
  31138. cache[cacheKey] = {
  31139. nextPos: clone(pos),
  31140. result: result0
  31141. };
  31142. return result0;
  31143. }
  31144. function parse_stSequence() {
  31145. var cacheKey = "stSequence@" + pos.offset;
  31146. var cachedResult = cache[cacheKey];
  31147. if (cachedResult) {
  31148. pos = clone(cachedResult.nextPos);
  31149. return cachedResult.result;
  31150. }
  31151. var result0, result1, result2, result3;
  31152. var pos0, pos1;
  31153. pos0 = clone(pos);
  31154. pos1 = clone(pos);
  31155. result0 = parse_temps();
  31156. result0 = result0 !== null ? result0 : "";
  31157. if (result0 !== null) {
  31158. result1 = parse_ws();
  31159. if (result1 !== null) {
  31160. result2 = parse_statements();
  31161. result2 = result2 !== null ? result2 : "";
  31162. if (result2 !== null) {
  31163. result3 = parse_ws();
  31164. if (result3 !== null) {
  31165. result0 = [result0, result1, result2, result3];
  31166. } else {
  31167. result0 = null;
  31168. pos = clone(pos1);
  31169. }
  31170. } else {
  31171. result0 = null;
  31172. pos = clone(pos1);
  31173. }
  31174. } else {
  31175. result0 = null;
  31176. pos = clone(pos1);
  31177. }
  31178. } else {
  31179. result0 = null;
  31180. pos = clone(pos1);
  31181. }
  31182. if (result0 !== null) {
  31183. result0 = (function(offset, line, column, temps, statements) {
  31184. return smalltalk.SequenceNode._new()
  31185. ._position_((line).__at(column))
  31186. ._temps_(temps || [])
  31187. ._nodes_(statements || []);
  31188. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31189. }
  31190. if (result0 === null) {
  31191. pos = clone(pos0);
  31192. }
  31193. cache[cacheKey] = {
  31194. nextPos: clone(pos),
  31195. result: result0
  31196. };
  31197. return result0;
  31198. }
  31199. function parse_block() {
  31200. var cacheKey = "block@" + pos.offset;
  31201. var cachedResult = cache[cacheKey];
  31202. if (cachedResult) {
  31203. pos = clone(cachedResult.nextPos);
  31204. return cachedResult.result;
  31205. }
  31206. var result0, result1, result2, result3, result4, result5, result6;
  31207. var pos0, pos1;
  31208. pos0 = clone(pos);
  31209. pos1 = clone(pos);
  31210. if (input.charCodeAt(pos.offset) === 91) {
  31211. result0 = "[";
  31212. advance(pos, 1);
  31213. } else {
  31214. result0 = null;
  31215. if (reportFailures === 0) {
  31216. matchFailed("\"[\"");
  31217. }
  31218. }
  31219. if (result0 !== null) {
  31220. result1 = parse_ws();
  31221. if (result1 !== null) {
  31222. result2 = parse_blockParamList();
  31223. result2 = result2 !== null ? result2 : "";
  31224. if (result2 !== null) {
  31225. result3 = parse_ws();
  31226. if (result3 !== null) {
  31227. result4 = parse_sequence();
  31228. result4 = result4 !== null ? result4 : "";
  31229. if (result4 !== null) {
  31230. result5 = parse_ws();
  31231. if (result5 !== null) {
  31232. if (input.charCodeAt(pos.offset) === 93) {
  31233. result6 = "]";
  31234. advance(pos, 1);
  31235. } else {
  31236. result6 = null;
  31237. if (reportFailures === 0) {
  31238. matchFailed("\"]\"");
  31239. }
  31240. }
  31241. if (result6 !== null) {
  31242. result0 = [result0, result1, result2, result3, result4, result5, result6];
  31243. } else {
  31244. result0 = null;
  31245. pos = clone(pos1);
  31246. }
  31247. } else {
  31248. result0 = null;
  31249. pos = clone(pos1);
  31250. }
  31251. } else {
  31252. result0 = null;
  31253. pos = clone(pos1);
  31254. }
  31255. } else {
  31256. result0 = null;
  31257. pos = clone(pos1);
  31258. }
  31259. } else {
  31260. result0 = null;
  31261. pos = clone(pos1);
  31262. }
  31263. } else {
  31264. result0 = null;
  31265. pos = clone(pos1);
  31266. }
  31267. } else {
  31268. result0 = null;
  31269. pos = clone(pos1);
  31270. }
  31271. if (result0 !== null) {
  31272. result0 = (function(offset, line, column, params, sequence) {
  31273. return smalltalk.BlockNode._new()
  31274. ._position_((line).__at(column))
  31275. ._parameters_(params || [])
  31276. ._nodes_([sequence._asBlockSequenceNode()]);
  31277. })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4]);
  31278. }
  31279. if (result0 === null) {
  31280. pos = clone(pos0);
  31281. }
  31282. cache[cacheKey] = {
  31283. nextPos: clone(pos),
  31284. result: result0
  31285. };
  31286. return result0;
  31287. }
  31288. function parse_operand() {
  31289. var cacheKey = "operand@" + pos.offset;
  31290. var cachedResult = cache[cacheKey];
  31291. if (cachedResult) {
  31292. pos = clone(cachedResult.nextPos);
  31293. return cachedResult.result;
  31294. }
  31295. var result0;
  31296. result0 = parse_literal();
  31297. if (result0 === null) {
  31298. result0 = parse_reference();
  31299. if (result0 === null) {
  31300. result0 = parse_subexpression();
  31301. }
  31302. }
  31303. cache[cacheKey] = {
  31304. nextPos: clone(pos),
  31305. result: result0
  31306. };
  31307. return result0;
  31308. }
  31309. function parse_unaryMessage() {
  31310. var cacheKey = "unaryMessage@" + pos.offset;
  31311. var cachedResult = cache[cacheKey];
  31312. if (cachedResult) {
  31313. pos = clone(cachedResult.nextPos);
  31314. return cachedResult.result;
  31315. }
  31316. var result0, result1, result2;
  31317. var pos0, pos1, pos2;
  31318. pos0 = clone(pos);
  31319. pos1 = clone(pos);
  31320. result0 = parse_ws();
  31321. if (result0 !== null) {
  31322. result1 = parse_identifier();
  31323. if (result1 !== null) {
  31324. pos2 = clone(pos);
  31325. reportFailures++;
  31326. if (/^[:]/.test(input.charAt(pos.offset))) {
  31327. result2 = input.charAt(pos.offset);
  31328. advance(pos, 1);
  31329. } else {
  31330. result2 = null;
  31331. if (reportFailures === 0) {
  31332. matchFailed("[:]");
  31333. }
  31334. }
  31335. reportFailures--;
  31336. if (result2 === null) {
  31337. result2 = "";
  31338. } else {
  31339. result2 = null;
  31340. pos = clone(pos2);
  31341. }
  31342. if (result2 !== null) {
  31343. result0 = [result0, result1, result2];
  31344. } else {
  31345. result0 = null;
  31346. pos = clone(pos1);
  31347. }
  31348. } else {
  31349. result0 = null;
  31350. pos = clone(pos1);
  31351. }
  31352. } else {
  31353. result0 = null;
  31354. pos = clone(pos1);
  31355. }
  31356. if (result0 !== null) {
  31357. result0 = (function(offset, line, column, selector) {
  31358. return smalltalk.SendNode._new()
  31359. ._position_((line).__at(column))
  31360. ._selector_(selector);
  31361. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  31362. }
  31363. if (result0 === null) {
  31364. pos = clone(pos0);
  31365. }
  31366. cache[cacheKey] = {
  31367. nextPos: clone(pos),
  31368. result: result0
  31369. };
  31370. return result0;
  31371. }
  31372. function parse_unaryTail() {
  31373. var cacheKey = "unaryTail@" + pos.offset;
  31374. var cachedResult = cache[cacheKey];
  31375. if (cachedResult) {
  31376. pos = clone(cachedResult.nextPos);
  31377. return cachedResult.result;
  31378. }
  31379. var result0, result1, result2, result3;
  31380. var pos0, pos1;
  31381. pos0 = clone(pos);
  31382. pos1 = clone(pos);
  31383. result0 = parse_unaryMessage();
  31384. if (result0 !== null) {
  31385. result1 = parse_ws();
  31386. if (result1 !== null) {
  31387. result2 = parse_unaryTail();
  31388. result2 = result2 !== null ? result2 : "";
  31389. if (result2 !== null) {
  31390. result3 = parse_ws();
  31391. if (result3 !== null) {
  31392. result0 = [result0, result1, result2, result3];
  31393. } else {
  31394. result0 = null;
  31395. pos = clone(pos1);
  31396. }
  31397. } else {
  31398. result0 = null;
  31399. pos = clone(pos1);
  31400. }
  31401. } else {
  31402. result0 = null;
  31403. pos = clone(pos1);
  31404. }
  31405. } else {
  31406. result0 = null;
  31407. pos = clone(pos1);
  31408. }
  31409. if (result0 !== null) {
  31410. result0 = (function(offset, line, column, message, tail) {
  31411. if(tail) {
  31412. return tail._valueForReceiver_(message);
  31413. }
  31414. else {
  31415. return message;
  31416. }
  31417. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31418. }
  31419. if (result0 === null) {
  31420. pos = clone(pos0);
  31421. }
  31422. cache[cacheKey] = {
  31423. nextPos: clone(pos),
  31424. result: result0
  31425. };
  31426. return result0;
  31427. }
  31428. function parse_unarySend() {
  31429. var cacheKey = "unarySend@" + pos.offset;
  31430. var cachedResult = cache[cacheKey];
  31431. if (cachedResult) {
  31432. pos = clone(cachedResult.nextPos);
  31433. return cachedResult.result;
  31434. }
  31435. var result0, result1, result2;
  31436. var pos0, pos1;
  31437. pos0 = clone(pos);
  31438. pos1 = clone(pos);
  31439. result0 = parse_operand();
  31440. if (result0 !== null) {
  31441. result1 = parse_ws();
  31442. if (result1 !== null) {
  31443. result2 = parse_unaryTail();
  31444. result2 = result2 !== null ? result2 : "";
  31445. if (result2 !== null) {
  31446. result0 = [result0, result1, result2];
  31447. } else {
  31448. result0 = null;
  31449. pos = clone(pos1);
  31450. }
  31451. } else {
  31452. result0 = null;
  31453. pos = clone(pos1);
  31454. }
  31455. } else {
  31456. result0 = null;
  31457. pos = clone(pos1);
  31458. }
  31459. if (result0 !== null) {
  31460. result0 = (function(offset, line, column, receiver, tail) {
  31461. if(tail) {
  31462. return tail._valueForReceiver_(receiver);
  31463. }
  31464. else {
  31465. return receiver;
  31466. }
  31467. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31468. }
  31469. if (result0 === null) {
  31470. pos = clone(pos0);
  31471. }
  31472. cache[cacheKey] = {
  31473. nextPos: clone(pos),
  31474. result: result0
  31475. };
  31476. return result0;
  31477. }
  31478. function parse_binaryMessage() {
  31479. var cacheKey = "binaryMessage@" + pos.offset;
  31480. var cachedResult = cache[cacheKey];
  31481. if (cachedResult) {
  31482. pos = clone(cachedResult.nextPos);
  31483. return cachedResult.result;
  31484. }
  31485. var result0, result1, result2, result3;
  31486. var pos0, pos1;
  31487. pos0 = clone(pos);
  31488. pos1 = clone(pos);
  31489. result0 = parse_ws();
  31490. if (result0 !== null) {
  31491. result1 = parse_binarySelector();
  31492. if (result1 !== null) {
  31493. result2 = parse_ws();
  31494. if (result2 !== null) {
  31495. result3 = parse_unarySend();
  31496. if (result3 === null) {
  31497. result3 = parse_operand();
  31498. }
  31499. if (result3 !== null) {
  31500. result0 = [result0, result1, result2, result3];
  31501. } else {
  31502. result0 = null;
  31503. pos = clone(pos1);
  31504. }
  31505. } else {
  31506. result0 = null;
  31507. pos = clone(pos1);
  31508. }
  31509. } else {
  31510. result0 = null;
  31511. pos = clone(pos1);
  31512. }
  31513. } else {
  31514. result0 = null;
  31515. pos = clone(pos1);
  31516. }
  31517. if (result0 !== null) {
  31518. result0 = (function(offset, line, column, selector, arg) {
  31519. return smalltalk.SendNode._new()
  31520. ._position_((line).__at(column))
  31521. ._selector_(selector)
  31522. ._arguments_([arg]);
  31523. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  31524. }
  31525. if (result0 === null) {
  31526. pos = clone(pos0);
  31527. }
  31528. cache[cacheKey] = {
  31529. nextPos: clone(pos),
  31530. result: result0
  31531. };
  31532. return result0;
  31533. }
  31534. function parse_binaryTail() {
  31535. var cacheKey = "binaryTail@" + pos.offset;
  31536. var cachedResult = cache[cacheKey];
  31537. if (cachedResult) {
  31538. pos = clone(cachedResult.nextPos);
  31539. return cachedResult.result;
  31540. }
  31541. var result0, result1;
  31542. var pos0, pos1;
  31543. pos0 = clone(pos);
  31544. pos1 = clone(pos);
  31545. result0 = parse_binaryMessage();
  31546. if (result0 !== null) {
  31547. result1 = parse_binaryTail();
  31548. result1 = result1 !== null ? result1 : "";
  31549. if (result1 !== null) {
  31550. result0 = [result0, result1];
  31551. } else {
  31552. result0 = null;
  31553. pos = clone(pos1);
  31554. }
  31555. } else {
  31556. result0 = null;
  31557. pos = clone(pos1);
  31558. }
  31559. if (result0 !== null) {
  31560. result0 = (function(offset, line, column, message, tail) {
  31561. if(tail) {
  31562. return tail._valueForReceiver_(message);
  31563. }
  31564. else {
  31565. return message;
  31566. }
  31567. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31568. }
  31569. if (result0 === null) {
  31570. pos = clone(pos0);
  31571. }
  31572. cache[cacheKey] = {
  31573. nextPos: clone(pos),
  31574. result: result0
  31575. };
  31576. return result0;
  31577. }
  31578. function parse_binarySend() {
  31579. var cacheKey = "binarySend@" + pos.offset;
  31580. var cachedResult = cache[cacheKey];
  31581. if (cachedResult) {
  31582. pos = clone(cachedResult.nextPos);
  31583. return cachedResult.result;
  31584. }
  31585. var result0, result1;
  31586. var pos0, pos1;
  31587. pos0 = clone(pos);
  31588. pos1 = clone(pos);
  31589. result0 = parse_unarySend();
  31590. if (result0 !== null) {
  31591. result1 = parse_binaryTail();
  31592. result1 = result1 !== null ? result1 : "";
  31593. if (result1 !== null) {
  31594. result0 = [result0, result1];
  31595. } else {
  31596. result0 = null;
  31597. pos = clone(pos1);
  31598. }
  31599. } else {
  31600. result0 = null;
  31601. pos = clone(pos1);
  31602. }
  31603. if (result0 !== null) {
  31604. result0 = (function(offset, line, column, receiver, tail) {
  31605. if(tail) {
  31606. return tail._valueForReceiver_(receiver);
  31607. }
  31608. else {
  31609. return receiver;
  31610. }
  31611. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31612. }
  31613. if (result0 === null) {
  31614. pos = clone(pos0);
  31615. }
  31616. cache[cacheKey] = {
  31617. nextPos: clone(pos),
  31618. result: result0
  31619. };
  31620. return result0;
  31621. }
  31622. function parse_keywordMessage() {
  31623. var cacheKey = "keywordMessage@" + pos.offset;
  31624. var cachedResult = cache[cacheKey];
  31625. if (cachedResult) {
  31626. pos = clone(cachedResult.nextPos);
  31627. return cachedResult.result;
  31628. }
  31629. var result0, result1, result2, result3;
  31630. var pos0, pos1, pos2, pos3;
  31631. pos0 = clone(pos);
  31632. pos1 = clone(pos);
  31633. result0 = parse_ws();
  31634. if (result0 !== null) {
  31635. pos2 = clone(pos);
  31636. pos3 = clone(pos);
  31637. result2 = parse_keywordPair();
  31638. if (result2 !== null) {
  31639. result3 = parse_ws();
  31640. if (result3 !== null) {
  31641. result2 = [result2, result3];
  31642. } else {
  31643. result2 = null;
  31644. pos = clone(pos3);
  31645. }
  31646. } else {
  31647. result2 = null;
  31648. pos = clone(pos3);
  31649. }
  31650. if (result2 !== null) {
  31651. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31652. }
  31653. if (result2 === null) {
  31654. pos = clone(pos2);
  31655. }
  31656. if (result2 !== null) {
  31657. result1 = [];
  31658. while (result2 !== null) {
  31659. result1.push(result2);
  31660. pos2 = clone(pos);
  31661. pos3 = clone(pos);
  31662. result2 = parse_keywordPair();
  31663. if (result2 !== null) {
  31664. result3 = parse_ws();
  31665. if (result3 !== null) {
  31666. result2 = [result2, result3];
  31667. } else {
  31668. result2 = null;
  31669. pos = clone(pos3);
  31670. }
  31671. } else {
  31672. result2 = null;
  31673. pos = clone(pos3);
  31674. }
  31675. if (result2 !== null) {
  31676. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31677. }
  31678. if (result2 === null) {
  31679. pos = clone(pos2);
  31680. }
  31681. }
  31682. } else {
  31683. result1 = null;
  31684. }
  31685. if (result1 !== null) {
  31686. result0 = [result0, result1];
  31687. } else {
  31688. result0 = null;
  31689. pos = clone(pos1);
  31690. }
  31691. } else {
  31692. result0 = null;
  31693. pos = clone(pos1);
  31694. }
  31695. if (result0 !== null) {
  31696. result0 = (function(offset, line, column, pairs) {
  31697. var selector = [];
  31698. var args = [];
  31699. for(var i = 0; i < pairs.length; i++) {
  31700. selector.push(pairs[i].key);
  31701. args.push(pairs[i].arg);
  31702. }
  31703. return smalltalk.SendNode._new()
  31704. ._position_((line).__at(column))
  31705. ._selector_(selector.join(""))
  31706. ._arguments_(args);
  31707. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  31708. }
  31709. if (result0 === null) {
  31710. pos = clone(pos0);
  31711. }
  31712. cache[cacheKey] = {
  31713. nextPos: clone(pos),
  31714. result: result0
  31715. };
  31716. return result0;
  31717. }
  31718. function parse_keywordSend() {
  31719. var cacheKey = "keywordSend@" + pos.offset;
  31720. var cachedResult = cache[cacheKey];
  31721. if (cachedResult) {
  31722. pos = clone(cachedResult.nextPos);
  31723. return cachedResult.result;
  31724. }
  31725. var result0, result1;
  31726. var pos0, pos1;
  31727. pos0 = clone(pos);
  31728. pos1 = clone(pos);
  31729. result0 = parse_binarySend();
  31730. if (result0 !== null) {
  31731. result1 = parse_keywordMessage();
  31732. if (result1 !== null) {
  31733. result0 = [result0, result1];
  31734. } else {
  31735. result0 = null;
  31736. pos = clone(pos1);
  31737. }
  31738. } else {
  31739. result0 = null;
  31740. pos = clone(pos1);
  31741. }
  31742. if (result0 !== null) {
  31743. result0 = (function(offset, line, column, receiver, tail) {
  31744. return tail._valueForReceiver_(receiver);
  31745. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31746. }
  31747. if (result0 === null) {
  31748. pos = clone(pos0);
  31749. }
  31750. cache[cacheKey] = {
  31751. nextPos: clone(pos),
  31752. result: result0
  31753. };
  31754. return result0;
  31755. }
  31756. function parse_message() {
  31757. var cacheKey = "message@" + pos.offset;
  31758. var cachedResult = cache[cacheKey];
  31759. if (cachedResult) {
  31760. pos = clone(cachedResult.nextPos);
  31761. return cachedResult.result;
  31762. }
  31763. var result0;
  31764. result0 = parse_binaryMessage();
  31765. if (result0 === null) {
  31766. result0 = parse_unaryMessage();
  31767. if (result0 === null) {
  31768. result0 = parse_keywordMessage();
  31769. }
  31770. }
  31771. cache[cacheKey] = {
  31772. nextPos: clone(pos),
  31773. result: result0
  31774. };
  31775. return result0;
  31776. }
  31777. function parse_cascade() {
  31778. var cacheKey = "cascade@" + pos.offset;
  31779. var cachedResult = cache[cacheKey];
  31780. if (cachedResult) {
  31781. pos = clone(cachedResult.nextPos);
  31782. return cachedResult.result;
  31783. }
  31784. var result0, result1, result2, result3, result4, result5, result6, result7;
  31785. var pos0, pos1, pos2, pos3;
  31786. pos0 = clone(pos);
  31787. pos1 = clone(pos);
  31788. result0 = parse_ws();
  31789. if (result0 !== null) {
  31790. result1 = parse_keywordSend();
  31791. if (result1 === null) {
  31792. result1 = parse_binarySend();
  31793. }
  31794. if (result1 !== null) {
  31795. pos2 = clone(pos);
  31796. pos3 = clone(pos);
  31797. result3 = parse_ws();
  31798. if (result3 !== null) {
  31799. if (input.charCodeAt(pos.offset) === 59) {
  31800. result4 = ";";
  31801. advance(pos, 1);
  31802. } else {
  31803. result4 = null;
  31804. if (reportFailures === 0) {
  31805. matchFailed("\";\"");
  31806. }
  31807. }
  31808. if (result4 !== null) {
  31809. result5 = parse_ws();
  31810. if (result5 !== null) {
  31811. result6 = parse_message();
  31812. if (result6 !== null) {
  31813. result7 = parse_ws();
  31814. if (result7 !== null) {
  31815. result3 = [result3, result4, result5, result6, result7];
  31816. } else {
  31817. result3 = null;
  31818. pos = clone(pos3);
  31819. }
  31820. } else {
  31821. result3 = null;
  31822. pos = clone(pos3);
  31823. }
  31824. } else {
  31825. result3 = null;
  31826. pos = clone(pos3);
  31827. }
  31828. } else {
  31829. result3 = null;
  31830. pos = clone(pos3);
  31831. }
  31832. } else {
  31833. result3 = null;
  31834. pos = clone(pos3);
  31835. }
  31836. if (result3 !== null) {
  31837. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  31838. }
  31839. if (result3 === null) {
  31840. pos = clone(pos2);
  31841. }
  31842. if (result3 !== null) {
  31843. result2 = [];
  31844. while (result3 !== null) {
  31845. result2.push(result3);
  31846. pos2 = clone(pos);
  31847. pos3 = clone(pos);
  31848. result3 = parse_ws();
  31849. if (result3 !== null) {
  31850. if (input.charCodeAt(pos.offset) === 59) {
  31851. result4 = ";";
  31852. advance(pos, 1);
  31853. } else {
  31854. result4 = null;
  31855. if (reportFailures === 0) {
  31856. matchFailed("\";\"");
  31857. }
  31858. }
  31859. if (result4 !== null) {
  31860. result5 = parse_ws();
  31861. if (result5 !== null) {
  31862. result6 = parse_message();
  31863. if (result6 !== null) {
  31864. result7 = parse_ws();
  31865. if (result7 !== null) {
  31866. result3 = [result3, result4, result5, result6, result7];
  31867. } else {
  31868. result3 = null;
  31869. pos = clone(pos3);
  31870. }
  31871. } else {
  31872. result3 = null;
  31873. pos = clone(pos3);
  31874. }
  31875. } else {
  31876. result3 = null;
  31877. pos = clone(pos3);
  31878. }
  31879. } else {
  31880. result3 = null;
  31881. pos = clone(pos3);
  31882. }
  31883. } else {
  31884. result3 = null;
  31885. pos = clone(pos3);
  31886. }
  31887. if (result3 !== null) {
  31888. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  31889. }
  31890. if (result3 === null) {
  31891. pos = clone(pos2);
  31892. }
  31893. }
  31894. } else {
  31895. result2 = null;
  31896. }
  31897. if (result2 !== null) {
  31898. result0 = [result0, result1, result2];
  31899. } else {
  31900. result0 = null;
  31901. pos = clone(pos1);
  31902. }
  31903. } else {
  31904. result0 = null;
  31905. pos = clone(pos1);
  31906. }
  31907. } else {
  31908. result0 = null;
  31909. pos = clone(pos1);
  31910. }
  31911. if (result0 !== null) {
  31912. result0 = (function(offset, line, column, send, messages) {
  31913. var cascade = [];
  31914. cascade.push(send);
  31915. for(var i = 0; i < messages.length; i++) {
  31916. cascade.push(messages[i]);
  31917. }
  31918. return smalltalk.CascadeNode._new()
  31919. ._position_((line).__at(column))
  31920. ._receiver_(send._receiver())
  31921. ._nodes_(cascade);
  31922. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]);
  31923. }
  31924. if (result0 === null) {
  31925. pos = clone(pos0);
  31926. }
  31927. cache[cacheKey] = {
  31928. nextPos: clone(pos),
  31929. result: result0
  31930. };
  31931. return result0;
  31932. }
  31933. function parse_jsStatement() {
  31934. var cacheKey = "jsStatement@" + pos.offset;
  31935. var cachedResult = cache[cacheKey];
  31936. if (cachedResult) {
  31937. pos = clone(cachedResult.nextPos);
  31938. return cachedResult.result;
  31939. }
  31940. var result0, result1, result2;
  31941. var pos0, pos1, pos2;
  31942. pos0 = clone(pos);
  31943. pos1 = clone(pos);
  31944. if (input.charCodeAt(pos.offset) === 60) {
  31945. result0 = "<";
  31946. advance(pos, 1);
  31947. } else {
  31948. result0 = null;
  31949. if (reportFailures === 0) {
  31950. matchFailed("\"<\"");
  31951. }
  31952. }
  31953. if (result0 !== null) {
  31954. result1 = [];
  31955. pos2 = clone(pos);
  31956. if (input.substr(pos.offset, 2) === ">>") {
  31957. result2 = ">>";
  31958. advance(pos, 2);
  31959. } else {
  31960. result2 = null;
  31961. if (reportFailures === 0) {
  31962. matchFailed("\">>\"");
  31963. }
  31964. }
  31965. if (result2 !== null) {
  31966. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  31967. }
  31968. if (result2 === null) {
  31969. pos = clone(pos2);
  31970. }
  31971. if (result2 === null) {
  31972. if (/^[^>]/.test(input.charAt(pos.offset))) {
  31973. result2 = input.charAt(pos.offset);
  31974. advance(pos, 1);
  31975. } else {
  31976. result2 = null;
  31977. if (reportFailures === 0) {
  31978. matchFailed("[^>]");
  31979. }
  31980. }
  31981. }
  31982. while (result2 !== null) {
  31983. result1.push(result2);
  31984. pos2 = clone(pos);
  31985. if (input.substr(pos.offset, 2) === ">>") {
  31986. result2 = ">>";
  31987. advance(pos, 2);
  31988. } else {
  31989. result2 = null;
  31990. if (reportFailures === 0) {
  31991. matchFailed("\">>\"");
  31992. }
  31993. }
  31994. if (result2 !== null) {
  31995. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  31996. }
  31997. if (result2 === null) {
  31998. pos = clone(pos2);
  31999. }
  32000. if (result2 === null) {
  32001. if (/^[^>]/.test(input.charAt(pos.offset))) {
  32002. result2 = input.charAt(pos.offset);
  32003. advance(pos, 1);
  32004. } else {
  32005. result2 = null;
  32006. if (reportFailures === 0) {
  32007. matchFailed("[^>]");
  32008. }
  32009. }
  32010. }
  32011. }
  32012. if (result1 !== null) {
  32013. if (input.charCodeAt(pos.offset) === 62) {
  32014. result2 = ">";
  32015. advance(pos, 1);
  32016. } else {
  32017. result2 = null;
  32018. if (reportFailures === 0) {
  32019. matchFailed("\">\"");
  32020. }
  32021. }
  32022. if (result2 !== null) {
  32023. result0 = [result0, result1, result2];
  32024. } else {
  32025. result0 = null;
  32026. pos = clone(pos1);
  32027. }
  32028. } else {
  32029. result0 = null;
  32030. pos = clone(pos1);
  32031. }
  32032. } else {
  32033. result0 = null;
  32034. pos = clone(pos1);
  32035. }
  32036. if (result0 !== null) {
  32037. result0 = (function(offset, line, column, val) {
  32038. return smalltalk.JSStatementNode._new()
  32039. ._position_((line).__at(column))
  32040. ._source_(val.join(""));
  32041. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  32042. }
  32043. if (result0 === null) {
  32044. pos = clone(pos0);
  32045. }
  32046. cache[cacheKey] = {
  32047. nextPos: clone(pos),
  32048. result: result0
  32049. };
  32050. return result0;
  32051. }
  32052. function parse_method() {
  32053. var cacheKey = "method@" + pos.offset;
  32054. var cachedResult = cache[cacheKey];
  32055. if (cachedResult) {
  32056. pos = clone(cachedResult.nextPos);
  32057. return cachedResult.result;
  32058. }
  32059. var result0, result1, result2, result3, result4;
  32060. var pos0, pos1;
  32061. pos0 = clone(pos);
  32062. pos1 = clone(pos);
  32063. result0 = parse_ws();
  32064. if (result0 !== null) {
  32065. result1 = parse_keywordPattern();
  32066. if (result1 === null) {
  32067. result1 = parse_binaryPattern();
  32068. if (result1 === null) {
  32069. result1 = parse_unaryPattern();
  32070. }
  32071. }
  32072. if (result1 !== null) {
  32073. result2 = parse_ws();
  32074. if (result2 !== null) {
  32075. result3 = parse_sequence();
  32076. result3 = result3 !== null ? result3 : "";
  32077. if (result3 !== null) {
  32078. result4 = parse_ws();
  32079. if (result4 !== null) {
  32080. result0 = [result0, result1, result2, result3, result4];
  32081. } else {
  32082. result0 = null;
  32083. pos = clone(pos1);
  32084. }
  32085. } else {
  32086. result0 = null;
  32087. pos = clone(pos1);
  32088. }
  32089. } else {
  32090. result0 = null;
  32091. pos = clone(pos1);
  32092. }
  32093. } else {
  32094. result0 = null;
  32095. pos = clone(pos1);
  32096. }
  32097. } else {
  32098. result0 = null;
  32099. pos = clone(pos1);
  32100. }
  32101. if (result0 !== null) {
  32102. result0 = (function(offset, line, column, pattern, sequence) {
  32103. return smalltalk.MethodNode._new()
  32104. ._position_((line).__at(column))
  32105. ._selector_(pattern[0])
  32106. ._arguments_(pattern[1])
  32107. ._nodes_([sequence]);
  32108. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  32109. }
  32110. if (result0 === null) {
  32111. pos = clone(pos0);
  32112. }
  32113. cache[cacheKey] = {
  32114. nextPos: clone(pos),
  32115. result: result0
  32116. };
  32117. return result0;
  32118. }
  32119. function cleanupExpected(expected) {
  32120. expected.sort();
  32121. var lastExpected = null;
  32122. var cleanExpected = [];
  32123. for (var i = 0; i < expected.length; i++) {
  32124. if (expected[i] !== lastExpected) {
  32125. cleanExpected.push(expected[i]);
  32126. lastExpected = expected[i];
  32127. }
  32128. }
  32129. return cleanExpected;
  32130. }
  32131. var result = parseFunctions[startRule]();
  32132. /*
  32133. * The parser is now in one of the following three states:
  32134. *
  32135. * 1. The parser successfully parsed the whole input.
  32136. *
  32137. * - |result !== null|
  32138. * - |pos.offset === input.length|
  32139. * - |rightmostFailuresExpected| may or may not contain something
  32140. *
  32141. * 2. The parser successfully parsed only a part of the input.
  32142. *
  32143. * - |result !== null|
  32144. * - |pos.offset < input.length|
  32145. * - |rightmostFailuresExpected| may or may not contain something
  32146. *
  32147. * 3. The parser did not successfully parse any part of the input.
  32148. *
  32149. * - |result === null|
  32150. * - |pos.offset === 0|
  32151. * - |rightmostFailuresExpected| contains at least one failure
  32152. *
  32153. * All code following this comment (including called functions) must
  32154. * handle these states.
  32155. */
  32156. if (result === null || pos.offset !== input.length) {
  32157. var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
  32158. var found = offset < input.length ? input.charAt(offset) : null;
  32159. var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
  32160. throw new this.SyntaxError(
  32161. cleanupExpected(rightmostFailuresExpected),
  32162. found,
  32163. offset,
  32164. errorPosition.line,
  32165. errorPosition.column
  32166. );
  32167. }
  32168. return result;
  32169. },
  32170. /* Returns the parser source code. */
  32171. toSource: function() { return this._source; }
  32172. };
  32173. /* Thrown when a parser encounters a syntax error. */
  32174. result.SyntaxError = function(expected, found, offset, line, column) {
  32175. function buildMessage(expected, found) {
  32176. var expectedHumanized, foundHumanized;
  32177. switch (expected.length) {
  32178. case 0:
  32179. expectedHumanized = "end of input";
  32180. break;
  32181. case 1:
  32182. expectedHumanized = expected[0];
  32183. break;
  32184. default:
  32185. expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
  32186. + " or "
  32187. + expected[expected.length - 1];
  32188. }
  32189. foundHumanized = found ? quote(found) : "end of input";
  32190. return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
  32191. }
  32192. this.name = "SyntaxError";
  32193. this.expected = expected;
  32194. this.found = found;
  32195. this.message = buildMessage(expected, found);
  32196. this.offset = offset;
  32197. this.line = line;
  32198. this.column = column;
  32199. };
  32200. result.SyntaxError.prototype = Error.prototype;
  32201. return result;
  32202. })();
  32203. smalltalk.addPackage('AmberCli');
  32204. smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
  32205. smalltalk.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.";
  32206. smalltalk.addMethod(
  32207. smalltalk.method({
  32208. selector: "commandLineSwitches",
  32209. category: 'commandline',
  32210. fn: function (){
  32211. var self=this;
  32212. var switches;
  32213. return smalltalk.withContext(function($ctx1) {
  32214. var $1;
  32215. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  32216. return smalltalk.withContext(function($ctx2) {
  32217. return _st(each)._selector();
  32218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32219. switches=_st(switches)._select_((function(each){
  32220. return smalltalk.withContext(function($ctx2) {
  32221. return _st(each)._match_("^[^:]*:$");
  32222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32223. switches=_st(switches)._collect_((function(each){
  32224. return smalltalk.withContext(function($ctx2) {
  32225. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  32226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32227. $1=switches;
  32228. return $1;
  32229. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})},
  32230. args: [],
  32231. 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",
  32232. messageSends: ["collect:", "selector", "methodsInProtocol:", "class", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  32233. referencedClasses: []
  32234. }),
  32235. smalltalk.AmberCli.klass);
  32236. smalltalk.addMethod(
  32237. smalltalk.method({
  32238. selector: "handleArguments:",
  32239. category: 'commandline',
  32240. fn: function (args){
  32241. var self=this;
  32242. var selector;
  32243. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  32244. return smalltalk.withContext(function($ctx1) {
  32245. selector=self._selectorForCommandLineSwitch_(_st(args)._first());
  32246. _st(args)._remove_(_st(args)._first());
  32247. self._perform_withArguments_(selector,_st($Array())._with_(args));
  32248. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
  32249. args: ["args"],
  32250. 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)",
  32251. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  32252. referencedClasses: ["Array"]
  32253. }),
  32254. smalltalk.AmberCli.klass);
  32255. smalltalk.addMethod(
  32256. smalltalk.method({
  32257. selector: "help:",
  32258. category: 'commands',
  32259. fn: function (args){
  32260. var self=this;
  32261. return smalltalk.withContext(function($ctx1) {
  32262. _st(console)._log_("Available Commands:");
  32263. _st(self._commandLineSwitches())._do_((function(each){
  32264. return smalltalk.withContext(function($ctx2) {
  32265. return _st(console)._log_(each);
  32266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  32267. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
  32268. args: ["args"],
  32269. source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  32270. messageSends: ["log:", "do:", "commandLineSwitches"],
  32271. referencedClasses: []
  32272. }),
  32273. smalltalk.AmberCli.klass);
  32274. smalltalk.addMethod(
  32275. smalltalk.method({
  32276. selector: "main",
  32277. category: 'startup',
  32278. fn: function (){
  32279. var self=this;
  32280. var args,nodeMinorVersion;
  32281. return smalltalk.withContext(function($ctx1) {
  32282. var $1,$2,$3;
  32283. nodeMinorVersion=_st(_st(_st(_st(process)._version())._tokenize_("."))._second())._asNumber();
  32284. $1=_st(nodeMinorVersion).__lt((8));
  32285. if(smalltalk.assert($1)){
  32286. _st(console)._log_("You are currently using Node.js ".__comma(_st(process)._version()));
  32287. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  32288. return (-1);
  32289. };
  32290. args=_st(process)._argv();
  32291. _st(args)._removeFrom_to_((1),(3));
  32292. $2=_st(args)._isEmpty();
  32293. if(smalltalk.assert($2)){
  32294. self._help_(nil);
  32295. } else {
  32296. $3=self._handleArguments_(args);
  32297. return $3;
  32298. };
  32299. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass)})},
  32300. args: [],
  32301. 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: 3.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  32302. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "log:", ",", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"],
  32303. referencedClasses: []
  32304. }),
  32305. smalltalk.AmberCli.klass);
  32306. smalltalk.addMethod(
  32307. smalltalk.method({
  32308. selector: "repl:",
  32309. category: 'commands',
  32310. fn: function (args){
  32311. var self=this;
  32312. function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
  32313. return smalltalk.withContext(function($ctx1) {
  32314. var $1;
  32315. $1=_st(_st($Repl())._new())._createInterface();
  32316. return $1;
  32317. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
  32318. args: ["args"],
  32319. source: "repl: args\x0a\x09^Repl new createInterface",
  32320. messageSends: ["createInterface", "new"],
  32321. referencedClasses: ["Repl"]
  32322. }),
  32323. smalltalk.AmberCli.klass);
  32324. smalltalk.addMethod(
  32325. smalltalk.method({
  32326. selector: "selectorForCommandLineSwitch:",
  32327. category: 'commandline',
  32328. fn: function (aSwitch){
  32329. var self=this;
  32330. var command,selector;
  32331. return smalltalk.withContext(function($ctx1) {
  32332. var $1,$2;
  32333. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  32334. if(smalltalk.assert($1)){
  32335. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  32336. return smalltalk.withContext(function($ctx2) {
  32337. return _st(_st(each)._second())._asUppercase();
  32338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  32339. selector;
  32340. } else {
  32341. selector="help:";
  32342. selector;
  32343. };
  32344. $2=selector;
  32345. return $2;
  32346. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
  32347. args: ["aSwitch"],
  32348. 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",
  32349. messageSends: ["ifTrue:ifFalse:", ",", "replace:with:", "asUppercase", "second", "includes:", "commandLineSwitches"],
  32350. referencedClasses: []
  32351. }),
  32352. smalltalk.AmberCli.klass);
  32353. smalltalk.addMethod(
  32354. smalltalk.method({
  32355. selector: "serve:",
  32356. category: 'commands',
  32357. fn: function (args){
  32358. var self=this;
  32359. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  32360. return smalltalk.withContext(function($ctx1) {
  32361. var $1;
  32362. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  32363. return $1;
  32364. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})},
  32365. args: ["args"],
  32366. source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start",
  32367. messageSends: ["start", "createServerWithArguments:"],
  32368. referencedClasses: ["FileServer"]
  32369. }),
  32370. smalltalk.AmberCli.klass);
  32371. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  32372. smalltalk.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.";
  32373. smalltalk.addMethod(
  32374. smalltalk.method({
  32375. selector: "base64Decode:",
  32376. category: 'private',
  32377. fn: function (aString){
  32378. var self=this;
  32379. return smalltalk.withContext(function($ctx1) {
  32380. return (new Buffer(aString, 'base64').toString());
  32381. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  32382. args: ["aString"],
  32383. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  32384. messageSends: [],
  32385. referencedClasses: []
  32386. }),
  32387. smalltalk.FileServer);
  32388. smalltalk.addMethod(
  32389. smalltalk.method({
  32390. selector: "basePath",
  32391. category: 'accessing',
  32392. fn: function (){
  32393. var self=this;
  32394. return smalltalk.withContext(function($ctx1) {
  32395. var $2,$1;
  32396. $2=self["@basePath"];
  32397. if(($receiver = $2) == nil || $receiver == undefined){
  32398. $1="./";
  32399. } else {
  32400. $1=$2;
  32401. };
  32402. return $1;
  32403. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  32404. args: [],
  32405. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  32406. messageSends: ["ifNil:"],
  32407. referencedClasses: []
  32408. }),
  32409. smalltalk.FileServer);
  32410. smalltalk.addMethod(
  32411. smalltalk.method({
  32412. selector: "basePath:",
  32413. category: 'accessing',
  32414. fn: function (aString){
  32415. var self=this;
  32416. return smalltalk.withContext(function($ctx1) {
  32417. self["@basePath"]=aString;
  32418. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  32419. args: ["aString"],
  32420. source: "basePath: aString\x0a\x09basePath := aString",
  32421. messageSends: [],
  32422. referencedClasses: []
  32423. }),
  32424. smalltalk.FileServer);
  32425. smalltalk.addMethod(
  32426. smalltalk.method({
  32427. selector: "checkDirectoryLayout",
  32428. category: 'initialization',
  32429. fn: function (){
  32430. var self=this;
  32431. return smalltalk.withContext(function($ctx1) {
  32432. var $1,$2,$3;
  32433. $1=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("index.html"));
  32434. if(! smalltalk.assert($1)){
  32435. _st(console)._warn_("Warning: project directory does not contain index.html");
  32436. };
  32437. $2=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("st"));
  32438. if(! smalltalk.assert($2)){
  32439. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  32440. };
  32441. $3=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
  32442. if(! smalltalk.assert($3)){
  32443. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  32444. };
  32445. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  32446. args: [],
  32447. source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  32448. messageSends: ["ifFalse:", "warn:", "existsSync:", ",", "basePath"],
  32449. referencedClasses: []
  32450. }),
  32451. smalltalk.FileServer);
  32452. smalltalk.addMethod(
  32453. smalltalk.method({
  32454. selector: "fallbackPage",
  32455. category: 'accessing',
  32456. fn: function (){
  32457. var self=this;
  32458. return smalltalk.withContext(function($ctx1) {
  32459. var $1;
  32460. $1=self["@fallbackPage"];
  32461. return $1;
  32462. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  32463. args: [],
  32464. source: "fallbackPage\x0a\x09^fallbackPage",
  32465. messageSends: [],
  32466. referencedClasses: []
  32467. }),
  32468. smalltalk.FileServer);
  32469. smalltalk.addMethod(
  32470. smalltalk.method({
  32471. selector: "fallbackPage:",
  32472. category: 'accessing',
  32473. fn: function (aString){
  32474. var self=this;
  32475. return smalltalk.withContext(function($ctx1) {
  32476. self["@fallbackPage"]=aString;
  32477. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  32478. args: ["aString"],
  32479. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  32480. messageSends: [],
  32481. referencedClasses: []
  32482. }),
  32483. smalltalk.FileServer);
  32484. smalltalk.addMethod(
  32485. smalltalk.method({
  32486. selector: "handleGETRequest:respondTo:",
  32487. category: 'request handling',
  32488. fn: function (aRequest,aResponse){
  32489. var self=this;
  32490. var uri,filename;
  32491. return smalltalk.withContext(function($ctx1) {
  32492. var $1;
  32493. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  32494. filename=_st(self["@path"])._join_with_(self._basePath(),uri);
  32495. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  32496. return smalltalk.withContext(function($ctx2) {
  32497. $1=aBoolean;
  32498. if(smalltalk.assert($1)){
  32499. return self._respondFileNamed_to_(filename,aResponse);
  32500. } else {
  32501. return self._respondNotFoundTo_(aResponse);
  32502. };
  32503. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1)})}));
  32504. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  32505. args: ["aRequest", "aResponse"],
  32506. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  32507. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  32508. referencedClasses: []
  32509. }),
  32510. smalltalk.FileServer);
  32511. smalltalk.addMethod(
  32512. smalltalk.method({
  32513. selector: "handleOPTIONSRequest:respondTo:",
  32514. category: 'request handling',
  32515. fn: function (aRequest,aResponse){
  32516. var self=this;
  32517. return smalltalk.withContext(function($ctx1) {
  32518. _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Access-Control-Allow-Origin".__minus_gt("*"),"Access-Control-Allow-Methods".__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),"Access-Control-Allow-Headers".__minus_gt("Content-Type, Accept"),"Content-Length".__minus_gt((0)),"Access-Control-Max-Age".__minus_gt((10))]));
  32519. _st(aResponse)._end();
  32520. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  32521. args: ["aRequest", "aResponse"],
  32522. 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",
  32523. messageSends: ["writeHead:options:", "->", "end"],
  32524. referencedClasses: []
  32525. }),
  32526. smalltalk.FileServer);
  32527. smalltalk.addMethod(
  32528. smalltalk.method({
  32529. selector: "handlePUTRequest:respondTo:",
  32530. category: 'request handling',
  32531. fn: function (aRequest,aResponse){
  32532. var self=this;
  32533. var file,stream;
  32534. return smalltalk.withContext(function($ctx1) {
  32535. var $1,$2;
  32536. $1=self._isAuthenticated_(aRequest);
  32537. if(! smalltalk.assert($1)){
  32538. self._respondAuthenticationRequiredTo_(aResponse);
  32539. return nil;
  32540. };
  32541. file=".".__comma(_st(aRequest)._url());
  32542. stream=_st(self["@fs"])._createWriteStream_(file);
  32543. _st(stream)._on_do_("error",(function(error){
  32544. return smalltalk.withContext(function($ctx2) {
  32545. _st(console)._warn_("Error creating WriteStream for file ".__comma(file));
  32546. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  32547. _st(console)._warn_(" The exact error is: ".__comma(error));
  32548. return self._respondNotCreatedTo_(aResponse);
  32549. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  32550. _st(stream)._on_do_("close",(function(){
  32551. return smalltalk.withContext(function($ctx2) {
  32552. return self._respondCreatedTo_(aResponse);
  32553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32554. _st(aRequest)._setEncoding_("utf8");
  32555. _st(aRequest)._on_do_("data",(function(data){
  32556. return smalltalk.withContext(function($ctx2) {
  32557. return _st(stream)._write_(data);
  32558. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1)})}));
  32559. _st(aRequest)._on_do_("end",(function(){
  32560. return smalltalk.withContext(function($ctx2) {
  32561. $2=_st(stream)._writable();
  32562. if(smalltalk.assert($2)){
  32563. return _st(stream)._end();
  32564. };
  32565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32566. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  32567. args: ["aRequest", "aResponse"],
  32568. 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 js/ or st/ directory in your project?'.\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]]",
  32569. messageSends: ["ifFalse:", "respondAuthenticationRequiredTo:", "isAuthenticated:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "end", "writable"],
  32570. referencedClasses: []
  32571. }),
  32572. smalltalk.FileServer);
  32573. smalltalk.addMethod(
  32574. smalltalk.method({
  32575. selector: "handleRequest:respondTo:",
  32576. category: 'request handling',
  32577. fn: function (aRequest,aResponse){
  32578. var self=this;
  32579. return smalltalk.withContext(function($ctx1) {
  32580. var $1,$2,$3;
  32581. $1=_st(_st(aRequest)._method()).__eq("PUT");
  32582. if(smalltalk.assert($1)){
  32583. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  32584. };
  32585. $2=_st(_st(aRequest)._method()).__eq("GET");
  32586. if(smalltalk.assert($2)){
  32587. self._handleGETRequest_respondTo_(aRequest,aResponse);
  32588. };
  32589. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  32590. if(smalltalk.assert($3)){
  32591. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  32592. };
  32593. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  32594. args: ["aRequest", "aResponse"],
  32595. 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]",
  32596. messageSends: ["ifTrue:", "handlePUTRequest:respondTo:", "=", "method", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  32597. referencedClasses: []
  32598. }),
  32599. smalltalk.FileServer);
  32600. smalltalk.addMethod(
  32601. smalltalk.method({
  32602. selector: "host",
  32603. category: 'accessing',
  32604. fn: function (){
  32605. var self=this;
  32606. return smalltalk.withContext(function($ctx1) {
  32607. var $1;
  32608. $1=self["@host"];
  32609. return $1;
  32610. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  32611. args: [],
  32612. source: "host\x0a\x09^host",
  32613. messageSends: [],
  32614. referencedClasses: []
  32615. }),
  32616. smalltalk.FileServer);
  32617. smalltalk.addMethod(
  32618. smalltalk.method({
  32619. selector: "host:",
  32620. category: 'accessing',
  32621. fn: function (hostname){
  32622. var self=this;
  32623. return smalltalk.withContext(function($ctx1) {
  32624. self["@host"]=hostname;
  32625. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  32626. args: ["hostname"],
  32627. source: "host: hostname\x0a\x09host := hostname",
  32628. messageSends: [],
  32629. referencedClasses: []
  32630. }),
  32631. smalltalk.FileServer);
  32632. smalltalk.addMethod(
  32633. smalltalk.method({
  32634. selector: "initialize",
  32635. category: 'initialization',
  32636. fn: function (){
  32637. var self=this;
  32638. return smalltalk.withContext(function($ctx1) {
  32639. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  32640. self["@path"]=self._require_("path");
  32641. self["@http"]=self._require_("http");
  32642. self["@fs"]=self._require_("fs");
  32643. self["@util"]=self._require_("util");
  32644. self["@url"]=self._require_("url");
  32645. self["@host"]=_st(self._class())._defaultHost();
  32646. self["@port"]=_st(self._class())._defaultPort();
  32647. self["@username"]=nil;
  32648. self["@password"]=nil;
  32649. self["@fallbackPage"]=nil;
  32650. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  32651. args: [],
  32652. 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.",
  32653. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  32654. referencedClasses: []
  32655. }),
  32656. smalltalk.FileServer);
  32657. smalltalk.addMethod(
  32658. smalltalk.method({
  32659. selector: "isAuthenticated:",
  32660. category: 'private',
  32661. fn: function (aRequest){
  32662. var self=this;
  32663. var header,token,auth,parts;
  32664. return smalltalk.withContext(function($ctx1) {
  32665. var $1,$2,$3,$4,$5;
  32666. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  32667. return smalltalk.withContext(function($ctx2) {
  32668. return _st(self["@password"])._isNil();
  32669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32670. if(smalltalk.assert($1)){
  32671. return true;
  32672. };
  32673. $2=_st(_st(aRequest)._headers())._at_("authorization");
  32674. if(($receiver = $2) == nil || $receiver == undefined){
  32675. header="";
  32676. } else {
  32677. header=$2;
  32678. };
  32679. $3=_st(header)._isEmpty();
  32680. if(smalltalk.assert($3)){
  32681. return false;
  32682. } else {
  32683. $4=_st(header)._tokenize_(" ");
  32684. if(($receiver = $4) == nil || $receiver == undefined){
  32685. token="";
  32686. } else {
  32687. token=$4;
  32688. };
  32689. token;
  32690. auth=self._base64Decode_(_st(token)._at_((2)));
  32691. auth;
  32692. parts=_st(auth)._tokenize_(":");
  32693. parts;
  32694. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  32695. return smalltalk.withContext(function($ctx2) {
  32696. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  32697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32698. if(smalltalk.assert($5)){
  32699. return true;
  32700. } else {
  32701. return false;
  32702. };
  32703. };
  32704. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  32705. args: ["aRequest"],
  32706. 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].",
  32707. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "tokenize:", "base64Decode:", "=", "isEmpty"],
  32708. referencedClasses: []
  32709. }),
  32710. smalltalk.FileServer);
  32711. smalltalk.addMethod(
  32712. smalltalk.method({
  32713. selector: "password:",
  32714. category: 'accessing',
  32715. fn: function (aPassword){
  32716. var self=this;
  32717. return smalltalk.withContext(function($ctx1) {
  32718. self["@password"]=aPassword;
  32719. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  32720. args: ["aPassword"],
  32721. source: "password: aPassword\x0a\x09password := aPassword.",
  32722. messageSends: [],
  32723. referencedClasses: []
  32724. }),
  32725. smalltalk.FileServer);
  32726. smalltalk.addMethod(
  32727. smalltalk.method({
  32728. selector: "port",
  32729. category: 'accessing',
  32730. fn: function (){
  32731. var self=this;
  32732. return smalltalk.withContext(function($ctx1) {
  32733. var $1;
  32734. $1=self["@port"];
  32735. return $1;
  32736. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  32737. args: [],
  32738. source: "port\x0a\x09^port",
  32739. messageSends: [],
  32740. referencedClasses: []
  32741. }),
  32742. smalltalk.FileServer);
  32743. smalltalk.addMethod(
  32744. smalltalk.method({
  32745. selector: "port:",
  32746. category: 'accessing',
  32747. fn: function (aNumber){
  32748. var self=this;
  32749. return smalltalk.withContext(function($ctx1) {
  32750. self["@port"]=aNumber;
  32751. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  32752. args: ["aNumber"],
  32753. source: "port: aNumber\x0a\x09port := aNumber",
  32754. messageSends: [],
  32755. referencedClasses: []
  32756. }),
  32757. smalltalk.FileServer);
  32758. smalltalk.addMethod(
  32759. smalltalk.method({
  32760. selector: "require:",
  32761. category: 'private',
  32762. fn: function (aModuleString){
  32763. var self=this;
  32764. return smalltalk.withContext(function($ctx1) {
  32765. var $1;
  32766. $1=_st(require)._value_(aModuleString);
  32767. return $1;
  32768. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  32769. args: ["aModuleString"],
  32770. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  32771. messageSends: ["value:"],
  32772. referencedClasses: []
  32773. }),
  32774. smalltalk.FileServer);
  32775. smalltalk.addMethod(
  32776. smalltalk.method({
  32777. selector: "respondAuthenticationRequiredTo:",
  32778. category: 'request handling',
  32779. fn: function (aResponse){
  32780. var self=this;
  32781. return smalltalk.withContext(function($ctx1) {
  32782. var $1,$2;
  32783. $1=aResponse;
  32784. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._from_(["WWW-Authenticate".__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  32785. _st($1)._write_("<html><body>Authentication needed</body></html>");
  32786. $2=_st($1)._end();
  32787. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32788. args: ["aResponse"],
  32789. 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.",
  32790. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32791. referencedClasses: []
  32792. }),
  32793. smalltalk.FileServer);
  32794. smalltalk.addMethod(
  32795. smalltalk.method({
  32796. selector: "respondCreatedTo:",
  32797. category: 'request handling',
  32798. fn: function (aResponse){
  32799. var self=this;
  32800. return smalltalk.withContext(function($ctx1) {
  32801. var $1,$2;
  32802. $1=aResponse;
  32803. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  32804. $2=_st($1)._end();
  32805. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32806. args: ["aResponse"],
  32807. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  32808. messageSends: ["writeHead:options:", "->", "end"],
  32809. referencedClasses: []
  32810. }),
  32811. smalltalk.FileServer);
  32812. smalltalk.addMethod(
  32813. smalltalk.method({
  32814. selector: "respondFileNamed:to:",
  32815. category: 'request handling',
  32816. fn: function (aFilename,aResponse){
  32817. var self=this;
  32818. var type,filename;
  32819. return smalltalk.withContext(function($ctx1) {
  32820. var $1,$2,$3,$4,$5;
  32821. filename=aFilename;
  32822. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  32823. if(smalltalk.assert($1)){
  32824. filename=_st(filename).__comma("index.html");
  32825. filename;
  32826. };
  32827. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  32828. return smalltalk.withContext(function($ctx2) {
  32829. $2=_st(ex)._notNil();
  32830. if(smalltalk.assert($2)){
  32831. _st(console)._log_(_st(filename).__comma(" does not exist"));
  32832. return self._respondInternalErrorTo_(aResponse);
  32833. } else {
  32834. type=_st(self._class())._mimeTypeFor_(filename);
  32835. type;
  32836. $3=_st(type).__eq("application/javascript");
  32837. if(smalltalk.assert($3)){
  32838. type=_st(type).__comma(";charset=utf-8");
  32839. type;
  32840. };
  32841. $4=aResponse;
  32842. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt(type)]));
  32843. _st($4)._write_encoding_(file,"binary");
  32844. $5=_st($4)._end();
  32845. return $5;
  32846. };
  32847. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1)})}));
  32848. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  32849. args: ["aFilename", "aResponse"],
  32850. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\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 respondInternalErrorTo: 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]]",
  32851. messageSends: ["ifTrue:", ",", "isDirectory", "statSync:", "readFile:do:", "ifTrue:ifFalse:", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end", "notNil"],
  32852. referencedClasses: []
  32853. }),
  32854. smalltalk.FileServer);
  32855. smalltalk.addMethod(
  32856. smalltalk.method({
  32857. selector: "respondInternalErrorTo:",
  32858. category: 'request handling',
  32859. fn: function (aResponse){
  32860. var self=this;
  32861. return smalltalk.withContext(function($ctx1) {
  32862. var $1,$2;
  32863. $1=aResponse;
  32864. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32865. _st($1)._write_("500 Internal server error");
  32866. $2=_st($1)._end();
  32867. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32868. args: ["aResponse"],
  32869. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  32870. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32871. referencedClasses: []
  32872. }),
  32873. smalltalk.FileServer);
  32874. smalltalk.addMethod(
  32875. smalltalk.method({
  32876. selector: "respondNotCreatedTo:",
  32877. category: 'request handling',
  32878. fn: function (aResponse){
  32879. var self=this;
  32880. return smalltalk.withContext(function($ctx1) {
  32881. var $1,$2;
  32882. $1=aResponse;
  32883. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32884. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  32885. $2=_st($1)._end();
  32886. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32887. args: ["aResponse"],
  32888. 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 st/js directories on the server?';\x0a\x09\x09end.",
  32889. messageSends: ["writeHead:options:", "->", "write:", "end"],
  32890. referencedClasses: []
  32891. }),
  32892. smalltalk.FileServer);
  32893. smalltalk.addMethod(
  32894. smalltalk.method({
  32895. selector: "respondNotFoundTo:",
  32896. category: 'request handling',
  32897. fn: function (aResponse){
  32898. var self=this;
  32899. return smalltalk.withContext(function($ctx1) {
  32900. var $1,$2,$3,$4;
  32901. $1=_st(self._fallbackPage())._isNil();
  32902. if(! smalltalk.assert($1)){
  32903. $2=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  32904. return $2;
  32905. };
  32906. $3=aResponse;
  32907. _st($3)._writeHead_options_((404),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  32908. _st($3)._write_("404 Not found");
  32909. $4=_st($3)._end();
  32910. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32911. args: ["aResponse"],
  32912. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  32913. messageSends: ["ifFalse:", "respondFileNamed:to:", "fallbackPage", "isNil", "writeHead:options:", "->", "write:", "end"],
  32914. referencedClasses: []
  32915. }),
  32916. smalltalk.FileServer);
  32917. smalltalk.addMethod(
  32918. smalltalk.method({
  32919. selector: "respondOKTo:",
  32920. category: 'request handling',
  32921. fn: function (aResponse){
  32922. var self=this;
  32923. return smalltalk.withContext(function($ctx1) {
  32924. var $1,$2;
  32925. $1=aResponse;
  32926. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  32927. $2=_st($1)._end();
  32928. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  32929. args: ["aResponse"],
  32930. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  32931. messageSends: ["writeHead:options:", "->", "end"],
  32932. referencedClasses: []
  32933. }),
  32934. smalltalk.FileServer);
  32935. smalltalk.addMethod(
  32936. smalltalk.method({
  32937. selector: "start",
  32938. category: 'starting',
  32939. fn: function (){
  32940. var self=this;
  32941. return smalltalk.withContext(function($ctx1) {
  32942. var $1,$2;
  32943. self._checkDirectoryLayout();
  32944. $1=_st(self["@http"])._createServer_((function(request,response){
  32945. return smalltalk.withContext(function($ctx2) {
  32946. return self._handleRequest_respondTo_(request,response);
  32947. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1)})}));
  32948. _st($1)._on_do_("error",(function(error){
  32949. return smalltalk.withContext(function($ctx2) {
  32950. return _st(console)._log_("Error starting server: ".__comma(error));
  32951. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1)})}));
  32952. _st($1)._on_do_("listening",(function(){
  32953. return smalltalk.withContext(function($ctx2) {
  32954. return _st(console)._log_(_st(_st("Starting file server on http://".__comma(self._host())).__comma(":")).__comma(_st(self._port())._asString()));
  32955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  32956. $2=_st($1)._listen_host_(self._port(),self._host());
  32957. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  32958. args: [],
  32959. 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.",
  32960. messageSends: ["checkDirectoryLayout", "on:do:", "log:", ",", "createServer:", "handleRequest:respondTo:", "asString", "port", "host", "listen:host:"],
  32961. referencedClasses: []
  32962. }),
  32963. smalltalk.FileServer);
  32964. smalltalk.addMethod(
  32965. smalltalk.method({
  32966. selector: "startOn:",
  32967. category: 'starting',
  32968. fn: function (aPort){
  32969. var self=this;
  32970. return smalltalk.withContext(function($ctx1) {
  32971. self._port_(aPort);
  32972. self._start();
  32973. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  32974. args: ["aPort"],
  32975. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  32976. messageSends: ["port:", "start"],
  32977. referencedClasses: []
  32978. }),
  32979. smalltalk.FileServer);
  32980. smalltalk.addMethod(
  32981. smalltalk.method({
  32982. selector: "username:",
  32983. category: 'accessing',
  32984. fn: function (aUsername){
  32985. var self=this;
  32986. return smalltalk.withContext(function($ctx1) {
  32987. self["@username"]=aUsername;
  32988. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  32989. args: ["aUsername"],
  32990. source: "username: aUsername\x0a\x09username := aUsername.",
  32991. messageSends: [],
  32992. referencedClasses: []
  32993. }),
  32994. smalltalk.FileServer);
  32995. smalltalk.addMethod(
  32996. smalltalk.method({
  32997. selector: "writeData:toFileNamed:",
  32998. category: 'private',
  32999. fn: function (data,aFilename){
  33000. var self=this;
  33001. return smalltalk.withContext(function($ctx1) {
  33002. _st(console)._log_(aFilename);
  33003. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  33004. args: ["data", "aFilename"],
  33005. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  33006. messageSends: ["log:"],
  33007. referencedClasses: []
  33008. }),
  33009. smalltalk.FileServer);
  33010. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  33011. smalltalk.addMethod(
  33012. smalltalk.method({
  33013. selector: "commandLineSwitches",
  33014. category: 'accessing',
  33015. fn: function (){
  33016. var self=this;
  33017. var switches;
  33018. return smalltalk.withContext(function($ctx1) {
  33019. var $1;
  33020. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  33021. return smalltalk.withContext(function($ctx2) {
  33022. return _st(each)._selector();
  33023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33024. switches=_st(switches)._select_((function(each){
  33025. return smalltalk.withContext(function($ctx2) {
  33026. return _st(each)._match_("^[^:]*:$");
  33027. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33028. switches=_st(switches)._collect_((function(each){
  33029. return smalltalk.withContext(function($ctx2) {
  33030. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  33031. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33032. $1=switches;
  33033. return $1;
  33034. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  33035. args: [],
  33036. 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",
  33037. messageSends: ["collect:", "selector", "methodsInProtocol:", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  33038. referencedClasses: []
  33039. }),
  33040. smalltalk.FileServer.klass);
  33041. smalltalk.addMethod(
  33042. smalltalk.method({
  33043. selector: "createServerWithArguments:",
  33044. category: 'initialization',
  33045. fn: function (options){
  33046. var self=this;
  33047. var server,popFront,front,optionName,optionValue,switches;
  33048. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  33049. return smalltalk.withContext(function($ctx1) {
  33050. var $1,$2,$3,$4,$5;
  33051. var $early={};
  33052. try {
  33053. switches=self._commandLineSwitches();
  33054. server=self._new();
  33055. _st(options)._ifEmpty_((function(){
  33056. return smalltalk.withContext(function($ctx2) {
  33057. $1=server;
  33058. throw $early=[$1];
  33059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33060. $2=_st(_st(options)._size())._even();
  33061. if(! smalltalk.assert($2)){
  33062. _st(console)._log_("Using default parameters.");
  33063. _st(console)._log_("Wrong commandline options or not enough arguments for: ".__comma(options));
  33064. _st(console)._log_("Use any of the following ones: ".__comma(switches));
  33065. $3=server;
  33066. return $3;
  33067. };
  33068. popFront=(function(args){
  33069. return smalltalk.withContext(function($ctx2) {
  33070. front=_st(args)._first();
  33071. front;
  33072. _st(args)._remove_(front);
  33073. return front;
  33074. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})});
  33075. _st((function(){
  33076. return smalltalk.withContext(function($ctx2) {
  33077. return _st(options)._notEmpty();
  33078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  33079. return smalltalk.withContext(function($ctx2) {
  33080. optionName=_st(popFront)._value_(options);
  33081. optionName;
  33082. optionValue=_st(popFront)._value_(options);
  33083. optionValue;
  33084. $4=_st(switches)._includes_(optionName);
  33085. if(smalltalk.assert($4)){
  33086. optionName=self._selectorForCommandLineSwitch_(optionName);
  33087. optionName;
  33088. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  33089. } else {
  33090. _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
  33091. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  33092. };
  33093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33094. $5=server;
  33095. return $5;
  33096. }
  33097. catch(e) {if(e===$early)return e[0]; throw e}
  33098. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  33099. args: ["options"],
  33100. 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.",
  33101. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "log:", ",", "even", "size", "first", "remove:", "whileTrue:", "value:", "ifTrue:ifFalse:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:", "includes:", "notEmpty"],
  33102. referencedClasses: ["Array"]
  33103. }),
  33104. smalltalk.FileServer.klass);
  33105. smalltalk.addMethod(
  33106. smalltalk.method({
  33107. selector: "defaultHost",
  33108. category: 'accessing',
  33109. fn: function (){
  33110. var self=this;
  33111. return smalltalk.withContext(function($ctx1) {
  33112. return "127.0.0.1";
  33113. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  33114. args: [],
  33115. source: "defaultHost\x0a\x09^'127.0.0.1'",
  33116. messageSends: [],
  33117. referencedClasses: []
  33118. }),
  33119. smalltalk.FileServer.klass);
  33120. smalltalk.addMethod(
  33121. smalltalk.method({
  33122. selector: "defaultMimeTypes",
  33123. category: 'accessing',
  33124. fn: function (){
  33125. var self=this;
  33126. return smalltalk.withContext(function($ctx1) {
  33127. var $1;
  33128. $1=smalltalk.HashedCollection._from_(["%".__minus_gt("application/x-trash"),"323".__minus_gt("text/h323"),"abw".__minus_gt("application/x-abiword"),"ai".__minus_gt("application/postscript"),"aif".__minus_gt("audio/x-aiff"),"aifc".__minus_gt("audio/x-aiff"),"aiff".__minus_gt("audio/x-aiff"),"alc".__minus_gt("chemical/x-alchemy"),"art".__minus_gt("image/x-jg"),"asc".__minus_gt("text/plain"),"asf".__minus_gt("video/x-ms-asf"),"asn".__minus_gt("chemical/x-ncbi-asn1-spec"),"aso".__minus_gt("chemical/x-ncbi-asn1-binary"),"asx".__minus_gt("video/x-ms-asf"),"au".__minus_gt("audio/basic"),"avi".__minus_gt("video/x-msvideo"),"b".__minus_gt("chemical/x-molconn-Z"),"bak".__minus_gt("application/x-trash"),"bat".__minus_gt("application/x-msdos-program"),"bcpio".__minus_gt("application/x-bcpio"),"bib".__minus_gt("text/x-bibtex"),"bin".__minus_gt("application/octet-stream"),"bmp".__minus_gt("image/x-ms-bmp"),"book".__minus_gt("application/x-maker"),"bsd".__minus_gt("chemical/x-crossfire"),"c".__minus_gt("text/x-csrc"),"c++".__minus_gt("text/x-c++src"),"c3d".__minus_gt("chemical/x-chem3d"),"cac".__minus_gt("chemical/x-cache"),"cache".__minus_gt("chemical/x-cache"),"cascii".__minus_gt("chemical/x-cactvs-binary"),"cat".__minus_gt("application/vnd.ms-pki.seccat"),"cbin".__minus_gt("chemical/x-cactvs-binary"),"cc".__minus_gt("text/x-c++src"),"cdf".__minus_gt("application/x-cdf"),"cdr".__minus_gt("image/x-coreldraw"),"cdt".__minus_gt("image/x-coreldrawtemplate"),"cdx".__minus_gt("chemical/x-cdx"),"cdy".__minus_gt("application/vnd.cinderella"),"cef".__minus_gt("chemical/x-cxf"),"cer".__minus_gt("chemical/x-cerius"),"chm".__minus_gt("chemical/x-chemdraw"),"chrt".__minus_gt("application/x-kchart"),"cif".__minus_gt("chemical/x-cif"),"class".__minus_gt("application/java-vm"),"cls".__minus_gt("text/x-tex"),"cmdf".__minus_gt("chemical/x-cmdf"),"cml".__minus_gt("chemical/x-cml"),"cod".__minus_gt("application/vnd.rim.cod"),"com".__minus_gt("application/x-msdos-program"),"cpa".__minus_gt("chemical/x-compass"),"cpio".__minus_gt("application/x-cpio"),"cpp".__minus_gt("text/x-c++src"),"cpt".__minus_gt("image/x-corelphotopaint"),"crl".__minus_gt("application/x-pkcs7-crl"),"crt".__minus_gt("application/x-x509-ca-cert"),"csf".__minus_gt("chemical/x-cache-csf"),"csh".__minus_gt("text/x-csh"),"csm".__minus_gt("chemical/x-csml"),"csml".__minus_gt("chemical/x-csml"),"css".__minus_gt("text/css"),"csv".__minus_gt("text/comma-separated-values"),"ctab".__minus_gt("chemical/x-cactvs-binary"),"ctx".__minus_gt("chemical/x-ctx"),"cu".__minus_gt("application/cu-seeme"),"cub".__minus_gt("chemical/x-gaussian-cube"),"cxf".__minus_gt("chemical/x-cxf"),"cxx".__minus_gt("text/x-c++src"),"dat".__minus_gt("chemical/x-mopac-input"),"dcr".__minus_gt("application/x-director"),"deb".__minus_gt("application/x-debian-package"),"dif".__minus_gt("video/dv"),"diff".__minus_gt("text/plain"),"dir".__minus_gt("application/x-director"),"djv".__minus_gt("image/vnd.djvu"),"djvu".__minus_gt("image/vnd.djvu"),"dl".__minus_gt("video/dl"),"dll".__minus_gt("application/x-msdos-program"),"dmg".__minus_gt("application/x-apple-diskimage"),"dms".__minus_gt("application/x-dms"),"doc".__minus_gt("application/msword"),"dot".__minus_gt("application/msword"),"dv".__minus_gt("video/dv"),"dvi".__minus_gt("application/x-dvi"),"dx".__minus_gt("chemical/x-jcamp-dx"),"dxr".__minus_gt("application/x-director"),"emb".__minus_gt("chemical/x-embl-dl-nucleotide"),"embl".__minus_gt("chemical/x-embl-dl-nucleotide"),"ent".__minus_gt("chemical/x-pdb"),"eps".__minus_gt("application/postscript"),"etx".__minus_gt("text/x-setext"),"exe".__minus_gt("application/x-msdos-program"),"ez".__minus_gt("application/andrew-inset"),"fb".__minus_gt("application/x-maker"),"fbdoc".__minus_gt("application/x-maker"),"fch".__minus_gt("chemical/x-gaussian-checkpoint"),"fchk".__minus_gt("chemical/x-gaussian-checkpoint"),"fig".__minus_gt("application/x-xfig"),"flac".__minus_gt("application/x-flac"),"fli".__minus_gt("video/fli"),"fm".__minus_gt("application/x-maker"),"frame".__minus_gt("application/x-maker"),"frm".__minus_gt("application/x-maker"),"gal".__minus_gt("chemical/x-gaussian-log"),"gam".__minus_gt("chemical/x-gamess-input"),"gamin".__minus_gt("chemical/x-gamess-input"),"gau".__minus_gt("chemical/x-gaussian-input"),"gcd".__minus_gt("text/x-pcs-gcd"),"gcf".__minus_gt("application/x-graphing-calculator"),"gcg".__minus_gt("chemical/x-gcg8-sequence"),"gen".__minus_gt("chemical/x-genbank"),"gf".__minus_gt("application/x-tex-gf"),"gif".__minus_gt("image/gif"),"gjc".__minus_gt("chemical/x-gaussian-input"),"gjf".__minus_gt("chemical/x-gaussian-input"),"gl".__minus_gt("video/gl"),"gnumeric".__minus_gt("application/x-gnumeric"),"gpt".__minus_gt("chemical/x-mopac-graph"),"gsf".__minus_gt("application/x-font"),"gsm".__minus_gt("audio/x-gsm"),"gtar".__minus_gt("application/x-gtar"),"h".__minus_gt("text/x-chdr"),"h++".__minus_gt("text/x-c++hdr"),"hdf".__minus_gt("application/x-hdf"),"hh".__minus_gt("text/x-c++hdr"),"hin".__minus_gt("chemical/x-hin"),"hpp".__minus_gt("text/x-c++hdr"),"hqx".__minus_gt("application/mac-binhex40"),"hs".__minus_gt("text/x-haskell"),"hta".__minus_gt("application/hta"),"htc".__minus_gt("text/x-component"),"htm".__minus_gt("text/html"),"html".__minus_gt("text/html"),"hxx".__minus_gt("text/x-c++hdr"),"ica".__minus_gt("application/x-ica"),"ice".__minus_gt("x-conference/x-cooltalk"),"ico".__minus_gt("image/x-icon"),"ics".__minus_gt("text/calendar"),"icz".__minus_gt("text/calendar"),"ief".__minus_gt("image/ief"),"iges".__minus_gt("model/iges"),"igs".__minus_gt("model/iges"),"iii".__minus_gt("application/x-iphone"),"inp".__minus_gt("chemical/x-gamess-input"),"ins".__minus_gt("application/x-internet-signup"),"iso".__minus_gt("application/x-iso9660-image"),"isp".__minus_gt("application/x-internet-signup"),"ist".__minus_gt("chemical/x-isostar"),"istr".__minus_gt("chemical/x-isostar"),"jad".__minus_gt("text/vnd.sun.j2me.app-descriptor"),"jar".__minus_gt("application/java-archive"),"java".__minus_gt("text/x-java"),"jdx".__minus_gt("chemical/x-jcamp-dx"),"jmz".__minus_gt("application/x-jmol"),"jng".__minus_gt("image/x-jng"),"jnlp".__minus_gt("application/x-java-jnlp-file"),"jpe".__minus_gt("image/jpeg"),"jpeg".__minus_gt("image/jpeg"),"jpg".__minus_gt("image/jpeg"),"js".__minus_gt("application/javascript"),"kar".__minus_gt("audio/midi"),"key".__minus_gt("application/pgp-keys"),"kil".__minus_gt("application/x-killustrator"),"kin".__minus_gt("chemical/x-kinemage"),"kpr".__minus_gt("application/x-kpresenter"),"kpt".__minus_gt("application/x-kpresenter"),"ksp".__minus_gt("application/x-kspread"),"kwd".__minus_gt("application/x-kword"),"kwt".__minus_gt("application/x-kword"),"latex".__minus_gt("application/x-latex"),"lha".__minus_gt("application/x-lha"),"lhs".__minus_gt("text/x-literate-haskell"),"lsf".__minus_gt("video/x-la-asf"),"lsx".__minus_gt("video/x-la-asf"),"ltx".__minus_gt("text/x-tex"),"lzh".__minus_gt("application/x-lzh"),"lzx".__minus_gt("application/x-lzx"),"m3u".__minus_gt("audio/x-mpegurl"),"m4a".__minus_gt("audio/mpeg"),"maker".__minus_gt("application/x-maker"),"man".__minus_gt("application/x-troff-man"),"mcif".__minus_gt("chemical/x-mmcif"),"mcm".__minus_gt("chemical/x-macmolecule"),"mdb".__minus_gt("application/msaccess"),"me".__minus_gt("application/x-troff-me"),"mesh".__minus_gt("model/mesh"),"mid".__minus_gt("audio/midi"),"midi".__minus_gt("audio/midi"),"mif".__minus_gt("application/x-mif"),"mm".__minus_gt("application/x-freemind"),"mmd".__minus_gt("chemical/x-macromodel-input"),"mmf".__minus_gt("application/vnd.smaf"),"mml".__minus_gt("text/mathml"),"mmod".__minus_gt("chemical/x-macromodel-input"),"mng".__minus_gt("video/x-mng"),"moc".__minus_gt("text/x-moc"),"mol".__minus_gt("chemical/x-mdl-molfile"),"mol2".__minus_gt("chemical/x-mol2"),"moo".__minus_gt("chemical/x-mopac-out"),"mop".__minus_gt("chemical/x-mopac-input"),"mopcrt".__minus_gt("chemical/x-mopac-input"),"mov".__minus_gt("video/quicktime"),"movie".__minus_gt("video/x-sgi-movie"),"mp2".__minus_gt("audio/mpeg"),"mp3".__minus_gt("audio/mpeg"),"mp4".__minus_gt("video/mp4"),"mpc".__minus_gt("chemical/x-mopac-input"),"mpe".__minus_gt("video/mpeg"),"mpeg".__minus_gt("video/mpeg"),"mpega".__minus_gt("audio/mpeg"),"mpg".__minus_gt("video/mpeg"),"mpga".__minus_gt("audio/mpeg"),"ms".__minus_gt("application/x-troff-ms"),"msh".__minus_gt("model/mesh"),"msi".__minus_gt("application/x-msi"),"mvb".__minus_gt("chemical/x-mopac-vib"),"mxu".__minus_gt("video/vnd.mpegurl"),"nb".__minus_gt("application/mathematica"),"nc".__minus_gt("application/x-netcdf"),"nwc".__minus_gt("application/x-nwc"),"o".__minus_gt("application/x-object"),"oda".__minus_gt("application/oda"),"odb".__minus_gt("application/vnd.oasis.opendocument.database"),"odc".__minus_gt("application/vnd.oasis.opendocument.chart"),"odf".__minus_gt("application/vnd.oasis.opendocument.formula"),"odg".__minus_gt("application/vnd.oasis.opendocument.graphics"),"odi".__minus_gt("application/vnd.oasis.opendocument.image"),"odm".__minus_gt("application/vnd.oasis.opendocument.text-master"),"odp".__minus_gt("application/vnd.oasis.opendocument.presentation"),"ods".__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),"odt".__minus_gt("application/vnd.oasis.opendocument.text"),"ogg".__minus_gt("application/ogg"),"old".__minus_gt("application/x-trash"),"oth".__minus_gt("application/vnd.oasis.opendocument.text-web"),"oza".__minus_gt("application/x-oz-application"),"p".__minus_gt("text/x-pascal"),"p7r".__minus_gt("application/x-pkcs7-certreqresp"),"pac".__minus_gt("application/x-ns-proxy-autoconfig"),"pas".__minus_gt("text/x-pascal"),"pat".__minus_gt("image/x-coreldrawpattern"),"pbm".__minus_gt("image/x-portable-bitmap"),"pcf".__minus_gt("application/x-font"),"pcf.Z".__minus_gt("application/x-font"),"pcx".__minus_gt("image/pcx"),"pdb".__minus_gt("chemical/x-pdb"),"pdf".__minus_gt("application/pdf"),"pfa".__minus_gt("application/x-font"),"pfb".__minus_gt("application/x-font"),"pgm".__minus_gt("image/x-portable-graymap"),"pgn".__minus_gt("application/x-chess-pgn"),"pgp".__minus_gt("application/pgp-signature"),"pk".__minus_gt("application/x-tex-pk"),"pl".__minus_gt("text/x-perl"),"pls".__minus_gt("audio/x-scpls"),"pm".__minus_gt("text/x-perl"),"png".__minus_gt("image/png"),"pnm".__minus_gt("image/x-portable-anymap"),"pot".__minus_gt("text/plain"),"ppm".__minus_gt("image/x-portable-pixmap"),"pps".__minus_gt("application/vnd.ms-powerpoint"),"ppt".__minus_gt("application/vnd.ms-powerpoint"),"prf".__minus_gt("application/pics-rules"),"prt".__minus_gt("chemical/x-ncbi-asn1-ascii"),"ps".__minus_gt("application/postscript"),"psd".__minus_gt("image/x-photoshop"),"psp".__minus_gt("text/x-psp"),"py".__minus_gt("text/x-python"),"pyc".__minus_gt("application/x-python-code"),"pyo".__minus_gt("application/x-python-code"),"qt".__minus_gt("video/quicktime"),"qtl".__minus_gt("application/x-quicktimeplayer"),"ra".__minus_gt("audio/x-realaudio"),"ram".__minus_gt("audio/x-pn-realaudio"),"rar".__minus_gt("application/rar"),"ras".__minus_gt("image/x-cmu-raster"),"rd".__minus_gt("chemical/x-mdl-rdfile"),"rdf".__minus_gt("application/rdf+xml"),"rgb".__minus_gt("image/x-rgb"),"rm".__minus_gt("audio/x-pn-realaudio"),"roff".__minus_gt("application/x-troff"),"ros".__minus_gt("chemical/x-rosdal"),"rpm".__minus_gt("application/x-redhat-package-manager"),"rss".__minus_gt("application/rss+xml"),"rtf".__minus_gt("text/rtf"),"rtx".__minus_gt("text/richtext"),"rxn".__minus_gt("chemical/x-mdl-rxnfile"),"sct".__minus_gt("text/scriptlet"),"sd".__minus_gt("chemical/x-mdl-sdfile"),"sd2".__minus_gt("audio/x-sd2"),"sda".__minus_gt("application/vnd.stardivision.draw"),"sdc".__minus_gt("application/vnd.stardivision.calc"),"sdd".__minus_gt("application/vnd.stardivision.impress"),"sdf".__minus_gt("chemical/x-mdl-sdfile"),"sdp".__minus_gt("application/vnd.stardivision.impress"),"sdw".__minus_gt("application/vnd.stardivision.writer"),"ser".__minus_gt("application/java-serialized-object"),"sgf".__minus_gt("application/x-go-sgf"),"sgl".__minus_gt("application/vnd.stardivision.writer-global"),"sh".__minus_gt("text/x-sh"),"shar".__minus_gt("application/x-shar"),"shtml".__minus_gt("text/html"),"sid".__minus_gt("audio/prs.sid"),"sik".__minus_gt("application/x-trash"),"silo".__minus_gt("model/mesh"),"sis".__minus_gt("application/vnd.symbian.install"),"sit".__minus_gt("application/x-stuffit"),"skd".__minus_gt("application/x-koan"),"skm".__minus_gt("application/x-koan"),"skp".__minus_gt("application/x-koan"),"skt".__minus_gt("application/x-koan"),"smf".__minus_gt("application/vnd.stardivision.math"),"smi".__minus_gt("application/smil"),"smil".__minus_gt("application/smil"),"snd".__minus_gt("audio/basic"),"spc".__minus_gt("chemical/x-galactic-spc"),"spl".__minus_gt("application/x-futuresplash"),"src".__minus_gt("application/x-wais-source"),"stc".__minus_gt("application/vnd.sun.xml.calc.template"),"std".__minus_gt("application/vnd.sun.xml.draw.template"),"sti".__minus_gt("application/vnd.sun.xml.impress.template"),"stl".__minus_gt("application/vnd.ms-pki.stl"),"stw".__minus_gt("application/vnd.sun.xml.writer.template"),"sty".__minus_gt("text/x-tex"),"sv4cpio".__minus_gt("application/x-sv4cpio"),"sv4crc".__minus_gt("application/x-sv4crc"),"svg".__minus_gt("image/svg+xml"),"svgz".__minus_gt("image/svg+xml"),"sw".__minus_gt("chemical/x-swissprot"),"swf".__minus_gt("application/x-shockwave-flash"),"swfl".__minus_gt("application/x-shockwave-flash"),"sxc".__minus_gt("application/vnd.sun.xml.calc"),"sxd".__minus_gt("application/vnd.sun.xml.draw"),"sxg".__minus_gt("application/vnd.sun.xml.writer.global"),"sxi".__minus_gt("application/vnd.sun.xml.impress"),"sxm".__minus_gt("application/vnd.sun.xml.math"),"sxw".__minus_gt("application/vnd.sun.xml.writer"),"t".__minus_gt("application/x-troff"),"tar".__minus_gt("application/x-tar"),"taz".__minus_gt("application/x-gtar"),"tcl".__minus_gt("text/x-tcl"),"tex".__minus_gt("text/x-tex"),"texi".__minus_gt("application/x-texinfo"),"texinfo".__minus_gt("application/x-texinfo"),"text".__minus_gt("text/plain"),"tgf".__minus_gt("chemical/x-mdl-tgf"),"tgz".__minus_gt("application/x-gtar"),"tif".__minus_gt("image/tiff"),"tiff".__minus_gt("image/tiff"),"tk".__minus_gt("text/x-tcl"),"tm".__minus_gt("text/texmacs"),"torrent".__minus_gt("application/x-bittorrent"),"tr".__minus_gt("application/x-troff"),"ts".__minus_gt("text/texmacs"),"tsp".__minus_gt("application/dsptype"),"tsv".__minus_gt("text/tab-separated-values"),"txt".__minus_gt("text/plain"),"udeb".__minus_gt("application/x-debian-package"),"uls".__minus_gt("text/iuls"),"ustar".__minus_gt("application/x-ustar"),"val".__minus_gt("chemical/x-ncbi-asn1-binary"),"vcd".__minus_gt("application/x-cdlink"),"vcf".__minus_gt("text/x-vcard"),"vcs".__minus_gt("text/x-vcalendar"),"vmd".__minus_gt("chemical/x-vmd"),"vms".__minus_gt("chemical/x-vamas-iso14976"),"vor".__minus_gt("application/vnd.stardivision.writer"),"vrm".__minus_gt("x-world/x-vrml"),"vrml".__minus_gt("x-world/x-vrml"),"vsd".__minus_gt("application/vnd.visio"),"wad".__minus_gt("application/x-doom"),"wav".__minus_gt("audio/x-wav"),"wax".__minus_gt("audio/x-ms-wax"),"wbmp".__minus_gt("image/vnd.wap.wbmp"),"wbxml".__minus_gt("application/vnd.wap.wbxml"),"wk".__minus_gt("application/x-123"),"wm".__minus_gt("video/x-ms-wm"),"wma".__minus_gt("audio/x-ms-wma"),"wmd".__minus_gt("application/x-ms-wmd"),"wml".__minus_gt("text/vnd.wap.wml"),"wmlc".__minus_gt("application/vnd.wap.wmlc"),"wmls".__minus_gt("text/vnd.wap.wmlscript"),"wmlsc".__minus_gt("application/vnd.wap.wmlscriptc"),"wmv".__minus_gt("video/x-ms-wmv"),"wmx".__minus_gt("video/x-ms-wmx"),"wmz".__minus_gt("application/x-ms-wmz"),"wp5".__minus_gt("application/wordperfect5.1"),"wpd".__minus_gt("application/wordperfect"),"wrl".__minus_gt("x-world/x-vrml"),"wsc".__minus_gt("text/scriptlet"),"wvx".__minus_gt("video/x-ms-wvx"),"wz".__minus_gt("application/x-wingz"),"xbm".__minus_gt("image/x-xbitmap"),"xcf".__minus_gt("application/x-xcf"),"xht".__minus_gt("application/xhtml+xml"),"xhtml".__minus_gt("application/xhtml+xml"),"xlb".__minus_gt("application/vnd.ms-excel"),"xls".__minus_gt("application/vnd.ms-excel"),"xlt".__minus_gt("application/vnd.ms-excel"),"xml".__minus_gt("application/xml"),"xpi".__minus_gt("application/x-xpinstall"),"xpm".__minus_gt("image/x-xpixmap"),"xsl".__minus_gt("application/xml"),"xtel".__minus_gt("chemical/x-xtel"),"xul".__minus_gt("application/vnd.mozilla.xul+xml"),"xwd".__minus_gt("image/x-xwindowdump"),"xyz".__minus_gt("chemical/x-xyz"),"zip".__minus_gt("application/zip"),"zmt".__minus_gt("chemical/x-mopac-input"),"~".__minus_gt("application/x-trash")]);
  33129. return $1;
  33130. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  33131. args: [],
  33132. 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}",
  33133. messageSends: ["->"],
  33134. referencedClasses: []
  33135. }),
  33136. smalltalk.FileServer.klass);
  33137. smalltalk.addMethod(
  33138. smalltalk.method({
  33139. selector: "defaultPort",
  33140. category: 'accessing',
  33141. fn: function (){
  33142. var self=this;
  33143. return smalltalk.withContext(function($ctx1) {
  33144. return (4000);
  33145. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  33146. args: [],
  33147. source: "defaultPort\x0a\x09^4000",
  33148. messageSends: [],
  33149. referencedClasses: []
  33150. }),
  33151. smalltalk.FileServer.klass);
  33152. smalltalk.addMethod(
  33153. smalltalk.method({
  33154. selector: "main",
  33155. category: 'initialization',
  33156. fn: function (){
  33157. var self=this;
  33158. var fileServer,args;
  33159. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  33160. return smalltalk.withContext(function($ctx1) {
  33161. var $1,$2;
  33162. var $early={};
  33163. try {
  33164. args=_st(process)._argv();
  33165. _st(args)._removeFrom_to_((1),(3));
  33166. _st(args)._detect_ifNone_((function(each){
  33167. return smalltalk.withContext(function($ctx2) {
  33168. $1=_st(each).__eq("--help");
  33169. if(smalltalk.assert($1)){
  33170. return _st($FileServer())._printHelp();
  33171. };
  33172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  33173. return smalltalk.withContext(function($ctx2) {
  33174. fileServer=_st($FileServer())._createServerWithArguments_(args);
  33175. fileServer;
  33176. $2=_st(fileServer)._start();
  33177. throw $early=[$2];
  33178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33179. return self}
  33180. catch(e) {if(e===$early)return e[0]; throw e}
  33181. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  33182. args: [],
  33183. 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]",
  33184. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "printHelp", "=", "createServerWithArguments:", "start"],
  33185. referencedClasses: ["FileServer"]
  33186. }),
  33187. smalltalk.FileServer.klass);
  33188. smalltalk.addMethod(
  33189. smalltalk.method({
  33190. selector: "mimeTypeFor:",
  33191. category: 'accessing',
  33192. fn: function (aString){
  33193. var self=this;
  33194. return smalltalk.withContext(function($ctx1) {
  33195. var $1;
  33196. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  33197. return smalltalk.withContext(function($ctx2) {
  33198. return "text/plain";
  33199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33200. return $1;
  33201. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  33202. args: ["aString"],
  33203. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  33204. messageSends: ["at:ifAbsent:", "replace:with:", "mimeTypes"],
  33205. referencedClasses: []
  33206. }),
  33207. smalltalk.FileServer.klass);
  33208. smalltalk.addMethod(
  33209. smalltalk.method({
  33210. selector: "mimeTypes",
  33211. category: 'accessing',
  33212. fn: function (){
  33213. var self=this;
  33214. return smalltalk.withContext(function($ctx1) {
  33215. var $2,$1;
  33216. $2=self["@mimeTypes"];
  33217. if(($receiver = $2) == nil || $receiver == undefined){
  33218. self["@mimeTypes"]=self._defaultMimeTypes();
  33219. $1=self["@mimeTypes"];
  33220. } else {
  33221. $1=$2;
  33222. };
  33223. return $1;
  33224. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  33225. args: [],
  33226. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  33227. messageSends: ["ifNil:", "defaultMimeTypes"],
  33228. referencedClasses: []
  33229. }),
  33230. smalltalk.FileServer.klass);
  33231. smalltalk.addMethod(
  33232. smalltalk.method({
  33233. selector: "printHelp",
  33234. category: 'accessing',
  33235. fn: function (){
  33236. var self=this;
  33237. return smalltalk.withContext(function($ctx1) {
  33238. _st(console)._log_("Available commandline options are:");
  33239. _st(console)._log_("--help");
  33240. _st(self._commandLineSwitches())._do_((function(each){
  33241. return smalltalk.withContext(function($ctx2) {
  33242. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  33243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  33244. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  33245. args: [],
  33246. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  33247. messageSends: ["log:", "do:", ",", "commandLineSwitches"],
  33248. referencedClasses: []
  33249. }),
  33250. smalltalk.FileServer.klass);
  33251. smalltalk.addMethod(
  33252. smalltalk.method({
  33253. selector: "selectorForCommandLineSwitch:",
  33254. category: 'accessing',
  33255. fn: function (aSwitch){
  33256. var self=this;
  33257. return smalltalk.withContext(function($ctx1) {
  33258. var $1;
  33259. $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  33260. return smalltalk.withContext(function($ctx2) {
  33261. return _st(_st(each)._second())._asUppercase();
  33262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}))).__comma(":");
  33263. return $1;
  33264. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  33265. args: ["aSwitch"],
  33266. 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 ]), ':'",
  33267. messageSends: [",", "replace:with:", "asUppercase", "second"],
  33268. referencedClasses: []
  33269. }),
  33270. smalltalk.FileServer.klass);
  33271. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'AmberCli');
  33272. smalltalk.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.";
  33273. smalltalk.addMethod(
  33274. smalltalk.method({
  33275. selector: "close",
  33276. category: 'actions',
  33277. fn: function (){
  33278. var self=this;
  33279. return smalltalk.withContext(function($ctx1) {
  33280. _st(_st(process)._stdin())._destroy();
  33281. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
  33282. args: [],
  33283. source: "close\x0a\x09process stdin destroy",
  33284. messageSends: ["destroy", "stdin"],
  33285. referencedClasses: []
  33286. }),
  33287. smalltalk.Repl);
  33288. smalltalk.addMethod(
  33289. smalltalk.method({
  33290. selector: "createInterface",
  33291. category: 'actions',
  33292. fn: function (){
  33293. var self=this;
  33294. return smalltalk.withContext(function($ctx1) {
  33295. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  33296. _st(self["@interface"])._on_do_("line",(function(buffer){
  33297. return smalltalk.withContext(function($ctx2) {
  33298. return self._eval_(buffer);
  33299. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1)})}));
  33300. _st(self["@interface"])._on_do_("close",(function(){
  33301. return smalltalk.withContext(function($ctx2) {
  33302. return self._close();
  33303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  33304. self._setPrompt();
  33305. _st(self["@interface"])._prompt();
  33306. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
  33307. args: [],
  33308. source: "createInterface\x0a\x09\x22No completion for now\x22\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self eval: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self setPrompt.\x0a\x09interface prompt",
  33309. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"],
  33310. referencedClasses: []
  33311. }),
  33312. smalltalk.Repl);
  33313. smalltalk.addMethod(
  33314. smalltalk.method({
  33315. selector: "eval:",
  33316. category: 'actions',
  33317. fn: function (buffer){
  33318. var self=this;
  33319. var result;
  33320. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  33321. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  33322. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  33323. return smalltalk.withContext(function($ctx1) {
  33324. var $1,$2;
  33325. $1=_st(buffer)._isEmpty();
  33326. if(! smalltalk.assert($1)){
  33327. self._try_catch_((function(){
  33328. return smalltalk.withContext(function($ctx2) {
  33329. result=_st(_st($Compiler())._new())._evaluateExpression_(buffer);
  33330. result;
  33331. return _st($Transcript())._show_(result);
  33332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(e){
  33333. return smalltalk.withContext(function($ctx2) {
  33334. $2=_st(e)._isSmalltalkError();
  33335. if(smalltalk.assert($2)){
  33336. return _st(_st($ErrorHandler())._new())._handleError_(e);
  33337. } else {
  33338. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  33339. };
  33340. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  33341. };
  33342. _st(self["@interface"])._prompt();
  33343. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer,result:result},smalltalk.Repl)})},
  33344. args: ["buffer"],
  33345. source: "eval: buffer\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer.\x0a\x09\x09\x09Transcript show: result]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ErrorHandler new handleError: e]\x0a\x09\x09\x09 ifFalse: [process stdout write: e jsStack]]].\x0a\x09interface prompt",
  33346. messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"],
  33347. referencedClasses: ["Compiler", "Transcript", "ErrorHandler"]
  33348. }),
  33349. smalltalk.Repl);
  33350. smalltalk.addMethod(
  33351. smalltalk.method({
  33352. selector: "initialize",
  33353. category: 'initialization',
  33354. fn: function (){
  33355. var self=this;
  33356. return smalltalk.withContext(function($ctx1) {
  33357. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  33358. self["@readline"]=_st(require)._value_("readline");
  33359. self["@util"]=_st(require)._value_("util");
  33360. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
  33361. args: [],
  33362. source: "initialize\x0a\x09super initialize.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'",
  33363. messageSends: ["initialize", "value:"],
  33364. referencedClasses: []
  33365. }),
  33366. smalltalk.Repl);
  33367. smalltalk.addMethod(
  33368. smalltalk.method({
  33369. selector: "prompt",
  33370. category: 'accessing',
  33371. fn: function (){
  33372. var self=this;
  33373. return smalltalk.withContext(function($ctx1) {
  33374. return "amber >> ";
  33375. }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
  33376. args: [],
  33377. source: "prompt\x0a\x09^'amber >> '",
  33378. messageSends: [],
  33379. referencedClasses: []
  33380. }),
  33381. smalltalk.Repl);
  33382. smalltalk.addMethod(
  33383. smalltalk.method({
  33384. selector: "setPrompt",
  33385. category: 'actions',
  33386. fn: function (){
  33387. var self=this;
  33388. return smalltalk.withContext(function($ctx1) {
  33389. _st(self["@interface"])._setPrompt_(self._prompt());
  33390. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
  33391. args: [],
  33392. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  33393. messageSends: ["setPrompt:", "prompt"],
  33394. referencedClasses: []
  33395. }),
  33396. smalltalk.Repl);
  33397. smalltalk.addMethod(
  33398. smalltalk.method({
  33399. selector: "main",
  33400. category: 'initialization',
  33401. fn: function (){
  33402. var self=this;
  33403. return smalltalk.withContext(function($ctx1) {
  33404. _st(self._new())._createInterface();
  33405. return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
  33406. args: [],
  33407. source: "main\x0a\x09self new createInterface",
  33408. messageSends: ["createInterface", "new"],
  33409. referencedClasses: []
  33410. }),
  33411. smalltalk.Repl.klass);
  33412. (function () {
  33413. var inBrowser = typeof amber !== "undefined" && typeof amber.load === "function";
  33414. function init() {
  33415. smalltalk.initialize();
  33416. /* Similar to jQuery(document).ready() */
  33417. if (inBrowser && amber.smalltalkReady) {
  33418. amber.smalltalkReady();
  33419. }
  33420. }
  33421. if (inBrowser) {
  33422. // init is lengthy process done in JavaScript.
  33423. // setTimeout here postpones it, so DOM ready
  33424. // event can occur sooner, thus load process
  33425. // may appear optically faster.
  33426. setTimeout(init, 0);
  33427. } else {
  33428. // In certain configurations, setTimeout is not feasible.
  33429. // It is mainly for `amberc`-produced concatenated
  33430. // node.js programs. There, the actual "main" appears
  33431. // immediately after init, so it must happens synchronously.
  33432. init();
  33433. }
  33434. })();smalltalk.AmberCli._main()