amber.js 853 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671
  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. /* Smalltalk constructors definition */
  45. function SmalltalkObject(){};
  46. function SmalltalkBehavior(){};
  47. function SmalltalkClass(){};
  48. function SmalltalkPackage(){};
  49. function SmalltalkMetaclass(){
  50. this.meta = true;
  51. };
  52. function SmalltalkMethod(){};
  53. function SmalltalkNil(){};
  54. function SmalltalkSymbol(string){
  55. this.value = string;
  56. };
  57. function SmalltalkOrganizer() {
  58. this.elements = [];
  59. };
  60. SmalltalkOrganizer.prototype.addElement = function(el) {
  61. if(typeof el === 'undefined' || el === nil) {
  62. return false;
  63. }
  64. if(this.elements.indexOf(el) == -1) {
  65. this.elements.push(el);
  66. }
  67. };
  68. SmalltalkOrganizer.prototype.removeElement = function(el) {
  69. for(var i=0; i<this.elements.length; i++) {
  70. if(this.elements[i] == el) {
  71. this.elements.splice(i, 1);
  72. break;
  73. }
  74. }
  75. };
  76. function Smalltalk(){
  77. var st = this;
  78. /* This is the current call context object. While it is publicly available,
  79. Use smalltalk.getThisContext() instead which will answer a safe copy of
  80. the current context */
  81. st.thisContext = undefined;
  82. /* List of all reserved words in JavaScript. They may not be used as variables
  83. in Smalltalk. */
  84. // list of reserved JavaScript keywords as of
  85. // http://es5.github.com/#x7.6.1.1
  86. // and
  87. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  88. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  89. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  90. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  91. 'try', 'typeof', 'var', 'void', 'while', 'with',
  92. // ES5: future use: http://es5.github.com/#x7.6.1.2
  93. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  94. // ES5: future use in strict mode
  95. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  96. 'public', 'static', 'yield'];
  97. /* The symbol table ensures symbol unicity */
  98. symbolTable = {};
  99. st.symbolFor = function(string) {
  100. if(symbolTable[string] === undefined) {
  101. symbolTable[string] = new SmalltalkSymbol(string);
  102. };
  103. return symbolTable[string];
  104. };
  105. /* Unique ID number generator */
  106. oid = 0;
  107. st.nextId = function() {
  108. oid += 1;
  109. return oid;
  110. };
  111. /* We hold all Packages in a separate Object */
  112. st.packages = {};
  113. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  114. function pkg(spec) {
  115. var that = new SmalltalkPackage();
  116. that.pkgName = spec.pkgName;
  117. that.organization = new SmalltalkOrganizer();
  118. that.properties = spec.properties || {};
  119. return that;
  120. };
  121. /* Smalltalk class creation. A class is an instance of an automatically
  122. created metaclass object. Newly created classes (not their metaclass)
  123. should be added to the smalltalk object, see smalltalk.addClass().
  124. Superclass linking is *not* handled here, see smalltalk.init() */
  125. function klass(spec) {
  126. var spec = spec || {};
  127. var meta = metaclass();
  128. var that = setupClass(meta.instanceClass, spec);
  129. that.className = spec.className;
  130. meta.className = spec.className + ' class';
  131. if(spec.superclass) {
  132. that.superclass = spec.superclass;
  133. meta.superclass = spec.superclass.klass;
  134. }
  135. return that;
  136. }
  137. function metaclass() {
  138. var meta = setupClass(new SmalltalkMetaclass(), {})
  139. meta.instanceClass = new meta.fn;
  140. return meta;
  141. }
  142. function setupClass(that, spec) {
  143. that.fn = spec.fn || function(){};
  144. that.iVarNames = spec.iVarNames || [];
  145. Object.defineProperty(that, "toString", {
  146. value: function() { return 'Smalltalk ' + this.className; },
  147. configurable: true // no writable - in par with ES6 methods
  148. });
  149. that.organization = new SmalltalkOrganizer();
  150. that.pkg = spec.pkg;
  151. Object.defineProperties(that.fn.prototype, {
  152. methods: { value: {}, enumerable: false, configurable: true, writable: true },
  153. inheritedMethods: { value: {}, enumerable: false, configurable: true, writable: true },
  154. klass: { value: that, enumerable: false, configurable: true, writable: true }
  155. });
  156. return that;
  157. };
  158. /* Smalltalk method object. To add a method to a class,
  159. use smalltalk.addMethod() */
  160. st.method = function(spec) {
  161. var that = new SmalltalkMethod();
  162. that.selector = spec.selector;
  163. that.jsSelector = spec.jsSelector;
  164. that.args = spec.args || {};
  165. that.category = spec.category;
  166. that.source = spec.source;
  167. that.messageSends = spec.messageSends || [];
  168. that.referencedClasses = spec.referencedClasses || [];
  169. that.fn = spec.fn;
  170. return that;
  171. };
  172. /* Initialize a class in its class hierarchy. Handle both class and
  173. metaclasses. */
  174. st.init = function(klass) {
  175. st.initClass(klass);
  176. if(klass.klass && !klass.meta) {
  177. st.initClass(klass.klass);
  178. }
  179. };
  180. st.initClass = function(klass) {
  181. var subclasses = st.subclasses(klass);
  182. var methods, prototype = klass.fn.prototype;
  183. if(klass.superclass && klass.superclass !== nil) {
  184. methods = st.methods(klass.superclass);
  185. //Methods linking
  186. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  187. var key = keys[i];
  188. if(!prototype.methods[key]) {
  189. prototype.inheritedMethods[key] = methods[key];
  190. Object.defineProperty(prototype, methods[key].jsSelector, {
  191. value: methods[key].fn, configurable: true, writable: true
  192. });
  193. }
  194. }
  195. }
  196. for(var i=0; i<subclasses.length; i++) {
  197. st.initClass(subclasses[i]);
  198. }
  199. };
  200. /* Answer all registered Packages as Array */
  201. st.packages.all = function() {
  202. var packages = [];
  203. for(var i in st.packages) {
  204. if (!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  205. packages.push(st.packages[i]);
  206. }
  207. return packages
  208. };
  209. /* Answer all registered Smalltalk classes */
  210. st.classes = function() {
  211. var classes = [], names = Object.keys(st), l = names.length;
  212. for (var i=0; i<l; i++) {
  213. var name = names[i];
  214. if (name.search(/^[A-Z]/) !== -1) {
  215. classes.push(st[name]);
  216. }
  217. }
  218. return classes;
  219. };
  220. /* Answer all methods (included inherited ones) of klass. */
  221. st.methods = function(klass) {
  222. var methods = {};
  223. inheritedMethods = klass.fn.prototype.inheritedMethods;
  224. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  225. methods[keys[i]] = inheritedMethods[keys[i]];
  226. }
  227. var inheritedMethods = klass.fn.prototype.methods;
  228. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  229. methods[keys[i]] = inheritedMethods[keys[i]];
  230. }
  231. return methods;
  232. };
  233. /* Answer the direct subclasses of klass. */
  234. st.subclasses = function(klass) {
  235. var subclasses = [];
  236. var classes = st.classes();
  237. for(var i=0; i < classes.length; i++) {
  238. var c = classes[i];
  239. if(c.fn) {
  240. //Classes
  241. if(c.superclass === klass) {
  242. subclasses.push(c);
  243. }
  244. c = c.klass;
  245. //Metaclasses
  246. if(c && c.superclass === klass) {
  247. subclasses.push(c);
  248. }
  249. }
  250. }
  251. return subclasses;
  252. };
  253. /* Create a new class wrapping a JavaScript constructor, and add it to the
  254. global smalltalk object. Package is lazily created if it does not exist with given name. */
  255. st.wrapClassName = function(className, pkgName, fn, superclass) {
  256. var pkg = st.addPackage(pkgName);
  257. st[className] = klass({
  258. className: className,
  259. superclass: superclass,
  260. pkg: pkg,
  261. fn: fn
  262. });
  263. };
  264. /* Create an alias for an existing class */
  265. st.alias = function(klass, alias) {
  266. st[alias] = klass;
  267. }
  268. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  269. If pkgName is null or empty we return nil, which is an allowed package for a class.
  270. If package already exists we still update the properties of it. */
  271. st.addPackage = function(pkgName, properties) {
  272. if(!pkgName) {return nil;}
  273. if(!(st.packages[pkgName])) {
  274. st.packages[pkgName] = pkg({
  275. pkgName: pkgName,
  276. properties: properties
  277. });
  278. } else {
  279. if(properties) {
  280. st.packages[pkgName].properties = properties;
  281. }
  282. }
  283. return st.packages[pkgName];
  284. };
  285. /* Add a class to the smalltalk object, creating a new one if needed.
  286. A Package is lazily created if it does not exist with given name. */
  287. st.addClass = function(className, superclass, iVarNames, pkgName) {
  288. var pkg = st.addPackage(pkgName);
  289. if(st[className]) {
  290. st[className].superclass = superclass;
  291. st[className].iVarNames = iVarNames;
  292. st[className].pkg = pkg || st[className].pkg;
  293. } else {
  294. st[className] = klass({
  295. className: className,
  296. superclass: superclass,
  297. pkg: pkg,
  298. iVarNames: iVarNames
  299. });
  300. }
  301. pkg.organization.addElement(st[className]);
  302. };
  303. st.removeClass = function(klass) {
  304. klass.pkg.organization.removeElement(klass);
  305. delete st[klass.className];
  306. };
  307. /* Add/remove a method to/from a class */
  308. st.addMethod = function(jsSelector, method, klass) {
  309. Object.defineProperty(klass.fn.prototype, jsSelector, {
  310. value: method.fn, configurable: true, writable: true
  311. });
  312. klass.fn.prototype.methods[method.selector] = method;
  313. method.methodClass = klass;
  314. method.jsSelector = jsSelector;
  315. klass.organization.addElement(method.category);
  316. };
  317. st.removeMethod = function(method) {
  318. var protocol = method.category;
  319. var klass = method.methodClass;
  320. var methods = klass.fn.prototype.methods;
  321. delete klass.fn.prototype[method.selector._asSelector()];
  322. delete methods[method.selector];
  323. var selectors = Object.keys(methods);
  324. var shouldDeleteProtocol = true;
  325. for(var i= 0, l = selectors.length; i<l; i++) {
  326. if(methods[selectors[i]].category === protocol) {
  327. shouldDeleteProtocol = false;
  328. break;
  329. };
  330. };
  331. if(shouldDeleteProtocol) {
  332. klass.organization.removeElement(protocol)
  333. };
  334. };
  335. /* Handles unhandled errors during message sends */
  336. st.send = function(receiver, selector, args, klass) {
  337. if(st.thisContext) {
  338. return withContextSend(receiver, selector, args, klass);
  339. } else {
  340. try {return withContextSend(receiver, selector, args, klass)}
  341. catch(error) {
  342. // Reset the context stack in any case
  343. st.thisContext = undefined;
  344. if(error.smalltalkError) {
  345. handleError(error);
  346. } else {
  347. throw(error);
  348. }
  349. }
  350. }
  351. };
  352. function withContextSend(receiver, selector, args, klass) {
  353. var call, method;
  354. if(receiver == null) {
  355. receiver = nil;
  356. }
  357. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  358. if(method) {
  359. var context = pushContext(receiver, selector, method, args);
  360. call = method.apply(receiver, args);
  361. popContext(context);
  362. return call;
  363. } else {
  364. return messageNotUnderstood(receiver, selector, args);
  365. }
  366. };
  367. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  368. (See the Smalltalk class ErrorHandler and its subclasses */
  369. function handleError(error) {
  370. if(!error.cc) {
  371. smalltalk.ErrorHandler._current()._handleError_(error);
  372. }
  373. };
  374. /* Handles #dnu: *and* JavaScript method calls.
  375. if the receiver has no klass, we consider it a JS object (outside of the
  376. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  377. function messageNotUnderstood(receiver, selector, args) {
  378. /* Handles JS method calls. */
  379. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  380. return callJavaScriptMethod(receiver, selector, args);
  381. }
  382. /* Handles not understood messages. Also see the Amber counter-part
  383. Object>>doesNotUnderstand: */
  384. return receiver._doesNotUnderstand_(
  385. st.Message._new()
  386. ._selector_(st.convertSelector(selector))
  387. ._arguments_(args)
  388. );
  389. };
  390. /* Call a method of a JS object, or answer a property if it exists.
  391. Else try wrapping a JSObjectProxy around the receiver.
  392. If the object property is a function, then call it, except if it starts with
  393. an uppercase character (we probably want to answer the function itself in this
  394. case and send it #new from Amber).
  395. Converts keyword-based selectors by using the first
  396. keyword only, but keeping all message arguments.
  397. Example:
  398. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  399. function callJavaScriptMethod(receiver, selector, args) {
  400. var jsSelector = selector._asJavaScriptSelector();
  401. var jsProperty = receiver[jsSelector];
  402. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  403. return jsProperty.apply(receiver, args);
  404. } else if(jsProperty !== undefined) {
  405. if(args[0]) {
  406. receiver[jsSelector] = args[0];
  407. return nil;
  408. } else {
  409. return jsProperty;
  410. }
  411. }
  412. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  413. };
  414. /* Reuse one old context stored in oldContext */
  415. st.oldContext = null;
  416. /* Handle thisContext pseudo variable */
  417. st.getThisContext = function() {
  418. if(st.thisContext) {
  419. return st.thisContext.copy();
  420. }
  421. };
  422. function pushContext(receiver, selector, method, temps) {
  423. var c = st.oldContext, tc = st.thisContext;
  424. if (!c) {
  425. return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, tc);
  426. }
  427. st.oldContext = null;
  428. c.homeContext = tc;
  429. c.pc = 1;
  430. c.receiver = receiver;
  431. c.selector = selector;
  432. c.method = method;
  433. c.temps = temps || {};
  434. return st.thisContext = c;
  435. };
  436. function popContext(context) {
  437. st.thisContext = context.homeContext;
  438. context.homeContext = undefined;
  439. st.oldContext = context;
  440. };
  441. /* Convert a string to a valid smalltalk selector.
  442. if you modify the following functions, also change String>>asSelector
  443. accordingly */
  444. st.convertSelector = function(selector) {
  445. if(selector.match(/__/)) {
  446. return convertBinarySelector(selector);
  447. } else {
  448. return convertKeywordSelector(selector);
  449. }
  450. };
  451. function convertKeywordSelector(selector) {
  452. return selector.replace(/^_/, '').replace(/_/g, ':');
  453. };
  454. function convertBinarySelector(selector) {
  455. return selector
  456. .replace(/^_/, '')
  457. .replace(/_plus/, '+')
  458. .replace(/_minus/, '-')
  459. .replace(/_star/, '*')
  460. .replace(/_slash/, '/')
  461. .replace(/_gt/, '>')
  462. .replace(/_lt/, '<')
  463. .replace(/_eq/, '=')
  464. .replace(/_comma/, ',')
  465. .replace(/_at/, '@')
  466. };
  467. /* Converts a JavaScript object to valid Smalltalk Object */
  468. st.readJSObject = function(js) {
  469. var object = js;
  470. var readObject = (js.constructor === Object);
  471. var readArray = (js.constructor === Array);
  472. if(readObject) {
  473. object = smalltalk.Dictionary._new();
  474. }
  475. for(var i in js) {
  476. if(readObject) {
  477. object._at_put_(i, st.readJSObject(js[i]));
  478. }
  479. if(readArray) {
  480. object[i] = st.readJSObject(js[i]);
  481. }
  482. }
  483. return object;
  484. };
  485. /* Boolean assertion */
  486. st.assert = function(shouldBeBoolean) {
  487. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  488. return shouldBeBoolean == true;
  489. } else {
  490. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  491. }
  492. }
  493. };
  494. function SmalltalkMethodContext(receiver, selector, method, temps, home) {
  495. this.receiver = receiver;
  496. this.selector = selector;
  497. this.method = method;
  498. this.temps = temps || {};
  499. this.homeContext = home;
  500. };
  501. SmalltalkMethodContext.prototype.copy = function() {
  502. var home = this.homeContext;
  503. if(home) {home = home.copy()}
  504. return new SmalltalkMethodContext(
  505. this.receiver,
  506. this.selector,
  507. this.method,
  508. this.temps,
  509. home
  510. );
  511. };
  512. SmalltalkMethodContext.prototype.resume = function() {
  513. //Brutally set the receiver as thisContext, then re-enter the function
  514. smalltalk.thisContext = this;
  515. return this.method.apply(receiver, temps);
  516. };
  517. /* Global Smalltalk objects. */
  518. var nil = new SmalltalkNil();
  519. var smalltalk = new Smalltalk();
  520. if(this.jQuery) {
  521. this.jQuery.allowJavaScriptCalls = true;
  522. }
  523. /****************************************************************************************/
  524. /* Base classes wrapping. If you edit this part, do not forget to set the superclass of the
  525. object metaclass to Class after the definition of Object */
  526. smalltalk.wrapClassName("Object", "Kernel", SmalltalkObject);
  527. smalltalk.wrapClassName("Smalltalk", "Kernel", Smalltalk, smalltalk.Object);
  528. smalltalk.wrapClassName("Package", "Kernel", SmalltalkPackage, smalltalk.Object);
  529. smalltalk.wrapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Object);
  530. smalltalk.wrapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
  531. smalltalk.wrapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
  532. smalltalk.wrapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
  533. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object);
  534. smalltalk.Object.klass.superclass = smalltalk.Class;
  535. smalltalk.wrapClassName("Number", "Kernel", Number, smalltalk.Object);
  536. smalltalk.wrapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  537. smalltalk.wrapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  538. smalltalk.wrapClassName("Date", "Kernel", Date, smalltalk.Object);
  539. smalltalk.wrapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object);
  540. smalltalk.wrapClassName("Collection", "Kernel", null, smalltalk.Object);
  541. smalltalk.wrapClassName("SequenceableCollection", "Kernel", null, smalltalk.Collection);
  542. smalltalk.wrapClassName("CharacterArray", "Kernel", null, smalltalk.SequenceableCollection);
  543. smalltalk.wrapClassName("String", "Kernel", String, smalltalk.CharacterArray);
  544. smalltalk.wrapClassName("Symbol", "Kernel", SmalltalkSymbol, smalltalk.CharacterArray);
  545. smalltalk.wrapClassName("Array", "Kernel", Array, smalltalk.SequenceableCollection);
  546. smalltalk.wrapClassName("RegularExpression", "Kernel", RegExp, smalltalk.String);
  547. smalltalk.wrapClassName("Error", "Kernel", Error, smalltalk.Object);
  548. smalltalk.wrapClassName("MethodContext", "Kernel", SmalltalkMethodContext, smalltalk.Object);
  549. /* Alias definitions */
  550. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  551. smalltalk.alias(smalltalk.Date, "Time");
  552. smalltalk.addPackage('Kernel-Objects', {});
  553. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  554. smalltalk.Object.comment="*Object is the root of the Smalltalk class system*. All classes in the system are subclasses of Object.\x0a\x0aObject provides default behavior common to all normal objects, such as: \x0a\x0a- access\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\x0aObject has no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `Object >> 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\x0aObjects 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 Overriding this message can be useful to implement proxies for example."
  555. smalltalk.addMethod(
  556. "__minus_gt",
  557. smalltalk.method({
  558. selector: "->",
  559. category: 'converting',
  560. fn: function (anObject) {
  561. var self = this;
  562. var $1;
  563. $1 = smalltalk.send(smalltalk.Association || Association, "_key_value_", [self, anObject]);
  564. return $1;
  565. },
  566. args: ["anObject"],
  567. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  568. messageSends: ["key:value:"],
  569. referencedClasses: ["Association"]
  570. }),
  571. smalltalk.Object);
  572. smalltalk.addMethod(
  573. "__eq",
  574. smalltalk.method({
  575. selector: "=",
  576. category: 'comparing',
  577. fn: function (anObject) {
  578. var self = this;
  579. var $1;
  580. $1 = smalltalk.send(self, "__eq_eq", [anObject]);
  581. return $1;
  582. },
  583. args: ["anObject"],
  584. source: "= anObject\x0a\x09^self == anObject",
  585. messageSends: ["=="],
  586. referencedClasses: []
  587. }),
  588. smalltalk.Object);
  589. smalltalk.addMethod(
  590. "__eq_eq",
  591. smalltalk.method({
  592. selector: "==",
  593. category: 'comparing',
  594. fn: function (anObject) {
  595. var self = this;
  596. var $1;
  597. $1 = smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  598. return $1;
  599. },
  600. args: ["anObject"],
  601. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  602. messageSends: ["=", "identityHash"],
  603. referencedClasses: []
  604. }),
  605. smalltalk.Object);
  606. smalltalk.addMethod(
  607. "_asJSON",
  608. smalltalk.method({
  609. selector: "asJSON",
  610. category: 'converting',
  611. fn: function () {
  612. var self = this;
  613. var variables;
  614. variables = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  615. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_allInstanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(variables, "_at_put_", [each, smalltalk.send(smalltalk.send(self, "_instVarAt_", [each]), "_asJSON", [])]);}]);
  616. return variables;
  617. },
  618. args: [],
  619. 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",
  620. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  621. referencedClasses: ["HashedCollection"]
  622. }),
  623. smalltalk.Object);
  624. smalltalk.addMethod(
  625. "_asJSONString",
  626. smalltalk.method({
  627. selector: "asJSONString",
  628. category: 'converting',
  629. fn: function () {
  630. var self = this;
  631. var $1;
  632. $1 = smalltalk.send(smalltalk.JSON || JSON, "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  633. return $1;
  634. },
  635. args: [],
  636. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  637. messageSends: ["stringify:", "asJSON"],
  638. referencedClasses: ["JSON"]
  639. }),
  640. smalltalk.Object);
  641. smalltalk.addMethod(
  642. "_asJavascript",
  643. smalltalk.method({
  644. selector: "asJavascript",
  645. category: 'converting',
  646. fn: function () {
  647. var self = this;
  648. var $1;
  649. $1 = smalltalk.send(self, "_asString", []);
  650. return $1;
  651. },
  652. args: [],
  653. source: "asJavascript\x0a\x09^self asString",
  654. messageSends: ["asString"],
  655. referencedClasses: []
  656. }),
  657. smalltalk.Object);
  658. smalltalk.addMethod(
  659. "_asString",
  660. smalltalk.method({
  661. selector: "asString",
  662. category: 'converting',
  663. fn: function () {
  664. var self = this;
  665. var $1;
  666. $1 = smalltalk.send(self, "_printString", []);
  667. return $1;
  668. },
  669. args: [],
  670. source: "asString\x0a\x09^self printString",
  671. messageSends: ["printString"],
  672. referencedClasses: []
  673. }),
  674. smalltalk.Object);
  675. smalltalk.addMethod(
  676. "_basicAt_",
  677. smalltalk.method({
  678. selector: "basicAt:",
  679. category: 'accessing',
  680. fn: function (aString) {
  681. var self = this;
  682. return self[aString];
  683. return self;
  684. },
  685. args: ["aString"],
  686. source: "basicAt: aString\x0a\x09<return self[aString]>",
  687. messageSends: [],
  688. referencedClasses: []
  689. }),
  690. smalltalk.Object);
  691. smalltalk.addMethod(
  692. "_basicAt_put_",
  693. smalltalk.method({
  694. selector: "basicAt:put:",
  695. category: 'accessing',
  696. fn: function (aString, anObject) {
  697. var self = this;
  698. return self[aString] = anObject;
  699. return self;
  700. },
  701. args: ["aString", "anObject"],
  702. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  703. messageSends: [],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Object);
  707. smalltalk.addMethod(
  708. "_basicDelete_",
  709. smalltalk.method({
  710. selector: "basicDelete:",
  711. category: 'accessing',
  712. fn: function (aString) {
  713. var self = this;
  714. delete self[aString];
  715. return aString;
  716. return self;
  717. },
  718. args: ["aString"],
  719. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  720. messageSends: [],
  721. referencedClasses: []
  722. }),
  723. smalltalk.Object);
  724. smalltalk.addMethod(
  725. "_basicPerform_",
  726. smalltalk.method({
  727. selector: "basicPerform:",
  728. category: 'message handling',
  729. fn: function (aSymbol) {
  730. var self = this;
  731. var $1;
  732. $1 = smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  733. return $1;
  734. },
  735. args: ["aSymbol"],
  736. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  737. messageSends: ["basicPerform:withArguments:"],
  738. referencedClasses: []
  739. }),
  740. smalltalk.Object);
  741. smalltalk.addMethod(
  742. "_basicPerform_withArguments_",
  743. smalltalk.method({
  744. selector: "basicPerform:withArguments:",
  745. category: 'message handling',
  746. fn: function (aSymbol, aCollection) {
  747. var self = this;
  748. return self[aSymbol].apply(self, aCollection);
  749. return self;
  750. },
  751. args: ["aSymbol", "aCollection"],
  752. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  753. messageSends: [],
  754. referencedClasses: []
  755. }),
  756. smalltalk.Object);
  757. smalltalk.addMethod(
  758. "_class",
  759. smalltalk.method({
  760. selector: "class",
  761. category: 'accessing',
  762. fn: function () {
  763. var self = this;
  764. return self.klass;
  765. return self;
  766. },
  767. args: [],
  768. source: "class\x0a\x09<return self.klass>",
  769. messageSends: [],
  770. referencedClasses: []
  771. }),
  772. smalltalk.Object);
  773. smalltalk.addMethod(
  774. "_copy",
  775. smalltalk.method({
  776. selector: "copy",
  777. category: 'copying',
  778. fn: function () {
  779. var self = this;
  780. var $1;
  781. $1 = smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  782. return $1;
  783. },
  784. args: [],
  785. source: "copy\x0a\x09^self shallowCopy postCopy",
  786. messageSends: ["postCopy", "shallowCopy"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.Object);
  790. smalltalk.addMethod(
  791. "_deepCopy",
  792. smalltalk.method({
  793. selector: "deepCopy",
  794. category: 'copying',
  795. fn: function () {
  796. var self = this;
  797. var copy = self.klass._new();
  798. for (var i in self) {
  799. if (/^@.+/.test(i)) {
  800. copy[i] = self[i]._deepCopy();
  801. }
  802. }
  803. return copy;
  804. return self;
  805. },
  806. args: [],
  807. source: "deepCopy\x0a\x09< \x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  808. messageSends: [],
  809. referencedClasses: []
  810. }),
  811. smalltalk.Object);
  812. smalltalk.addMethod(
  813. "_deprecatedAPI",
  814. smalltalk.method({
  815. selector: "deprecatedAPI",
  816. category: 'error handling',
  817. fn: function () {
  818. var self = this;
  819. smalltalk.send(console, "_warn_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.getThisContext(), "_home", []), "_asString", []), "__comma", [" is deprecated! (in "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.getThisContext(), "_home", []), "_home", []), "_asString", [])]), "__comma", [")"])]);
  820. return self;
  821. },
  822. args: [],
  823. 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, ')'",
  824. messageSends: ["warn:", ",", "asString", "home"],
  825. referencedClasses: []
  826. }),
  827. smalltalk.Object);
  828. smalltalk.addMethod(
  829. "_doesNotUnderstand_",
  830. smalltalk.method({
  831. selector: "doesNotUnderstand:",
  832. category: 'error handling',
  833. fn: function (aMessage) {
  834. var self = this;
  835. var $1, $2;
  836. $1 = smalltalk.send(smalltalk.MessageNotUnderstood || MessageNotUnderstood, "_new", []);
  837. smalltalk.send($1, "_receiver_", [self]);
  838. smalltalk.send($1, "_message_", [aMessage]);
  839. $2 = smalltalk.send($1, "_signal", []);
  840. return self;
  841. },
  842. args: ["aMessage"],
  843. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  844. messageSends: ["receiver:", "new", "message:", "signal"],
  845. referencedClasses: ["MessageNotUnderstood"]
  846. }),
  847. smalltalk.Object);
  848. smalltalk.addMethod(
  849. "_error_",
  850. smalltalk.method({
  851. selector: "error:",
  852. category: 'error handling',
  853. fn: function (aString) {
  854. var self = this;
  855. smalltalk.send(smalltalk.Error || Error, "_signal_", [aString]);
  856. return self;
  857. },
  858. args: ["aString"],
  859. source: "error: aString\x0a\x09Error signal: aString",
  860. messageSends: ["signal:"],
  861. referencedClasses: ["Error"]
  862. }),
  863. smalltalk.Object);
  864. smalltalk.addMethod(
  865. "_halt",
  866. smalltalk.method({
  867. selector: "halt",
  868. category: 'error handling',
  869. fn: function () {
  870. var self = this;
  871. smalltalk.send(self, "_error_", ["Halt encountered"]);
  872. return self;
  873. },
  874. args: [],
  875. source: "halt\x0a\x09self error: 'Halt encountered'",
  876. messageSends: ["error:"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.Object);
  880. smalltalk.addMethod(
  881. "_identityHash",
  882. smalltalk.method({
  883. selector: "identityHash",
  884. category: 'accessing',
  885. fn: function () {
  886. var self = this;
  887. var hash = self.identityHash;
  888. if (hash) {
  889. return hash;
  890. }
  891. hash = smalltalk.nextId();
  892. Object.defineProperty(self, "identityHash", {value: hash});
  893. return hash;
  894. return self;
  895. },
  896. args: [],
  897. 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>",
  898. messageSends: [],
  899. referencedClasses: []
  900. }),
  901. smalltalk.Object);
  902. smalltalk.addMethod(
  903. "_ifNil_",
  904. smalltalk.method({
  905. selector: "ifNil:",
  906. category: 'testing',
  907. fn: function (aBlock) {
  908. var self = this;
  909. return self;
  910. },
  911. args: ["aBlock"],
  912. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.Object);
  917. smalltalk.addMethod(
  918. "_ifNil_ifNotNil_",
  919. smalltalk.method({
  920. selector: "ifNil:ifNotNil:",
  921. category: 'testing',
  922. fn: function (aBlock, anotherBlock) {
  923. var self = this;
  924. var $1;
  925. $1 = smalltalk.send(anotherBlock, "_value", []);
  926. return $1;
  927. },
  928. args: ["aBlock", "anotherBlock"],
  929. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  930. messageSends: ["value"],
  931. referencedClasses: []
  932. }),
  933. smalltalk.Object);
  934. smalltalk.addMethod(
  935. "_ifNotNil_",
  936. smalltalk.method({
  937. selector: "ifNotNil:",
  938. category: 'testing',
  939. fn: function (aBlock) {
  940. var self = this;
  941. var $1;
  942. $1 = smalltalk.send(aBlock, "_value", []);
  943. return $1;
  944. },
  945. args: ["aBlock"],
  946. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  947. messageSends: ["value"],
  948. referencedClasses: []
  949. }),
  950. smalltalk.Object);
  951. smalltalk.addMethod(
  952. "_ifNotNil_ifNil_",
  953. smalltalk.method({
  954. selector: "ifNotNil:ifNil:",
  955. category: 'testing',
  956. fn: function (aBlock, anotherBlock) {
  957. var self = this;
  958. var $1;
  959. $1 = smalltalk.send(aBlock, "_value", []);
  960. return $1;
  961. },
  962. args: ["aBlock", "anotherBlock"],
  963. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  964. messageSends: ["value"],
  965. referencedClasses: []
  966. }),
  967. smalltalk.Object);
  968. smalltalk.addMethod(
  969. "_initialize",
  970. smalltalk.method({
  971. selector: "initialize",
  972. category: 'initialization',
  973. fn: function () {
  974. var self = this;
  975. return self;
  976. },
  977. args: [],
  978. source: "initialize",
  979. messageSends: [],
  980. referencedClasses: []
  981. }),
  982. smalltalk.Object);
  983. smalltalk.addMethod(
  984. "_instVarAt_",
  985. smalltalk.method({
  986. selector: "instVarAt:",
  987. category: 'accessing',
  988. fn: function (aSymbol) {
  989. var self = this;
  990. var varname;
  991. varname = smalltalk.send(aSymbol, "_asString", []);
  992. return self["@" + varname];
  993. return self;
  994. },
  995. args: ["aSymbol"],
  996. source: "instVarAt: aSymbol\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<return self['@'+varname]>",
  997. messageSends: ["asString"],
  998. referencedClasses: []
  999. }),
  1000. smalltalk.Object);
  1001. smalltalk.addMethod(
  1002. "_instVarAt_put_",
  1003. smalltalk.method({
  1004. selector: "instVarAt:put:",
  1005. category: 'accessing',
  1006. fn: function (aSymbol, anObject) {
  1007. var self = this;
  1008. var varname;
  1009. varname = smalltalk.send(aSymbol, "_asString", []);
  1010. self["@" + varname] = anObject;
  1011. return self;
  1012. },
  1013. args: ["aSymbol", "anObject"],
  1014. source: "instVarAt: aSymbol put: anObject\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<self['@' + varname] = anObject>",
  1015. messageSends: ["asString"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.Object);
  1019. smalltalk.addMethod(
  1020. "_isClass",
  1021. smalltalk.method({
  1022. selector: "isClass",
  1023. category: 'testing',
  1024. fn: function () {
  1025. var self = this;
  1026. return false;
  1027. },
  1028. args: [],
  1029. source: "isClass\x0a\x09^false",
  1030. messageSends: [],
  1031. referencedClasses: []
  1032. }),
  1033. smalltalk.Object);
  1034. smalltalk.addMethod(
  1035. "_isKindOf_",
  1036. smalltalk.method({
  1037. selector: "isKindOf:",
  1038. category: 'testing',
  1039. fn: function (aClass) {
  1040. var self = this;
  1041. var $2, $1;
  1042. $2 = smalltalk.send(self, "_isMemberOf_", [aClass]);
  1043. if (smalltalk.assert($2)) {
  1044. $1 = true;
  1045. } else {
  1046. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);
  1047. }
  1048. return $1;
  1049. },
  1050. args: ["aClass"],
  1051. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  1052. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1053. referencedClasses: []
  1054. }),
  1055. smalltalk.Object);
  1056. smalltalk.addMethod(
  1057. "_isMemberOf_",
  1058. smalltalk.method({
  1059. selector: "isMemberOf:",
  1060. category: 'testing',
  1061. fn: function (aClass) {
  1062. var self = this;
  1063. var $1;
  1064. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  1065. return $1;
  1066. },
  1067. args: ["aClass"],
  1068. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1069. messageSends: ["=", "class"],
  1070. referencedClasses: []
  1071. }),
  1072. smalltalk.Object);
  1073. smalltalk.addMethod(
  1074. "_isMetaclass",
  1075. smalltalk.method({
  1076. selector: "isMetaclass",
  1077. category: 'testing',
  1078. fn: function () {
  1079. var self = this;
  1080. return false;
  1081. },
  1082. args: [],
  1083. source: "isMetaclass\x0a\x09^false",
  1084. messageSends: [],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.Object);
  1088. smalltalk.addMethod(
  1089. "_isNil",
  1090. smalltalk.method({
  1091. selector: "isNil",
  1092. category: 'testing',
  1093. fn: function () {
  1094. var self = this;
  1095. return false;
  1096. },
  1097. args: [],
  1098. source: "isNil\x0a\x09^false",
  1099. messageSends: [],
  1100. referencedClasses: []
  1101. }),
  1102. smalltalk.Object);
  1103. smalltalk.addMethod(
  1104. "_isNumber",
  1105. smalltalk.method({
  1106. selector: "isNumber",
  1107. category: 'testing',
  1108. fn: function () {
  1109. var self = this;
  1110. return false;
  1111. },
  1112. args: [],
  1113. source: "isNumber\x0a\x09^false",
  1114. messageSends: [],
  1115. referencedClasses: []
  1116. }),
  1117. smalltalk.Object);
  1118. smalltalk.addMethod(
  1119. "_isParseFailure",
  1120. smalltalk.method({
  1121. selector: "isParseFailure",
  1122. category: 'testing',
  1123. fn: function () {
  1124. var self = this;
  1125. return false;
  1126. },
  1127. args: [],
  1128. source: "isParseFailure\x0a\x09^false",
  1129. messageSends: [],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.Object);
  1133. smalltalk.addMethod(
  1134. "_isString",
  1135. smalltalk.method({
  1136. selector: "isString",
  1137. category: 'testing',
  1138. fn: function () {
  1139. var self = this;
  1140. return false;
  1141. },
  1142. args: [],
  1143. source: "isString\x0a\x09^false",
  1144. messageSends: [],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.Object);
  1148. smalltalk.addMethod(
  1149. "_isSymbol",
  1150. smalltalk.method({
  1151. selector: "isSymbol",
  1152. category: 'testing',
  1153. fn: function () {
  1154. var self = this;
  1155. return false;
  1156. },
  1157. args: [],
  1158. source: "isSymbol\x0a\x09^false",
  1159. messageSends: [],
  1160. referencedClasses: []
  1161. }),
  1162. smalltalk.Object);
  1163. smalltalk.addMethod(
  1164. "_log_block_",
  1165. smalltalk.method({
  1166. selector: "log:block:",
  1167. category: 'printing',
  1168. fn: function (aString, aBlock) {
  1169. var self = this;
  1170. var result;
  1171. smalltalk.send(console, "_log_", [smalltalk.send(smalltalk.send(aString, "__comma", [" time: "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [function () {result = smalltalk.send(aBlock, "_value", []);return result;}]), "_printString", [])])]);
  1172. return result;
  1173. },
  1174. args: ["aString", "aBlock"],
  1175. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  1176. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  1177. referencedClasses: ["Date"]
  1178. }),
  1179. smalltalk.Object);
  1180. smalltalk.addMethod(
  1181. "_notNil",
  1182. smalltalk.method({
  1183. selector: "notNil",
  1184. category: 'testing',
  1185. fn: function () {
  1186. var self = this;
  1187. var $1;
  1188. $1 = smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  1189. return $1;
  1190. },
  1191. args: [],
  1192. source: "notNil\x0a\x09^self isNil not",
  1193. messageSends: ["not", "isNil"],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.Object);
  1197. smalltalk.addMethod(
  1198. "_perform_",
  1199. smalltalk.method({
  1200. selector: "perform:",
  1201. category: 'message handling',
  1202. fn: function (aSymbol) {
  1203. var self = this;
  1204. var $1;
  1205. $1 = smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  1206. return $1;
  1207. },
  1208. args: ["aSymbol"],
  1209. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  1210. messageSends: ["perform:withArguments:"],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.Object);
  1214. smalltalk.addMethod(
  1215. "_perform_withArguments_",
  1216. smalltalk.method({
  1217. selector: "perform:withArguments:",
  1218. category: 'message handling',
  1219. fn: function (aSymbol, aCollection) {
  1220. var self = this;
  1221. var selector;
  1222. selector = smalltalk.send(aSymbol, "_asSelector", []);
  1223. return smalltalk.send(self, selector, aCollection);
  1224. return self;
  1225. },
  1226. args: ["aSymbol", "aCollection"],
  1227. source: "perform: aSymbol withArguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSymbol asSelector.\x0a\x09<return smalltalk.send(self, selector, aCollection)>",
  1228. messageSends: ["asSelector"],
  1229. referencedClasses: []
  1230. }),
  1231. smalltalk.Object);
  1232. smalltalk.addMethod(
  1233. "_postCopy",
  1234. smalltalk.method({
  1235. selector: "postCopy",
  1236. category: 'copying',
  1237. fn: function () {
  1238. var self = this;
  1239. return self;
  1240. },
  1241. args: [],
  1242. source: "postCopy",
  1243. messageSends: [],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.Object);
  1247. smalltalk.addMethod(
  1248. "_printNl",
  1249. smalltalk.method({
  1250. selector: "printNl",
  1251. category: 'printing',
  1252. fn: function () {
  1253. var self = this;
  1254. console.log(self);
  1255. return self;
  1256. },
  1257. args: [],
  1258. source: "printNl\x0a\x09<console.log(self)>",
  1259. messageSends: [],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.Object);
  1263. smalltalk.addMethod(
  1264. "_printString",
  1265. smalltalk.method({
  1266. selector: "printString",
  1267. category: 'printing',
  1268. fn: function () {
  1269. var self = this;
  1270. var $1;
  1271. $1 = smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  1272. return $1;
  1273. },
  1274. args: [],
  1275. source: "printString\x0a\x09^'a ', self class name",
  1276. messageSends: [",", "name", "class"],
  1277. referencedClasses: []
  1278. }),
  1279. smalltalk.Object);
  1280. smalltalk.addMethod(
  1281. "_respondsTo_",
  1282. smalltalk.method({
  1283. selector: "respondsTo:",
  1284. category: 'testing',
  1285. fn: function (aSelector) {
  1286. var self = this;
  1287. var $1;
  1288. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  1289. return $1;
  1290. },
  1291. args: ["aSelector"],
  1292. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1293. messageSends: ["canUnderstand:", "class"],
  1294. referencedClasses: []
  1295. }),
  1296. smalltalk.Object);
  1297. smalltalk.addMethod(
  1298. "_shallowCopy",
  1299. smalltalk.method({
  1300. selector: "shallowCopy",
  1301. category: 'copying',
  1302. fn: function () {
  1303. var self = this;
  1304. var copy = self.klass._new();
  1305. for (var i in self) {
  1306. if (/^@.+/.test(i)) {
  1307. copy[i] = self[i];
  1308. }
  1309. }
  1310. return copy;
  1311. return self;
  1312. },
  1313. args: [],
  1314. source: "shallowCopy\x0a\x09<\x0a\x09 var copy = self.klass._new();\x0a\x09 for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09 copy[i] = self[i];\x0a\x09\x09}\x0a\x09 }\x0a\x09 return copy;\x0a\x09>",
  1315. messageSends: [],
  1316. referencedClasses: []
  1317. }),
  1318. smalltalk.Object);
  1319. smalltalk.addMethod(
  1320. "_shouldNotImplement",
  1321. smalltalk.method({
  1322. selector: "shouldNotImplement",
  1323. category: 'error handling',
  1324. fn: function () {
  1325. var self = this;
  1326. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  1327. return self;
  1328. },
  1329. args: [],
  1330. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1331. messageSends: ["error:", ",", "name", "class"],
  1332. referencedClasses: []
  1333. }),
  1334. smalltalk.Object);
  1335. smalltalk.addMethod(
  1336. "_size",
  1337. smalltalk.method({
  1338. selector: "size",
  1339. category: 'accessing',
  1340. fn: function () {
  1341. var self = this;
  1342. smalltalk.send(self, "_error_", ["Object not indexable"]);
  1343. return self;
  1344. },
  1345. args: [],
  1346. source: "size\x0a\x09self error: 'Object not indexable'",
  1347. messageSends: ["error:"],
  1348. referencedClasses: []
  1349. }),
  1350. smalltalk.Object);
  1351. smalltalk.addMethod(
  1352. "_storeOn_",
  1353. smalltalk.method({
  1354. selector: "storeOn:",
  1355. category: 'printing',
  1356. fn: function (aStream) {
  1357. var self = this;
  1358. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  1359. return self;
  1360. },
  1361. args: ["aStream"],
  1362. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1363. messageSends: ["nextPutAll:", "printString"],
  1364. referencedClasses: []
  1365. }),
  1366. smalltalk.Object);
  1367. smalltalk.addMethod(
  1368. "_storeString",
  1369. smalltalk.method({
  1370. selector: "storeString",
  1371. category: 'printing',
  1372. fn: function () {
  1373. var self = this;
  1374. var $1;
  1375. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (s) {return smalltalk.send(self, "_storeOn_", [s]);}]);
  1376. return $1;
  1377. },
  1378. args: [],
  1379. source: "storeString\x0a\x09\x22Answer a String representation of the receiver from which the receiver \x0a\x09can be reconstructed.\x22\x0a\x0a\x09^ String streamContents: [:s | self storeOn: s]",
  1380. messageSends: ["streamContents:", "storeOn:"],
  1381. referencedClasses: ["String"]
  1382. }),
  1383. smalltalk.Object);
  1384. smalltalk.addMethod(
  1385. "_subclassResponsibility",
  1386. smalltalk.method({
  1387. selector: "subclassResponsibility",
  1388. category: 'error handling',
  1389. fn: function () {
  1390. var self = this;
  1391. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  1392. return self;
  1393. },
  1394. args: [],
  1395. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1396. messageSends: ["error:"],
  1397. referencedClasses: []
  1398. }),
  1399. smalltalk.Object);
  1400. smalltalk.addMethod(
  1401. "_throw_",
  1402. smalltalk.method({
  1403. selector: "throw:",
  1404. category: 'error handling',
  1405. fn: function (anObject) {
  1406. var self = this;
  1407. throw anObject;
  1408. return self;
  1409. },
  1410. args: ["anObject"],
  1411. source: "throw: anObject\x0a\x09< throw anObject >",
  1412. messageSends: [],
  1413. referencedClasses: []
  1414. }),
  1415. smalltalk.Object);
  1416. smalltalk.addMethod(
  1417. "_try_catch_",
  1418. smalltalk.method({
  1419. selector: "try:catch:",
  1420. category: 'error handling',
  1421. fn: function (aBlock,anotherBlock){
  1422. var self=this;
  1423. try{return aBlock()} catch(e) {return anotherBlock(e)};
  1424. ;
  1425. return self},
  1426. args: ["aBlock", "anotherBlock"],
  1427. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock()} catch(e) {return anotherBlock(e)}>",
  1428. messageSends: [],
  1429. referencedClasses: []
  1430. }),
  1431. smalltalk.Object);
  1432. smalltalk.addMethod(
  1433. "_value",
  1434. smalltalk.method({
  1435. selector: "value",
  1436. category: 'accessing',
  1437. fn: function (){
  1438. var self=this;
  1439. return self.valueOf();
  1440. ;
  1441. return self},
  1442. args: [],
  1443. source: "value\x0a\x09<return self.valueOf()>",
  1444. messageSends: [],
  1445. referencedClasses: []
  1446. }),
  1447. smalltalk.Object);
  1448. smalltalk.addMethod(
  1449. "_yourself",
  1450. smalltalk.method({
  1451. selector: "yourself",
  1452. category: 'accessing',
  1453. fn: function (){
  1454. var self=this;
  1455. var $1;
  1456. $1=self;
  1457. return $1;
  1458. },
  1459. args: [],
  1460. source: "yourself\x0a\x09^ self",
  1461. messageSends: [],
  1462. referencedClasses: []
  1463. }),
  1464. smalltalk.Object);
  1465. smalltalk.addMethod(
  1466. "_~_eq",
  1467. smalltalk.method({
  1468. selector: "~=",
  1469. category: 'comparing',
  1470. fn: function (anObject) {
  1471. var self = this;
  1472. var $1;
  1473. $1 = smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  1474. return $1;
  1475. },
  1476. args: ["anObject"],
  1477. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1478. messageSends: ["="],
  1479. referencedClasses: []
  1480. }),
  1481. smalltalk.Object);
  1482. smalltalk.addMethod(
  1483. "_~~",
  1484. smalltalk.method({
  1485. selector: "~~",
  1486. category: 'comparing',
  1487. fn: function (anObject) {
  1488. var self = this;
  1489. var $1;
  1490. $1 = smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  1491. return $1;
  1492. },
  1493. args: ["anObject"],
  1494. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1495. messageSends: ["=", "=="],
  1496. referencedClasses: []
  1497. }),
  1498. smalltalk.Object);
  1499. smalltalk.addMethod(
  1500. "_initialize",
  1501. smalltalk.method({
  1502. selector: "initialize",
  1503. category: 'initialization',
  1504. fn: function () {
  1505. var self = this;
  1506. return self;
  1507. },
  1508. args: [],
  1509. source: "initialize\x0a\x09\x22no op\x22",
  1510. messageSends: [],
  1511. referencedClasses: []
  1512. }),
  1513. smalltalk.Object.klass);
  1514. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1515. smalltalk.Boolean.comment="Boolean wraps the JavaScript `Boolean()` constructor. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0aBoolean defines the protocol for logic testing operations and conditional control structures for the logical values.\x0aBoolean instances are weither `true` or `false`."
  1516. smalltalk.addMethod(
  1517. "_&",
  1518. smalltalk.method({
  1519. selector: "&",
  1520. category: 'controlling',
  1521. fn: function (aBoolean) {
  1522. var self = this;
  1523. if (self == true) {
  1524. return aBoolean;
  1525. } else {
  1526. return false;
  1527. }
  1528. return self;
  1529. },
  1530. args: ["aBoolean"],
  1531. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  1532. messageSends: [],
  1533. referencedClasses: []
  1534. }),
  1535. smalltalk.Boolean);
  1536. smalltalk.addMethod(
  1537. "__eq",
  1538. smalltalk.method({
  1539. selector: "=",
  1540. category: 'comparing',
  1541. fn: function (aBoolean) {
  1542. var self = this;
  1543. var $1;
  1544. $1 = smalltalk.send(smalltalk.send(aBoolean, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]);
  1545. if (!smalltalk.assert($1)) {
  1546. return false;
  1547. }
  1548. return Boolean(self == true) == aBoolean;
  1549. return self;
  1550. },
  1551. args: ["aBoolean"],
  1552. source: "= aBoolean\x0a\x09aBoolean class = self class ifFalse: [^false].\x0a\x09<return Boolean(self == true) == aBoolean>",
  1553. messageSends: ["ifFalse:", "=", "class"],
  1554. referencedClasses: []
  1555. }),
  1556. smalltalk.Boolean);
  1557. smalltalk.addMethod(
  1558. "__eq_eq",
  1559. smalltalk.method({
  1560. selector: "==",
  1561. category: 'comparing',
  1562. fn: function (aBoolean) {
  1563. var self = this;
  1564. var $1;
  1565. $1 = smalltalk.send(self, "__eq", [aBoolean]);
  1566. return $1;
  1567. },
  1568. args: ["aBoolean"],
  1569. source: "== aBoolean\x0a\x09^self = aBoolean",
  1570. messageSends: ["="],
  1571. referencedClasses: []
  1572. }),
  1573. smalltalk.Boolean);
  1574. smalltalk.addMethod(
  1575. "_and_",
  1576. smalltalk.method({
  1577. selector: "and:",
  1578. category: 'controlling',
  1579. fn: function (aBlock) {
  1580. var self = this;
  1581. var $2, $1;
  1582. $2 = smalltalk.send(self, "__eq", [true]);
  1583. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [aBlock, function () {return false;}]);
  1584. return $1;
  1585. },
  1586. args: ["aBlock"],
  1587. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  1588. messageSends: ["ifTrue:ifFalse:", "="],
  1589. referencedClasses: []
  1590. }),
  1591. smalltalk.Boolean);
  1592. smalltalk.addMethod(
  1593. "_asJSON",
  1594. smalltalk.method({
  1595. selector: "asJSON",
  1596. category: 'converting',
  1597. fn: function () {
  1598. var self = this;
  1599. return self;
  1600. },
  1601. args: [],
  1602. source: "asJSON\x0a\x09^self",
  1603. messageSends: [],
  1604. referencedClasses: []
  1605. }),
  1606. smalltalk.Boolean);
  1607. smalltalk.addMethod(
  1608. "_deepCopy",
  1609. smalltalk.method({
  1610. selector: "deepCopy",
  1611. category: 'copying',
  1612. fn: function () {
  1613. var self = this;
  1614. return self;
  1615. },
  1616. args: [],
  1617. source: "deepCopy\x0a\x09^self",
  1618. messageSends: [],
  1619. referencedClasses: []
  1620. }),
  1621. smalltalk.Boolean);
  1622. smalltalk.addMethod(
  1623. "_ifFalse_",
  1624. smalltalk.method({
  1625. selector: "ifFalse:",
  1626. category: 'controlling',
  1627. fn: function (aBlock) {
  1628. var self = this;
  1629. var $1;
  1630. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [function () {}, aBlock]);
  1631. return $1;
  1632. },
  1633. args: ["aBlock"],
  1634. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1635. messageSends: ["ifTrue:ifFalse:"],
  1636. referencedClasses: []
  1637. }),
  1638. smalltalk.Boolean);
  1639. smalltalk.addMethod(
  1640. "_ifFalse_ifTrue_",
  1641. smalltalk.method({
  1642. selector: "ifFalse:ifTrue:",
  1643. category: 'controlling',
  1644. fn: function (aBlock, anotherBlock) {
  1645. var self = this;
  1646. var $1;
  1647. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  1648. return $1;
  1649. },
  1650. args: ["aBlock", "anotherBlock"],
  1651. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1652. messageSends: ["ifTrue:ifFalse:"],
  1653. referencedClasses: []
  1654. }),
  1655. smalltalk.Boolean);
  1656. smalltalk.addMethod(
  1657. "_ifTrue_",
  1658. smalltalk.method({
  1659. selector: "ifTrue:",
  1660. category: 'controlling',
  1661. fn: function (aBlock) {
  1662. var self = this;
  1663. var $1;
  1664. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, function () {}]);
  1665. return $1;
  1666. },
  1667. args: ["aBlock"],
  1668. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1669. messageSends: ["ifTrue:ifFalse:"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.Boolean);
  1673. smalltalk.addMethod(
  1674. "_ifTrue_ifFalse_",
  1675. smalltalk.method({
  1676. selector: "ifTrue:ifFalse:",
  1677. category: 'controlling',
  1678. fn: function (aBlock, anotherBlock) {
  1679. var self = this;
  1680. if (self == true) {
  1681. return aBlock();
  1682. } else {
  1683. return anotherBlock();
  1684. }
  1685. return self;
  1686. },
  1687. args: ["aBlock", "anotherBlock"],
  1688. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBlock();\x0a\x09 } else {\x0a\x09\x09return anotherBlock();\x0a\x09 }\x0a\x09>",
  1689. messageSends: [],
  1690. referencedClasses: []
  1691. }),
  1692. smalltalk.Boolean);
  1693. smalltalk.addMethod(
  1694. "_not",
  1695. smalltalk.method({
  1696. selector: "not",
  1697. category: 'controlling',
  1698. fn: function () {
  1699. var self = this;
  1700. var $1;
  1701. $1 = smalltalk.send(self, "__eq", [false]);
  1702. return $1;
  1703. },
  1704. args: [],
  1705. source: "not\x0a\x09^self = false",
  1706. messageSends: ["="],
  1707. referencedClasses: []
  1708. }),
  1709. smalltalk.Boolean);
  1710. smalltalk.addMethod(
  1711. "_or_",
  1712. smalltalk.method({
  1713. selector: "or:",
  1714. category: 'controlling',
  1715. fn: function (aBlock) {
  1716. var self = this;
  1717. var $2, $1;
  1718. $2 = smalltalk.send(self, "__eq", [true]);
  1719. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [function () {return true;}, aBlock]);
  1720. return $1;
  1721. },
  1722. args: ["aBlock"],
  1723. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1724. messageSends: ["ifTrue:ifFalse:", "="],
  1725. referencedClasses: []
  1726. }),
  1727. smalltalk.Boolean);
  1728. smalltalk.addMethod(
  1729. "_printString",
  1730. smalltalk.method({
  1731. selector: "printString",
  1732. category: 'printing',
  1733. fn: function () {
  1734. var self = this;
  1735. return self.toString();
  1736. return self;
  1737. },
  1738. args: [],
  1739. source: "printString\x0a\x09<return self.toString()>",
  1740. messageSends: [],
  1741. referencedClasses: []
  1742. }),
  1743. smalltalk.Boolean);
  1744. smalltalk.addMethod(
  1745. "_shallowCopy",
  1746. smalltalk.method({
  1747. selector: "shallowCopy",
  1748. category: 'copying',
  1749. fn: function () {
  1750. var self = this;
  1751. return self;
  1752. },
  1753. args: [],
  1754. source: "shallowCopy\x0a\x09^self",
  1755. messageSends: [],
  1756. referencedClasses: []
  1757. }),
  1758. smalltalk.Boolean);
  1759. smalltalk.addMethod(
  1760. "_|",
  1761. smalltalk.method({
  1762. selector: "|",
  1763. category: 'controlling',
  1764. fn: function (aBoolean) {
  1765. var self = this;
  1766. if (self == true) {
  1767. return true;
  1768. } else {
  1769. return aBoolean;
  1770. }
  1771. return self;
  1772. },
  1773. args: ["aBoolean"],
  1774. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1775. messageSends: [],
  1776. referencedClasses: []
  1777. }),
  1778. smalltalk.Boolean);
  1779. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1780. smalltalk.Date.comment="The Date class is used to work with dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate wraps the `Date()` JavaScript constructor, and Smalltalk date objects are JavaScript date objects."
  1781. smalltalk.addMethod(
  1782. "__plus",
  1783. smalltalk.method({
  1784. selector: "+",
  1785. category: 'arithmetic',
  1786. fn: function (aDate) {
  1787. var self = this;
  1788. return self + aDate;
  1789. return self;
  1790. },
  1791. args: ["aDate"],
  1792. source: "+ aDate\x0a\x09<return self + aDate>",
  1793. messageSends: [],
  1794. referencedClasses: []
  1795. }),
  1796. smalltalk.Date);
  1797. smalltalk.addMethod(
  1798. "__minus",
  1799. smalltalk.method({
  1800. selector: "-",
  1801. category: 'arithmetic',
  1802. fn: function (aDate) {
  1803. var self = this;
  1804. return self - aDate;
  1805. return self;
  1806. },
  1807. args: ["aDate"],
  1808. source: "- aDate\x0a\x09<return self - aDate>",
  1809. messageSends: [],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.Date);
  1813. smalltalk.addMethod(
  1814. "__lt",
  1815. smalltalk.method({
  1816. selector: "<",
  1817. category: 'comparing',
  1818. fn: function (aDate) {
  1819. var self = this;
  1820. return self < aDate;
  1821. return self;
  1822. },
  1823. args: ["aDate"],
  1824. source: "< aDate\x0a\x09<return self < aDate>",
  1825. messageSends: [],
  1826. referencedClasses: []
  1827. }),
  1828. smalltalk.Date);
  1829. smalltalk.addMethod(
  1830. "__lt_eq",
  1831. smalltalk.method({
  1832. selector: "<=",
  1833. category: 'comparing',
  1834. fn: function (aDate) {
  1835. var self = this;
  1836. return self <= aDate;
  1837. return self;
  1838. },
  1839. args: ["aDate"],
  1840. source: "<= aDate\x0a\x09<return self <= aDate>",
  1841. messageSends: [],
  1842. referencedClasses: []
  1843. }),
  1844. smalltalk.Date);
  1845. smalltalk.addMethod(
  1846. "__gt",
  1847. smalltalk.method({
  1848. selector: ">",
  1849. category: 'comparing',
  1850. fn: function (aDate) {
  1851. var self = this;
  1852. return self > aDate;
  1853. return self;
  1854. },
  1855. args: ["aDate"],
  1856. source: "> aDate\x0a\x09<return self >> aDate>",
  1857. messageSends: [],
  1858. referencedClasses: []
  1859. }),
  1860. smalltalk.Date);
  1861. smalltalk.addMethod(
  1862. "__gt_eq",
  1863. smalltalk.method({
  1864. selector: ">=",
  1865. category: 'comparing',
  1866. fn: function (aDate) {
  1867. var self = this;
  1868. return self >= aDate;
  1869. return self;
  1870. },
  1871. args: ["aDate"],
  1872. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1873. messageSends: [],
  1874. referencedClasses: []
  1875. }),
  1876. smalltalk.Date);
  1877. smalltalk.addMethod(
  1878. "_asDateString",
  1879. smalltalk.method({
  1880. selector: "asDateString",
  1881. category: 'converting',
  1882. fn: function () {
  1883. var self = this;
  1884. return self.toDateString();
  1885. return self;
  1886. },
  1887. args: [],
  1888. source: "asDateString\x0a\x09<return self.toDateString()>",
  1889. messageSends: [],
  1890. referencedClasses: []
  1891. }),
  1892. smalltalk.Date);
  1893. smalltalk.addMethod(
  1894. "_asLocaleString",
  1895. smalltalk.method({
  1896. selector: "asLocaleString",
  1897. category: 'converting',
  1898. fn: function () {
  1899. var self = this;
  1900. return self.toLocaleString();
  1901. return self;
  1902. },
  1903. args: [],
  1904. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1905. messageSends: [],
  1906. referencedClasses: []
  1907. }),
  1908. smalltalk.Date);
  1909. smalltalk.addMethod(
  1910. "_asMilliseconds",
  1911. smalltalk.method({
  1912. selector: "asMilliseconds",
  1913. category: 'converting',
  1914. fn: function () {
  1915. var self = this;
  1916. var $1;
  1917. $1 = smalltalk.send(self, "_time", []);
  1918. return $1;
  1919. },
  1920. args: [],
  1921. source: "asMilliseconds\x0a\x09^self time",
  1922. messageSends: ["time"],
  1923. referencedClasses: []
  1924. }),
  1925. smalltalk.Date);
  1926. smalltalk.addMethod(
  1927. "_asNumber",
  1928. smalltalk.method({
  1929. selector: "asNumber",
  1930. category: 'converting',
  1931. fn: function () {
  1932. var self = this;
  1933. var $1;
  1934. $1 = smalltalk.send(self, "_asMilliseconds", []);
  1935. return $1;
  1936. },
  1937. args: [],
  1938. source: "asNumber\x0a\x09^self asMilliseconds",
  1939. messageSends: ["asMilliseconds"],
  1940. referencedClasses: []
  1941. }),
  1942. smalltalk.Date);
  1943. smalltalk.addMethod(
  1944. "_asString",
  1945. smalltalk.method({
  1946. selector: "asString",
  1947. category: 'converting',
  1948. fn: function () {
  1949. var self = this;
  1950. return self.toString();
  1951. return self;
  1952. },
  1953. args: [],
  1954. source: "asString\x0a\x09<return self.toString()>",
  1955. messageSends: [],
  1956. referencedClasses: []
  1957. }),
  1958. smalltalk.Date);
  1959. smalltalk.addMethod(
  1960. "_asTimeString",
  1961. smalltalk.method({
  1962. selector: "asTimeString",
  1963. category: 'converting',
  1964. fn: function () {
  1965. var self = this;
  1966. return self.toTimeString();
  1967. return self;
  1968. },
  1969. args: [],
  1970. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1971. messageSends: [],
  1972. referencedClasses: []
  1973. }),
  1974. smalltalk.Date);
  1975. smalltalk.addMethod(
  1976. "_day",
  1977. smalltalk.method({
  1978. selector: "day",
  1979. category: 'accessing',
  1980. fn: function () {
  1981. var self = this;
  1982. var $1;
  1983. $1 = smalltalk.send(self, "_dayOfWeek", []);
  1984. return $1;
  1985. },
  1986. args: [],
  1987. source: "day\x0a\x09^self dayOfWeek",
  1988. messageSends: ["dayOfWeek"],
  1989. referencedClasses: []
  1990. }),
  1991. smalltalk.Date);
  1992. smalltalk.addMethod(
  1993. "_day_",
  1994. smalltalk.method({
  1995. selector: "day:",
  1996. category: 'accessing',
  1997. fn: function (aNumber) {
  1998. var self = this;
  1999. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  2000. return self;
  2001. },
  2002. args: ["aNumber"],
  2003. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2004. messageSends: ["dayOfWeek:"],
  2005. referencedClasses: []
  2006. }),
  2007. smalltalk.Date);
  2008. smalltalk.addMethod(
  2009. "_dayOfMonth",
  2010. smalltalk.method({
  2011. selector: "dayOfMonth",
  2012. category: 'accessing',
  2013. fn: function () {
  2014. var self = this;
  2015. return self.getDate();
  2016. return self;
  2017. },
  2018. args: [],
  2019. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2020. messageSends: [],
  2021. referencedClasses: []
  2022. }),
  2023. smalltalk.Date);
  2024. smalltalk.addMethod(
  2025. "_dayOfMonth_",
  2026. smalltalk.method({
  2027. selector: "dayOfMonth:",
  2028. category: 'accessing',
  2029. fn: function (aNumber) {
  2030. var self = this;
  2031. self.setDate(aNumber);
  2032. return self;
  2033. },
  2034. args: ["aNumber"],
  2035. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2036. messageSends: [],
  2037. referencedClasses: []
  2038. }),
  2039. smalltalk.Date);
  2040. smalltalk.addMethod(
  2041. "_dayOfWeek",
  2042. smalltalk.method({
  2043. selector: "dayOfWeek",
  2044. category: 'accessing',
  2045. fn: function () {
  2046. var self = this;
  2047. return self.getDay() + 1;
  2048. return self;
  2049. },
  2050. args: [],
  2051. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2052. messageSends: [],
  2053. referencedClasses: []
  2054. }),
  2055. smalltalk.Date);
  2056. smalltalk.addMethod(
  2057. "_dayOfWeek_",
  2058. smalltalk.method({
  2059. selector: "dayOfWeek:",
  2060. category: 'accessing',
  2061. fn: function (aNumber) {
  2062. var self = this;
  2063. return self.setDay(aNumber - 1);
  2064. return self;
  2065. },
  2066. args: ["aNumber"],
  2067. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2068. messageSends: [],
  2069. referencedClasses: []
  2070. }),
  2071. smalltalk.Date);
  2072. smalltalk.addMethod(
  2073. "_hours",
  2074. smalltalk.method({
  2075. selector: "hours",
  2076. category: 'accessing',
  2077. fn: function () {
  2078. var self = this;
  2079. return self.getHours();
  2080. return self;
  2081. },
  2082. args: [],
  2083. source: "hours\x0a\x09<return self.getHours()>",
  2084. messageSends: [],
  2085. referencedClasses: []
  2086. }),
  2087. smalltalk.Date);
  2088. smalltalk.addMethod(
  2089. "_hours_",
  2090. smalltalk.method({
  2091. selector: "hours:",
  2092. category: 'accessing',
  2093. fn: function (aNumber) {
  2094. var self = this;
  2095. self.setHours(aNumber);
  2096. return self;
  2097. },
  2098. args: ["aNumber"],
  2099. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2100. messageSends: [],
  2101. referencedClasses: []
  2102. }),
  2103. smalltalk.Date);
  2104. smalltalk.addMethod(
  2105. "_milliseconds",
  2106. smalltalk.method({
  2107. selector: "milliseconds",
  2108. category: 'accessing',
  2109. fn: function () {
  2110. var self = this;
  2111. return self.getMilliseconds();
  2112. return self;
  2113. },
  2114. args: [],
  2115. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2116. messageSends: [],
  2117. referencedClasses: []
  2118. }),
  2119. smalltalk.Date);
  2120. smalltalk.addMethod(
  2121. "_milliseconds_",
  2122. smalltalk.method({
  2123. selector: "milliseconds:",
  2124. category: 'accessing',
  2125. fn: function (aNumber) {
  2126. var self = this;
  2127. self.setMilliseconds(aNumber);
  2128. return self;
  2129. },
  2130. args: ["aNumber"],
  2131. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2132. messageSends: [],
  2133. referencedClasses: []
  2134. }),
  2135. smalltalk.Date);
  2136. smalltalk.addMethod(
  2137. "_minutes",
  2138. smalltalk.method({
  2139. selector: "minutes",
  2140. category: 'accessing',
  2141. fn: function () {
  2142. var self = this;
  2143. return self.getMinutes();
  2144. return self;
  2145. },
  2146. args: [],
  2147. source: "minutes\x0a\x09<return self.getMinutes()>",
  2148. messageSends: [],
  2149. referencedClasses: []
  2150. }),
  2151. smalltalk.Date);
  2152. smalltalk.addMethod(
  2153. "_minutes_",
  2154. smalltalk.method({
  2155. selector: "minutes:",
  2156. category: 'accessing',
  2157. fn: function (aNumber) {
  2158. var self = this;
  2159. self.setMinutes(aNumber);
  2160. return self;
  2161. },
  2162. args: ["aNumber"],
  2163. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2164. messageSends: [],
  2165. referencedClasses: []
  2166. }),
  2167. smalltalk.Date);
  2168. smalltalk.addMethod(
  2169. "_month",
  2170. smalltalk.method({
  2171. selector: "month",
  2172. category: 'accessing',
  2173. fn: function () {
  2174. var self = this;
  2175. return self.getMonth() + 1;
  2176. return self;
  2177. },
  2178. args: [],
  2179. source: "month\x0a\x09<return self.getMonth() + 1>",
  2180. messageSends: [],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.Date);
  2184. smalltalk.addMethod(
  2185. "_month_",
  2186. smalltalk.method({
  2187. selector: "month:",
  2188. category: 'accessing',
  2189. fn: function (aNumber) {
  2190. var self = this;
  2191. self.setMonth(aNumber - 1);
  2192. return self;
  2193. },
  2194. args: ["aNumber"],
  2195. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2196. messageSends: [],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.Date);
  2200. smalltalk.addMethod(
  2201. "_printString",
  2202. smalltalk.method({
  2203. selector: "printString",
  2204. category: 'printing',
  2205. fn: function () {
  2206. var self = this;
  2207. var $1;
  2208. $1 = smalltalk.send(self, "_asString", []);
  2209. return $1;
  2210. },
  2211. args: [],
  2212. source: "printString\x0a\x09^self asString",
  2213. messageSends: ["asString"],
  2214. referencedClasses: []
  2215. }),
  2216. smalltalk.Date);
  2217. smalltalk.addMethod(
  2218. "_seconds",
  2219. smalltalk.method({
  2220. selector: "seconds",
  2221. category: 'accessing',
  2222. fn: function () {
  2223. var self = this;
  2224. return self.getSeconds();
  2225. return self;
  2226. },
  2227. args: [],
  2228. source: "seconds\x0a\x09<return self.getSeconds()>",
  2229. messageSends: [],
  2230. referencedClasses: []
  2231. }),
  2232. smalltalk.Date);
  2233. smalltalk.addMethod(
  2234. "_seconds_",
  2235. smalltalk.method({
  2236. selector: "seconds:",
  2237. category: 'accessing',
  2238. fn: function (aNumber) {
  2239. var self = this;
  2240. self.setSeconds(aNumber);
  2241. return self;
  2242. },
  2243. args: ["aNumber"],
  2244. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2245. messageSends: [],
  2246. referencedClasses: []
  2247. }),
  2248. smalltalk.Date);
  2249. smalltalk.addMethod(
  2250. "_time",
  2251. smalltalk.method({
  2252. selector: "time",
  2253. category: 'accessing',
  2254. fn: function () {
  2255. var self = this;
  2256. return self.getTime();
  2257. return self;
  2258. },
  2259. args: [],
  2260. source: "time\x0a\x09<return self.getTime()>",
  2261. messageSends: [],
  2262. referencedClasses: []
  2263. }),
  2264. smalltalk.Date);
  2265. smalltalk.addMethod(
  2266. "_time_",
  2267. smalltalk.method({
  2268. selector: "time:",
  2269. category: 'accessing',
  2270. fn: function (aNumber) {
  2271. var self = this;
  2272. self.setTime(aNumber);
  2273. return self;
  2274. },
  2275. args: ["aNumber"],
  2276. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2277. messageSends: [],
  2278. referencedClasses: []
  2279. }),
  2280. smalltalk.Date);
  2281. smalltalk.addMethod(
  2282. "_year",
  2283. smalltalk.method({
  2284. selector: "year",
  2285. category: 'accessing',
  2286. fn: function () {
  2287. var self = this;
  2288. return self.getFullYear();
  2289. return self;
  2290. },
  2291. args: [],
  2292. source: "year\x0a\x09<return self.getFullYear()>",
  2293. messageSends: [],
  2294. referencedClasses: []
  2295. }),
  2296. smalltalk.Date);
  2297. smalltalk.addMethod(
  2298. "_year_",
  2299. smalltalk.method({
  2300. selector: "year:",
  2301. category: 'accessing',
  2302. fn: function (aNumber) {
  2303. var self = this;
  2304. self.setFullYear(aNumber);
  2305. return self;
  2306. },
  2307. args: ["aNumber"],
  2308. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2309. messageSends: [],
  2310. referencedClasses: []
  2311. }),
  2312. smalltalk.Date);
  2313. smalltalk.addMethod(
  2314. "_fromMilliseconds_",
  2315. smalltalk.method({
  2316. selector: "fromMilliseconds:",
  2317. category: 'instance creation',
  2318. fn: function (aNumber) {
  2319. var self = this;
  2320. var $1;
  2321. $1 = smalltalk.send(self, "_new_", [aNumber]);
  2322. return $1;
  2323. },
  2324. args: ["aNumber"],
  2325. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2326. messageSends: ["new:"],
  2327. referencedClasses: []
  2328. }),
  2329. smalltalk.Date.klass);
  2330. smalltalk.addMethod(
  2331. "_fromSeconds_",
  2332. smalltalk.method({
  2333. selector: "fromSeconds:",
  2334. category: 'instance creation',
  2335. fn: function (aNumber) {
  2336. var self = this;
  2337. var $1;
  2338. $1 = smalltalk.send(self, "_fromMilliseconds_", [smalltalk.send(aNumber, "__star", [1000])]);
  2339. return $1;
  2340. },
  2341. args: ["aNumber"],
  2342. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2343. messageSends: ["fromMilliseconds:", "*"],
  2344. referencedClasses: []
  2345. }),
  2346. smalltalk.Date.klass);
  2347. smalltalk.addMethod(
  2348. "_fromString_",
  2349. smalltalk.method({
  2350. selector: "fromString:",
  2351. category: 'instance creation',
  2352. fn: function (aString) {
  2353. var self = this;
  2354. var $1;
  2355. $1 = smalltalk.send(self, "_new_", [aString]);
  2356. return $1;
  2357. },
  2358. args: ["aString"],
  2359. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2360. messageSends: ["new:"],
  2361. referencedClasses: []
  2362. }),
  2363. smalltalk.Date.klass);
  2364. smalltalk.addMethod(
  2365. "_millisecondsToRun_",
  2366. smalltalk.method({
  2367. selector: "millisecondsToRun:",
  2368. category: 'instance creation',
  2369. fn: function (aBlock) {
  2370. var self = this;
  2371. var $1;
  2372. var t;
  2373. t = smalltalk.send(smalltalk.Date || Date, "_now", []);
  2374. smalltalk.send(aBlock, "_value", []);
  2375. $1 = smalltalk.send(smalltalk.send(smalltalk.Date || Date, "_now", []), "__minus", [t]);
  2376. return $1;
  2377. },
  2378. args: ["aBlock"],
  2379. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2380. messageSends: ["now", "value", "-"],
  2381. referencedClasses: ["Date"]
  2382. }),
  2383. smalltalk.Date.klass);
  2384. smalltalk.addMethod(
  2385. "_new_",
  2386. smalltalk.method({
  2387. selector: "new:",
  2388. category: 'instance creation',
  2389. fn: function (anObject) {
  2390. var self = this;
  2391. return new Date(anObject);
  2392. return self;
  2393. },
  2394. args: ["anObject"],
  2395. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2396. messageSends: [],
  2397. referencedClasses: []
  2398. }),
  2399. smalltalk.Date.klass);
  2400. smalltalk.addMethod(
  2401. "_now",
  2402. smalltalk.method({
  2403. selector: "now",
  2404. category: 'instance creation',
  2405. fn: function () {
  2406. var self = this;
  2407. var $1;
  2408. $1 = smalltalk.send(self, "_today", []);
  2409. return $1;
  2410. },
  2411. args: [],
  2412. source: "now\x0a\x09^self today",
  2413. messageSends: ["today"],
  2414. referencedClasses: []
  2415. }),
  2416. smalltalk.Date.klass);
  2417. smalltalk.addMethod(
  2418. "_today",
  2419. smalltalk.method({
  2420. selector: "today",
  2421. category: 'instance creation',
  2422. fn: function () {
  2423. var self = this;
  2424. var $1;
  2425. $1 = smalltalk.send(self, "_new", []);
  2426. return $1;
  2427. },
  2428. args: [],
  2429. source: "today\x0a\x09^self new",
  2430. messageSends: ["new"],
  2431. referencedClasses: []
  2432. }),
  2433. smalltalk.Date.klass);
  2434. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2435. smalltalk.JSObjectProxy.comment="JSObjectProxy handles sending messages to JavaScript object, therefore accessing JavaScript objects from Amber is transparent.\x0aJSOjbectProxy makes intensive use of `#doesNotUnderstand:`.\x0a\x0a## Examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a window alert: 'hello world'.\x0a window inspect.\x0a (window jQuery: 'body') append: 'hello world'\x0a\x0aSmalltalk 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`."
  2436. smalltalk.addMethod(
  2437. "_at_",
  2438. smalltalk.method({
  2439. selector: "at:",
  2440. category: 'accessing',
  2441. fn: function (aSymbol) {
  2442. var self = this;
  2443. var attr;
  2444. attr = smalltalk.send(aSymbol, "_asString", []);
  2445. return self['@jsObject'][attr];
  2446. return self;
  2447. },
  2448. args: ["aSymbol"],
  2449. source: "at: aSymbol\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<return self['@jsObject'][attr]>",
  2450. messageSends: ["asString"],
  2451. referencedClasses: []
  2452. }),
  2453. smalltalk.JSObjectProxy);
  2454. smalltalk.addMethod(
  2455. "_at_put_",
  2456. smalltalk.method({
  2457. selector: "at:put:",
  2458. category: 'accessing',
  2459. fn: function (aSymbol, anObject) {
  2460. var self = this;
  2461. var attr;
  2462. attr = smalltalk.send(aSymbol, "_asString", []);
  2463. self['@jsObject'][attr] = anObject;
  2464. return self;
  2465. },
  2466. args: ["aSymbol", "anObject"],
  2467. source: "at: aSymbol put: anObject\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<self['@jsObject'][attr] = anObject>",
  2468. messageSends: ["asString"],
  2469. referencedClasses: []
  2470. }),
  2471. smalltalk.JSObjectProxy);
  2472. smalltalk.addMethod(
  2473. "_doesNotUnderstand_",
  2474. smalltalk.method({
  2475. selector: "doesNotUnderstand:",
  2476. category: 'proxy',
  2477. fn: function (aMessage){
  2478. var self=this;
  2479. var obj;
  2480. var selector;
  2481. var jsSelector;
  2482. var arguments;
  2483. obj=smalltalk.send(self,"_jsObject",[]);
  2484. selector=smalltalk.send(aMessage,"_selector",[]);
  2485. jsSelector=smalltalk.send(selector,"_asJavaScriptSelector",[]);
  2486. arguments=smalltalk.send(aMessage,"_arguments",[]);
  2487. if(jsSelector in obj) {return smalltalk.send(obj, jsSelector, arguments)};
  2488. ;
  2489. smalltalk.send(self,"_doesNotUnderstand_",[aMessage],smalltalk.Object);
  2490. return self},
  2491. args: ["aMessage"],
  2492. source: "doesNotUnderstand: aMessage\x0a\x09| obj selector jsSelector arguments |\x0a\x09obj := self jsObject.\x0a\x09selector := aMessage selector.\x0a\x09jsSelector := selector asJavaScriptSelector.\x0a\x09arguments := aMessage arguments.\x0a\x09<if(jsSelector in obj) {return smalltalk.send(obj, jsSelector, arguments)}>.\x0a\x09super doesNotUnderstand: aMessage",
  2493. messageSends: ["jsObject", "selector", "asJavaScriptSelector", "arguments", "doesNotUnderstand:"],
  2494. referencedClasses: []
  2495. }),
  2496. smalltalk.JSObjectProxy);
  2497. smalltalk.addMethod(
  2498. "_inspectOn_",
  2499. smalltalk.method({
  2500. selector: "inspectOn:",
  2501. category: 'proxy',
  2502. fn: function (anInspector) {
  2503. var self = this;
  2504. var variables;
  2505. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  2506. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  2507. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  2508. for (var i in self['@jsObject']) {
  2509. variables._at_put_(i, self['@jsObject'][i]);
  2510. }
  2511. smalltalk.send(anInspector, "_setVariables_", [variables]);
  2512. return self;
  2513. },
  2514. args: ["anInspector"],
  2515. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09<for(var i in self['@jsObject']) {\x0a\x09\x09variables._at_put_(i, self['@jsObject'][i]);\x0a\x09}>.\x0a\x09anInspector setVariables: variables",
  2516. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "setVariables:"],
  2517. referencedClasses: ["Dictionary"]
  2518. }),
  2519. smalltalk.JSObjectProxy);
  2520. smalltalk.addMethod(
  2521. "_jsObject",
  2522. smalltalk.method({
  2523. selector: "jsObject",
  2524. category: 'accessing',
  2525. fn: function () {
  2526. var self = this;
  2527. return self['@jsObject'];
  2528. },
  2529. args: [],
  2530. source: "jsObject\x0a\x09^jsObject",
  2531. messageSends: [],
  2532. referencedClasses: []
  2533. }),
  2534. smalltalk.JSObjectProxy);
  2535. smalltalk.addMethod(
  2536. "_jsObject_",
  2537. smalltalk.method({
  2538. selector: "jsObject:",
  2539. category: 'accessing',
  2540. fn: function (aJSObject) {
  2541. var self = this;
  2542. self['@jsObject'] = aJSObject;
  2543. return self;
  2544. },
  2545. args: ["aJSObject"],
  2546. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2547. messageSends: [],
  2548. referencedClasses: []
  2549. }),
  2550. smalltalk.JSObjectProxy);
  2551. smalltalk.addMethod(
  2552. "_printString",
  2553. smalltalk.method({
  2554. selector: "printString",
  2555. category: 'proxy',
  2556. fn: function () {
  2557. var self = this;
  2558. var $1;
  2559. $1 = smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  2560. return $1;
  2561. },
  2562. args: [],
  2563. source: "printString\x0a\x09^self jsObject toString",
  2564. messageSends: ["toString", "jsObject"],
  2565. referencedClasses: []
  2566. }),
  2567. smalltalk.JSObjectProxy);
  2568. smalltalk.addMethod(
  2569. "_on_",
  2570. smalltalk.method({
  2571. selector: "on:",
  2572. category: 'instance creation',
  2573. fn: function (aJSObject) {
  2574. var self = this;
  2575. var $2, $3, $1;
  2576. $2 = smalltalk.send(self, "_new", []);
  2577. smalltalk.send($2, "_jsObject_", [aJSObject]);
  2578. $3 = smalltalk.send($2, "_yourself", []);
  2579. $1 = $3;
  2580. return $1;
  2581. },
  2582. args: ["aJSObject"],
  2583. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2584. messageSends: ["jsObject:", "new", "yourself"],
  2585. referencedClasses: []
  2586. }),
  2587. smalltalk.JSObjectProxy.klass);
  2588. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2589. smalltalk.Number.comment="Number holds the most general methods for dealing with numbers. \x0aNumber is directly mapped to JavaScript Number.\x0a\x0aMost arithmetic methods like `#+` `#/` `#-` `#max:` are directly inlined into javascript. \x0a\x0a##Enumerating\x0aA Number can 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]."
  2590. smalltalk.addMethod(
  2591. "_&",
  2592. smalltalk.method({
  2593. selector: "&",
  2594. category: 'converting',
  2595. fn: function (aNumber) {
  2596. var self = this;
  2597. return self & aNumber;
  2598. return self;
  2599. },
  2600. args: ["aNumber"],
  2601. source: "& aNumber\x0a\x09<return self & aNumber>",
  2602. messageSends: [],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.Number);
  2606. smalltalk.addMethod(
  2607. "__star",
  2608. smalltalk.method({
  2609. selector: "*",
  2610. category: 'arithmetic',
  2611. fn: function (aNumber) {
  2612. var self = this;
  2613. return self * aNumber;
  2614. return self;
  2615. },
  2616. args: ["aNumber"],
  2617. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2618. messageSends: [],
  2619. referencedClasses: []
  2620. }),
  2621. smalltalk.Number);
  2622. smalltalk.addMethod(
  2623. "__plus",
  2624. smalltalk.method({
  2625. selector: "+",
  2626. category: 'arithmetic',
  2627. fn: function (aNumber) {
  2628. var self = this;
  2629. return self + aNumber;
  2630. return self;
  2631. },
  2632. args: ["aNumber"],
  2633. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2634. messageSends: [],
  2635. referencedClasses: []
  2636. }),
  2637. smalltalk.Number);
  2638. smalltalk.addMethod(
  2639. "__minus",
  2640. smalltalk.method({
  2641. selector: "-",
  2642. category: 'arithmetic',
  2643. fn: function (aNumber) {
  2644. var self = this;
  2645. return self - aNumber;
  2646. return self;
  2647. },
  2648. args: ["aNumber"],
  2649. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2650. messageSends: [],
  2651. referencedClasses: []
  2652. }),
  2653. smalltalk.Number);
  2654. smalltalk.addMethod(
  2655. "__slash",
  2656. smalltalk.method({
  2657. selector: "/",
  2658. category: 'arithmetic',
  2659. fn: function (aNumber) {
  2660. var self = this;
  2661. return self / aNumber;
  2662. return self;
  2663. },
  2664. args: ["aNumber"],
  2665. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2666. messageSends: [],
  2667. referencedClasses: []
  2668. }),
  2669. smalltalk.Number);
  2670. smalltalk.addMethod(
  2671. "__lt",
  2672. smalltalk.method({
  2673. selector: "<",
  2674. category: 'comparing',
  2675. fn: function (aNumber) {
  2676. var self = this;
  2677. return self < aNumber;
  2678. return self;
  2679. },
  2680. args: ["aNumber"],
  2681. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2682. messageSends: [],
  2683. referencedClasses: []
  2684. }),
  2685. smalltalk.Number);
  2686. smalltalk.addMethod(
  2687. "__lt_eq",
  2688. smalltalk.method({
  2689. selector: "<=",
  2690. category: 'comparing',
  2691. fn: function (aNumber) {
  2692. var self = this;
  2693. return self <= aNumber;
  2694. return self;
  2695. },
  2696. args: ["aNumber"],
  2697. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2698. messageSends: [],
  2699. referencedClasses: []
  2700. }),
  2701. smalltalk.Number);
  2702. smalltalk.addMethod(
  2703. "__eq",
  2704. smalltalk.method({
  2705. selector: "=",
  2706. category: 'comparing',
  2707. fn: function (aNumber) {
  2708. var self = this;
  2709. var $1;
  2710. $1 = smalltalk.send(aNumber, "_isNumber", []);
  2711. if (!smalltalk.assert($1)) {
  2712. return false;
  2713. }
  2714. return Number(self) == aNumber;
  2715. return self;
  2716. },
  2717. args: ["aNumber"],
  2718. source: "= aNumber\x0a\x09aNumber isNumber ifFalse: [^false]. \x0a\x09<return Number(self) == aNumber>",
  2719. messageSends: ["ifFalse:", "isNumber"],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.Number);
  2723. smalltalk.addMethod(
  2724. "__gt",
  2725. smalltalk.method({
  2726. selector: ">",
  2727. category: 'comparing',
  2728. fn: function (aNumber) {
  2729. var self = this;
  2730. return self > aNumber;
  2731. return self;
  2732. },
  2733. args: ["aNumber"],
  2734. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2735. messageSends: [],
  2736. referencedClasses: []
  2737. }),
  2738. smalltalk.Number);
  2739. smalltalk.addMethod(
  2740. "__gt_eq",
  2741. smalltalk.method({
  2742. selector: ">=",
  2743. category: 'comparing',
  2744. fn: function (aNumber) {
  2745. var self = this;
  2746. return self >= aNumber;
  2747. return self;
  2748. },
  2749. args: ["aNumber"],
  2750. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2751. messageSends: [],
  2752. referencedClasses: []
  2753. }),
  2754. smalltalk.Number);
  2755. smalltalk.addMethod(
  2756. "__at",
  2757. smalltalk.method({
  2758. selector: "@",
  2759. category: 'converting',
  2760. fn: function (aNumber) {
  2761. var self = this;
  2762. var $1;
  2763. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, aNumber]);
  2764. return $1;
  2765. },
  2766. args: ["aNumber"],
  2767. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2768. messageSends: ["x:y:"],
  2769. referencedClasses: ["Point"]
  2770. }),
  2771. smalltalk.Number);
  2772. smalltalk.addMethod(
  2773. "_\x5c\x5c",
  2774. smalltalk.method({
  2775. selector: "\x5c\x5c",
  2776. category: 'arithmetic',
  2777. fn: function (aNumber) {
  2778. var self = this;
  2779. return self % aNumber;
  2780. return self;
  2781. },
  2782. args: ["aNumber"],
  2783. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2784. messageSends: [],
  2785. referencedClasses: []
  2786. }),
  2787. smalltalk.Number);
  2788. smalltalk.addMethod(
  2789. "_abs",
  2790. smalltalk.method({
  2791. selector: "abs",
  2792. category: 'arithmetic',
  2793. fn: function () {
  2794. var self = this;
  2795. var $1;
  2796. $1 = Math.abs(self);
  2797. return $1;
  2798. },
  2799. args: [],
  2800. source: "abs\x0a\x09^ <Math.abs(self);>",
  2801. messageSends: [],
  2802. referencedClasses: []
  2803. }),
  2804. smalltalk.Number);
  2805. smalltalk.addMethod(
  2806. "_asJSON",
  2807. smalltalk.method({
  2808. selector: "asJSON",
  2809. category: 'converting',
  2810. fn: function () {
  2811. var self = this;
  2812. return self;
  2813. },
  2814. args: [],
  2815. source: "asJSON\x0a\x09^self",
  2816. messageSends: [],
  2817. referencedClasses: []
  2818. }),
  2819. smalltalk.Number);
  2820. smalltalk.addMethod(
  2821. "_asJavascript",
  2822. smalltalk.method({
  2823. selector: "asJavascript",
  2824. category: 'converting',
  2825. fn: function () {
  2826. var self = this;
  2827. var $1;
  2828. $1 = smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  2829. return $1;
  2830. },
  2831. args: [],
  2832. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2833. messageSends: [",", "printString"],
  2834. referencedClasses: []
  2835. }),
  2836. smalltalk.Number);
  2837. smalltalk.addMethod(
  2838. "_asPoint",
  2839. smalltalk.method({
  2840. selector: "asPoint",
  2841. category: 'converting',
  2842. fn: function () {
  2843. var self = this;
  2844. var $1;
  2845. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, self]);
  2846. return $1;
  2847. },
  2848. args: [],
  2849. source: "asPoint\x0a\x09^Point x: self y: self",
  2850. messageSends: ["x:y:"],
  2851. referencedClasses: ["Point"]
  2852. }),
  2853. smalltalk.Number);
  2854. smalltalk.addMethod(
  2855. "_asString",
  2856. smalltalk.method({
  2857. selector: "asString",
  2858. category: 'converting',
  2859. fn: function () {
  2860. var self = this;
  2861. var $1;
  2862. $1 = smalltalk.send(self, "_printString", []);
  2863. return $1;
  2864. },
  2865. args: [],
  2866. source: "asString\x0a\x09^self printString",
  2867. messageSends: ["printString"],
  2868. referencedClasses: []
  2869. }),
  2870. smalltalk.Number);
  2871. smalltalk.addMethod(
  2872. "_atRandom",
  2873. smalltalk.method({
  2874. selector: "atRandom",
  2875. category: 'converting',
  2876. fn: function () {
  2877. var self = this;
  2878. var $1;
  2879. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Random || Random, "_new", []), "_next", []), "__star", [self]), "_truncated", []), "__plus", [1]);
  2880. return $1;
  2881. },
  2882. args: [],
  2883. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  2884. messageSends: ["+", "truncated", "*", "next", "new"],
  2885. referencedClasses: ["Random"]
  2886. }),
  2887. smalltalk.Number);
  2888. smalltalk.addMethod(
  2889. "_copy",
  2890. smalltalk.method({
  2891. selector: "copy",
  2892. category: 'copying',
  2893. fn: function () {
  2894. var self = this;
  2895. return self;
  2896. },
  2897. args: [],
  2898. source: "copy\x0a\x09^self",
  2899. messageSends: [],
  2900. referencedClasses: []
  2901. }),
  2902. smalltalk.Number);
  2903. smalltalk.addMethod(
  2904. "_deepCopy",
  2905. smalltalk.method({
  2906. selector: "deepCopy",
  2907. category: 'copying',
  2908. fn: function () {
  2909. var self = this;
  2910. var $1;
  2911. $1 = smalltalk.send(self, "_copy", []);
  2912. return $1;
  2913. },
  2914. args: [],
  2915. source: "deepCopy\x0a\x09^self copy",
  2916. messageSends: ["copy"],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.Number);
  2920. smalltalk.addMethod(
  2921. "_even",
  2922. smalltalk.method({
  2923. selector: "even",
  2924. category: 'testing',
  2925. fn: function () {
  2926. var self = this;
  2927. var $1;
  2928. $1 = smalltalk.send(0, "__eq", [smalltalk.send(self, "_\\\\", [2])]);
  2929. return $1;
  2930. },
  2931. args: [],
  2932. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2933. messageSends: ["=", "\x5c\x5c\x5c\x5c"],
  2934. referencedClasses: []
  2935. }),
  2936. smalltalk.Number);
  2937. smalltalk.addMethod(
  2938. "_identityHash",
  2939. smalltalk.method({
  2940. selector: "identityHash",
  2941. category: 'accessing',
  2942. fn: function () {
  2943. var self = this;
  2944. var $1;
  2945. $1 = smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  2946. return $1;
  2947. },
  2948. args: [],
  2949. source: "identityHash\x0a\x09^self asString, 'n'",
  2950. messageSends: [",", "asString"],
  2951. referencedClasses: []
  2952. }),
  2953. smalltalk.Number);
  2954. smalltalk.addMethod(
  2955. "_isNumber",
  2956. smalltalk.method({
  2957. selector: "isNumber",
  2958. category: 'testing',
  2959. fn: function () {
  2960. var self = this;
  2961. return true;
  2962. },
  2963. args: [],
  2964. source: "isNumber\x0a\x09^true",
  2965. messageSends: [],
  2966. referencedClasses: []
  2967. }),
  2968. smalltalk.Number);
  2969. smalltalk.addMethod(
  2970. "_isZero",
  2971. smalltalk.method({
  2972. selector: "isZero",
  2973. category: 'testing',
  2974. fn: function () {
  2975. var self = this;
  2976. var $1;
  2977. $1 = smalltalk.send(self, "__eq", [0]);
  2978. return $1;
  2979. },
  2980. args: [],
  2981. source: "isZero\x0a\x09^self = 0",
  2982. messageSends: ["="],
  2983. referencedClasses: []
  2984. }),
  2985. smalltalk.Number);
  2986. smalltalk.addMethod(
  2987. "_max_",
  2988. smalltalk.method({
  2989. selector: "max:",
  2990. category: 'arithmetic',
  2991. fn: function (aNumber) {
  2992. var self = this;
  2993. return Math.max(self, aNumber);
  2994. return self;
  2995. },
  2996. args: ["aNumber"],
  2997. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  2998. messageSends: [],
  2999. referencedClasses: []
  3000. }),
  3001. smalltalk.Number);
  3002. smalltalk.addMethod(
  3003. "_min_",
  3004. smalltalk.method({
  3005. selector: "min:",
  3006. category: 'arithmetic',
  3007. fn: function (aNumber) {
  3008. var self = this;
  3009. return Math.min(self, aNumber);
  3010. return self;
  3011. },
  3012. args: ["aNumber"],
  3013. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3014. messageSends: [],
  3015. referencedClasses: []
  3016. }),
  3017. smalltalk.Number);
  3018. smalltalk.addMethod(
  3019. "_negated",
  3020. smalltalk.method({
  3021. selector: "negated",
  3022. category: 'arithmetic',
  3023. fn: function () {
  3024. var self = this;
  3025. var $1;
  3026. $1 = smalltalk.send(0, "__minus", [self]);
  3027. return $1;
  3028. },
  3029. args: [],
  3030. source: "negated\x0a\x09^0 - self",
  3031. messageSends: ["-"],
  3032. referencedClasses: []
  3033. }),
  3034. smalltalk.Number);
  3035. smalltalk.addMethod(
  3036. "_negative",
  3037. smalltalk.method({
  3038. selector: "negative",
  3039. category: 'testing',
  3040. fn: function () {
  3041. var self = this;
  3042. var $1;
  3043. $1 = smalltalk.send(self, "__lt", [0]);
  3044. return $1;
  3045. },
  3046. args: [],
  3047. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3048. messageSends: ["<"],
  3049. referencedClasses: []
  3050. }),
  3051. smalltalk.Number);
  3052. smalltalk.addMethod(
  3053. "_odd",
  3054. smalltalk.method({
  3055. selector: "odd",
  3056. category: 'testing',
  3057. fn: function () {
  3058. var self = this;
  3059. var $1;
  3060. $1 = smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  3061. return $1;
  3062. },
  3063. args: [],
  3064. source: "odd\x0a\x09^ self even not",
  3065. messageSends: ["not", "even"],
  3066. referencedClasses: []
  3067. }),
  3068. smalltalk.Number);
  3069. smalltalk.addMethod(
  3070. "_positive",
  3071. smalltalk.method({
  3072. selector: "positive",
  3073. category: 'testing',
  3074. fn: function () {
  3075. var self = this;
  3076. var $1;
  3077. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3078. return $1;
  3079. },
  3080. args: [],
  3081. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3082. messageSends: [">="],
  3083. referencedClasses: []
  3084. }),
  3085. smalltalk.Number);
  3086. smalltalk.addMethod(
  3087. "_printShowingDecimalPlaces_",
  3088. smalltalk.method({
  3089. selector: "printShowingDecimalPlaces:",
  3090. category: 'printing',
  3091. fn: function (placesDesired) {
  3092. var self = this;
  3093. return self.toFixed(placesDesired);
  3094. return self;
  3095. },
  3096. args: ["placesDesired"],
  3097. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3098. messageSends: [],
  3099. referencedClasses: []
  3100. }),
  3101. smalltalk.Number);
  3102. smalltalk.addMethod(
  3103. "_printString",
  3104. smalltalk.method({
  3105. selector: "printString",
  3106. category: 'printing',
  3107. fn: function () {
  3108. var self = this;
  3109. return String(self);
  3110. return self;
  3111. },
  3112. args: [],
  3113. source: "printString\x0a\x09<return String(self)>",
  3114. messageSends: [],
  3115. referencedClasses: []
  3116. }),
  3117. smalltalk.Number);
  3118. smalltalk.addMethod(
  3119. "_rounded",
  3120. smalltalk.method({
  3121. selector: "rounded",
  3122. category: 'converting',
  3123. fn: function () {
  3124. var self = this;
  3125. return Math.round(self);
  3126. return self;
  3127. },
  3128. args: [],
  3129. source: "rounded\x0a\x09<return Math.round(self);>",
  3130. messageSends: [],
  3131. referencedClasses: []
  3132. }),
  3133. smalltalk.Number);
  3134. smalltalk.addMethod(
  3135. "_sqrt",
  3136. smalltalk.method({
  3137. selector: "sqrt",
  3138. category: 'arithmetic',
  3139. fn: function () {
  3140. var self = this;
  3141. return Math.sqrt(self);
  3142. return self;
  3143. },
  3144. args: [],
  3145. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3146. messageSends: [],
  3147. referencedClasses: []
  3148. }),
  3149. smalltalk.Number);
  3150. smalltalk.addMethod(
  3151. "_squared",
  3152. smalltalk.method({
  3153. selector: "squared",
  3154. category: 'arithmetic',
  3155. fn: function () {
  3156. var self = this;
  3157. var $1;
  3158. $1 = smalltalk.send(self, "__star", [self]);
  3159. return $1;
  3160. },
  3161. args: [],
  3162. source: "squared\x0a\x09^self * self",
  3163. messageSends: ["*"],
  3164. referencedClasses: []
  3165. }),
  3166. smalltalk.Number);
  3167. smalltalk.addMethod(
  3168. "_timesRepeat_",
  3169. smalltalk.method({
  3170. selector: "timesRepeat:",
  3171. category: 'enumerating',
  3172. fn: function (aBlock){
  3173. var self=this;
  3174. var count;
  3175. count=(1);
  3176. smalltalk.send((function(){
  3177. return smalltalk.send(count,"__gt",[self]);
  3178. }),"_whileFalse_",[(function(){
  3179. smalltalk.send(aBlock,"_value",[]);
  3180. count=smalltalk.send(count,"__plus",[(1)]);
  3181. return count;
  3182. })]);
  3183. return self},
  3184. args: ["aBlock"],
  3185. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  3186. messageSends: ["whileFalse:", "value", "+", ">"],
  3187. referencedClasses: []
  3188. }),
  3189. smalltalk.Number);
  3190. smalltalk.addMethod(
  3191. "_to_",
  3192. smalltalk.method({
  3193. selector: "to:",
  3194. category: 'converting',
  3195. fn: function (aNumber) {
  3196. var self = this;
  3197. var array;
  3198. var first;
  3199. var last;
  3200. var count;
  3201. first = smalltalk.send(self, "_truncated", []);
  3202. last = smalltalk.send(smalltalk.send(aNumber, "_truncated", []), "__plus", [1]);
  3203. count = 1;
  3204. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3205. smalltalk.send(smalltalk.send(last, "__minus", [first]), "_timesRepeat_", [function () {smalltalk.send(array, "_at_put_", [count, first]);count = smalltalk.send(count, "__plus", [1]);count;first = smalltalk.send(first, "__plus", [1]);return first;}]);
  3206. return array;
  3207. },
  3208. args: ["aNumber"],
  3209. 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 array at: count put: first.\x0a\x09 count := count + 1.\x0a\x09 first := first + 1].\x0a\x09^array",
  3210. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  3211. referencedClasses: ["Array"]
  3212. }),
  3213. smalltalk.Number);
  3214. smalltalk.addMethod(
  3215. "_to_by_",
  3216. smalltalk.method({
  3217. selector: "to:by:",
  3218. category: 'converting',
  3219. fn: function (stop, step) {
  3220. var self = this;
  3221. var $1, $2;
  3222. var array;
  3223. var value;
  3224. var pos;
  3225. value = self;
  3226. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3227. pos = 1;
  3228. $1 = smalltalk.send(step, "__eq", [0]);
  3229. if (smalltalk.assert($1)) {
  3230. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3231. }
  3232. $2 = smalltalk.send(step, "__lt", [0]);
  3233. if (smalltalk.assert($2)) {
  3234. smalltalk.send(function () {return smalltalk.send(value, "__gt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(array, "_at_put_", [pos, value]);pos = smalltalk.send(pos, "__plus", [1]);pos;value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3235. } else {
  3236. smalltalk.send(function () {return smalltalk.send(value, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(array, "_at_put_", [pos, value]);pos = smalltalk.send(pos, "__plus", [1]);pos;value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3237. }
  3238. return array;
  3239. },
  3240. args: ["stop", "step"],
  3241. 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\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09array at: pos put: value.\x0a\x09 \x09\x09\x09pos := pos + 1.\x0a\x09 \x09\x09\x09value := value + step]].\x0a\x09^array",
  3242. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  3243. referencedClasses: ["Array"]
  3244. }),
  3245. smalltalk.Number);
  3246. smalltalk.addMethod(
  3247. "_to_by_do_",
  3248. smalltalk.method({
  3249. selector: "to:by:do:",
  3250. category: 'enumerating',
  3251. fn: function (stop, step, aBlock) {
  3252. var self = this;
  3253. var $1, $2;
  3254. var value;
  3255. value = self;
  3256. $1 = smalltalk.send(step, "__eq", [0]);
  3257. if (smalltalk.assert($1)) {
  3258. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3259. }
  3260. $2 = smalltalk.send(step, "__lt", [0]);
  3261. if (smalltalk.assert($2)) {
  3262. smalltalk.send(function () {return smalltalk.send(value, "__gt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [value]);value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3263. } else {
  3264. smalltalk.send(function () {return smalltalk.send(value, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [value]);value = smalltalk.send(value, "__plus", [step]);return value;}]);
  3265. }
  3266. return self;
  3267. },
  3268. args: ["stop", "step", "aBlock"],
  3269. 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\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09 \x09\x09\x09aBlock value: value.\x0a\x09 \x09\x09\x09value := value + step]]",
  3270. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  3271. referencedClasses: []
  3272. }),
  3273. smalltalk.Number);
  3274. smalltalk.addMethod(
  3275. "_to_do_",
  3276. smalltalk.method({
  3277. selector: "to:do:",
  3278. category: 'enumerating',
  3279. fn: function (stop, aBlock) {
  3280. var self = this;
  3281. var nextValue;
  3282. nextValue = self;
  3283. smalltalk.send(function () {return smalltalk.send(nextValue, "__lt_eq", [stop]);}, "_whileTrue_", [function () {smalltalk.send(aBlock, "_value_", [nextValue]);nextValue = smalltalk.send(nextValue, "__plus", [1]);return nextValue;}]);
  3284. return self;
  3285. },
  3286. args: ["stop", "aBlock"],
  3287. 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]",
  3288. messageSends: ["whileTrue:", "value:", "+", "<="],
  3289. referencedClasses: []
  3290. }),
  3291. smalltalk.Number);
  3292. smalltalk.addMethod(
  3293. "_truncated",
  3294. smalltalk.method({
  3295. selector: "truncated",
  3296. category: 'converting',
  3297. fn: function () {
  3298. var self = this;
  3299. var $1;
  3300. var result;
  3301. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3302. if (smalltalk.assert($1)) {
  3303. result = Math.floor(self);
  3304. } else {
  3305. result = Math.floor(self * -1) * -1;
  3306. }
  3307. return result;
  3308. },
  3309. args: [],
  3310. source: "truncated\x0a|result|\x0a\x0a self >= 0 \x0a ifTrue: [<result = Math.floor(self);>]\x0a ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].\x0a\x0a ^ result",
  3311. messageSends: ["ifTrue:ifFalse:", ">="],
  3312. referencedClasses: []
  3313. }),
  3314. smalltalk.Number);
  3315. smalltalk.addMethod(
  3316. "_|",
  3317. smalltalk.method({
  3318. selector: "|",
  3319. category: 'converting',
  3320. fn: function (aNumber) {
  3321. var self = this;
  3322. return self | aNumber;
  3323. return self;
  3324. },
  3325. args: ["aNumber"],
  3326. source: "| aNumber\x0a\x09<return self | aNumber>",
  3327. messageSends: [],
  3328. referencedClasses: []
  3329. }),
  3330. smalltalk.Number);
  3331. smalltalk.addMethod(
  3332. "_pi",
  3333. smalltalk.method({
  3334. selector: "pi",
  3335. category: 'instance creation',
  3336. fn: function () {
  3337. var self = this;
  3338. return Math.PI;
  3339. return self;
  3340. },
  3341. args: [],
  3342. source: "pi\x0a\x09<return Math.PI>",
  3343. messageSends: [],
  3344. referencedClasses: []
  3345. }),
  3346. smalltalk.Number.klass);
  3347. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3348. smalltalk.addMethod(
  3349. "_addElement_",
  3350. smalltalk.method({
  3351. selector: "addElement:",
  3352. category: 'accessing',
  3353. fn: function (anObject) {
  3354. var self = this;
  3355. self.addElement(anObject);
  3356. return self;
  3357. },
  3358. args: ["anObject"],
  3359. source: "addElement: anObject\x0a\x09<self.addElement(anObject)>",
  3360. messageSends: [],
  3361. referencedClasses: []
  3362. }),
  3363. smalltalk.Organizer);
  3364. smalltalk.addMethod(
  3365. "_elements",
  3366. smalltalk.method({
  3367. selector: "elements",
  3368. category: 'accessing',
  3369. fn: function () {
  3370. var self = this;
  3371. var $1;
  3372. $1 = smalltalk.send(smalltalk.send(self, "_basicAt_", ["elements"]), "_copy", []);
  3373. return $1;
  3374. },
  3375. args: [],
  3376. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3377. messageSends: ["copy", "basicAt:"],
  3378. referencedClasses: []
  3379. }),
  3380. smalltalk.Organizer);
  3381. smalltalk.addMethod(
  3382. "_removeElement_",
  3383. smalltalk.method({
  3384. selector: "removeElement:",
  3385. category: 'accessing',
  3386. fn: function (anObject) {
  3387. var self = this;
  3388. self.removeElement(anObject);
  3389. return self;
  3390. },
  3391. args: ["anObject"],
  3392. source: "removeElement: anObject\x0a\x09<self.removeElement(anObject)>",
  3393. messageSends: [],
  3394. referencedClasses: []
  3395. }),
  3396. smalltalk.Organizer);
  3397. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3398. smalltalk.Package.comment="A Package is 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\x0aA Package has a name, an Array of \x22requires\x22, a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name:\x0a\x0a\x09Smalltalk current packageAt: 'Kernel'\x0a\x0a...but you can also use:\x0a\x0a\x09Package 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\x0acan 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. This can easily be seen in for example class\x0aString where the method category \x22*IDE\x22 defines #inspectOn: which thus is a method belonging to the IDE package.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package fetch: 'Additional-Examples'"
  3399. smalltalk.addMethod(
  3400. "_classes",
  3401. smalltalk.method({
  3402. selector: "classes",
  3403. category: 'classes',
  3404. fn: function () {
  3405. var self = this;
  3406. var $1;
  3407. $1 = smalltalk.send(smalltalk.send(self, "_organization", []), "_elements", []);
  3408. return $1;
  3409. },
  3410. args: [],
  3411. source: "classes\x0a\x09^ self organization elements",
  3412. messageSends: ["elements", "organization"],
  3413. referencedClasses: []
  3414. }),
  3415. smalltalk.Package);
  3416. smalltalk.addMethod(
  3417. "_commitPathJs",
  3418. smalltalk.method({
  3419. selector: "commitPathJs",
  3420. category: 'accessing',
  3421. fn: function () {
  3422. var self = this;
  3423. var $1;
  3424. if (($receiver = self['@commitPathJs']) == nil ||
  3425. $receiver == undefined) {
  3426. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);
  3427. } else {
  3428. $1 = self['@commitPathJs'];
  3429. }
  3430. return $1;
  3431. },
  3432. args: [],
  3433. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3434. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3435. referencedClasses: []
  3436. }),
  3437. smalltalk.Package);
  3438. smalltalk.addMethod(
  3439. "_commitPathJs_",
  3440. smalltalk.method({
  3441. selector: "commitPathJs:",
  3442. category: 'accessing',
  3443. fn: function (aString) {
  3444. var self = this;
  3445. self['@commitPathJs'] = aString;
  3446. return self;
  3447. },
  3448. args: ["aString"],
  3449. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3450. messageSends: [],
  3451. referencedClasses: []
  3452. }),
  3453. smalltalk.Package);
  3454. smalltalk.addMethod(
  3455. "_commitPathSt",
  3456. smalltalk.method({
  3457. selector: "commitPathSt",
  3458. category: 'accessing',
  3459. fn: function () {
  3460. var self = this;
  3461. var $1;
  3462. if (($receiver = self['@commitPathSt']) == nil ||
  3463. $receiver == undefined) {
  3464. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);
  3465. } else {
  3466. $1 = self['@commitPathSt'];
  3467. }
  3468. return $1;
  3469. },
  3470. args: [],
  3471. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3472. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3473. referencedClasses: []
  3474. }),
  3475. smalltalk.Package);
  3476. smalltalk.addMethod(
  3477. "_commitPathSt_",
  3478. smalltalk.method({
  3479. selector: "commitPathSt:",
  3480. category: 'accessing',
  3481. fn: function (aString) {
  3482. var self = this;
  3483. self['@commitPathSt'] = aString;
  3484. return self;
  3485. },
  3486. args: ["aString"],
  3487. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3488. messageSends: [],
  3489. referencedClasses: []
  3490. }),
  3491. smalltalk.Package);
  3492. smalltalk.addMethod(
  3493. "_dependencies",
  3494. smalltalk.method({
  3495. selector: "dependencies",
  3496. category: 'accessing',
  3497. fn: function () {
  3498. var self = this;
  3499. var $1;
  3500. $1 = smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  3501. return $1;
  3502. },
  3503. args: [],
  3504. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  3505. messageSends: ["propertyAt:ifAbsent:"],
  3506. referencedClasses: []
  3507. }),
  3508. smalltalk.Package);
  3509. smalltalk.addMethod(
  3510. "_dependencies_",
  3511. smalltalk.method({
  3512. selector: "dependencies:",
  3513. category: 'accessing',
  3514. fn: function (anArray) {
  3515. var self = this;
  3516. var $1;
  3517. $1 = smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  3518. return $1;
  3519. },
  3520. args: ["anArray"],
  3521. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  3522. messageSends: ["propertyAt:put:"],
  3523. referencedClasses: []
  3524. }),
  3525. smalltalk.Package);
  3526. smalltalk.addMethod(
  3527. "_jsProperties",
  3528. smalltalk.method({
  3529. selector: "jsProperties",
  3530. category: 'private',
  3531. fn: function () {
  3532. var self = this;
  3533. return self.properties;
  3534. return self;
  3535. },
  3536. args: [],
  3537. source: "jsProperties\x0a\x09<return self.properties>",
  3538. messageSends: [],
  3539. referencedClasses: []
  3540. }),
  3541. smalltalk.Package);
  3542. smalltalk.addMethod(
  3543. "_jsProperties_",
  3544. smalltalk.method({
  3545. selector: "jsProperties:",
  3546. category: 'private',
  3547. fn: function (aJSObject) {
  3548. var self = this;
  3549. return self.properties = aJSObject;
  3550. return self;
  3551. },
  3552. args: ["aJSObject"],
  3553. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3554. messageSends: [],
  3555. referencedClasses: []
  3556. }),
  3557. smalltalk.Package);
  3558. smalltalk.addMethod(
  3559. "_name",
  3560. smalltalk.method({
  3561. selector: "name",
  3562. category: 'accessing',
  3563. fn: function () {
  3564. var self = this;
  3565. return self.pkgName;
  3566. return self;
  3567. },
  3568. args: [],
  3569. source: "name\x0a\x09<return self.pkgName>",
  3570. messageSends: [],
  3571. referencedClasses: []
  3572. }),
  3573. smalltalk.Package);
  3574. smalltalk.addMethod(
  3575. "_name_",
  3576. smalltalk.method({
  3577. selector: "name:",
  3578. category: 'accessing',
  3579. fn: function (aString) {
  3580. var self = this;
  3581. self.pkgName = aString;
  3582. return self;
  3583. },
  3584. args: ["aString"],
  3585. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3586. messageSends: [],
  3587. referencedClasses: []
  3588. }),
  3589. smalltalk.Package);
  3590. smalltalk.addMethod(
  3591. "_organization",
  3592. smalltalk.method({
  3593. selector: "organization",
  3594. category: 'accessing',
  3595. fn: function () {
  3596. var self = this;
  3597. var $1;
  3598. $1 = smalltalk.send(self, "_basicAt_", ["organization"]);
  3599. return $1;
  3600. },
  3601. args: [],
  3602. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3603. messageSends: ["basicAt:"],
  3604. referencedClasses: []
  3605. }),
  3606. smalltalk.Package);
  3607. smalltalk.addMethod(
  3608. "_printString",
  3609. smalltalk.method({
  3610. selector: "printString",
  3611. category: 'printing',
  3612. fn: function () {
  3613. var self = this;
  3614. var $1;
  3615. $1 = smalltalk.send(self, "_name", []);
  3616. return $1;
  3617. },
  3618. args: [],
  3619. source: "printString\x0a\x09^self name",
  3620. messageSends: ["name"],
  3621. referencedClasses: []
  3622. }),
  3623. smalltalk.Package);
  3624. smalltalk.addMethod(
  3625. "_properties",
  3626. smalltalk.method({
  3627. selector: "properties",
  3628. category: 'accessing',
  3629. fn: function () {
  3630. var self = this;
  3631. var $1;
  3632. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  3633. return $1;
  3634. },
  3635. args: [],
  3636. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3637. messageSends: ["readJSObject:", "basicAt:", "current"],
  3638. referencedClasses: ["Smalltalk"]
  3639. }),
  3640. smalltalk.Package);
  3641. smalltalk.addMethod(
  3642. "_properties_",
  3643. smalltalk.method({
  3644. selector: "properties:",
  3645. category: 'accessing',
  3646. fn: function (aDict) {
  3647. var self = this;
  3648. var object;
  3649. object = {};
  3650. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  3651. return self.properties = object;
  3652. return self;
  3653. },
  3654. args: ["aDict"],
  3655. source: "properties: aDict\x0a\x09\x22We store it as a javascript object.\x22\x0a\x09\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a\x09<return self.properties = object>",
  3656. messageSends: ["keysAndValuesDo:"],
  3657. referencedClasses: []
  3658. }),
  3659. smalltalk.Package);
  3660. smalltalk.addMethod(
  3661. "_propertiesAsJSON",
  3662. smalltalk.method({
  3663. selector: "propertiesAsJSON",
  3664. category: 'private',
  3665. fn: function () {
  3666. var self = this;
  3667. return JSON.stringify(self.properties);
  3668. return self;
  3669. },
  3670. args: [],
  3671. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3672. messageSends: [],
  3673. referencedClasses: []
  3674. }),
  3675. smalltalk.Package);
  3676. smalltalk.addMethod(
  3677. "_propertyAt_",
  3678. smalltalk.method({
  3679. selector: "propertyAt:",
  3680. category: 'properties',
  3681. fn: function (key) {
  3682. var self = this;
  3683. return self.properties[key];
  3684. return self;
  3685. },
  3686. args: ["key"],
  3687. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3688. messageSends: [],
  3689. referencedClasses: []
  3690. }),
  3691. smalltalk.Package);
  3692. smalltalk.addMethod(
  3693. "_propertyAt_ifAbsent_",
  3694. smalltalk.method({
  3695. selector: "propertyAt:ifAbsent:",
  3696. category: 'properties',
  3697. fn: function (key, block) {
  3698. var self = this;
  3699. var $2, $1;
  3700. $2 = smalltalk.send(self, "_propertyAt_", [key]);
  3701. if (($receiver = $2) == nil || $receiver == undefined) {
  3702. $1 = smalltalk.send(block, "_value", []);
  3703. } else {
  3704. $1 = $2;
  3705. }
  3706. return $1;
  3707. },
  3708. args: ["key", "block"],
  3709. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3710. messageSends: ["ifNil:", "value", "propertyAt:"],
  3711. referencedClasses: []
  3712. }),
  3713. smalltalk.Package);
  3714. smalltalk.addMethod(
  3715. "_propertyAt_put_",
  3716. smalltalk.method({
  3717. selector: "propertyAt:put:",
  3718. category: 'properties',
  3719. fn: function (key, value) {
  3720. var self = this;
  3721. return self.properties[key] = value;
  3722. return self;
  3723. },
  3724. args: ["key", "value"],
  3725. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3726. messageSends: [],
  3727. referencedClasses: []
  3728. }),
  3729. smalltalk.Package);
  3730. smalltalk.addMethod(
  3731. "_sortedClasses",
  3732. smalltalk.method({
  3733. selector: "sortedClasses",
  3734. category: 'classes',
  3735. fn: function () {
  3736. var self = this;
  3737. var $1;
  3738. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  3739. return $1;
  3740. },
  3741. args: [],
  3742. 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",
  3743. messageSends: ["sortedClasses:", "classes", "class"],
  3744. referencedClasses: []
  3745. }),
  3746. smalltalk.Package);
  3747. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3748. smalltalk.addMethod(
  3749. "_commitPathsFromLoader",
  3750. smalltalk.method({
  3751. selector: "commitPathsFromLoader",
  3752. category: 'commit paths',
  3753. fn: function (){
  3754. var self=this;
  3755. var $1,$2;
  3756. var js;
  3757. var st;
  3758. var cp = smalltalk['@@commitPath'];
  3759. if (cp) { js = cp.js; st = cp.st; };
  3760. ;
  3761. $1=js;
  3762. if(($receiver = $1) == nil || $receiver == undefined){
  3763. $1;
  3764. } else {
  3765. smalltalk.send(self,"_defaultCommitPathJs_",[js]);
  3766. };
  3767. $2=st;
  3768. if(($receiver = $2) == nil || $receiver == undefined){
  3769. $2;
  3770. } else {
  3771. smalltalk.send(self,"_defaultCommitPathSt_",[st]);
  3772. };
  3773. return self},
  3774. args: [],
  3775. source: "commitPathsFromLoader\x0a\x09| js st |\x0a <var cp = smalltalk['@@commitPath'];\x0a if (cp) { js = cp.js; st = cp.st; }>.\x0a js ifNotNil: [ self defaultCommitPathJs: js ].\x0a st ifNotNil: [ self defaultCommitPathSt: st ].",
  3776. messageSends: ["ifNotNil:", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  3777. referencedClasses: []
  3778. }),
  3779. smalltalk.Package.klass);
  3780. smalltalk.addMethod(
  3781. "_commitToLocalStorage_",
  3782. smalltalk.method({
  3783. selector: "commitToLocalStorage:",
  3784. category: 'loading-storing',
  3785. fn: function (aPackageName) {
  3786. var self = this;
  3787. var key;
  3788. var sourceCode;
  3789. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  3790. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  3791. localStorage[key] = escape(sourceCode);
  3792. return self;
  3793. },
  3794. args: ["aPackageName"],
  3795. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  3796. messageSends: [",", "exportPackage:", "new"],
  3797. referencedClasses: ["Exporter"]
  3798. }),
  3799. smalltalk.Package.klass);
  3800. smalltalk.addMethod(
  3801. "_defaultCommitPathJs",
  3802. smalltalk.method({
  3803. selector: "defaultCommitPathJs",
  3804. category: 'commit paths',
  3805. fn: function () {
  3806. var self = this;
  3807. var $1;
  3808. if (($receiver = self['@defaultCommitPathJs']) == nil ||
  3809. $receiver == undefined) {
  3810. self['@defaultCommitPathJs'] = "js";
  3811. $1 = self['@defaultCommitPathJs'];
  3812. } else {
  3813. $1 = self['@defaultCommitPathJs'];
  3814. }
  3815. return $1;
  3816. },
  3817. args: [],
  3818. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3819. messageSends: ["ifNil:"],
  3820. referencedClasses: []
  3821. }),
  3822. smalltalk.Package.klass);
  3823. smalltalk.addMethod(
  3824. "_defaultCommitPathJs_",
  3825. smalltalk.method({
  3826. selector: "defaultCommitPathJs:",
  3827. category: 'commit paths',
  3828. fn: function (aString) {
  3829. var self = this;
  3830. self['@defaultCommitPathJs'] = aString;
  3831. return self;
  3832. },
  3833. args: ["aString"],
  3834. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3835. messageSends: [],
  3836. referencedClasses: []
  3837. }),
  3838. smalltalk.Package.klass);
  3839. smalltalk.addMethod(
  3840. "_defaultCommitPathSt",
  3841. smalltalk.method({
  3842. selector: "defaultCommitPathSt",
  3843. category: 'commit paths',
  3844. fn: function () {
  3845. var self = this;
  3846. var $1;
  3847. if (($receiver = self['@defaultCommitPathSt']) == nil ||
  3848. $receiver == undefined) {
  3849. self['@defaultCommitPathSt'] = "st";
  3850. $1 = self['@defaultCommitPathSt'];
  3851. } else {
  3852. $1 = self['@defaultCommitPathSt'];
  3853. }
  3854. return $1;
  3855. },
  3856. args: [],
  3857. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3858. messageSends: ["ifNil:"],
  3859. referencedClasses: []
  3860. }),
  3861. smalltalk.Package.klass);
  3862. smalltalk.addMethod(
  3863. "_defaultCommitPathSt_",
  3864. smalltalk.method({
  3865. selector: "defaultCommitPathSt:",
  3866. category: 'commit paths',
  3867. fn: function (aString) {
  3868. var self = this;
  3869. self['@defaultCommitPathSt'] = aString;
  3870. return self;
  3871. },
  3872. args: ["aString"],
  3873. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3874. messageSends: [],
  3875. referencedClasses: []
  3876. }),
  3877. smalltalk.Package.klass);
  3878. smalltalk.addMethod(
  3879. "_fetch_",
  3880. smalltalk.method({
  3881. selector: "fetch:",
  3882. category: 'loading-storing',
  3883. fn: function (aPackageName) {
  3884. var self = this;
  3885. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  3886. return self;
  3887. },
  3888. args: ["aPackageName"],
  3889. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  3890. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  3891. referencedClasses: []
  3892. }),
  3893. smalltalk.Package.klass);
  3894. smalltalk.addMethod(
  3895. "_fetch_prefix_",
  3896. smalltalk.method({
  3897. selector: "fetch:prefix:",
  3898. category: 'loading-storing',
  3899. fn: function (aPackageName, aPrefix) {
  3900. var self = this;
  3901. smalltalk.send(jQuery, "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), function () {return smalltalk.send(smalltalk.Package || Package, "_init_", [aPackageName]);}]);
  3902. return self;
  3903. },
  3904. args: ["aPackageName", "aPrefix"],
  3905. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  3906. messageSends: ["getScript:onSuccess:", ",", "init:"],
  3907. referencedClasses: ["Package"]
  3908. }),
  3909. smalltalk.Package.klass);
  3910. smalltalk.addMethod(
  3911. "_init_",
  3912. smalltalk.method({
  3913. selector: "init:",
  3914. category: 'loading-storing',
  3915. fn: function (aPackageName) {
  3916. var self = this;
  3917. var $1, $2;
  3918. $1 = smalltalk.send(smalltalk.send(smalltalk, "_classes", []), "_select_", [function (each) {return each.pkg.pkgName == aPackageName;}]);
  3919. smalltalk.send($1, "_do_", [function (each) {return smalltalk.init(each);}]);
  3920. $2 = smalltalk.send($1, "_do_", [function (each) {return smalltalk.send(each, "_initialize", []);}]);
  3921. return self;
  3922. },
  3923. args: ["aPackageName"],
  3924. source: "init: aPackageName\x0a\x09(smalltalk classes select: [ :each | <each.pkg.pkgName == aPackageName> ])\x0a\x09\x09do: [ :each | <smalltalk.init(each)> ];\x0a\x09\x09do: [ :each | each initialize ]",
  3925. messageSends: ["do:", "select:", "classes", "initialize"],
  3926. referencedClasses: []
  3927. }),
  3928. smalltalk.Package.klass);
  3929. smalltalk.addMethod(
  3930. "_initialize",
  3931. smalltalk.method({
  3932. selector: "initialize",
  3933. category: 'initialization',
  3934. fn: function (){
  3935. var self=this;
  3936. smalltalk.send(self,"_initialize",[],smalltalk.Object.klass);
  3937. smalltalk.send(self,"_commitPathsFromLoader",[]);
  3938. return self},
  3939. args: [],
  3940. source: "initialize\x0a\x09super initialize.\x0a self commitPathsFromLoader",
  3941. messageSends: ["initialize", "commitPathsFromLoader"],
  3942. referencedClasses: []
  3943. }),
  3944. smalltalk.Package.klass);
  3945. smalltalk.addMethod(
  3946. "_named_",
  3947. smalltalk.method({
  3948. selector: "named:",
  3949. category: 'not yet classified',
  3950. fn: function (aPackageName) {
  3951. var self = this;
  3952. var $1;
  3953. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  3954. return $1;
  3955. },
  3956. args: ["aPackageName"],
  3957. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3958. messageSends: ["packageAt:", "current"],
  3959. referencedClasses: ["Smalltalk"]
  3960. }),
  3961. smalltalk.Package.klass);
  3962. smalltalk.addMethod(
  3963. "_named_ifAbsent_",
  3964. smalltalk.method({
  3965. selector: "named:ifAbsent:",
  3966. category: 'not yet classified',
  3967. fn: function (aPackageName, aBlock) {
  3968. var self = this;
  3969. var $1;
  3970. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  3971. return $1;
  3972. },
  3973. args: ["aPackageName", "aBlock"],
  3974. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3975. messageSends: ["packageAt:ifAbsent:", "current"],
  3976. referencedClasses: ["Smalltalk"]
  3977. }),
  3978. smalltalk.Package.klass);
  3979. smalltalk.addMethod(
  3980. "_resetCommitPaths",
  3981. smalltalk.method({
  3982. selector: "resetCommitPaths",
  3983. category: 'commit paths',
  3984. fn: function () {
  3985. var self = this;
  3986. self['@defaultCommitPathJs'] = nil;
  3987. self['@defaultCommitPathSt'] = nil;
  3988. return self;
  3989. },
  3990. args: [],
  3991. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  3992. messageSends: [],
  3993. referencedClasses: []
  3994. }),
  3995. smalltalk.Package.klass);
  3996. smalltalk.addMethod(
  3997. "_sortedClasses_",
  3998. smalltalk.method({
  3999. selector: "sortedClasses:",
  4000. category: 'sorting',
  4001. fn: function (classes) {
  4002. var self = this;
  4003. var $1;
  4004. var children;
  4005. var others;
  4006. var nodes;
  4007. var expandedClasses;
  4008. children = [];
  4009. others = [];
  4010. smalltalk.send(classes, "_do_", [function (each) {$1 = smalltalk.send(classes, "_includes_", [smalltalk.send(each, "_superclass", [])]);if (smalltalk.assert($1)) {return smalltalk.send(others, "_add_", [each]);} else {return smalltalk.send(children, "_add_", [each]);}}]);
  4011. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  4012. nodes = smalltalk.send(nodes, "_sorted_", [function (a, b) {return smalltalk.send(smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", []), "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]);}]);
  4013. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  4014. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  4015. return expandedClasses;
  4016. },
  4017. args: ["classes"],
  4018. 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",
  4019. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  4020. referencedClasses: ["ClassSorterNode", "Array"]
  4021. }),
  4022. smalltalk.Package.klass);
  4023. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4024. smalltalk.Point.comment="A `Point` represents an x-y pair of numbers usually designating a geometric coordinate.\x0aPoints 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\x0a\x0aAmber does not have much behavior in this class out-of-the-box."
  4025. smalltalk.addMethod(
  4026. "__star",
  4027. smalltalk.method({
  4028. selector: "*",
  4029. category: 'arithmetic',
  4030. fn: function (aPoint) {
  4031. var self = this;
  4032. var $1;
  4033. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4034. return $1;
  4035. },
  4036. args: ["aPoint"],
  4037. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4038. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4039. referencedClasses: ["Point"]
  4040. }),
  4041. smalltalk.Point);
  4042. smalltalk.addMethod(
  4043. "__plus",
  4044. smalltalk.method({
  4045. selector: "+",
  4046. category: 'arithmetic',
  4047. fn: function (aPoint) {
  4048. var self = this;
  4049. var $1;
  4050. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4051. return $1;
  4052. },
  4053. args: ["aPoint"],
  4054. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4055. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4056. referencedClasses: ["Point"]
  4057. }),
  4058. smalltalk.Point);
  4059. smalltalk.addMethod(
  4060. "__minus",
  4061. smalltalk.method({
  4062. selector: "-",
  4063. category: 'arithmetic',
  4064. fn: function (aPoint) {
  4065. var self = this;
  4066. var $1;
  4067. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4068. return $1;
  4069. },
  4070. args: ["aPoint"],
  4071. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4072. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4073. referencedClasses: ["Point"]
  4074. }),
  4075. smalltalk.Point);
  4076. smalltalk.addMethod(
  4077. "__slash",
  4078. smalltalk.method({
  4079. selector: "/",
  4080. category: 'arithmetic',
  4081. fn: function (aPoint) {
  4082. var self = this;
  4083. var $1;
  4084. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4085. return $1;
  4086. },
  4087. args: ["aPoint"],
  4088. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4089. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4090. referencedClasses: ["Point"]
  4091. }),
  4092. smalltalk.Point);
  4093. smalltalk.addMethod(
  4094. "__eq",
  4095. smalltalk.method({
  4096. selector: "=",
  4097. category: 'arithmetic',
  4098. fn: function (aPoint) {
  4099. var self = this;
  4100. var $1;
  4101. $1 = smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]), "_and_", [function () {return smalltalk.send(smalltalk.send(smalltalk.send(aPoint, "_x", []), "__eq", [smalltalk.send(self, "_x", [])]), "_&", [smalltalk.send(smalltalk.send(aPoint, "_y", []), "__eq", [smalltalk.send(self, "_y", [])])]);}]);
  4102. return $1;
  4103. },
  4104. args: ["aPoint"],
  4105. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4106. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4107. referencedClasses: []
  4108. }),
  4109. smalltalk.Point);
  4110. smalltalk.addMethod(
  4111. "_asPoint",
  4112. smalltalk.method({
  4113. selector: "asPoint",
  4114. category: 'converting',
  4115. fn: function () {
  4116. var self = this;
  4117. return self;
  4118. },
  4119. args: [],
  4120. source: "asPoint\x0a\x09^self",
  4121. messageSends: [],
  4122. referencedClasses: []
  4123. }),
  4124. smalltalk.Point);
  4125. smalltalk.addMethod(
  4126. "_printString",
  4127. smalltalk.method({
  4128. selector: "printString",
  4129. category: 'printing',
  4130. fn: function () {
  4131. var self = this;
  4132. var $2, $1;
  4133. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (stream) {smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", ["@"])]);$2 = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [function () {return smalltalk.send(self['@y'], "_negative", []);}]);if (smalltalk.assert($2)) {smalltalk.send(stream, "_space", []);}return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);}]);
  4134. return $1;
  4135. },
  4136. args: [],
  4137. source: "printString\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09stream nextPutAll: x printString, '@'.\x0a\x09\x09(y notNil and: [y negative])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09\x09stream space].\x0a\x09\x09stream nextPutAll: y printString]",
  4138. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "space", "and:", "negative", "notNil"],
  4139. referencedClasses: ["String"]
  4140. }),
  4141. smalltalk.Point);
  4142. smalltalk.addMethod(
  4143. "_translateBy_",
  4144. smalltalk.method({
  4145. selector: "translateBy:",
  4146. category: 'transforming',
  4147. fn: function (delta) {
  4148. var self = this;
  4149. var $1;
  4150. $1 = smalltalk.send(smalltalk.send(smalltalk.send(delta, "_x", []), "__plus", [self['@x']]), "__at", [smalltalk.send(smalltalk.send(delta, "_y", []), "__plus", [self['@y']])]);
  4151. return $1;
  4152. },
  4153. args: ["delta"],
  4154. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4155. messageSends: ["@", "+", "y", "x"],
  4156. referencedClasses: []
  4157. }),
  4158. smalltalk.Point);
  4159. smalltalk.addMethod(
  4160. "_x",
  4161. smalltalk.method({
  4162. selector: "x",
  4163. category: 'accessing',
  4164. fn: function () {
  4165. var self = this;
  4166. return self['@x'];
  4167. },
  4168. args: [],
  4169. source: "x\x0a\x09^x",
  4170. messageSends: [],
  4171. referencedClasses: []
  4172. }),
  4173. smalltalk.Point);
  4174. smalltalk.addMethod(
  4175. "_x_",
  4176. smalltalk.method({
  4177. selector: "x:",
  4178. category: 'accessing',
  4179. fn: function (aNumber) {
  4180. var self = this;
  4181. self['@x'] = aNumber;
  4182. return self;
  4183. },
  4184. args: ["aNumber"],
  4185. source: "x: aNumber\x0a\x09x := aNumber",
  4186. messageSends: [],
  4187. referencedClasses: []
  4188. }),
  4189. smalltalk.Point);
  4190. smalltalk.addMethod(
  4191. "_y",
  4192. smalltalk.method({
  4193. selector: "y",
  4194. category: 'accessing',
  4195. fn: function () {
  4196. var self = this;
  4197. return self['@y'];
  4198. },
  4199. args: [],
  4200. source: "y\x0a\x09^y",
  4201. messageSends: [],
  4202. referencedClasses: []
  4203. }),
  4204. smalltalk.Point);
  4205. smalltalk.addMethod(
  4206. "_y_",
  4207. smalltalk.method({
  4208. selector: "y:",
  4209. category: 'accessing',
  4210. fn: function (aNumber) {
  4211. var self = this;
  4212. self['@y'] = aNumber;
  4213. return self;
  4214. },
  4215. args: ["aNumber"],
  4216. source: "y: aNumber\x0a\x09y := aNumber",
  4217. messageSends: [],
  4218. referencedClasses: []
  4219. }),
  4220. smalltalk.Point);
  4221. smalltalk.addMethod(
  4222. "_x_y_",
  4223. smalltalk.method({
  4224. selector: "x:y:",
  4225. category: 'instance creation',
  4226. fn: function (aNumber, anotherNumber) {
  4227. var self = this;
  4228. var $2, $3, $1;
  4229. $2 = smalltalk.send(self, "_new", []);
  4230. smalltalk.send($2, "_x_", [aNumber]);
  4231. smalltalk.send($2, "_y_", [anotherNumber]);
  4232. $3 = smalltalk.send($2, "_yourself", []);
  4233. $1 = $3;
  4234. return $1;
  4235. },
  4236. args: ["aNumber", "anotherNumber"],
  4237. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4238. messageSends: ["x:", "new", "y:", "yourself"],
  4239. referencedClasses: []
  4240. }),
  4241. smalltalk.Point.klass);
  4242. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4243. smalltalk.Random.comment="`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:\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\x0a...and if you want a random number in a specific interval this also works:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0a...but be 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\x0a...or perhaps a 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'`."
  4244. smalltalk.addMethod(
  4245. "_next",
  4246. smalltalk.method({
  4247. selector: "next",
  4248. category: 'accessing',
  4249. fn: function () {
  4250. var self = this;
  4251. return Math.random();
  4252. return self;
  4253. },
  4254. args: [],
  4255. source: "next\x0a\x09<return Math.random()>",
  4256. messageSends: [],
  4257. referencedClasses: []
  4258. }),
  4259. smalltalk.Random);
  4260. smalltalk.addMethod(
  4261. "_next_",
  4262. smalltalk.method({
  4263. selector: "next:",
  4264. category: 'accessing',
  4265. fn: function (anInteger) {
  4266. var self = this;
  4267. var $1;
  4268. $1 = smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  4269. return $1;
  4270. },
  4271. args: ["anInteger"],
  4272. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  4273. messageSends: ["collect:", "next", "to:"],
  4274. referencedClasses: []
  4275. }),
  4276. smalltalk.Random);
  4277. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  4278. smalltalk.Smalltalk.comment="Smalltalk has only one instance, accessed with `Smalltalk current`. \x0aIt represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.\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 of `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 class of `nil`\x0a\x0a__note:__ classes and packages are accessed using strings, not symbols\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Smalltalk source code. \x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work"
  4279. smalltalk.addMethod(
  4280. "_at_",
  4281. smalltalk.method({
  4282. selector: "at:",
  4283. category: 'accessing',
  4284. fn: function (aSymbol) {
  4285. var self = this;
  4286. return self[aSymbol._asString()];
  4287. return self;
  4288. },
  4289. args: ["aSymbol"],
  4290. source: "at: aSymbol\x0a\x09<return self[aSymbol._asString()]>",
  4291. messageSends: [],
  4292. referencedClasses: []
  4293. }),
  4294. smalltalk.Smalltalk);
  4295. smalltalk.addMethod(
  4296. "_basicParse_",
  4297. smalltalk.method({
  4298. selector: "basicParse:",
  4299. category: 'accessing',
  4300. fn: function (aString) {
  4301. var self = this;
  4302. return smalltalk.parser.parse(aString);
  4303. return self;
  4304. },
  4305. args: ["aString"],
  4306. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  4307. messageSends: [],
  4308. referencedClasses: []
  4309. }),
  4310. smalltalk.Smalltalk);
  4311. smalltalk.addMethod(
  4312. "_classes",
  4313. smalltalk.method({
  4314. selector: "classes",
  4315. category: 'classes',
  4316. fn: function () {
  4317. var self = this;
  4318. return self.classes();
  4319. return self;
  4320. },
  4321. args: [],
  4322. source: "classes\x0a\x09<return self.classes()>",
  4323. messageSends: [],
  4324. referencedClasses: []
  4325. }),
  4326. smalltalk.Smalltalk);
  4327. smalltalk.addMethod(
  4328. "_createPackage_",
  4329. smalltalk.method({
  4330. selector: "createPackage:",
  4331. category: 'private',
  4332. fn: function (packageName) {
  4333. var self = this;
  4334. return smalltalk.addPackage(packageName, nil);
  4335. return self;
  4336. },
  4337. args: ["packageName"],
  4338. source: "createPackage: packageName\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a <return smalltalk.addPackage(packageName, nil)>",
  4339. messageSends: [],
  4340. referencedClasses: []
  4341. }),
  4342. smalltalk.Smalltalk);
  4343. smalltalk.addMethod(
  4344. "_createPackage_properties_",
  4345. smalltalk.method({
  4346. selector: "createPackage:properties:",
  4347. category: 'private',
  4348. fn: function (packageName, aDict) {
  4349. var self = this;
  4350. var object;
  4351. object = {};
  4352. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  4353. return smalltalk.addPackage(packageName, object);
  4354. return self;
  4355. },
  4356. args: ["packageName", "aDict"],
  4357. source: "createPackage: packageName properties: aDict\x0a\x09\x22Create and bind a new package with given name and return it.\x22\x0a\x0a\x09| object |\x0a\x09<object = {};>.\x0a\x09aDict keysAndValuesDo: [:key :value |\x0a\x09\x09<object[key] = value>.\x0a\x09].\x0a <return smalltalk.addPackage(packageName, object)>",
  4358. messageSends: ["keysAndValuesDo:"],
  4359. referencedClasses: []
  4360. }),
  4361. smalltalk.Smalltalk);
  4362. smalltalk.addMethod(
  4363. "_deleteClass_",
  4364. smalltalk.method({
  4365. selector: "deleteClass:",
  4366. category: 'private',
  4367. fn: function (aClass) {
  4368. var self = this;
  4369. self.removeClass(aClass);
  4370. return self;
  4371. },
  4372. args: ["aClass"],
  4373. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a \x0a\x09<self.removeClass(aClass)>",
  4374. messageSends: [],
  4375. referencedClasses: []
  4376. }),
  4377. smalltalk.Smalltalk);
  4378. smalltalk.addMethod(
  4379. "_deletePackage_",
  4380. smalltalk.method({
  4381. selector: "deletePackage:",
  4382. category: 'private',
  4383. fn: function (packageName) {
  4384. var self = this;
  4385. delete smalltalk.packages[packageName];
  4386. return self;
  4387. },
  4388. args: ["packageName"],
  4389. 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 <delete smalltalk.packages[packageName]>",
  4390. messageSends: [],
  4391. referencedClasses: []
  4392. }),
  4393. smalltalk.Smalltalk);
  4394. smalltalk.addMethod(
  4395. "_packageAt_",
  4396. smalltalk.method({
  4397. selector: "packageAt:",
  4398. category: 'packages',
  4399. fn: function (packageName) {
  4400. var self = this;
  4401. return self.packages[packageName];
  4402. return self;
  4403. },
  4404. args: ["packageName"],
  4405. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  4406. messageSends: [],
  4407. referencedClasses: []
  4408. }),
  4409. smalltalk.Smalltalk);
  4410. smalltalk.addMethod(
  4411. "_packageAt_ifAbsent_",
  4412. smalltalk.method({
  4413. selector: "packageAt:ifAbsent:",
  4414. category: 'packages',
  4415. fn: function (packageName, aBlock) {
  4416. var self = this;
  4417. var $2, $1;
  4418. $2 = smalltalk.send(self, "_packageAt_", [packageName]);
  4419. $1 = smalltalk.send($2, "_ifNil_", [aBlock]);
  4420. return $1;
  4421. },
  4422. args: ["packageName", "aBlock"],
  4423. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  4424. messageSends: ["ifNil:", "packageAt:"],
  4425. referencedClasses: []
  4426. }),
  4427. smalltalk.Smalltalk);
  4428. smalltalk.addMethod(
  4429. "_packages",
  4430. smalltalk.method({
  4431. selector: "packages",
  4432. category: 'packages',
  4433. fn: function () {
  4434. var self = this;
  4435. return self.packages.all();
  4436. return self;
  4437. },
  4438. args: [],
  4439. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4440. messageSends: [],
  4441. referencedClasses: []
  4442. }),
  4443. smalltalk.Smalltalk);
  4444. smalltalk.addMethod(
  4445. "_parse_",
  4446. smalltalk.method({
  4447. selector: "parse:",
  4448. category: 'accessing',
  4449. fn: function (aString) {
  4450. var self = this;
  4451. var result;
  4452. smalltalk.send(self, "_try_catch_", [function () {result = smalltalk.send(self, "_basicParse_", [aString]);return result;}, function (ex) {return smalltalk.send(smalltalk.send(self, "_parseError_parsing_", [ex, aString]), "_signal", []);}]);
  4453. return result;
  4454. },
  4455. args: ["aString"],
  4456. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  4457. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  4458. referencedClasses: []
  4459. }),
  4460. smalltalk.Smalltalk);
  4461. smalltalk.addMethod(
  4462. "_parseError_parsing_",
  4463. smalltalk.method({
  4464. selector: "parseError:parsing:",
  4465. category: 'accessing',
  4466. fn: function (anException, aString) {
  4467. var self = this;
  4468. var $1;
  4469. var row;
  4470. var col;
  4471. var message;
  4472. var lines;
  4473. var badLine;
  4474. var code;
  4475. row = anException.line;
  4476. col = anException.column;
  4477. message = anException.message;
  4478. lines = smalltalk.send(aString, "_lines", []);
  4479. badLine = smalltalk.send(lines, "_at_", [row]);
  4480. badLine = smalltalk.send(smalltalk.send(smalltalk.send(badLine, "_copyFrom_to_", [1, smalltalk.send(col, "__minus", [1])]), "__comma", [" ===>"]), "__comma", [smalltalk.send(badLine, "_copyFrom_to_", [col, smalltalk.send(badLine, "_size", [])])]);
  4481. smalltalk.send(lines, "_at_put_", [row, badLine]);
  4482. code = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (s) {return smalltalk.send(lines, "_withIndexDo_", [function (l, i) {return smalltalk.send(s, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(i, "_asString", []), "__comma", [": "]), "__comma", [l]), "__comma", [smalltalk.send(smalltalk.String || String, "_lf", [])])]);}]);}]);
  4483. $1 = smalltalk.send(smalltalk.send(smalltalk.ParseError || ParseError, "_new", []), "_messageText_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Parse error on line ", "__comma", [row]), "__comma", [" column "]), "__comma", [col]), "__comma", [" : "]), "__comma", [message]), "__comma", [" Below is code with line numbers and ===> marker inserted:"]), "__comma", [smalltalk.send(smalltalk.String || String, "_lf", [])]), "__comma", [code])]);
  4484. return $1;
  4485. },
  4486. args: ["anException", "aString"],
  4487. source: "parseError: anException parsing: aString\x0a\x09| row col message lines badLine code |\x0a\x09<row = anException.line;\x0a\x09col = anException.column;\x0a\x09message = anException.message;>.\x0a\x09lines := aString lines.\x0a\x09badLine := lines at: row.\x0a\x09badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom: col to: badLine size).\x0a\x09lines at: row put: badLine.\x0a\x09code := String streamContents: [:s |\x0a lines withIndexDo: [:l :i |\x0a s nextPutAll: i asString, ': ', l, String lf]].\x0a\x09^ ParseError new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)",
  4488. messageSends: ["lines", "at:", ",", "copyFrom:to:", "size", "-", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "lf", "asString", "messageText:", "new"],
  4489. referencedClasses: ["String", "ParseError"]
  4490. }),
  4491. smalltalk.Smalltalk);
  4492. smalltalk.addMethod(
  4493. "_pseudoVariableNames",
  4494. smalltalk.method({
  4495. selector: "pseudoVariableNames",
  4496. category: 'packages',
  4497. fn: function () {
  4498. var self = this;
  4499. return ["self", "super", "nil", "true", "false", "thisContext"];
  4500. },
  4501. args: [],
  4502. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  4503. messageSends: [],
  4504. referencedClasses: []
  4505. }),
  4506. smalltalk.Smalltalk);
  4507. smalltalk.addMethod(
  4508. "_readJSObject_",
  4509. smalltalk.method({
  4510. selector: "readJSObject:",
  4511. category: 'accessing',
  4512. fn: function (anObject) {
  4513. var self = this;
  4514. return self.readJSObject(anObject);
  4515. return self;
  4516. },
  4517. args: ["anObject"],
  4518. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  4519. messageSends: [],
  4520. referencedClasses: []
  4521. }),
  4522. smalltalk.Smalltalk);
  4523. smalltalk.addMethod(
  4524. "_removeClass_",
  4525. smalltalk.method({
  4526. selector: "removeClass:",
  4527. category: 'classes',
  4528. fn: function (aClass) {
  4529. var self = this;
  4530. var $1, $2, $3;
  4531. $1 = smalltalk.send(aClass, "_isMetaclass", []);
  4532. if (smalltalk.assert($1)) {
  4533. smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);
  4534. }
  4535. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  4536. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  4537. smalltalk.send(self, "_deleteClass_", [aClass]);
  4538. $2 = smalltalk.send(smalltalk.ClassRemoved || ClassRemoved, "_new", []);
  4539. smalltalk.send($2, "_theClass_", [aClass]);
  4540. $3 = smalltalk.send($2, "_yourself", []);
  4541. smalltalk.send(smalltalk.send(smalltalk.SystemAnnouncer || SystemAnnouncer, "_current", []), "_announce_", [$3]);
  4542. return self;
  4543. },
  4544. args: ["aClass"],
  4545. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a \x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09aClass removeCompiledMethod: each].\x0a \x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09aClass class removeCompiledMethod: each].\x0a \x0a\x09self deleteClass: aClass.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRemoved new\x0a \x09theClass: aClass;\x0a yourself)",
  4546. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "do:", "removeCompiledMethod:", "values", "methodDictionary", "class", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  4547. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  4548. }),
  4549. smalltalk.Smalltalk);
  4550. smalltalk.addMethod(
  4551. "_removePackage_",
  4552. smalltalk.method({
  4553. selector: "removePackage:",
  4554. category: 'packages',
  4555. fn: function (packageName) {
  4556. var self = this;
  4557. var pkg;
  4558. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4559. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  4560. smalltalk.send(self, "_deletePackage_", [packageName]);
  4561. return self;
  4562. },
  4563. args: ["packageName"],
  4564. 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 \x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  4565. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4566. referencedClasses: []
  4567. }),
  4568. smalltalk.Smalltalk);
  4569. smalltalk.addMethod(
  4570. "_renamePackage_to_",
  4571. smalltalk.method({
  4572. selector: "renamePackage:to:",
  4573. category: 'packages',
  4574. fn: function (packageName, newName) {
  4575. var self = this;
  4576. var $1;
  4577. var pkg;
  4578. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4579. $1 = smalltalk.send(self, "_packageAt_", [newName]);
  4580. if (($receiver = $1) == nil || $receiver == undefined) {
  4581. } else {
  4582. smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);
  4583. }
  4584. smalltalk.packages[newName] = smalltalk.packages[packageName];
  4585. smalltalk.send(pkg, "_name_", [newName]);
  4586. smalltalk.send(self, "_deletePackage_", [packageName]);
  4587. return self;
  4588. },
  4589. args: ["packageName", "newName"],
  4590. 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<smalltalk.packages[newName] = smalltalk.packages[packageName]>.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  4591. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  4592. referencedClasses: []
  4593. }),
  4594. smalltalk.Smalltalk);
  4595. smalltalk.addMethod(
  4596. "_reservedWords",
  4597. smalltalk.method({
  4598. selector: "reservedWords",
  4599. category: 'accessing',
  4600. fn: function () {
  4601. var self = this;
  4602. return self.reservedWords;
  4603. return self;
  4604. },
  4605. args: [],
  4606. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4607. messageSends: [],
  4608. referencedClasses: []
  4609. }),
  4610. smalltalk.Smalltalk);
  4611. smalltalk.addMethod(
  4612. "_send_to_arguments_",
  4613. smalltalk.method({
  4614. selector: "send:to:arguments:",
  4615. category: 'accessing',
  4616. fn: function (aSelector, anObject, aCollection) {
  4617. var self = this;
  4618. var selector;
  4619. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  4620. return self.send(anObject, selector, aCollection);
  4621. return self;
  4622. },
  4623. args: ["aSelector", "anObject", "aCollection"],
  4624. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<return self.send(anObject, selector, aCollection)>",
  4625. messageSends: ["asSelector", "asString"],
  4626. referencedClasses: []
  4627. }),
  4628. smalltalk.Smalltalk);
  4629. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4630. smalltalk.addMethod(
  4631. "_current",
  4632. smalltalk.method({
  4633. selector: "current",
  4634. category: 'accessing',
  4635. fn: function () {
  4636. var self = this;
  4637. return smalltalk;
  4638. return self;
  4639. },
  4640. args: [],
  4641. source: "current\x0a\x09<return smalltalk>",
  4642. messageSends: [],
  4643. referencedClasses: []
  4644. }),
  4645. smalltalk.Smalltalk.klass);
  4646. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  4647. smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
  4648. smalltalk.addMethod(
  4649. "_clearInterval",
  4650. smalltalk.method({
  4651. selector: "clearInterval",
  4652. category: 'timeout/interval',
  4653. fn: function (){
  4654. var self=this;
  4655. var interval = self["@rawTimeout"];
  4656. clearInterval(interval);
  4657. ;
  4658. ;
  4659. return self},
  4660. args: [],
  4661. source: "clearInterval\x0a\x09<\x0a \x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a >",
  4662. messageSends: [],
  4663. referencedClasses: []
  4664. }),
  4665. smalltalk.Timeout);
  4666. smalltalk.addMethod(
  4667. "_clearTimeout",
  4668. smalltalk.method({
  4669. selector: "clearTimeout",
  4670. category: 'timeout/interval',
  4671. fn: function (){
  4672. var self=this;
  4673. var timeout = self["@rawTimeout"];
  4674. clearTimeout(timeout);
  4675. ;
  4676. ;
  4677. return self},
  4678. args: [],
  4679. source: "clearTimeout\x0a\x09<\x0a \x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a >",
  4680. messageSends: [],
  4681. referencedClasses: []
  4682. }),
  4683. smalltalk.Timeout);
  4684. smalltalk.addMethod(
  4685. "_rawTimeout_",
  4686. smalltalk.method({
  4687. selector: "rawTimeout:",
  4688. category: 'accessing',
  4689. fn: function (anObject){
  4690. var self=this;
  4691. self["@rawTimeout"]=anObject;
  4692. return self},
  4693. args: ["anObject"],
  4694. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  4695. messageSends: [],
  4696. referencedClasses: []
  4697. }),
  4698. smalltalk.Timeout);
  4699. smalltalk.addMethod(
  4700. "_on_",
  4701. smalltalk.method({
  4702. selector: "on:",
  4703. category: 'instance creation',
  4704. fn: function (anObject){
  4705. var self=this;
  4706. var $2,$3,$1;
  4707. $2=smalltalk.send(self,"_new",[]);
  4708. smalltalk.send($2,"_rawTimeout_",[anObject]);
  4709. $3=smalltalk.send($2,"_yourself",[]);
  4710. $1=$3;
  4711. return $1;
  4712. },
  4713. args: ["anObject"],
  4714. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  4715. messageSends: ["rawTimeout:", "new", "yourself"],
  4716. referencedClasses: []
  4717. }),
  4718. smalltalk.Timeout.klass);
  4719. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4720. smalltalk.UndefinedObject.comment="UndefinedObject describes the behavior of its 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 representation of the `undefined` JavaScript object."
  4721. smalltalk.addMethod(
  4722. "_asJSON",
  4723. smalltalk.method({
  4724. selector: "asJSON",
  4725. category: 'converting',
  4726. fn: function () {
  4727. var self = this;
  4728. return null;
  4729. },
  4730. args: [],
  4731. source: "asJSON\x0a\x09^null",
  4732. messageSends: [],
  4733. referencedClasses: []
  4734. }),
  4735. smalltalk.UndefinedObject);
  4736. smalltalk.addMethod(
  4737. "_deepCopy",
  4738. smalltalk.method({
  4739. selector: "deepCopy",
  4740. category: 'copying',
  4741. fn: function () {
  4742. var self = this;
  4743. return self;
  4744. },
  4745. args: [],
  4746. source: "deepCopy\x0a\x09^self",
  4747. messageSends: [],
  4748. referencedClasses: []
  4749. }),
  4750. smalltalk.UndefinedObject);
  4751. smalltalk.addMethod(
  4752. "_ifNil_",
  4753. smalltalk.method({
  4754. selector: "ifNil:",
  4755. category: 'testing',
  4756. fn: function (aBlock) {
  4757. var self = this;
  4758. var $1;
  4759. $1 = smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {}]);
  4760. return $1;
  4761. },
  4762. args: ["aBlock"],
  4763. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4764. messageSends: ["ifNil:ifNotNil:"],
  4765. referencedClasses: []
  4766. }),
  4767. smalltalk.UndefinedObject);
  4768. smalltalk.addMethod(
  4769. "_ifNil_ifNotNil_",
  4770. smalltalk.method({
  4771. selector: "ifNil:ifNotNil:",
  4772. category: 'testing',
  4773. fn: function (aBlock, anotherBlock) {
  4774. var self = this;
  4775. var $1;
  4776. $1 = smalltalk.send(aBlock, "_value", []);
  4777. return $1;
  4778. },
  4779. args: ["aBlock", "anotherBlock"],
  4780. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4781. messageSends: ["value"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.UndefinedObject);
  4785. smalltalk.addMethod(
  4786. "_ifNotNil_",
  4787. smalltalk.method({
  4788. selector: "ifNotNil:",
  4789. category: 'testing',
  4790. fn: function (aBlock) {
  4791. var self = this;
  4792. return self;
  4793. },
  4794. args: ["aBlock"],
  4795. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4796. messageSends: [],
  4797. referencedClasses: []
  4798. }),
  4799. smalltalk.UndefinedObject);
  4800. smalltalk.addMethod(
  4801. "_ifNotNil_ifNil_",
  4802. smalltalk.method({
  4803. selector: "ifNotNil:ifNil:",
  4804. category: 'testing',
  4805. fn: function (aBlock, anotherBlock) {
  4806. var self = this;
  4807. var $1;
  4808. $1 = smalltalk.send(anotherBlock, "_value", []);
  4809. return $1;
  4810. },
  4811. args: ["aBlock", "anotherBlock"],
  4812. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4813. messageSends: ["value"],
  4814. referencedClasses: []
  4815. }),
  4816. smalltalk.UndefinedObject);
  4817. smalltalk.addMethod(
  4818. "_isNil",
  4819. smalltalk.method({
  4820. selector: "isNil",
  4821. category: 'testing',
  4822. fn: function () {
  4823. var self = this;
  4824. return true;
  4825. },
  4826. args: [],
  4827. source: "isNil\x0a\x09^true",
  4828. messageSends: [],
  4829. referencedClasses: []
  4830. }),
  4831. smalltalk.UndefinedObject);
  4832. smalltalk.addMethod(
  4833. "_notNil",
  4834. smalltalk.method({
  4835. selector: "notNil",
  4836. category: 'testing',
  4837. fn: function () {
  4838. var self = this;
  4839. return false;
  4840. },
  4841. args: [],
  4842. source: "notNil\x0a\x09^false",
  4843. messageSends: [],
  4844. referencedClasses: []
  4845. }),
  4846. smalltalk.UndefinedObject);
  4847. smalltalk.addMethod(
  4848. "_printString",
  4849. smalltalk.method({
  4850. selector: "printString",
  4851. category: 'printing',
  4852. fn: function () {
  4853. var self = this;
  4854. return "nil";
  4855. },
  4856. args: [],
  4857. source: "printString\x0a ^'nil'",
  4858. messageSends: [],
  4859. referencedClasses: []
  4860. }),
  4861. smalltalk.UndefinedObject);
  4862. smalltalk.addMethod(
  4863. "_shallowCopy",
  4864. smalltalk.method({
  4865. selector: "shallowCopy",
  4866. category: 'copying',
  4867. fn: function () {
  4868. var self = this;
  4869. return self;
  4870. },
  4871. args: [],
  4872. source: "shallowCopy\x0a\x09^self",
  4873. messageSends: [],
  4874. referencedClasses: []
  4875. }),
  4876. smalltalk.UndefinedObject);
  4877. smalltalk.addMethod(
  4878. "_subclass_instanceVariableNames_",
  4879. smalltalk.method({
  4880. selector: "subclass:instanceVariableNames:",
  4881. category: 'class creation',
  4882. fn: function (aString, anotherString) {
  4883. var self = this;
  4884. var $1;
  4885. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4886. return $1;
  4887. },
  4888. args: ["aString", "anotherString"],
  4889. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4890. messageSends: ["subclass:instanceVariableNames:package:"],
  4891. referencedClasses: []
  4892. }),
  4893. smalltalk.UndefinedObject);
  4894. smalltalk.addMethod(
  4895. "_subclass_instanceVariableNames_category_",
  4896. smalltalk.method({
  4897. selector: "subclass:instanceVariableNames:category:",
  4898. category: 'class creation',
  4899. fn: function (aString, aString2, aString3) {
  4900. var self = this;
  4901. var $1;
  4902. smalltalk.send(self, "_deprecatedAPI", []);
  4903. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4904. return $1;
  4905. },
  4906. args: ["aString", "aString2", "aString3"],
  4907. 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",
  4908. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4909. referencedClasses: []
  4910. }),
  4911. smalltalk.UndefinedObject);
  4912. smalltalk.addMethod(
  4913. "_subclass_instanceVariableNames_package_",
  4914. smalltalk.method({
  4915. selector: "subclass:instanceVariableNames:package:",
  4916. category: 'class creation',
  4917. fn: function (aString,aString2,aString3){
  4918. var self=this;
  4919. var $1;
  4920. $1=smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_superclass_subclass_instanceVariableNames_package_",[self,smalltalk.send(aString,"_asString",[]),aString2,aString3]);
  4921. return $1;
  4922. },
  4923. args: ["aString", "aString2", "aString3"],
  4924. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4925. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  4926. referencedClasses: ["ClassBuilder"]
  4927. }),
  4928. smalltalk.UndefinedObject);
  4929. smalltalk.addMethod(
  4930. "_new",
  4931. smalltalk.method({
  4932. selector: "new",
  4933. category: 'instance creation',
  4934. fn: function () {
  4935. var self = this;
  4936. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  4937. return self;
  4938. },
  4939. args: [],
  4940. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4941. messageSends: ["error:"],
  4942. referencedClasses: []
  4943. }),
  4944. smalltalk.UndefinedObject.klass);
  4945. smalltalk.addPackage('Kernel-Classes', {});
  4946. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  4947. smalltalk.Behavior.comment="Behavior is the superclass of all class objects. \x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances 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\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
  4948. smalltalk.addMethod(
  4949. "_addCompiledMethod_",
  4950. smalltalk.method({
  4951. selector: "addCompiledMethod:",
  4952. category: 'compiling',
  4953. fn: function (aMethod){
  4954. var self=this;
  4955. var $1,$2;
  4956. smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  4957. ;
  4958. $1=smalltalk.send((smalltalk.MethodAdded || MethodAdded),"_new",[]);
  4959. smalltalk.send($1,"_theClass_",[self]);
  4960. smalltalk.send($1,"_method_",[aMethod]);
  4961. $2=smalltalk.send($1,"_yourself",[]);
  4962. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  4963. return self},
  4964. args: ["aMethod"],
  4965. source: "addCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodAdded new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  4966. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  4967. referencedClasses: ["MethodAdded", "SystemAnnouncer"]
  4968. }),
  4969. smalltalk.Behavior);
  4970. smalltalk.addMethod(
  4971. "_allInstanceVariableNames",
  4972. smalltalk.method({
  4973. selector: "allInstanceVariableNames",
  4974. category: 'accessing',
  4975. fn: function (){
  4976. var self=this;
  4977. var $1;
  4978. var result;
  4979. result=smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_copy",[]);
  4980. $1=smalltalk.send(self,"_superclass",[]);
  4981. if(($receiver = $1) == nil || $receiver == undefined){
  4982. $1;
  4983. } else {
  4984. smalltalk.send(result,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allInstanceVariableNames",[])]);
  4985. };
  4986. return result;
  4987. },
  4988. args: [],
  4989. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  4990. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  4991. referencedClasses: []
  4992. }),
  4993. smalltalk.Behavior);
  4994. smalltalk.addMethod(
  4995. "_allSubclasses",
  4996. smalltalk.method({
  4997. selector: "allSubclasses",
  4998. category: 'accessing',
  4999. fn: function (){
  5000. var self=this;
  5001. var result;
  5002. result=smalltalk.send(self,"_subclasses",[]);
  5003. smalltalk.send(smalltalk.send(self,"_subclasses",[]),"_do_",[(function(each){
  5004. return smalltalk.send(result,"_addAll_",[smalltalk.send(each,"_allSubclasses",[])]);
  5005. })]);
  5006. return result;
  5007. },
  5008. args: [],
  5009. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  5010. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  5011. referencedClasses: []
  5012. }),
  5013. smalltalk.Behavior);
  5014. smalltalk.addMethod(
  5015. "_allSuperclasses",
  5016. smalltalk.method({
  5017. selector: "allSuperclasses",
  5018. category: 'accessing',
  5019. fn: function (){
  5020. var self=this;
  5021. var $1,$3,$4,$2;
  5022. $1=smalltalk.send(self,"_superclass",[]);
  5023. if(($receiver = $1) == nil || $receiver == undefined){
  5024. return [];
  5025. } else {
  5026. $1;
  5027. };
  5028. $3=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_with_",[smalltalk.send(self,"_superclass",[])]);
  5029. smalltalk.send($3,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allSuperclasses",[])]);
  5030. $4=smalltalk.send($3,"_yourself",[]);
  5031. $2=$4;
  5032. return $2;
  5033. },
  5034. args: [],
  5035. source: "allSuperclasses\x0a\x09\x0a self superclass ifNil: [ ^ #() ].\x0a \x0a\x09^ (OrderedCollection with: self superclass) \x0a \x09addAll: self superclass allSuperclasses;\x0a yourself",
  5036. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  5037. referencedClasses: ["OrderedCollection"]
  5038. }),
  5039. smalltalk.Behavior);
  5040. smalltalk.addMethod(
  5041. "_basicNew",
  5042. smalltalk.method({
  5043. selector: "basicNew",
  5044. category: 'instance creation',
  5045. fn: function (){
  5046. var self=this;
  5047. return new self.fn();
  5048. ;
  5049. return self},
  5050. args: [],
  5051. source: "basicNew\x0a\x09<return new self.fn()>",
  5052. messageSends: [],
  5053. referencedClasses: []
  5054. }),
  5055. smalltalk.Behavior);
  5056. smalltalk.addMethod(
  5057. "_canUnderstand_",
  5058. smalltalk.method({
  5059. selector: "canUnderstand:",
  5060. category: 'testing',
  5061. fn: function (aSelector){
  5062. var self=this;
  5063. var $1;
  5064. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]),"_includes_",[smalltalk.send(aSelector,"_asString",[])]),"_or_",[(function(){
  5065. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_superclass",[]),"_notNil",[]),"_and_",[(function(){
  5066. return smalltalk.send(smalltalk.send(self,"_superclass",[]),"_canUnderstand_",[aSelector]);
  5067. })]);
  5068. })]);
  5069. return $1;
  5070. },
  5071. args: ["aSelector"],
  5072. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  5073. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  5074. referencedClasses: []
  5075. }),
  5076. smalltalk.Behavior);
  5077. smalltalk.addMethod(
  5078. "_comment",
  5079. smalltalk.method({
  5080. selector: "comment",
  5081. category: 'accessing',
  5082. fn: function (){
  5083. var self=this;
  5084. var $2,$1;
  5085. $2=smalltalk.send(self,"_basicAt_",["comment"]);
  5086. if(($receiver = $2) == nil || $receiver == undefined){
  5087. $1="";
  5088. } else {
  5089. $1=$2;
  5090. };
  5091. return $1;
  5092. },
  5093. args: [],
  5094. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  5095. messageSends: ["ifNil:", "basicAt:"],
  5096. referencedClasses: []
  5097. }),
  5098. smalltalk.Behavior);
  5099. smalltalk.addMethod(
  5100. "_comment_",
  5101. smalltalk.method({
  5102. selector: "comment:",
  5103. category: 'accessing',
  5104. fn: function (aString){
  5105. var self=this;
  5106. var $1,$2;
  5107. smalltalk.send(self,"_basicAt_put_",["comment",aString]);
  5108. $1=smalltalk.send((smalltalk.ClassCommentChanged || ClassCommentChanged),"_new",[]);
  5109. smalltalk.send($1,"_theClass_",[self]);
  5110. $2=smalltalk.send($1,"_yourself",[]);
  5111. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5112. return self},
  5113. args: ["aString"],
  5114. source: "comment: aString\x0a self basicAt: 'comment' put: aString.\x0a SystemAnnouncer current\x0a \x09announce: (ClassCommentChanged new\x0a \x09theClass: self;\x0a yourself)",
  5115. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  5116. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  5117. }),
  5118. smalltalk.Behavior);
  5119. smalltalk.addMethod(
  5120. "_commentStamp",
  5121. smalltalk.method({
  5122. selector: "commentStamp",
  5123. category: 'accessing',
  5124. fn: function (){
  5125. var self=this;
  5126. var $2,$3,$1;
  5127. $2=smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader),"_new",[]);
  5128. smalltalk.send($2,"_class_",[self]);
  5129. $3=smalltalk.send($2,"_yourself",[]);
  5130. $1=$3;
  5131. return $1;
  5132. },
  5133. args: [],
  5134. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5135. messageSends: ["class:", "new", "yourself"],
  5136. referencedClasses: ["ClassCommentReader"]
  5137. }),
  5138. smalltalk.Behavior);
  5139. smalltalk.addMethod(
  5140. "_commentStamp_prior_",
  5141. smalltalk.method({
  5142. selector: "commentStamp:prior:",
  5143. category: 'accessing',
  5144. fn: function (aStamp,prior){
  5145. var self=this;
  5146. var $1;
  5147. $1=smalltalk.send(self,"_commentStamp",[]);
  5148. return $1;
  5149. },
  5150. args: ["aStamp", "prior"],
  5151. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  5152. messageSends: ["commentStamp"],
  5153. referencedClasses: []
  5154. }),
  5155. smalltalk.Behavior);
  5156. smalltalk.addMethod(
  5157. "_compile_",
  5158. smalltalk.method({
  5159. selector: "compile:",
  5160. category: 'compiling',
  5161. fn: function (aString){
  5162. var self=this;
  5163. smalltalk.send(self,"_compile_category_",[aString,""]);
  5164. return self},
  5165. args: ["aString"],
  5166. source: "compile: aString\x0a\x09self compile: aString category: ''",
  5167. messageSends: ["compile:category:"],
  5168. referencedClasses: []
  5169. }),
  5170. smalltalk.Behavior);
  5171. smalltalk.addMethod(
  5172. "_compile_category_",
  5173. smalltalk.method({
  5174. selector: "compile:category:",
  5175. category: 'compiling',
  5176. fn: function (aString,anotherString){
  5177. var self=this;
  5178. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self,anotherString]);
  5179. return self},
  5180. args: ["aString", "anotherString"],
  5181. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString \x0a forClass: self \x0a category: anotherString",
  5182. messageSends: ["install:forClass:category:", "new"],
  5183. referencedClasses: ["Compiler"]
  5184. }),
  5185. smalltalk.Behavior);
  5186. smalltalk.addMethod(
  5187. "_definition",
  5188. smalltalk.method({
  5189. selector: "definition",
  5190. category: 'accessing',
  5191. fn: function (){
  5192. var self=this;
  5193. return "";
  5194. },
  5195. args: [],
  5196. source: "definition\x0a\x09^ ''",
  5197. messageSends: [],
  5198. referencedClasses: []
  5199. }),
  5200. smalltalk.Behavior);
  5201. smalltalk.addMethod(
  5202. "_inheritsFrom_",
  5203. smalltalk.method({
  5204. selector: "inheritsFrom:",
  5205. category: 'testing',
  5206. fn: function (aClass){
  5207. var self=this;
  5208. var $1;
  5209. $1=smalltalk.send(smalltalk.send(aClass,"_allSubclasses",[]),"_includes_",[self]);
  5210. return $1;
  5211. },
  5212. args: ["aClass"],
  5213. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  5214. messageSends: ["includes:", "allSubclasses"],
  5215. referencedClasses: []
  5216. }),
  5217. smalltalk.Behavior);
  5218. smalltalk.addMethod(
  5219. "_instanceVariableNames",
  5220. smalltalk.method({
  5221. selector: "instanceVariableNames",
  5222. category: 'accessing',
  5223. fn: function (){
  5224. var self=this;
  5225. return self.iVarNames;
  5226. ;
  5227. return self},
  5228. args: [],
  5229. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5230. messageSends: [],
  5231. referencedClasses: []
  5232. }),
  5233. smalltalk.Behavior);
  5234. smalltalk.addMethod(
  5235. "_methodAt_",
  5236. smalltalk.method({
  5237. selector: "methodAt:",
  5238. category: 'accessing',
  5239. fn: function (aSymbol){
  5240. var self=this;
  5241. return smalltalk.methods(self)[aSymbol._asString()];
  5242. ;
  5243. return self},
  5244. args: ["aSymbol"],
  5245. source: "methodAt: aSymbol\x0a\x09<return smalltalk.methods(self)[aSymbol._asString()]>",
  5246. messageSends: [],
  5247. referencedClasses: []
  5248. }),
  5249. smalltalk.Behavior);
  5250. smalltalk.addMethod(
  5251. "_methodDictionary",
  5252. smalltalk.method({
  5253. selector: "methodDictionary",
  5254. category: 'accessing',
  5255. fn: function (){
  5256. var self=this;
  5257. var dict = smalltalk.HashedCollection._new();
  5258. var methods = self.fn.prototype.methods;
  5259. for(var i in methods) {
  5260. if(methods[i].selector) {
  5261. dict._at_put_(methods[i].selector, methods[i]);
  5262. }
  5263. };
  5264. return dict;
  5265. ;
  5266. return self},
  5267. args: [],
  5268. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.fn.prototype.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>",
  5269. messageSends: [],
  5270. referencedClasses: []
  5271. }),
  5272. smalltalk.Behavior);
  5273. smalltalk.addMethod(
  5274. "_methods",
  5275. smalltalk.method({
  5276. selector: "methods",
  5277. category: 'accessing',
  5278. fn: function (){
  5279. var self=this;
  5280. var $1;
  5281. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]);
  5282. return $1;
  5283. },
  5284. args: [],
  5285. source: "methods\x0a\x09^ self methodDictionary values",
  5286. messageSends: ["values", "methodDictionary"],
  5287. referencedClasses: []
  5288. }),
  5289. smalltalk.Behavior);
  5290. smalltalk.addMethod(
  5291. "_methodsFor_",
  5292. smalltalk.method({
  5293. selector: "methodsFor:",
  5294. category: 'accessing',
  5295. fn: function (aString){
  5296. var self=this;
  5297. var $2,$3,$1;
  5298. $2=smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader),"_new",[]);
  5299. smalltalk.send($2,"_class_category_",[self,aString]);
  5300. $3=smalltalk.send($2,"_yourself",[]);
  5301. $1=$3;
  5302. return $1;
  5303. },
  5304. args: ["aString"],
  5305. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  5306. messageSends: ["class:category:", "new", "yourself"],
  5307. referencedClasses: ["ClassCategoryReader"]
  5308. }),
  5309. smalltalk.Behavior);
  5310. smalltalk.addMethod(
  5311. "_methodsFor_stamp_",
  5312. smalltalk.method({
  5313. selector: "methodsFor:stamp:",
  5314. category: 'accessing',
  5315. fn: function (aString,aStamp){
  5316. var self=this;
  5317. var $1;
  5318. $1=smalltalk.send(self,"_methodsFor_",[aString]);
  5319. return $1;
  5320. },
  5321. args: ["aString", "aStamp"],
  5322. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  5323. messageSends: ["methodsFor:"],
  5324. referencedClasses: []
  5325. }),
  5326. smalltalk.Behavior);
  5327. smalltalk.addMethod(
  5328. "_methodsInProtocol_",
  5329. smalltalk.method({
  5330. selector: "methodsInProtocol:",
  5331. category: 'accessing',
  5332. fn: function (aString){
  5333. var self=this;
  5334. var $1;
  5335. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_select_",[(function(each){
  5336. return smalltalk.send(smalltalk.send(each,"_protocol",[]),"__eq",[aString]);
  5337. })]);
  5338. return $1;
  5339. },
  5340. args: ["aString"],
  5341. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  5342. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  5343. referencedClasses: []
  5344. }),
  5345. smalltalk.Behavior);
  5346. smalltalk.addMethod(
  5347. "_name",
  5348. smalltalk.method({
  5349. selector: "name",
  5350. category: 'accessing',
  5351. fn: function (){
  5352. var self=this;
  5353. return self.className || nil;
  5354. ;
  5355. return self},
  5356. args: [],
  5357. source: "name\x0a\x09<return self.className || nil>",
  5358. messageSends: [],
  5359. referencedClasses: []
  5360. }),
  5361. smalltalk.Behavior);
  5362. smalltalk.addMethod(
  5363. "_new",
  5364. smalltalk.method({
  5365. selector: "new",
  5366. category: 'instance creation',
  5367. fn: function (){
  5368. var self=this;
  5369. var $1;
  5370. $1=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  5371. return $1;
  5372. },
  5373. args: [],
  5374. source: "new\x0a\x09^self basicNew initialize",
  5375. messageSends: ["initialize", "basicNew"],
  5376. referencedClasses: []
  5377. }),
  5378. smalltalk.Behavior);
  5379. smalltalk.addMethod(
  5380. "_organization",
  5381. smalltalk.method({
  5382. selector: "organization",
  5383. category: 'accessing',
  5384. fn: function (){
  5385. var self=this;
  5386. var $1;
  5387. $1=smalltalk.send(self,"_basicAt_",["organization"]);
  5388. return $1;
  5389. },
  5390. args: [],
  5391. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5392. messageSends: ["basicAt:"],
  5393. referencedClasses: []
  5394. }),
  5395. smalltalk.Behavior);
  5396. smalltalk.addMethod(
  5397. "_protocols",
  5398. smalltalk.method({
  5399. selector: "protocols",
  5400. category: 'accessing',
  5401. fn: function (){
  5402. var self=this;
  5403. var $1;
  5404. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_organization",[]),"_elements",[]),"_sorted",[]);
  5405. return $1;
  5406. },
  5407. args: [],
  5408. source: "protocols\x0a ^ self organization elements sorted",
  5409. messageSends: ["sorted", "elements", "organization"],
  5410. referencedClasses: []
  5411. }),
  5412. smalltalk.Behavior);
  5413. smalltalk.addMethod(
  5414. "_protocolsDo_",
  5415. smalltalk.method({
  5416. selector: "protocolsDo:",
  5417. category: 'accessing',
  5418. fn: function (aBlock){
  5419. var self=this;
  5420. var methodsByCategory;
  5421. methodsByCategory=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  5422. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_do_",[(function(m){
  5423. return smalltalk.send(smalltalk.send(methodsByCategory,"_at_ifAbsentPut_",[smalltalk.send(m,"_category",[]),(function(){
  5424. return smalltalk.send((smalltalk.Array || Array),"_new",[]);
  5425. })]),"_add_",[m]);
  5426. })]);
  5427. smalltalk.send(smalltalk.send(self,"_protocols",[]),"_do_",[(function(category){
  5428. return smalltalk.send(aBlock,"_value_value_",[category,smalltalk.send(methodsByCategory,"_at_",[category])]);
  5429. })]);
  5430. return self},
  5431. args: ["aBlock"],
  5432. 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)]",
  5433. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  5434. referencedClasses: ["HashedCollection", "Array"]
  5435. }),
  5436. smalltalk.Behavior);
  5437. smalltalk.addMethod(
  5438. "_prototype",
  5439. smalltalk.method({
  5440. selector: "prototype",
  5441. category: 'accessing',
  5442. fn: function (){
  5443. var self=this;
  5444. return self.fn.prototype;
  5445. ;
  5446. return self},
  5447. args: [],
  5448. source: "prototype\x0a\x09<return self.fn.prototype>",
  5449. messageSends: [],
  5450. referencedClasses: []
  5451. }),
  5452. smalltalk.Behavior);
  5453. smalltalk.addMethod(
  5454. "_removeCompiledMethod_",
  5455. smalltalk.method({
  5456. selector: "removeCompiledMethod:",
  5457. category: 'compiling',
  5458. fn: function (aMethod){
  5459. var self=this;
  5460. var $1,$2;
  5461. smalltalk.removeMethod(aMethod)
  5462. smalltalk.init(self);
  5463. ;
  5464. ;
  5465. $1=smalltalk.send((smalltalk.MethodRemoved || MethodRemoved),"_new",[]);
  5466. smalltalk.send($1,"_theClass_",[self]);
  5467. smalltalk.send($1,"_method_",[aMethod]);
  5468. $2=smalltalk.send($1,"_yourself",[]);
  5469. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5470. return self},
  5471. args: ["aMethod"],
  5472. source: "removeCompiledMethod: aMethod\x0a\x09<\x0a \x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a >.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodRemoved new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  5473. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  5474. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  5475. }),
  5476. smalltalk.Behavior);
  5477. smalltalk.addMethod(
  5478. "_selectors",
  5479. smalltalk.method({
  5480. selector: "selectors",
  5481. category: 'accessing',
  5482. fn: function (){
  5483. var self=this;
  5484. var $1;
  5485. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]);
  5486. return $1;
  5487. },
  5488. args: [],
  5489. source: "selectors\x0a\x09^ self methodDictionary keys",
  5490. messageSends: ["keys", "methodDictionary"],
  5491. referencedClasses: []
  5492. }),
  5493. smalltalk.Behavior);
  5494. smalltalk.addMethod(
  5495. "_subclasses",
  5496. smalltalk.method({
  5497. selector: "subclasses",
  5498. category: 'accessing',
  5499. fn: function (){
  5500. var self=this;
  5501. return smalltalk.subclasses(self);
  5502. ;
  5503. return self},
  5504. args: [],
  5505. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  5506. messageSends: [],
  5507. referencedClasses: []
  5508. }),
  5509. smalltalk.Behavior);
  5510. smalltalk.addMethod(
  5511. "_superclass",
  5512. smalltalk.method({
  5513. selector: "superclass",
  5514. category: 'accessing',
  5515. fn: function (){
  5516. var self=this;
  5517. return self.superclass || nil;
  5518. ;
  5519. return self},
  5520. args: [],
  5521. source: "superclass\x0a\x09<return self.superclass || nil>",
  5522. messageSends: [],
  5523. referencedClasses: []
  5524. }),
  5525. smalltalk.Behavior);
  5526. smalltalk.addMethod(
  5527. "_theMetaClass",
  5528. smalltalk.method({
  5529. selector: "theMetaClass",
  5530. category: 'accessing',
  5531. fn: function (){
  5532. var self=this;
  5533. var $1;
  5534. $1=smalltalk.send(self,"_class",[]);
  5535. return $1;
  5536. },
  5537. args: [],
  5538. source: "theMetaClass\x0a\x09^ self class",
  5539. messageSends: ["class"],
  5540. referencedClasses: []
  5541. }),
  5542. smalltalk.Behavior);
  5543. smalltalk.addMethod(
  5544. "_theNonMetaClass",
  5545. smalltalk.method({
  5546. selector: "theNonMetaClass",
  5547. category: 'accessing',
  5548. fn: function (){
  5549. var self=this;
  5550. return self;
  5551. },
  5552. args: [],
  5553. source: "theNonMetaClass\x0a\x09^ self",
  5554. messageSends: [],
  5555. referencedClasses: []
  5556. }),
  5557. smalltalk.Behavior);
  5558. smalltalk.addMethod(
  5559. "_withAllSubclasses",
  5560. smalltalk.method({
  5561. selector: "withAllSubclasses",
  5562. category: 'accessing',
  5563. fn: function (){
  5564. var self=this;
  5565. var $2,$3,$1;
  5566. $2=smalltalk.send((smalltalk.Array || Array),"_with_",[self]);
  5567. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_allSubclasses",[])]);
  5568. $3=smalltalk.send($2,"_yourself",[]);
  5569. $1=$3;
  5570. return $1;
  5571. },
  5572. args: [],
  5573. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  5574. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  5575. referencedClasses: ["Array"]
  5576. }),
  5577. smalltalk.Behavior);
  5578. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  5579. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  5580. smalltalk.addMethod(
  5581. "_asJavascript",
  5582. smalltalk.method({
  5583. selector: "asJavascript",
  5584. category: 'converting',
  5585. fn: function (){
  5586. var self=this;
  5587. var $1;
  5588. $1=smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_name",[])]);
  5589. return $1;
  5590. },
  5591. args: [],
  5592. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  5593. messageSends: [",", "name"],
  5594. referencedClasses: []
  5595. }),
  5596. smalltalk.Class);
  5597. smalltalk.addMethod(
  5598. "_category",
  5599. smalltalk.method({
  5600. selector: "category",
  5601. category: 'accessing',
  5602. fn: function (){
  5603. var self=this;
  5604. var $2,$1;
  5605. $2=smalltalk.send(self,"_package",[]);
  5606. if(($receiver = $2) == nil || $receiver == undefined){
  5607. $1="Unclassified";
  5608. } else {
  5609. $1=smalltalk.send(smalltalk.send(self,"_package",[]),"_name",[]);
  5610. };
  5611. return $1;
  5612. },
  5613. args: [],
  5614. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  5615. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  5616. referencedClasses: []
  5617. }),
  5618. smalltalk.Class);
  5619. smalltalk.addMethod(
  5620. "_definition",
  5621. smalltalk.method({
  5622. selector: "definition",
  5623. category: 'accessing',
  5624. fn: function (){
  5625. var self=this;
  5626. var $2,$3,$1;
  5627. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5628. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_asString",[])]);
  5629. smalltalk.send(stream,"_nextPutAll_",[" subclass: #"]);
  5630. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_name",[])]);
  5631. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send((smalltalk.String || String),"_lf",[]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5632. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5633. $2;
  5634. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5635. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5636. }),(function(){
  5637. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5638. })]);
  5639. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5640. smalltalk.send(stream,"_nextPutAll_",["package: '"]);
  5641. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_category",[])]);
  5642. $3=smalltalk.send(stream,"_nextPutAll_",["'"]);
  5643. return $3;
  5644. })]);
  5645. return $1;
  5646. },
  5647. args: [],
  5648. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09nextPutAll: self superclass asString;\x0a\x09 \x09nextPutAll: ' subclass: #';\x0a\x09 \x09nextPutAll: self name;\x0a\x09 \x09nextPutAll: String lf, String tab;\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames \x0a \x09do: [ :each | stream nextPutAll: each ] \x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09 \x09nextPutAll: '''', String lf, String tab;\x0a\x09 \x09nextPutAll: 'package: ''';\x0a\x09 \x09nextPutAll: self category;\x0a\x09 \x09nextPutAll: '''' ]",
  5649. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  5650. referencedClasses: ["String"]
  5651. }),
  5652. smalltalk.Class);
  5653. smalltalk.addMethod(
  5654. "_isClass",
  5655. smalltalk.method({
  5656. selector: "isClass",
  5657. category: 'testing',
  5658. fn: function (){
  5659. var self=this;
  5660. return true;
  5661. },
  5662. args: [],
  5663. source: "isClass\x0a\x09^true",
  5664. messageSends: [],
  5665. referencedClasses: []
  5666. }),
  5667. smalltalk.Class);
  5668. smalltalk.addMethod(
  5669. "_package",
  5670. smalltalk.method({
  5671. selector: "package",
  5672. category: 'accessing',
  5673. fn: function (){
  5674. var self=this;
  5675. return self.pkg;
  5676. ;
  5677. return self},
  5678. args: [],
  5679. source: "package\x0a\x09<return self.pkg>",
  5680. messageSends: [],
  5681. referencedClasses: []
  5682. }),
  5683. smalltalk.Class);
  5684. smalltalk.addMethod(
  5685. "_package_",
  5686. smalltalk.method({
  5687. selector: "package:",
  5688. category: 'accessing',
  5689. fn: function (aPackage){
  5690. var self=this;
  5691. self.pkg = aPackage;
  5692. ;
  5693. return self},
  5694. args: ["aPackage"],
  5695. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  5696. messageSends: [],
  5697. referencedClasses: []
  5698. }),
  5699. smalltalk.Class);
  5700. smalltalk.addMethod(
  5701. "_printString",
  5702. smalltalk.method({
  5703. selector: "printString",
  5704. category: 'printing',
  5705. fn: function (){
  5706. var self=this;
  5707. var $1;
  5708. $1=smalltalk.send(self,"_name",[]);
  5709. return $1;
  5710. },
  5711. args: [],
  5712. source: "printString\x0a\x09^self name",
  5713. messageSends: ["name"],
  5714. referencedClasses: []
  5715. }),
  5716. smalltalk.Class);
  5717. smalltalk.addMethod(
  5718. "_rename_",
  5719. smalltalk.method({
  5720. selector: "rename:",
  5721. category: 'accessing',
  5722. fn: function (aString){
  5723. var self=this;
  5724. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_renameClass_to_",[self,aString]);
  5725. return self},
  5726. args: ["aString"],
  5727. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  5728. messageSends: ["renameClass:to:", "new"],
  5729. referencedClasses: ["ClassBuilder"]
  5730. }),
  5731. smalltalk.Class);
  5732. smalltalk.addMethod(
  5733. "_subclass_instanceVariableNames_",
  5734. smalltalk.method({
  5735. selector: "subclass:instanceVariableNames:",
  5736. category: 'class creation',
  5737. fn: function (aString,anotherString){
  5738. var self=this;
  5739. var $1;
  5740. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,anotherString,nil]);
  5741. return $1;
  5742. },
  5743. args: ["aString", "anotherString"],
  5744. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5745. messageSends: ["subclass:instanceVariableNames:package:"],
  5746. referencedClasses: []
  5747. }),
  5748. smalltalk.Class);
  5749. smalltalk.addMethod(
  5750. "_subclass_instanceVariableNames_category_",
  5751. smalltalk.method({
  5752. selector: "subclass:instanceVariableNames:category:",
  5753. category: 'class creation',
  5754. fn: function (aString,aString2,aString3){
  5755. var self=this;
  5756. var $1;
  5757. smalltalk.send(self,"_deprecatedAPI",[]);
  5758. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5759. return $1;
  5760. },
  5761. args: ["aString", "aString2", "aString3"],
  5762. 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",
  5763. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5764. referencedClasses: []
  5765. }),
  5766. smalltalk.Class);
  5767. smalltalk.addMethod(
  5768. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  5769. smalltalk.method({
  5770. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5771. category: 'class creation',
  5772. fn: function (aString,aString2,classVars,pools,aString3){
  5773. var self=this;
  5774. var $1;
  5775. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5776. return $1;
  5777. },
  5778. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5779. 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",
  5780. messageSends: ["subclass:instanceVariableNames:package:"],
  5781. referencedClasses: []
  5782. }),
  5783. smalltalk.Class);
  5784. smalltalk.addMethod(
  5785. "_subclass_instanceVariableNames_package_",
  5786. smalltalk.method({
  5787. selector: "subclass:instanceVariableNames:package:",
  5788. category: 'class creation',
  5789. fn: function (aString,aString2,aString3){
  5790. var self=this;
  5791. var $1;
  5792. $1=smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_superclass_subclass_instanceVariableNames_package_",[self,smalltalk.send(aString,"_asString",[]),aString2,aString3]);
  5793. return $1;
  5794. },
  5795. args: ["aString", "aString2", "aString3"],
  5796. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5797. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5798. referencedClasses: ["ClassBuilder"]
  5799. }),
  5800. smalltalk.Class);
  5801. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  5802. smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class. \x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
  5803. smalltalk.addMethod(
  5804. "_asJavascript",
  5805. smalltalk.method({
  5806. selector: "asJavascript",
  5807. category: 'converting',
  5808. fn: function (){
  5809. var self=this;
  5810. var $1;
  5811. $1=smalltalk.send(smalltalk.send("smalltalk.","__comma",[smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[])]),"__comma",[".klass"]);
  5812. return $1;
  5813. },
  5814. args: [],
  5815. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  5816. messageSends: [",", "name", "instanceClass"],
  5817. referencedClasses: []
  5818. }),
  5819. smalltalk.Metaclass);
  5820. smalltalk.addMethod(
  5821. "_definition",
  5822. smalltalk.method({
  5823. selector: "definition",
  5824. category: 'accessing',
  5825. fn: function (){
  5826. var self=this;
  5827. var $2,$1;
  5828. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5829. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_asString",[])]);
  5830. smalltalk.send(stream,"_nextPutAll_",[" class "]);
  5831. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5832. $2;
  5833. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5834. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5835. }),(function(){
  5836. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5837. })]);
  5838. return smalltalk.send(stream,"_nextPutAll_",["'"]);
  5839. })]);
  5840. return $1;
  5841. },
  5842. args: [],
  5843. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09 \x09nextPutAll: self asString;\x0a\x09 \x09nextPutAll: ' class ';\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09 \x09do: [ :each | stream nextPutAll: each ]\x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  5844. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  5845. referencedClasses: ["String"]
  5846. }),
  5847. smalltalk.Metaclass);
  5848. smalltalk.addMethod(
  5849. "_instanceClass",
  5850. smalltalk.method({
  5851. selector: "instanceClass",
  5852. category: 'accessing',
  5853. fn: function (){
  5854. var self=this;
  5855. return self.instanceClass;
  5856. ;
  5857. return self},
  5858. args: [],
  5859. source: "instanceClass\x0a\x09<return self.instanceClass>",
  5860. messageSends: [],
  5861. referencedClasses: []
  5862. }),
  5863. smalltalk.Metaclass);
  5864. smalltalk.addMethod(
  5865. "_instanceVariableNames_",
  5866. smalltalk.method({
  5867. selector: "instanceVariableNames:",
  5868. category: 'accessing',
  5869. fn: function (aCollection){
  5870. var self=this;
  5871. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_class_instanceVariableNames_",[self,aCollection]);
  5872. return self},
  5873. args: ["aCollection"],
  5874. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  5875. messageSends: ["class:instanceVariableNames:", "new"],
  5876. referencedClasses: ["ClassBuilder"]
  5877. }),
  5878. smalltalk.Metaclass);
  5879. smalltalk.addMethod(
  5880. "_isMetaclass",
  5881. smalltalk.method({
  5882. selector: "isMetaclass",
  5883. category: 'testing',
  5884. fn: function (){
  5885. var self=this;
  5886. return true;
  5887. },
  5888. args: [],
  5889. source: "isMetaclass\x0a\x09^true",
  5890. messageSends: [],
  5891. referencedClasses: []
  5892. }),
  5893. smalltalk.Metaclass);
  5894. smalltalk.addMethod(
  5895. "_printString",
  5896. smalltalk.method({
  5897. selector: "printString",
  5898. category: 'printing',
  5899. fn: function (){
  5900. var self=this;
  5901. var $1;
  5902. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
  5903. return $1;
  5904. },
  5905. args: [],
  5906. source: "printString\x0a\x09^self instanceClass name, ' class'",
  5907. messageSends: [",", "name", "instanceClass"],
  5908. referencedClasses: []
  5909. }),
  5910. smalltalk.Metaclass);
  5911. smalltalk.addMethod(
  5912. "_theMetaClass",
  5913. smalltalk.method({
  5914. selector: "theMetaClass",
  5915. category: 'accessing',
  5916. fn: function (){
  5917. var self=this;
  5918. return self;
  5919. },
  5920. args: [],
  5921. source: "theMetaClass\x0a\x09^ self",
  5922. messageSends: [],
  5923. referencedClasses: []
  5924. }),
  5925. smalltalk.Metaclass);
  5926. smalltalk.addMethod(
  5927. "_theNonMetaClass",
  5928. smalltalk.method({
  5929. selector: "theNonMetaClass",
  5930. category: 'accessing',
  5931. fn: function (){
  5932. var self=this;
  5933. var $1;
  5934. $1=smalltalk.send(self,"_instanceClass",[]);
  5935. return $1;
  5936. },
  5937. args: [],
  5938. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  5939. messageSends: ["instanceClass"],
  5940. referencedClasses: []
  5941. }),
  5942. smalltalk.Metaclass);
  5943. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  5944. smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
  5945. smalltalk.addMethod(
  5946. "_addSubclassOf_named_instanceVariableNames_",
  5947. smalltalk.method({
  5948. selector: "addSubclassOf:named:instanceVariableNames:",
  5949. category: 'private',
  5950. fn: function (aClass,aString,aCollection){
  5951. var self=this;
  5952. smalltalk.addClass(aString, aClass, aCollection);
  5953. return smalltalk[aString];
  5954. ;
  5955. return self},
  5956. args: ["aClass", "aString", "aCollection"],
  5957. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection\x0a\x09<smalltalk.addClass(aString, aClass, aCollection);\x0a\x09 return smalltalk[aString]>",
  5958. messageSends: [],
  5959. referencedClasses: []
  5960. }),
  5961. smalltalk.ClassBuilder);
  5962. smalltalk.addMethod(
  5963. "_addSubclassOf_named_instanceVariableNames_package_",
  5964. smalltalk.method({
  5965. selector: "addSubclassOf:named:instanceVariableNames:package:",
  5966. category: 'private',
  5967. fn: function (aClass,aString,aCollection,packageName){
  5968. var self=this;
  5969. smalltalk.addClass(aString, aClass, aCollection, packageName);
  5970. return smalltalk[aString];
  5971. ;
  5972. return self},
  5973. args: ["aClass", "aString", "aCollection", "packageName"],
  5974. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09 return smalltalk[aString]>",
  5975. messageSends: [],
  5976. referencedClasses: []
  5977. }),
  5978. smalltalk.ClassBuilder);
  5979. smalltalk.addMethod(
  5980. "_class_instanceVariableNames_",
  5981. smalltalk.method({
  5982. selector: "class:instanceVariableNames:",
  5983. category: 'class creation',
  5984. fn: function (aClass,aString){
  5985. var self=this;
  5986. var $1,$2,$3;
  5987. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  5988. if(! smalltalk.assert($1)){
  5989. smalltalk.send(self,"_error_",[smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" is not a metaclass"])]);
  5990. };
  5991. smalltalk.send(aClass,"_basicAt_put_",["iVarNames",smalltalk.send(self,"_instanceVariableNamesFor_",[aString])]);
  5992. $2=smalltalk.send((smalltalk.ClassDefinitionChanged || ClassDefinitionChanged),"_new",[]);
  5993. smalltalk.send($2,"_theClass_",[aClass]);
  5994. $3=smalltalk.send($2,"_yourself",[]);
  5995. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  5996. smalltalk.send(self,"_setupClass_",[aClass]);
  5997. return self},
  5998. args: ["aClass", "aString"],
  5999. source: "class: aClass instanceVariableNames: aString\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassDefinitionChanged new\x0a \x09theClass: aClass;\x0a yourself).\x0a \x0a\x09self setupClass: aClass",
  6000. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:", "instanceVariableNamesFor:", "announce:", "theClass:", "new", "yourself", "current", "setupClass:"],
  6001. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  6002. }),
  6003. smalltalk.ClassBuilder);
  6004. smalltalk.addMethod(
  6005. "_copyClass_named_",
  6006. smalltalk.method({
  6007. selector: "copyClass:named:",
  6008. category: 'private',
  6009. fn: function (aClass,aString){
  6010. var self=this;
  6011. var newClass;
  6012. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[smalltalk.send(aClass,"_superclass",[]),aString,smalltalk.send(aClass,"_instanceVariableNames",[]),smalltalk.send(smalltalk.send(aClass,"_package",[]),"_name",[])]);
  6013. smalltalk.send(self,"_setupClass_",[newClass]);
  6014. smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  6015. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),newClass,smalltalk.send(each,"_category",[])]);
  6016. })]);
  6017. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  6018. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),smalltalk.send(newClass,"_class",[]),smalltalk.send(each,"_category",[])]);
  6019. })]);
  6020. smalltalk.send(self,"_setupClass_",[newClass]);
  6021. return newClass;
  6022. },
  6023. args: ["aClass", "aString"],
  6024. source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self \x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString \x0a\x09\x09instanceVariableNames: aClass instanceVariableNames \x0a\x09\x09package: aClass package name.\x0a\x0a\x09self setupClass: newClass.\x0a\x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass category: each category].\x0a\x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass class category: each category].\x0a\x0a\x09self setupClass: newClass.\x0a\x09^newClass",
  6025. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "class"],
  6026. referencedClasses: ["Compiler"]
  6027. }),
  6028. smalltalk.ClassBuilder);
  6029. smalltalk.addMethod(
  6030. "_instanceVariableNamesFor_",
  6031. smalltalk.method({
  6032. selector: "instanceVariableNamesFor:",
  6033. category: 'private',
  6034. fn: function (aString){
  6035. var self=this;
  6036. var $1;
  6037. $1=smalltalk.send(smalltalk.send(aString,"_tokenize_",[" "]),"_reject_",[(function(each){
  6038. return smalltalk.send(each,"_isEmpty",[]);
  6039. })]);
  6040. return $1;
  6041. },
  6042. args: ["aString"],
  6043. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [:each | each isEmpty]",
  6044. messageSends: ["reject:", "isEmpty", "tokenize:"],
  6045. referencedClasses: []
  6046. }),
  6047. smalltalk.ClassBuilder);
  6048. smalltalk.addMethod(
  6049. "_renameClass_to_",
  6050. smalltalk.method({
  6051. selector: "renameClass:to:",
  6052. category: 'class creation',
  6053. fn: function (aClass,aString){
  6054. var self=this;
  6055. var $1,$2;
  6056. smalltalk[aString] = aClass;
  6057. delete smalltalk[aClass.className];
  6058. aClass.className = aString;
  6059. ;
  6060. ;
  6061. $1=smalltalk.send((smalltalk.ClassRenamed || ClassRenamed),"_new",[]);
  6062. smalltalk.send($1,"_theClass_",[aClass]);
  6063. $2=smalltalk.send($1,"_yourself",[]);
  6064. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  6065. return self},
  6066. args: ["aClass", "aString"],
  6067. source: "renameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRenamed new\x0a \x09theClass: aClass;\x0a yourself)\x0a \x09",
  6068. messageSends: ["announce:", "theClass:", "new", "yourself", "current"],
  6069. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  6070. }),
  6071. smalltalk.ClassBuilder);
  6072. smalltalk.addMethod(
  6073. "_setupClass_",
  6074. smalltalk.method({
  6075. selector: "setupClass:",
  6076. category: 'private',
  6077. fn: function (aClass){
  6078. var self=this;
  6079. smalltalk.init(aClass);;
  6080. ;
  6081. return self},
  6082. args: ["aClass"],
  6083. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  6084. messageSends: [],
  6085. referencedClasses: []
  6086. }),
  6087. smalltalk.ClassBuilder);
  6088. smalltalk.addMethod(
  6089. "_superclass_subclass_",
  6090. smalltalk.method({
  6091. selector: "superclass:subclass:",
  6092. category: 'class creation',
  6093. fn: function (aClass,aString){
  6094. var self=this;
  6095. var $1;
  6096. $1=smalltalk.send(self,"_superclass_subclass_instanceVariableNames_package_",[aClass,aString,"",nil]);
  6097. return $1;
  6098. },
  6099. args: ["aClass", "aString"],
  6100. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  6101. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6102. referencedClasses: []
  6103. }),
  6104. smalltalk.ClassBuilder);
  6105. smalltalk.addMethod(
  6106. "_superclass_subclass_instanceVariableNames_package_",
  6107. smalltalk.method({
  6108. selector: "superclass:subclass:instanceVariableNames:package:",
  6109. category: 'class creation',
  6110. fn: function (aClass,aString,aString2,aString3){
  6111. var self=this;
  6112. var $1,$2,$3;
  6113. var newClass;
  6114. if(($receiver = aString3) == nil || $receiver == undefined){
  6115. $1="unclassified";
  6116. } else {
  6117. $1=aString3;
  6118. };
  6119. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[aClass,aString,smalltalk.send(self,"_instanceVariableNamesFor_",[aString2]),$1]);
  6120. smalltalk.send(self,"_setupClass_",[newClass]);
  6121. $2=smalltalk.send((smalltalk.ClassAdded || ClassAdded),"_new",[]);
  6122. smalltalk.send($2,"_theClass_",[newClass]);
  6123. $3=smalltalk.send($2,"_yourself",[]);
  6124. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  6125. return newClass;
  6126. },
  6127. args: ["aClass", "aString", "aString2", "aString3"],
  6128. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a \x0a SystemAnnouncer current \x0a \x09announce: (ClassAdded new\x0a \x09theClass: newClass;\x0a yourself).\x0a \x0a\x09^newClass",
  6129. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  6130. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  6131. }),
  6132. smalltalk.ClassBuilder);
  6133. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  6134. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  6135. smalltalk.addMethod(
  6136. "_class_category_",
  6137. smalltalk.method({
  6138. selector: "class:category:",
  6139. category: 'accessing',
  6140. fn: function (aClass,aString){
  6141. var self=this;
  6142. self["@class"]=aClass;
  6143. self["@category"]=aString;
  6144. return self},
  6145. args: ["aClass", "aString"],
  6146. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6147. messageSends: [],
  6148. referencedClasses: []
  6149. }),
  6150. smalltalk.ClassCategoryReader);
  6151. smalltalk.addMethod(
  6152. "_compileMethod_",
  6153. smalltalk.method({
  6154. selector: "compileMethod:",
  6155. category: 'private',
  6156. fn: function (aString){
  6157. var self=this;
  6158. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self["@class"],self["@category"]]);
  6159. return self},
  6160. args: ["aString"],
  6161. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  6162. messageSends: ["install:forClass:category:", "new"],
  6163. referencedClasses: ["Compiler"]
  6164. }),
  6165. smalltalk.ClassCategoryReader);
  6166. smalltalk.addMethod(
  6167. "_initialize",
  6168. smalltalk.method({
  6169. selector: "initialize",
  6170. category: 'initialization',
  6171. fn: function (){
  6172. var self=this;
  6173. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6174. return self},
  6175. args: [],
  6176. source: "initialize\x0a\x09super initialize.",
  6177. messageSends: ["initialize"],
  6178. referencedClasses: []
  6179. }),
  6180. smalltalk.ClassCategoryReader);
  6181. smalltalk.addMethod(
  6182. "_scanFrom_",
  6183. smalltalk.method({
  6184. selector: "scanFrom:",
  6185. category: 'fileIn',
  6186. fn: function (aChunkParser){
  6187. var self=this;
  6188. var chunk;
  6189. smalltalk.send((function(){
  6190. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6191. chunk;
  6192. return smalltalk.send(chunk,"_isEmpty",[]);
  6193. }),"_whileFalse_",[(function(){
  6194. return smalltalk.send(self,"_compileMethod_",[chunk]);
  6195. })]);
  6196. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_setupClass_",[self["@class"]]);
  6197. return self},
  6198. args: ["aChunkParser"],
  6199. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09 self compileMethod: chunk].\x0a\x09Compiler new setupClass: class",
  6200. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  6201. referencedClasses: ["Compiler"]
  6202. }),
  6203. smalltalk.ClassCategoryReader);
  6204. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  6205. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.\x0aSee `ClassCategoryReader` too."
  6206. smalltalk.addMethod(
  6207. "_class_",
  6208. smalltalk.method({
  6209. selector: "class:",
  6210. category: 'accessing',
  6211. fn: function (aClass){
  6212. var self=this;
  6213. self["@class"]=aClass;
  6214. return self},
  6215. args: ["aClass"],
  6216. source: "class: aClass\x0a\x09class := aClass",
  6217. messageSends: [],
  6218. referencedClasses: []
  6219. }),
  6220. smalltalk.ClassCommentReader);
  6221. smalltalk.addMethod(
  6222. "_initialize",
  6223. smalltalk.method({
  6224. selector: "initialize",
  6225. category: 'initialization',
  6226. fn: function (){
  6227. var self=this;
  6228. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6229. return self},
  6230. args: [],
  6231. source: "initialize\x0a\x09super initialize.",
  6232. messageSends: ["initialize"],
  6233. referencedClasses: []
  6234. }),
  6235. smalltalk.ClassCommentReader);
  6236. smalltalk.addMethod(
  6237. "_scanFrom_",
  6238. smalltalk.method({
  6239. selector: "scanFrom:",
  6240. category: 'fileIn',
  6241. fn: function (aChunkParser){
  6242. var self=this;
  6243. var $1;
  6244. var chunk;
  6245. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6246. $1=smalltalk.send(chunk,"_isEmpty",[]);
  6247. if(! smalltalk.assert($1)){
  6248. smalltalk.send(self,"_setComment_",[chunk]);
  6249. };
  6250. return self},
  6251. args: ["aChunkParser"],
  6252. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  6253. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  6254. referencedClasses: []
  6255. }),
  6256. smalltalk.ClassCommentReader);
  6257. smalltalk.addMethod(
  6258. "_setComment_",
  6259. smalltalk.method({
  6260. selector: "setComment:",
  6261. category: 'private',
  6262. fn: function (aString){
  6263. var self=this;
  6264. smalltalk.send(self["@class"],"_comment_",[aString]);
  6265. return self},
  6266. args: ["aString"],
  6267. source: "setComment: aString\x0a class comment: aString",
  6268. messageSends: ["comment:"],
  6269. referencedClasses: []
  6270. }),
  6271. smalltalk.ClassCommentReader);
  6272. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  6273. smalltalk.addMethod(
  6274. "_getNodesFrom_",
  6275. smalltalk.method({
  6276. selector: "getNodesFrom:",
  6277. category: 'accessing',
  6278. fn: function (aCollection){
  6279. var self=this;
  6280. var $1;
  6281. var children;
  6282. var others;
  6283. children=[];
  6284. others=[];
  6285. smalltalk.send(aCollection,"_do_",[(function(each){
  6286. $1=smalltalk.send(smalltalk.send(each,"_superclass",[]),"__eq",[smalltalk.send(self,"_theClass",[])]);
  6287. if(smalltalk.assert($1)){
  6288. return smalltalk.send(children,"_add_",[each]);
  6289. } else {
  6290. return smalltalk.send(others,"_add_",[each]);
  6291. };
  6292. })]);
  6293. self["@nodes"]=smalltalk.send(children,"_collect_",[(function(each){
  6294. return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode),"_on_classes_level_",[each,others,smalltalk.send(smalltalk.send(self,"_level",[]),"__plus",[(1)])]);
  6295. })]);
  6296. return self},
  6297. args: ["aCollection"],
  6298. 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]",
  6299. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  6300. referencedClasses: ["ClassSorterNode"]
  6301. }),
  6302. smalltalk.ClassSorterNode);
  6303. smalltalk.addMethod(
  6304. "_level",
  6305. smalltalk.method({
  6306. selector: "level",
  6307. category: 'accessing',
  6308. fn: function (){
  6309. var self=this;
  6310. return self["@level"];
  6311. },
  6312. args: [],
  6313. source: "level\x0a\x09^level",
  6314. messageSends: [],
  6315. referencedClasses: []
  6316. }),
  6317. smalltalk.ClassSorterNode);
  6318. smalltalk.addMethod(
  6319. "_level_",
  6320. smalltalk.method({
  6321. selector: "level:",
  6322. category: 'accessing',
  6323. fn: function (anInteger){
  6324. var self=this;
  6325. self["@level"]=anInteger;
  6326. return self},
  6327. args: ["anInteger"],
  6328. source: "level: anInteger\x0a\x09level := anInteger",
  6329. messageSends: [],
  6330. referencedClasses: []
  6331. }),
  6332. smalltalk.ClassSorterNode);
  6333. smalltalk.addMethod(
  6334. "_nodes",
  6335. smalltalk.method({
  6336. selector: "nodes",
  6337. category: 'accessing',
  6338. fn: function (){
  6339. var self=this;
  6340. return self["@nodes"];
  6341. },
  6342. args: [],
  6343. source: "nodes\x0a\x09^nodes",
  6344. messageSends: [],
  6345. referencedClasses: []
  6346. }),
  6347. smalltalk.ClassSorterNode);
  6348. smalltalk.addMethod(
  6349. "_theClass",
  6350. smalltalk.method({
  6351. selector: "theClass",
  6352. category: 'accessing',
  6353. fn: function (){
  6354. var self=this;
  6355. return self["@theClass"];
  6356. },
  6357. args: [],
  6358. source: "theClass\x0a\x09^theClass",
  6359. messageSends: [],
  6360. referencedClasses: []
  6361. }),
  6362. smalltalk.ClassSorterNode);
  6363. smalltalk.addMethod(
  6364. "_theClass_",
  6365. smalltalk.method({
  6366. selector: "theClass:",
  6367. category: 'accessing',
  6368. fn: function (aClass){
  6369. var self=this;
  6370. self["@theClass"]=aClass;
  6371. return self},
  6372. args: ["aClass"],
  6373. source: "theClass: aClass\x0a\x09theClass := aClass",
  6374. messageSends: [],
  6375. referencedClasses: []
  6376. }),
  6377. smalltalk.ClassSorterNode);
  6378. smalltalk.addMethod(
  6379. "_traverseClassesWith_",
  6380. smalltalk.method({
  6381. selector: "traverseClassesWith:",
  6382. category: 'visiting',
  6383. fn: function (aCollection){
  6384. var self=this;
  6385. smalltalk.send(aCollection,"_add_",[smalltalk.send(self,"_theClass",[])]);
  6386. smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_sorted_",[(function(a,b){
  6387. return smalltalk.send(smalltalk.send(smalltalk.send(a,"_theClass",[]),"_name",[]),"__lt_eq",[smalltalk.send(smalltalk.send(b,"_theClass",[]),"_name",[])]);
  6388. })]),"_do_",[(function(aNode){
  6389. return smalltalk.send(aNode,"_traverseClassesWith_",[aCollection]);
  6390. })]);
  6391. return self},
  6392. args: ["aCollection"],
  6393. 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 ].",
  6394. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  6395. referencedClasses: []
  6396. }),
  6397. smalltalk.ClassSorterNode);
  6398. smalltalk.addMethod(
  6399. "_on_classes_level_",
  6400. smalltalk.method({
  6401. selector: "on:classes:level:",
  6402. category: 'instance creation',
  6403. fn: function (aClass,aCollection,anInteger){
  6404. var self=this;
  6405. var $2,$3,$1;
  6406. $2=smalltalk.send(self,"_new",[]);
  6407. smalltalk.send($2,"_theClass_",[aClass]);
  6408. smalltalk.send($2,"_level_",[anInteger]);
  6409. smalltalk.send($2,"_getNodesFrom_",[aCollection]);
  6410. $3=smalltalk.send($2,"_yourself",[]);
  6411. $1=$3;
  6412. return $1;
  6413. },
  6414. args: ["aClass", "aCollection", "anInteger"],
  6415. 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",
  6416. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  6417. referencedClasses: []
  6418. }),
  6419. smalltalk.ClassSorterNode.klass);
  6420. smalltalk.addPackage('Kernel-Methods', {});
  6421. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  6422. smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
  6423. smalltalk.addMethod(
  6424. "_applyTo_arguments_",
  6425. smalltalk.method({
  6426. selector: "applyTo:arguments:",
  6427. category: 'evaluating',
  6428. fn: function (anObject, aCollection) {
  6429. var self = this;
  6430. return self.apply(anObject, aCollection);
  6431. return self;
  6432. },
  6433. args: ["anObject", "aCollection"],
  6434. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  6435. messageSends: [],
  6436. referencedClasses: []
  6437. }),
  6438. smalltalk.BlockClosure);
  6439. smalltalk.addMethod(
  6440. "_compiledSource",
  6441. smalltalk.method({
  6442. selector: "compiledSource",
  6443. category: 'accessing',
  6444. fn: function () {
  6445. var self = this;
  6446. return self.toString();
  6447. return self;
  6448. },
  6449. args: [],
  6450. source: "compiledSource\x0a\x09<return self.toString()>",
  6451. messageSends: [],
  6452. referencedClasses: []
  6453. }),
  6454. smalltalk.BlockClosure);
  6455. smalltalk.addMethod(
  6456. "_ensure_",
  6457. smalltalk.method({
  6458. selector: "ensure:",
  6459. category: 'evaluating',
  6460. fn: function (aBlock){
  6461. var self=this;
  6462. try{return self()}finally{aBlock._value()};
  6463. ;
  6464. return self},
  6465. args: ["aBlock"],
  6466. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  6467. messageSends: [],
  6468. referencedClasses: []
  6469. }),
  6470. smalltalk.BlockClosure);
  6471. smalltalk.addMethod(
  6472. "_fork",
  6473. smalltalk.method({
  6474. selector: "fork",
  6475. category: 'timeout/interval',
  6476. fn: function (){
  6477. var self=this;
  6478. smalltalk.send(smalltalk.send((smalltalk.ForkPool || ForkPool),"_default",[]),"_fork_",[self]);
  6479. return self},
  6480. args: [],
  6481. source: "fork\x0a\x09ForkPool default fork: self",
  6482. messageSends: ["fork:", "default"],
  6483. referencedClasses: ["ForkPool"]
  6484. }),
  6485. smalltalk.BlockClosure);
  6486. smalltalk.addMethod(
  6487. "_new",
  6488. smalltalk.method({
  6489. selector: "new",
  6490. category: 'evaluating',
  6491. fn: function () {
  6492. var self = this;
  6493. return new self;
  6494. return self;
  6495. },
  6496. args: [],
  6497. 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()>",
  6498. messageSends: [],
  6499. referencedClasses: []
  6500. }),
  6501. smalltalk.BlockClosure);
  6502. smalltalk.addMethod(
  6503. "_newValue_",
  6504. smalltalk.method({
  6505. selector: "newValue:",
  6506. category: 'evaluating',
  6507. fn: function (anObject) {
  6508. var self = this;
  6509. return new self(anObject);
  6510. return self;
  6511. },
  6512. args: ["anObject"],
  6513. source: "newValue: anObject\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(anObject)>",
  6514. messageSends: [],
  6515. referencedClasses: []
  6516. }),
  6517. smalltalk.BlockClosure);
  6518. smalltalk.addMethod(
  6519. "_newValue_value_",
  6520. smalltalk.method({
  6521. selector: "newValue:value:",
  6522. category: 'evaluating',
  6523. fn: function (anObject, anObject2) {
  6524. var self = this;
  6525. return new self(anObject, anObject2);
  6526. return self;
  6527. },
  6528. args: ["anObject", "anObject2"],
  6529. source: "newValue: anObject value: anObject2\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(anObject, anObject2)>",
  6530. messageSends: [],
  6531. referencedClasses: []
  6532. }),
  6533. smalltalk.BlockClosure);
  6534. smalltalk.addMethod(
  6535. "_newValue_value_value_",
  6536. smalltalk.method({
  6537. selector: "newValue:value:value:",
  6538. category: 'evaluating',
  6539. fn: function (anObject, anObject2, anObject3) {
  6540. var self = this;
  6541. return new self(anObject, anObject2);
  6542. return self;
  6543. },
  6544. args: ["anObject", "anObject2", "anObject3"],
  6545. source: "newValue: anObject value: anObject2 value: anObject3\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(anObject, anObject2)>",
  6546. messageSends: [],
  6547. referencedClasses: []
  6548. }),
  6549. smalltalk.BlockClosure);
  6550. smalltalk.addMethod(
  6551. "_numArgs",
  6552. smalltalk.method({
  6553. selector: "numArgs",
  6554. category: 'accessing',
  6555. fn: function () {
  6556. var self = this;
  6557. return self.length;
  6558. return self;
  6559. },
  6560. args: [],
  6561. source: "numArgs\x0a\x09<return self.length>",
  6562. messageSends: [],
  6563. referencedClasses: []
  6564. }),
  6565. smalltalk.BlockClosure);
  6566. smalltalk.addMethod(
  6567. "_on_do_",
  6568. smalltalk.method({
  6569. selector: "on:do:",
  6570. category: 'error handling',
  6571. fn: function (anErrorClass, aBlock) {
  6572. var self = this;
  6573. var $2, $1;
  6574. $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
  6575. return $1;
  6576. },
  6577. args: ["anErrorClass", "aBlock"],
  6578. source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (error isKindOf: anErrorClass) \x0a\x09 ifTrue: [aBlock value: error]\x0a\x09 ifFalse: [error signal]]",
  6579. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  6580. referencedClasses: []
  6581. }),
  6582. smalltalk.BlockClosure);
  6583. smalltalk.addMethod(
  6584. "_timeToRun",
  6585. smalltalk.method({
  6586. selector: "timeToRun",
  6587. category: 'evaluating',
  6588. fn: function () {
  6589. var self = this;
  6590. var $1;
  6591. $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
  6592. return $1;
  6593. },
  6594. args: [],
  6595. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  6596. messageSends: ["millisecondsToRun:"],
  6597. referencedClasses: ["Date"]
  6598. }),
  6599. smalltalk.BlockClosure);
  6600. smalltalk.addMethod(
  6601. "_value",
  6602. smalltalk.method({
  6603. selector: "value",
  6604. category: 'evaluating',
  6605. fn: function () {
  6606. var self = this;
  6607. return self();
  6608. return self;
  6609. },
  6610. args: [],
  6611. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  6612. messageSends: [],
  6613. referencedClasses: []
  6614. }),
  6615. smalltalk.BlockClosure);
  6616. smalltalk.addMethod(
  6617. "_value_",
  6618. smalltalk.method({
  6619. selector: "value:",
  6620. category: 'evaluating',
  6621. fn: function (anArg) {
  6622. var self = this;
  6623. return self(anArg);
  6624. return self;
  6625. },
  6626. args: ["anArg"],
  6627. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  6628. messageSends: [],
  6629. referencedClasses: []
  6630. }),
  6631. smalltalk.BlockClosure);
  6632. smalltalk.addMethod(
  6633. "_value_value_",
  6634. smalltalk.method({
  6635. selector: "value:value:",
  6636. category: 'evaluating',
  6637. fn: function (firstArg, secondArg) {
  6638. var self = this;
  6639. return self(firstArg, secondArg);
  6640. return self;
  6641. },
  6642. args: ["firstArg", "secondArg"],
  6643. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  6644. messageSends: [],
  6645. referencedClasses: []
  6646. }),
  6647. smalltalk.BlockClosure);
  6648. smalltalk.addMethod(
  6649. "_value_value_value_",
  6650. smalltalk.method({
  6651. selector: "value:value:value:",
  6652. category: 'evaluating',
  6653. fn: function (firstArg, secondArg, thirdArg) {
  6654. var self = this;
  6655. return self(firstArg, secondArg, thirdArg);
  6656. return self;
  6657. },
  6658. args: ["firstArg", "secondArg", "thirdArg"],
  6659. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  6660. messageSends: [],
  6661. referencedClasses: []
  6662. }),
  6663. smalltalk.BlockClosure);
  6664. smalltalk.addMethod(
  6665. "_valueWithInterval_",
  6666. smalltalk.method({
  6667. selector: "valueWithInterval:",
  6668. category: 'timeout/interval',
  6669. fn: function (aNumber){
  6670. var self=this;
  6671. var interval = setInterval(self, aNumber);
  6672. return smalltalk.Timeout._on_(interval);
  6673. ;
  6674. ;
  6675. return self},
  6676. args: ["aNumber"],
  6677. source: "valueWithInterval: aNumber\x0a\x09<\x0a \x09var interval = setInterval(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(interval);\x0a >",
  6678. messageSends: [],
  6679. referencedClasses: []
  6680. }),
  6681. smalltalk.BlockClosure);
  6682. smalltalk.addMethod(
  6683. "_valueWithPossibleArguments_",
  6684. smalltalk.method({
  6685. selector: "valueWithPossibleArguments:",
  6686. category: 'evaluating',
  6687. fn: function (aCollection) {
  6688. var self = this;
  6689. return self.apply(null, aCollection);
  6690. return self;
  6691. },
  6692. args: ["aCollection"],
  6693. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  6694. messageSends: [],
  6695. referencedClasses: []
  6696. }),
  6697. smalltalk.BlockClosure);
  6698. smalltalk.addMethod(
  6699. "_valueWithTimeout_",
  6700. smalltalk.method({
  6701. selector: "valueWithTimeout:",
  6702. category: 'timeout/interval',
  6703. fn: function (aNumber){
  6704. var self=this;
  6705. var timeout = setTimeout(self, aNumber);
  6706. return smalltalk.Timeout._on_(timeout);
  6707. ;
  6708. ;
  6709. return self},
  6710. args: ["aNumber"],
  6711. source: "valueWithTimeout: aNumber\x0a\x09<\x0a \x09var timeout = setTimeout(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(timeout);\x0a >",
  6712. messageSends: [],
  6713. referencedClasses: []
  6714. }),
  6715. smalltalk.BlockClosure);
  6716. smalltalk.addMethod(
  6717. "_whileFalse",
  6718. smalltalk.method({
  6719. selector: "whileFalse",
  6720. category: 'controlling',
  6721. fn: function () {
  6722. var self = this;
  6723. smalltalk.send(self, "_whileFalse_", [function () {}]);
  6724. return self;
  6725. },
  6726. args: [],
  6727. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  6728. messageSends: ["whileFalse:"],
  6729. referencedClasses: []
  6730. }),
  6731. smalltalk.BlockClosure);
  6732. smalltalk.addMethod(
  6733. "_whileFalse_",
  6734. smalltalk.method({
  6735. selector: "whileFalse:",
  6736. category: 'controlling',
  6737. fn: function (aBlock) {
  6738. var self = this;
  6739. while (!self()) {
  6740. aBlock();
  6741. }
  6742. return self;
  6743. },
  6744. args: ["aBlock"],
  6745. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  6746. messageSends: [],
  6747. referencedClasses: []
  6748. }),
  6749. smalltalk.BlockClosure);
  6750. smalltalk.addMethod(
  6751. "_whileTrue",
  6752. smalltalk.method({
  6753. selector: "whileTrue",
  6754. category: 'controlling',
  6755. fn: function () {
  6756. var self = this;
  6757. smalltalk.send(self, "_whileTrue_", [function () {}]);
  6758. return self;
  6759. },
  6760. args: [],
  6761. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  6762. messageSends: ["whileTrue:"],
  6763. referencedClasses: []
  6764. }),
  6765. smalltalk.BlockClosure);
  6766. smalltalk.addMethod(
  6767. "_whileTrue_",
  6768. smalltalk.method({
  6769. selector: "whileTrue:",
  6770. category: 'controlling',
  6771. fn: function (aBlock) {
  6772. var self = this;
  6773. while (self()) {
  6774. aBlock();
  6775. }
  6776. return self;
  6777. },
  6778. args: ["aBlock"],
  6779. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  6780. messageSends: [],
  6781. referencedClasses: []
  6782. }),
  6783. smalltalk.BlockClosure);
  6784. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  6785. smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
  6786. smalltalk.addMethod(
  6787. "_arguments",
  6788. smalltalk.method({
  6789. selector: "arguments",
  6790. category: 'accessing',
  6791. fn: function () {
  6792. var self = this;
  6793. return self.args || [];
  6794. return self;
  6795. },
  6796. args: [],
  6797. source: "arguments\x0a\x09<return self.args || []>",
  6798. messageSends: [],
  6799. referencedClasses: []
  6800. }),
  6801. smalltalk.CompiledMethod);
  6802. smalltalk.addMethod(
  6803. "_category",
  6804. smalltalk.method({
  6805. selector: "category",
  6806. category: 'accessing',
  6807. fn: function () {
  6808. var self = this;
  6809. var $2, $1;
  6810. $2 = smalltalk.send(self, "_basicAt_", ["category"]);
  6811. if (($receiver = $2) == nil || $receiver == undefined) {
  6812. $1 = "";
  6813. } else {
  6814. $1 = $2;
  6815. }
  6816. return $1;
  6817. },
  6818. args: [],
  6819. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  6820. messageSends: ["ifNil:", "basicAt:"],
  6821. referencedClasses: []
  6822. }),
  6823. smalltalk.CompiledMethod);
  6824. smalltalk.addMethod(
  6825. "_category_",
  6826. smalltalk.method({
  6827. selector: "category:",
  6828. category: 'accessing',
  6829. fn: function (aString){
  6830. var self=this;
  6831. var $1;
  6832. var oldCategory;
  6833. oldCategory=smalltalk.send(self,"_category",[]);
  6834. smalltalk.send(self,"_basicAt_put_",["category",aString]);
  6835. $1=smalltalk.send(self,"_methodClass",[]);
  6836. if(($receiver = $1) == nil || $receiver == undefined){
  6837. $1;
  6838. } else {
  6839. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
  6840. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
  6841. return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
  6842. })]),"_ifEmpty_",[(function(){
  6843. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
  6844. })]);
  6845. };
  6846. return self},
  6847. args: ["aString"],
  6848. source: "category: aString\x0a\x09| oldCategory |\x0a oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a \x0a self methodClass ifNotNil: [\x0a \x09self methodClass organization addElement: aString.\x0a \x0a\x09\x09(self methodClass methods \x0a \x09\x09select: [ :each | each category = oldCategory ])\x0a \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
  6849. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  6850. referencedClasses: []
  6851. }),
  6852. smalltalk.CompiledMethod);
  6853. smalltalk.addMethod(
  6854. "_fn",
  6855. smalltalk.method({
  6856. selector: "fn",
  6857. category: 'accessing',
  6858. fn: function () {
  6859. var self = this;
  6860. var $1;
  6861. $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
  6862. return $1;
  6863. },
  6864. args: [],
  6865. source: "fn\x0a\x09^self basicAt: 'fn'",
  6866. messageSends: ["basicAt:"],
  6867. referencedClasses: []
  6868. }),
  6869. smalltalk.CompiledMethod);
  6870. smalltalk.addMethod(
  6871. "_fn_",
  6872. smalltalk.method({
  6873. selector: "fn:",
  6874. category: 'accessing',
  6875. fn: function (aBlock) {
  6876. var self = this;
  6877. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  6878. return self;
  6879. },
  6880. args: ["aBlock"],
  6881. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  6882. messageSends: ["basicAt:put:"],
  6883. referencedClasses: []
  6884. }),
  6885. smalltalk.CompiledMethod);
  6886. smalltalk.addMethod(
  6887. "_messageSends",
  6888. smalltalk.method({
  6889. selector: "messageSends",
  6890. category: 'accessing',
  6891. fn: function () {
  6892. var self = this;
  6893. var $1;
  6894. $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
  6895. return $1;
  6896. },
  6897. args: [],
  6898. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  6899. messageSends: ["basicAt:"],
  6900. referencedClasses: []
  6901. }),
  6902. smalltalk.CompiledMethod);
  6903. smalltalk.addMethod(
  6904. "_methodClass",
  6905. smalltalk.method({
  6906. selector: "methodClass",
  6907. category: 'accessing',
  6908. fn: function () {
  6909. var self = this;
  6910. var $1;
  6911. $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
  6912. return $1;
  6913. },
  6914. args: [],
  6915. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  6916. messageSends: ["basicAt:"],
  6917. referencedClasses: []
  6918. }),
  6919. smalltalk.CompiledMethod);
  6920. smalltalk.addMethod(
  6921. "_protocol",
  6922. smalltalk.method({
  6923. selector: "protocol",
  6924. category: 'accessing',
  6925. fn: function () {
  6926. var self = this;
  6927. var $1;
  6928. $1 = smalltalk.send(self, "_category", []);
  6929. return $1;
  6930. },
  6931. args: [],
  6932. source: "protocol\x0a\x09^ self category",
  6933. messageSends: ["category"],
  6934. referencedClasses: []
  6935. }),
  6936. smalltalk.CompiledMethod);
  6937. smalltalk.addMethod(
  6938. "_referencedClasses",
  6939. smalltalk.method({
  6940. selector: "referencedClasses",
  6941. category: 'accessing',
  6942. fn: function () {
  6943. var self = this;
  6944. var $1;
  6945. $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  6946. return $1;
  6947. },
  6948. args: [],
  6949. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  6950. messageSends: ["basicAt:"],
  6951. referencedClasses: []
  6952. }),
  6953. smalltalk.CompiledMethod);
  6954. smalltalk.addMethod(
  6955. "_selector",
  6956. smalltalk.method({
  6957. selector: "selector",
  6958. category: 'accessing',
  6959. fn: function () {
  6960. var self = this;
  6961. var $1;
  6962. $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
  6963. return $1;
  6964. },
  6965. args: [],
  6966. source: "selector\x0a\x09^self basicAt: 'selector'",
  6967. messageSends: ["basicAt:"],
  6968. referencedClasses: []
  6969. }),
  6970. smalltalk.CompiledMethod);
  6971. smalltalk.addMethod(
  6972. "_selector_",
  6973. smalltalk.method({
  6974. selector: "selector:",
  6975. category: 'accessing',
  6976. fn: function (aString) {
  6977. var self = this;
  6978. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  6979. return self;
  6980. },
  6981. args: ["aString"],
  6982. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  6983. messageSends: ["basicAt:put:"],
  6984. referencedClasses: []
  6985. }),
  6986. smalltalk.CompiledMethod);
  6987. smalltalk.addMethod(
  6988. "_source",
  6989. smalltalk.method({
  6990. selector: "source",
  6991. category: 'accessing',
  6992. fn: function () {
  6993. var self = this;
  6994. var $2, $1;
  6995. $2 = smalltalk.send(self, "_basicAt_", ["source"]);
  6996. if (($receiver = $2) == nil || $receiver == undefined) {
  6997. $1 = "";
  6998. } else {
  6999. $1 = $2;
  7000. }
  7001. return $1;
  7002. },
  7003. args: [],
  7004. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  7005. messageSends: ["ifNil:", "basicAt:"],
  7006. referencedClasses: []
  7007. }),
  7008. smalltalk.CompiledMethod);
  7009. smalltalk.addMethod(
  7010. "_source_",
  7011. smalltalk.method({
  7012. selector: "source:",
  7013. category: 'accessing',
  7014. fn: function (aString) {
  7015. var self = this;
  7016. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  7017. return self;
  7018. },
  7019. args: ["aString"],
  7020. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  7021. messageSends: ["basicAt:put:"],
  7022. referencedClasses: []
  7023. }),
  7024. smalltalk.CompiledMethod);
  7025. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  7026. smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
  7027. smalltalk.addMethod(
  7028. "_addWorker",
  7029. smalltalk.method({
  7030. selector: "addWorker",
  7031. category: 'action',
  7032. fn: function (){
  7033. var self=this;
  7034. smalltalk.send(self["@worker"],"_valueWithTimeout_",[(0)]);
  7035. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__plus",[(1)]);
  7036. return self},
  7037. args: [],
  7038. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
  7039. messageSends: ["valueWithTimeout:", "+"],
  7040. referencedClasses: []
  7041. }),
  7042. smalltalk.ForkPool);
  7043. smalltalk.addMethod(
  7044. "_defaultMaxPoolSize",
  7045. smalltalk.method({
  7046. selector: "defaultMaxPoolSize",
  7047. category: 'defaults',
  7048. fn: function (){
  7049. var self=this;
  7050. var $1;
  7051. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_defaultMaxPoolSize",[]);
  7052. return $1;
  7053. },
  7054. args: [],
  7055. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  7056. messageSends: ["defaultMaxPoolSize", "class"],
  7057. referencedClasses: []
  7058. }),
  7059. smalltalk.ForkPool);
  7060. smalltalk.addMethod(
  7061. "_fork_",
  7062. smalltalk.method({
  7063. selector: "fork:",
  7064. category: 'action',
  7065. fn: function (aBlock){
  7066. var self=this;
  7067. var $1;
  7068. $1=smalltalk.send(self["@poolSize"],"__lt",[smalltalk.send(self,"_maxPoolSize",[])]);
  7069. if(smalltalk.assert($1)){
  7070. smalltalk.send(self,"_addWorker",[]);
  7071. };
  7072. smalltalk.send(self["@queue"],"_back_",[aBlock]);
  7073. return self},
  7074. args: ["aBlock"],
  7075. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
  7076. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"],
  7077. referencedClasses: []
  7078. }),
  7079. smalltalk.ForkPool);
  7080. smalltalk.addMethod(
  7081. "_initialize",
  7082. smalltalk.method({
  7083. selector: "initialize",
  7084. category: 'initialization',
  7085. fn: function (){
  7086. var self=this;
  7087. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  7088. self["@poolSize"]=(0);
  7089. self["@queue"]=smalltalk.send((smalltalk.Queue || Queue),"_new",[]);
  7090. self["@worker"]=smalltalk.send(self,"_makeWorker",[]);
  7091. return self},
  7092. args: [],
  7093. source: "initialize\x0a super initialize.\x0a \x0a\x09poolSize := 0.\x0a queue := Queue new.\x0a worker := self makeWorker",
  7094. messageSends: ["initialize", "new", "makeWorker"],
  7095. referencedClasses: ["Queue"]
  7096. }),
  7097. smalltalk.ForkPool);
  7098. smalltalk.addMethod(
  7099. "_makeWorker",
  7100. smalltalk.method({
  7101. selector: "makeWorker",
  7102. category: 'initialization',
  7103. fn: function (){
  7104. var self=this;
  7105. var $2,$1;
  7106. var sentinel;
  7107. sentinel=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  7108. $1=(function(){
  7109. var block;
  7110. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__minus",[(1)]);
  7111. self["@poolSize"];
  7112. block=smalltalk.send(self["@queue"],"_frontIfAbsent_",[(function(){
  7113. return sentinel;
  7114. })]);
  7115. block;
  7116. $2=smalltalk.send(block,"__eq_eq",[sentinel]);
  7117. if(! smalltalk.assert($2)){
  7118. return smalltalk.send((function(){
  7119. return smalltalk.send(block,"_value",[]);
  7120. }),"_ensure_",[(function(){
  7121. return smalltalk.send(self,"_addWorker",[]);
  7122. })]);
  7123. };
  7124. });
  7125. return $1;
  7126. },
  7127. args: [],
  7128. source: "makeWorker\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^[ | block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]]",
  7129. messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  7130. referencedClasses: ["Object"]
  7131. }),
  7132. smalltalk.ForkPool);
  7133. smalltalk.addMethod(
  7134. "_maxPoolSize",
  7135. smalltalk.method({
  7136. selector: "maxPoolSize",
  7137. category: 'accessing',
  7138. fn: function (){
  7139. var self=this;
  7140. var $2,$1;
  7141. $2=self["@maxPoolSize"];
  7142. if(($receiver = $2) == nil || $receiver == undefined){
  7143. $1=smalltalk.send(self,"_defaultMaxPoolSize",[]);
  7144. } else {
  7145. $1=$2;
  7146. };
  7147. return $1;
  7148. },
  7149. args: [],
  7150. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  7151. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  7152. referencedClasses: []
  7153. }),
  7154. smalltalk.ForkPool);
  7155. smalltalk.addMethod(
  7156. "_maxPoolSize_",
  7157. smalltalk.method({
  7158. selector: "maxPoolSize:",
  7159. category: 'accessing',
  7160. fn: function (anInteger){
  7161. var self=this;
  7162. self["@maxPoolSize"]=anInteger;
  7163. return self},
  7164. args: ["anInteger"],
  7165. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  7166. messageSends: [],
  7167. referencedClasses: []
  7168. }),
  7169. smalltalk.ForkPool);
  7170. smalltalk.ForkPool.klass.iVarNames = ['default'];
  7171. smalltalk.addMethod(
  7172. "_default",
  7173. smalltalk.method({
  7174. selector: "default",
  7175. category: 'accessing',
  7176. fn: function (){
  7177. var self=this;
  7178. var $1;
  7179. if(($receiver = self["@default"]) == nil || $receiver == undefined){
  7180. self["@default"]=smalltalk.send(self,"_new",[]);
  7181. $1=self["@default"];
  7182. } else {
  7183. $1=self["@default"];
  7184. };
  7185. return $1;
  7186. },
  7187. args: [],
  7188. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  7189. messageSends: ["ifNil:", "new"],
  7190. referencedClasses: []
  7191. }),
  7192. smalltalk.ForkPool.klass);
  7193. smalltalk.addMethod(
  7194. "_defaultMaxPoolSize",
  7195. smalltalk.method({
  7196. selector: "defaultMaxPoolSize",
  7197. category: 'accessing',
  7198. fn: function (){
  7199. var self=this;
  7200. return (100);
  7201. },
  7202. args: [],
  7203. source: "defaultMaxPoolSize\x0a\x09^100",
  7204. messageSends: [],
  7205. referencedClasses: []
  7206. }),
  7207. smalltalk.ForkPool.klass);
  7208. smalltalk.addMethod(
  7209. "_resetDefault",
  7210. smalltalk.method({
  7211. selector: "resetDefault",
  7212. category: 'accessing',
  7213. fn: function (){
  7214. var self=this;
  7215. self["@default"]=nil;
  7216. return self},
  7217. args: [],
  7218. source: "resetDefault\x0a\x09default := nil",
  7219. messageSends: [],
  7220. referencedClasses: []
  7221. }),
  7222. smalltalk.ForkPool.klass);
  7223. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  7224. smalltalk.Message.comment="Generally, the system does not use instances of Message 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:`"
  7225. smalltalk.addMethod(
  7226. "_arguments",
  7227. smalltalk.method({
  7228. selector: "arguments",
  7229. category: 'accessing',
  7230. fn: function () {
  7231. var self = this;
  7232. return self['@arguments'];
  7233. },
  7234. args: [],
  7235. source: "arguments\x0a\x09^arguments",
  7236. messageSends: [],
  7237. referencedClasses: []
  7238. }),
  7239. smalltalk.Message);
  7240. smalltalk.addMethod(
  7241. "_arguments_",
  7242. smalltalk.method({
  7243. selector: "arguments:",
  7244. category: 'accessing',
  7245. fn: function (anArray) {
  7246. var self = this;
  7247. self['@arguments'] = anArray;
  7248. return self;
  7249. },
  7250. args: ["anArray"],
  7251. source: "arguments: anArray\x0a\x09arguments := anArray",
  7252. messageSends: [],
  7253. referencedClasses: []
  7254. }),
  7255. smalltalk.Message);
  7256. smalltalk.addMethod(
  7257. "_printString",
  7258. smalltalk.method({
  7259. selector: "printString",
  7260. category: 'printing',
  7261. fn: function () {
  7262. var self = this;
  7263. var $2, $1;
  7264. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
  7265. return $1;
  7266. },
  7267. args: [],
  7268. source: "printString\x0a\x09^ String streamContents: [:aStream| \x0a \x09\x09\x09\x09aStream \x0a \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a \x09\x09\x09\x09\x09nextPutAll: '(';\x0a \x09\x09\x09\x09\x09nextPutAll: selector;\x0a \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
  7269. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  7270. referencedClasses: ["String"]
  7271. }),
  7272. smalltalk.Message);
  7273. smalltalk.addMethod(
  7274. "_selector",
  7275. smalltalk.method({
  7276. selector: "selector",
  7277. category: 'accessing',
  7278. fn: function () {
  7279. var self = this;
  7280. return self['@selector'];
  7281. },
  7282. args: [],
  7283. source: "selector\x0a\x09^selector",
  7284. messageSends: [],
  7285. referencedClasses: []
  7286. }),
  7287. smalltalk.Message);
  7288. smalltalk.addMethod(
  7289. "_selector_",
  7290. smalltalk.method({
  7291. selector: "selector:",
  7292. category: 'accessing',
  7293. fn: function (aString) {
  7294. var self = this;
  7295. self['@selector'] = aString;
  7296. return self;
  7297. },
  7298. args: ["aString"],
  7299. source: "selector: aString\x0a\x09selector := aString",
  7300. messageSends: [],
  7301. referencedClasses: []
  7302. }),
  7303. smalltalk.Message);
  7304. smalltalk.addMethod(
  7305. "_sendTo_",
  7306. smalltalk.method({
  7307. selector: "sendTo:",
  7308. category: 'printing',
  7309. fn: function (anObject) {
  7310. var self = this;
  7311. var $1;
  7312. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  7313. return $1;
  7314. },
  7315. args: ["anObject"],
  7316. source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
  7317. messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
  7318. referencedClasses: ["Smalltalk"]
  7319. }),
  7320. smalltalk.Message);
  7321. smalltalk.addMethod(
  7322. "_selector_arguments_",
  7323. smalltalk.method({
  7324. selector: "selector:arguments:",
  7325. category: 'instance creation',
  7326. fn: function (aString, anArray) {
  7327. var self = this;
  7328. var $2, $3, $1;
  7329. $2 = smalltalk.send(self, "_new", []);
  7330. smalltalk.send($2, "_selector_", [aString]);
  7331. smalltalk.send($2, "_arguments_", [anArray]);
  7332. $3 = smalltalk.send($2, "_yourself", []);
  7333. $1 = $3;
  7334. return $1;
  7335. },
  7336. args: ["aString", "anArray"],
  7337. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  7338. messageSends: ["selector:", "new", "arguments:", "yourself"],
  7339. referencedClasses: []
  7340. }),
  7341. smalltalk.Message.klass);
  7342. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  7343. smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a \x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js \x0a\x0aCurrent limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block."
  7344. smalltalk.addMethod(
  7345. "_asString",
  7346. smalltalk.method({
  7347. selector: "asString",
  7348. category: 'accessing',
  7349. fn: function () {
  7350. var self = this;
  7351. var $1;
  7352. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  7353. return $1;
  7354. },
  7355. args: [],
  7356. source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
  7357. messageSends: [",", "selector", "printString", "class", "receiver"],
  7358. referencedClasses: []
  7359. }),
  7360. smalltalk.MethodContext);
  7361. smalltalk.addMethod(
  7362. "_home",
  7363. smalltalk.method({
  7364. selector: "home",
  7365. category: 'accessing',
  7366. fn: function () {
  7367. var self = this;
  7368. return self.homeContext;
  7369. return self;
  7370. },
  7371. args: [],
  7372. source: "home\x0a\x09<return self.homeContext>",
  7373. messageSends: [],
  7374. referencedClasses: []
  7375. }),
  7376. smalltalk.MethodContext);
  7377. smalltalk.addMethod(
  7378. "_pc",
  7379. smalltalk.method({
  7380. selector: "pc",
  7381. category: 'accessing',
  7382. fn: function () {
  7383. var self = this;
  7384. return self.pc;
  7385. return self;
  7386. },
  7387. args: [],
  7388. source: "pc\x0a\x09<return self.pc>",
  7389. messageSends: [],
  7390. referencedClasses: []
  7391. }),
  7392. smalltalk.MethodContext);
  7393. smalltalk.addMethod(
  7394. "_printString",
  7395. smalltalk.method({
  7396. selector: "printString",
  7397. category: 'accessing',
  7398. fn: function () {
  7399. var self = this;
  7400. var $1;
  7401. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  7402. return $1;
  7403. },
  7404. args: [],
  7405. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  7406. messageSends: [",", "asString", "printString"],
  7407. referencedClasses: []
  7408. }),
  7409. smalltalk.MethodContext);
  7410. smalltalk.addMethod(
  7411. "_receiver",
  7412. smalltalk.method({
  7413. selector: "receiver",
  7414. category: 'accessing',
  7415. fn: function () {
  7416. var self = this;
  7417. return self.receiver;
  7418. return self;
  7419. },
  7420. args: [],
  7421. source: "receiver\x0a\x09<return self.receiver>",
  7422. messageSends: [],
  7423. referencedClasses: []
  7424. }),
  7425. smalltalk.MethodContext);
  7426. smalltalk.addMethod(
  7427. "_selector",
  7428. smalltalk.method({
  7429. selector: "selector",
  7430. category: 'accessing',
  7431. fn: function () {
  7432. var self = this;
  7433. return smalltalk.convertSelector(self.selector);
  7434. return self;
  7435. },
  7436. args: [],
  7437. source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
  7438. messageSends: [],
  7439. referencedClasses: []
  7440. }),
  7441. smalltalk.MethodContext);
  7442. smalltalk.addMethod(
  7443. "_temps",
  7444. smalltalk.method({
  7445. selector: "temps",
  7446. category: 'accessing',
  7447. fn: function () {
  7448. var self = this;
  7449. return self.temps;
  7450. return self;
  7451. },
  7452. args: [],
  7453. source: "temps\x0a\x09<return self.temps>",
  7454. messageSends: [],
  7455. referencedClasses: []
  7456. }),
  7457. smalltalk.MethodContext);
  7458. smalltalk.addPackage('Kernel-Collections', {});
  7459. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  7460. smalltalk.addMethod(
  7461. "__eq",
  7462. smalltalk.method({
  7463. selector: "=",
  7464. category: 'comparing',
  7465. fn: function (anAssociation){
  7466. var self=this;
  7467. var $1;
  7468. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(anAssociation,"_class",[])]),"_and_",[(function(){
  7469. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_key",[]),"__eq",[smalltalk.send(anAssociation,"_key",[])]),"_and_",[(function(){
  7470. return smalltalk.send(smalltalk.send(self,"_value",[]),"__eq",[smalltalk.send(anAssociation,"_value",[])]);
  7471. })]);
  7472. })]);
  7473. return $1;
  7474. },
  7475. args: ["anAssociation"],
  7476. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  7477. messageSends: ["and:", "=", "value", "key", "class"],
  7478. referencedClasses: []
  7479. }),
  7480. smalltalk.Association);
  7481. smalltalk.addMethod(
  7482. "_key",
  7483. smalltalk.method({
  7484. selector: "key",
  7485. category: 'accessing',
  7486. fn: function (){
  7487. var self=this;
  7488. return self["@key"];
  7489. },
  7490. args: [],
  7491. source: "key\x0a\x09^key",
  7492. messageSends: [],
  7493. referencedClasses: []
  7494. }),
  7495. smalltalk.Association);
  7496. smalltalk.addMethod(
  7497. "_key_",
  7498. smalltalk.method({
  7499. selector: "key:",
  7500. category: 'accessing',
  7501. fn: function (aKey){
  7502. var self=this;
  7503. self["@key"]=aKey;
  7504. return self},
  7505. args: ["aKey"],
  7506. source: "key: aKey\x0a\x09key := aKey",
  7507. messageSends: [],
  7508. referencedClasses: []
  7509. }),
  7510. smalltalk.Association);
  7511. smalltalk.addMethod(
  7512. "_printString",
  7513. smalltalk.method({
  7514. selector: "printString",
  7515. category: 'printing',
  7516. fn: function (){
  7517. var self=this;
  7518. var $1;
  7519. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  7520. return smalltalk.send(self,"_storeOn_",[aStream]);
  7521. })]);
  7522. return $1;
  7523. },
  7524. args: [],
  7525. source: "printString\x0a\x09\x22print the contents of the Association into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09self storeOn: aStream]",
  7526. messageSends: ["streamContents:", "storeOn:"],
  7527. referencedClasses: ["String"]
  7528. }),
  7529. smalltalk.Association);
  7530. smalltalk.addMethod(
  7531. "_storeOn_",
  7532. smalltalk.method({
  7533. selector: "storeOn:",
  7534. category: 'printing',
  7535. fn: function (aStream){
  7536. var self=this;
  7537. smalltalk.send(self["@key"],"_storeOn_",[aStream]);
  7538. smalltalk.send(aStream,"_nextPutAll_",["->"]);
  7539. smalltalk.send(self["@value"],"_storeOn_",[aStream]);
  7540. return self},
  7541. args: ["aStream"],
  7542. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  7543. messageSends: ["storeOn:", "nextPutAll:"],
  7544. referencedClasses: []
  7545. }),
  7546. smalltalk.Association);
  7547. smalltalk.addMethod(
  7548. "_value",
  7549. smalltalk.method({
  7550. selector: "value",
  7551. category: 'accessing',
  7552. fn: function (){
  7553. var self=this;
  7554. return self["@value"];
  7555. },
  7556. args: [],
  7557. source: "value\x0a\x09^value",
  7558. messageSends: [],
  7559. referencedClasses: []
  7560. }),
  7561. smalltalk.Association);
  7562. smalltalk.addMethod(
  7563. "_value_",
  7564. smalltalk.method({
  7565. selector: "value:",
  7566. category: 'accessing',
  7567. fn: function (aValue){
  7568. var self=this;
  7569. self["@value"]=aValue;
  7570. return self},
  7571. args: ["aValue"],
  7572. source: "value: aValue\x0a\x09value := aValue",
  7573. messageSends: [],
  7574. referencedClasses: []
  7575. }),
  7576. smalltalk.Association);
  7577. smalltalk.addMethod(
  7578. "_key_value_",
  7579. smalltalk.method({
  7580. selector: "key:value:",
  7581. category: 'instance creation',
  7582. fn: function (aKey,aValue){
  7583. var self=this;
  7584. var $2,$3,$1;
  7585. $2=smalltalk.send(self,"_new",[]);
  7586. smalltalk.send($2,"_key_",[aKey]);
  7587. smalltalk.send($2,"_value_",[aValue]);
  7588. $3=smalltalk.send($2,"_yourself",[]);
  7589. $1=$3;
  7590. return $1;
  7591. },
  7592. args: ["aKey", "aValue"],
  7593. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7594. messageSends: ["key:", "new", "value:", "yourself"],
  7595. referencedClasses: []
  7596. }),
  7597. smalltalk.Association.klass);
  7598. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  7599. smalltalk.addMethod(
  7600. "__comma",
  7601. smalltalk.method({
  7602. selector: ",",
  7603. category: 'copying',
  7604. fn: function (aCollection){
  7605. var self=this;
  7606. var $2,$3,$1;
  7607. $2=smalltalk.send(self,"_copy",[]);
  7608. smalltalk.send($2,"_addAll_",[aCollection]);
  7609. $3=smalltalk.send($2,"_yourself",[]);
  7610. $1=$3;
  7611. return $1;
  7612. },
  7613. args: ["aCollection"],
  7614. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  7615. messageSends: ["addAll:", "copy", "yourself"],
  7616. referencedClasses: []
  7617. }),
  7618. smalltalk.Collection);
  7619. smalltalk.addMethod(
  7620. "_add_",
  7621. smalltalk.method({
  7622. selector: "add:",
  7623. category: 'adding/removing',
  7624. fn: function (anObject){
  7625. var self=this;
  7626. smalltalk.send(self,"_subclassResponsibility",[]);
  7627. return self},
  7628. args: ["anObject"],
  7629. source: "add: anObject\x0a\x09self subclassResponsibility",
  7630. messageSends: ["subclassResponsibility"],
  7631. referencedClasses: []
  7632. }),
  7633. smalltalk.Collection);
  7634. smalltalk.addMethod(
  7635. "_addAll_",
  7636. smalltalk.method({
  7637. selector: "addAll:",
  7638. category: 'adding/removing',
  7639. fn: function (aCollection){
  7640. var self=this;
  7641. smalltalk.send(aCollection,"_do_",[(function(each){
  7642. return smalltalk.send(self,"_add_",[each]);
  7643. })]);
  7644. return aCollection;
  7645. },
  7646. args: ["aCollection"],
  7647. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  7648. messageSends: ["do:", "add:"],
  7649. referencedClasses: []
  7650. }),
  7651. smalltalk.Collection);
  7652. smalltalk.addMethod(
  7653. "_asArray",
  7654. smalltalk.method({
  7655. selector: "asArray",
  7656. category: 'converting',
  7657. fn: function (){
  7658. var self=this;
  7659. var $1;
  7660. $1=smalltalk.send((smalltalk.Array || Array),"_withAll_",[self]);
  7661. return $1;
  7662. },
  7663. args: [],
  7664. source: "asArray\x0a\x09^Array withAll: self",
  7665. messageSends: ["withAll:"],
  7666. referencedClasses: ["Array"]
  7667. }),
  7668. smalltalk.Collection);
  7669. smalltalk.addMethod(
  7670. "_asJSON",
  7671. smalltalk.method({
  7672. selector: "asJSON",
  7673. category: 'converting',
  7674. fn: function (){
  7675. var self=this;
  7676. var $1;
  7677. $1=smalltalk.send(smalltalk.send(self,"_asArray",[]),"_collect_",[(function(each){
  7678. return smalltalk.send(each,"_asJSON",[]);
  7679. })]);
  7680. return $1;
  7681. },
  7682. args: [],
  7683. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  7684. messageSends: ["collect:", "asJSON", "asArray"],
  7685. referencedClasses: []
  7686. }),
  7687. smalltalk.Collection);
  7688. smalltalk.addMethod(
  7689. "_asOrderedCollection",
  7690. smalltalk.method({
  7691. selector: "asOrderedCollection",
  7692. category: 'converting',
  7693. fn: function (){
  7694. var self=this;
  7695. var $1;
  7696. $1=smalltalk.send(self,"_asArray",[]);
  7697. return $1;
  7698. },
  7699. args: [],
  7700. source: "asOrderedCollection\x0a\x09^self asArray",
  7701. messageSends: ["asArray"],
  7702. referencedClasses: []
  7703. }),
  7704. smalltalk.Collection);
  7705. smalltalk.addMethod(
  7706. "_asSet",
  7707. smalltalk.method({
  7708. selector: "asSet",
  7709. category: 'converting',
  7710. fn: function (){
  7711. var self=this;
  7712. var $1;
  7713. $1=smalltalk.send((smalltalk.Set || Set),"_withAll_",[self]);
  7714. return $1;
  7715. },
  7716. args: [],
  7717. source: "asSet\x0a\x09^Set withAll: self",
  7718. messageSends: ["withAll:"],
  7719. referencedClasses: ["Set"]
  7720. }),
  7721. smalltalk.Collection);
  7722. smalltalk.addMethod(
  7723. "_collect_",
  7724. smalltalk.method({
  7725. selector: "collect:",
  7726. category: 'enumerating',
  7727. fn: function (aBlock){
  7728. var self=this;
  7729. var $1;
  7730. var stream;
  7731. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  7732. smalltalk.send(self,"_do_",[(function(each){
  7733. return smalltalk.send(stream,"_nextPut_",[smalltalk.send(aBlock,"_value_",[each])]);
  7734. })]);
  7735. $1=smalltalk.send(stream,"_contents",[]);
  7736. return $1;
  7737. },
  7738. args: ["aBlock"],
  7739. 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",
  7740. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  7741. referencedClasses: []
  7742. }),
  7743. smalltalk.Collection);
  7744. smalltalk.addMethod(
  7745. "_copyWith_",
  7746. smalltalk.method({
  7747. selector: "copyWith:",
  7748. category: 'copying',
  7749. fn: function (anObject){
  7750. var self=this;
  7751. var $2,$3,$1;
  7752. $2=smalltalk.send(self,"_copy",[]);
  7753. smalltalk.send($2,"_add_",[anObject]);
  7754. $3=smalltalk.send($2,"_yourself",[]);
  7755. $1=$3;
  7756. return $1;
  7757. },
  7758. args: ["anObject"],
  7759. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  7760. messageSends: ["add:", "copy", "yourself"],
  7761. referencedClasses: []
  7762. }),
  7763. smalltalk.Collection);
  7764. smalltalk.addMethod(
  7765. "_copyWithAll_",
  7766. smalltalk.method({
  7767. selector: "copyWithAll:",
  7768. category: 'copying',
  7769. fn: function (aCollection){
  7770. var self=this;
  7771. var $2,$3,$1;
  7772. $2=smalltalk.send(self,"_copy",[]);
  7773. smalltalk.send($2,"_addAll_",[aCollection]);
  7774. $3=smalltalk.send($2,"_yourself",[]);
  7775. $1=$3;
  7776. return $1;
  7777. },
  7778. args: ["aCollection"],
  7779. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  7780. messageSends: ["addAll:", "copy", "yourself"],
  7781. referencedClasses: []
  7782. }),
  7783. smalltalk.Collection);
  7784. smalltalk.addMethod(
  7785. "_copyWithoutAll_",
  7786. smalltalk.method({
  7787. selector: "copyWithoutAll:",
  7788. category: 'copying',
  7789. fn: function (aCollection){
  7790. var self=this;
  7791. var $1;
  7792. $1=smalltalk.send(self,"_reject_",[(function(each){
  7793. return smalltalk.send(aCollection,"_includes_",[each]);
  7794. })]);
  7795. return $1;
  7796. },
  7797. args: ["aCollection"],
  7798. 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]",
  7799. messageSends: ["reject:", "includes:"],
  7800. referencedClasses: []
  7801. }),
  7802. smalltalk.Collection);
  7803. smalltalk.addMethod(
  7804. "_detect_",
  7805. smalltalk.method({
  7806. selector: "detect:",
  7807. category: 'enumerating',
  7808. fn: function (aBlock){
  7809. var self=this;
  7810. var $1;
  7811. $1=smalltalk.send(self,"_detect_ifNone_",[aBlock,(function(){
  7812. return smalltalk.send(self,"_errorNotFound",[]);
  7813. })]);
  7814. return $1;
  7815. },
  7816. args: ["aBlock"],
  7817. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  7818. messageSends: ["detect:ifNone:", "errorNotFound"],
  7819. referencedClasses: []
  7820. }),
  7821. smalltalk.Collection);
  7822. smalltalk.addMethod(
  7823. "_detect_ifNone_",
  7824. smalltalk.method({
  7825. selector: "detect:ifNone:",
  7826. category: 'enumerating',
  7827. fn: function (aBlock,anotherBlock){
  7828. var self=this;
  7829. for(var i = 0; i < self.length; i++)
  7830. if(aBlock(self[i]))
  7831. return self[i];
  7832. return anotherBlock();
  7833. ;
  7834. ;
  7835. return self},
  7836. args: ["aBlock", "anotherBlock"],
  7837. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>",
  7838. messageSends: [],
  7839. referencedClasses: []
  7840. }),
  7841. smalltalk.Collection);
  7842. smalltalk.addMethod(
  7843. "_do_",
  7844. smalltalk.method({
  7845. selector: "do:",
  7846. category: 'enumerating',
  7847. fn: function (aBlock){
  7848. var self=this;
  7849. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  7850. ;
  7851. return self},
  7852. args: ["aBlock"],
  7853. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  7854. messageSends: [],
  7855. referencedClasses: []
  7856. }),
  7857. smalltalk.Collection);
  7858. smalltalk.addMethod(
  7859. "_do_separatedBy_",
  7860. smalltalk.method({
  7861. selector: "do:separatedBy:",
  7862. category: 'enumerating',
  7863. fn: function (aBlock,anotherBlock){
  7864. var self=this;
  7865. var first;
  7866. first=true;
  7867. smalltalk.send(self,"_do_",[(function(each){
  7868. if(smalltalk.assert(first)){
  7869. first=false;
  7870. first;
  7871. } else {
  7872. smalltalk.send(anotherBlock,"_value",[]);
  7873. };
  7874. return smalltalk.send(aBlock,"_value_",[each]);
  7875. })]);
  7876. return self},
  7877. args: ["aBlock", "anotherBlock"],
  7878. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| first |\x0a\x09first := true.\x0a\x09self do: [:each |\x0a\x09 first\x0a\x09\x09ifTrue: [first := false]\x0a\x09\x09ifFalse: [anotherBlock value].\x0a\x09 aBlock value: each]",
  7879. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  7880. referencedClasses: []
  7881. }),
  7882. smalltalk.Collection);
  7883. smalltalk.addMethod(
  7884. "_errorNotFound",
  7885. smalltalk.method({
  7886. selector: "errorNotFound",
  7887. category: 'error handling',
  7888. fn: function (){
  7889. var self=this;
  7890. smalltalk.send(self,"_error_",["Object is not in the collection"]);
  7891. return self},
  7892. args: [],
  7893. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7894. messageSends: ["error:"],
  7895. referencedClasses: []
  7896. }),
  7897. smalltalk.Collection);
  7898. smalltalk.addMethod(
  7899. "_ifEmpty_",
  7900. smalltalk.method({
  7901. selector: "ifEmpty:",
  7902. category: 'testing',
  7903. fn: function (aBlock){
  7904. var self=this;
  7905. var $2,$1;
  7906. $2=smalltalk.send(self,"_isEmpty",[]);
  7907. if(smalltalk.assert($2)){
  7908. $1=smalltalk.send(aBlock,"_value",[]);
  7909. } else {
  7910. $1=self;
  7911. };
  7912. return $1;
  7913. },
  7914. args: ["aBlock"],
  7915. 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 ]",
  7916. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  7917. referencedClasses: []
  7918. }),
  7919. smalltalk.Collection);
  7920. smalltalk.addMethod(
  7921. "_ifNotEmpty_",
  7922. smalltalk.method({
  7923. selector: "ifNotEmpty:",
  7924. category: 'testing',
  7925. fn: function (aBlock){
  7926. var self=this;
  7927. var $1;
  7928. $1=smalltalk.send(self,"_notEmpty",[]);
  7929. smalltalk.send($1,"_ifTrue_",[aBlock]);
  7930. return self},
  7931. args: ["aBlock"],
  7932. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  7933. messageSends: ["ifTrue:", "notEmpty"],
  7934. referencedClasses: []
  7935. }),
  7936. smalltalk.Collection);
  7937. smalltalk.addMethod(
  7938. "_includes_",
  7939. smalltalk.method({
  7940. selector: "includes:",
  7941. category: 'testing',
  7942. fn: function (anObject){
  7943. var self=this;
  7944. var i = self.length;
  7945. while (i--) {
  7946. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  7947. }
  7948. return false
  7949. ;
  7950. ;
  7951. return self},
  7952. args: ["anObject"],
  7953. source: "includes: anObject\x0a\x09<\x0a\x09\x09var i = self.length;\x0a\x09\x09while (i--) {\x0a\x09\x09\x09if (smalltalk.send(self[i], \x22__eq\x22, [anObject])) {return true;}\x09\x0a\x09\x09}\x0a\x09\x09return false\x0a\x09>",
  7954. messageSends: [],
  7955. referencedClasses: []
  7956. }),
  7957. smalltalk.Collection);
  7958. smalltalk.addMethod(
  7959. "_inject_into_",
  7960. smalltalk.method({
  7961. selector: "inject:into:",
  7962. category: 'enumerating',
  7963. fn: function (anObject,aBlock){
  7964. var self=this;
  7965. var result;
  7966. result=anObject;
  7967. smalltalk.send(self,"_do_",[(function(each){
  7968. result=smalltalk.send(aBlock,"_value_value_",[result,each]);
  7969. return result;
  7970. })]);
  7971. return result;
  7972. },
  7973. args: ["anObject", "aBlock"],
  7974. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each | \x0a\x09 result := aBlock value: result value: each].\x0a\x09^result",
  7975. messageSends: ["do:", "value:value:"],
  7976. referencedClasses: []
  7977. }),
  7978. smalltalk.Collection);
  7979. smalltalk.addMethod(
  7980. "_intersection_",
  7981. smalltalk.method({
  7982. selector: "intersection:",
  7983. category: 'enumerating',
  7984. fn: function (aCollection){
  7985. var self=this;
  7986. var $1,$2;
  7987. var set;
  7988. var outputSet;
  7989. set=smalltalk.send(self,"_asSet",[]);
  7990. outputSet=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  7991. smalltalk.send(aCollection,"_do_",[(function(each){
  7992. $1=smalltalk.send(smalltalk.send(set,"_includes_",[each]),"_and_",[(function(){
  7993. return smalltalk.send(smalltalk.send(outputSet,"_includes_",[each]),"_not",[]);
  7994. })]);
  7995. if(smalltalk.assert($1)){
  7996. return smalltalk.send(outputSet,"_add_",[each]);
  7997. };
  7998. })]);
  7999. $2=smalltalk.send(smalltalk.send(self,"_class",[]),"_withAll_",[smalltalk.send(outputSet,"_asArray",[])]);
  8000. return $2;
  8001. },
  8002. args: ["aCollection"],
  8003. 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",
  8004. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  8005. referencedClasses: ["Set"]
  8006. }),
  8007. smalltalk.Collection);
  8008. smalltalk.addMethod(
  8009. "_isEmpty",
  8010. smalltalk.method({
  8011. selector: "isEmpty",
  8012. category: 'testing',
  8013. fn: function (){
  8014. var self=this;
  8015. var $1;
  8016. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  8017. return $1;
  8018. },
  8019. args: [],
  8020. source: "isEmpty\x0a\x09^self size = 0",
  8021. messageSends: ["=", "size"],
  8022. referencedClasses: []
  8023. }),
  8024. smalltalk.Collection);
  8025. smalltalk.addMethod(
  8026. "_notEmpty",
  8027. smalltalk.method({
  8028. selector: "notEmpty",
  8029. category: 'testing',
  8030. fn: function (){
  8031. var self=this;
  8032. var $1;
  8033. $1=smalltalk.send(smalltalk.send(self,"_isEmpty",[]),"_not",[]);
  8034. return $1;
  8035. },
  8036. args: [],
  8037. source: "notEmpty\x0a\x09^self isEmpty not",
  8038. messageSends: ["not", "isEmpty"],
  8039. referencedClasses: []
  8040. }),
  8041. smalltalk.Collection);
  8042. smalltalk.addMethod(
  8043. "_occurrencesOf_",
  8044. smalltalk.method({
  8045. selector: "occurrencesOf:",
  8046. category: 'accessing',
  8047. fn: function (anObject){
  8048. var self=this;
  8049. var $1;
  8050. var tally;
  8051. tally=(0);
  8052. smalltalk.send(self,"_do_",[(function(each){
  8053. $1=smalltalk.send(anObject,"__eq",[each]);
  8054. if(smalltalk.assert($1)){
  8055. tally=smalltalk.send(tally,"__plus",[(1)]);
  8056. return tally;
  8057. };
  8058. })]);
  8059. return tally;
  8060. },
  8061. args: ["anObject"],
  8062. 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",
  8063. messageSends: ["do:", "ifTrue:", "+", "="],
  8064. referencedClasses: []
  8065. }),
  8066. smalltalk.Collection);
  8067. smalltalk.addMethod(
  8068. "_printString",
  8069. smalltalk.method({
  8070. selector: "printString",
  8071. category: 'printing',
  8072. fn: function (){
  8073. var self=this;
  8074. var $1;
  8075. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  8076. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_printString",[],smalltalk.Object),"__comma",[" ("])]);
  8077. smalltalk.send(self,"_do_separatedBy_",[(function(each){
  8078. return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(each,"_printString",[])]);
  8079. }),(function(){
  8080. return smalltalk.send(aStream,"_nextPutAll_",[" "]);
  8081. })]);
  8082. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  8083. })]);
  8084. return $1;
  8085. },
  8086. args: [],
  8087. source: "printString\x0a\x09\x22print the contents of the Collection into a string and return it\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: super printString, ' ('.\x0a\x09\x09self do: [:each | aStream nextPutAll: each printString]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream nextPutAll: ')']",
  8088. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  8089. referencedClasses: ["String"]
  8090. }),
  8091. smalltalk.Collection);
  8092. smalltalk.addMethod(
  8093. "_readStream",
  8094. smalltalk.method({
  8095. selector: "readStream",
  8096. category: 'accessing',
  8097. fn: function (){
  8098. var self=this;
  8099. var $1;
  8100. $1=smalltalk.send(self,"_stream",[]);
  8101. return $1;
  8102. },
  8103. args: [],
  8104. source: "readStream\x0a\x09^self stream",
  8105. messageSends: ["stream"],
  8106. referencedClasses: []
  8107. }),
  8108. smalltalk.Collection);
  8109. smalltalk.addMethod(
  8110. "_reject_",
  8111. smalltalk.method({
  8112. selector: "reject:",
  8113. category: 'enumerating',
  8114. fn: function (aBlock){
  8115. var self=this;
  8116. var $1;
  8117. $1=smalltalk.send(self,"_select_",[(function(each){
  8118. return smalltalk.send(smalltalk.send(aBlock,"_value_",[each]),"__eq",[false]);
  8119. })]);
  8120. return $1;
  8121. },
  8122. args: ["aBlock"],
  8123. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  8124. messageSends: ["select:", "=", "value:"],
  8125. referencedClasses: []
  8126. }),
  8127. smalltalk.Collection);
  8128. smalltalk.addMethod(
  8129. "_remove_",
  8130. smalltalk.method({
  8131. selector: "remove:",
  8132. category: 'adding/removing',
  8133. fn: function (anObject){
  8134. var self=this;
  8135. var $1;
  8136. $1=smalltalk.send(self,"_remove_ifAbsent_",[anObject,(function(){
  8137. return smalltalk.send(self,"_errorNotFound",[]);
  8138. })]);
  8139. return $1;
  8140. },
  8141. args: ["anObject"],
  8142. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  8143. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  8144. referencedClasses: []
  8145. }),
  8146. smalltalk.Collection);
  8147. smalltalk.addMethod(
  8148. "_remove_ifAbsent_",
  8149. smalltalk.method({
  8150. selector: "remove:ifAbsent:",
  8151. category: 'adding/removing',
  8152. fn: function (anObject,aBlock){
  8153. var self=this;
  8154. smalltalk.send(self,"_subclassResponsibility",[]);
  8155. return self},
  8156. args: ["anObject", "aBlock"],
  8157. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  8158. messageSends: ["subclassResponsibility"],
  8159. referencedClasses: []
  8160. }),
  8161. smalltalk.Collection);
  8162. smalltalk.addMethod(
  8163. "_select_",
  8164. smalltalk.method({
  8165. selector: "select:",
  8166. category: 'enumerating',
  8167. fn: function (aBlock){
  8168. var self=this;
  8169. var $1,$2;
  8170. var stream;
  8171. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  8172. smalltalk.send(self,"_do_",[(function(each){
  8173. $1=smalltalk.send(aBlock,"_value_",[each]);
  8174. if(smalltalk.assert($1)){
  8175. return smalltalk.send(stream,"_nextPut_",[each]);
  8176. };
  8177. })]);
  8178. $2=smalltalk.send(stream,"_contents",[]);
  8179. return $2;
  8180. },
  8181. args: ["aBlock"],
  8182. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09 (aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  8183. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  8184. referencedClasses: []
  8185. }),
  8186. smalltalk.Collection);
  8187. smalltalk.addMethod(
  8188. "_size",
  8189. smalltalk.method({
  8190. selector: "size",
  8191. category: 'accessing',
  8192. fn: function (){
  8193. var self=this;
  8194. smalltalk.send(self,"_subclassResponsibility",[]);
  8195. return self},
  8196. args: [],
  8197. source: "size\x0a\x09self subclassResponsibility",
  8198. messageSends: ["subclassResponsibility"],
  8199. referencedClasses: []
  8200. }),
  8201. smalltalk.Collection);
  8202. smalltalk.addMethod(
  8203. "_stream",
  8204. smalltalk.method({
  8205. selector: "stream",
  8206. category: 'accessing',
  8207. fn: function (){
  8208. var self=this;
  8209. var $1;
  8210. $1=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[self]);
  8211. return $1;
  8212. },
  8213. args: [],
  8214. source: "stream\x0a\x09^self streamClass on: self",
  8215. messageSends: ["on:", "streamClass"],
  8216. referencedClasses: []
  8217. }),
  8218. smalltalk.Collection);
  8219. smalltalk.addMethod(
  8220. "_streamClass",
  8221. smalltalk.method({
  8222. selector: "streamClass",
  8223. category: 'accessing',
  8224. fn: function (){
  8225. var self=this;
  8226. var $1;
  8227. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_streamClass",[]);
  8228. return $1;
  8229. },
  8230. args: [],
  8231. source: "streamClass\x0a\x09^self class streamClass",
  8232. messageSends: ["streamClass", "class"],
  8233. referencedClasses: []
  8234. }),
  8235. smalltalk.Collection);
  8236. smalltalk.addMethod(
  8237. "_writeStream",
  8238. smalltalk.method({
  8239. selector: "writeStream",
  8240. category: 'accessing',
  8241. fn: function (){
  8242. var self=this;
  8243. var $1;
  8244. $1=smalltalk.send(self,"_stream",[]);
  8245. return $1;
  8246. },
  8247. args: [],
  8248. source: "writeStream\x0a\x09^self stream",
  8249. messageSends: ["stream"],
  8250. referencedClasses: []
  8251. }),
  8252. smalltalk.Collection);
  8253. smalltalk.addMethod(
  8254. "_new_",
  8255. smalltalk.method({
  8256. selector: "new:",
  8257. category: 'instance creation',
  8258. fn: function (anInteger){
  8259. var self=this;
  8260. var $1;
  8261. $1=smalltalk.send(self,"_new",[]);
  8262. return $1;
  8263. },
  8264. args: ["anInteger"],
  8265. source: "new: anInteger\x0a\x09^self new",
  8266. messageSends: ["new"],
  8267. referencedClasses: []
  8268. }),
  8269. smalltalk.Collection.klass);
  8270. smalltalk.addMethod(
  8271. "_streamClass",
  8272. smalltalk.method({
  8273. selector: "streamClass",
  8274. category: 'accessing',
  8275. fn: function (){
  8276. var self=this;
  8277. return (smalltalk.Stream || Stream);
  8278. },
  8279. args: [],
  8280. source: "streamClass\x0a\x09 ^Stream",
  8281. messageSends: [],
  8282. referencedClasses: ["Stream"]
  8283. }),
  8284. smalltalk.Collection.klass);
  8285. smalltalk.addMethod(
  8286. "_with_",
  8287. smalltalk.method({
  8288. selector: "with:",
  8289. category: 'instance creation',
  8290. fn: function (anObject){
  8291. var self=this;
  8292. var $2,$3,$1;
  8293. $2=smalltalk.send(self,"_new",[]);
  8294. smalltalk.send($2,"_add_",[anObject]);
  8295. $3=smalltalk.send($2,"_yourself",[]);
  8296. $1=$3;
  8297. return $1;
  8298. },
  8299. args: ["anObject"],
  8300. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8301. messageSends: ["add:", "new", "yourself"],
  8302. referencedClasses: []
  8303. }),
  8304. smalltalk.Collection.klass);
  8305. smalltalk.addMethod(
  8306. "_with_with_",
  8307. smalltalk.method({
  8308. selector: "with:with:",
  8309. category: 'instance creation',
  8310. fn: function (anObject,anotherObject){
  8311. var self=this;
  8312. var $2,$3,$1;
  8313. $2=smalltalk.send(self,"_new",[]);
  8314. smalltalk.send($2,"_add_",[anObject]);
  8315. smalltalk.send($2,"_add_",[anotherObject]);
  8316. $3=smalltalk.send($2,"_yourself",[]);
  8317. $1=$3;
  8318. return $1;
  8319. },
  8320. args: ["anObject", "anotherObject"],
  8321. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8322. messageSends: ["add:", "new", "yourself"],
  8323. referencedClasses: []
  8324. }),
  8325. smalltalk.Collection.klass);
  8326. smalltalk.addMethod(
  8327. "_with_with_with_",
  8328. smalltalk.method({
  8329. selector: "with:with:with:",
  8330. category: 'instance creation',
  8331. fn: function (firstObject,secondObject,thirdObject){
  8332. var self=this;
  8333. var $2,$3,$1;
  8334. $2=smalltalk.send(self,"_new",[]);
  8335. smalltalk.send($2,"_add_",[firstObject]);
  8336. smalltalk.send($2,"_add_",[secondObject]);
  8337. smalltalk.send($2,"_add_",[thirdObject]);
  8338. $3=smalltalk.send($2,"_yourself",[]);
  8339. $1=$3;
  8340. return $1;
  8341. },
  8342. args: ["firstObject", "secondObject", "thirdObject"],
  8343. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09 ^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  8344. messageSends: ["add:", "new", "yourself"],
  8345. referencedClasses: []
  8346. }),
  8347. smalltalk.Collection.klass);
  8348. smalltalk.addMethod(
  8349. "_withAll_",
  8350. smalltalk.method({
  8351. selector: "withAll:",
  8352. category: 'instance creation',
  8353. fn: function (aCollection){
  8354. var self=this;
  8355. var $2,$3,$1;
  8356. $2=smalltalk.send(self,"_new",[]);
  8357. smalltalk.send($2,"_addAll_",[aCollection]);
  8358. $3=smalltalk.send($2,"_yourself",[]);
  8359. $1=$3;
  8360. return $1;
  8361. },
  8362. args: ["aCollection"],
  8363. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8364. messageSends: ["addAll:", "new", "yourself"],
  8365. referencedClasses: []
  8366. }),
  8367. smalltalk.Collection.klass);
  8368. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  8369. smalltalk.HashedCollection.comment="A HashedCollection is a traditional JavaScript object, or a Smalltalk Dictionary.\x0a\x0aUnlike a Dictionary, it can only have strings as keys."
  8370. smalltalk.addMethod(
  8371. "__comma",
  8372. smalltalk.method({
  8373. selector: ",",
  8374. category: 'copying',
  8375. fn: function (aCollection){
  8376. var self=this;
  8377. smalltalk.send(self,"_shouldNotImplement",[]);
  8378. return self},
  8379. args: ["aCollection"],
  8380. source: ", aCollection\x0a\x09self shouldNotImplement",
  8381. messageSends: ["shouldNotImplement"],
  8382. referencedClasses: []
  8383. }),
  8384. smalltalk.HashedCollection);
  8385. smalltalk.addMethod(
  8386. "__eq",
  8387. smalltalk.method({
  8388. selector: "=",
  8389. category: 'comparing',
  8390. fn: function (aHashedCollection){
  8391. var self=this;
  8392. var $1,$2,$3;
  8393. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aHashedCollection,"_class",[])]);
  8394. if(! smalltalk.assert($1)){
  8395. return false;
  8396. };
  8397. $2=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aHashedCollection,"_size",[])]);
  8398. if(! smalltalk.assert($2)){
  8399. return false;
  8400. };
  8401. $3=smalltalk.send(smalltalk.send(self,"_associations",[]),"__eq",[smalltalk.send(aHashedCollection,"_associations",[])]);
  8402. return $3;
  8403. },
  8404. args: ["aHashedCollection"],
  8405. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  8406. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  8407. referencedClasses: []
  8408. }),
  8409. smalltalk.HashedCollection);
  8410. smalltalk.addMethod(
  8411. "_add_",
  8412. smalltalk.method({
  8413. selector: "add:",
  8414. category: 'adding/removing',
  8415. fn: function (anAssociation){
  8416. var self=this;
  8417. smalltalk.send(self,"_at_put_",[smalltalk.send(anAssociation,"_key",[]),smalltalk.send(anAssociation,"_value",[])]);
  8418. return self},
  8419. args: ["anAssociation"],
  8420. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8421. messageSends: ["at:put:", "key", "value"],
  8422. referencedClasses: []
  8423. }),
  8424. smalltalk.HashedCollection);
  8425. smalltalk.addMethod(
  8426. "_addAll_",
  8427. smalltalk.method({
  8428. selector: "addAll:",
  8429. category: 'adding/removing',
  8430. fn: function (aHashedCollection){
  8431. var self=this;
  8432. smalltalk.send(self,"_addAll_",[smalltalk.send(aHashedCollection,"_associations",[])],smalltalk.Collection);
  8433. return aHashedCollection;
  8434. },
  8435. args: ["aHashedCollection"],
  8436. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  8437. messageSends: ["addAll:", "associations"],
  8438. referencedClasses: []
  8439. }),
  8440. smalltalk.HashedCollection);
  8441. smalltalk.addMethod(
  8442. "_asDictionary",
  8443. smalltalk.method({
  8444. selector: "asDictionary",
  8445. category: 'converting',
  8446. fn: function (){
  8447. var self=this;
  8448. var $1;
  8449. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  8450. return $1;
  8451. },
  8452. args: [],
  8453. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  8454. messageSends: ["fromPairs:", "associations"],
  8455. referencedClasses: ["Dictionary"]
  8456. }),
  8457. smalltalk.HashedCollection);
  8458. smalltalk.addMethod(
  8459. "_asJSON",
  8460. smalltalk.method({
  8461. selector: "asJSON",
  8462. category: 'converting',
  8463. fn: function (){
  8464. var self=this;
  8465. var c;
  8466. c=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8467. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8468. return smalltalk.send(c,"_at_put_",[key,smalltalk.send(value,"_asJSON",[])]);
  8469. })]);
  8470. return c;
  8471. },
  8472. args: [],
  8473. 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",
  8474. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  8475. referencedClasses: []
  8476. }),
  8477. smalltalk.HashedCollection);
  8478. smalltalk.addMethod(
  8479. "_associations",
  8480. smalltalk.method({
  8481. selector: "associations",
  8482. category: 'accessing',
  8483. fn: function (){
  8484. var self=this;
  8485. var associations;
  8486. associations=[];
  8487. smalltalk.send(smalltalk.send(self,"_keys",[]),"_do_",[(function(each){
  8488. return smalltalk.send(associations,"_add_",[smalltalk.send((smalltalk.Association || Association),"_key_value_",[each,smalltalk.send(self,"_at_",[each])])]);
  8489. })]);
  8490. return associations;
  8491. },
  8492. args: [],
  8493. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self keys do: [:each |\x0a\x09 associations add: (Association key: each value: (self at: each))].\x0a\x09^associations",
  8494. messageSends: ["do:", "add:", "key:value:", "at:", "keys"],
  8495. referencedClasses: ["Association"]
  8496. }),
  8497. smalltalk.HashedCollection);
  8498. smalltalk.addMethod(
  8499. "_associationsDo_",
  8500. smalltalk.method({
  8501. selector: "associationsDo:",
  8502. category: 'enumerating',
  8503. fn: function (aBlock){
  8504. var self=this;
  8505. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_",[aBlock]);
  8506. return self},
  8507. args: ["aBlock"],
  8508. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  8509. messageSends: ["do:", "associations"],
  8510. referencedClasses: []
  8511. }),
  8512. smalltalk.HashedCollection);
  8513. smalltalk.addMethod(
  8514. "_at_",
  8515. smalltalk.method({
  8516. selector: "at:",
  8517. category: 'accessing',
  8518. fn: function (aKey){
  8519. var self=this;
  8520. var $1;
  8521. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8522. return smalltalk.send(self,"_errorNotFound",[]);
  8523. })]);
  8524. return $1;
  8525. },
  8526. args: ["aKey"],
  8527. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  8528. messageSends: ["at:ifAbsent:", "errorNotFound"],
  8529. referencedClasses: []
  8530. }),
  8531. smalltalk.HashedCollection);
  8532. smalltalk.addMethod(
  8533. "_at_ifAbsent_",
  8534. smalltalk.method({
  8535. selector: "at:ifAbsent:",
  8536. category: 'accessing',
  8537. fn: function (aKey,aBlock){
  8538. var self=this;
  8539. var $2,$1;
  8540. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8541. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8542. return smalltalk.send(self,"_basicAt_",[aKey]);
  8543. }),aBlock]);
  8544. return $1;
  8545. },
  8546. args: ["aKey", "aBlock"],
  8547. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  8548. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  8549. referencedClasses: []
  8550. }),
  8551. smalltalk.HashedCollection);
  8552. smalltalk.addMethod(
  8553. "_at_ifAbsentPut_",
  8554. smalltalk.method({
  8555. selector: "at:ifAbsentPut:",
  8556. category: 'accessing',
  8557. fn: function (aKey,aBlock){
  8558. var self=this;
  8559. var $1;
  8560. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8561. return smalltalk.send(self,"_at_put_",[aKey,smalltalk.send(aBlock,"_value",[])]);
  8562. })]);
  8563. return $1;
  8564. },
  8565. args: ["aKey", "aBlock"],
  8566. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  8567. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  8568. referencedClasses: []
  8569. }),
  8570. smalltalk.HashedCollection);
  8571. smalltalk.addMethod(
  8572. "_at_ifPresent_",
  8573. smalltalk.method({
  8574. selector: "at:ifPresent:",
  8575. category: 'accessing',
  8576. fn: function (aKey,aBlock){
  8577. var self=this;
  8578. var $2,$1;
  8579. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8580. if(smalltalk.assert($2)){
  8581. $1=smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8582. } else {
  8583. $1=nil;
  8584. };
  8585. return $1;
  8586. },
  8587. args: ["aKey", "aBlock"],
  8588. source: "at: aKey ifPresent: aBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the given block with the value associated with the key. \x0a\x09Otherwise, answer nil.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ nil ]",
  8589. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8590. referencedClasses: []
  8591. }),
  8592. smalltalk.HashedCollection);
  8593. smalltalk.addMethod(
  8594. "_at_ifPresent_ifAbsent_",
  8595. smalltalk.method({
  8596. selector: "at:ifPresent:ifAbsent:",
  8597. category: 'accessing',
  8598. fn: function (aKey,aBlock,anotherBlock){
  8599. var self=this;
  8600. var $2,$1;
  8601. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8602. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8603. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8604. }),anotherBlock]);
  8605. return $1;
  8606. },
  8607. args: ["aKey", "aBlock", "anotherBlock"],
  8608. 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",
  8609. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8610. referencedClasses: []
  8611. }),
  8612. smalltalk.HashedCollection);
  8613. smalltalk.addMethod(
  8614. "_at_put_",
  8615. smalltalk.method({
  8616. selector: "at:put:",
  8617. category: 'accessing',
  8618. fn: function (aKey,aValue){
  8619. var self=this;
  8620. var $1;
  8621. $1=smalltalk.send(self,"_basicAt_put_",[aKey,aValue]);
  8622. return $1;
  8623. },
  8624. args: ["aKey", "aValue"],
  8625. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  8626. messageSends: ["basicAt:put:"],
  8627. referencedClasses: []
  8628. }),
  8629. smalltalk.HashedCollection);
  8630. smalltalk.addMethod(
  8631. "_collect_",
  8632. smalltalk.method({
  8633. selector: "collect:",
  8634. category: 'enumerating',
  8635. fn: function (aBlock){
  8636. var self=this;
  8637. var newDict;
  8638. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8639. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8640. return smalltalk.send(newDict,"_at_put_",[key,smalltalk.send(aBlock,"_value_",[value])]);
  8641. })]);
  8642. return newDict;
  8643. },
  8644. args: ["aBlock"],
  8645. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  8646. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  8647. referencedClasses: []
  8648. }),
  8649. smalltalk.HashedCollection);
  8650. smalltalk.addMethod(
  8651. "_copyFrom_to_",
  8652. smalltalk.method({
  8653. selector: "copyFrom:to:",
  8654. category: 'copying',
  8655. fn: function (anIndex,anotherIndex){
  8656. var self=this;
  8657. smalltalk.send(self,"_shouldNotImplement",[]);
  8658. return self},
  8659. args: ["anIndex", "anotherIndex"],
  8660. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  8661. messageSends: ["shouldNotImplement"],
  8662. referencedClasses: []
  8663. }),
  8664. smalltalk.HashedCollection);
  8665. smalltalk.addMethod(
  8666. "_deepCopy",
  8667. smalltalk.method({
  8668. selector: "deepCopy",
  8669. category: 'copying',
  8670. fn: function (){
  8671. var self=this;
  8672. var copy;
  8673. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8674. smalltalk.send(self,"_associationsDo_",[(function(each){
  8675. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(smalltalk.send(each,"_value",[]),"_deepCopy",[])]);
  8676. })]);
  8677. return copy;
  8678. },
  8679. args: [],
  8680. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value deepCopy].\x0a\x09^copy",
  8681. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  8682. referencedClasses: []
  8683. }),
  8684. smalltalk.HashedCollection);
  8685. smalltalk.addMethod(
  8686. "_detect_ifNone_",
  8687. smalltalk.method({
  8688. selector: "detect:ifNone:",
  8689. category: 'enumerating',
  8690. fn: function (aBlock,anotherBlock){
  8691. var self=this;
  8692. var $1;
  8693. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_detect_ifNone_",[aBlock,anotherBlock]);
  8694. return $1;
  8695. },
  8696. args: ["aBlock", "anotherBlock"],
  8697. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  8698. messageSends: ["detect:ifNone:", "values"],
  8699. referencedClasses: []
  8700. }),
  8701. smalltalk.HashedCollection);
  8702. smalltalk.addMethod(
  8703. "_do_",
  8704. smalltalk.method({
  8705. selector: "do:",
  8706. category: 'enumerating',
  8707. fn: function (aBlock){
  8708. var self=this;
  8709. smalltalk.send(smalltalk.send(self,"_values",[]),"_do_",[aBlock]);
  8710. return self},
  8711. args: ["aBlock"],
  8712. source: "do: aBlock\x0a\x09self values do: aBlock",
  8713. messageSends: ["do:", "values"],
  8714. referencedClasses: []
  8715. }),
  8716. smalltalk.HashedCollection);
  8717. smalltalk.addMethod(
  8718. "_includes_",
  8719. smalltalk.method({
  8720. selector: "includes:",
  8721. category: 'enumerating',
  8722. fn: function (anObject){
  8723. var self=this;
  8724. var $1;
  8725. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_includes_",[anObject]);
  8726. return $1;
  8727. },
  8728. args: ["anObject"],
  8729. source: "includes: anObject\x0a\x09^self values includes: anObject",
  8730. messageSends: ["includes:", "values"],
  8731. referencedClasses: []
  8732. }),
  8733. smalltalk.HashedCollection);
  8734. smalltalk.addMethod(
  8735. "_includesKey_",
  8736. smalltalk.method({
  8737. selector: "includesKey:",
  8738. category: 'testing',
  8739. fn: function (aKey){
  8740. var self=this;
  8741. return self.hasOwnProperty(aKey);
  8742. ;
  8743. return self},
  8744. args: ["aKey"],
  8745. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  8746. messageSends: [],
  8747. referencedClasses: []
  8748. }),
  8749. smalltalk.HashedCollection);
  8750. smalltalk.addMethod(
  8751. "_keys",
  8752. smalltalk.method({
  8753. selector: "keys",
  8754. category: 'accessing',
  8755. fn: function (){
  8756. var self=this;
  8757. if ('function'===typeof Object.keys) return Object.keys(self);
  8758. var keys = [];
  8759. for(var i in self) {
  8760. if(self.hasOwnProperty(i)) {
  8761. keys.push(i);
  8762. }
  8763. };
  8764. return keys;
  8765. ;
  8766. ;
  8767. return self},
  8768. args: [],
  8769. 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>",
  8770. messageSends: [],
  8771. referencedClasses: []
  8772. }),
  8773. smalltalk.HashedCollection);
  8774. smalltalk.addMethod(
  8775. "_keysAndValuesDo_",
  8776. smalltalk.method({
  8777. selector: "keysAndValuesDo:",
  8778. category: 'enumerating',
  8779. fn: function (aBlock){
  8780. var self=this;
  8781. smalltalk.send(self,"_associationsDo_",[(function(each){
  8782. return smalltalk.send(aBlock,"_value_value_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8783. })]);
  8784. return self},
  8785. args: ["aBlock"],
  8786. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  8787. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  8788. referencedClasses: []
  8789. }),
  8790. smalltalk.HashedCollection);
  8791. smalltalk.addMethod(
  8792. "_printString",
  8793. smalltalk.method({
  8794. selector: "printString",
  8795. category: 'printing',
  8796. fn: function (){
  8797. var self=this;
  8798. var $1;
  8799. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  8800. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("a ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])]),"__comma",["("])]);
  8801. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8802. return smalltalk.send(each,"_storeOn_",[aStream]);
  8803. }),(function(){
  8804. return smalltalk.send(aStream,"_nextPutAll_",[" , "]);
  8805. })]);
  8806. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  8807. })]);
  8808. return $1;
  8809. },
  8810. args: [],
  8811. source: "printString\x0a\x09\x22print the contents of the HashedCollection into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream nextPutAll: 'a ', self class name, '('.\x0a\x09\x09self associations\x0a\x09\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' , '].\x0a\x09\x09aStream nextPutAll: ')']",
  8812. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  8813. referencedClasses: ["String"]
  8814. }),
  8815. smalltalk.HashedCollection);
  8816. smalltalk.addMethod(
  8817. "_remove_ifAbsent_",
  8818. smalltalk.method({
  8819. selector: "remove:ifAbsent:",
  8820. category: 'adding/removing',
  8821. fn: function (aKey,aBlock){
  8822. var self=this;
  8823. var $1;
  8824. $1=smalltalk.send(self,"_removeKey_ifAbsent_",[aKey,aBlock]);
  8825. return $1;
  8826. },
  8827. args: ["aKey", "aBlock"],
  8828. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  8829. messageSends: ["removeKey:ifAbsent:"],
  8830. referencedClasses: []
  8831. }),
  8832. smalltalk.HashedCollection);
  8833. smalltalk.addMethod(
  8834. "_removeKey_",
  8835. smalltalk.method({
  8836. selector: "removeKey:",
  8837. category: 'adding/removing',
  8838. fn: function (aKey){
  8839. var self=this;
  8840. var $1;
  8841. $1=smalltalk.send(self,"_remove_",[aKey]);
  8842. return $1;
  8843. },
  8844. args: ["aKey"],
  8845. source: "removeKey: aKey\x0a ^self remove: aKey",
  8846. messageSends: ["remove:"],
  8847. referencedClasses: []
  8848. }),
  8849. smalltalk.HashedCollection);
  8850. smalltalk.addMethod(
  8851. "_removeKey_ifAbsent_",
  8852. smalltalk.method({
  8853. selector: "removeKey:ifAbsent:",
  8854. category: 'adding/removing',
  8855. fn: function (aKey,aBlock){
  8856. var self=this;
  8857. var $2,$1;
  8858. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8859. if(smalltalk.assert($2)){
  8860. $1=smalltalk.send(self,"_basicDelete_",[aKey]);
  8861. } else {
  8862. $1=smalltalk.send(aBlock,"_value",[]);
  8863. };
  8864. return $1;
  8865. },
  8866. args: ["aKey", "aBlock"],
  8867. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  8868. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  8869. referencedClasses: []
  8870. }),
  8871. smalltalk.HashedCollection);
  8872. smalltalk.addMethod(
  8873. "_select_",
  8874. smalltalk.method({
  8875. selector: "select:",
  8876. category: 'enumerating',
  8877. fn: function (aBlock){
  8878. var self=this;
  8879. var $1;
  8880. var newDict;
  8881. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8882. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8883. $1=smalltalk.send(aBlock,"_value_",[value]);
  8884. if(smalltalk.assert($1)){
  8885. return smalltalk.send(newDict,"_at_put_",[key,value]);
  8886. };
  8887. })]);
  8888. return newDict;
  8889. },
  8890. args: ["aBlock"],
  8891. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 (aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  8892. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  8893. referencedClasses: []
  8894. }),
  8895. smalltalk.HashedCollection);
  8896. smalltalk.addMethod(
  8897. "_shallowCopy",
  8898. smalltalk.method({
  8899. selector: "shallowCopy",
  8900. category: 'copying',
  8901. fn: function (){
  8902. var self=this;
  8903. var copy;
  8904. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8905. smalltalk.send(self,"_associationsDo_",[(function(each){
  8906. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8907. })]);
  8908. return copy;
  8909. },
  8910. args: [],
  8911. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self associationsDo: [:each |\x0a\x09 copy at: each key put: each value].\x0a\x09^copy",
  8912. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  8913. referencedClasses: []
  8914. }),
  8915. smalltalk.HashedCollection);
  8916. smalltalk.addMethod(
  8917. "_size",
  8918. smalltalk.method({
  8919. selector: "size",
  8920. category: 'accessing',
  8921. fn: function (){
  8922. var self=this;
  8923. var $1;
  8924. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_size",[]);
  8925. return $1;
  8926. },
  8927. args: [],
  8928. source: "size\x0a\x09^self keys size",
  8929. messageSends: ["size", "keys"],
  8930. referencedClasses: []
  8931. }),
  8932. smalltalk.HashedCollection);
  8933. smalltalk.addMethod(
  8934. "_storeOn_",
  8935. smalltalk.method({
  8936. selector: "storeOn:",
  8937. category: 'printing',
  8938. fn: function (aStream){
  8939. var self=this;
  8940. smalltalk.send(aStream,"_nextPutAll_",["#{"]);
  8941. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8942. return smalltalk.send(each,"_storeOn_",[aStream]);
  8943. }),(function(){
  8944. return smalltalk.send(aStream,"_nextPutAll_",[". "]);
  8945. })]);
  8946. smalltalk.send(aStream,"_nextPutAll_",["}"]);
  8947. return self},
  8948. args: ["aStream"],
  8949. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  8950. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  8951. referencedClasses: []
  8952. }),
  8953. smalltalk.HashedCollection);
  8954. smalltalk.addMethod(
  8955. "_values",
  8956. smalltalk.method({
  8957. selector: "values",
  8958. category: 'accessing',
  8959. fn: function (){
  8960. var self=this;
  8961. var $1;
  8962. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_collect_",[(function(each){
  8963. return smalltalk.send(self,"_at_",[each]);
  8964. })]);
  8965. return $1;
  8966. },
  8967. args: [],
  8968. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  8969. messageSends: ["collect:", "at:", "keys"],
  8970. referencedClasses: []
  8971. }),
  8972. smalltalk.HashedCollection);
  8973. smalltalk.addMethod(
  8974. "_fromPairs_",
  8975. smalltalk.method({
  8976. selector: "fromPairs:",
  8977. category: 'instance creation',
  8978. fn: function (aCollection){
  8979. var self=this;
  8980. var dict;
  8981. dict=smalltalk.send(self,"_new",[]);
  8982. smalltalk.send(aCollection,"_do_",[(function(each){
  8983. return smalltalk.send(dict,"_add_",[each]);
  8984. })]);
  8985. return dict;
  8986. },
  8987. args: ["aCollection"],
  8988. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  8989. messageSends: ["new", "do:", "add:"],
  8990. referencedClasses: []
  8991. }),
  8992. smalltalk.HashedCollection.klass);
  8993. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  8994. smalltalk.addMethod(
  8995. "_asHashedCollection",
  8996. smalltalk.method({
  8997. selector: "asHashedCollection",
  8998. category: 'converting',
  8999. fn: function (){
  9000. var self=this;
  9001. var $1;
  9002. $1=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  9003. return $1;
  9004. },
  9005. args: [],
  9006. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  9007. messageSends: ["fromPairs:", "associations"],
  9008. referencedClasses: ["HashedCollection"]
  9009. }),
  9010. smalltalk.Dictionary);
  9011. smalltalk.addMethod(
  9012. "_asJSON",
  9013. smalltalk.method({
  9014. selector: "asJSON",
  9015. category: 'converting',
  9016. fn: function (){
  9017. var self=this;
  9018. var $1;
  9019. $1=smalltalk.send(smalltalk.send(self,"_asHashedCollection",[]),"_asJSON",[]);
  9020. return $1;
  9021. },
  9022. args: [],
  9023. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  9024. messageSends: ["asJSON", "asHashedCollection"],
  9025. referencedClasses: []
  9026. }),
  9027. smalltalk.Dictionary);
  9028. smalltalk.addMethod(
  9029. "_at_ifAbsent_",
  9030. smalltalk.method({
  9031. selector: "at:ifAbsent:",
  9032. category: 'accessing',
  9033. fn: function (aKey,aBlock){
  9034. var self=this;
  9035. var index;
  9036. for(var i=0;i<self['@keys'].length;i++){
  9037. if(self['@keys'][i].__eq(aKey)) {index = i;}
  9038. };
  9039. if(typeof index === 'undefined') {
  9040. return aBlock();
  9041. } else {
  9042. return self['@values'][index];
  9043. }
  9044. ;
  9045. ;
  9046. return self},
  9047. args: ["aKey", "aBlock"],
  9048. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index;\x0a\x09\x09for(var i=0;i<self['@keys'].length;i++){\x0a\x09\x09\x09if(self['@keys'][i].__eq(aKey)) {index = i;}\x0a\x09\x09};\x0a\x09\x09if(typeof index === 'undefined') {\x0a\x09\x09\x09return aBlock();\x0a\x09\x09} else {\x0a\x09\x09\x09return self['@values'][index];\x0a\x09\x09}\x0a\x09>",
  9049. messageSends: [],
  9050. referencedClasses: []
  9051. }),
  9052. smalltalk.Dictionary);
  9053. smalltalk.addMethod(
  9054. "_at_put_",
  9055. smalltalk.method({
  9056. selector: "at:put:",
  9057. category: 'accessing',
  9058. fn: function (aKey,aValue){
  9059. var self=this;
  9060. var index = self['@keys'].indexOf(aKey);
  9061. if(index === -1) {
  9062. self['@values'].push(aValue);
  9063. self['@keys'].push(aKey);
  9064. } else {
  9065. self['@values'][index] = aValue;
  9066. };
  9067. return aValue;
  9068. ;
  9069. ;
  9070. return self},
  9071. args: ["aKey", "aValue"],
  9072. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self['@keys'].indexOf(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09self['@values'].push(aValue);\x0a\x09\x09\x09self['@keys'].push(aKey);\x0a\x09\x09} else {\x0a\x09\x09\x09self['@values'][index] = aValue;\x0a\x09\x09};\x0a\x0a\x09\x09return aValue;\x0a\x09>",
  9073. messageSends: [],
  9074. referencedClasses: []
  9075. }),
  9076. smalltalk.Dictionary);
  9077. smalltalk.addMethod(
  9078. "_includesKey_",
  9079. smalltalk.method({
  9080. selector: "includesKey:",
  9081. category: 'testing',
  9082. fn: function (aKey){
  9083. var self=this;
  9084. var $1;
  9085. $1=smalltalk.send(self["@keys"],"_includes_",[aKey]);
  9086. return $1;
  9087. },
  9088. args: ["aKey"],
  9089. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  9090. messageSends: ["includes:"],
  9091. referencedClasses: []
  9092. }),
  9093. smalltalk.Dictionary);
  9094. smalltalk.addMethod(
  9095. "_initialize",
  9096. smalltalk.method({
  9097. selector: "initialize",
  9098. category: 'initialization',
  9099. fn: function (){
  9100. var self=this;
  9101. smalltalk.send(self,"_initialize",[],smalltalk.HashedCollection);
  9102. self["@keys"]=[];
  9103. self["@values"]=[];
  9104. return self},
  9105. args: [],
  9106. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9107. messageSends: ["initialize"],
  9108. referencedClasses: []
  9109. }),
  9110. smalltalk.Dictionary);
  9111. smalltalk.addMethod(
  9112. "_keyAtValue_",
  9113. smalltalk.method({
  9114. selector: "keyAtValue:",
  9115. category: 'accessing',
  9116. fn: function (anObject){
  9117. var self=this;
  9118. var $1;
  9119. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_associations",[]),"_detect_ifNone_",[(function(k,v){
  9120. return smalltalk.send(v,"__eq_eq",[anObject]);
  9121. }),(function(){
  9122. return smalltalk.send(self,"_error_",["Not found"]);
  9123. })]),"_key",[]);
  9124. return $1;
  9125. },
  9126. args: ["anObject"],
  9127. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  9128. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  9129. referencedClasses: []
  9130. }),
  9131. smalltalk.Dictionary);
  9132. smalltalk.addMethod(
  9133. "_keys",
  9134. smalltalk.method({
  9135. selector: "keys",
  9136. category: 'accessing',
  9137. fn: function (){
  9138. var self=this;
  9139. var $1;
  9140. $1=smalltalk.send(self["@keys"],"_copy",[]);
  9141. return $1;
  9142. },
  9143. args: [],
  9144. source: "keys\x0a\x09^keys copy",
  9145. messageSends: ["copy"],
  9146. referencedClasses: []
  9147. }),
  9148. smalltalk.Dictionary);
  9149. smalltalk.addMethod(
  9150. "_removeKey_ifAbsent_",
  9151. smalltalk.method({
  9152. selector: "removeKey:ifAbsent:",
  9153. category: 'adding/removing',
  9154. fn: function (aKey,aBlock){
  9155. var self=this;
  9156. var index = self['@keys'].indexOf(aKey);
  9157. if(index === -1) {
  9158. return aBlock()
  9159. } else {
  9160. var value;
  9161. self['@keys'].splice(index, 1);
  9162. value = self['@values'].splice(index, 1);
  9163. return value[0];
  9164. };
  9165. ;
  9166. ;
  9167. return self},
  9168. args: ["aKey", "aBlock"],
  9169. source: "removeKey: aKey ifAbsent: aBlock\x0a <\x0a var index = self['@keys'].indexOf(aKey);\x0a if(index === -1) {\x0a return aBlock()\x0a } else {\x0a var value;\x0a self['@keys'].splice(index, 1);\x0a value = self['@values'].splice(index, 1);\x0a return value[0];\x0a };\x0a >",
  9170. messageSends: [],
  9171. referencedClasses: []
  9172. }),
  9173. smalltalk.Dictionary);
  9174. smalltalk.addMethod(
  9175. "_valueAt_",
  9176. smalltalk.method({
  9177. selector: "valueAt:",
  9178. category: 'accessing',
  9179. fn: function (anObject){
  9180. var self=this;
  9181. var $1;
  9182. $1=smalltalk.send(self,"_associationsDo_",[(2)]);
  9183. return $1;
  9184. },
  9185. args: ["anObject"],
  9186. source: "valueAt: anObject\x0a\x0a\x09^ self associationsDo:2",
  9187. messageSends: ["associationsDo:"],
  9188. referencedClasses: []
  9189. }),
  9190. smalltalk.Dictionary);
  9191. smalltalk.addMethod(
  9192. "_values",
  9193. smalltalk.method({
  9194. selector: "values",
  9195. category: 'accessing',
  9196. fn: function (){
  9197. var self=this;
  9198. var $1;
  9199. $1=smalltalk.send(self["@values"],"_copy",[]);
  9200. return $1;
  9201. },
  9202. args: [],
  9203. source: "values\x0a\x09^values copy",
  9204. messageSends: ["copy"],
  9205. referencedClasses: []
  9206. }),
  9207. smalltalk.Dictionary);
  9208. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9209. smalltalk.addMethod(
  9210. "__eq",
  9211. smalltalk.method({
  9212. selector: "=",
  9213. category: 'comparing',
  9214. fn: function (aCollection){
  9215. var self=this;
  9216. var $1,$2;
  9217. var $early={};
  9218. try {
  9219. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  9220. return smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aCollection,"_size",[])]);
  9221. })]);
  9222. if(! smalltalk.assert($1)){
  9223. return false;
  9224. };
  9225. smalltalk.send(self,"_withIndexDo_",[(function(each,i){
  9226. $2=smalltalk.send(smalltalk.send(aCollection,"_at_",[i]),"__eq",[each]);
  9227. if(! smalltalk.assert($2)){
  9228. throw $early=[false];
  9229. };
  9230. })]);
  9231. return true;
  9232. }
  9233. catch(e) {if(e===$early)return e[0]; throw e}
  9234. },
  9235. args: ["aCollection"],
  9236. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a (aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  9237. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  9238. referencedClasses: []
  9239. }),
  9240. smalltalk.SequenceableCollection);
  9241. smalltalk.addMethod(
  9242. "_addLast_",
  9243. smalltalk.method({
  9244. selector: "addLast:",
  9245. category: 'adding',
  9246. fn: function (anObject){
  9247. var self=this;
  9248. smalltalk.send(self,"_add_",[anObject]);
  9249. return self},
  9250. args: ["anObject"],
  9251. source: "addLast: anObject\x0a\x09self add: anObject",
  9252. messageSends: ["add:"],
  9253. referencedClasses: []
  9254. }),
  9255. smalltalk.SequenceableCollection);
  9256. smalltalk.addMethod(
  9257. "_allButFirst",
  9258. smalltalk.method({
  9259. selector: "allButFirst",
  9260. category: 'accessing',
  9261. fn: function (){
  9262. var self=this;
  9263. var $1;
  9264. $1=smalltalk.send(self,"_copyFrom_to_",[(2),smalltalk.send(self,"_size",[])]);
  9265. return $1;
  9266. },
  9267. args: [],
  9268. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  9269. messageSends: ["copyFrom:to:", "size"],
  9270. referencedClasses: []
  9271. }),
  9272. smalltalk.SequenceableCollection);
  9273. smalltalk.addMethod(
  9274. "_allButLast",
  9275. smalltalk.method({
  9276. selector: "allButLast",
  9277. category: 'accessing',
  9278. fn: function (){
  9279. var self=this;
  9280. var $1;
  9281. $1=smalltalk.send(self,"_copyFrom_to_",[(1),smalltalk.send(smalltalk.send(self,"_size",[]),"__minus",[(1)])]);
  9282. return $1;
  9283. },
  9284. args: [],
  9285. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  9286. messageSends: ["copyFrom:to:", "-", "size"],
  9287. referencedClasses: []
  9288. }),
  9289. smalltalk.SequenceableCollection);
  9290. smalltalk.addMethod(
  9291. "_at_",
  9292. smalltalk.method({
  9293. selector: "at:",
  9294. category: 'accessing',
  9295. fn: function (anIndex){
  9296. var self=this;
  9297. var $1;
  9298. $1=smalltalk.send(self,"_at_ifAbsent_",[anIndex,(function(){
  9299. return smalltalk.send(self,"_errorNotFound",[]);
  9300. })]);
  9301. return $1;
  9302. },
  9303. args: ["anIndex"],
  9304. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  9305. messageSends: ["at:ifAbsent:", "errorNotFound"],
  9306. referencedClasses: []
  9307. }),
  9308. smalltalk.SequenceableCollection);
  9309. smalltalk.addMethod(
  9310. "_at_ifAbsent_",
  9311. smalltalk.method({
  9312. selector: "at:ifAbsent:",
  9313. category: 'accessing',
  9314. fn: function (anIndex,aBlock){
  9315. var self=this;
  9316. smalltalk.send(self,"_subclassResponsibility",[]);
  9317. return self},
  9318. args: ["anIndex", "aBlock"],
  9319. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9320. messageSends: ["subclassResponsibility"],
  9321. referencedClasses: []
  9322. }),
  9323. smalltalk.SequenceableCollection);
  9324. smalltalk.addMethod(
  9325. "_at_put_",
  9326. smalltalk.method({
  9327. selector: "at:put:",
  9328. category: 'accessing',
  9329. fn: function (anIndex,anObject){
  9330. var self=this;
  9331. smalltalk.send(self,"_subclassResponsibility",[]);
  9332. return self},
  9333. args: ["anIndex", "anObject"],
  9334. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  9335. messageSends: ["subclassResponsibility"],
  9336. referencedClasses: []
  9337. }),
  9338. smalltalk.SequenceableCollection);
  9339. smalltalk.addMethod(
  9340. "_atRandom",
  9341. smalltalk.method({
  9342. selector: "atRandom",
  9343. category: 'accessing',
  9344. fn: function (){
  9345. var self=this;
  9346. var $1;
  9347. $1=smalltalk.send(self,"_at_",[smalltalk.send(smalltalk.send(self,"_size",[]),"_atRandom",[])]);
  9348. return $1;
  9349. },
  9350. args: [],
  9351. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9352. messageSends: ["at:", "atRandom", "size"],
  9353. referencedClasses: []
  9354. }),
  9355. smalltalk.SequenceableCollection);
  9356. smalltalk.addMethod(
  9357. "_copyFrom_to_",
  9358. smalltalk.method({
  9359. selector: "copyFrom:to:",
  9360. category: 'copying',
  9361. fn: function (anIndex,anotherIndex){
  9362. var self=this;
  9363. var range;
  9364. var newCollection;
  9365. range=smalltalk.send(anIndex,"_to_",[anotherIndex]);
  9366. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(range,"_size",[])]);
  9367. smalltalk.send(range,"_withIndexDo_",[(function(each,i){
  9368. return smalltalk.send(newCollection,"_at_put_",[i,smalltalk.send(self,"_at_",[each])]);
  9369. })]);
  9370. return newCollection;
  9371. },
  9372. args: ["anIndex", "anotherIndex"],
  9373. 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 newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  9374. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  9375. referencedClasses: []
  9376. }),
  9377. smalltalk.SequenceableCollection);
  9378. smalltalk.addMethod(
  9379. "_deepCopy",
  9380. smalltalk.method({
  9381. selector: "deepCopy",
  9382. category: 'copying',
  9383. fn: function (){
  9384. var self=this;
  9385. var newCollection;
  9386. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9387. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9388. return smalltalk.send(newCollection,"_at_put_",[index,smalltalk.send(each,"_deepCopy",[])]);
  9389. })]);
  9390. return newCollection;
  9391. },
  9392. args: [],
  9393. 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",
  9394. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  9395. referencedClasses: []
  9396. }),
  9397. smalltalk.SequenceableCollection);
  9398. smalltalk.addMethod(
  9399. "_first",
  9400. smalltalk.method({
  9401. selector: "first",
  9402. category: 'accessing',
  9403. fn: function (){
  9404. var self=this;
  9405. var $1;
  9406. $1=smalltalk.send(self,"_at_",[(1)]);
  9407. return $1;
  9408. },
  9409. args: [],
  9410. source: "first\x0a\x09^self at: 1",
  9411. messageSends: ["at:"],
  9412. referencedClasses: []
  9413. }),
  9414. smalltalk.SequenceableCollection);
  9415. smalltalk.addMethod(
  9416. "_first_",
  9417. smalltalk.method({
  9418. selector: "first:",
  9419. category: 'accessing',
  9420. fn: function (n){
  9421. var self=this;
  9422. var $1;
  9423. $1=smalltalk.send(self,"_copyFrom_to_",[(1),n]);
  9424. return $1;
  9425. },
  9426. args: ["n"],
  9427. 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",
  9428. messageSends: ["copyFrom:to:"],
  9429. referencedClasses: []
  9430. }),
  9431. smalltalk.SequenceableCollection);
  9432. smalltalk.addMethod(
  9433. "_fourth",
  9434. smalltalk.method({
  9435. selector: "fourth",
  9436. category: 'accessing',
  9437. fn: function (){
  9438. var self=this;
  9439. var $1;
  9440. $1=smalltalk.send(self,"_at_",[(4)]);
  9441. return $1;
  9442. },
  9443. args: [],
  9444. source: "fourth\x0a\x09^self at: 4",
  9445. messageSends: ["at:"],
  9446. referencedClasses: []
  9447. }),
  9448. smalltalk.SequenceableCollection);
  9449. smalltalk.addMethod(
  9450. "_indexOf_",
  9451. smalltalk.method({
  9452. selector: "indexOf:",
  9453. category: 'accessing',
  9454. fn: function (anObject){
  9455. var self=this;
  9456. var $1;
  9457. $1=smalltalk.send(self,"_indexOf_ifAbsent_",[anObject,(function(){
  9458. return smalltalk.send(self,"_errorNotFound",[]);
  9459. })]);
  9460. return $1;
  9461. },
  9462. args: ["anObject"],
  9463. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  9464. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  9465. referencedClasses: []
  9466. }),
  9467. smalltalk.SequenceableCollection);
  9468. smalltalk.addMethod(
  9469. "_indexOf_ifAbsent_",
  9470. smalltalk.method({
  9471. selector: "indexOf:ifAbsent:",
  9472. category: 'accessing',
  9473. fn: function (anObject,aBlock){
  9474. var self=this;
  9475. for(var i=0;i<self.length;i++) {
  9476. if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
  9477. };
  9478. return aBlock();
  9479. ;
  9480. ;
  9481. return self},
  9482. args: ["anObject", "aBlock"],
  9483. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
  9484. messageSends: [],
  9485. referencedClasses: []
  9486. }),
  9487. smalltalk.SequenceableCollection);
  9488. smalltalk.addMethod(
  9489. "_indexOf_startingAt_",
  9490. smalltalk.method({
  9491. selector: "indexOf:startingAt:",
  9492. category: 'accessing',
  9493. fn: function (anObject,start){
  9494. var self=this;
  9495. var $1;
  9496. $1=smalltalk.send(self,"_indexOf_startingAt_ifAbsent_",[anObject,start,(function(){
  9497. return (0);
  9498. })]);
  9499. return $1;
  9500. },
  9501. args: ["anObject", "start"],
  9502. 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]",
  9503. messageSends: ["indexOf:startingAt:ifAbsent:"],
  9504. referencedClasses: []
  9505. }),
  9506. smalltalk.SequenceableCollection);
  9507. smalltalk.addMethod(
  9508. "_indexOf_startingAt_ifAbsent_",
  9509. smalltalk.method({
  9510. selector: "indexOf:startingAt:ifAbsent:",
  9511. category: 'accessing',
  9512. fn: function (anObject,start,aBlock){
  9513. var self=this;
  9514. for(var i=start-1;i<self.length;i++){
  9515. if(self[i].__eq(anObject)) {return i+1}
  9516. }
  9517. return aBlock();
  9518. ;
  9519. ;
  9520. return self},
  9521. args: ["anObject", "start", "aBlock"],
  9522. 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();\x0a\x09>",
  9523. messageSends: [],
  9524. referencedClasses: []
  9525. }),
  9526. smalltalk.SequenceableCollection);
  9527. smalltalk.addMethod(
  9528. "_last",
  9529. smalltalk.method({
  9530. selector: "last",
  9531. category: 'accessing',
  9532. fn: function (){
  9533. var self=this;
  9534. var $1;
  9535. $1=smalltalk.send(self,"_at_",[smalltalk.send(self,"_size",[])]);
  9536. return $1;
  9537. },
  9538. args: [],
  9539. source: "last\x0a\x09^self at: self size",
  9540. messageSends: ["at:", "size"],
  9541. referencedClasses: []
  9542. }),
  9543. smalltalk.SequenceableCollection);
  9544. smalltalk.addMethod(
  9545. "_removeLast",
  9546. smalltalk.method({
  9547. selector: "removeLast",
  9548. category: 'adding',
  9549. fn: function (){
  9550. var self=this;
  9551. smalltalk.send(self,"_remove_",[smalltalk.send(self,"_last",[])]);
  9552. return self},
  9553. args: [],
  9554. source: "removeLast\x0a\x09self remove: self last",
  9555. messageSends: ["remove:", "last"],
  9556. referencedClasses: []
  9557. }),
  9558. smalltalk.SequenceableCollection);
  9559. smalltalk.addMethod(
  9560. "_reversed",
  9561. smalltalk.method({
  9562. selector: "reversed",
  9563. category: 'converting',
  9564. fn: function (){
  9565. var self=this;
  9566. smalltalk.send(self,"_subclassResponsibility",[]);
  9567. return self},
  9568. args: [],
  9569. source: "reversed\x0a\x09self subclassResponsibility",
  9570. messageSends: ["subclassResponsibility"],
  9571. referencedClasses: []
  9572. }),
  9573. smalltalk.SequenceableCollection);
  9574. smalltalk.addMethod(
  9575. "_second",
  9576. smalltalk.method({
  9577. selector: "second",
  9578. category: 'accessing',
  9579. fn: function (){
  9580. var self=this;
  9581. var $1;
  9582. $1=smalltalk.send(self,"_at_",[(2)]);
  9583. return $1;
  9584. },
  9585. args: [],
  9586. source: "second\x0a\x09^self at: 2",
  9587. messageSends: ["at:"],
  9588. referencedClasses: []
  9589. }),
  9590. smalltalk.SequenceableCollection);
  9591. smalltalk.addMethod(
  9592. "_shallowCopy",
  9593. smalltalk.method({
  9594. selector: "shallowCopy",
  9595. category: 'copying',
  9596. fn: function (){
  9597. var self=this;
  9598. var newCollection;
  9599. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9600. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9601. return smalltalk.send(newCollection,"_at_put_",[index,each]);
  9602. })]);
  9603. return newCollection;
  9604. },
  9605. args: [],
  9606. 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",
  9607. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  9608. referencedClasses: []
  9609. }),
  9610. smalltalk.SequenceableCollection);
  9611. smalltalk.addMethod(
  9612. "_third",
  9613. smalltalk.method({
  9614. selector: "third",
  9615. category: 'accessing',
  9616. fn: function (){
  9617. var self=this;
  9618. var $1;
  9619. $1=smalltalk.send(self,"_at_",[(3)]);
  9620. return $1;
  9621. },
  9622. args: [],
  9623. source: "third\x0a\x09^self at: 3",
  9624. messageSends: ["at:"],
  9625. referencedClasses: []
  9626. }),
  9627. smalltalk.SequenceableCollection);
  9628. smalltalk.addMethod(
  9629. "_withIndexDo_",
  9630. smalltalk.method({
  9631. selector: "withIndexDo:",
  9632. category: 'enumerating',
  9633. fn: function (aBlock){
  9634. var self=this;
  9635. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  9636. ;
  9637. return self},
  9638. args: ["aBlock"],
  9639. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  9640. messageSends: [],
  9641. referencedClasses: []
  9642. }),
  9643. smalltalk.SequenceableCollection);
  9644. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9645. smalltalk.addMethod(
  9646. "_add_",
  9647. smalltalk.method({
  9648. selector: "add:",
  9649. category: 'adding/removing',
  9650. fn: function (anObject){
  9651. var self=this;
  9652. self.push(anObject); return anObject;;
  9653. ;
  9654. return self},
  9655. args: ["anObject"],
  9656. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  9657. messageSends: [],
  9658. referencedClasses: []
  9659. }),
  9660. smalltalk.Array);
  9661. smalltalk.addMethod(
  9662. "_asJavascript",
  9663. smalltalk.method({
  9664. selector: "asJavascript",
  9665. category: 'converting',
  9666. fn: function (){
  9667. var self=this;
  9668. var $1;
  9669. $1=smalltalk.send(smalltalk.send("[","__comma",[smalltalk.send(smalltalk.send(self,"_collect_",[(function(each){
  9670. return smalltalk.send(each,"_asJavascript",[]);
  9671. })]),"_join_",[", "])]),"__comma",["]"]);
  9672. return $1;
  9673. },
  9674. args: [],
  9675. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  9676. messageSends: [",", "join:", "collect:", "asJavascript"],
  9677. referencedClasses: []
  9678. }),
  9679. smalltalk.Array);
  9680. smalltalk.addMethod(
  9681. "_at_ifAbsent_",
  9682. smalltalk.method({
  9683. selector: "at:ifAbsent:",
  9684. category: 'accessing',
  9685. fn: function (anIndex,aBlock){
  9686. var self=this;
  9687. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  9688. return self[anIndex - 1];
  9689. ;
  9690. ;
  9691. return self},
  9692. args: ["anIndex", "aBlock"],
  9693. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  9694. messageSends: [],
  9695. referencedClasses: []
  9696. }),
  9697. smalltalk.Array);
  9698. smalltalk.addMethod(
  9699. "_at_put_",
  9700. smalltalk.method({
  9701. selector: "at:put:",
  9702. category: 'accessing',
  9703. fn: function (anIndex,anObject){
  9704. var self=this;
  9705. return self[anIndex - 1] = anObject;
  9706. ;
  9707. return self},
  9708. args: ["anIndex", "anObject"],
  9709. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  9710. messageSends: [],
  9711. referencedClasses: []
  9712. }),
  9713. smalltalk.Array);
  9714. smalltalk.addMethod(
  9715. "_join_",
  9716. smalltalk.method({
  9717. selector: "join:",
  9718. category: 'enumerating',
  9719. fn: function (aString){
  9720. var self=this;
  9721. return self.join(aString);
  9722. ;
  9723. return self},
  9724. args: ["aString"],
  9725. source: "join: aString\x0a\x09<return self.join(aString)>",
  9726. messageSends: [],
  9727. referencedClasses: []
  9728. }),
  9729. smalltalk.Array);
  9730. smalltalk.addMethod(
  9731. "_remove_ifAbsent_",
  9732. smalltalk.method({
  9733. selector: "remove:ifAbsent:",
  9734. category: 'adding/removing',
  9735. fn: function (anObject,aBlock){
  9736. var self=this;
  9737. for(var i=0;i<self.length;i++) {
  9738. if(self[i] == anObject) {
  9739. self.splice(i,1);
  9740. return self;
  9741. }
  9742. }
  9743. ;
  9744. ;
  9745. smalltalk.send(aBlock,"_value",[]);
  9746. return self},
  9747. args: ["anObject", "aBlock"],
  9748. 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>.\x0a\x09aBlock value",
  9749. messageSends: ["value"],
  9750. referencedClasses: []
  9751. }),
  9752. smalltalk.Array);
  9753. smalltalk.addMethod(
  9754. "_removeFrom_to_",
  9755. smalltalk.method({
  9756. selector: "removeFrom:to:",
  9757. category: 'adding/removing',
  9758. fn: function (aNumber,anotherNumber){
  9759. var self=this;
  9760. self.splice(aNumber - 1,anotherNumber - 1);
  9761. ;
  9762. return self},
  9763. args: ["aNumber", "anotherNumber"],
  9764. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  9765. messageSends: [],
  9766. referencedClasses: []
  9767. }),
  9768. smalltalk.Array);
  9769. smalltalk.addMethod(
  9770. "_reversed",
  9771. smalltalk.method({
  9772. selector: "reversed",
  9773. category: 'converting',
  9774. fn: function (){
  9775. var self=this;
  9776. return self._copy().reverse();
  9777. ;
  9778. return self},
  9779. args: [],
  9780. source: "reversed\x0a\x09<return self._copy().reverse()>",
  9781. messageSends: [],
  9782. referencedClasses: []
  9783. }),
  9784. smalltalk.Array);
  9785. smalltalk.addMethod(
  9786. "_size",
  9787. smalltalk.method({
  9788. selector: "size",
  9789. category: 'accessing',
  9790. fn: function (){
  9791. var self=this;
  9792. return self.length;
  9793. ;
  9794. return self},
  9795. args: [],
  9796. source: "size\x0a\x09<return self.length>",
  9797. messageSends: [],
  9798. referencedClasses: []
  9799. }),
  9800. smalltalk.Array);
  9801. smalltalk.addMethod(
  9802. "_sort",
  9803. smalltalk.method({
  9804. selector: "sort",
  9805. category: 'enumerating',
  9806. fn: function (){
  9807. var self=this;
  9808. var $1;
  9809. $1=smalltalk.send(self,"_basicPerform_",["sort"]);
  9810. return $1;
  9811. },
  9812. args: [],
  9813. source: "sort\x0a ^self basicPerform: 'sort'",
  9814. messageSends: ["basicPerform:"],
  9815. referencedClasses: []
  9816. }),
  9817. smalltalk.Array);
  9818. smalltalk.addMethod(
  9819. "_sort_",
  9820. smalltalk.method({
  9821. selector: "sort:",
  9822. category: 'enumerating',
  9823. fn: function (aBlock){
  9824. var self=this;
  9825. return self.sort(function(a, b) {
  9826. if(aBlock(a,b)) {return -1} else {return 1}
  9827. })
  9828. ;
  9829. ;
  9830. return self},
  9831. args: ["aBlock"],
  9832. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  9833. messageSends: [],
  9834. referencedClasses: []
  9835. }),
  9836. smalltalk.Array);
  9837. smalltalk.addMethod(
  9838. "_sorted",
  9839. smalltalk.method({
  9840. selector: "sorted",
  9841. category: 'enumerating',
  9842. fn: function (){
  9843. var self=this;
  9844. var $1;
  9845. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort",[]);
  9846. return $1;
  9847. },
  9848. args: [],
  9849. source: "sorted\x0a\x09^self copy sort",
  9850. messageSends: ["sort", "copy"],
  9851. referencedClasses: []
  9852. }),
  9853. smalltalk.Array);
  9854. smalltalk.addMethod(
  9855. "_sorted_",
  9856. smalltalk.method({
  9857. selector: "sorted:",
  9858. category: 'enumerating',
  9859. fn: function (aBlock){
  9860. var self=this;
  9861. var $1;
  9862. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort_",[aBlock]);
  9863. return $1;
  9864. },
  9865. args: ["aBlock"],
  9866. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  9867. messageSends: ["sort:", "copy"],
  9868. referencedClasses: []
  9869. }),
  9870. smalltalk.Array);
  9871. smalltalk.addMethod(
  9872. "_new_",
  9873. smalltalk.method({
  9874. selector: "new:",
  9875. category: 'instance creation',
  9876. fn: function (anInteger){
  9877. var self=this;
  9878. return new Array(anInteger);
  9879. ;
  9880. return self},
  9881. args: ["anInteger"],
  9882. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  9883. messageSends: [],
  9884. referencedClasses: []
  9885. }),
  9886. smalltalk.Array.klass);
  9887. smalltalk.addMethod(
  9888. "_with_",
  9889. smalltalk.method({
  9890. selector: "with:",
  9891. category: 'instance creation',
  9892. fn: function (anObject){
  9893. var self=this;
  9894. var $2,$3,$1;
  9895. $2=smalltalk.send(self,"_new_",[(1)]);
  9896. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9897. $3=smalltalk.send($2,"_yourself",[]);
  9898. $1=$3;
  9899. return $1;
  9900. },
  9901. args: ["anObject"],
  9902. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  9903. messageSends: ["at:put:", "new:", "yourself"],
  9904. referencedClasses: []
  9905. }),
  9906. smalltalk.Array.klass);
  9907. smalltalk.addMethod(
  9908. "_with_with_",
  9909. smalltalk.method({
  9910. selector: "with:with:",
  9911. category: 'instance creation',
  9912. fn: function (anObject,anObject2){
  9913. var self=this;
  9914. var $2,$3,$1;
  9915. $2=smalltalk.send(self,"_new_",[(2)]);
  9916. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9917. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9918. $3=smalltalk.send($2,"_yourself",[]);
  9919. $1=$3;
  9920. return $1;
  9921. },
  9922. args: ["anObject", "anObject2"],
  9923. source: "with: anObject with: anObject2\x0a\x09 ^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  9924. messageSends: ["at:put:", "new:", "yourself"],
  9925. referencedClasses: []
  9926. }),
  9927. smalltalk.Array.klass);
  9928. smalltalk.addMethod(
  9929. "_with_with_with_",
  9930. smalltalk.method({
  9931. selector: "with:with:with:",
  9932. category: 'instance creation',
  9933. fn: function (anObject,anObject2,anObject3){
  9934. var self=this;
  9935. var $2,$3,$1;
  9936. $2=smalltalk.send(self,"_new_",[(3)]);
  9937. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9938. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9939. smalltalk.send($2,"_at_put_",[(3),anObject3]);
  9940. $3=smalltalk.send($2,"_yourself",[]);
  9941. $1=$3;
  9942. return $1;
  9943. },
  9944. args: ["anObject", "anObject2", "anObject3"],
  9945. source: "with: anObject with: anObject2 with: anObject3\x0a\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",
  9946. messageSends: ["at:put:", "new:", "yourself"],
  9947. referencedClasses: []
  9948. }),
  9949. smalltalk.Array.klass);
  9950. smalltalk.addMethod(
  9951. "_withAll_",
  9952. smalltalk.method({
  9953. selector: "withAll:",
  9954. category: 'instance creation',
  9955. fn: function (aCollection){
  9956. var self=this;
  9957. var instance;
  9958. var index;
  9959. index=(1);
  9960. instance=smalltalk.send(self,"_new_",[smalltalk.send(aCollection,"_size",[])]);
  9961. smalltalk.send(aCollection,"_do_",[(function(each){
  9962. smalltalk.send(instance,"_at_put_",[index,each]);
  9963. index=smalltalk.send(index,"__plus",[(1)]);
  9964. return index;
  9965. })]);
  9966. return instance;
  9967. },
  9968. args: ["aCollection"],
  9969. 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",
  9970. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  9971. referencedClasses: []
  9972. }),
  9973. smalltalk.Array.klass);
  9974. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9975. smalltalk.addMethod(
  9976. "__comma",
  9977. smalltalk.method({
  9978. selector: ",",
  9979. category: 'copying',
  9980. fn: function (aString){
  9981. var self=this;
  9982. var $1;
  9983. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__comma",[smalltalk.send(aString,"_asString",[])]);
  9984. return $1;
  9985. },
  9986. args: ["aString"],
  9987. source: ", aString\x0a\x09^self asString, aString asString",
  9988. messageSends: [",", "asString"],
  9989. referencedClasses: []
  9990. }),
  9991. smalltalk.CharacterArray);
  9992. smalltalk.addMethod(
  9993. "_add_",
  9994. smalltalk.method({
  9995. selector: "add:",
  9996. category: 'adding',
  9997. fn: function (anObject){
  9998. var self=this;
  9999. smalltalk.send(self,"_errorReadOnly",[]);
  10000. return self},
  10001. args: ["anObject"],
  10002. source: "add: anObject\x0a\x09self errorReadOnly",
  10003. messageSends: ["errorReadOnly"],
  10004. referencedClasses: []
  10005. }),
  10006. smalltalk.CharacterArray);
  10007. smalltalk.addMethod(
  10008. "_asLowercase",
  10009. smalltalk.method({
  10010. selector: "asLowercase",
  10011. category: 'converting',
  10012. fn: function (){
  10013. var self=this;
  10014. var $1;
  10015. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asLowercase",[])]);
  10016. return $1;
  10017. },
  10018. args: [],
  10019. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  10020. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  10021. referencedClasses: []
  10022. }),
  10023. smalltalk.CharacterArray);
  10024. smalltalk.addMethod(
  10025. "_asNumber",
  10026. smalltalk.method({
  10027. selector: "asNumber",
  10028. category: 'converting',
  10029. fn: function (){
  10030. var self=this;
  10031. var $1;
  10032. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asNumber",[]);
  10033. return $1;
  10034. },
  10035. args: [],
  10036. source: "asNumber\x0a\x09^self asString asNumber",
  10037. messageSends: ["asNumber", "asString"],
  10038. referencedClasses: []
  10039. }),
  10040. smalltalk.CharacterArray);
  10041. smalltalk.addMethod(
  10042. "_asString",
  10043. smalltalk.method({
  10044. selector: "asString",
  10045. category: 'converting',
  10046. fn: function (){
  10047. var self=this;
  10048. var $1;
  10049. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  10050. return $1;
  10051. },
  10052. args: [],
  10053. source: "asString\x0a\x09^self subclassResponsibility",
  10054. messageSends: ["subclassResponsibility"],
  10055. referencedClasses: []
  10056. }),
  10057. smalltalk.CharacterArray);
  10058. smalltalk.addMethod(
  10059. "_asSymbol",
  10060. smalltalk.method({
  10061. selector: "asSymbol",
  10062. category: 'converting',
  10063. fn: function (){
  10064. var self=this;
  10065. var $1;
  10066. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  10067. return $1;
  10068. },
  10069. args: [],
  10070. source: "asSymbol\x0a\x09^self subclassResponsibility",
  10071. messageSends: ["subclassResponsibility"],
  10072. referencedClasses: []
  10073. }),
  10074. smalltalk.CharacterArray);
  10075. smalltalk.addMethod(
  10076. "_asUppercase",
  10077. smalltalk.method({
  10078. selector: "asUppercase",
  10079. category: 'converting',
  10080. fn: function (){
  10081. var self=this;
  10082. var $1;
  10083. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asUppercase",[])]);
  10084. return $1;
  10085. },
  10086. args: [],
  10087. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  10088. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  10089. referencedClasses: []
  10090. }),
  10091. smalltalk.CharacterArray);
  10092. smalltalk.addMethod(
  10093. "_at_put_",
  10094. smalltalk.method({
  10095. selector: "at:put:",
  10096. category: 'accessing',
  10097. fn: function (anIndex,anObject){
  10098. var self=this;
  10099. smalltalk.send(self,"_errorReadOnly",[]);
  10100. return self},
  10101. args: ["anIndex", "anObject"],
  10102. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  10103. messageSends: ["errorReadOnly"],
  10104. referencedClasses: []
  10105. }),
  10106. smalltalk.CharacterArray);
  10107. smalltalk.addMethod(
  10108. "_errorReadOnly",
  10109. smalltalk.method({
  10110. selector: "errorReadOnly",
  10111. category: 'error handling',
  10112. fn: function (){
  10113. var self=this;
  10114. smalltalk.send(self,"_error_",["Object is read-only"]);
  10115. return self},
  10116. args: [],
  10117. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  10118. messageSends: ["error:"],
  10119. referencedClasses: []
  10120. }),
  10121. smalltalk.CharacterArray);
  10122. smalltalk.addMethod(
  10123. "_printString",
  10124. smalltalk.method({
  10125. selector: "printString",
  10126. category: 'printing',
  10127. fn: function (){
  10128. var self=this;
  10129. var $1;
  10130. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_printString",[]);
  10131. return $1;
  10132. },
  10133. args: [],
  10134. source: "printString\x0a\x09^self asString printString",
  10135. messageSends: ["printString", "asString"],
  10136. referencedClasses: []
  10137. }),
  10138. smalltalk.CharacterArray);
  10139. smalltalk.addMethod(
  10140. "_remove_",
  10141. smalltalk.method({
  10142. selector: "remove:",
  10143. category: 'adding',
  10144. fn: function (anObject){
  10145. var self=this;
  10146. smalltalk.send(self,"_errorReadOnly",[]);
  10147. return self},
  10148. args: ["anObject"],
  10149. source: "remove: anObject\x0a\x09self errorReadOnly",
  10150. messageSends: ["errorReadOnly"],
  10151. referencedClasses: []
  10152. }),
  10153. smalltalk.CharacterArray);
  10154. smalltalk.addMethod(
  10155. "_fromString_",
  10156. smalltalk.method({
  10157. selector: "fromString:",
  10158. category: 'instance creation',
  10159. fn: function (aString){
  10160. var self=this;
  10161. smalltalk.send(self,"_subclassResponsibility",[]);
  10162. return self},
  10163. args: ["aString"],
  10164. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10165. messageSends: ["subclassResponsibility"],
  10166. referencedClasses: []
  10167. }),
  10168. smalltalk.CharacterArray.klass);
  10169. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  10170. smalltalk.addMethod(
  10171. "__comma",
  10172. smalltalk.method({
  10173. selector: ",",
  10174. category: 'copying',
  10175. fn: function (aString){
  10176. var self=this;
  10177. return self + aString;
  10178. ;
  10179. return self},
  10180. args: ["aString"],
  10181. source: ", aString\x0a\x09<return self + aString>",
  10182. messageSends: [],
  10183. referencedClasses: []
  10184. }),
  10185. smalltalk.String);
  10186. smalltalk.addMethod(
  10187. "__lt",
  10188. smalltalk.method({
  10189. selector: "<",
  10190. category: 'comparing',
  10191. fn: function (aString){
  10192. var self=this;
  10193. return String(self) < aString._asString();
  10194. ;
  10195. return self},
  10196. args: ["aString"],
  10197. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  10198. messageSends: [],
  10199. referencedClasses: []
  10200. }),
  10201. smalltalk.String);
  10202. smalltalk.addMethod(
  10203. "__lt_eq",
  10204. smalltalk.method({
  10205. selector: "<=",
  10206. category: 'comparing',
  10207. fn: function (aString){
  10208. var self=this;
  10209. return String(self) <= aString._asString();
  10210. ;
  10211. return self},
  10212. args: ["aString"],
  10213. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  10214. messageSends: [],
  10215. referencedClasses: []
  10216. }),
  10217. smalltalk.String);
  10218. smalltalk.addMethod(
  10219. "__eq",
  10220. smalltalk.method({
  10221. selector: "=",
  10222. category: 'comparing',
  10223. fn: function (aString){
  10224. var self=this;
  10225. var $1;
  10226. $1=smalltalk.send(smalltalk.send(aString,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  10227. if(! smalltalk.assert($1)){
  10228. return false;
  10229. };
  10230. return String(self) === String(aString);
  10231. ;
  10232. return self},
  10233. args: ["aString"],
  10234. source: "= aString\x0a\x09aString class = self class ifFalse: [^false].\x0a\x09<return String(self) === String(aString)>",
  10235. messageSends: ["ifFalse:", "=", "class"],
  10236. referencedClasses: []
  10237. }),
  10238. smalltalk.String);
  10239. smalltalk.addMethod(
  10240. "__eq_eq",
  10241. smalltalk.method({
  10242. selector: "==",
  10243. category: 'comparing',
  10244. fn: function (aString){
  10245. var self=this;
  10246. var $1;
  10247. $1=smalltalk.send(self,"__eq",[aString]);
  10248. return $1;
  10249. },
  10250. args: ["aString"],
  10251. source: "== aString\x0a\x09^self = aString",
  10252. messageSends: ["="],
  10253. referencedClasses: []
  10254. }),
  10255. smalltalk.String);
  10256. smalltalk.addMethod(
  10257. "__gt",
  10258. smalltalk.method({
  10259. selector: ">",
  10260. category: 'comparing',
  10261. fn: function (aString){
  10262. var self=this;
  10263. return String(self) > aString._asString();
  10264. ;
  10265. return self},
  10266. args: ["aString"],
  10267. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  10268. messageSends: [],
  10269. referencedClasses: []
  10270. }),
  10271. smalltalk.String);
  10272. smalltalk.addMethod(
  10273. "__gt_eq",
  10274. smalltalk.method({
  10275. selector: ">=",
  10276. category: 'comparing',
  10277. fn: function (aString){
  10278. var self=this;
  10279. return String(self) >= aString._asString();
  10280. ;
  10281. return self},
  10282. args: ["aString"],
  10283. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  10284. messageSends: [],
  10285. referencedClasses: []
  10286. }),
  10287. smalltalk.String);
  10288. smalltalk.addMethod(
  10289. "_asJSON",
  10290. smalltalk.method({
  10291. selector: "asJSON",
  10292. category: 'converting',
  10293. fn: function (){
  10294. var self=this;
  10295. return self;
  10296. },
  10297. args: [],
  10298. source: "asJSON\x0a\x09^self",
  10299. messageSends: [],
  10300. referencedClasses: []
  10301. }),
  10302. smalltalk.String);
  10303. smalltalk.addMethod(
  10304. "_asJavaScriptSelector",
  10305. smalltalk.method({
  10306. selector: "asJavaScriptSelector",
  10307. category: 'converting',
  10308. fn: function (){
  10309. var self=this;
  10310. var $1;
  10311. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asSelector",[]),"_replace_with_",["^_",""]),"_replace_with_",["_.*",""]);
  10312. return $1;
  10313. },
  10314. args: [],
  10315. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  10316. messageSends: ["replace:with:", "asSelector"],
  10317. referencedClasses: []
  10318. }),
  10319. smalltalk.String);
  10320. smalltalk.addMethod(
  10321. "_asJavascript",
  10322. smalltalk.method({
  10323. selector: "asJavascript",
  10324. category: 'converting',
  10325. fn: function (){
  10326. var self=this;
  10327. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10328. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10329. else
  10330. return "\"" + self + "\"";
  10331. ;
  10332. ;
  10333. return self},
  10334. args: [],
  10335. 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>",
  10336. messageSends: [],
  10337. referencedClasses: []
  10338. }),
  10339. smalltalk.String);
  10340. smalltalk.addMethod(
  10341. "_asLowercase",
  10342. smalltalk.method({
  10343. selector: "asLowercase",
  10344. category: 'converting',
  10345. fn: function (){
  10346. var self=this;
  10347. return self.toLowerCase();
  10348. ;
  10349. return self},
  10350. args: [],
  10351. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  10352. messageSends: [],
  10353. referencedClasses: []
  10354. }),
  10355. smalltalk.String);
  10356. smalltalk.addMethod(
  10357. "_asNumber",
  10358. smalltalk.method({
  10359. selector: "asNumber",
  10360. category: 'converting',
  10361. fn: function (){
  10362. var self=this;
  10363. return Number(self);
  10364. ;
  10365. return self},
  10366. args: [],
  10367. source: "asNumber\x0a\x09<return Number(self)>",
  10368. messageSends: [],
  10369. referencedClasses: []
  10370. }),
  10371. smalltalk.String);
  10372. smalltalk.addMethod(
  10373. "_asSelector",
  10374. smalltalk.method({
  10375. selector: "asSelector",
  10376. category: 'converting',
  10377. fn: function (){
  10378. var self=this;
  10379. var selector;
  10380. selector=smalltalk.send("_","__comma",[self]);
  10381. selector=smalltalk.send(selector,"_replace_with_",[":","_"]);
  10382. selector=smalltalk.send(selector,"_replace_with_",["[+]","_plus"]);
  10383. selector=smalltalk.send(selector,"_replace_with_",["-","_minus"]);
  10384. selector=smalltalk.send(selector,"_replace_with_",["[*]","_star"]);
  10385. selector=smalltalk.send(selector,"_replace_with_",["[/]","_slash"]);
  10386. selector=smalltalk.send(selector,"_replace_with_",[">","_gt"]);
  10387. selector=smalltalk.send(selector,"_replace_with_",["<","_lt"]);
  10388. selector=smalltalk.send(selector,"_replace_with_",["=","_eq"]);
  10389. selector=smalltalk.send(selector,"_replace_with_",[",","_comma"]);
  10390. selector=smalltalk.send(selector,"_replace_with_",["[@]","_at"]);
  10391. return selector;
  10392. },
  10393. args: [],
  10394. source: "asSelector\x0a\x09\x22If you change this method, change smalltalk.convertSelector too (see js/boot.js file)\x22\x0a\x0a\x09| selector |\x0a\x09selector := '_', self.\x0a\x09selector := selector replace: ':' with: '_'.\x0a\x09selector := selector replace: '[+]' with: '_plus'.\x0a\x09selector := selector replace: '-' with: '_minus'.\x0a\x09selector := selector replace: '[*]' with: '_star'.\x0a\x09selector := selector replace: '[/]' with: '_slash'.\x0a\x09selector := selector replace: '>' with: '_gt'.\x0a\x09selector := selector replace: '<' with: '_lt'.\x0a\x09selector := selector replace: '=' with: '_eq'.\x0a\x09selector := selector replace: ',' with: '_comma'.\x0a\x09selector := selector replace: '[@]' with: '_at'.\x0a\x09^selector",
  10395. messageSends: [",", "replace:with:"],
  10396. referencedClasses: []
  10397. }),
  10398. smalltalk.String);
  10399. smalltalk.addMethod(
  10400. "_asString",
  10401. smalltalk.method({
  10402. selector: "asString",
  10403. category: 'converting',
  10404. fn: function (){
  10405. var self=this;
  10406. return self;
  10407. },
  10408. args: [],
  10409. source: "asString\x0a\x09^self",
  10410. messageSends: [],
  10411. referencedClasses: []
  10412. }),
  10413. smalltalk.String);
  10414. smalltalk.addMethod(
  10415. "_asSymbol",
  10416. smalltalk.method({
  10417. selector: "asSymbol",
  10418. category: 'converting',
  10419. fn: function (){
  10420. var self=this;
  10421. var $1;
  10422. $1=smalltalk.send((smalltalk.Symbol || Symbol),"_lookup_",[self]);
  10423. return $1;
  10424. },
  10425. args: [],
  10426. source: "asSymbol\x0a\x09^Symbol lookup: self",
  10427. messageSends: ["lookup:"],
  10428. referencedClasses: ["Symbol"]
  10429. }),
  10430. smalltalk.String);
  10431. smalltalk.addMethod(
  10432. "_asUppercase",
  10433. smalltalk.method({
  10434. selector: "asUppercase",
  10435. category: 'converting',
  10436. fn: function (){
  10437. var self=this;
  10438. return self.toUpperCase();
  10439. ;
  10440. return self},
  10441. args: [],
  10442. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  10443. messageSends: [],
  10444. referencedClasses: []
  10445. }),
  10446. smalltalk.String);
  10447. smalltalk.addMethod(
  10448. "_asciiValue",
  10449. smalltalk.method({
  10450. selector: "asciiValue",
  10451. category: 'accessing',
  10452. fn: function (){
  10453. var self=this;
  10454. return self.charCodeAt(0);;
  10455. ;
  10456. return self},
  10457. args: [],
  10458. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  10459. messageSends: [],
  10460. referencedClasses: []
  10461. }),
  10462. smalltalk.String);
  10463. smalltalk.addMethod(
  10464. "_at_ifAbsent_",
  10465. smalltalk.method({
  10466. selector: "at:ifAbsent:",
  10467. category: 'accessing',
  10468. fn: function (anIndex,aBlock){
  10469. var self=this;
  10470. return String(self).charAt(anIndex - 1) || aBlock();
  10471. ;
  10472. return self},
  10473. args: ["anIndex", "aBlock"],
  10474. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  10475. messageSends: [],
  10476. referencedClasses: []
  10477. }),
  10478. smalltalk.String);
  10479. smalltalk.addMethod(
  10480. "_copyFrom_to_",
  10481. smalltalk.method({
  10482. selector: "copyFrom:to:",
  10483. category: 'copying',
  10484. fn: function (anIndex,anotherIndex){
  10485. var self=this;
  10486. return self.substring(anIndex - 1, anotherIndex);
  10487. ;
  10488. return self},
  10489. args: ["anIndex", "anotherIndex"],
  10490. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  10491. messageSends: [],
  10492. referencedClasses: []
  10493. }),
  10494. smalltalk.String);
  10495. smalltalk.addMethod(
  10496. "_deepCopy",
  10497. smalltalk.method({
  10498. selector: "deepCopy",
  10499. category: 'copying',
  10500. fn: function (){
  10501. var self=this;
  10502. var $1;
  10503. $1=smalltalk.send(self,"_shallowCopy",[]);
  10504. return $1;
  10505. },
  10506. args: [],
  10507. source: "deepCopy\x0a\x09^self shallowCopy",
  10508. messageSends: ["shallowCopy"],
  10509. referencedClasses: []
  10510. }),
  10511. smalltalk.String);
  10512. smalltalk.addMethod(
  10513. "_do_",
  10514. smalltalk.method({
  10515. selector: "do:",
  10516. category: 'enumerating',
  10517. fn: function (aBlock){
  10518. var self=this;
  10519. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  10520. ;
  10521. return self},
  10522. args: ["aBlock"],
  10523. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  10524. messageSends: [],
  10525. referencedClasses: []
  10526. }),
  10527. smalltalk.String);
  10528. smalltalk.addMethod(
  10529. "_escaped",
  10530. smalltalk.method({
  10531. selector: "escaped",
  10532. category: 'accessing',
  10533. fn: function (){
  10534. var self=this;
  10535. return escape(self);
  10536. ;
  10537. return self},
  10538. args: [],
  10539. source: "escaped\x0a\x09<return escape(self)>",
  10540. messageSends: [],
  10541. referencedClasses: []
  10542. }),
  10543. smalltalk.String);
  10544. smalltalk.addMethod(
  10545. "_includesSubString_",
  10546. smalltalk.method({
  10547. selector: "includesSubString:",
  10548. category: 'testing',
  10549. fn: function (subString){
  10550. var self=this;
  10551. return self.indexOf(subString) != -1 ;
  10552. ;
  10553. return self},
  10554. args: ["subString"],
  10555. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  10556. messageSends: [],
  10557. referencedClasses: []
  10558. }),
  10559. smalltalk.String);
  10560. smalltalk.addMethod(
  10561. "_isString",
  10562. smalltalk.method({
  10563. selector: "isString",
  10564. category: 'testing',
  10565. fn: function (){
  10566. var self=this;
  10567. return true;
  10568. },
  10569. args: [],
  10570. source: "isString\x0a\x09^true",
  10571. messageSends: [],
  10572. referencedClasses: []
  10573. }),
  10574. smalltalk.String);
  10575. smalltalk.addMethod(
  10576. "_join_",
  10577. smalltalk.method({
  10578. selector: "join:",
  10579. category: 'split join',
  10580. fn: function (aCollection){
  10581. var self=this;
  10582. var $1;
  10583. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  10584. return smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  10585. return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(each,"_asString",[])]);
  10586. }),(function(){
  10587. return smalltalk.send(stream,"_nextPutAll_",[self]);
  10588. })]);
  10589. })]);
  10590. return $1;
  10591. },
  10592. args: ["aCollection"],
  10593. 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]]",
  10594. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  10595. referencedClasses: ["String"]
  10596. }),
  10597. smalltalk.String);
  10598. smalltalk.addMethod(
  10599. "_lineIndicesDo_",
  10600. smalltalk.method({
  10601. selector: "lineIndicesDo:",
  10602. category: 'split join',
  10603. fn: function (aBlock){
  10604. var self=this;
  10605. var $1,$2,$3;
  10606. var $early={};
  10607. try {
  10608. var cr;
  10609. var lf;
  10610. var start;
  10611. var sz;
  10612. var nextLF;
  10613. var nextCR;
  10614. start=(1);
  10615. sz=smalltalk.send(self,"_size",[]);
  10616. cr=smalltalk.send((smalltalk.String || String),"_cr",[]);
  10617. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,(1)]);
  10618. lf=smalltalk.send((smalltalk.String || String),"_lf",[]);
  10619. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,(1)]);
  10620. smalltalk.send((function(){
  10621. return smalltalk.send(start,"__lt_eq",[sz]);
  10622. }),"_whileTrue_",[(function(){
  10623. $1=smalltalk.send(smalltalk.send(nextLF,"__eq",[(0)]),"_and_",[(function(){
  10624. return smalltalk.send(nextCR,"__eq",[(0)]);
  10625. })]);
  10626. if(smalltalk.assert($1)){
  10627. smalltalk.send(aBlock,"_value_value_value_",[start,sz,sz]);
  10628. throw $early=[self];
  10629. };
  10630. $2=smalltalk.send(smalltalk.send(nextCR,"__eq",[(0)]),"_or_",[(function(){
  10631. return smalltalk.send(smalltalk.send((0),"__lt",[nextLF]),"_and_",[(function(){
  10632. return smalltalk.send(nextLF,"__lt",[nextCR]);
  10633. })]);
  10634. })]);
  10635. if(smalltalk.assert($2)){
  10636. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextLF,"__minus",[(1)]),nextLF]);
  10637. start=smalltalk.send((1),"__plus",[nextLF]);
  10638. start;
  10639. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10640. return nextLF;
  10641. } else {
  10642. $3=smalltalk.send(smalltalk.send((1),"__plus",[nextCR]),"__eq",[nextLF]);
  10643. if(smalltalk.assert($3)){
  10644. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextLF]);
  10645. start=smalltalk.send((1),"__plus",[nextLF]);
  10646. start;
  10647. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10648. nextCR;
  10649. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10650. return nextLF;
  10651. } else {
  10652. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextCR]);
  10653. start=smalltalk.send((1),"__plus",[nextCR]);
  10654. start;
  10655. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10656. return nextCR;
  10657. };
  10658. };
  10659. })]);
  10660. return self}
  10661. catch(e) {if(e===$early)return e[0]; throw e}
  10662. },
  10663. args: ["aBlock"],
  10664. 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 ]]]",
  10665. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  10666. referencedClasses: ["String"]
  10667. }),
  10668. smalltalk.String);
  10669. smalltalk.addMethod(
  10670. "_lineNumber_",
  10671. smalltalk.method({
  10672. selector: "lineNumber:",
  10673. category: 'split join',
  10674. fn: function (anIndex){
  10675. var self=this;
  10676. var $1,$2;
  10677. var $early={};
  10678. try {
  10679. var lineCount;
  10680. lineCount=(0);
  10681. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10682. lineCount=smalltalk.send(lineCount,"__plus",[(1)]);
  10683. $1=smalltalk.send(lineCount,"__eq",[anIndex]);
  10684. if(smalltalk.assert($1)){
  10685. $2=smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters]);
  10686. throw $early=[$2];
  10687. };
  10688. })]);
  10689. return nil;
  10690. }
  10691. catch(e) {if(e===$early)return e[0]; throw e}
  10692. },
  10693. args: ["anIndex"],
  10694. 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",
  10695. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  10696. referencedClasses: []
  10697. }),
  10698. smalltalk.String);
  10699. smalltalk.addMethod(
  10700. "_lines",
  10701. smalltalk.method({
  10702. selector: "lines",
  10703. category: 'split join',
  10704. fn: function (){
  10705. var self=this;
  10706. var lines;
  10707. lines=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  10708. smalltalk.send(self,"_linesDo_",[(function(aLine){
  10709. return smalltalk.send(lines,"_add_",[aLine]);
  10710. })]);
  10711. return lines;
  10712. },
  10713. args: [],
  10714. 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",
  10715. messageSends: ["new", "linesDo:", "add:"],
  10716. referencedClasses: ["Array"]
  10717. }),
  10718. smalltalk.String);
  10719. smalltalk.addMethod(
  10720. "_linesDo_",
  10721. smalltalk.method({
  10722. selector: "linesDo:",
  10723. category: 'split join',
  10724. fn: function (aBlock){
  10725. var self=this;
  10726. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10727. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters])]);
  10728. })]);
  10729. return self},
  10730. args: ["aBlock"],
  10731. 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)]",
  10732. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  10733. referencedClasses: []
  10734. }),
  10735. smalltalk.String);
  10736. smalltalk.addMethod(
  10737. "_match_",
  10738. smalltalk.method({
  10739. selector: "match:",
  10740. category: 'regular expressions',
  10741. fn: function (aRegexp){
  10742. var self=this;
  10743. return self.search(aRegexp) != -1;
  10744. ;
  10745. return self},
  10746. args: ["aRegexp"],
  10747. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  10748. messageSends: [],
  10749. referencedClasses: []
  10750. }),
  10751. smalltalk.String);
  10752. smalltalk.addMethod(
  10753. "_matchesOf_",
  10754. smalltalk.method({
  10755. selector: "matchesOf:",
  10756. category: 'regular expressions',
  10757. fn: function (aRegularExpression){
  10758. var self=this;
  10759. return self.match(aRegularExpression);
  10760. ;
  10761. return self},
  10762. args: ["aRegularExpression"],
  10763. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  10764. messageSends: [],
  10765. referencedClasses: []
  10766. }),
  10767. smalltalk.String);
  10768. smalltalk.addMethod(
  10769. "_printNl",
  10770. smalltalk.method({
  10771. selector: "printNl",
  10772. category: 'printing',
  10773. fn: function (){
  10774. var self=this;
  10775. console.log(self);
  10776. ;
  10777. return self},
  10778. args: [],
  10779. source: "printNl\x0a\x09<console.log(self)>",
  10780. messageSends: [],
  10781. referencedClasses: []
  10782. }),
  10783. smalltalk.String);
  10784. smalltalk.addMethod(
  10785. "_printString",
  10786. smalltalk.method({
  10787. selector: "printString",
  10788. category: 'printing',
  10789. fn: function (){
  10790. var self=this;
  10791. var $1;
  10792. $1=smalltalk.send(smalltalk.send("'","__comma",[self]),"__comma",["'"]);
  10793. return $1;
  10794. },
  10795. args: [],
  10796. source: "printString\x0a\x09^'''', self, ''''",
  10797. messageSends: [","],
  10798. referencedClasses: []
  10799. }),
  10800. smalltalk.String);
  10801. smalltalk.addMethod(
  10802. "_replace_with_",
  10803. smalltalk.method({
  10804. selector: "replace:with:",
  10805. category: 'regular expressions',
  10806. fn: function (aString,anotherString){
  10807. var self=this;
  10808. var $1;
  10809. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[aString,"g"]),anotherString]);
  10810. return $1;
  10811. },
  10812. args: ["aString", "anotherString"],
  10813. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  10814. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  10815. referencedClasses: ["RegularExpression"]
  10816. }),
  10817. smalltalk.String);
  10818. smalltalk.addMethod(
  10819. "_replaceRegexp_with_",
  10820. smalltalk.method({
  10821. selector: "replaceRegexp:with:",
  10822. category: 'regular expressions',
  10823. fn: function (aRegexp,aString){
  10824. var self=this;
  10825. return self.replace(aRegexp, aString);
  10826. ;
  10827. return self},
  10828. args: ["aRegexp", "aString"],
  10829. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  10830. messageSends: [],
  10831. referencedClasses: []
  10832. }),
  10833. smalltalk.String);
  10834. smalltalk.addMethod(
  10835. "_reversed",
  10836. smalltalk.method({
  10837. selector: "reversed",
  10838. category: 'converting',
  10839. fn: function (){
  10840. var self=this;
  10841. return self.split("").reverse().join("");
  10842. ;
  10843. return self},
  10844. args: [],
  10845. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  10846. messageSends: [],
  10847. referencedClasses: []
  10848. }),
  10849. smalltalk.String);
  10850. smalltalk.addMethod(
  10851. "_shallowCopy",
  10852. smalltalk.method({
  10853. selector: "shallowCopy",
  10854. category: 'copying',
  10855. fn: function (){
  10856. var self=this;
  10857. var $1;
  10858. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[self]);
  10859. return $1;
  10860. },
  10861. args: [],
  10862. source: "shallowCopy\x0a\x09^self class fromString: self",
  10863. messageSends: ["fromString:", "class"],
  10864. referencedClasses: []
  10865. }),
  10866. smalltalk.String);
  10867. smalltalk.addMethod(
  10868. "_size",
  10869. smalltalk.method({
  10870. selector: "size",
  10871. category: 'accessing',
  10872. fn: function (){
  10873. var self=this;
  10874. return self.length;
  10875. ;
  10876. return self},
  10877. args: [],
  10878. source: "size\x0a\x09<return self.length>",
  10879. messageSends: [],
  10880. referencedClasses: []
  10881. }),
  10882. smalltalk.String);
  10883. smalltalk.addMethod(
  10884. "_tokenize_",
  10885. smalltalk.method({
  10886. selector: "tokenize:",
  10887. category: 'converting',
  10888. fn: function (aString){
  10889. var self=this;
  10890. return self.split(aString);
  10891. ;
  10892. return self},
  10893. args: ["aString"],
  10894. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  10895. messageSends: [],
  10896. referencedClasses: []
  10897. }),
  10898. smalltalk.String);
  10899. smalltalk.addMethod(
  10900. "_trimBoth",
  10901. smalltalk.method({
  10902. selector: "trimBoth",
  10903. category: 'regular expressions',
  10904. fn: function (){
  10905. var self=this;
  10906. var $1;
  10907. $1=smalltalk.send(self,"_trimBoth_",["\x5cs"]);
  10908. return $1;
  10909. },
  10910. args: [],
  10911. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  10912. messageSends: ["trimBoth:"],
  10913. referencedClasses: []
  10914. }),
  10915. smalltalk.String);
  10916. smalltalk.addMethod(
  10917. "_trimBoth_",
  10918. smalltalk.method({
  10919. selector: "trimBoth:",
  10920. category: 'regular expressions',
  10921. fn: function (separators){
  10922. var self=this;
  10923. var $1;
  10924. $1=smalltalk.send(smalltalk.send(self,"_trimLeft_",[separators]),"_trimRight_",[separators]);
  10925. return $1;
  10926. },
  10927. args: ["separators"],
  10928. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  10929. messageSends: ["trimRight:", "trimLeft:"],
  10930. referencedClasses: []
  10931. }),
  10932. smalltalk.String);
  10933. smalltalk.addMethod(
  10934. "_trimLeft",
  10935. smalltalk.method({
  10936. selector: "trimLeft",
  10937. category: 'regular expressions',
  10938. fn: function (){
  10939. var self=this;
  10940. var $1;
  10941. $1=smalltalk.send(self,"_trimLeft_",["\x5cs"]);
  10942. return $1;
  10943. },
  10944. args: [],
  10945. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  10946. messageSends: ["trimLeft:"],
  10947. referencedClasses: []
  10948. }),
  10949. smalltalk.String);
  10950. smalltalk.addMethod(
  10951. "_trimLeft_",
  10952. smalltalk.method({
  10953. selector: "trimLeft:",
  10954. category: 'regular expressions',
  10955. fn: function (separators){
  10956. var self=this;
  10957. var $1;
  10958. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("^[","__comma",[separators]),"__comma",["]+"]),"g"]),""]);
  10959. return $1;
  10960. },
  10961. args: ["separators"],
  10962. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  10963. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10964. referencedClasses: ["RegularExpression"]
  10965. }),
  10966. smalltalk.String);
  10967. smalltalk.addMethod(
  10968. "_trimRight",
  10969. smalltalk.method({
  10970. selector: "trimRight",
  10971. category: 'regular expressions',
  10972. fn: function (){
  10973. var self=this;
  10974. var $1;
  10975. $1=smalltalk.send(self,"_trimRight_",["\x5cs"]);
  10976. return $1;
  10977. },
  10978. args: [],
  10979. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  10980. messageSends: ["trimRight:"],
  10981. referencedClasses: []
  10982. }),
  10983. smalltalk.String);
  10984. smalltalk.addMethod(
  10985. "_trimRight_",
  10986. smalltalk.method({
  10987. selector: "trimRight:",
  10988. category: 'regular expressions',
  10989. fn: function (separators){
  10990. var self=this;
  10991. var $1;
  10992. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("[","__comma",[separators]),"__comma",["]+$"]),"g"]),""]);
  10993. return $1;
  10994. },
  10995. args: ["separators"],
  10996. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  10997. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10998. referencedClasses: ["RegularExpression"]
  10999. }),
  11000. smalltalk.String);
  11001. smalltalk.addMethod(
  11002. "_unescaped",
  11003. smalltalk.method({
  11004. selector: "unescaped",
  11005. category: 'accessing',
  11006. fn: function (){
  11007. var self=this;
  11008. return unescape(self);
  11009. ;
  11010. return self},
  11011. args: [],
  11012. source: "unescaped\x0a\x09<return unescape(self)>",
  11013. messageSends: [],
  11014. referencedClasses: []
  11015. }),
  11016. smalltalk.String);
  11017. smalltalk.addMethod(
  11018. "_withIndexDo_",
  11019. smalltalk.method({
  11020. selector: "withIndexDo:",
  11021. category: 'enumerating',
  11022. fn: function (aBlock){
  11023. var self=this;
  11024. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  11025. ;
  11026. return self},
  11027. args: ["aBlock"],
  11028. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  11029. messageSends: [],
  11030. referencedClasses: []
  11031. }),
  11032. smalltalk.String);
  11033. smalltalk.addMethod(
  11034. "_cr",
  11035. smalltalk.method({
  11036. selector: "cr",
  11037. category: 'accessing',
  11038. fn: function (){
  11039. var self=this;
  11040. return '\r';
  11041. ;
  11042. return self},
  11043. args: [],
  11044. source: "cr\x0a\x09<return '\x5cr'>",
  11045. messageSends: [],
  11046. referencedClasses: []
  11047. }),
  11048. smalltalk.String.klass);
  11049. smalltalk.addMethod(
  11050. "_crlf",
  11051. smalltalk.method({
  11052. selector: "crlf",
  11053. category: 'accessing',
  11054. fn: function (){
  11055. var self=this;
  11056. return '\r\n';
  11057. ;
  11058. return self},
  11059. args: [],
  11060. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  11061. messageSends: [],
  11062. referencedClasses: []
  11063. }),
  11064. smalltalk.String.klass);
  11065. smalltalk.addMethod(
  11066. "_fromCharCode_",
  11067. smalltalk.method({
  11068. selector: "fromCharCode:",
  11069. category: 'instance creation',
  11070. fn: function (anInteger){
  11071. var self=this;
  11072. return String.fromCharCode(anInteger);
  11073. ;
  11074. return self},
  11075. args: ["anInteger"],
  11076. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  11077. messageSends: [],
  11078. referencedClasses: []
  11079. }),
  11080. smalltalk.String.klass);
  11081. smalltalk.addMethod(
  11082. "_fromString_",
  11083. smalltalk.method({
  11084. selector: "fromString:",
  11085. category: 'instance creation',
  11086. fn: function (aString){
  11087. var self=this;
  11088. return new self.fn(aString);
  11089. ;
  11090. return self},
  11091. args: ["aString"],
  11092. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  11093. messageSends: [],
  11094. referencedClasses: []
  11095. }),
  11096. smalltalk.String.klass);
  11097. smalltalk.addMethod(
  11098. "_lf",
  11099. smalltalk.method({
  11100. selector: "lf",
  11101. category: 'accessing',
  11102. fn: function (){
  11103. var self=this;
  11104. return '\n';
  11105. ;
  11106. return self},
  11107. args: [],
  11108. source: "lf\x0a\x09<return '\x5cn'>",
  11109. messageSends: [],
  11110. referencedClasses: []
  11111. }),
  11112. smalltalk.String.klass);
  11113. smalltalk.addMethod(
  11114. "_space",
  11115. smalltalk.method({
  11116. selector: "space",
  11117. category: 'accessing',
  11118. fn: function (){
  11119. var self=this;
  11120. return ' ';
  11121. ;
  11122. return self},
  11123. args: [],
  11124. source: "space\x0a\x09<return ' '>",
  11125. messageSends: [],
  11126. referencedClasses: []
  11127. }),
  11128. smalltalk.String.klass);
  11129. smalltalk.addMethod(
  11130. "_streamClass",
  11131. smalltalk.method({
  11132. selector: "streamClass",
  11133. category: 'accessing',
  11134. fn: function (){
  11135. var self=this;
  11136. return (smalltalk.StringStream || StringStream);
  11137. },
  11138. args: [],
  11139. source: "streamClass\x0a\x09 ^StringStream",
  11140. messageSends: [],
  11141. referencedClasses: ["StringStream"]
  11142. }),
  11143. smalltalk.String.klass);
  11144. smalltalk.addMethod(
  11145. "_streamContents_",
  11146. smalltalk.method({
  11147. selector: "streamContents:",
  11148. category: 'instance creation',
  11149. fn: function (blockWithArg){
  11150. var self=this;
  11151. var $1;
  11152. var stream;
  11153. stream=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[smalltalk.send((smalltalk.String || String),"_new",[])]);
  11154. smalltalk.send(blockWithArg,"_value_",[stream]);
  11155. $1=smalltalk.send(stream,"_contents",[]);
  11156. return $1;
  11157. },
  11158. args: ["blockWithArg"],
  11159. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  11160. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  11161. referencedClasses: ["String"]
  11162. }),
  11163. smalltalk.String.klass);
  11164. smalltalk.addMethod(
  11165. "_tab",
  11166. smalltalk.method({
  11167. selector: "tab",
  11168. category: 'accessing',
  11169. fn: function (){
  11170. var self=this;
  11171. return '\t';
  11172. ;
  11173. return self},
  11174. args: [],
  11175. source: "tab\x0a\x09<return '\x5ct'>",
  11176. messageSends: [],
  11177. referencedClasses: []
  11178. }),
  11179. smalltalk.String.klass);
  11180. smalltalk.addMethod(
  11181. "_value_",
  11182. smalltalk.method({
  11183. selector: "value:",
  11184. category: 'instance creation',
  11185. fn: function (aUTFCharCode){
  11186. var self=this;
  11187. return String.fromCharCode(aUTFCharCode);;
  11188. ;
  11189. return self},
  11190. args: ["aUTFCharCode"],
  11191. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  11192. messageSends: [],
  11193. referencedClasses: []
  11194. }),
  11195. smalltalk.String.klass);
  11196. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  11197. smalltalk.addMethod(
  11198. "__lt",
  11199. smalltalk.method({
  11200. selector: "<",
  11201. category: 'comparing',
  11202. fn: function (aSymbol){
  11203. var self=this;
  11204. var $1;
  11205. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt",[smalltalk.send(aSymbol,"_asString",[])]);
  11206. return $1;
  11207. },
  11208. args: ["aSymbol"],
  11209. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  11210. messageSends: ["<", "asString"],
  11211. referencedClasses: []
  11212. }),
  11213. smalltalk.Symbol);
  11214. smalltalk.addMethod(
  11215. "__lt_eq",
  11216. smalltalk.method({
  11217. selector: "<=",
  11218. category: 'comparing',
  11219. fn: function (aSymbol){
  11220. var self=this;
  11221. var $1;
  11222. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11223. return $1;
  11224. },
  11225. args: ["aSymbol"],
  11226. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  11227. messageSends: ["<=", "asString"],
  11228. referencedClasses: []
  11229. }),
  11230. smalltalk.Symbol);
  11231. smalltalk.addMethod(
  11232. "__eq",
  11233. smalltalk.method({
  11234. selector: "=",
  11235. category: 'comparing',
  11236. fn: function (aSymbol){
  11237. var self=this;
  11238. var $1,$2;
  11239. $1=smalltalk.send(smalltalk.send(aSymbol,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  11240. if(! smalltalk.assert($1)){
  11241. return false;
  11242. };
  11243. $2=smalltalk.send(smalltalk.send(self,"_asString",[]),"__eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11244. return $2;
  11245. },
  11246. args: ["aSymbol"],
  11247. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  11248. messageSends: ["ifFalse:", "=", "class", "asString"],
  11249. referencedClasses: []
  11250. }),
  11251. smalltalk.Symbol);
  11252. smalltalk.addMethod(
  11253. "__gt",
  11254. smalltalk.method({
  11255. selector: ">",
  11256. category: 'comparing',
  11257. fn: function (aSymbol){
  11258. var self=this;
  11259. var $1;
  11260. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt",[smalltalk.send(aSymbol,"_asString",[])]);
  11261. return $1;
  11262. },
  11263. args: ["aSymbol"],
  11264. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  11265. messageSends: [">", "asString"],
  11266. referencedClasses: []
  11267. }),
  11268. smalltalk.Symbol);
  11269. smalltalk.addMethod(
  11270. "__gt_eq",
  11271. smalltalk.method({
  11272. selector: ">=",
  11273. category: 'comparing',
  11274. fn: function (aSymbol){
  11275. var self=this;
  11276. var $1;
  11277. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11278. return $1;
  11279. },
  11280. args: ["aSymbol"],
  11281. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  11282. messageSends: [">=", "asString"],
  11283. referencedClasses: []
  11284. }),
  11285. smalltalk.Symbol);
  11286. smalltalk.addMethod(
  11287. "_asJSON",
  11288. smalltalk.method({
  11289. selector: "asJSON",
  11290. category: 'converting',
  11291. fn: function (){
  11292. var self=this;
  11293. var $1;
  11294. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asJSON",[]);
  11295. return $1;
  11296. },
  11297. args: [],
  11298. source: "asJSON\x0a\x09^self asString asJSON",
  11299. messageSends: ["asJSON", "asString"],
  11300. referencedClasses: []
  11301. }),
  11302. smalltalk.Symbol);
  11303. smalltalk.addMethod(
  11304. "_asJavascript",
  11305. smalltalk.method({
  11306. selector: "asJavascript",
  11307. category: 'converting',
  11308. fn: function (){
  11309. var self=this;
  11310. var $1;
  11311. $1=smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22","__comma",[smalltalk.send(self,"_asString",[])]),"__comma",["\x22)"]);
  11312. return $1;
  11313. },
  11314. args: [],
  11315. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  11316. messageSends: [",", "asString"],
  11317. referencedClasses: []
  11318. }),
  11319. smalltalk.Symbol);
  11320. smalltalk.addMethod(
  11321. "_asSelector",
  11322. smalltalk.method({
  11323. selector: "asSelector",
  11324. category: 'converting',
  11325. fn: function (){
  11326. var self=this;
  11327. var $1;
  11328. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSelector",[]);
  11329. return $1;
  11330. },
  11331. args: [],
  11332. source: "asSelector\x0a\x09^self asString asSelector",
  11333. messageSends: ["asSelector", "asString"],
  11334. referencedClasses: []
  11335. }),
  11336. smalltalk.Symbol);
  11337. smalltalk.addMethod(
  11338. "_asString",
  11339. smalltalk.method({
  11340. selector: "asString",
  11341. category: 'converting',
  11342. fn: function (){
  11343. var self=this;
  11344. return self.value;
  11345. ;
  11346. return self},
  11347. args: [],
  11348. source: "asString\x0a\x09<return self.value>",
  11349. messageSends: [],
  11350. referencedClasses: []
  11351. }),
  11352. smalltalk.Symbol);
  11353. smalltalk.addMethod(
  11354. "_asSymbol",
  11355. smalltalk.method({
  11356. selector: "asSymbol",
  11357. category: 'converting',
  11358. fn: function (){
  11359. var self=this;
  11360. return self;
  11361. },
  11362. args: [],
  11363. source: "asSymbol\x0a\x09^self",
  11364. messageSends: [],
  11365. referencedClasses: []
  11366. }),
  11367. smalltalk.Symbol);
  11368. smalltalk.addMethod(
  11369. "_at_ifAbsent_",
  11370. smalltalk.method({
  11371. selector: "at:ifAbsent:",
  11372. category: 'accessing',
  11373. fn: function (anIndex,aBlock){
  11374. var self=this;
  11375. var $1;
  11376. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_at_ifAbsent_",[anIndex,aBlock]);
  11377. return $1;
  11378. },
  11379. args: ["anIndex", "aBlock"],
  11380. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  11381. messageSends: ["at:ifAbsent:", "asString"],
  11382. referencedClasses: []
  11383. }),
  11384. smalltalk.Symbol);
  11385. smalltalk.addMethod(
  11386. "_collect_",
  11387. smalltalk.method({
  11388. selector: "collect:",
  11389. category: 'enumerating',
  11390. fn: function (aBlock){
  11391. var self=this;
  11392. var $1;
  11393. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_collect_",[aBlock]),"_asSymbol",[]);
  11394. return $1;
  11395. },
  11396. args: ["aBlock"],
  11397. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  11398. messageSends: ["asSymbol", "collect:", "asString"],
  11399. referencedClasses: []
  11400. }),
  11401. smalltalk.Symbol);
  11402. smalltalk.addMethod(
  11403. "_copyFrom_to_",
  11404. smalltalk.method({
  11405. selector: "copyFrom:to:",
  11406. category: 'copying',
  11407. fn: function (anIndex,anotherIndex){
  11408. var self=this;
  11409. var $1;
  11410. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_copyFrom_to_",[anIndex,anotherIndex])]);
  11411. return $1;
  11412. },
  11413. args: ["anIndex", "anotherIndex"],
  11414. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  11415. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  11416. referencedClasses: []
  11417. }),
  11418. smalltalk.Symbol);
  11419. smalltalk.addMethod(
  11420. "_deepCopy",
  11421. smalltalk.method({
  11422. selector: "deepCopy",
  11423. category: 'copying',
  11424. fn: function (){
  11425. var self=this;
  11426. return self;
  11427. },
  11428. args: [],
  11429. source: "deepCopy\x0a\x09^self",
  11430. messageSends: [],
  11431. referencedClasses: []
  11432. }),
  11433. smalltalk.Symbol);
  11434. smalltalk.addMethod(
  11435. "_detect_",
  11436. smalltalk.method({
  11437. selector: "detect:",
  11438. category: 'enumerating',
  11439. fn: function (aBlock){
  11440. var self=this;
  11441. var $1;
  11442. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_detect_",[aBlock]);
  11443. return $1;
  11444. },
  11445. args: ["aBlock"],
  11446. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  11447. messageSends: ["detect:", "asString"],
  11448. referencedClasses: []
  11449. }),
  11450. smalltalk.Symbol);
  11451. smalltalk.addMethod(
  11452. "_do_",
  11453. smalltalk.method({
  11454. selector: "do:",
  11455. category: 'enumerating',
  11456. fn: function (aBlock){
  11457. var self=this;
  11458. smalltalk.send(smalltalk.send(self,"_asString",[]),"_do_",[aBlock]);
  11459. return self},
  11460. args: ["aBlock"],
  11461. source: "do: aBlock\x0a\x09self asString do: aBlock",
  11462. messageSends: ["do:", "asString"],
  11463. referencedClasses: []
  11464. }),
  11465. smalltalk.Symbol);
  11466. smalltalk.addMethod(
  11467. "_isSymbol",
  11468. smalltalk.method({
  11469. selector: "isSymbol",
  11470. category: 'printing',
  11471. fn: function (){
  11472. var self=this;
  11473. return true;
  11474. },
  11475. args: [],
  11476. source: "isSymbol\x0a\x09^true",
  11477. messageSends: [],
  11478. referencedClasses: []
  11479. }),
  11480. smalltalk.Symbol);
  11481. smalltalk.addMethod(
  11482. "_printString",
  11483. smalltalk.method({
  11484. selector: "printString",
  11485. category: 'printing',
  11486. fn: function (){
  11487. var self=this;
  11488. var $1;
  11489. $1=smalltalk.send("#","__comma",[smalltalk.send(self,"_asString",[])]);
  11490. return $1;
  11491. },
  11492. args: [],
  11493. source: "printString\x0a\x09^'#', self asString",
  11494. messageSends: [",", "asString"],
  11495. referencedClasses: []
  11496. }),
  11497. smalltalk.Symbol);
  11498. smalltalk.addMethod(
  11499. "_select_",
  11500. smalltalk.method({
  11501. selector: "select:",
  11502. category: 'enumerating',
  11503. fn: function (aBlock){
  11504. var self=this;
  11505. var $1;
  11506. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_select_",[aBlock]),"_asSymbol",[]);
  11507. return $1;
  11508. },
  11509. args: ["aBlock"],
  11510. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  11511. messageSends: ["asSymbol", "select:", "asString"],
  11512. referencedClasses: []
  11513. }),
  11514. smalltalk.Symbol);
  11515. smalltalk.addMethod(
  11516. "_shallowCopy",
  11517. smalltalk.method({
  11518. selector: "shallowCopy",
  11519. category: 'copying',
  11520. fn: function (){
  11521. var self=this;
  11522. return self;
  11523. },
  11524. args: [],
  11525. source: "shallowCopy\x0a\x09^self",
  11526. messageSends: [],
  11527. referencedClasses: []
  11528. }),
  11529. smalltalk.Symbol);
  11530. smalltalk.addMethod(
  11531. "_size",
  11532. smalltalk.method({
  11533. selector: "size",
  11534. category: 'accessing',
  11535. fn: function (){
  11536. var self=this;
  11537. var $1;
  11538. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_size",[]);
  11539. return $1;
  11540. },
  11541. args: [],
  11542. source: "size\x0a\x09^self asString size",
  11543. messageSends: ["size", "asString"],
  11544. referencedClasses: []
  11545. }),
  11546. smalltalk.Symbol);
  11547. smalltalk.addMethod(
  11548. "_value_",
  11549. smalltalk.method({
  11550. selector: "value:",
  11551. category: 'evaluating',
  11552. fn: function (anObject){
  11553. var self=this;
  11554. var $1;
  11555. $1=smalltalk.send(anObject,"_perform_",[self]);
  11556. return $1;
  11557. },
  11558. args: ["anObject"],
  11559. source: "value: anObject \x0a\x09^anObject perform: self",
  11560. messageSends: ["perform:"],
  11561. referencedClasses: []
  11562. }),
  11563. smalltalk.Symbol);
  11564. smalltalk.addMethod(
  11565. "_withIndexDo_",
  11566. smalltalk.method({
  11567. selector: "withIndexDo:",
  11568. category: 'enumerating',
  11569. fn: function (aBlock){
  11570. var self=this;
  11571. smalltalk.send(smalltalk.send(self,"_asString",[]),"_withIndexDo_",[aBlock]);
  11572. return self},
  11573. args: ["aBlock"],
  11574. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  11575. messageSends: ["withIndexDo:", "asString"],
  11576. referencedClasses: []
  11577. }),
  11578. smalltalk.Symbol);
  11579. smalltalk.addMethod(
  11580. "_basicNew",
  11581. smalltalk.method({
  11582. selector: "basicNew",
  11583. category: 'instance creation',
  11584. fn: function (){
  11585. var self=this;
  11586. smalltalk.send(self,"_shouldNotImplement",[]);
  11587. return self},
  11588. args: [],
  11589. source: "basicNew\x0a\x09self shouldNotImplement",
  11590. messageSends: ["shouldNotImplement"],
  11591. referencedClasses: []
  11592. }),
  11593. smalltalk.Symbol.klass);
  11594. smalltalk.addMethod(
  11595. "_fromString_",
  11596. smalltalk.method({
  11597. selector: "fromString:",
  11598. category: 'instance creation',
  11599. fn: function (aString){
  11600. var self=this;
  11601. var $1;
  11602. $1=smalltalk.send(self,"_lookup_",[aString]);
  11603. return $1;
  11604. },
  11605. args: ["aString"],
  11606. source: "fromString: aString\x0a\x09^self lookup: aString",
  11607. messageSends: ["lookup:"],
  11608. referencedClasses: []
  11609. }),
  11610. smalltalk.Symbol.klass);
  11611. smalltalk.addMethod(
  11612. "_lookup_",
  11613. smalltalk.method({
  11614. selector: "lookup:",
  11615. category: 'instance creation',
  11616. fn: function (aString){
  11617. var self=this;
  11618. return smalltalk.symbolFor(aString);;
  11619. ;
  11620. return self},
  11621. args: ["aString"],
  11622. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  11623. messageSends: [],
  11624. referencedClasses: []
  11625. }),
  11626. smalltalk.Symbol.klass);
  11627. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  11628. smalltalk.addMethod(
  11629. "__eq",
  11630. smalltalk.method({
  11631. selector: "=",
  11632. category: 'comparing',
  11633. fn: function (aCollection){
  11634. var self=this;
  11635. var $1;
  11636. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  11637. return smalltalk.send(self["@elements"],"__eq",[smalltalk.send(aCollection,"_asArray",[])]);
  11638. })]);
  11639. return $1;
  11640. },
  11641. args: ["aCollection"],
  11642. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  11643. messageSends: ["and:", "=", "asArray", "class"],
  11644. referencedClasses: []
  11645. }),
  11646. smalltalk.Set);
  11647. smalltalk.addMethod(
  11648. "_add_",
  11649. smalltalk.method({
  11650. selector: "add:",
  11651. category: 'adding/removing',
  11652. fn: function (anObject){
  11653. var self=this;
  11654. var found;
  11655. for(var i=0; i < self['@elements'].length; i++) {
  11656. if(anObject == self['@elements'][i]) {
  11657. found = true;
  11658. break;
  11659. }
  11660. }
  11661. if(!found) {self['@elements'].push(anObject)}
  11662. ;
  11663. ;
  11664. return self},
  11665. args: ["anObject"],
  11666. 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>",
  11667. messageSends: [],
  11668. referencedClasses: []
  11669. }),
  11670. smalltalk.Set);
  11671. smalltalk.addMethod(
  11672. "_asArray",
  11673. smalltalk.method({
  11674. selector: "asArray",
  11675. category: 'converting',
  11676. fn: function (){
  11677. var self=this;
  11678. var $1;
  11679. $1=smalltalk.send(self["@elements"],"_copy",[]);
  11680. return $1;
  11681. },
  11682. args: [],
  11683. source: "asArray\x0a\x09^elements copy",
  11684. messageSends: ["copy"],
  11685. referencedClasses: []
  11686. }),
  11687. smalltalk.Set);
  11688. smalltalk.addMethod(
  11689. "_detect_ifNone_",
  11690. smalltalk.method({
  11691. selector: "detect:ifNone:",
  11692. category: 'enumerating',
  11693. fn: function (aBlock,anotherBlock){
  11694. var self=this;
  11695. var $1;
  11696. $1=smalltalk.send(self["@elements"],"_detect_ifNone_",[aBlock,anotherBlock]);
  11697. return $1;
  11698. },
  11699. args: ["aBlock", "anotherBlock"],
  11700. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  11701. messageSends: ["detect:ifNone:"],
  11702. referencedClasses: []
  11703. }),
  11704. smalltalk.Set);
  11705. smalltalk.addMethod(
  11706. "_do_",
  11707. smalltalk.method({
  11708. selector: "do:",
  11709. category: 'enumerating',
  11710. fn: function (aBlock){
  11711. var self=this;
  11712. smalltalk.send(self["@elements"],"_do_",[aBlock]);
  11713. return self},
  11714. args: ["aBlock"],
  11715. source: "do: aBlock\x0a\x09elements do: aBlock",
  11716. messageSends: ["do:"],
  11717. referencedClasses: []
  11718. }),
  11719. smalltalk.Set);
  11720. smalltalk.addMethod(
  11721. "_includes_",
  11722. smalltalk.method({
  11723. selector: "includes:",
  11724. category: 'testing',
  11725. fn: function (anObject){
  11726. var self=this;
  11727. var $1;
  11728. $1=smalltalk.send(self["@elements"],"_includes_",[anObject]);
  11729. return $1;
  11730. },
  11731. args: ["anObject"],
  11732. source: "includes: anObject\x0a\x09^elements includes: anObject",
  11733. messageSends: ["includes:"],
  11734. referencedClasses: []
  11735. }),
  11736. smalltalk.Set);
  11737. smalltalk.addMethod(
  11738. "_initialize",
  11739. smalltalk.method({
  11740. selector: "initialize",
  11741. category: 'initialization',
  11742. fn: function (){
  11743. var self=this;
  11744. smalltalk.send(self,"_initialize",[],smalltalk.Collection);
  11745. self["@elements"]=[];
  11746. return self},
  11747. args: [],
  11748. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  11749. messageSends: ["initialize"],
  11750. referencedClasses: []
  11751. }),
  11752. smalltalk.Set);
  11753. smalltalk.addMethod(
  11754. "_remove_",
  11755. smalltalk.method({
  11756. selector: "remove:",
  11757. category: 'adding/removing',
  11758. fn: function (anObject){
  11759. var self=this;
  11760. smalltalk.send(self["@elements"],"_remove_",[anObject]);
  11761. return self},
  11762. args: ["anObject"],
  11763. source: "remove: anObject\x0a\x09elements remove: anObject",
  11764. messageSends: ["remove:"],
  11765. referencedClasses: []
  11766. }),
  11767. smalltalk.Set);
  11768. smalltalk.addMethod(
  11769. "_select_",
  11770. smalltalk.method({
  11771. selector: "select:",
  11772. category: 'enumerating',
  11773. fn: function (aBlock){
  11774. var self=this;
  11775. var $1;
  11776. var collection;
  11777. collection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  11778. smalltalk.send(self,"_do_",[(function(each){
  11779. $1=smalltalk.send(aBlock,"_value_",[each]);
  11780. if(smalltalk.assert($1)){
  11781. return smalltalk.send(collection,"_add_",[each]);
  11782. };
  11783. })]);
  11784. return collection;
  11785. },
  11786. args: ["aBlock"],
  11787. 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",
  11788. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  11789. referencedClasses: []
  11790. }),
  11791. smalltalk.Set);
  11792. smalltalk.addMethod(
  11793. "_size",
  11794. smalltalk.method({
  11795. selector: "size",
  11796. category: 'accessing',
  11797. fn: function (){
  11798. var self=this;
  11799. var $1;
  11800. $1=smalltalk.send(self["@elements"],"_size",[]);
  11801. return $1;
  11802. },
  11803. args: [],
  11804. source: "size\x0a\x09^elements size",
  11805. messageSends: ["size"],
  11806. referencedClasses: []
  11807. }),
  11808. smalltalk.Set);
  11809. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  11810. smalltalk.Queue.comment="I am a one-sided Queue.\x0a\x0aI use 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."
  11811. smalltalk.addMethod(
  11812. "_back_",
  11813. smalltalk.method({
  11814. selector: "back:",
  11815. category: 'accessing',
  11816. fn: function (anObject){
  11817. var self=this;
  11818. smalltalk.send(self["@write"],"_add_",[anObject]);
  11819. return self},
  11820. args: ["anObject"],
  11821. source: "back: anObject\x0a\x09write add: anObject\x0a",
  11822. messageSends: ["add:"],
  11823. referencedClasses: []
  11824. }),
  11825. smalltalk.Queue);
  11826. smalltalk.addMethod(
  11827. "_front",
  11828. smalltalk.method({
  11829. selector: "front",
  11830. category: 'accessing',
  11831. fn: function (){
  11832. var self=this;
  11833. var $1;
  11834. $1=smalltalk.send(self,"_frontIfAbsent_",[(function(){
  11835. return smalltalk.send(self,"_error_",["Cannot read from empty Queue."]);
  11836. })]);
  11837. return $1;
  11838. },
  11839. args: [],
  11840. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.']\x0a",
  11841. messageSends: ["frontIfAbsent:", "error:"],
  11842. referencedClasses: []
  11843. }),
  11844. smalltalk.Queue);
  11845. smalltalk.addMethod(
  11846. "_frontIfAbsent_",
  11847. smalltalk.method({
  11848. selector: "frontIfAbsent:",
  11849. category: 'accessing',
  11850. fn: function (aBlock){
  11851. var self=this;
  11852. var $1,$2,$3;
  11853. var $early={};
  11854. try {
  11855. var result;
  11856. result=smalltalk.send(self["@read"],"_at_ifAbsent_",[self["@readIndex"],(function(){
  11857. $1=smalltalk.send(self["@write"],"_isEmpty",[]);
  11858. if(smalltalk.assert($1)){
  11859. $2=smalltalk.send(self["@readIndex"],"__gt",[(1)]);
  11860. if(smalltalk.assert($2)){
  11861. self["@read"]=[];
  11862. self["@read"];
  11863. self["@readIndex"]=(1);
  11864. self["@readIndex"];
  11865. };
  11866. $3=smalltalk.send(aBlock,"_value",[]);
  11867. throw $early=[$3];
  11868. };
  11869. self["@read"]=self["@write"];
  11870. self["@read"];
  11871. self["@readIndex"]=(1);
  11872. self["@readIndex"];
  11873. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11874. self["@write"];
  11875. return smalltalk.send(self["@read"],"_first",[]);
  11876. })]);
  11877. smalltalk.send(self["@read"],"_at_put_",[self["@readIndex"],nil]);
  11878. self["@readIndex"]=smalltalk.send(self["@readIndex"],"__plus",[(1)]);
  11879. return result;
  11880. }
  11881. catch(e) {if(e===$early)return e[0]; throw e}
  11882. },
  11883. args: ["aBlock"],
  11884. source: "frontIfAbsent: 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 \x09read := write.\x0a \x09readIndex := 1.\x0a \x09write := OrderedCollection new.\x0a \x09read first ].\x0a read at: readIndex put: nil.\x0a readIndex := readIndex + 1.\x0a ^result\x0a",
  11885. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  11886. referencedClasses: ["OrderedCollection"]
  11887. }),
  11888. smalltalk.Queue);
  11889. smalltalk.addMethod(
  11890. "_initialize",
  11891. smalltalk.method({
  11892. selector: "initialize",
  11893. category: 'initialization',
  11894. fn: function (){
  11895. var self=this;
  11896. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  11897. self["@read"]=[];
  11898. self["@readIndex"]=(1);
  11899. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11900. return self},
  11901. args: [],
  11902. source: "initialize\x0a\x09super initialize.\x0a\x09read := #().\x0a readIndex := 1.\x0a write := OrderedCollection new",
  11903. messageSends: ["initialize", "new"],
  11904. referencedClasses: ["OrderedCollection"]
  11905. }),
  11906. smalltalk.Queue);
  11907. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  11908. smalltalk.addMethod(
  11909. "_compile_",
  11910. smalltalk.method({
  11911. selector: "compile:",
  11912. category: 'evaluating',
  11913. fn: function (aString){
  11914. var self=this;
  11915. return self.compile(aString);
  11916. ;
  11917. return self},
  11918. args: ["aString"],
  11919. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  11920. messageSends: [],
  11921. referencedClasses: []
  11922. }),
  11923. smalltalk.RegularExpression);
  11924. smalltalk.addMethod(
  11925. "_exec_",
  11926. smalltalk.method({
  11927. selector: "exec:",
  11928. category: 'evaluating',
  11929. fn: function (aString){
  11930. var self=this;
  11931. return self.exec(aString) || nil;
  11932. ;
  11933. return self},
  11934. args: ["aString"],
  11935. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  11936. messageSends: [],
  11937. referencedClasses: []
  11938. }),
  11939. smalltalk.RegularExpression);
  11940. smalltalk.addMethod(
  11941. "_test_",
  11942. smalltalk.method({
  11943. selector: "test:",
  11944. category: 'evaluating',
  11945. fn: function (aString){
  11946. var self=this;
  11947. return self.test(aString);
  11948. ;
  11949. return self},
  11950. args: ["aString"],
  11951. source: "test: aString\x0a\x09<return self.test(aString)>",
  11952. messageSends: [],
  11953. referencedClasses: []
  11954. }),
  11955. smalltalk.RegularExpression);
  11956. smalltalk.addMethod(
  11957. "_fromString_",
  11958. smalltalk.method({
  11959. selector: "fromString:",
  11960. category: 'instance creation',
  11961. fn: function (aString){
  11962. var self=this;
  11963. var $1;
  11964. $1=smalltalk.send(self,"_fromString_flag_",[aString,""]);
  11965. return $1;
  11966. },
  11967. args: ["aString"],
  11968. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  11969. messageSends: ["fromString:flag:"],
  11970. referencedClasses: []
  11971. }),
  11972. smalltalk.RegularExpression.klass);
  11973. smalltalk.addMethod(
  11974. "_fromString_flag_",
  11975. smalltalk.method({
  11976. selector: "fromString:flag:",
  11977. category: 'instance creation',
  11978. fn: function (aString,anotherString){
  11979. var self=this;
  11980. return new RegExp(aString, anotherString);
  11981. ;
  11982. return self},
  11983. args: ["aString", "anotherString"],
  11984. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  11985. messageSends: [],
  11986. referencedClasses: []
  11987. }),
  11988. smalltalk.RegularExpression.klass);
  11989. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  11990. smalltalk.addMethod(
  11991. "_atEnd",
  11992. smalltalk.method({
  11993. selector: "atEnd",
  11994. category: 'testing',
  11995. fn: function (){
  11996. var self=this;
  11997. var $1;
  11998. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[smalltalk.send(self,"_size",[])]);
  11999. return $1;
  12000. },
  12001. args: [],
  12002. source: "atEnd\x0a\x09^self position = self size",
  12003. messageSends: ["=", "size", "position"],
  12004. referencedClasses: []
  12005. }),
  12006. smalltalk.Stream);
  12007. smalltalk.addMethod(
  12008. "_atStart",
  12009. smalltalk.method({
  12010. selector: "atStart",
  12011. category: 'testing',
  12012. fn: function (){
  12013. var self=this;
  12014. var $1;
  12015. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[(0)]);
  12016. return $1;
  12017. },
  12018. args: [],
  12019. source: "atStart\x0a\x09^self position = 0",
  12020. messageSends: ["=", "position"],
  12021. referencedClasses: []
  12022. }),
  12023. smalltalk.Stream);
  12024. smalltalk.addMethod(
  12025. "_close",
  12026. smalltalk.method({
  12027. selector: "close",
  12028. category: 'actions',
  12029. fn: function (){
  12030. var self=this;
  12031. return self},
  12032. args: [],
  12033. source: "close",
  12034. messageSends: [],
  12035. referencedClasses: []
  12036. }),
  12037. smalltalk.Stream);
  12038. smalltalk.addMethod(
  12039. "_collection",
  12040. smalltalk.method({
  12041. selector: "collection",
  12042. category: 'accessing',
  12043. fn: function (){
  12044. var self=this;
  12045. return self["@collection"];
  12046. },
  12047. args: [],
  12048. source: "collection\x0a\x09^collection",
  12049. messageSends: [],
  12050. referencedClasses: []
  12051. }),
  12052. smalltalk.Stream);
  12053. smalltalk.addMethod(
  12054. "_contents",
  12055. smalltalk.method({
  12056. selector: "contents",
  12057. category: 'accessing',
  12058. fn: function (){
  12059. var self=this;
  12060. var $1;
  12061. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_streamSize",[])]);
  12062. return $1;
  12063. },
  12064. args: [],
  12065. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  12066. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  12067. referencedClasses: []
  12068. }),
  12069. smalltalk.Stream);
  12070. smalltalk.addMethod(
  12071. "_do_",
  12072. smalltalk.method({
  12073. selector: "do:",
  12074. category: 'enumerating',
  12075. fn: function (aBlock){
  12076. var self=this;
  12077. smalltalk.send((function(){
  12078. return smalltalk.send(self,"_atEnd",[]);
  12079. }),"_whileFalse_",[(function(){
  12080. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_next",[])]);
  12081. })]);
  12082. return self},
  12083. args: ["aBlock"],
  12084. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  12085. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  12086. referencedClasses: []
  12087. }),
  12088. smalltalk.Stream);
  12089. smalltalk.addMethod(
  12090. "_flush",
  12091. smalltalk.method({
  12092. selector: "flush",
  12093. category: 'actions',
  12094. fn: function (){
  12095. var self=this;
  12096. return self},
  12097. args: [],
  12098. source: "flush",
  12099. messageSends: [],
  12100. referencedClasses: []
  12101. }),
  12102. smalltalk.Stream);
  12103. smalltalk.addMethod(
  12104. "_isEmpty",
  12105. smalltalk.method({
  12106. selector: "isEmpty",
  12107. category: 'testing',
  12108. fn: function (){
  12109. var self=this;
  12110. var $1;
  12111. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  12112. return $1;
  12113. },
  12114. args: [],
  12115. source: "isEmpty\x0a\x09^self size = 0",
  12116. messageSends: ["=", "size"],
  12117. referencedClasses: []
  12118. }),
  12119. smalltalk.Stream);
  12120. smalltalk.addMethod(
  12121. "_next",
  12122. smalltalk.method({
  12123. selector: "next",
  12124. category: 'reading',
  12125. fn: function (){
  12126. var self=this;
  12127. var $2,$1;
  12128. $2=smalltalk.send(self,"_atEnd",[]);
  12129. if(smalltalk.assert($2)){
  12130. $1=nil;
  12131. } else {
  12132. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12133. $1=smalltalk.send(self["@collection"],"_at_",[smalltalk.send(self,"_position",[])]);
  12134. };
  12135. return $1;
  12136. },
  12137. args: [],
  12138. 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]",
  12139. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  12140. referencedClasses: []
  12141. }),
  12142. smalltalk.Stream);
  12143. smalltalk.addMethod(
  12144. "_next_",
  12145. smalltalk.method({
  12146. selector: "next:",
  12147. category: 'reading',
  12148. fn: function (anInteger){
  12149. var self=this;
  12150. var $1;
  12151. var tempCollection;
  12152. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  12153. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  12154. $1=smalltalk.send(self,"_atEnd",[]);
  12155. if(! smalltalk.assert($1)){
  12156. return smalltalk.send(tempCollection,"_add_",[smalltalk.send(self,"_next",[])]);
  12157. };
  12158. })]);
  12159. return tempCollection;
  12160. },
  12161. args: ["anInteger"],
  12162. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  12163. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  12164. referencedClasses: []
  12165. }),
  12166. smalltalk.Stream);
  12167. smalltalk.addMethod(
  12168. "_nextPut_",
  12169. smalltalk.method({
  12170. selector: "nextPut:",
  12171. category: 'writing',
  12172. fn: function (anObject){
  12173. var self=this;
  12174. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12175. smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_put_",[smalltalk.send(self,"_position",[]),anObject]);
  12176. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12177. return self},
  12178. args: ["anObject"],
  12179. 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)",
  12180. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  12181. referencedClasses: []
  12182. }),
  12183. smalltalk.Stream);
  12184. smalltalk.addMethod(
  12185. "_nextPutAll_",
  12186. smalltalk.method({
  12187. selector: "nextPutAll:",
  12188. category: 'writing',
  12189. fn: function (aCollection){
  12190. var self=this;
  12191. smalltalk.send(aCollection,"_do_",[(function(each){
  12192. return smalltalk.send(self,"_nextPut_",[each]);
  12193. })]);
  12194. return self},
  12195. args: ["aCollection"],
  12196. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  12197. messageSends: ["do:", "nextPut:"],
  12198. referencedClasses: []
  12199. }),
  12200. smalltalk.Stream);
  12201. smalltalk.addMethod(
  12202. "_peek",
  12203. smalltalk.method({
  12204. selector: "peek",
  12205. category: 'reading',
  12206. fn: function (){
  12207. var self=this;
  12208. var $2,$1;
  12209. $2=smalltalk.send(self,"_atEnd",[]);
  12210. if(! smalltalk.assert($2)){
  12211. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12212. };
  12213. return $1;
  12214. },
  12215. args: [],
  12216. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  12217. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  12218. referencedClasses: []
  12219. }),
  12220. smalltalk.Stream);
  12221. smalltalk.addMethod(
  12222. "_position",
  12223. smalltalk.method({
  12224. selector: "position",
  12225. category: 'accessing',
  12226. fn: function (){
  12227. var self=this;
  12228. var $1;
  12229. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  12230. self["@position"]=(0);
  12231. $1=self["@position"];
  12232. } else {
  12233. $1=self["@position"];
  12234. };
  12235. return $1;
  12236. },
  12237. args: [],
  12238. source: "position\x0a\x09^position ifNil: [position := 0]",
  12239. messageSends: ["ifNil:"],
  12240. referencedClasses: []
  12241. }),
  12242. smalltalk.Stream);
  12243. smalltalk.addMethod(
  12244. "_position_",
  12245. smalltalk.method({
  12246. selector: "position:",
  12247. category: 'accessing',
  12248. fn: function (anInteger){
  12249. var self=this;
  12250. self["@position"]=anInteger;
  12251. return self},
  12252. args: ["anInteger"],
  12253. source: "position: anInteger\x0a\x09position := anInteger",
  12254. messageSends: [],
  12255. referencedClasses: []
  12256. }),
  12257. smalltalk.Stream);
  12258. smalltalk.addMethod(
  12259. "_reset",
  12260. smalltalk.method({
  12261. selector: "reset",
  12262. category: 'actions',
  12263. fn: function (){
  12264. var self=this;
  12265. smalltalk.send(self,"_position_",[(0)]);
  12266. return self},
  12267. args: [],
  12268. source: "reset\x0a\x09self position: 0",
  12269. messageSends: ["position:"],
  12270. referencedClasses: []
  12271. }),
  12272. smalltalk.Stream);
  12273. smalltalk.addMethod(
  12274. "_resetContents",
  12275. smalltalk.method({
  12276. selector: "resetContents",
  12277. category: 'actions',
  12278. fn: function (){
  12279. var self=this;
  12280. smalltalk.send(self,"_reset",[]);
  12281. smalltalk.send(self,"_setStreamSize_",[(0)]);
  12282. return self},
  12283. args: [],
  12284. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12285. messageSends: ["reset", "setStreamSize:"],
  12286. referencedClasses: []
  12287. }),
  12288. smalltalk.Stream);
  12289. smalltalk.addMethod(
  12290. "_setCollection_",
  12291. smalltalk.method({
  12292. selector: "setCollection:",
  12293. category: 'accessing',
  12294. fn: function (aCollection){
  12295. var self=this;
  12296. self["@collection"]=aCollection;
  12297. return self},
  12298. args: ["aCollection"],
  12299. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12300. messageSends: [],
  12301. referencedClasses: []
  12302. }),
  12303. smalltalk.Stream);
  12304. smalltalk.addMethod(
  12305. "_setStreamSize_",
  12306. smalltalk.method({
  12307. selector: "setStreamSize:",
  12308. category: 'accessing',
  12309. fn: function (anInteger){
  12310. var self=this;
  12311. self["@streamSize"]=anInteger;
  12312. return self},
  12313. args: ["anInteger"],
  12314. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12315. messageSends: [],
  12316. referencedClasses: []
  12317. }),
  12318. smalltalk.Stream);
  12319. smalltalk.addMethod(
  12320. "_setToEnd",
  12321. smalltalk.method({
  12322. selector: "setToEnd",
  12323. category: 'positioning',
  12324. fn: function (){
  12325. var self=this;
  12326. smalltalk.send(self,"_position_",[smalltalk.send(self,"_size",[])]);
  12327. return self},
  12328. args: [],
  12329. source: "setToEnd\x0a\x09self position: self size",
  12330. messageSends: ["position:", "size"],
  12331. referencedClasses: []
  12332. }),
  12333. smalltalk.Stream);
  12334. smalltalk.addMethod(
  12335. "_size",
  12336. smalltalk.method({
  12337. selector: "size",
  12338. category: 'accessing',
  12339. fn: function (){
  12340. var self=this;
  12341. var $1;
  12342. $1=smalltalk.send(self,"_streamSize",[]);
  12343. return $1;
  12344. },
  12345. args: [],
  12346. source: "size\x0a\x09^self streamSize",
  12347. messageSends: ["streamSize"],
  12348. referencedClasses: []
  12349. }),
  12350. smalltalk.Stream);
  12351. smalltalk.addMethod(
  12352. "_skip_",
  12353. smalltalk.method({
  12354. selector: "skip:",
  12355. category: 'positioning',
  12356. fn: function (anInteger){
  12357. var self=this;
  12358. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[anInteger]),"_min_max_",[smalltalk.send(self,"_size",[]),(0)])]);
  12359. return self},
  12360. args: ["anInteger"],
  12361. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  12362. messageSends: ["position:", "min:max:", "size", "+", "position"],
  12363. referencedClasses: []
  12364. }),
  12365. smalltalk.Stream);
  12366. smalltalk.addMethod(
  12367. "_streamSize",
  12368. smalltalk.method({
  12369. selector: "streamSize",
  12370. category: 'accessing',
  12371. fn: function (){
  12372. var self=this;
  12373. return self["@streamSize"];
  12374. },
  12375. args: [],
  12376. source: "streamSize\x0a\x09^streamSize",
  12377. messageSends: [],
  12378. referencedClasses: []
  12379. }),
  12380. smalltalk.Stream);
  12381. smalltalk.addMethod(
  12382. "_on_",
  12383. smalltalk.method({
  12384. selector: "on:",
  12385. category: 'instance creation',
  12386. fn: function (aCollection){
  12387. var self=this;
  12388. var $2,$3,$1;
  12389. $2=smalltalk.send(self,"_new",[]);
  12390. smalltalk.send($2,"_setCollection_",[aCollection]);
  12391. smalltalk.send($2,"_setStreamSize_",[smalltalk.send(aCollection,"_size",[])]);
  12392. $3=smalltalk.send($2,"_yourself",[]);
  12393. $1=$3;
  12394. return $1;
  12395. },
  12396. args: ["aCollection"],
  12397. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12398. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  12399. referencedClasses: []
  12400. }),
  12401. smalltalk.Stream.klass);
  12402. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  12403. smalltalk.addMethod(
  12404. "_cr",
  12405. smalltalk.method({
  12406. selector: "cr",
  12407. category: 'writing',
  12408. fn: function (){
  12409. var self=this;
  12410. var $1;
  12411. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  12412. return $1;
  12413. },
  12414. args: [],
  12415. source: "cr\x0a\x09^self nextPutAll: String cr",
  12416. messageSends: ["nextPutAll:", "cr"],
  12417. referencedClasses: ["String"]
  12418. }),
  12419. smalltalk.StringStream);
  12420. smalltalk.addMethod(
  12421. "_crlf",
  12422. smalltalk.method({
  12423. selector: "crlf",
  12424. category: 'writing',
  12425. fn: function (){
  12426. var self=this;
  12427. var $1;
  12428. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_crlf",[])]);
  12429. return $1;
  12430. },
  12431. args: [],
  12432. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  12433. messageSends: ["nextPutAll:", "crlf"],
  12434. referencedClasses: ["String"]
  12435. }),
  12436. smalltalk.StringStream);
  12437. smalltalk.addMethod(
  12438. "_lf",
  12439. smalltalk.method({
  12440. selector: "lf",
  12441. category: 'writing',
  12442. fn: function (){
  12443. var self=this;
  12444. var $1;
  12445. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_lf",[])]);
  12446. return $1;
  12447. },
  12448. args: [],
  12449. source: "lf\x0a\x09^self nextPutAll: String lf",
  12450. messageSends: ["nextPutAll:", "lf"],
  12451. referencedClasses: ["String"]
  12452. }),
  12453. smalltalk.StringStream);
  12454. smalltalk.addMethod(
  12455. "_next_",
  12456. smalltalk.method({
  12457. selector: "next:",
  12458. category: 'reading',
  12459. fn: function (anInteger){
  12460. var self=this;
  12461. var $1;
  12462. var tempCollection;
  12463. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  12464. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  12465. $1=smalltalk.send(self,"_atEnd",[]);
  12466. if(! smalltalk.assert($1)){
  12467. tempCollection=smalltalk.send(tempCollection,"__comma",[smalltalk.send(self,"_next",[])]);
  12468. return tempCollection;
  12469. };
  12470. })]);
  12471. return tempCollection;
  12472. },
  12473. args: ["anInteger"],
  12474. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  12475. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  12476. referencedClasses: []
  12477. }),
  12478. smalltalk.StringStream);
  12479. smalltalk.addMethod(
  12480. "_nextPut_",
  12481. smalltalk.method({
  12482. selector: "nextPut:",
  12483. category: 'writing',
  12484. fn: function (aString){
  12485. var self=this;
  12486. smalltalk.send(self,"_nextPutAll_",[aString]);
  12487. return self},
  12488. args: ["aString"],
  12489. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  12490. messageSends: ["nextPutAll:"],
  12491. referencedClasses: []
  12492. }),
  12493. smalltalk.StringStream);
  12494. smalltalk.addMethod(
  12495. "_nextPutAll_",
  12496. smalltalk.method({
  12497. selector: "nextPutAll:",
  12498. category: 'writing',
  12499. fn: function (aString){
  12500. var self=this;
  12501. smalltalk.send(self,"_setCollection_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_position",[])]),"__comma",[aString]),"__comma",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)]),"__plus",[smalltalk.send(aString,"_size",[])]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[])])])]);
  12502. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[smalltalk.send(aString,"_size",[])])]);
  12503. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12504. return self},
  12505. args: ["aString"],
  12506. source: "nextPutAll: aString\x0a\x09self setCollection: \x0a\x09 (self collection copyFrom: 1 to: self position),\x0a\x09 aString,\x0a\x09 (self collection copyFrom: (self position + 1 + aString size) to: self collection size).\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  12507. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  12508. referencedClasses: []
  12509. }),
  12510. smalltalk.StringStream);
  12511. smalltalk.addMethod(
  12512. "_space",
  12513. smalltalk.method({
  12514. selector: "space",
  12515. category: 'writing',
  12516. fn: function (){
  12517. var self=this;
  12518. smalltalk.send(self,"_nextPut_",[" "]);
  12519. return self},
  12520. args: [],
  12521. source: "space\x0a\x09self nextPut: ' '",
  12522. messageSends: ["nextPut:"],
  12523. referencedClasses: []
  12524. }),
  12525. smalltalk.StringStream);
  12526. smalltalk.addPackage('Kernel-Exceptions', {});
  12527. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  12528. smalltalk.addMethod(
  12529. "_context",
  12530. smalltalk.method({
  12531. selector: "context",
  12532. category: 'accessing',
  12533. fn: function (){
  12534. var self=this;
  12535. return self.context;
  12536. ;
  12537. return self},
  12538. args: [],
  12539. source: "context\x0a\x09<return self.context>",
  12540. messageSends: [],
  12541. referencedClasses: []
  12542. }),
  12543. smalltalk.Error);
  12544. smalltalk.addMethod(
  12545. "_initialize",
  12546. smalltalk.method({
  12547. selector: "initialize",
  12548. category: 'initialization',
  12549. fn: function (){
  12550. var self=this;
  12551. smalltalk.send(self,"_messageText_",[smalltalk.send("Errorclass: ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])])]);
  12552. return self},
  12553. args: [],
  12554. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  12555. messageSends: ["messageText:", ",", "name", "class"],
  12556. referencedClasses: []
  12557. }),
  12558. smalltalk.Error);
  12559. smalltalk.addMethod(
  12560. "_isSmalltalkError",
  12561. smalltalk.method({
  12562. selector: "isSmalltalkError",
  12563. category: 'testing',
  12564. fn: function (){
  12565. var self=this;
  12566. return self.smalltalkError === true;
  12567. ;
  12568. return self},
  12569. args: [],
  12570. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  12571. messageSends: [],
  12572. referencedClasses: []
  12573. }),
  12574. smalltalk.Error);
  12575. smalltalk.addMethod(
  12576. "_jsStack",
  12577. smalltalk.method({
  12578. selector: "jsStack",
  12579. category: 'accessing',
  12580. fn: function (){
  12581. var self=this;
  12582. return self.stack;
  12583. ;
  12584. return self},
  12585. args: [],
  12586. source: "jsStack\x0a\x09<return self.stack>",
  12587. messageSends: [],
  12588. referencedClasses: []
  12589. }),
  12590. smalltalk.Error);
  12591. smalltalk.addMethod(
  12592. "_messageText",
  12593. smalltalk.method({
  12594. selector: "messageText",
  12595. category: 'accessing',
  12596. fn: function (){
  12597. var self=this;
  12598. return self["@messageText"];
  12599. },
  12600. args: [],
  12601. source: "messageText\x0a\x09^messageText",
  12602. messageSends: [],
  12603. referencedClasses: []
  12604. }),
  12605. smalltalk.Error);
  12606. smalltalk.addMethod(
  12607. "_messageText_",
  12608. smalltalk.method({
  12609. selector: "messageText:",
  12610. category: 'accessing',
  12611. fn: function (aString){
  12612. var self=this;
  12613. self["@messageText"]=aString;
  12614. return self},
  12615. args: ["aString"],
  12616. source: "messageText: aString\x0a\x09messageText := aString",
  12617. messageSends: [],
  12618. referencedClasses: []
  12619. }),
  12620. smalltalk.Error);
  12621. smalltalk.addMethod(
  12622. "_signal",
  12623. smalltalk.method({
  12624. selector: "signal",
  12625. category: 'signaling',
  12626. fn: function (){
  12627. var self=this;
  12628. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  12629. ;
  12630. return self},
  12631. args: [],
  12632. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  12633. messageSends: [],
  12634. referencedClasses: []
  12635. }),
  12636. smalltalk.Error);
  12637. smalltalk.addMethod(
  12638. "_signal_",
  12639. smalltalk.method({
  12640. selector: "signal:",
  12641. category: 'signaling',
  12642. fn: function (aString){
  12643. var self=this;
  12644. smalltalk.send(self,"_messageText_",[aString]);
  12645. smalltalk.send(self,"_signal",[]);
  12646. return self},
  12647. args: ["aString"],
  12648. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  12649. messageSends: ["messageText:", "signal"],
  12650. referencedClasses: []
  12651. }),
  12652. smalltalk.Error);
  12653. smalltalk.addMethod(
  12654. "_signal",
  12655. smalltalk.method({
  12656. selector: "signal",
  12657. category: 'instance creation',
  12658. fn: function (){
  12659. var self=this;
  12660. var $1;
  12661. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
  12662. return $1;
  12663. },
  12664. args: [],
  12665. source: "signal\x0a\x09^self new signal",
  12666. messageSends: ["signal", "new"],
  12667. referencedClasses: []
  12668. }),
  12669. smalltalk.Error.klass);
  12670. smalltalk.addMethod(
  12671. "_signal_",
  12672. smalltalk.method({
  12673. selector: "signal:",
  12674. category: 'instance creation',
  12675. fn: function (aString){
  12676. var self=this;
  12677. var $1;
  12678. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
  12679. return $1;
  12680. },
  12681. args: ["aString"],
  12682. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  12683. messageSends: ["signal:", "new"],
  12684. referencedClasses: []
  12685. }),
  12686. smalltalk.Error.klass);
  12687. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  12688. smalltalk.addMethod(
  12689. "_message",
  12690. smalltalk.method({
  12691. selector: "message",
  12692. category: 'accessing',
  12693. fn: function (){
  12694. var self=this;
  12695. return self["@message"];
  12696. },
  12697. args: [],
  12698. source: "message\x0a\x09^message",
  12699. messageSends: [],
  12700. referencedClasses: []
  12701. }),
  12702. smalltalk.MessageNotUnderstood);
  12703. smalltalk.addMethod(
  12704. "_message_",
  12705. smalltalk.method({
  12706. selector: "message:",
  12707. category: 'accessing',
  12708. fn: function (aMessage){
  12709. var self=this;
  12710. self["@message"]=aMessage;
  12711. return self},
  12712. args: ["aMessage"],
  12713. source: "message: aMessage\x0a\x09message := aMessage",
  12714. messageSends: [],
  12715. referencedClasses: []
  12716. }),
  12717. smalltalk.MessageNotUnderstood);
  12718. smalltalk.addMethod(
  12719. "_messageText",
  12720. smalltalk.method({
  12721. selector: "messageText",
  12722. category: 'accessing',
  12723. fn: function (){
  12724. var self=this;
  12725. var $1;
  12726. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
  12727. return $1;
  12728. },
  12729. args: [],
  12730. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  12731. messageSends: [",", "selector", "message", "asString", "receiver"],
  12732. referencedClasses: []
  12733. }),
  12734. smalltalk.MessageNotUnderstood);
  12735. smalltalk.addMethod(
  12736. "_receiver",
  12737. smalltalk.method({
  12738. selector: "receiver",
  12739. category: 'accessing',
  12740. fn: function (){
  12741. var self=this;
  12742. return self["@receiver"];
  12743. },
  12744. args: [],
  12745. source: "receiver\x0a\x09^receiver",
  12746. messageSends: [],
  12747. referencedClasses: []
  12748. }),
  12749. smalltalk.MessageNotUnderstood);
  12750. smalltalk.addMethod(
  12751. "_receiver_",
  12752. smalltalk.method({
  12753. selector: "receiver:",
  12754. category: 'accessing',
  12755. fn: function (anObject){
  12756. var self=this;
  12757. self["@receiver"]=anObject;
  12758. return self},
  12759. args: ["anObject"],
  12760. source: "receiver: anObject\x0a\x09receiver := anObject",
  12761. messageSends: [],
  12762. referencedClasses: []
  12763. }),
  12764. smalltalk.MessageNotUnderstood);
  12765. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  12766. smalltalk.addMethod(
  12767. "_object",
  12768. smalltalk.method({
  12769. selector: "object",
  12770. category: 'accessing',
  12771. fn: function (){
  12772. var self=this;
  12773. return self["@object"];
  12774. },
  12775. args: [],
  12776. source: "object\x0a\x09^ object",
  12777. messageSends: [],
  12778. referencedClasses: []
  12779. }),
  12780. smalltalk.NonBooleanReceiver);
  12781. smalltalk.addMethod(
  12782. "_object_",
  12783. smalltalk.method({
  12784. selector: "object:",
  12785. category: 'accessing',
  12786. fn: function (anObject){
  12787. var self=this;
  12788. self["@object"]=anObject;
  12789. return self},
  12790. args: ["anObject"],
  12791. source: "object: anObject\x0a\x09object := anObject",
  12792. messageSends: [],
  12793. referencedClasses: []
  12794. }),
  12795. smalltalk.NonBooleanReceiver);
  12796. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  12797. smalltalk.addMethod(
  12798. "_handleError_",
  12799. smalltalk.method({
  12800. selector: "handleError:",
  12801. category: 'error handling',
  12802. fn: function (anError){
  12803. var self=this;
  12804. var $1;
  12805. $1=smalltalk.send(anError,"_context",[]);
  12806. if(($receiver = $1) == nil || $receiver == undefined){
  12807. $1;
  12808. } else {
  12809. smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
  12810. };
  12811. smalltalk.send(self,"_logError_",[anError]);
  12812. return self},
  12813. args: ["anError"],
  12814. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  12815. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  12816. referencedClasses: []
  12817. }),
  12818. smalltalk.ErrorHandler);
  12819. smalltalk.addMethod(
  12820. "_log_",
  12821. smalltalk.method({
  12822. selector: "log:",
  12823. category: 'private',
  12824. fn: function (aString){
  12825. var self=this;
  12826. smalltalk.send(console,"_log_",[aString]);
  12827. return self},
  12828. args: ["aString"],
  12829. source: "log: aString\x0a\x09console log: aString",
  12830. messageSends: ["log:"],
  12831. referencedClasses: []
  12832. }),
  12833. smalltalk.ErrorHandler);
  12834. smalltalk.addMethod(
  12835. "_logContext_",
  12836. smalltalk.method({
  12837. selector: "logContext:",
  12838. category: 'private',
  12839. fn: function (aContext){
  12840. var self=this;
  12841. var $1;
  12842. $1=smalltalk.send(aContext,"_home",[]);
  12843. if(($receiver = $1) == nil || $receiver == undefined){
  12844. $1;
  12845. } else {
  12846. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12847. };
  12848. smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
  12849. return self},
  12850. args: ["aContext"],
  12851. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
  12852. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "selector", "asString", "receiver"],
  12853. referencedClasses: []
  12854. }),
  12855. smalltalk.ErrorHandler);
  12856. smalltalk.addMethod(
  12857. "_logError_",
  12858. smalltalk.method({
  12859. selector: "logError:",
  12860. category: 'private',
  12861. fn: function (anError){
  12862. var self=this;
  12863. smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
  12864. return self},
  12865. args: ["anError"],
  12866. source: "logError: anError\x0a\x09self log: anError messageText",
  12867. messageSends: ["log:", "messageText"],
  12868. referencedClasses: []
  12869. }),
  12870. smalltalk.ErrorHandler);
  12871. smalltalk.addMethod(
  12872. "_logErrorContext_",
  12873. smalltalk.method({
  12874. selector: "logErrorContext:",
  12875. category: 'private',
  12876. fn: function (aContext){
  12877. var self=this;
  12878. var $1;
  12879. if(($receiver = aContext) == nil || $receiver == undefined){
  12880. aContext;
  12881. } else {
  12882. $1=smalltalk.send(aContext,"_home",[]);
  12883. if(($receiver = $1) == nil || $receiver == undefined){
  12884. $1;
  12885. } else {
  12886. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12887. };
  12888. };
  12889. return self},
  12890. args: ["aContext"],
  12891. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  12892. messageSends: ["ifNotNil:", "logContext:", "home"],
  12893. referencedClasses: []
  12894. }),
  12895. smalltalk.ErrorHandler);
  12896. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  12897. smalltalk.addMethod(
  12898. "_current",
  12899. smalltalk.method({
  12900. selector: "current",
  12901. category: 'accessing',
  12902. fn: function (){
  12903. var self=this;
  12904. var $1;
  12905. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  12906. self["@current"]=smalltalk.send(self,"_new",[]);
  12907. $1=self["@current"];
  12908. } else {
  12909. $1=self["@current"];
  12910. };
  12911. return $1;
  12912. },
  12913. args: [],
  12914. source: "current\x0a\x09^current ifNil: [current := self new]",
  12915. messageSends: ["ifNil:", "new"],
  12916. referencedClasses: []
  12917. }),
  12918. smalltalk.ErrorHandler.klass);
  12919. smalltalk.addMethod(
  12920. "_initialize",
  12921. smalltalk.method({
  12922. selector: "initialize",
  12923. category: 'initialization',
  12924. fn: function (){
  12925. var self=this;
  12926. smalltalk.send(self,"_register",[]);
  12927. return self},
  12928. args: [],
  12929. source: "initialize\x0a\x09self register",
  12930. messageSends: ["register"],
  12931. referencedClasses: []
  12932. }),
  12933. smalltalk.ErrorHandler.klass);
  12934. smalltalk.addMethod(
  12935. "_register",
  12936. smalltalk.method({
  12937. selector: "register",
  12938. category: 'initialization',
  12939. fn: function (){
  12940. var self=this;
  12941. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
  12942. return self},
  12943. args: [],
  12944. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  12945. messageSends: ["setCurrent:", "new"],
  12946. referencedClasses: ["ErrorHandler"]
  12947. }),
  12948. smalltalk.ErrorHandler.klass);
  12949. smalltalk.addMethod(
  12950. "_setCurrent_",
  12951. smalltalk.method({
  12952. selector: "setCurrent:",
  12953. category: 'accessing',
  12954. fn: function (anHandler){
  12955. var self=this;
  12956. self["@current"]=anHandler;
  12957. return self},
  12958. args: ["anHandler"],
  12959. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  12960. messageSends: [],
  12961. referencedClasses: []
  12962. }),
  12963. smalltalk.ErrorHandler.klass);
  12964. smalltalk.addPackage('Kernel-Transcript', {});
  12965. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  12966. smalltalk.addMethod(
  12967. "_clear",
  12968. smalltalk.method({
  12969. selector: "clear",
  12970. category: 'printing',
  12971. fn: function (){
  12972. var self=this;
  12973. return self},
  12974. args: [],
  12975. source: "clear\x0a\x09\x22no op\x22",
  12976. messageSends: [],
  12977. referencedClasses: []
  12978. }),
  12979. smalltalk.ConsoleTranscript);
  12980. smalltalk.addMethod(
  12981. "_cr",
  12982. smalltalk.method({
  12983. selector: "cr",
  12984. category: 'printing',
  12985. fn: function (){
  12986. var self=this;
  12987. return self},
  12988. args: [],
  12989. source: "cr\x0a\x09\x22no op\x22",
  12990. messageSends: [],
  12991. referencedClasses: []
  12992. }),
  12993. smalltalk.ConsoleTranscript);
  12994. smalltalk.addMethod(
  12995. "_open",
  12996. smalltalk.method({
  12997. selector: "open",
  12998. category: 'actions',
  12999. fn: function (){
  13000. var self=this;
  13001. return self},
  13002. args: [],
  13003. source: "open",
  13004. messageSends: [],
  13005. referencedClasses: []
  13006. }),
  13007. smalltalk.ConsoleTranscript);
  13008. smalltalk.addMethod(
  13009. "_show_",
  13010. smalltalk.method({
  13011. selector: "show:",
  13012. category: 'printing',
  13013. fn: function (anObject){
  13014. var self=this;
  13015. var string;
  13016. string=smalltalk.send(anObject,"_asString",[]);
  13017. console.log(String(string));
  13018. ;
  13019. return self},
  13020. args: ["anObject"],
  13021. source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
  13022. messageSends: ["asString"],
  13023. referencedClasses: []
  13024. }),
  13025. smalltalk.ConsoleTranscript);
  13026. smalltalk.addMethod(
  13027. "_initialize",
  13028. smalltalk.method({
  13029. selector: "initialize",
  13030. category: 'initialization',
  13031. fn: function (){
  13032. var self=this;
  13033. smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
  13034. return self},
  13035. args: [],
  13036. source: "initialize\x0a\x09Transcript register: self new",
  13037. messageSends: ["register:", "new"],
  13038. referencedClasses: ["Transcript"]
  13039. }),
  13040. smalltalk.ConsoleTranscript.klass);
  13041. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  13042. smalltalk.Transcript.klass.iVarNames = ['current'];
  13043. smalltalk.addMethod(
  13044. "_clear",
  13045. smalltalk.method({
  13046. selector: "clear",
  13047. category: 'printing',
  13048. fn: function (){
  13049. var self=this;
  13050. smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
  13051. return self},
  13052. args: [],
  13053. source: "clear\x0a self current clear",
  13054. messageSends: ["clear", "current"],
  13055. referencedClasses: []
  13056. }),
  13057. smalltalk.Transcript.klass);
  13058. smalltalk.addMethod(
  13059. "_cr",
  13060. smalltalk.method({
  13061. selector: "cr",
  13062. category: 'printing',
  13063. fn: function (){
  13064. var self=this;
  13065. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  13066. return self},
  13067. args: [],
  13068. source: "cr\x0a self current show: String cr",
  13069. messageSends: ["show:", "cr", "current"],
  13070. referencedClasses: ["String"]
  13071. }),
  13072. smalltalk.Transcript.klass);
  13073. smalltalk.addMethod(
  13074. "_current",
  13075. smalltalk.method({
  13076. selector: "current",
  13077. category: 'instance creation',
  13078. fn: function (){
  13079. var self=this;
  13080. return self["@current"];
  13081. },
  13082. args: [],
  13083. source: "current\x0a ^current",
  13084. messageSends: [],
  13085. referencedClasses: []
  13086. }),
  13087. smalltalk.Transcript.klass);
  13088. smalltalk.addMethod(
  13089. "_new",
  13090. smalltalk.method({
  13091. selector: "new",
  13092. category: 'instance creation',
  13093. fn: function (){
  13094. var self=this;
  13095. smalltalk.send(self,"_shouldNotImplement",[]);
  13096. return self},
  13097. args: [],
  13098. source: "new\x0a self shouldNotImplement",
  13099. messageSends: ["shouldNotImplement"],
  13100. referencedClasses: []
  13101. }),
  13102. smalltalk.Transcript.klass);
  13103. smalltalk.addMethod(
  13104. "_open",
  13105. smalltalk.method({
  13106. selector: "open",
  13107. category: 'instance creation',
  13108. fn: function (){
  13109. var self=this;
  13110. smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
  13111. return self},
  13112. args: [],
  13113. source: "open\x0a self current open",
  13114. messageSends: ["open", "current"],
  13115. referencedClasses: []
  13116. }),
  13117. smalltalk.Transcript.klass);
  13118. smalltalk.addMethod(
  13119. "_register_",
  13120. smalltalk.method({
  13121. selector: "register:",
  13122. category: 'instance creation',
  13123. fn: function (aTranscript){
  13124. var self=this;
  13125. self["@current"]=aTranscript;
  13126. return self},
  13127. args: ["aTranscript"],
  13128. source: "register: aTranscript\x0a\x09current := aTranscript",
  13129. messageSends: [],
  13130. referencedClasses: []
  13131. }),
  13132. smalltalk.Transcript.klass);
  13133. smalltalk.addMethod(
  13134. "_show_",
  13135. smalltalk.method({
  13136. selector: "show:",
  13137. category: 'printing',
  13138. fn: function (anObject){
  13139. var self=this;
  13140. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
  13141. return self},
  13142. args: ["anObject"],
  13143. source: "show: anObject\x0a self current show: anObject",
  13144. messageSends: ["show:", "current"],
  13145. referencedClasses: []
  13146. }),
  13147. smalltalk.Transcript.klass);
  13148. smalltalk.addPackage('Kernel-Announcements', {});
  13149. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  13150. smalltalk.addMethod(
  13151. "_announcementClass",
  13152. smalltalk.method({
  13153. selector: "announcementClass",
  13154. category: 'accessing',
  13155. fn: function (){
  13156. var self=this;
  13157. return self["@announcementClass"];
  13158. },
  13159. args: [],
  13160. source: "announcementClass\x0a\x09^announcementClass",
  13161. messageSends: [],
  13162. referencedClasses: []
  13163. }),
  13164. smalltalk.AnnouncementSubscription);
  13165. smalltalk.addMethod(
  13166. "_announcementClass_",
  13167. smalltalk.method({
  13168. selector: "announcementClass:",
  13169. category: 'accessing',
  13170. fn: function (aClass){
  13171. var self=this;
  13172. self["@announcementClass"]=aClass;
  13173. return self},
  13174. args: ["aClass"],
  13175. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  13176. messageSends: [],
  13177. referencedClasses: []
  13178. }),
  13179. smalltalk.AnnouncementSubscription);
  13180. smalltalk.addMethod(
  13181. "_block",
  13182. smalltalk.method({
  13183. selector: "block",
  13184. category: 'accessing',
  13185. fn: function (){
  13186. var self=this;
  13187. return self["@block"];
  13188. },
  13189. args: [],
  13190. source: "block\x0a\x09^block",
  13191. messageSends: [],
  13192. referencedClasses: []
  13193. }),
  13194. smalltalk.AnnouncementSubscription);
  13195. smalltalk.addMethod(
  13196. "_block_",
  13197. smalltalk.method({
  13198. selector: "block:",
  13199. category: 'accessing',
  13200. fn: function (aBlock){
  13201. var self=this;
  13202. self["@block"]=aBlock;
  13203. return self},
  13204. args: ["aBlock"],
  13205. source: "block: aBlock\x0a\x09block := aBlock",
  13206. messageSends: [],
  13207. referencedClasses: []
  13208. }),
  13209. smalltalk.AnnouncementSubscription);
  13210. smalltalk.addMethod(
  13211. "_deliver_",
  13212. smalltalk.method({
  13213. selector: "deliver:",
  13214. category: 'announcing',
  13215. fn: function (anAnnouncement){
  13216. var self=this;
  13217. var $1;
  13218. $1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
  13219. if(smalltalk.assert($1)){
  13220. smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
  13221. };
  13222. return self},
  13223. args: ["anAnnouncement"],
  13224. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
  13225. messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
  13226. referencedClasses: []
  13227. }),
  13228. smalltalk.AnnouncementSubscription);
  13229. smalltalk.addMethod(
  13230. "_handlesAnnouncement_",
  13231. smalltalk.method({
  13232. selector: "handlesAnnouncement:",
  13233. category: 'announcing',
  13234. fn: function (anAnnouncement){
  13235. var self=this;
  13236. var $1;
  13237. $1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
  13238. return $1;
  13239. },
  13240. args: ["anAnnouncement"],
  13241. source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
  13242. messageSends: ["isKindOf:", "announcementClass"],
  13243. referencedClasses: []
  13244. }),
  13245. smalltalk.AnnouncementSubscription);
  13246. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  13247. smalltalk.addMethod(
  13248. "_announce_",
  13249. smalltalk.method({
  13250. selector: "announce:",
  13251. category: 'announcing',
  13252. fn: function (anAnnouncement){
  13253. var self=this;
  13254. smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
  13255. return smalltalk.send(each,"_deliver_",[anAnnouncement]);
  13256. })]);
  13257. return self},
  13258. args: ["anAnnouncement"],
  13259. source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
  13260. messageSends: ["do:", "deliver:"],
  13261. referencedClasses: []
  13262. }),
  13263. smalltalk.Announcer);
  13264. smalltalk.addMethod(
  13265. "_initialize",
  13266. smalltalk.method({
  13267. selector: "initialize",
  13268. category: 'initialization',
  13269. fn: function (){
  13270. var self=this;
  13271. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  13272. self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  13273. return self},
  13274. args: [],
  13275. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
  13276. messageSends: ["initialize", "new"],
  13277. referencedClasses: ["Array"]
  13278. }),
  13279. smalltalk.Announcer);
  13280. smalltalk.addMethod(
  13281. "_on_do_",
  13282. smalltalk.method({
  13283. selector: "on:do:",
  13284. category: 'subscribing',
  13285. fn: function (aClass,aBlock){
  13286. var self=this;
  13287. var $1,$2;
  13288. $1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
  13289. smalltalk.send($1,"_block_",[aBlock]);
  13290. smalltalk.send($1,"_announcementClass_",[aClass]);
  13291. $2=smalltalk.send($1,"_yourself",[]);
  13292. smalltalk.send(self["@subscriptions"],"_add_",[$2]);
  13293. return self},
  13294. args: ["aClass", "aBlock"],
  13295. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  13296. messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
  13297. referencedClasses: ["AnnouncementSubscription"]
  13298. }),
  13299. smalltalk.Announcer);
  13300. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  13301. smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
  13302. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  13303. smalltalk.addMethod(
  13304. "_current",
  13305. smalltalk.method({
  13306. selector: "current",
  13307. category: 'accessing',
  13308. fn: function (){
  13309. var self=this;
  13310. var $1;
  13311. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  13312. self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
  13313. $1=self["@current"];
  13314. } else {
  13315. $1=self["@current"];
  13316. };
  13317. return $1;
  13318. },
  13319. args: [],
  13320. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  13321. messageSends: ["ifNil:", "new"],
  13322. referencedClasses: []
  13323. }),
  13324. smalltalk.SystemAnnouncer.klass);
  13325. smalltalk.addMethod(
  13326. "_new",
  13327. smalltalk.method({
  13328. selector: "new",
  13329. category: 'instance creation',
  13330. fn: function (){
  13331. var self=this;
  13332. smalltalk.send(self,"_shouldNotImplement",[]);
  13333. return self},
  13334. args: [],
  13335. source: "new\x0a\x09self shouldNotImplement",
  13336. messageSends: ["shouldNotImplement"],
  13337. referencedClasses: []
  13338. }),
  13339. smalltalk.SystemAnnouncer.klass);
  13340. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  13341. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
  13342. smalltalk.addMethod(
  13343. "_theClass",
  13344. smalltalk.method({
  13345. selector: "theClass",
  13346. category: 'accessing',
  13347. fn: function (){
  13348. var self=this;
  13349. return self["@theClass"];
  13350. },
  13351. args: [],
  13352. source: "theClass\x0a\x09^ theClass",
  13353. messageSends: [],
  13354. referencedClasses: []
  13355. }),
  13356. smalltalk.SystemAnnouncement);
  13357. smalltalk.addMethod(
  13358. "_theClass_",
  13359. smalltalk.method({
  13360. selector: "theClass:",
  13361. category: 'accessing',
  13362. fn: function (aClass){
  13363. var self=this;
  13364. self["@theClass"]=aClass;
  13365. return self},
  13366. args: ["aClass"],
  13367. source: "theClass: aClass\x0a\x09theClass := aClass",
  13368. messageSends: [],
  13369. referencedClasses: []
  13370. }),
  13371. smalltalk.SystemAnnouncement);
  13372. smalltalk.addClass('ClassAdded', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13373. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
  13374. smalltalk.addClass('ClassCommentChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13375. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
  13376. smalltalk.addClass('ClassDefinitionChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13377. smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
  13378. smalltalk.addClass('ClassRemoved', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13379. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
  13380. smalltalk.addClass('ClassRenamed', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13381. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
  13382. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  13383. smalltalk.addMethod(
  13384. "_method",
  13385. smalltalk.method({
  13386. selector: "method",
  13387. category: 'accessing',
  13388. fn: function (){
  13389. var self=this;
  13390. return self["@method"];
  13391. },
  13392. args: [],
  13393. source: "method\x0a\x09^ method",
  13394. messageSends: [],
  13395. referencedClasses: []
  13396. }),
  13397. smalltalk.MethodAnnouncement);
  13398. smalltalk.addMethod(
  13399. "_method_",
  13400. smalltalk.method({
  13401. selector: "method:",
  13402. category: 'accessing',
  13403. fn: function (aCompiledMethod){
  13404. var self=this;
  13405. self["@method"]=aCompiledMethod;
  13406. return self},
  13407. args: ["aCompiledMethod"],
  13408. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  13409. messageSends: [],
  13410. referencedClasses: []
  13411. }),
  13412. smalltalk.MethodAnnouncement);
  13413. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13414. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13415. smalltalk.addPackage('Compiler-Core', {});
  13416. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  13417. 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`"
  13418. smalltalk.addMethod(
  13419. "_codeGeneratorClass",
  13420. smalltalk.method({
  13421. selector: "codeGeneratorClass",
  13422. category: 'accessing',
  13423. fn: function (){
  13424. var self=this;
  13425. var $1;
  13426. if(($receiver = self["@codeGeneratorClass"]) == nil || $receiver == undefined){
  13427. $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
  13428. } else {
  13429. $1=self["@codeGeneratorClass"];
  13430. };
  13431. return $1;
  13432. },
  13433. args: [],
  13434. source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
  13435. messageSends: ["ifNil:"],
  13436. referencedClasses: ["InliningCodeGenerator"]
  13437. }),
  13438. smalltalk.Compiler);
  13439. smalltalk.addMethod(
  13440. "_codeGeneratorClass_",
  13441. smalltalk.method({
  13442. selector: "codeGeneratorClass:",
  13443. category: 'accessing',
  13444. fn: function (aClass){
  13445. var self=this;
  13446. self["@codeGeneratorClass"]=aClass;
  13447. return self},
  13448. args: ["aClass"],
  13449. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  13450. messageSends: [],
  13451. referencedClasses: []
  13452. }),
  13453. smalltalk.Compiler);
  13454. smalltalk.addMethod(
  13455. "_compile_",
  13456. smalltalk.method({
  13457. selector: "compile:",
  13458. category: 'compiling',
  13459. fn: function (aString){
  13460. var self=this;
  13461. var $1;
  13462. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[aString])]);
  13463. return $1;
  13464. },
  13465. args: ["aString"],
  13466. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  13467. messageSends: ["compileNode:", "parse:"],
  13468. referencedClasses: []
  13469. }),
  13470. smalltalk.Compiler);
  13471. smalltalk.addMethod(
  13472. "_compile_forClass_",
  13473. smalltalk.method({
  13474. selector: "compile:forClass:",
  13475. category: 'compiling',
  13476. fn: function (aString,aClass){
  13477. var self=this;
  13478. var $1;
  13479. smalltalk.send(self,"_currentClass_",[aClass]);
  13480. smalltalk.send(self,"_source_",[aString]);
  13481. $1=smalltalk.send(self,"_compile_",[aString]);
  13482. return $1;
  13483. },
  13484. args: ["aString", "aClass"],
  13485. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  13486. messageSends: ["currentClass:", "source:", "compile:"],
  13487. referencedClasses: []
  13488. }),
  13489. smalltalk.Compiler);
  13490. smalltalk.addMethod(
  13491. "_compileExpression_",
  13492. smalltalk.method({
  13493. selector: "compileExpression:",
  13494. category: 'compiling',
  13495. fn: function (aString){
  13496. var self=this;
  13497. var $1;
  13498. smalltalk.send(self,"_currentClass_",[(smalltalk.DoIt || DoIt)]);
  13499. smalltalk.send(self,"_source_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  13500. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[smalltalk.send(self,"_source",[])])]);
  13501. return $1;
  13502. },
  13503. args: ["aString"],
  13504. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  13505. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  13506. referencedClasses: ["DoIt"]
  13507. }),
  13508. smalltalk.Compiler);
  13509. smalltalk.addMethod(
  13510. "_compileNode_",
  13511. smalltalk.method({
  13512. selector: "compileNode:",
  13513. category: 'compiling',
  13514. fn: function (aNode){
  13515. var self=this;
  13516. var $1;
  13517. var generator;
  13518. var result;
  13519. generator=smalltalk.send(smalltalk.send(self,"_codeGeneratorClass",[]),"_new",[]);
  13520. smalltalk.send(generator,"_source_",[smalltalk.send(self,"_source",[])]);
  13521. $1=smalltalk.send(generator,"_currentClass_",[smalltalk.send(self,"_currentClass",[])]);
  13522. result=smalltalk.send(generator,"_compileNode_",[aNode]);
  13523. smalltalk.send(self,"_unknownVariables_",[[]]);
  13524. return result;
  13525. },
  13526. args: ["aNode"],
  13527. 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",
  13528. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  13529. referencedClasses: []
  13530. }),
  13531. smalltalk.Compiler);
  13532. smalltalk.addMethod(
  13533. "_currentClass",
  13534. smalltalk.method({
  13535. selector: "currentClass",
  13536. category: 'accessing',
  13537. fn: function (){
  13538. var self=this;
  13539. return self["@currentClass"];
  13540. },
  13541. args: [],
  13542. source: "currentClass\x0a\x09^currentClass",
  13543. messageSends: [],
  13544. referencedClasses: []
  13545. }),
  13546. smalltalk.Compiler);
  13547. smalltalk.addMethod(
  13548. "_currentClass_",
  13549. smalltalk.method({
  13550. selector: "currentClass:",
  13551. category: 'accessing',
  13552. fn: function (aClass){
  13553. var self=this;
  13554. self["@currentClass"]=aClass;
  13555. return self},
  13556. args: ["aClass"],
  13557. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  13558. messageSends: [],
  13559. referencedClasses: []
  13560. }),
  13561. smalltalk.Compiler);
  13562. smalltalk.addMethod(
  13563. "_eval_",
  13564. smalltalk.method({
  13565. selector: "eval:",
  13566. category: 'compiling',
  13567. fn: function (aString){
  13568. var self=this;
  13569. return eval(aString);
  13570. ;
  13571. return self},
  13572. args: ["aString"],
  13573. source: "eval: aString\x0a\x09<return eval(aString)>",
  13574. messageSends: [],
  13575. referencedClasses: []
  13576. }),
  13577. smalltalk.Compiler);
  13578. smalltalk.addMethod(
  13579. "_evaluateExpression_",
  13580. smalltalk.method({
  13581. selector: "evaluateExpression:",
  13582. category: 'compiling',
  13583. fn: function (aString){
  13584. var self=this;
  13585. var result;
  13586. smalltalk.send((smalltalk.DoIt || DoIt),"_addCompiledMethod_",[smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compileExpression_",[aString])])]);
  13587. result=smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]),"_doIt",[]);
  13588. smalltalk.send((smalltalk.DoIt || DoIt),"_removeCompiledMethod_",[smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_methodDictionary",[]),"_at_",["doIt"])]);
  13589. return result;
  13590. },
  13591. args: ["aString"],
  13592. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09| result |\x0a\x09DoIt addCompiledMethod: (self eval: (self compileExpression: aString)).\x0a\x09result := DoIt new doIt.\x0a\x09DoIt removeCompiledMethod: (DoIt methodDictionary at: 'doIt').\x0a\x09^result",
  13593. messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
  13594. referencedClasses: ["DoIt"]
  13595. }),
  13596. smalltalk.Compiler);
  13597. smalltalk.addMethod(
  13598. "_install_forClass_category_",
  13599. smalltalk.method({
  13600. selector: "install:forClass:category:",
  13601. category: 'compiling',
  13602. fn: function (aString,aBehavior,anotherString){
  13603. var self=this;
  13604. var compiled;
  13605. compiled=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compile_forClass_",[aString,aBehavior])]);
  13606. smalltalk.send(compiled,"_category_",[anotherString]);
  13607. smalltalk.send(aBehavior,"_addCompiledMethod_",[compiled]);
  13608. smalltalk.send(self,"_setupClass_",[aBehavior]);
  13609. return compiled;
  13610. },
  13611. args: ["aString", "aBehavior", "anotherString"],
  13612. source: "install: aString forClass: aBehavior category: anotherString\x0a\x09| compiled |\x0a\x09compiled := self eval: (self compile: aString forClass: aBehavior).\x0a\x09compiled category: anotherString.\x0a\x09aBehavior addCompiledMethod: compiled.\x0a self setupClass: aBehavior.\x0a\x09^compiled",
  13613. messageSends: ["eval:", "compile:forClass:", "category:", "addCompiledMethod:", "setupClass:"],
  13614. referencedClasses: []
  13615. }),
  13616. smalltalk.Compiler);
  13617. smalltalk.addMethod(
  13618. "_parse_",
  13619. smalltalk.method({
  13620. selector: "parse:",
  13621. category: 'compiling',
  13622. fn: function (aString){
  13623. var self=this;
  13624. var $1;
  13625. $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_parse_",[aString]);
  13626. return $1;
  13627. },
  13628. args: ["aString"],
  13629. source: "parse: aString\x0a ^Smalltalk current parse: aString",
  13630. messageSends: ["parse:", "current"],
  13631. referencedClasses: ["Smalltalk"]
  13632. }),
  13633. smalltalk.Compiler);
  13634. smalltalk.addMethod(
  13635. "_parseExpression_",
  13636. smalltalk.method({
  13637. selector: "parseExpression:",
  13638. category: 'compiling',
  13639. fn: function (aString){
  13640. var self=this;
  13641. var $1;
  13642. $1=smalltalk.send(self,"_parse_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  13643. return $1;
  13644. },
  13645. args: ["aString"],
  13646. source: "parseExpression: aString\x0a ^self parse: 'doIt ^[', aString, '] value'",
  13647. messageSends: ["parse:", ","],
  13648. referencedClasses: []
  13649. }),
  13650. smalltalk.Compiler);
  13651. smalltalk.addMethod(
  13652. "_recompile_",
  13653. smalltalk.method({
  13654. selector: "recompile:",
  13655. category: 'compiling',
  13656. fn: function (aClass){
  13657. var self=this;
  13658. var $1;
  13659. smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_do_",[(function(each){
  13660. smalltalk.send(console,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(each,"_selector",[])])]);
  13661. return smalltalk.send(self,"_install_forClass_category_",[smalltalk.send(each,"_source",[]),aClass,smalltalk.send(each,"_category",[])]);
  13662. })]);
  13663. smalltalk.send(self,"_setupClass_",[aClass]);
  13664. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  13665. if(! smalltalk.assert($1)){
  13666. smalltalk.send(self,"_recompile_",[smalltalk.send(aClass,"_class",[])]);
  13667. };
  13668. return self},
  13669. args: ["aClass"],
  13670. source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09console log: aClass name, ' >> ', each selector.\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09self setupClass: aClass.\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
  13671. messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "setupClass:", "ifFalse:", "recompile:", "class", "isMetaclass"],
  13672. referencedClasses: []
  13673. }),
  13674. smalltalk.Compiler);
  13675. smalltalk.addMethod(
  13676. "_recompileAll",
  13677. smalltalk.method({
  13678. selector: "recompileAll",
  13679. category: 'compiling',
  13680. fn: function (){
  13681. var self=this;
  13682. var $1;
  13683. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  13684. smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[each]);
  13685. $1=smalltalk.send((smalltalk.Transcript || Transcript),"_cr",[]);
  13686. $1;
  13687. return smalltalk.send((function(){
  13688. return smalltalk.send(self,"_recompile_",[each]);
  13689. }),"_valueWithTimeout_",[(100)]);
  13690. })]);
  13691. return self},
  13692. args: [],
  13693. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09Transcript show: each; cr.\x0a\x09\x09[self recompile: each] valueWithTimeout: 100]",
  13694. messageSends: ["do:", "show:", "cr", "valueWithTimeout:", "recompile:", "classes", "current"],
  13695. referencedClasses: ["Transcript", "Smalltalk"]
  13696. }),
  13697. smalltalk.Compiler);
  13698. smalltalk.addMethod(
  13699. "_setupClass_",
  13700. smalltalk.method({
  13701. selector: "setupClass:",
  13702. category: 'compiling',
  13703. fn: function (aClass){
  13704. var self=this;
  13705. smalltalk.init(aClass);
  13706. ;
  13707. return self},
  13708. args: ["aClass"],
  13709. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass)>",
  13710. messageSends: [],
  13711. referencedClasses: []
  13712. }),
  13713. smalltalk.Compiler);
  13714. smalltalk.addMethod(
  13715. "_source",
  13716. smalltalk.method({
  13717. selector: "source",
  13718. category: 'accessing',
  13719. fn: function (){
  13720. var self=this;
  13721. var $1;
  13722. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  13723. $1="";
  13724. } else {
  13725. $1=self["@source"];
  13726. };
  13727. return $1;
  13728. },
  13729. args: [],
  13730. source: "source\x0a\x09^source ifNil: ['']",
  13731. messageSends: ["ifNil:"],
  13732. referencedClasses: []
  13733. }),
  13734. smalltalk.Compiler);
  13735. smalltalk.addMethod(
  13736. "_source_",
  13737. smalltalk.method({
  13738. selector: "source:",
  13739. category: 'accessing',
  13740. fn: function (aString){
  13741. var self=this;
  13742. self["@source"]=aString;
  13743. return self},
  13744. args: ["aString"],
  13745. source: "source: aString\x0a\x09source := aString",
  13746. messageSends: [],
  13747. referencedClasses: []
  13748. }),
  13749. smalltalk.Compiler);
  13750. smalltalk.addMethod(
  13751. "_unknownVariables",
  13752. smalltalk.method({
  13753. selector: "unknownVariables",
  13754. category: 'accessing',
  13755. fn: function (){
  13756. var self=this;
  13757. return self["@unknownVariables"];
  13758. },
  13759. args: [],
  13760. source: "unknownVariables\x0a\x09^unknownVariables",
  13761. messageSends: [],
  13762. referencedClasses: []
  13763. }),
  13764. smalltalk.Compiler);
  13765. smalltalk.addMethod(
  13766. "_unknownVariables_",
  13767. smalltalk.method({
  13768. selector: "unknownVariables:",
  13769. category: 'accessing',
  13770. fn: function (aCollection){
  13771. var self=this;
  13772. self["@unknownVariables"]=aCollection;
  13773. return self},
  13774. args: ["aCollection"],
  13775. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  13776. messageSends: [],
  13777. referencedClasses: []
  13778. }),
  13779. smalltalk.Compiler);
  13780. smalltalk.addMethod(
  13781. "_recompile_",
  13782. smalltalk.method({
  13783. selector: "recompile:",
  13784. category: 'compiling',
  13785. fn: function (aClass){
  13786. var self=this;
  13787. smalltalk.send(smalltalk.send(self,"_new",[]),"_recompile_",[aClass]);
  13788. return self},
  13789. args: ["aClass"],
  13790. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  13791. messageSends: ["recompile:", "new"],
  13792. referencedClasses: []
  13793. }),
  13794. smalltalk.Compiler.klass);
  13795. smalltalk.addMethod(
  13796. "_recompileAll",
  13797. smalltalk.method({
  13798. selector: "recompileAll",
  13799. category: 'compiling',
  13800. fn: function (){
  13801. var self=this;
  13802. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  13803. return smalltalk.send(self,"_recompile_",[each]);
  13804. })]);
  13805. return self},
  13806. args: [],
  13807. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  13808. messageSends: ["do:", "recompile:", "classes", "current"],
  13809. referencedClasses: ["Smalltalk"]
  13810. }),
  13811. smalltalk.Compiler.klass);
  13812. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  13813. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`."
  13814. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  13815. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors."
  13816. smalltalk.addMethod(
  13817. "_visit_",
  13818. smalltalk.method({
  13819. selector: "visit:",
  13820. category: 'visiting',
  13821. fn: function (aNode){
  13822. var self=this;
  13823. var $1;
  13824. $1=smalltalk.send(aNode,"_accept_",[self]);
  13825. return $1;
  13826. },
  13827. args: ["aNode"],
  13828. source: "visit: aNode\x0a\x09^ aNode accept: self",
  13829. messageSends: ["accept:"],
  13830. referencedClasses: []
  13831. }),
  13832. smalltalk.NodeVisitor);
  13833. smalltalk.addMethod(
  13834. "_visitAll_",
  13835. smalltalk.method({
  13836. selector: "visitAll:",
  13837. category: 'visiting',
  13838. fn: function (aCollection){
  13839. var self=this;
  13840. var $1;
  13841. $1=smalltalk.send(aCollection,"_do_",[(function(each){
  13842. return smalltalk.send(self,"_visit_",[each]);
  13843. })]);
  13844. return $1;
  13845. },
  13846. args: ["aCollection"],
  13847. source: "visitAll: aCollection\x0a\x09^ aCollection do: [ :each | self visit: each ]",
  13848. messageSends: ["do:", "visit:"],
  13849. referencedClasses: []
  13850. }),
  13851. smalltalk.NodeVisitor);
  13852. smalltalk.addMethod(
  13853. "_visitAssignmentNode_",
  13854. smalltalk.method({
  13855. selector: "visitAssignmentNode:",
  13856. category: 'visiting',
  13857. fn: function (aNode){
  13858. var self=this;
  13859. var $1;
  13860. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13861. return $1;
  13862. },
  13863. args: ["aNode"],
  13864. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  13865. messageSends: ["visitNode:"],
  13866. referencedClasses: []
  13867. }),
  13868. smalltalk.NodeVisitor);
  13869. smalltalk.addMethod(
  13870. "_visitBlockNode_",
  13871. smalltalk.method({
  13872. selector: "visitBlockNode:",
  13873. category: 'visiting',
  13874. fn: function (aNode){
  13875. var self=this;
  13876. var $1;
  13877. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13878. return $1;
  13879. },
  13880. args: ["aNode"],
  13881. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  13882. messageSends: ["visitNode:"],
  13883. referencedClasses: []
  13884. }),
  13885. smalltalk.NodeVisitor);
  13886. smalltalk.addMethod(
  13887. "_visitBlockSequenceNode_",
  13888. smalltalk.method({
  13889. selector: "visitBlockSequenceNode:",
  13890. category: 'visiting',
  13891. fn: function (aNode){
  13892. var self=this;
  13893. var $1;
  13894. $1=smalltalk.send(self,"_visitSequenceNode_",[aNode]);
  13895. return $1;
  13896. },
  13897. args: ["aNode"],
  13898. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  13899. messageSends: ["visitSequenceNode:"],
  13900. referencedClasses: []
  13901. }),
  13902. smalltalk.NodeVisitor);
  13903. smalltalk.addMethod(
  13904. "_visitCascadeNode_",
  13905. smalltalk.method({
  13906. selector: "visitCascadeNode:",
  13907. category: 'visiting',
  13908. fn: function (aNode){
  13909. var self=this;
  13910. var $1;
  13911. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13912. return $1;
  13913. },
  13914. args: ["aNode"],
  13915. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  13916. messageSends: ["visitNode:"],
  13917. referencedClasses: []
  13918. }),
  13919. smalltalk.NodeVisitor);
  13920. smalltalk.addMethod(
  13921. "_visitClassReferenceNode_",
  13922. smalltalk.method({
  13923. selector: "visitClassReferenceNode:",
  13924. category: 'visiting',
  13925. fn: function (aNode){
  13926. var self=this;
  13927. var $1;
  13928. $1=smalltalk.send(self,"_visitVariableNode_",[aNode]);
  13929. return $1;
  13930. },
  13931. args: ["aNode"],
  13932. source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
  13933. messageSends: ["visitVariableNode:"],
  13934. referencedClasses: []
  13935. }),
  13936. smalltalk.NodeVisitor);
  13937. smalltalk.addMethod(
  13938. "_visitDynamicArrayNode_",
  13939. smalltalk.method({
  13940. selector: "visitDynamicArrayNode:",
  13941. category: 'visiting',
  13942. fn: function (aNode){
  13943. var self=this;
  13944. var $1;
  13945. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13946. return $1;
  13947. },
  13948. args: ["aNode"],
  13949. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  13950. messageSends: ["visitNode:"],
  13951. referencedClasses: []
  13952. }),
  13953. smalltalk.NodeVisitor);
  13954. smalltalk.addMethod(
  13955. "_visitDynamicDictionaryNode_",
  13956. smalltalk.method({
  13957. selector: "visitDynamicDictionaryNode:",
  13958. category: 'visiting',
  13959. fn: function (aNode){
  13960. var self=this;
  13961. var $1;
  13962. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13963. return $1;
  13964. },
  13965. args: ["aNode"],
  13966. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  13967. messageSends: ["visitNode:"],
  13968. referencedClasses: []
  13969. }),
  13970. smalltalk.NodeVisitor);
  13971. smalltalk.addMethod(
  13972. "_visitJSStatementNode_",
  13973. smalltalk.method({
  13974. selector: "visitJSStatementNode:",
  13975. category: 'visiting',
  13976. fn: function (aNode){
  13977. var self=this;
  13978. var $1;
  13979. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13980. return $1;
  13981. },
  13982. args: ["aNode"],
  13983. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  13984. messageSends: ["visitNode:"],
  13985. referencedClasses: []
  13986. }),
  13987. smalltalk.NodeVisitor);
  13988. smalltalk.addMethod(
  13989. "_visitMethodNode_",
  13990. smalltalk.method({
  13991. selector: "visitMethodNode:",
  13992. category: 'visiting',
  13993. fn: function (aNode){
  13994. var self=this;
  13995. var $1;
  13996. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13997. return $1;
  13998. },
  13999. args: ["aNode"],
  14000. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  14001. messageSends: ["visitNode:"],
  14002. referencedClasses: []
  14003. }),
  14004. smalltalk.NodeVisitor);
  14005. smalltalk.addMethod(
  14006. "_visitNode_",
  14007. smalltalk.method({
  14008. selector: "visitNode:",
  14009. category: 'visiting',
  14010. fn: function (aNode){
  14011. var self=this;
  14012. var $1;
  14013. $1=smalltalk.send(self,"_visitAll_",[smalltalk.send(aNode,"_nodes",[])]);
  14014. return $1;
  14015. },
  14016. args: ["aNode"],
  14017. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  14018. messageSends: ["visitAll:", "nodes"],
  14019. referencedClasses: []
  14020. }),
  14021. smalltalk.NodeVisitor);
  14022. smalltalk.addMethod(
  14023. "_visitReturnNode_",
  14024. smalltalk.method({
  14025. selector: "visitReturnNode:",
  14026. category: 'visiting',
  14027. fn: function (aNode){
  14028. var self=this;
  14029. var $1;
  14030. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  14031. return $1;
  14032. },
  14033. args: ["aNode"],
  14034. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  14035. messageSends: ["visitNode:"],
  14036. referencedClasses: []
  14037. }),
  14038. smalltalk.NodeVisitor);
  14039. smalltalk.addMethod(
  14040. "_visitSendNode_",
  14041. smalltalk.method({
  14042. selector: "visitSendNode:",
  14043. category: 'visiting',
  14044. fn: function (aNode){
  14045. var self=this;
  14046. var $1;
  14047. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  14048. return $1;
  14049. },
  14050. args: ["aNode"],
  14051. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  14052. messageSends: ["visitNode:"],
  14053. referencedClasses: []
  14054. }),
  14055. smalltalk.NodeVisitor);
  14056. smalltalk.addMethod(
  14057. "_visitSequenceNode_",
  14058. smalltalk.method({
  14059. selector: "visitSequenceNode:",
  14060. category: 'visiting',
  14061. fn: function (aNode){
  14062. var self=this;
  14063. var $1;
  14064. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  14065. return $1;
  14066. },
  14067. args: ["aNode"],
  14068. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  14069. messageSends: ["visitNode:"],
  14070. referencedClasses: []
  14071. }),
  14072. smalltalk.NodeVisitor);
  14073. smalltalk.addMethod(
  14074. "_visitValueNode_",
  14075. smalltalk.method({
  14076. selector: "visitValueNode:",
  14077. category: 'visiting',
  14078. fn: function (aNode){
  14079. var self=this;
  14080. var $1;
  14081. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  14082. return $1;
  14083. },
  14084. args: ["aNode"],
  14085. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  14086. messageSends: ["visitNode:"],
  14087. referencedClasses: []
  14088. }),
  14089. smalltalk.NodeVisitor);
  14090. smalltalk.addMethod(
  14091. "_visitVariableNode_",
  14092. smalltalk.method({
  14093. selector: "visitVariableNode:",
  14094. category: 'visiting',
  14095. fn: function (aNode){
  14096. var self=this;
  14097. var $1;
  14098. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  14099. return $1;
  14100. },
  14101. args: ["aNode"],
  14102. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  14103. messageSends: ["visitNode:"],
  14104. referencedClasses: []
  14105. }),
  14106. smalltalk.NodeVisitor);
  14107. smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler-Core');
  14108. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API."
  14109. smalltalk.addMethod(
  14110. "_classNameFor_",
  14111. smalltalk.method({
  14112. selector: "classNameFor:",
  14113. category: 'accessing',
  14114. fn: function (aClass){
  14115. var self=this;
  14116. var $2,$3,$1;
  14117. $2=smalltalk.send(aClass,"_isMetaclass",[]);
  14118. if(smalltalk.assert($2)){
  14119. $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
  14120. } else {
  14121. $3=smalltalk.send(aClass,"_isNil",[]);
  14122. if(smalltalk.assert($3)){
  14123. $1="nil";
  14124. } else {
  14125. $1=smalltalk.send(aClass,"_name",[]);
  14126. };
  14127. };
  14128. return $1;
  14129. },
  14130. args: ["aClass"],
  14131. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, '.klass']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
  14132. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  14133. referencedClasses: []
  14134. }),
  14135. smalltalk.AbstractCodeGenerator);
  14136. smalltalk.addMethod(
  14137. "_compileNode_",
  14138. smalltalk.method({
  14139. selector: "compileNode:",
  14140. category: 'compiling',
  14141. fn: function (aNode){
  14142. var self=this;
  14143. smalltalk.send(self,"_subclassResponsibility",[]);
  14144. return self},
  14145. args: ["aNode"],
  14146. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  14147. messageSends: ["subclassResponsibility"],
  14148. referencedClasses: []
  14149. }),
  14150. smalltalk.AbstractCodeGenerator);
  14151. smalltalk.addMethod(
  14152. "_currentClass",
  14153. smalltalk.method({
  14154. selector: "currentClass",
  14155. category: 'accessing',
  14156. fn: function (){
  14157. var self=this;
  14158. return self["@currentClass"];
  14159. },
  14160. args: [],
  14161. source: "currentClass\x0a\x09^currentClass",
  14162. messageSends: [],
  14163. referencedClasses: []
  14164. }),
  14165. smalltalk.AbstractCodeGenerator);
  14166. smalltalk.addMethod(
  14167. "_currentClass_",
  14168. smalltalk.method({
  14169. selector: "currentClass:",
  14170. category: 'accessing',
  14171. fn: function (aClass){
  14172. var self=this;
  14173. self["@currentClass"]=aClass;
  14174. return self},
  14175. args: ["aClass"],
  14176. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  14177. messageSends: [],
  14178. referencedClasses: []
  14179. }),
  14180. smalltalk.AbstractCodeGenerator);
  14181. smalltalk.addMethod(
  14182. "_pseudoVariables",
  14183. smalltalk.method({
  14184. selector: "pseudoVariables",
  14185. category: 'accessing',
  14186. fn: function (){
  14187. var self=this;
  14188. return ["self", "super", "true", "false", "nil", "thisContext"];
  14189. },
  14190. args: [],
  14191. source: "pseudoVariables\x0a\x09^#('self' 'super' 'true' 'false' 'nil' 'thisContext')",
  14192. messageSends: [],
  14193. referencedClasses: []
  14194. }),
  14195. smalltalk.AbstractCodeGenerator);
  14196. smalltalk.addMethod(
  14197. "_safeVariableNameFor_",
  14198. smalltalk.method({
  14199. selector: "safeVariableNameFor:",
  14200. category: 'accessing',
  14201. fn: function (aString){
  14202. var self=this;
  14203. var $2,$1;
  14204. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[aString]);
  14205. if(smalltalk.assert($2)){
  14206. $1=smalltalk.send(aString,"__comma",["_"]);
  14207. } else {
  14208. $1=aString;
  14209. };
  14210. return $1;
  14211. },
  14212. args: ["aString"],
  14213. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  14214. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  14215. referencedClasses: ["Smalltalk"]
  14216. }),
  14217. smalltalk.AbstractCodeGenerator);
  14218. smalltalk.addMethod(
  14219. "_source",
  14220. smalltalk.method({
  14221. selector: "source",
  14222. category: 'accessing',
  14223. fn: function (){
  14224. var self=this;
  14225. var $1;
  14226. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  14227. $1="";
  14228. } else {
  14229. $1=self["@source"];
  14230. };
  14231. return $1;
  14232. },
  14233. args: [],
  14234. source: "source\x0a\x09^source ifNil: ['']",
  14235. messageSends: ["ifNil:"],
  14236. referencedClasses: []
  14237. }),
  14238. smalltalk.AbstractCodeGenerator);
  14239. smalltalk.addMethod(
  14240. "_source_",
  14241. smalltalk.method({
  14242. selector: "source:",
  14243. category: 'accessing',
  14244. fn: function (aString){
  14245. var self=this;
  14246. self["@source"]=aString;
  14247. return self},
  14248. args: ["aString"],
  14249. source: "source: aString\x0a\x09source := aString",
  14250. messageSends: [],
  14251. referencedClasses: []
  14252. }),
  14253. smalltalk.AbstractCodeGenerator);
  14254. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  14255. 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."
  14256. smalltalk.addMethod(
  14257. "_compileNode_",
  14258. smalltalk.method({
  14259. selector: "compileNode:",
  14260. category: 'compiling',
  14261. fn: function (aNode){
  14262. var self=this;
  14263. var $2,$3,$1;
  14264. var ir;
  14265. var stream;
  14266. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  14267. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  14268. $2=smalltalk.send(self,"_irTranslator",[]);
  14269. smalltalk.send($2,"_visit_",[ir]);
  14270. $3=smalltalk.send($2,"_contents",[]);
  14271. $1=$3;
  14272. return $1;
  14273. },
  14274. args: ["aNode"],
  14275. 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",
  14276. messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
  14277. referencedClasses: []
  14278. }),
  14279. smalltalk.CodeGenerator);
  14280. smalltalk.addMethod(
  14281. "_irTranslator",
  14282. smalltalk.method({
  14283. selector: "irTranslator",
  14284. category: 'compiling',
  14285. fn: function (){
  14286. var self=this;
  14287. var $1;
  14288. $1=smalltalk.send((smalltalk.IRJSTranslator || IRJSTranslator),"_new",[]);
  14289. return $1;
  14290. },
  14291. args: [],
  14292. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  14293. messageSends: ["new"],
  14294. referencedClasses: ["IRJSTranslator"]
  14295. }),
  14296. smalltalk.CodeGenerator);
  14297. smalltalk.addMethod(
  14298. "_semanticAnalyzer",
  14299. smalltalk.method({
  14300. selector: "semanticAnalyzer",
  14301. category: 'compiling',
  14302. fn: function (){
  14303. var self=this;
  14304. var $1;
  14305. $1=smalltalk.send((smalltalk.SemanticAnalyzer || SemanticAnalyzer),"_on_",[smalltalk.send(self,"_currentClass",[])]);
  14306. return $1;
  14307. },
  14308. args: [],
  14309. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  14310. messageSends: ["on:", "currentClass"],
  14311. referencedClasses: ["SemanticAnalyzer"]
  14312. }),
  14313. smalltalk.CodeGenerator);
  14314. smalltalk.addMethod(
  14315. "_translator",
  14316. smalltalk.method({
  14317. selector: "translator",
  14318. category: 'compiling',
  14319. fn: function (){
  14320. var self=this;
  14321. var $2,$3,$1;
  14322. $2=smalltalk.send((smalltalk.IRASTTranslator || IRASTTranslator),"_new",[]);
  14323. smalltalk.send($2,"_source_",[smalltalk.send(self,"_source",[])]);
  14324. smalltalk.send($2,"_theClass_",[smalltalk.send(self,"_currentClass",[])]);
  14325. $3=smalltalk.send($2,"_yourself",[]);
  14326. $1=$3;
  14327. return $1;
  14328. },
  14329. args: [],
  14330. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  14331. messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
  14332. referencedClasses: ["IRASTTranslator"]
  14333. }),
  14334. smalltalk.CodeGenerator);
  14335. smalltalk.addClass('FunCodeGenerator', smalltalk.AbstractCodeGenerator, ['stream', 'nestedBlocks', 'earlyReturn', 'currentSelector', 'unknownVariables', 'tempVariables', 'messageSends', 'referencedClasses', 'classReferenced', 'argVariables'], 'Compiler-Core');
  14336. smalltalk.addMethod(
  14337. "_argVariables",
  14338. smalltalk.method({
  14339. selector: "argVariables",
  14340. category: 'accessing',
  14341. fn: function (){
  14342. var self=this;
  14343. var $1;
  14344. $1=smalltalk.send(self["@argVariables"],"_copy",[]);
  14345. return $1;
  14346. },
  14347. args: [],
  14348. source: "argVariables\x0a\x09^argVariables copy",
  14349. messageSends: ["copy"],
  14350. referencedClasses: []
  14351. }),
  14352. smalltalk.FunCodeGenerator);
  14353. smalltalk.addMethod(
  14354. "_checkClass_for_",
  14355. smalltalk.method({
  14356. selector: "checkClass:for:",
  14357. category: 'optimizations',
  14358. fn: function (aClassName,receiver){
  14359. var self=this;
  14360. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("((($receiver = ","__comma",[receiver]),"__comma",[").klass === smalltalk."]),"__comma",[aClassName]),"__comma",[") ? "])]);
  14361. return self},
  14362. args: ["aClassName", "receiver"],
  14363. source: "checkClass: aClassName for: receiver\x0a stream nextPutAll: '((($receiver = ', receiver, ').klass === smalltalk.', aClassName, ') ? '",
  14364. messageSends: ["nextPutAll:", ","],
  14365. referencedClasses: []
  14366. }),
  14367. smalltalk.FunCodeGenerator);
  14368. smalltalk.addMethod(
  14369. "_compileNode_",
  14370. smalltalk.method({
  14371. selector: "compileNode:",
  14372. category: 'compiling',
  14373. fn: function (aNode){
  14374. var self=this;
  14375. var $1;
  14376. self["@stream"]=smalltalk.send("","_writeStream",[]);
  14377. smalltalk.send(self,"_visit_",[aNode]);
  14378. $1=smalltalk.send(self["@stream"],"_contents",[]);
  14379. return $1;
  14380. },
  14381. args: ["aNode"],
  14382. source: "compileNode: aNode\x0a\x09stream := '' writeStream.\x0a\x09self visit: aNode.\x0a\x09^stream contents",
  14383. messageSends: ["writeStream", "visit:", "contents"],
  14384. referencedClasses: []
  14385. }),
  14386. smalltalk.FunCodeGenerator);
  14387. smalltalk.addMethod(
  14388. "_initialize",
  14389. smalltalk.method({
  14390. selector: "initialize",
  14391. category: 'initialization',
  14392. fn: function (){
  14393. var self=this;
  14394. smalltalk.send(self,"_initialize",[],smalltalk.AbstractCodeGenerator);
  14395. self["@stream"]=smalltalk.send("","_writeStream",[]);
  14396. self["@unknownVariables"]=[];
  14397. self["@tempVariables"]=[];
  14398. self["@argVariables"]=[];
  14399. self["@messageSends"]=[];
  14400. self["@classReferenced"]=[];
  14401. return self},
  14402. args: [],
  14403. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream. \x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09messageSends := #().\x0a\x09classReferenced := #()",
  14404. messageSends: ["initialize", "writeStream"],
  14405. referencedClasses: []
  14406. }),
  14407. smalltalk.FunCodeGenerator);
  14408. smalltalk.addMethod(
  14409. "_inline_receiver_argumentNodes_",
  14410. smalltalk.method({
  14411. selector: "inline:receiver:argumentNodes:",
  14412. category: 'optimizations',
  14413. fn: function (aSelector,receiver,aCollection){
  14414. var self=this;
  14415. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  14416. var inlined;
  14417. inlined=false;
  14418. $1=smalltalk.send(aSelector,"__eq",["ifFalse:"]);
  14419. if(smalltalk.assert($1)){
  14420. $2=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14421. if(smalltalk.assert($2)){
  14422. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14423. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  14424. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14425. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  14426. inlined=true;
  14427. inlined;
  14428. };
  14429. };
  14430. $3=smalltalk.send(aSelector,"__eq",["ifTrue:"]);
  14431. if(smalltalk.assert($3)){
  14432. $4=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14433. if(smalltalk.assert($4)){
  14434. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14435. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  14436. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14437. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  14438. inlined=true;
  14439. inlined;
  14440. };
  14441. };
  14442. $5=smalltalk.send(aSelector,"__eq",["ifTrue:ifFalse:"]);
  14443. if(smalltalk.assert($5)){
  14444. $6=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14445. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14446. })]);
  14447. if(smalltalk.assert($6)){
  14448. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14449. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  14450. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14451. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14452. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14453. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  14454. inlined=true;
  14455. inlined;
  14456. };
  14457. };
  14458. $7=smalltalk.send(aSelector,"__eq",["ifFalse:ifTrue:"]);
  14459. if(smalltalk.assert($7)){
  14460. $8=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14461. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14462. })]);
  14463. if(smalltalk.assert($8)){
  14464. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14465. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  14466. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14467. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14468. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14469. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  14470. inlined=true;
  14471. inlined;
  14472. };
  14473. };
  14474. $9=smalltalk.send(aSelector,"__eq",["<"]);
  14475. if(smalltalk.assert($9)){
  14476. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14477. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <"]);
  14478. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14479. inlined=true;
  14480. inlined;
  14481. };
  14482. $10=smalltalk.send(aSelector,"__eq",["<="]);
  14483. if(smalltalk.assert($10)){
  14484. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14485. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <="]);
  14486. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14487. inlined=true;
  14488. inlined;
  14489. };
  14490. $11=smalltalk.send(aSelector,"__eq",[">"]);
  14491. if(smalltalk.assert($11)){
  14492. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14493. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >"]);
  14494. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14495. inlined=true;
  14496. inlined;
  14497. };
  14498. $12=smalltalk.send(aSelector,"__eq",[">="]);
  14499. if(smalltalk.assert($12)){
  14500. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14501. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >="]);
  14502. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14503. inlined=true;
  14504. inlined;
  14505. };
  14506. $13=smalltalk.send(aSelector,"__eq",["+"]);
  14507. if(smalltalk.assert($13)){
  14508. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14509. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver +"]);
  14510. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14511. inlined=true;
  14512. inlined;
  14513. };
  14514. $14=smalltalk.send(aSelector,"__eq",["-"]);
  14515. if(smalltalk.assert($14)){
  14516. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14517. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver -"]);
  14518. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14519. inlined=true;
  14520. inlined;
  14521. };
  14522. $15=smalltalk.send(aSelector,"__eq",["*"]);
  14523. if(smalltalk.assert($15)){
  14524. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14525. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver *"]);
  14526. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14527. inlined=true;
  14528. inlined;
  14529. };
  14530. $16=smalltalk.send(aSelector,"__eq",["/"]);
  14531. if(smalltalk.assert($16)){
  14532. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14533. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver /"]);
  14534. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14535. inlined=true;
  14536. inlined;
  14537. };
  14538. return inlined;
  14539. },
  14540. args: ["aSelector", "receiver", "aCollection"],
  14541. source: "inline: aSelector receiver: receiver argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a\x0a\x09\x22-- Booleans --\x22\x0a\x0a\x09(aSelector = 'ifFalse:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:ifFalse:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifFalse:ifTrue:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>') ifTrue: [ \x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '+') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver +'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '-') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver -'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '*') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver *'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '/') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver /'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a ^inlined",
  14542. messageSends: ["ifTrue:", "checkClass:for:", "nextPutAll:", "visit:", "first", "isBlockNode", "=", "second", "and:"],
  14543. referencedClasses: []
  14544. }),
  14545. smalltalk.FunCodeGenerator);
  14546. smalltalk.addMethod(
  14547. "_inlineLiteral_receiverNode_argumentNodes_",
  14548. smalltalk.method({
  14549. selector: "inlineLiteral:receiverNode:argumentNodes:",
  14550. category: 'optimizations',
  14551. fn: function (aSelector,anObject,aCollection){
  14552. var self=this;
  14553. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32;
  14554. var inlined;
  14555. inlined=false;
  14556. $1=smalltalk.send(aSelector,"__eq",["whileTrue:"]);
  14557. if(smalltalk.assert($1)){
  14558. $2=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  14559. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14560. })]);
  14561. if(smalltalk.assert($2)){
  14562. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  14563. smalltalk.send(self,"_visit_",[anObject]);
  14564. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  14565. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14566. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  14567. inlined=true;
  14568. inlined;
  14569. };
  14570. };
  14571. $3=smalltalk.send(aSelector,"__eq",["whileFalse:"]);
  14572. if(smalltalk.assert($3)){
  14573. $4=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  14574. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14575. })]);
  14576. if(smalltalk.assert($4)){
  14577. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  14578. smalltalk.send(self,"_visit_",[anObject]);
  14579. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  14580. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14581. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  14582. inlined=true;
  14583. inlined;
  14584. };
  14585. };
  14586. $5=smalltalk.send(aSelector,"__eq",["whileTrue"]);
  14587. if(smalltalk.assert($5)){
  14588. $6=smalltalk.send(anObject,"_isBlockNode",[]);
  14589. if(smalltalk.assert($6)){
  14590. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  14591. smalltalk.send(self,"_visit_",[anObject]);
  14592. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  14593. inlined=true;
  14594. inlined;
  14595. };
  14596. };
  14597. $7=smalltalk.send(aSelector,"__eq",["whileFalse"]);
  14598. if(smalltalk.assert($7)){
  14599. $8=smalltalk.send(anObject,"_isBlockNode",[]);
  14600. if(smalltalk.assert($8)){
  14601. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  14602. smalltalk.send(self,"_visit_",[anObject]);
  14603. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  14604. inlined=true;
  14605. inlined;
  14606. };
  14607. };
  14608. $9=smalltalk.send(aSelector,"__eq",["+"]);
  14609. if(smalltalk.assert($9)){
  14610. $10=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14611. if(smalltalk.assert($10)){
  14612. smalltalk.send(self,"_visit_",[anObject]);
  14613. smalltalk.send(self["@stream"],"_nextPutAll_",[" + "]);
  14614. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14615. inlined=true;
  14616. inlined;
  14617. };
  14618. };
  14619. $11=smalltalk.send(aSelector,"__eq",["-"]);
  14620. if(smalltalk.assert($11)){
  14621. $12=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14622. if(smalltalk.assert($12)){
  14623. smalltalk.send(self,"_visit_",[anObject]);
  14624. smalltalk.send(self["@stream"],"_nextPutAll_",[" - "]);
  14625. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14626. inlined=true;
  14627. inlined;
  14628. };
  14629. };
  14630. $13=smalltalk.send(aSelector,"__eq",["*"]);
  14631. if(smalltalk.assert($13)){
  14632. $14=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14633. if(smalltalk.assert($14)){
  14634. smalltalk.send(self,"_visit_",[anObject]);
  14635. smalltalk.send(self["@stream"],"_nextPutAll_",[" * "]);
  14636. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14637. inlined=true;
  14638. inlined;
  14639. };
  14640. };
  14641. $15=smalltalk.send(aSelector,"__eq",["/"]);
  14642. if(smalltalk.assert($15)){
  14643. $16=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14644. if(smalltalk.assert($16)){
  14645. smalltalk.send(self,"_visit_",[anObject]);
  14646. smalltalk.send(self["@stream"],"_nextPutAll_",[" / "]);
  14647. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14648. inlined=true;
  14649. inlined;
  14650. };
  14651. };
  14652. $17=smalltalk.send(aSelector,"__eq",["<"]);
  14653. if(smalltalk.assert($17)){
  14654. $18=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14655. if(smalltalk.assert($18)){
  14656. smalltalk.send(self,"_visit_",[anObject]);
  14657. smalltalk.send(self["@stream"],"_nextPutAll_",[" < "]);
  14658. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14659. inlined=true;
  14660. inlined;
  14661. };
  14662. };
  14663. $19=smalltalk.send(aSelector,"__eq",["<="]);
  14664. if(smalltalk.assert($19)){
  14665. $20=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14666. if(smalltalk.assert($20)){
  14667. smalltalk.send(self,"_visit_",[anObject]);
  14668. smalltalk.send(self["@stream"],"_nextPutAll_",[" <= "]);
  14669. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14670. inlined=true;
  14671. inlined;
  14672. };
  14673. };
  14674. $21=smalltalk.send(aSelector,"__eq",[">"]);
  14675. if(smalltalk.assert($21)){
  14676. $22=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14677. if(smalltalk.assert($22)){
  14678. smalltalk.send(self,"_visit_",[anObject]);
  14679. smalltalk.send(self["@stream"],"_nextPutAll_",[" > "]);
  14680. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14681. inlined=true;
  14682. inlined;
  14683. };
  14684. };
  14685. $23=smalltalk.send(aSelector,"__eq",[">="]);
  14686. if(smalltalk.assert($23)){
  14687. $24=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14688. if(smalltalk.assert($24)){
  14689. smalltalk.send(self,"_visit_",[anObject]);
  14690. smalltalk.send(self["@stream"],"_nextPutAll_",[" >= "]);
  14691. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14692. inlined=true;
  14693. inlined;
  14694. };
  14695. };
  14696. $25=smalltalk.send(aSelector,"__eq",["ifNil:"]);
  14697. if(smalltalk.assert($25)){
  14698. $26=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14699. if(smalltalk.assert($26)){
  14700. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14701. smalltalk.send(self,"_visit_",[anObject]);
  14702. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14703. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14704. smalltalk.send(self["@stream"],"_nextPutAll_",["() : $receiver"]);
  14705. inlined=true;
  14706. inlined;
  14707. };
  14708. };
  14709. $27=smalltalk.send(aSelector,"__eq",["ifNotNil:"]);
  14710. if(smalltalk.assert($27)){
  14711. $28=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14712. if(smalltalk.assert($28)){
  14713. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14714. smalltalk.send(self,"_visit_",[anObject]);
  14715. smalltalk.send(self["@stream"],"_nextPutAll_",[") != nil && $receiver != undefined) ? "]);
  14716. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14717. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil"]);
  14718. inlined=true;
  14719. inlined;
  14720. };
  14721. };
  14722. $29=smalltalk.send(aSelector,"__eq",["ifNil:ifNotNil:"]);
  14723. if(smalltalk.assert($29)){
  14724. $30=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14725. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14726. })]);
  14727. if(smalltalk.assert($30)){
  14728. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14729. smalltalk.send(self,"_visit_",[anObject]);
  14730. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14731. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14732. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14733. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14734. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  14735. inlined=true;
  14736. inlined;
  14737. };
  14738. };
  14739. $31=smalltalk.send(aSelector,"__eq",["ifNotNil:ifNil:"]);
  14740. if(smalltalk.assert($31)){
  14741. $32=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14742. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14743. })]);
  14744. if(smalltalk.assert($32)){
  14745. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14746. smalltalk.send(self,"_visit_",[anObject]);
  14747. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14748. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14749. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14750. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14751. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  14752. inlined=true;
  14753. inlined;
  14754. };
  14755. };
  14756. return inlined;
  14757. },
  14758. args: ["aSelector", "anObject", "aCollection"],
  14759. source: "inlineLiteral: aSelector receiverNode: anObject argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a \x0a\x09\x22-- BlockClosures --\x22\x0a\x0a\x09(aSelector = 'whileTrue:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileTrue') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '+') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' + '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '-') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' - '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '*') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' * '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '/') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' / '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' < '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' <= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' > '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' >= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a \x09 \x0a\x09\x22-- UndefinedObject --\x22\x0a\x0a\x09(aSelector = 'ifNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : $receiver'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') != nil && $receiver != undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : nil'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNil:ifNotNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:ifNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a \x0a ^inlined",
  14760. messageSends: ["ifTrue:", "nextPutAll:", "visit:", "first", "and:", "isBlockNode", "=", "isNode:ofClass:", "second"],
  14761. referencedClasses: ["Number"]
  14762. }),
  14763. smalltalk.FunCodeGenerator);
  14764. smalltalk.addMethod(
  14765. "_isNode_ofClass_",
  14766. smalltalk.method({
  14767. selector: "isNode:ofClass:",
  14768. category: 'optimizations',
  14769. fn: function (aNode,aClass){
  14770. var self=this;
  14771. var $1;
  14772. $1=smalltalk.send(smalltalk.send(aNode,"_isValueNode",[]),"_and_",[(function(){
  14773. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"_class",[]),"__eq",[aClass]),"_or_",[(function(){
  14774. return smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"__eq",["self"]),"_and_",[(function(){
  14775. return smalltalk.send(smalltalk.send(self,"_currentClass",[]),"__eq",[aClass]);
  14776. })]);
  14777. })]);
  14778. })]);
  14779. return $1;
  14780. },
  14781. args: ["aNode", "aClass"],
  14782. source: "isNode: aNode ofClass: aClass\x0a\x09^aNode isValueNode and: [\x0a \x09aNode value class = aClass or: [\x0a \x09\x09aNode value = 'self' and: [self currentClass = aClass]]]",
  14783. messageSends: ["and:", "or:", "=", "currentClass", "value", "class", "isValueNode"],
  14784. referencedClasses: []
  14785. }),
  14786. smalltalk.FunCodeGenerator);
  14787. smalltalk.addMethod(
  14788. "_knownVariables",
  14789. smalltalk.method({
  14790. selector: "knownVariables",
  14791. category: 'accessing',
  14792. fn: function (){
  14793. var self=this;
  14794. var $2,$3,$1;
  14795. $2=smalltalk.send(self,"_pseudoVariables",[]);
  14796. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_tempVariables",[])]);
  14797. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_argVariables",[])]);
  14798. $3=smalltalk.send($2,"_yourself",[]);
  14799. $1=$3;
  14800. return $1;
  14801. },
  14802. args: [],
  14803. source: "knownVariables\x0a\x09^self pseudoVariables \x0a\x09\x09addAll: self tempVariables;\x0a\x09\x09addAll: self argVariables;\x0a\x09\x09yourself",
  14804. messageSends: ["addAll:", "tempVariables", "pseudoVariables", "argVariables", "yourself"],
  14805. referencedClasses: []
  14806. }),
  14807. smalltalk.FunCodeGenerator);
  14808. smalltalk.addMethod(
  14809. "_performOptimizations",
  14810. smalltalk.method({
  14811. selector: "performOptimizations",
  14812. category: 'testing',
  14813. fn: function (){
  14814. var self=this;
  14815. var $1;
  14816. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_performOptimizations",[]);
  14817. return $1;
  14818. },
  14819. args: [],
  14820. source: "performOptimizations\x0a\x09^self class performOptimizations",
  14821. messageSends: ["performOptimizations", "class"],
  14822. referencedClasses: []
  14823. }),
  14824. smalltalk.FunCodeGenerator);
  14825. smalltalk.addMethod(
  14826. "_send_to_arguments_superSend_",
  14827. smalltalk.method({
  14828. selector: "send:to:arguments:superSend:",
  14829. category: 'visiting',
  14830. fn: function (aSelector,aReceiver,aCollection,aBoolean){
  14831. var self=this;
  14832. var $1;
  14833. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(str){
  14834. var tmp;
  14835. tmp=self["@stream"];
  14836. tmp;
  14837. smalltalk.send(str,"_nextPutAll_",["smalltalk.send("]);
  14838. smalltalk.send(str,"_nextPutAll_",[aReceiver]);
  14839. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", \x22","__comma",[smalltalk.send(aSelector,"_asSelector",[])]),"__comma",["\x22, ["])]);
  14840. self["@stream"]=str;
  14841. self["@stream"];
  14842. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  14843. return smalltalk.send(self,"_visit_",[each]);
  14844. }),(function(){
  14845. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  14846. })]);
  14847. self["@stream"]=tmp;
  14848. self["@stream"];
  14849. smalltalk.send(str,"_nextPutAll_",["]"]);
  14850. if(smalltalk.assert(aBoolean)){
  14851. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(self,"_currentClass",[])])]),"__comma",[".superclass || nil"])]);
  14852. };
  14853. return smalltalk.send(str,"_nextPutAll_",[")"]);
  14854. })]);
  14855. return $1;
  14856. },
  14857. args: ["aSelector", "aReceiver", "aCollection", "aBoolean"],
  14858. source: "send: aSelector to: aReceiver arguments: aCollection superSend: aBoolean\x0a\x09^String streamContents: [:str || tmp |\x0a \x09tmp := stream.\x0a\x09\x09str nextPutAll: 'smalltalk.send('.\x0a\x09\x09str nextPutAll: aReceiver.\x0a\x09\x09str nextPutAll: ', \x22', aSelector asSelector, '\x22, ['.\x0a stream := str.\x0a\x09\x09aCollection\x0a\x09 \x09\x09do: [:each | self visit: each]\x0a\x09 \x09\x09separatedBy: [stream nextPutAll: ', '].\x0a stream := tmp.\x0a str nextPutAll: ']'.\x0a\x09\x09aBoolean ifTrue: [\x0a\x09\x09\x09str nextPutAll: ', smalltalk.', (self classNameFor: self currentClass), '.superclass || nil'].\x0a\x09\x09str nextPutAll: ')']",
  14859. messageSends: ["streamContents:", "nextPutAll:", ",", "asSelector", "do:separatedBy:", "visit:", "ifTrue:", "classNameFor:", "currentClass"],
  14860. referencedClasses: ["String"]
  14861. }),
  14862. smalltalk.FunCodeGenerator);
  14863. smalltalk.addMethod(
  14864. "_tempVariables",
  14865. smalltalk.method({
  14866. selector: "tempVariables",
  14867. category: 'accessing',
  14868. fn: function (){
  14869. var self=this;
  14870. var $1;
  14871. $1=smalltalk.send(self["@tempVariables"],"_copy",[]);
  14872. return $1;
  14873. },
  14874. args: [],
  14875. source: "tempVariables\x0a\x09^tempVariables copy",
  14876. messageSends: ["copy"],
  14877. referencedClasses: []
  14878. }),
  14879. smalltalk.FunCodeGenerator);
  14880. smalltalk.addMethod(
  14881. "_unknownVariables",
  14882. smalltalk.method({
  14883. selector: "unknownVariables",
  14884. category: 'accessing',
  14885. fn: function (){
  14886. var self=this;
  14887. var $1;
  14888. $1=smalltalk.send(self["@unknownVariables"],"_copy",[]);
  14889. return $1;
  14890. },
  14891. args: [],
  14892. source: "unknownVariables\x0a\x09^unknownVariables copy",
  14893. messageSends: ["copy"],
  14894. referencedClasses: []
  14895. }),
  14896. smalltalk.FunCodeGenerator);
  14897. smalltalk.addMethod(
  14898. "_visit_",
  14899. smalltalk.method({
  14900. selector: "visit:",
  14901. category: 'visiting',
  14902. fn: function (aNode){
  14903. var self=this;
  14904. smalltalk.send(aNode,"_accept_",[self]);
  14905. return self},
  14906. args: ["aNode"],
  14907. source: "visit: aNode\x0a\x09aNode accept: self",
  14908. messageSends: ["accept:"],
  14909. referencedClasses: []
  14910. }),
  14911. smalltalk.FunCodeGenerator);
  14912. smalltalk.addMethod(
  14913. "_visitAssignmentNode_",
  14914. smalltalk.method({
  14915. selector: "visitAssignmentNode:",
  14916. category: 'visiting',
  14917. fn: function (aNode){
  14918. var self=this;
  14919. smalltalk.send(self["@stream"],"_nextPutAll_",["("]);
  14920. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  14921. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  14922. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  14923. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  14924. return self},
  14925. args: ["aNode"],
  14926. source: "visitAssignmentNode: aNode\x0a\x09stream nextPutAll: '('.\x0a\x09self visit: aNode left.\x0a\x09stream nextPutAll: '='.\x0a\x09self visit: aNode right.\x0a\x09stream nextPutAll: ')'",
  14927. messageSends: ["nextPutAll:", "visit:", "left", "right"],
  14928. referencedClasses: []
  14929. }),
  14930. smalltalk.FunCodeGenerator);
  14931. smalltalk.addMethod(
  14932. "_visitBlockNode_",
  14933. smalltalk.method({
  14934. selector: "visitBlockNode:",
  14935. category: 'visiting',
  14936. fn: function (aNode){
  14937. var self=this;
  14938. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  14939. smalltalk.send(smalltalk.send(aNode,"_parameters",[]),"_do_separatedBy_",[(function(each){
  14940. smalltalk.send(self["@tempVariables"],"_add_",[each]);
  14941. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  14942. }),(function(){
  14943. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  14944. })]);
  14945. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  14946. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  14947. return smalltalk.send(self,"_visit_",[each]);
  14948. })]);
  14949. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  14950. return self},
  14951. args: ["aNode"],
  14952. source: "visitBlockNode: aNode\x0a\x09stream nextPutAll: '(function('.\x0a\x09aNode parameters \x0a\x09 do: [:each |\x0a\x09\x09tempVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream nextPutAll: '){'.\x0a\x09aNode nodes do: [:each | self visit: each].\x0a\x09stream nextPutAll: '})'",
  14953. messageSends: ["nextPutAll:", "do:separatedBy:", "add:", "parameters", "do:", "visit:", "nodes"],
  14954. referencedClasses: []
  14955. }),
  14956. smalltalk.FunCodeGenerator);
  14957. smalltalk.addMethod(
  14958. "_visitBlockSequenceNode_",
  14959. smalltalk.method({
  14960. selector: "visitBlockSequenceNode:",
  14961. category: 'visiting',
  14962. fn: function (aNode){
  14963. var self=this;
  14964. var $1,$2,$3;
  14965. var index;
  14966. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__plus",[(1)]);
  14967. $1=smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_isEmpty",[]);
  14968. if(smalltalk.assert($1)){
  14969. smalltalk.send(self["@stream"],"_nextPutAll_",["return nil;"]);
  14970. } else {
  14971. smalltalk.send(smalltalk.send(aNode,"_temps",[]),"_do_",[(function(each){
  14972. var temp;
  14973. temp=smalltalk.send(self,"_safeVariableNameFor_",[each]);
  14974. temp;
  14975. smalltalk.send(self["@tempVariables"],"_add_",[temp]);
  14976. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[temp]),"__comma",["=nil;"])]);
  14977. $2=smalltalk.send(self["@stream"],"_lf",[]);
  14978. return $2;
  14979. })]);
  14980. index=(0);
  14981. index;
  14982. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  14983. index=smalltalk.send(index,"__plus",[(1)]);
  14984. index;
  14985. $3=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  14986. if(smalltalk.assert($3)){
  14987. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  14988. };
  14989. smalltalk.send(self,"_visit_",[each]);
  14990. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  14991. })]);
  14992. };
  14993. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__minus",[(1)]);
  14994. return self},
  14995. args: ["aNode"],
  14996. source: "visitBlockSequenceNode: aNode\x0a\x09| index |\x0a\x09nestedBlocks := nestedBlocks + 1.\x0a\x09aNode nodes isEmpty\x0a\x09 ifTrue: [\x0a\x09\x09stream nextPutAll: 'return nil;']\x0a\x09 ifFalse: [\x0a\x09\x09aNode temps do: [:each | | temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09\x09 tempVariables add: temp.\x0a\x09\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09\x09index := 0.\x0a\x09\x09aNode nodes do: [:each |\x0a\x09\x09 index := index + 1.\x0a\x09\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09\x09stream nextPutAll: 'return '].\x0a\x09\x09 self visit: each.\x0a\x09\x09 stream nextPutAll: ';']].\x0a\x09nestedBlocks := nestedBlocks - 1",
  14997. messageSends: ["+", "ifTrue:ifFalse:", "nextPutAll:", "do:", "safeVariableNameFor:", "add:", ",", "lf", "temps", "ifTrue:", "=", "size", "nodes", "visit:", "isEmpty", "-"],
  14998. referencedClasses: []
  14999. }),
  15000. smalltalk.FunCodeGenerator);
  15001. smalltalk.addMethod(
  15002. "_visitCascadeNode_",
  15003. smalltalk.method({
  15004. selector: "visitCascadeNode:",
  15005. category: 'visiting',
  15006. fn: function (aNode){
  15007. var self=this;
  15008. var $1,$2;
  15009. var index;
  15010. index=(0);
  15011. $1=smalltalk.send(self["@tempVariables"],"_includes_",["$rec"]);
  15012. if(! smalltalk.assert($1)){
  15013. smalltalk.send(self["@tempVariables"],"_add_",["$rec"]);
  15014. };
  15015. smalltalk.send(self["@stream"],"_nextPutAll_",["(function($rec){"]);
  15016. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  15017. index=smalltalk.send(index,"__plus",[(1)]);
  15018. index;
  15019. $2=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  15020. if(smalltalk.assert($2)){
  15021. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  15022. };
  15023. smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_value_",["$rec"])]);
  15024. smalltalk.send(self,"_visit_",[each]);
  15025. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  15026. })]);
  15027. smalltalk.send(self["@stream"],"_nextPutAll_",["})("]);
  15028. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
  15029. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  15030. return self},
  15031. args: ["aNode"],
  15032. source: "visitCascadeNode: aNode\x0a\x09| index |\x0a\x09index := 0.\x0a\x09(tempVariables includes: '$rec') ifFalse: [\x0a\x09\x09tempVariables add: '$rec'].\x0a\x09stream nextPutAll: '(function($rec){'.\x0a\x09aNode nodes do: [:each |\x0a\x09 index := index + 1.\x0a\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09stream nextPutAll: 'return '].\x0a\x09 each receiver: (VariableNode new value: '$rec').\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';'].\x0a\x09stream nextPutAll: '})('.\x0a\x09self visit: aNode receiver.\x0a\x09stream nextPutAll: ')'",
  15033. messageSends: ["ifFalse:", "add:", "includes:", "nextPutAll:", "do:", "+", "ifTrue:", "=", "size", "nodes", "receiver:", "value:", "new", "visit:", "receiver"],
  15034. referencedClasses: ["VariableNode"]
  15035. }),
  15036. smalltalk.FunCodeGenerator);
  15037. smalltalk.addMethod(
  15038. "_visitClassReferenceNode_",
  15039. smalltalk.method({
  15040. selector: "visitClassReferenceNode:",
  15041. category: 'visiting',
  15042. fn: function (aNode){
  15043. var self=this;
  15044. var $1;
  15045. $1=smalltalk.send(self["@referencedClasses"],"_includes_",[smalltalk.send(aNode,"_value",[])]);
  15046. if(! smalltalk.assert($1)){
  15047. smalltalk.send(self["@referencedClasses"],"_add_",[smalltalk.send(aNode,"_value",[])]);
  15048. };
  15049. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.","__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[" || "]),"__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[")"])]);
  15050. return self},
  15051. args: ["aNode"],
  15052. source: "visitClassReferenceNode: aNode\x0a\x09(referencedClasses includes: aNode value) ifFalse: [\x0a\x09\x09referencedClasses add: aNode value].\x0a\x09stream nextPutAll: '(smalltalk.', aNode value, ' || ', aNode value, ')'",
  15053. messageSends: ["ifFalse:", "add:", "value", "includes:", "nextPutAll:", ","],
  15054. referencedClasses: []
  15055. }),
  15056. smalltalk.FunCodeGenerator);
  15057. smalltalk.addMethod(
  15058. "_visitDynamicArrayNode_",
  15059. smalltalk.method({
  15060. selector: "visitDynamicArrayNode:",
  15061. category: 'visiting',
  15062. fn: function (aNode){
  15063. var self=this;
  15064. smalltalk.send(self["@stream"],"_nextPutAll_",["["]);
  15065. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  15066. return smalltalk.send(self,"_visit_",[each]);
  15067. }),(function(){
  15068. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  15069. })]);
  15070. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  15071. return self},
  15072. args: ["aNode"],
  15073. source: "visitDynamicArrayNode: aNode\x0a\x09stream nextPutAll: '['.\x0a\x09aNode nodes \x0a\x09\x09do: [:each | self visit: each]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'",
  15074. messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
  15075. referencedClasses: []
  15076. }),
  15077. smalltalk.FunCodeGenerator);
  15078. smalltalk.addMethod(
  15079. "_visitDynamicDictionaryNode_",
  15080. smalltalk.method({
  15081. selector: "visitDynamicDictionaryNode:",
  15082. category: 'visiting',
  15083. fn: function (aNode){
  15084. var self=this;
  15085. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  15086. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  15087. return smalltalk.send(self,"_visit_",[each]);
  15088. }),(function(){
  15089. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  15090. })]);
  15091. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  15092. return self},
  15093. args: ["aNode"],
  15094. source: "visitDynamicDictionaryNode: aNode\x0a\x09stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.\x0a\x09\x09aNode nodes \x0a\x09\x09\x09do: [:each | self visit: each]\x0a\x09\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09\x09stream nextPutAll: '])'",
  15095. messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
  15096. referencedClasses: []
  15097. }),
  15098. smalltalk.FunCodeGenerator);
  15099. smalltalk.addMethod(
  15100. "_visitFailure_",
  15101. smalltalk.method({
  15102. selector: "visitFailure:",
  15103. category: 'visiting',
  15104. fn: function (aFailure){
  15105. var self=this;
  15106. smalltalk.send(self,"_error_",[smalltalk.send(aFailure,"_asString",[])]);
  15107. return self},
  15108. args: ["aFailure"],
  15109. source: "visitFailure: aFailure\x0a\x09self error: aFailure asString",
  15110. messageSends: ["error:", "asString"],
  15111. referencedClasses: []
  15112. }),
  15113. smalltalk.FunCodeGenerator);
  15114. smalltalk.addMethod(
  15115. "_visitJSStatementNode_",
  15116. smalltalk.method({
  15117. selector: "visitJSStatementNode:",
  15118. category: 'visiting',
  15119. fn: function (aNode){
  15120. var self=this;
  15121. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(aNode,"_source",[])]);
  15122. return self},
  15123. args: ["aNode"],
  15124. source: "visitJSStatementNode: aNode\x0a\x09stream nextPutAll: aNode source",
  15125. messageSends: ["nextPutAll:", "source"],
  15126. referencedClasses: []
  15127. }),
  15128. smalltalk.FunCodeGenerator);
  15129. smalltalk.addMethod(
  15130. "_visitMethodNode_",
  15131. smalltalk.method({
  15132. selector: "visitMethodNode:",
  15133. category: 'visiting',
  15134. fn: function (aNode) {
  15135. var self=this;
  15136. var str=nil;
  15137. var currentSelector=nil;
  15138. (self['@currentSelector']=smalltalk.send(smalltalk.send(aNode, "_selector", []), "_asSelector", []));
  15139. (self['@nestedBlocks']=(0));
  15140. (self['@earlyReturn']=false);
  15141. (self['@messageSends']=[]);
  15142. (self['@referencedClasses']=[]);
  15143. (self['@unknownVariables']=[]);
  15144. (self['@tempVariables']=[]);
  15145. (self['@argVariables']=[]);
  15146. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: \x22", "__comma", [smalltalk.send(aNode, "_selector", [])]), "__comma", ["\x22,"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  15147. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(self, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  15148. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  15149. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_separatedBy_", [(function(each){smalltalk.send(self['@argVariables'], "_add_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);
  15150. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  15151. (str=self['@stream']);
  15152. (self['@stream']=smalltalk.send("", "_writeStream", []));
  15153. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  15154. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})]));
  15155. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(self['@stream'], "_contents", [])]);
  15156. (self['@stream']=str);
  15157. (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["return self;"]);})(self['@stream']);
  15158. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})]));
  15159. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  15160. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(",", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", ["messageSends: "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@messageSends'], "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(self['@argVariables'], "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
  15161. smalltalk.send(self['@referencedClasses'], "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  15162. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  15163. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  15164. return self;},
  15165. args: ["aNode"],
  15166. source: "visitMethodNode: aNode\x0a\x09| str currentSelector | \x0a\x09currentSelector := aNode selector asSelector.\x0a\x09nestedBlocks := 0.\x0a\x09earlyReturn := false.\x0a\x09messageSends := #().\x0a\x09referencedClasses := #().\x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09stream \x0a\x09 nextPutAll: 'smalltalk.method({'; lf;\x0a\x09 nextPutAll: 'selector: \x22', aNode selector, '\x22,'; lf.\x0a\x09stream nextPutAll: 'source: ', self source asJavascript, ',';lf.\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09aNode arguments \x0a\x09 do: [:each | \x0a\x09\x09argVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream \x0a\x09 nextPutAll: '){'; lf;\x0a\x09 nextPutAll: 'var self=this;'; lf.\x0a\x09str := stream.\x0a\x09stream := '' writeStream.\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09earlyReturn ifTrue: [\x0a\x09 str nextPutAll: 'var $early={};'; lf; nextPutAll: 'try{'].\x0a\x09str nextPutAll: stream contents.\x0a\x09stream := str.\x0a\x09stream \x0a\x09 lf; \x0a\x09 nextPutAll: 'return self;'.\x0a\x09earlyReturn ifTrue: [\x0a\x09 stream lf; nextPutAll: '} catch(e) {if(e===$early)return e[0]; throw e}'].\x0a\x09stream nextPutAll: '}'.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: messageSends asJavascript, ','; lf;\x0a \x09nextPutAll: 'args: ', argVariables asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09referencedClasses \x0a\x09\x09do: [:each | stream nextPutAll: each printString]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'.\x0a\x09stream nextPutAll: '})'",
  15167. messageSends: ["asSelector", "selector", "nextPutAll:", "lf", ",", "asJavascript", "source", "do:separatedBy:", "arguments", "add:", "writeStream", "do:", "nodes", "visit:", "ifTrue:", "contents", "printString"],
  15168. referencedClasses: ["String"]
  15169. }),
  15170. smalltalk.FunCodeGenerator);
  15171. smalltalk.addMethod(
  15172. "_visitReturnNode_",
  15173. smalltalk.method({
  15174. selector: "visitReturnNode:",
  15175. category: 'visiting',
  15176. fn: function (aNode) {
  15177. var self=this;
  15178. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (self['@earlyReturn']=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (self['@earlyReturn']=true);})]));
  15179. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));
  15180. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  15181. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})]));
  15182. return self;},
  15183. args: ["aNode"],
  15184. source: "visitReturnNode: aNode\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 earlyReturn := true].\x0a\x09nestedBlocks > 0\x0a\x09 ifTrue: [\x0a\x09\x09stream\x0a\x09\x09 nextPutAll: '(function(){throw $early=[']\x0a\x09 ifFalse: [stream nextPutAll: 'return '].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 stream nextPutAll: ']})()']",
  15185. messageSends: ["ifTrue:", ">", "ifTrue:ifFalse:", "nextPutAll:", "do:", "nodes", "visit:"],
  15186. referencedClasses: []
  15187. }),
  15188. smalltalk.FunCodeGenerator);
  15189. smalltalk.addMethod(
  15190. "_visitSendNode_",
  15191. smalltalk.method({
  15192. selector: "visitSendNode:",
  15193. category: 'visiting',
  15194. fn: function (aNode) {
  15195. var self=this;
  15196. var str=nil;
  15197. var receiver=nil;
  15198. var superSend=nil;
  15199. var inlined=nil;
  15200. (str=self['@stream']);
  15201. ((($receiver = smalltalk.send(self['@messageSends'], "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})]));
  15202. (self['@stream']=smalltalk.send("", "_writeStream", []));
  15203. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
  15204. (superSend=smalltalk.send(smalltalk.send(self['@stream'], "_contents", []), "__eq", ["super"]));
  15205. (receiver=((($receiver = superSend).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "self";})() : (function(){return smalltalk.send(self['@stream'], "_contents", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "self";}), (function(){return smalltalk.send(self['@stream'], "_contents", []);})])));
  15206. (self['@stream']=str);
  15207. ((($receiver = smalltalk.send(self, "_performOptimizations", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));
  15208. return self;},
  15209. args: ["aNode"],
  15210. source: "visitSendNode: aNode\x0a | str receiver superSend inlined |\x0a str := stream.\x0a (messageSends includes: aNode selector) ifFalse: [\x0a messageSends add: aNode selector].\x0a stream := '' writeStream.\x0a self visit: aNode receiver.\x0a superSend := stream contents = 'super'.\x0a receiver := superSend ifTrue: ['self'] ifFalse: [stream contents].\x0a stream := str.\x0a\x09\x0a\x09self performOptimizations \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09(self inlineLiteral: aNode selector receiverNode: aNode receiver argumentNodes: aNode arguments) ifFalse: [\x0a\x09\x09\x09\x09(self inline: aNode selector receiver: receiver argumentNodes: aNode arguments)\x0a \x09\x09\x09ifTrue: [stream nextPutAll: ' : ', (self send: aNode selector to: '$receiver' arguments: aNode arguments superSend: superSend), ')']\x0a \x09\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]]]\x0a\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]",
  15211. messageSends: ["ifFalse:", "includes:", "selector", "add:", "writeStream", "visit:", "receiver", "=", "contents", "ifTrue:ifFalse:", "performOptimizations", "inlineLiteral:receiverNode:argumentNodes:", "arguments", "inline:receiver:argumentNodes:", "nextPutAll:", ",", "send:to:arguments:superSend:"],
  15212. referencedClasses: []
  15213. }),
  15214. smalltalk.FunCodeGenerator);
  15215. smalltalk.addMethod(
  15216. "_visitSequenceNode_",
  15217. smalltalk.method({
  15218. selector: "visitSequenceNode:",
  15219. category: 'visiting',
  15220. fn: function (aNode) {
  15221. var self=this;
  15222. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  15223. (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);
  15224. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);}), (function(){return smalltalk.send(self['@stream'], "_lf", []);})]);
  15225. return self;},
  15226. args: ["aNode"],
  15227. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [:each || temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09 tempVariables add: temp.\x0a\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';']\x0a\x09 separatedBy: [stream lf]",
  15228. messageSends: ["do:", "temps", "safeVariableNameFor:", "add:", "nextPutAll:", ",", "lf", "do:separatedBy:", "nodes", "visit:"],
  15229. referencedClasses: []
  15230. }),
  15231. smalltalk.FunCodeGenerator);
  15232. smalltalk.addMethod(
  15233. "_visitValueNode_",
  15234. smalltalk.method({
  15235. selector: "visitValueNode:",
  15236. category: 'visiting',
  15237. fn: function (aNode) {
  15238. var self=this;
  15239. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_value", []), "_asJavascript", [])]);
  15240. return self;},
  15241. args: ["aNode"],
  15242. source: "visitValueNode: aNode\x0a\x09stream nextPutAll: aNode value asJavascript",
  15243. messageSends: ["nextPutAll:", "asJavascript", "value"],
  15244. referencedClasses: []
  15245. }),
  15246. smalltalk.FunCodeGenerator);
  15247. smalltalk.addMethod(
  15248. "_visitVariableNode_",
  15249. smalltalk.method({
  15250. selector: "visitVariableNode:",
  15251. category: 'visiting',
  15252. fn: function (aNode) {
  15253. var self=this;
  15254. var varName=nil;
  15255. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_currentClass", []), "_allInstanceVariableNames", []), "_includes_", [smalltalk.send(aNode, "_value", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);})() : (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);}), (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})]));
  15256. return self;},
  15257. args: ["aNode"],
  15258. source: "visitVariableNode: aNode\x0a\x09| varName |\x0a\x09(self currentClass allInstanceVariableNames includes: aNode value) \x0a\x09\x09ifTrue: [stream nextPutAll: 'self[''@', aNode value, ''']']\x0a\x09\x09ifFalse: [\x0a \x09varName := self safeVariableNameFor: aNode value.\x0a\x09\x09\x09(self knownVariables includes: varName) \x0a \x09\x09ifFalse: [\x0a \x09unknownVariables add: aNode value.\x0a \x09aNode assigned \x0a \x09\x09ifTrue: [stream nextPutAll: varName]\x0a \x09\x09ifFalse: [stream nextPutAll: '(typeof ', varName, ' == ''undefined'' ? nil : ', varName, ')']]\x0a \x09\x09ifTrue: [\x0a \x09aNode value = 'thisContext'\x0a \x09\x09ifTrue: [stream nextPutAll: '(smalltalk.getThisContext())']\x0a \x09\x09\x09\x09ifFalse: [stream nextPutAll: varName]]]",
  15259. messageSends: ["ifTrue:ifFalse:", "includes:", "allInstanceVariableNames", "currentClass", "value", "nextPutAll:", ",", "safeVariableNameFor:", "ifFalse:ifTrue:", "knownVariables", "add:", "assigned", "="],
  15260. referencedClasses: []
  15261. }),
  15262. smalltalk.FunCodeGenerator);
  15263. smalltalk.FunCodeGenerator.klass.iVarNames = ['performOptimizations'];
  15264. smalltalk.addMethod(
  15265. "_performOptimizations",
  15266. smalltalk.method({
  15267. selector: "performOptimizations",
  15268. category: 'accessing',
  15269. fn: function () {
  15270. var self=this;
  15271. return (($receiver = self['@performOptimizations']) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver;
  15272. return self;},
  15273. args: [],
  15274. source: "performOptimizations\x0a\x09^performOptimizations ifNil: [true]",
  15275. messageSends: ["ifNil:"],
  15276. referencedClasses: []
  15277. }),
  15278. smalltalk.FunCodeGenerator.klass);
  15279. smalltalk.addMethod(
  15280. "_performOptimizations_",
  15281. smalltalk.method({
  15282. selector: "performOptimizations:",
  15283. category: 'accessing',
  15284. fn: function (aBoolean) {
  15285. var self=this;
  15286. (self['@performOptimizations']=aBoolean);
  15287. return self;},
  15288. args: ["aBoolean"],
  15289. source: "performOptimizations: aBoolean\x0a\x09performOptimizations := aBoolean",
  15290. messageSends: [],
  15291. referencedClasses: []
  15292. }),
  15293. smalltalk.FunCodeGenerator.klass);
  15294. smalltalk.addPackage('Compiler-Exceptions', {});
  15295. smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
  15296. smalltalk.CompilerError.comment="I am the common superclass of all compiling errors."
  15297. smalltalk.addClass('ParseError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  15298. smalltalk.ParseError.comment="Instance of ParseError are signaled on any parsing error. \x0aSee `Smalltalk >> #parse:`"
  15299. smalltalk.addClass('SemanticError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  15300. 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"
  15301. smalltalk.addClass('InliningError', smalltalk.SemanticError, [], 'Compiler-Exceptions');
  15302. smalltalk.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`."
  15303. smalltalk.addClass('InvalidAssignmentError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15304. smalltalk.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned."
  15305. smalltalk.addMethod(
  15306. "_messageText",
  15307. smalltalk.method({
  15308. selector: "messageText",
  15309. category: 'accessing',
  15310. fn: function (){
  15311. var self=this;
  15312. var $1;
  15313. $1=smalltalk.send(" Invalid assignment to variable: ","__comma",[smalltalk.send(self,"_variableName",[])]);
  15314. return $1;
  15315. },
  15316. args: [],
  15317. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  15318. messageSends: [",", "variableName"],
  15319. referencedClasses: []
  15320. }),
  15321. smalltalk.InvalidAssignmentError);
  15322. smalltalk.addMethod(
  15323. "_variableName",
  15324. smalltalk.method({
  15325. selector: "variableName",
  15326. category: 'accessing',
  15327. fn: function (){
  15328. var self=this;
  15329. return self["@variableName"];
  15330. },
  15331. args: [],
  15332. source: "variableName\x0a\x09^ variableName",
  15333. messageSends: [],
  15334. referencedClasses: []
  15335. }),
  15336. smalltalk.InvalidAssignmentError);
  15337. smalltalk.addMethod(
  15338. "_variableName_",
  15339. smalltalk.method({
  15340. selector: "variableName:",
  15341. category: 'accessing',
  15342. fn: function (aString){
  15343. var self=this;
  15344. self["@variableName"]=aString;
  15345. return self},
  15346. args: ["aString"],
  15347. source: "variableName: aString\x0a\x09variableName := aString",
  15348. messageSends: [],
  15349. referencedClasses: []
  15350. }),
  15351. smalltalk.InvalidAssignmentError);
  15352. smalltalk.addClass('ShadowingVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15353. 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."
  15354. smalltalk.addMethod(
  15355. "_messageText",
  15356. smalltalk.method({
  15357. selector: "messageText",
  15358. category: 'accessing',
  15359. fn: function (){
  15360. var self=this;
  15361. var $1;
  15362. $1=smalltalk.send(smalltalk.send("Variable shadowing error: ","__comma",[smalltalk.send(self,"_variableName",[])]),"__comma",[" is already defined"]);
  15363. return $1;
  15364. },
  15365. args: [],
  15366. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  15367. messageSends: [",", "variableName"],
  15368. referencedClasses: []
  15369. }),
  15370. smalltalk.ShadowingVariableError);
  15371. smalltalk.addMethod(
  15372. "_variableName",
  15373. smalltalk.method({
  15374. selector: "variableName",
  15375. category: 'accessing',
  15376. fn: function (){
  15377. var self=this;
  15378. return self["@variableName"];
  15379. },
  15380. args: [],
  15381. source: "variableName\x0a\x09^ variableName",
  15382. messageSends: [],
  15383. referencedClasses: []
  15384. }),
  15385. smalltalk.ShadowingVariableError);
  15386. smalltalk.addMethod(
  15387. "_variableName_",
  15388. smalltalk.method({
  15389. selector: "variableName:",
  15390. category: 'accessing',
  15391. fn: function (aString){
  15392. var self=this;
  15393. self["@variableName"]=aString;
  15394. return self},
  15395. args: ["aString"],
  15396. source: "variableName: aString\x0a\x09variableName := aString",
  15397. messageSends: [],
  15398. referencedClasses: []
  15399. }),
  15400. smalltalk.ShadowingVariableError);
  15401. smalltalk.addClass('UnknownVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15402. 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."
  15403. smalltalk.addMethod(
  15404. "_messageText",
  15405. smalltalk.method({
  15406. selector: "messageText",
  15407. category: 'accessing',
  15408. fn: function (){
  15409. var self=this;
  15410. var $1;
  15411. $1=smalltalk.send(smalltalk.send("Unknown Variable error: ","__comma",[smalltalk.send(self,"_variableName",[])]),"__comma",[" is not defined"]);
  15412. return $1;
  15413. },
  15414. args: [],
  15415. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  15416. messageSends: [",", "variableName"],
  15417. referencedClasses: []
  15418. }),
  15419. smalltalk.UnknownVariableError);
  15420. smalltalk.addMethod(
  15421. "_variableName",
  15422. smalltalk.method({
  15423. selector: "variableName",
  15424. category: 'accessing',
  15425. fn: function (){
  15426. var self=this;
  15427. return self["@variableName"];
  15428. },
  15429. args: [],
  15430. source: "variableName\x0a\x09^ variableName",
  15431. messageSends: [],
  15432. referencedClasses: []
  15433. }),
  15434. smalltalk.UnknownVariableError);
  15435. smalltalk.addMethod(
  15436. "_variableName_",
  15437. smalltalk.method({
  15438. selector: "variableName:",
  15439. category: 'accessing',
  15440. fn: function (aString){
  15441. var self=this;
  15442. self["@variableName"]=aString;
  15443. return self},
  15444. args: ["aString"],
  15445. source: "variableName: aString\x0a\x09variableName := aString",
  15446. messageSends: [],
  15447. referencedClasses: []
  15448. }),
  15449. smalltalk.UnknownVariableError);
  15450. smalltalk.addPackage('Compiler-AST', {});
  15451. smalltalk.addClass('Node', smalltalk.Object, ['nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  15452. smalltalk.Node.comment="I am the abstract root class of the abstract syntax tree."
  15453. smalltalk.addMethod(
  15454. "_accept_",
  15455. smalltalk.method({
  15456. selector: "accept:",
  15457. category: 'visiting',
  15458. fn: function (aVisitor){
  15459. var self=this;
  15460. var $1;
  15461. $1=smalltalk.send(aVisitor,"_visitNode_",[self]);
  15462. return $1;
  15463. },
  15464. args: ["aVisitor"],
  15465. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  15466. messageSends: ["visitNode:"],
  15467. referencedClasses: []
  15468. }),
  15469. smalltalk.Node);
  15470. smalltalk.addMethod(
  15471. "_addNode_",
  15472. smalltalk.method({
  15473. selector: "addNode:",
  15474. category: 'accessing',
  15475. fn: function (aNode){
  15476. var self=this;
  15477. smalltalk.send(smalltalk.send(self,"_nodes",[]),"_add_",[aNode]);
  15478. return self},
  15479. args: ["aNode"],
  15480. source: "addNode: aNode\x0a\x09self nodes add: aNode",
  15481. messageSends: ["add:", "nodes"],
  15482. referencedClasses: []
  15483. }),
  15484. smalltalk.Node);
  15485. smalltalk.addMethod(
  15486. "_isAssignmentNode",
  15487. smalltalk.method({
  15488. selector: "isAssignmentNode",
  15489. category: 'testing',
  15490. fn: function (){
  15491. var self=this;
  15492. return false;
  15493. },
  15494. args: [],
  15495. source: "isAssignmentNode\x0a\x09^ false",
  15496. messageSends: [],
  15497. referencedClasses: []
  15498. }),
  15499. smalltalk.Node);
  15500. smalltalk.addMethod(
  15501. "_isBlockNode",
  15502. smalltalk.method({
  15503. selector: "isBlockNode",
  15504. category: 'testing',
  15505. fn: function (){
  15506. var self=this;
  15507. return false;
  15508. },
  15509. args: [],
  15510. source: "isBlockNode\x0a\x09^false",
  15511. messageSends: [],
  15512. referencedClasses: []
  15513. }),
  15514. smalltalk.Node);
  15515. smalltalk.addMethod(
  15516. "_isBlockSequenceNode",
  15517. smalltalk.method({
  15518. selector: "isBlockSequenceNode",
  15519. category: 'testing',
  15520. fn: function (){
  15521. var self=this;
  15522. return false;
  15523. },
  15524. args: [],
  15525. source: "isBlockSequenceNode\x0a\x09^false",
  15526. messageSends: [],
  15527. referencedClasses: []
  15528. }),
  15529. smalltalk.Node);
  15530. smalltalk.addMethod(
  15531. "_isImmutable",
  15532. smalltalk.method({
  15533. selector: "isImmutable",
  15534. category: 'testing',
  15535. fn: function (){
  15536. var self=this;
  15537. return false;
  15538. },
  15539. args: [],
  15540. source: "isImmutable\x0a\x09^false",
  15541. messageSends: [],
  15542. referencedClasses: []
  15543. }),
  15544. smalltalk.Node);
  15545. smalltalk.addMethod(
  15546. "_isReturnNode",
  15547. smalltalk.method({
  15548. selector: "isReturnNode",
  15549. category: 'testing',
  15550. fn: function (){
  15551. var self=this;
  15552. return false;
  15553. },
  15554. args: [],
  15555. source: "isReturnNode\x0a\x09^false",
  15556. messageSends: [],
  15557. referencedClasses: []
  15558. }),
  15559. smalltalk.Node);
  15560. smalltalk.addMethod(
  15561. "_isSendNode",
  15562. smalltalk.method({
  15563. selector: "isSendNode",
  15564. category: 'testing',
  15565. fn: function (){
  15566. var self=this;
  15567. return false;
  15568. },
  15569. args: [],
  15570. source: "isSendNode\x0a\x09^false",
  15571. messageSends: [],
  15572. referencedClasses: []
  15573. }),
  15574. smalltalk.Node);
  15575. smalltalk.addMethod(
  15576. "_isValueNode",
  15577. smalltalk.method({
  15578. selector: "isValueNode",
  15579. category: 'testing',
  15580. fn: function (){
  15581. var self=this;
  15582. return false;
  15583. },
  15584. args: [],
  15585. source: "isValueNode\x0a\x09^false",
  15586. messageSends: [],
  15587. referencedClasses: []
  15588. }),
  15589. smalltalk.Node);
  15590. smalltalk.addMethod(
  15591. "_nodes",
  15592. smalltalk.method({
  15593. selector: "nodes",
  15594. category: 'accessing',
  15595. fn: function (){
  15596. var self=this;
  15597. var $1;
  15598. if(($receiver = self["@nodes"]) == nil || $receiver == undefined){
  15599. self["@nodes"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  15600. $1=self["@nodes"];
  15601. } else {
  15602. $1=self["@nodes"];
  15603. };
  15604. return $1;
  15605. },
  15606. args: [],
  15607. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  15608. messageSends: ["ifNil:", "new"],
  15609. referencedClasses: ["Array"]
  15610. }),
  15611. smalltalk.Node);
  15612. smalltalk.addMethod(
  15613. "_nodes_",
  15614. smalltalk.method({
  15615. selector: "nodes:",
  15616. category: 'building',
  15617. fn: function (aCollection){
  15618. var self=this;
  15619. self["@nodes"]=aCollection;
  15620. return self},
  15621. args: ["aCollection"],
  15622. source: "nodes: aCollection\x0a\x09nodes := aCollection",
  15623. messageSends: [],
  15624. referencedClasses: []
  15625. }),
  15626. smalltalk.Node);
  15627. smalltalk.addMethod(
  15628. "_shouldBeAliased",
  15629. smalltalk.method({
  15630. selector: "shouldBeAliased",
  15631. category: 'accessing',
  15632. fn: function (){
  15633. var self=this;
  15634. var $1;
  15635. if(($receiver = self["@shouldBeAliased"]) == nil || $receiver == undefined){
  15636. $1=false;
  15637. } else {
  15638. $1=self["@shouldBeAliased"];
  15639. };
  15640. return $1;
  15641. },
  15642. args: [],
  15643. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  15644. messageSends: ["ifNil:"],
  15645. referencedClasses: []
  15646. }),
  15647. smalltalk.Node);
  15648. smalltalk.addMethod(
  15649. "_shouldBeAliased_",
  15650. smalltalk.method({
  15651. selector: "shouldBeAliased:",
  15652. category: 'accessing',
  15653. fn: function (aBoolean){
  15654. var self=this;
  15655. self["@shouldBeAliased"]=aBoolean;
  15656. return self},
  15657. args: ["aBoolean"],
  15658. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  15659. messageSends: [],
  15660. referencedClasses: []
  15661. }),
  15662. smalltalk.Node);
  15663. smalltalk.addMethod(
  15664. "_shouldBeInlined",
  15665. smalltalk.method({
  15666. selector: "shouldBeInlined",
  15667. category: 'accessing',
  15668. fn: function (){
  15669. var self=this;
  15670. var $1;
  15671. if(($receiver = self["@shouldBeInlined"]) == nil || $receiver == undefined){
  15672. $1=false;
  15673. } else {
  15674. $1=self["@shouldBeInlined"];
  15675. };
  15676. return $1;
  15677. },
  15678. args: [],
  15679. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  15680. messageSends: ["ifNil:"],
  15681. referencedClasses: []
  15682. }),
  15683. smalltalk.Node);
  15684. smalltalk.addMethod(
  15685. "_shouldBeInlined_",
  15686. smalltalk.method({
  15687. selector: "shouldBeInlined:",
  15688. category: 'accessing',
  15689. fn: function (aBoolean){
  15690. var self=this;
  15691. self["@shouldBeInlined"]=aBoolean;
  15692. return self},
  15693. args: ["aBoolean"],
  15694. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  15695. messageSends: [],
  15696. referencedClasses: []
  15697. }),
  15698. smalltalk.Node);
  15699. smalltalk.addMethod(
  15700. "_subtreeNeedsAliasing",
  15701. smalltalk.method({
  15702. selector: "subtreeNeedsAliasing",
  15703. category: 'testing',
  15704. fn: function (){
  15705. var self=this;
  15706. var $1;
  15707. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_shouldBeAliased",[]),"_or_",[(function(){
  15708. return smalltalk.send(self,"_shouldBeInlined",[]);
  15709. })]),"_or_",[(function(){
  15710. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_detect_ifNone_",[(function(node){
  15711. return smalltalk.send(node,"_subtreeNeedsAliasing",[]);
  15712. }),(function(){
  15713. return false;
  15714. })]),"_~_eq",[false]);
  15715. })]);
  15716. return $1;
  15717. },
  15718. args: [],
  15719. source: "subtreeNeedsAliasing\x0a ^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a (self nodes detect: [ :node | node subtreeNeedsAliasing ] ifNone: [ false ]) ~= false\x0a ]",
  15720. messageSends: ["or:", "~=", "detect:ifNone:", "subtreeNeedsAliasing", "nodes", "shouldBeInlined", "shouldBeAliased"],
  15721. referencedClasses: []
  15722. }),
  15723. smalltalk.Node);
  15724. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler-AST');
  15725. smalltalk.addMethod(
  15726. "_accept_",
  15727. smalltalk.method({
  15728. selector: "accept:",
  15729. category: 'visiting',
  15730. fn: function (aVisitor){
  15731. var self=this;
  15732. var $1;
  15733. $1=smalltalk.send(aVisitor,"_visitAssignmentNode_",[self]);
  15734. return $1;
  15735. },
  15736. args: ["aVisitor"],
  15737. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  15738. messageSends: ["visitAssignmentNode:"],
  15739. referencedClasses: []
  15740. }),
  15741. smalltalk.AssignmentNode);
  15742. smalltalk.addMethod(
  15743. "_isAssignmentNode",
  15744. smalltalk.method({
  15745. selector: "isAssignmentNode",
  15746. category: 'testing',
  15747. fn: function (){
  15748. var self=this;
  15749. return true;
  15750. },
  15751. args: [],
  15752. source: "isAssignmentNode\x0a\x09^ true",
  15753. messageSends: [],
  15754. referencedClasses: []
  15755. }),
  15756. smalltalk.AssignmentNode);
  15757. smalltalk.addMethod(
  15758. "_left",
  15759. smalltalk.method({
  15760. selector: "left",
  15761. category: 'accessing',
  15762. fn: function (){
  15763. var self=this;
  15764. return self["@left"];
  15765. },
  15766. args: [],
  15767. source: "left\x0a\x09^left",
  15768. messageSends: [],
  15769. referencedClasses: []
  15770. }),
  15771. smalltalk.AssignmentNode);
  15772. smalltalk.addMethod(
  15773. "_left_",
  15774. smalltalk.method({
  15775. selector: "left:",
  15776. category: 'accessing',
  15777. fn: function (aNode){
  15778. var self=this;
  15779. self["@left"]=aNode;
  15780. return self},
  15781. args: ["aNode"],
  15782. source: "left: aNode\x0a\x09left := aNode",
  15783. messageSends: [],
  15784. referencedClasses: []
  15785. }),
  15786. smalltalk.AssignmentNode);
  15787. smalltalk.addMethod(
  15788. "_nodes",
  15789. smalltalk.method({
  15790. selector: "nodes",
  15791. category: 'accessing',
  15792. fn: function (){
  15793. var self=this;
  15794. var $1;
  15795. $1=smalltalk.send((smalltalk.Array || Array),"_with_with_",[smalltalk.send(self,"_left",[]),smalltalk.send(self,"_right",[])]);
  15796. return $1;
  15797. },
  15798. args: [],
  15799. source: "nodes\x0a\x09^ Array with: self left with: self right",
  15800. messageSends: ["with:with:", "left", "right"],
  15801. referencedClasses: ["Array"]
  15802. }),
  15803. smalltalk.AssignmentNode);
  15804. smalltalk.addMethod(
  15805. "_right",
  15806. smalltalk.method({
  15807. selector: "right",
  15808. category: 'accessing',
  15809. fn: function (){
  15810. var self=this;
  15811. return self["@right"];
  15812. },
  15813. args: [],
  15814. source: "right\x0a\x09^right",
  15815. messageSends: [],
  15816. referencedClasses: []
  15817. }),
  15818. smalltalk.AssignmentNode);
  15819. smalltalk.addMethod(
  15820. "_right_",
  15821. smalltalk.method({
  15822. selector: "right:",
  15823. category: 'accessing',
  15824. fn: function (aNode){
  15825. var self=this;
  15826. self["@right"]=aNode;
  15827. return self},
  15828. args: ["aNode"],
  15829. source: "right: aNode\x0a\x09right := aNode",
  15830. messageSends: [],
  15831. referencedClasses: []
  15832. }),
  15833. smalltalk.AssignmentNode);
  15834. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'scope'], 'Compiler-AST');
  15835. smalltalk.addMethod(
  15836. "_accept_",
  15837. smalltalk.method({
  15838. selector: "accept:",
  15839. category: 'visiting',
  15840. fn: function (aVisitor){
  15841. var self=this;
  15842. var $1;
  15843. $1=smalltalk.send(aVisitor,"_visitBlockNode_",[self]);
  15844. return $1;
  15845. },
  15846. args: ["aVisitor"],
  15847. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  15848. messageSends: ["visitBlockNode:"],
  15849. referencedClasses: []
  15850. }),
  15851. smalltalk.BlockNode);
  15852. smalltalk.addMethod(
  15853. "_isBlockNode",
  15854. smalltalk.method({
  15855. selector: "isBlockNode",
  15856. category: 'testing',
  15857. fn: function (){
  15858. var self=this;
  15859. return true;
  15860. },
  15861. args: [],
  15862. source: "isBlockNode\x0a\x09^true",
  15863. messageSends: [],
  15864. referencedClasses: []
  15865. }),
  15866. smalltalk.BlockNode);
  15867. smalltalk.addMethod(
  15868. "_parameters",
  15869. smalltalk.method({
  15870. selector: "parameters",
  15871. category: 'accessing',
  15872. fn: function (){
  15873. var self=this;
  15874. var $1;
  15875. if(($receiver = self["@parameters"]) == nil || $receiver == undefined){
  15876. self["@parameters"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  15877. $1=self["@parameters"];
  15878. } else {
  15879. $1=self["@parameters"];
  15880. };
  15881. return $1;
  15882. },
  15883. args: [],
  15884. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  15885. messageSends: ["ifNil:", "new"],
  15886. referencedClasses: ["Array"]
  15887. }),
  15888. smalltalk.BlockNode);
  15889. smalltalk.addMethod(
  15890. "_parameters_",
  15891. smalltalk.method({
  15892. selector: "parameters:",
  15893. category: 'accessing',
  15894. fn: function (aCollection){
  15895. var self=this;
  15896. self["@parameters"]=aCollection;
  15897. return self},
  15898. args: ["aCollection"],
  15899. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  15900. messageSends: [],
  15901. referencedClasses: []
  15902. }),
  15903. smalltalk.BlockNode);
  15904. smalltalk.addMethod(
  15905. "_scope",
  15906. smalltalk.method({
  15907. selector: "scope",
  15908. category: 'accessing',
  15909. fn: function (){
  15910. var self=this;
  15911. return self["@scope"];
  15912. },
  15913. args: [],
  15914. source: "scope\x0a\x09^ scope",
  15915. messageSends: [],
  15916. referencedClasses: []
  15917. }),
  15918. smalltalk.BlockNode);
  15919. smalltalk.addMethod(
  15920. "_scope_",
  15921. smalltalk.method({
  15922. selector: "scope:",
  15923. category: 'accessing',
  15924. fn: function (aLexicalScope){
  15925. var self=this;
  15926. self["@scope"]=aLexicalScope;
  15927. return self},
  15928. args: ["aLexicalScope"],
  15929. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  15930. messageSends: [],
  15931. referencedClasses: []
  15932. }),
  15933. smalltalk.BlockNode);
  15934. smalltalk.addMethod(
  15935. "_subtreeNeedsAliasing",
  15936. smalltalk.method({
  15937. selector: "subtreeNeedsAliasing",
  15938. category: 'testing',
  15939. fn: function (){
  15940. var self=this;
  15941. var $1;
  15942. $1=smalltalk.send(smalltalk.send(self,"_shouldBeAliased",[]),"_or_",[(function(){
  15943. return smalltalk.send(self,"_shouldBeInlined",[]);
  15944. })]);
  15945. return $1;
  15946. },
  15947. args: [],
  15948. source: "subtreeNeedsAliasing\x0a ^self shouldBeAliased or: [ self shouldBeInlined ]",
  15949. messageSends: ["or:", "shouldBeInlined", "shouldBeAliased"],
  15950. referencedClasses: []
  15951. }),
  15952. smalltalk.BlockNode);
  15953. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler-AST');
  15954. smalltalk.addMethod(
  15955. "_accept_",
  15956. smalltalk.method({
  15957. selector: "accept:",
  15958. category: 'visiting',
  15959. fn: function (aVisitor){
  15960. var self=this;
  15961. var $1;
  15962. $1=smalltalk.send(aVisitor,"_visitCascadeNode_",[self]);
  15963. return $1;
  15964. },
  15965. args: ["aVisitor"],
  15966. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  15967. messageSends: ["visitCascadeNode:"],
  15968. referencedClasses: []
  15969. }),
  15970. smalltalk.CascadeNode);
  15971. smalltalk.addMethod(
  15972. "_receiver",
  15973. smalltalk.method({
  15974. selector: "receiver",
  15975. category: 'accessing',
  15976. fn: function (){
  15977. var self=this;
  15978. return self["@receiver"];
  15979. },
  15980. args: [],
  15981. source: "receiver\x0a\x09^receiver",
  15982. messageSends: [],
  15983. referencedClasses: []
  15984. }),
  15985. smalltalk.CascadeNode);
  15986. smalltalk.addMethod(
  15987. "_receiver_",
  15988. smalltalk.method({
  15989. selector: "receiver:",
  15990. category: 'accessing',
  15991. fn: function (aNode){
  15992. var self=this;
  15993. self["@receiver"]=aNode;
  15994. return self},
  15995. args: ["aNode"],
  15996. source: "receiver: aNode\x0a\x09receiver := aNode",
  15997. messageSends: [],
  15998. referencedClasses: []
  15999. }),
  16000. smalltalk.CascadeNode);
  16001. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler-AST');
  16002. smalltalk.addMethod(
  16003. "_accept_",
  16004. smalltalk.method({
  16005. selector: "accept:",
  16006. category: 'visiting',
  16007. fn: function (aVisitor){
  16008. var self=this;
  16009. var $1;
  16010. $1=smalltalk.send(aVisitor,"_visitDynamicArrayNode_",[self]);
  16011. return $1;
  16012. },
  16013. args: ["aVisitor"],
  16014. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  16015. messageSends: ["visitDynamicArrayNode:"],
  16016. referencedClasses: []
  16017. }),
  16018. smalltalk.DynamicArrayNode);
  16019. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler-AST');
  16020. smalltalk.addMethod(
  16021. "_accept_",
  16022. smalltalk.method({
  16023. selector: "accept:",
  16024. category: 'visiting',
  16025. fn: function (aVisitor){
  16026. var self=this;
  16027. var $1;
  16028. $1=smalltalk.send(aVisitor,"_visitDynamicDictionaryNode_",[self]);
  16029. return $1;
  16030. },
  16031. args: ["aVisitor"],
  16032. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  16033. messageSends: ["visitDynamicDictionaryNode:"],
  16034. referencedClasses: []
  16035. }),
  16036. smalltalk.DynamicDictionaryNode);
  16037. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler-AST');
  16038. smalltalk.addMethod(
  16039. "_accept_",
  16040. smalltalk.method({
  16041. selector: "accept:",
  16042. category: 'visiting',
  16043. fn: function (aVisitor){
  16044. var self=this;
  16045. var $1;
  16046. $1=smalltalk.send(aVisitor,"_visitJSStatementNode_",[self]);
  16047. return $1;
  16048. },
  16049. args: ["aVisitor"],
  16050. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  16051. messageSends: ["visitJSStatementNode:"],
  16052. referencedClasses: []
  16053. }),
  16054. smalltalk.JSStatementNode);
  16055. smalltalk.addMethod(
  16056. "_source",
  16057. smalltalk.method({
  16058. selector: "source",
  16059. category: 'accessing',
  16060. fn: function (){
  16061. var self=this;
  16062. var $1;
  16063. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  16064. $1="";
  16065. } else {
  16066. $1=self["@source"];
  16067. };
  16068. return $1;
  16069. },
  16070. args: [],
  16071. source: "source\x0a\x09^source ifNil: ['']",
  16072. messageSends: ["ifNil:"],
  16073. referencedClasses: []
  16074. }),
  16075. smalltalk.JSStatementNode);
  16076. smalltalk.addMethod(
  16077. "_source_",
  16078. smalltalk.method({
  16079. selector: "source:",
  16080. category: 'accessing',
  16081. fn: function (aString){
  16082. var self=this;
  16083. self["@source"]=aString;
  16084. return self},
  16085. args: ["aString"],
  16086. source: "source: aString\x0a\x09source := aString",
  16087. messageSends: [],
  16088. referencedClasses: []
  16089. }),
  16090. smalltalk.JSStatementNode);
  16091. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'messageSends'], 'Compiler-AST');
  16092. smalltalk.addMethod(
  16093. "_accept_",
  16094. smalltalk.method({
  16095. selector: "accept:",
  16096. category: 'visiting',
  16097. fn: function (aVisitor){
  16098. var self=this;
  16099. var $1;
  16100. $1=smalltalk.send(aVisitor,"_visitMethodNode_",[self]);
  16101. return $1;
  16102. },
  16103. args: ["aVisitor"],
  16104. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  16105. messageSends: ["visitMethodNode:"],
  16106. referencedClasses: []
  16107. }),
  16108. smalltalk.MethodNode);
  16109. smalltalk.addMethod(
  16110. "_arguments",
  16111. smalltalk.method({
  16112. selector: "arguments",
  16113. category: 'accessing',
  16114. fn: function (){
  16115. var self=this;
  16116. var $1;
  16117. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  16118. $1=[];
  16119. } else {
  16120. $1=self["@arguments"];
  16121. };
  16122. return $1;
  16123. },
  16124. args: [],
  16125. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  16126. messageSends: ["ifNil:"],
  16127. referencedClasses: []
  16128. }),
  16129. smalltalk.MethodNode);
  16130. smalltalk.addMethod(
  16131. "_arguments_",
  16132. smalltalk.method({
  16133. selector: "arguments:",
  16134. category: 'accessing',
  16135. fn: function (aCollection){
  16136. var self=this;
  16137. self["@arguments"]=aCollection;
  16138. return self},
  16139. args: ["aCollection"],
  16140. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  16141. messageSends: [],
  16142. referencedClasses: []
  16143. }),
  16144. smalltalk.MethodNode);
  16145. smalltalk.addMethod(
  16146. "_classReferences",
  16147. smalltalk.method({
  16148. selector: "classReferences",
  16149. category: 'accessing',
  16150. fn: function (){
  16151. var self=this;
  16152. return self["@classReferences"];
  16153. },
  16154. args: [],
  16155. source: "classReferences\x0a\x09^ classReferences",
  16156. messageSends: [],
  16157. referencedClasses: []
  16158. }),
  16159. smalltalk.MethodNode);
  16160. smalltalk.addMethod(
  16161. "_classReferences_",
  16162. smalltalk.method({
  16163. selector: "classReferences:",
  16164. category: 'accessing',
  16165. fn: function (aCollection){
  16166. var self=this;
  16167. self["@classReferences"]=aCollection;
  16168. return self},
  16169. args: ["aCollection"],
  16170. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  16171. messageSends: [],
  16172. referencedClasses: []
  16173. }),
  16174. smalltalk.MethodNode);
  16175. smalltalk.addMethod(
  16176. "_messageSends",
  16177. smalltalk.method({
  16178. selector: "messageSends",
  16179. category: 'accessing',
  16180. fn: function (){
  16181. var self=this;
  16182. return self["@messageSends"];
  16183. },
  16184. args: [],
  16185. source: "messageSends\x0a\x09^ messageSends",
  16186. messageSends: [],
  16187. referencedClasses: []
  16188. }),
  16189. smalltalk.MethodNode);
  16190. smalltalk.addMethod(
  16191. "_messageSends_",
  16192. smalltalk.method({
  16193. selector: "messageSends:",
  16194. category: 'accessing',
  16195. fn: function (aCollection){
  16196. var self=this;
  16197. self["@messageSends"]=aCollection;
  16198. return self},
  16199. args: ["aCollection"],
  16200. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  16201. messageSends: [],
  16202. referencedClasses: []
  16203. }),
  16204. smalltalk.MethodNode);
  16205. smalltalk.addMethod(
  16206. "_scope",
  16207. smalltalk.method({
  16208. selector: "scope",
  16209. category: 'accessing',
  16210. fn: function (){
  16211. var self=this;
  16212. return self["@scope"];
  16213. },
  16214. args: [],
  16215. source: "scope\x0a\x09^ scope",
  16216. messageSends: [],
  16217. referencedClasses: []
  16218. }),
  16219. smalltalk.MethodNode);
  16220. smalltalk.addMethod(
  16221. "_scope_",
  16222. smalltalk.method({
  16223. selector: "scope:",
  16224. category: 'accessing',
  16225. fn: function (aMethodScope){
  16226. var self=this;
  16227. self["@scope"]=aMethodScope;
  16228. return self},
  16229. args: ["aMethodScope"],
  16230. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  16231. messageSends: [],
  16232. referencedClasses: []
  16233. }),
  16234. smalltalk.MethodNode);
  16235. smalltalk.addMethod(
  16236. "_selector",
  16237. smalltalk.method({
  16238. selector: "selector",
  16239. category: 'accessing',
  16240. fn: function (){
  16241. var self=this;
  16242. return self["@selector"];
  16243. },
  16244. args: [],
  16245. source: "selector\x0a\x09^selector",
  16246. messageSends: [],
  16247. referencedClasses: []
  16248. }),
  16249. smalltalk.MethodNode);
  16250. smalltalk.addMethod(
  16251. "_selector_",
  16252. smalltalk.method({
  16253. selector: "selector:",
  16254. category: 'accessing',
  16255. fn: function (aString){
  16256. var self=this;
  16257. self["@selector"]=aString;
  16258. return self},
  16259. args: ["aString"],
  16260. source: "selector: aString\x0a\x09selector := aString",
  16261. messageSends: [],
  16262. referencedClasses: []
  16263. }),
  16264. smalltalk.MethodNode);
  16265. smalltalk.addMethod(
  16266. "_source",
  16267. smalltalk.method({
  16268. selector: "source",
  16269. category: 'accessing',
  16270. fn: function (){
  16271. var self=this;
  16272. return self["@source"];
  16273. },
  16274. args: [],
  16275. source: "source\x0a\x09^source",
  16276. messageSends: [],
  16277. referencedClasses: []
  16278. }),
  16279. smalltalk.MethodNode);
  16280. smalltalk.addMethod(
  16281. "_source_",
  16282. smalltalk.method({
  16283. selector: "source:",
  16284. category: 'accessing',
  16285. fn: function (aString){
  16286. var self=this;
  16287. self["@source"]=aString;
  16288. return self},
  16289. args: ["aString"],
  16290. source: "source: aString\x0a\x09source := aString",
  16291. messageSends: [],
  16292. referencedClasses: []
  16293. }),
  16294. smalltalk.MethodNode);
  16295. smalltalk.addClass('ReturnNode', smalltalk.Node, ['scope'], 'Compiler-AST');
  16296. smalltalk.addMethod(
  16297. "_accept_",
  16298. smalltalk.method({
  16299. selector: "accept:",
  16300. category: 'visiting',
  16301. fn: function (aVisitor){
  16302. var self=this;
  16303. var $1;
  16304. $1=smalltalk.send(aVisitor,"_visitReturnNode_",[self]);
  16305. return $1;
  16306. },
  16307. args: ["aVisitor"],
  16308. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  16309. messageSends: ["visitReturnNode:"],
  16310. referencedClasses: []
  16311. }),
  16312. smalltalk.ReturnNode);
  16313. smalltalk.addMethod(
  16314. "_isReturnNode",
  16315. smalltalk.method({
  16316. selector: "isReturnNode",
  16317. category: 'testing',
  16318. fn: function (){
  16319. var self=this;
  16320. return true;
  16321. },
  16322. args: [],
  16323. source: "isReturnNode\x0a\x09^ true",
  16324. messageSends: [],
  16325. referencedClasses: []
  16326. }),
  16327. smalltalk.ReturnNode);
  16328. smalltalk.addMethod(
  16329. "_nonLocalReturn",
  16330. smalltalk.method({
  16331. selector: "nonLocalReturn",
  16332. category: 'testing',
  16333. fn: function (){
  16334. var self=this;
  16335. var $1;
  16336. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_scope",[]),"_isMethodScope",[]),"_not",[]);
  16337. return $1;
  16338. },
  16339. args: [],
  16340. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  16341. messageSends: ["not", "isMethodScope", "scope"],
  16342. referencedClasses: []
  16343. }),
  16344. smalltalk.ReturnNode);
  16345. smalltalk.addMethod(
  16346. "_scope",
  16347. smalltalk.method({
  16348. selector: "scope",
  16349. category: 'accessing',
  16350. fn: function (){
  16351. var self=this;
  16352. return self["@scope"];
  16353. },
  16354. args: [],
  16355. source: "scope\x0a\x09^ scope",
  16356. messageSends: [],
  16357. referencedClasses: []
  16358. }),
  16359. smalltalk.ReturnNode);
  16360. smalltalk.addMethod(
  16361. "_scope_",
  16362. smalltalk.method({
  16363. selector: "scope:",
  16364. category: 'accessing',
  16365. fn: function (aLexicalScope){
  16366. var self=this;
  16367. self["@scope"]=aLexicalScope;
  16368. return self},
  16369. args: ["aLexicalScope"],
  16370. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  16371. messageSends: [],
  16372. referencedClasses: []
  16373. }),
  16374. smalltalk.ReturnNode);
  16375. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  16376. smalltalk.addMethod(
  16377. "_accept_",
  16378. smalltalk.method({
  16379. selector: "accept:",
  16380. category: 'visiting',
  16381. fn: function (aVisitor){
  16382. var self=this;
  16383. var $1;
  16384. $1=smalltalk.send(aVisitor,"_visitSendNode_",[self]);
  16385. return $1;
  16386. },
  16387. args: ["aVisitor"],
  16388. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  16389. messageSends: ["visitSendNode:"],
  16390. referencedClasses: []
  16391. }),
  16392. smalltalk.SendNode);
  16393. smalltalk.addMethod(
  16394. "_arguments",
  16395. smalltalk.method({
  16396. selector: "arguments",
  16397. category: 'accessing',
  16398. fn: function (){
  16399. var self=this;
  16400. var $1;
  16401. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  16402. self["@arguments"]=[];
  16403. $1=self["@arguments"];
  16404. } else {
  16405. $1=self["@arguments"];
  16406. };
  16407. return $1;
  16408. },
  16409. args: [],
  16410. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  16411. messageSends: ["ifNil:"],
  16412. referencedClasses: []
  16413. }),
  16414. smalltalk.SendNode);
  16415. smalltalk.addMethod(
  16416. "_arguments_",
  16417. smalltalk.method({
  16418. selector: "arguments:",
  16419. category: 'accessing',
  16420. fn: function (aCollection){
  16421. var self=this;
  16422. self["@arguments"]=aCollection;
  16423. return self},
  16424. args: ["aCollection"],
  16425. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  16426. messageSends: [],
  16427. referencedClasses: []
  16428. }),
  16429. smalltalk.SendNode);
  16430. smalltalk.addMethod(
  16431. "_cascadeNodeWithMessages_",
  16432. smalltalk.method({
  16433. selector: "cascadeNodeWithMessages:",
  16434. category: 'accessing',
  16435. fn: function (aCollection){
  16436. var self=this;
  16437. var $1,$2,$4,$5,$3;
  16438. var first;
  16439. $1=smalltalk.send((smalltalk.SendNode || SendNode),"_new",[]);
  16440. smalltalk.send($1,"_selector_",[smalltalk.send(self,"_selector",[])]);
  16441. smalltalk.send($1,"_arguments_",[smalltalk.send(self,"_arguments",[])]);
  16442. $2=smalltalk.send($1,"_yourself",[]);
  16443. first=$2;
  16444. $4=smalltalk.send((smalltalk.CascadeNode || CascadeNode),"_new",[]);
  16445. smalltalk.send($4,"_receiver_",[smalltalk.send(self,"_receiver",[])]);
  16446. smalltalk.send($4,"_nodes_",[smalltalk.send(smalltalk.send((smalltalk.Array || Array),"_with_",[first]),"__comma",[aCollection])]);
  16447. $5=smalltalk.send($4,"_yourself",[]);
  16448. $3=$5;
  16449. return $3;
  16450. },
  16451. args: ["aCollection"],
  16452. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09 selector: self selector;\x0a\x09 arguments: self arguments;\x0a\x09 yourself.\x0a\x09^CascadeNode new\x0a\x09 receiver: self receiver;\x0a\x09 nodes: (Array with: first), aCollection;\x0a\x09 yourself",
  16453. messageSends: ["selector:", "selector", "new", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  16454. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  16455. }),
  16456. smalltalk.SendNode);
  16457. smalltalk.addMethod(
  16458. "_index",
  16459. smalltalk.method({
  16460. selector: "index",
  16461. category: 'accessing',
  16462. fn: function (){
  16463. var self=this;
  16464. return self["@index"];
  16465. },
  16466. args: [],
  16467. source: "index\x0a\x09^ index",
  16468. messageSends: [],
  16469. referencedClasses: []
  16470. }),
  16471. smalltalk.SendNode);
  16472. smalltalk.addMethod(
  16473. "_index_",
  16474. smalltalk.method({
  16475. selector: "index:",
  16476. category: 'accessing',
  16477. fn: function (anInteger){
  16478. var self=this;
  16479. self["@index"]=anInteger;
  16480. return self},
  16481. args: ["anInteger"],
  16482. source: "index: anInteger\x0a\x09index := anInteger",
  16483. messageSends: [],
  16484. referencedClasses: []
  16485. }),
  16486. smalltalk.SendNode);
  16487. smalltalk.addMethod(
  16488. "_isSendNode",
  16489. smalltalk.method({
  16490. selector: "isSendNode",
  16491. category: 'testing',
  16492. fn: function (){
  16493. var self=this;
  16494. return true;
  16495. },
  16496. args: [],
  16497. source: "isSendNode\x0a\x09^ true",
  16498. messageSends: [],
  16499. referencedClasses: []
  16500. }),
  16501. smalltalk.SendNode);
  16502. smalltalk.addMethod(
  16503. "_nodes",
  16504. smalltalk.method({
  16505. selector: "nodes",
  16506. category: 'accessing',
  16507. fn: function (){
  16508. var self=this;
  16509. var $2,$3,$1;
  16510. $2=smalltalk.send((smalltalk.Array || Array),"_withAll_",[smalltalk.send(self,"_arguments",[])]);
  16511. smalltalk.send($2,"_add_",[smalltalk.send(self,"_receiver",[])]);
  16512. $3=smalltalk.send($2,"_yourself",[]);
  16513. $1=$3;
  16514. return $1;
  16515. },
  16516. args: [],
  16517. source: "nodes\x0a\x09^ (Array withAll: self arguments)\x0a\x09\x09add: self receiver;\x0a\x09\x09yourself",
  16518. messageSends: ["add:", "receiver", "withAll:", "arguments", "yourself"],
  16519. referencedClasses: ["Array"]
  16520. }),
  16521. smalltalk.SendNode);
  16522. smalltalk.addMethod(
  16523. "_receiver",
  16524. smalltalk.method({
  16525. selector: "receiver",
  16526. category: 'accessing',
  16527. fn: function (){
  16528. var self=this;
  16529. return self["@receiver"];
  16530. },
  16531. args: [],
  16532. source: "receiver\x0a\x09^receiver",
  16533. messageSends: [],
  16534. referencedClasses: []
  16535. }),
  16536. smalltalk.SendNode);
  16537. smalltalk.addMethod(
  16538. "_receiver_",
  16539. smalltalk.method({
  16540. selector: "receiver:",
  16541. category: 'accessing',
  16542. fn: function (aNode){
  16543. var self=this;
  16544. self["@receiver"]=aNode;
  16545. return self},
  16546. args: ["aNode"],
  16547. source: "receiver: aNode\x0a\x09receiver := aNode",
  16548. messageSends: [],
  16549. referencedClasses: []
  16550. }),
  16551. smalltalk.SendNode);
  16552. smalltalk.addMethod(
  16553. "_selector",
  16554. smalltalk.method({
  16555. selector: "selector",
  16556. category: 'accessing',
  16557. fn: function (){
  16558. var self=this;
  16559. return self["@selector"];
  16560. },
  16561. args: [],
  16562. source: "selector\x0a\x09^selector",
  16563. messageSends: [],
  16564. referencedClasses: []
  16565. }),
  16566. smalltalk.SendNode);
  16567. smalltalk.addMethod(
  16568. "_selector_",
  16569. smalltalk.method({
  16570. selector: "selector:",
  16571. category: 'accessing',
  16572. fn: function (aString){
  16573. var self=this;
  16574. self["@selector"]=aString;
  16575. return self},
  16576. args: ["aString"],
  16577. source: "selector: aString\x0a\x09selector := aString",
  16578. messageSends: [],
  16579. referencedClasses: []
  16580. }),
  16581. smalltalk.SendNode);
  16582. smalltalk.addMethod(
  16583. "_superSend",
  16584. smalltalk.method({
  16585. selector: "superSend",
  16586. category: 'accessing',
  16587. fn: function (){
  16588. var self=this;
  16589. var $1;
  16590. if(($receiver = self["@superSend"]) == nil || $receiver == undefined){
  16591. $1=false;
  16592. } else {
  16593. $1=self["@superSend"];
  16594. };
  16595. return $1;
  16596. },
  16597. args: [],
  16598. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  16599. messageSends: ["ifNil:"],
  16600. referencedClasses: []
  16601. }),
  16602. smalltalk.SendNode);
  16603. smalltalk.addMethod(
  16604. "_superSend_",
  16605. smalltalk.method({
  16606. selector: "superSend:",
  16607. category: 'accessing',
  16608. fn: function (aBoolean){
  16609. var self=this;
  16610. self["@superSend"]=aBoolean;
  16611. return self},
  16612. args: ["aBoolean"],
  16613. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  16614. messageSends: [],
  16615. referencedClasses: []
  16616. }),
  16617. smalltalk.SendNode);
  16618. smalltalk.addMethod(
  16619. "_valueForReceiver_",
  16620. smalltalk.method({
  16621. selector: "valueForReceiver:",
  16622. category: 'accessing',
  16623. fn: function (anObject){
  16624. var self=this;
  16625. var $2,$4,$3,$5,$1;
  16626. $2=smalltalk.send((smalltalk.SendNode || SendNode),"_new",[]);
  16627. $4=smalltalk.send(self,"_receiver",[]);
  16628. if(($receiver = $4) == nil || $receiver == undefined){
  16629. $3=anObject;
  16630. } else {
  16631. $3=smalltalk.send(smalltalk.send(self,"_receiver",[]),"_valueForReceiver_",[anObject]);
  16632. };
  16633. smalltalk.send($2,"_receiver_",[$3]);
  16634. smalltalk.send($2,"_selector_",[smalltalk.send(self,"_selector",[])]);
  16635. smalltalk.send($2,"_arguments_",[smalltalk.send(self,"_arguments",[])]);
  16636. $5=smalltalk.send($2,"_yourself",[]);
  16637. $1=$5;
  16638. return $1;
  16639. },
  16640. args: ["anObject"],
  16641. source: "valueForReceiver: anObject\x0a\x09^SendNode new\x0a\x09 receiver: (self receiver \x0a\x09\x09ifNil: [anObject]\x0a\x09\x09ifNotNil: [self receiver valueForReceiver: anObject]);\x0a\x09 selector: self selector;\x0a\x09 arguments: self arguments;\x0a\x09 yourself",
  16642. messageSends: ["receiver:", "ifNil:ifNotNil:", "valueForReceiver:", "receiver", "new", "selector:", "selector", "arguments:", "arguments", "yourself"],
  16643. referencedClasses: ["SendNode"]
  16644. }),
  16645. smalltalk.SendNode);
  16646. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps', 'scope'], 'Compiler-AST');
  16647. smalltalk.addMethod(
  16648. "_accept_",
  16649. smalltalk.method({
  16650. selector: "accept:",
  16651. category: 'visiting',
  16652. fn: function (aVisitor){
  16653. var self=this;
  16654. var $1;
  16655. $1=smalltalk.send(aVisitor,"_visitSequenceNode_",[self]);
  16656. return $1;
  16657. },
  16658. args: ["aVisitor"],
  16659. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  16660. messageSends: ["visitSequenceNode:"],
  16661. referencedClasses: []
  16662. }),
  16663. smalltalk.SequenceNode);
  16664. smalltalk.addMethod(
  16665. "_asBlockSequenceNode",
  16666. smalltalk.method({
  16667. selector: "asBlockSequenceNode",
  16668. category: 'testing',
  16669. fn: function (){
  16670. var self=this;
  16671. var $2,$3,$1;
  16672. $2=smalltalk.send((smalltalk.BlockSequenceNode || BlockSequenceNode),"_new",[]);
  16673. smalltalk.send($2,"_nodes_",[smalltalk.send(self,"_nodes",[])]);
  16674. smalltalk.send($2,"_temps_",[smalltalk.send(self,"_temps",[])]);
  16675. $3=smalltalk.send($2,"_yourself",[]);
  16676. $1=$3;
  16677. return $1;
  16678. },
  16679. args: [],
  16680. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09 nodes: self nodes;\x0a\x09 temps: self temps;\x0a\x09 yourself",
  16681. messageSends: ["nodes:", "nodes", "new", "temps:", "temps", "yourself"],
  16682. referencedClasses: ["BlockSequenceNode"]
  16683. }),
  16684. smalltalk.SequenceNode);
  16685. smalltalk.addMethod(
  16686. "_scope",
  16687. smalltalk.method({
  16688. selector: "scope",
  16689. category: 'accessing',
  16690. fn: function (){
  16691. var self=this;
  16692. return self["@scope"];
  16693. },
  16694. args: [],
  16695. source: "scope\x0a\x09^ scope",
  16696. messageSends: [],
  16697. referencedClasses: []
  16698. }),
  16699. smalltalk.SequenceNode);
  16700. smalltalk.addMethod(
  16701. "_scope_",
  16702. smalltalk.method({
  16703. selector: "scope:",
  16704. category: 'accessing',
  16705. fn: function (aLexicalScope){
  16706. var self=this;
  16707. self["@scope"]=aLexicalScope;
  16708. return self},
  16709. args: ["aLexicalScope"],
  16710. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  16711. messageSends: [],
  16712. referencedClasses: []
  16713. }),
  16714. smalltalk.SequenceNode);
  16715. smalltalk.addMethod(
  16716. "_temps",
  16717. smalltalk.method({
  16718. selector: "temps",
  16719. category: 'accessing',
  16720. fn: function (){
  16721. var self=this;
  16722. var $1;
  16723. if(($receiver = self["@temps"]) == nil || $receiver == undefined){
  16724. $1=[];
  16725. } else {
  16726. $1=self["@temps"];
  16727. };
  16728. return $1;
  16729. },
  16730. args: [],
  16731. source: "temps\x0a\x09^temps ifNil: [#()]",
  16732. messageSends: ["ifNil:"],
  16733. referencedClasses: []
  16734. }),
  16735. smalltalk.SequenceNode);
  16736. smalltalk.addMethod(
  16737. "_temps_",
  16738. smalltalk.method({
  16739. selector: "temps:",
  16740. category: 'accessing',
  16741. fn: function (aCollection){
  16742. var self=this;
  16743. self["@temps"]=aCollection;
  16744. return self},
  16745. args: ["aCollection"],
  16746. source: "temps: aCollection\x0a\x09temps := aCollection",
  16747. messageSends: [],
  16748. referencedClasses: []
  16749. }),
  16750. smalltalk.SequenceNode);
  16751. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler-AST');
  16752. smalltalk.addMethod(
  16753. "_accept_",
  16754. smalltalk.method({
  16755. selector: "accept:",
  16756. category: 'visiting',
  16757. fn: function (aVisitor){
  16758. var self=this;
  16759. var $1;
  16760. $1=smalltalk.send(aVisitor,"_visitBlockSequenceNode_",[self]);
  16761. return $1;
  16762. },
  16763. args: ["aVisitor"],
  16764. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  16765. messageSends: ["visitBlockSequenceNode:"],
  16766. referencedClasses: []
  16767. }),
  16768. smalltalk.BlockSequenceNode);
  16769. smalltalk.addMethod(
  16770. "_isBlockSequenceNode",
  16771. smalltalk.method({
  16772. selector: "isBlockSequenceNode",
  16773. category: 'testing',
  16774. fn: function (){
  16775. var self=this;
  16776. return true;
  16777. },
  16778. args: [],
  16779. source: "isBlockSequenceNode\x0a\x09^true",
  16780. messageSends: [],
  16781. referencedClasses: []
  16782. }),
  16783. smalltalk.BlockSequenceNode);
  16784. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler-AST');
  16785. smalltalk.addMethod(
  16786. "_accept_",
  16787. smalltalk.method({
  16788. selector: "accept:",
  16789. category: 'visiting',
  16790. fn: function (aVisitor){
  16791. var self=this;
  16792. var $1;
  16793. $1=smalltalk.send(aVisitor,"_visitValueNode_",[self]);
  16794. return $1;
  16795. },
  16796. args: ["aVisitor"],
  16797. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  16798. messageSends: ["visitValueNode:"],
  16799. referencedClasses: []
  16800. }),
  16801. smalltalk.ValueNode);
  16802. smalltalk.addMethod(
  16803. "_isImmutable",
  16804. smalltalk.method({
  16805. selector: "isImmutable",
  16806. category: 'testing',
  16807. fn: function (){
  16808. var self=this;
  16809. var $1;
  16810. $1=true;
  16811. return $1;
  16812. },
  16813. args: [],
  16814. source: "isImmutable\x0a\x09^true",
  16815. messageSends: [],
  16816. referencedClasses: []
  16817. }),
  16818. smalltalk.ValueNode);
  16819. smalltalk.addMethod(
  16820. "_isValueNode",
  16821. smalltalk.method({
  16822. selector: "isValueNode",
  16823. category: 'testing',
  16824. fn: function (){
  16825. var self=this;
  16826. return true;
  16827. },
  16828. args: [],
  16829. source: "isValueNode\x0a\x09^true",
  16830. messageSends: [],
  16831. referencedClasses: []
  16832. }),
  16833. smalltalk.ValueNode);
  16834. smalltalk.addMethod(
  16835. "_value",
  16836. smalltalk.method({
  16837. selector: "value",
  16838. category: 'accessing',
  16839. fn: function (){
  16840. var self=this;
  16841. return self["@value"];
  16842. },
  16843. args: [],
  16844. source: "value\x0a\x09^value",
  16845. messageSends: [],
  16846. referencedClasses: []
  16847. }),
  16848. smalltalk.ValueNode);
  16849. smalltalk.addMethod(
  16850. "_value_",
  16851. smalltalk.method({
  16852. selector: "value:",
  16853. category: 'accessing',
  16854. fn: function (anObject){
  16855. var self=this;
  16856. self["@value"]=anObject;
  16857. return self},
  16858. args: ["anObject"],
  16859. source: "value: anObject\x0a\x09value := anObject",
  16860. messageSends: [],
  16861. referencedClasses: []
  16862. }),
  16863. smalltalk.ValueNode);
  16864. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  16865. smalltalk.addMethod(
  16866. "_accept_",
  16867. smalltalk.method({
  16868. selector: "accept:",
  16869. category: 'visiting',
  16870. fn: function (aVisitor){
  16871. var self=this;
  16872. var $1;
  16873. $1=smalltalk.send(aVisitor,"_visitVariableNode_",[self]);
  16874. return $1;
  16875. },
  16876. args: ["aVisitor"],
  16877. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  16878. messageSends: ["visitVariableNode:"],
  16879. referencedClasses: []
  16880. }),
  16881. smalltalk.VariableNode);
  16882. smalltalk.addMethod(
  16883. "_alias",
  16884. smalltalk.method({
  16885. selector: "alias",
  16886. category: 'accessing',
  16887. fn: function (){
  16888. var self=this;
  16889. var $1;
  16890. $1=smalltalk.send(smalltalk.send(self,"_binding",[]),"_alias",[]);
  16891. return $1;
  16892. },
  16893. args: [],
  16894. source: "alias\x0a\x09^ self binding alias",
  16895. messageSends: ["alias", "binding"],
  16896. referencedClasses: []
  16897. }),
  16898. smalltalk.VariableNode);
  16899. smalltalk.addMethod(
  16900. "_assigned",
  16901. smalltalk.method({
  16902. selector: "assigned",
  16903. category: 'accessing',
  16904. fn: function (){
  16905. var self=this;
  16906. var $1;
  16907. if(($receiver = self["@assigned"]) == nil || $receiver == undefined){
  16908. $1=false;
  16909. } else {
  16910. $1=self["@assigned"];
  16911. };
  16912. return $1;
  16913. },
  16914. args: [],
  16915. source: "assigned\x0a\x09^assigned ifNil: [false]",
  16916. messageSends: ["ifNil:"],
  16917. referencedClasses: []
  16918. }),
  16919. smalltalk.VariableNode);
  16920. smalltalk.addMethod(
  16921. "_assigned_",
  16922. smalltalk.method({
  16923. selector: "assigned:",
  16924. category: 'accessing',
  16925. fn: function (aBoolean){
  16926. var self=this;
  16927. self["@assigned"]=aBoolean;
  16928. return self},
  16929. args: ["aBoolean"],
  16930. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  16931. messageSends: [],
  16932. referencedClasses: []
  16933. }),
  16934. smalltalk.VariableNode);
  16935. smalltalk.addMethod(
  16936. "_beAssigned",
  16937. smalltalk.method({
  16938. selector: "beAssigned",
  16939. category: 'accessing',
  16940. fn: function (){
  16941. var self=this;
  16942. smalltalk.send(smalltalk.send(self,"_binding",[]),"_validateAssignment",[]);
  16943. self["@assigned"]=true;
  16944. return self},
  16945. args: [],
  16946. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  16947. messageSends: ["validateAssignment", "binding"],
  16948. referencedClasses: []
  16949. }),
  16950. smalltalk.VariableNode);
  16951. smalltalk.addMethod(
  16952. "_binding",
  16953. smalltalk.method({
  16954. selector: "binding",
  16955. category: 'accessing',
  16956. fn: function (){
  16957. var self=this;
  16958. return self["@binding"];
  16959. },
  16960. args: [],
  16961. source: "binding\x0a\x09^ binding",
  16962. messageSends: [],
  16963. referencedClasses: []
  16964. }),
  16965. smalltalk.VariableNode);
  16966. smalltalk.addMethod(
  16967. "_binding_",
  16968. smalltalk.method({
  16969. selector: "binding:",
  16970. category: 'accessing',
  16971. fn: function (aScopeVar){
  16972. var self=this;
  16973. self["@binding"]=aScopeVar;
  16974. return self},
  16975. args: ["aScopeVar"],
  16976. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  16977. messageSends: [],
  16978. referencedClasses: []
  16979. }),
  16980. smalltalk.VariableNode);
  16981. smalltalk.addMethod(
  16982. "_isImmutable",
  16983. smalltalk.method({
  16984. selector: "isImmutable",
  16985. category: 'testing',
  16986. fn: function (){
  16987. var self=this;
  16988. return false;
  16989. },
  16990. args: [],
  16991. source: "isImmutable\x0a\x09^false",
  16992. messageSends: [],
  16993. referencedClasses: []
  16994. }),
  16995. smalltalk.VariableNode);
  16996. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler-AST');
  16997. smalltalk.addMethod(
  16998. "_accept_",
  16999. smalltalk.method({
  17000. selector: "accept:",
  17001. category: 'visiting',
  17002. fn: function (aVisitor){
  17003. var self=this;
  17004. var $1;
  17005. $1=smalltalk.send(aVisitor,"_visitClassReferenceNode_",[self]);
  17006. return $1;
  17007. },
  17008. args: ["aVisitor"],
  17009. source: "accept: aVisitor\x0a\x09^ aVisitor visitClassReferenceNode: self",
  17010. messageSends: ["visitClassReferenceNode:"],
  17011. referencedClasses: []
  17012. }),
  17013. smalltalk.ClassReferenceNode);
  17014. smalltalk.addPackage('Compiler-IR', {});
  17015. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  17016. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.\x0aI rely on a builder object, instance of IRBuilder."
  17017. smalltalk.addMethod(
  17018. "_alias_",
  17019. smalltalk.method({
  17020. selector: "alias:",
  17021. category: 'visiting',
  17022. fn: function (aNode){
  17023. var self=this;
  17024. var $1,$2,$3,$4,$5,$6;
  17025. var variable;
  17026. $1=smalltalk.send(aNode,"_isImmutable",[]);
  17027. if(smalltalk.assert($1)){
  17028. $2=smalltalk.send(self,"_visit_",[aNode]);
  17029. return $2;
  17030. };
  17031. $3=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17032. smalltalk.send($3,"_variable_",[smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar),"_new",[]),"_name_",[smalltalk.send("$","__comma",[smalltalk.send(self,"_nextAlias",[])])])]);
  17033. $4=smalltalk.send($3,"_yourself",[]);
  17034. variable=$4;
  17035. $5=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  17036. smalltalk.send($5,"_add_",[variable]);
  17037. smalltalk.send($5,"_add_",[smalltalk.send(self,"_visit_",[aNode])]);
  17038. $6=smalltalk.send($5,"_yourself",[]);
  17039. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$6]);
  17040. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_internalVariables",[]),"_add_",[variable]);
  17041. return variable;
  17042. },
  17043. args: ["aNode"],
  17044. 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",
  17045. messageSends: ["ifTrue:", "visit:", "isImmutable", "variable:", "name:", ",", "nextAlias", "new", "yourself", "add:", "sequence", "internalVariables", "method"],
  17046. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  17047. }),
  17048. smalltalk.IRASTTranslator);
  17049. smalltalk.addMethod(
  17050. "_method",
  17051. smalltalk.method({
  17052. selector: "method",
  17053. category: 'accessing',
  17054. fn: function (){
  17055. var self=this;
  17056. return self["@method"];
  17057. },
  17058. args: [],
  17059. source: "method\x0a\x09^ method",
  17060. messageSends: [],
  17061. referencedClasses: []
  17062. }),
  17063. smalltalk.IRASTTranslator);
  17064. smalltalk.addMethod(
  17065. "_method_",
  17066. smalltalk.method({
  17067. selector: "method:",
  17068. category: 'accessing',
  17069. fn: function (anIRMethod){
  17070. var self=this;
  17071. self["@method"]=anIRMethod;
  17072. return self},
  17073. args: ["anIRMethod"],
  17074. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  17075. messageSends: [],
  17076. referencedClasses: []
  17077. }),
  17078. smalltalk.IRASTTranslator);
  17079. smalltalk.addMethod(
  17080. "_nextAlias",
  17081. smalltalk.method({
  17082. selector: "nextAlias",
  17083. category: 'accessing',
  17084. fn: function (){
  17085. var self=this;
  17086. var $1;
  17087. if(($receiver = self["@nextAlias"]) == nil || $receiver == undefined){
  17088. self["@nextAlias"]=(0);
  17089. self["@nextAlias"];
  17090. } else {
  17091. self["@nextAlias"];
  17092. };
  17093. self["@nextAlias"]=smalltalk.send(self["@nextAlias"],"__plus",[(1)]);
  17094. $1=smalltalk.send(self["@nextAlias"],"_asString",[]);
  17095. return $1;
  17096. },
  17097. args: [],
  17098. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  17099. messageSends: ["ifNil:", "+", "asString"],
  17100. referencedClasses: []
  17101. }),
  17102. smalltalk.IRASTTranslator);
  17103. smalltalk.addMethod(
  17104. "_sequence",
  17105. smalltalk.method({
  17106. selector: "sequence",
  17107. category: 'accessing',
  17108. fn: function (){
  17109. var self=this;
  17110. return self["@sequence"];
  17111. },
  17112. args: [],
  17113. source: "sequence\x0a\x09^ sequence",
  17114. messageSends: [],
  17115. referencedClasses: []
  17116. }),
  17117. smalltalk.IRASTTranslator);
  17118. smalltalk.addMethod(
  17119. "_sequence_",
  17120. smalltalk.method({
  17121. selector: "sequence:",
  17122. category: 'accessing',
  17123. fn: function (anIRSequence){
  17124. var self=this;
  17125. self["@sequence"]=anIRSequence;
  17126. return self},
  17127. args: ["anIRSequence"],
  17128. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  17129. messageSends: [],
  17130. referencedClasses: []
  17131. }),
  17132. smalltalk.IRASTTranslator);
  17133. smalltalk.addMethod(
  17134. "_source",
  17135. smalltalk.method({
  17136. selector: "source",
  17137. category: 'accessing',
  17138. fn: function (){
  17139. var self=this;
  17140. return self["@source"];
  17141. },
  17142. args: [],
  17143. source: "source\x0a\x09^ source",
  17144. messageSends: [],
  17145. referencedClasses: []
  17146. }),
  17147. smalltalk.IRASTTranslator);
  17148. smalltalk.addMethod(
  17149. "_source_",
  17150. smalltalk.method({
  17151. selector: "source:",
  17152. category: 'accessing',
  17153. fn: function (aString){
  17154. var self=this;
  17155. self["@source"]=aString;
  17156. return self},
  17157. args: ["aString"],
  17158. source: "source: aString\x0a\x09source := aString",
  17159. messageSends: [],
  17160. referencedClasses: []
  17161. }),
  17162. smalltalk.IRASTTranslator);
  17163. smalltalk.addMethod(
  17164. "_temporallyDependentList_",
  17165. smalltalk.method({
  17166. selector: "temporallyDependentList:",
  17167. category: 'visiting',
  17168. fn: function (nodes){
  17169. var self=this;
  17170. var $1,$2,$4,$3,$5;
  17171. var threshold;
  17172. var result;
  17173. threshold=(0);
  17174. smalltalk.send(nodes,"_withIndexDo_",[(function(each,i){
  17175. $1=smalltalk.send(each,"_subtreeNeedsAliasing",[]);
  17176. if(smalltalk.assert($1)){
  17177. threshold=i;
  17178. return threshold;
  17179. };
  17180. })]);
  17181. result=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  17182. smalltalk.send(nodes,"_withIndexDo_",[(function(each,i){
  17183. $2=result;
  17184. $4=smalltalk.send(i,"__lt_eq",[threshold]);
  17185. if(smalltalk.assert($4)){
  17186. $3=smalltalk.send(self,"_alias_",[each]);
  17187. } else {
  17188. $3=smalltalk.send(self,"_visit_",[each]);
  17189. };
  17190. return smalltalk.send($2,"_add_",[$3]);
  17191. })]);
  17192. $5=result;
  17193. return $5;
  17194. },
  17195. args: ["nodes"],
  17196. source: "temporallyDependentList: nodes\x0a\x09| threshold result |\x0a threshold := 0.\x0a \x0a nodes withIndexDo: [ :each :i |\x0a each subtreeNeedsAliasing\x0a\x09\x09 ifTrue: [ threshold := i ]].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09nodes 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 ^result\x0a",
  17197. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "alias:", "visit:", "<="],
  17198. referencedClasses: ["OrderedCollection"]
  17199. }),
  17200. smalltalk.IRASTTranslator);
  17201. smalltalk.addMethod(
  17202. "_theClass",
  17203. smalltalk.method({
  17204. selector: "theClass",
  17205. category: 'accessing',
  17206. fn: function (){
  17207. var self=this;
  17208. return self["@theClass"];
  17209. },
  17210. args: [],
  17211. source: "theClass\x0a\x09^ theClass",
  17212. messageSends: [],
  17213. referencedClasses: []
  17214. }),
  17215. smalltalk.IRASTTranslator);
  17216. smalltalk.addMethod(
  17217. "_theClass_",
  17218. smalltalk.method({
  17219. selector: "theClass:",
  17220. category: 'accessing',
  17221. fn: function (aClass){
  17222. var self=this;
  17223. self["@theClass"]=aClass;
  17224. return self},
  17225. args: ["aClass"],
  17226. source: "theClass: aClass\x0a\x09theClass := aClass",
  17227. messageSends: [],
  17228. referencedClasses: []
  17229. }),
  17230. smalltalk.IRASTTranslator);
  17231. smalltalk.addMethod(
  17232. "_visitAssignmentNode_",
  17233. smalltalk.method({
  17234. selector: "visitAssignmentNode:",
  17235. category: 'visiting',
  17236. fn: function (aNode){
  17237. var self=this;
  17238. var $1,$2;
  17239. var left;
  17240. var right;
  17241. var assignment;
  17242. right=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  17243. left=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  17244. $1=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  17245. smalltalk.send($1,"_add_",[left]);
  17246. smalltalk.send($1,"_add_",[right]);
  17247. $2=smalltalk.send($1,"_yourself",[]);
  17248. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$2]);
  17249. return left;
  17250. },
  17251. args: ["aNode"],
  17252. 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",
  17253. messageSends: ["visit:", "right", "left", "add:", "new", "yourself", "sequence"],
  17254. referencedClasses: ["IRAssignment"]
  17255. }),
  17256. smalltalk.IRASTTranslator);
  17257. smalltalk.addMethod(
  17258. "_visitBlockNode_",
  17259. smalltalk.method({
  17260. selector: "visitBlockNode:",
  17261. category: 'visiting',
  17262. fn: function (aNode){
  17263. var self=this;
  17264. var $1,$2,$3,$4;
  17265. var closure;
  17266. $1=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  17267. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_parameters",[])]);
  17268. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  17269. $2=smalltalk.send($1,"_yourself",[]);
  17270. closure=$2;
  17271. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  17272. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  17273. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  17274. $4=smalltalk.send($3,"_yourself",[]);
  17275. return smalltalk.send(closure,"_add_",[$4]);
  17276. })]);
  17277. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17278. return smalltalk.send(closure,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17279. })]);
  17280. return closure;
  17281. },
  17282. args: ["aNode"],
  17283. 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\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  17284. messageSends: ["arguments:", "parameters", "new", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "temps", "visit:", "nodes"],
  17285. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  17286. }),
  17287. smalltalk.IRASTTranslator);
  17288. smalltalk.addMethod(
  17289. "_visitBlockSequenceNode_",
  17290. smalltalk.method({
  17291. selector: "visitBlockSequenceNode:",
  17292. category: 'visiting',
  17293. fn: function (aNode){
  17294. var self=this;
  17295. var $2,$3,$4,$1;
  17296. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]),(function(){
  17297. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_ifNotEmpty_",[(function(){
  17298. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  17299. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17300. })]);
  17301. $2=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[]),"_isReturnNode",[]);
  17302. if(smalltalk.assert($2)){
  17303. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  17304. } else {
  17305. $3=smalltalk.send((smalltalk.IRBlockReturn || IRBlockReturn),"_new",[]);
  17306. smalltalk.send($3,"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  17307. $4=smalltalk.send($3,"_yourself",[]);
  17308. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$4]);
  17309. };
  17310. })]);
  17311. })]);
  17312. return $1;
  17313. },
  17314. args: ["aNode"],
  17315. 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) ]]]",
  17316. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "do:", "add:", "visit:", "sequence", "allButLast", "nodes", "ifFalse:ifTrue:", "last", "yourself", "isReturnNode"],
  17317. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  17318. }),
  17319. smalltalk.IRASTTranslator);
  17320. smalltalk.addMethod(
  17321. "_visitCascadeNode_",
  17322. smalltalk.method({
  17323. selector: "visitCascadeNode:",
  17324. category: 'visiting',
  17325. fn: function (aNode){
  17326. var self=this;
  17327. var $1,$2;
  17328. var alias;
  17329. $1=smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_isImmutable",[]);
  17330. if(! smalltalk.assert($1)){
  17331. alias=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  17332. alias;
  17333. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17334. return smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_binding_",[smalltalk.send(alias,"_variable",[])])]);
  17335. })]);
  17336. };
  17337. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  17338. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17339. })]);
  17340. $2=smalltalk.send(self,"_alias_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])]);
  17341. return $2;
  17342. },
  17343. args: ["aNode"],
  17344. 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",
  17345. messageSends: ["ifFalse:", "alias:", "receiver", "do:", "receiver:", "binding:", "variable", "new", "nodes", "isImmutable", "add:", "visit:", "sequence", "allButLast", "last"],
  17346. referencedClasses: ["VariableNode"]
  17347. }),
  17348. smalltalk.IRASTTranslator);
  17349. smalltalk.addMethod(
  17350. "_visitDynamicArrayNode_",
  17351. smalltalk.method({
  17352. selector: "visitDynamicArrayNode:",
  17353. category: 'visiting',
  17354. fn: function (aNode){
  17355. var self=this;
  17356. var $1;
  17357. var array;
  17358. array=smalltalk.send((smalltalk.IRDynamicArray || IRDynamicArray),"_new",[]);
  17359. smalltalk.send(smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send(aNode,"_nodes",[])]),"_do_",[(function(each){
  17360. return smalltalk.send(array,"_add_",[each]);
  17361. })]);
  17362. $1=array;
  17363. return $1;
  17364. },
  17365. args: ["aNode"],
  17366. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self temporallyDependentList: aNode nodes) do: [:each | array add: each].\x0a\x09^ array",
  17367. messageSends: ["new", "do:", "add:", "temporallyDependentList:", "nodes"],
  17368. referencedClasses: ["IRDynamicArray"]
  17369. }),
  17370. smalltalk.IRASTTranslator);
  17371. smalltalk.addMethod(
  17372. "_visitDynamicDictionaryNode_",
  17373. smalltalk.method({
  17374. selector: "visitDynamicDictionaryNode:",
  17375. category: 'visiting',
  17376. fn: function (aNode){
  17377. var self=this;
  17378. var $1;
  17379. var dictionary;
  17380. dictionary=smalltalk.send((smalltalk.IRDynamicDictionary || IRDynamicDictionary),"_new",[]);
  17381. smalltalk.send(smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send(aNode,"_nodes",[])]),"_do_",[(function(each){
  17382. return smalltalk.send(dictionary,"_add_",[each]);
  17383. })]);
  17384. $1=dictionary;
  17385. return $1;
  17386. },
  17387. args: ["aNode"],
  17388. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a (self temporallyDependentList: aNode nodes) do: [:each | dictionary add: each].\x0a\x09^ dictionary",
  17389. messageSends: ["new", "do:", "add:", "temporallyDependentList:", "nodes"],
  17390. referencedClasses: ["IRDynamicDictionary"]
  17391. }),
  17392. smalltalk.IRASTTranslator);
  17393. smalltalk.addMethod(
  17394. "_visitJSStatementNode_",
  17395. smalltalk.method({
  17396. selector: "visitJSStatementNode:",
  17397. category: 'visiting',
  17398. fn: function (aNode){
  17399. var self=this;
  17400. var $2,$3,$1;
  17401. $2=smalltalk.send((smalltalk.IRVerbatim || IRVerbatim),"_new",[]);
  17402. smalltalk.send($2,"_source_",[smalltalk.send(aNode,"_source",[])]);
  17403. $3=smalltalk.send($2,"_yourself",[]);
  17404. $1=$3;
  17405. return $1;
  17406. },
  17407. args: ["aNode"],
  17408. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source;\x0a\x09\x09yourself",
  17409. messageSends: ["source:", "source", "new", "yourself"],
  17410. referencedClasses: ["IRVerbatim"]
  17411. }),
  17412. smalltalk.IRASTTranslator);
  17413. smalltalk.addMethod(
  17414. "_visitMethodNode_",
  17415. smalltalk.method({
  17416. selector: "visitMethodNode:",
  17417. category: 'visiting',
  17418. fn: function (aNode){
  17419. var self=this;
  17420. var $1,$2,$3,$4,$5,$6,$7,$8;
  17421. $1=smalltalk.send((smalltalk.IRMethod || IRMethod),"_new",[]);
  17422. smalltalk.send($1,"_source_",[smalltalk.send(self,"_source",[])]);
  17423. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_arguments",[])]);
  17424. smalltalk.send($1,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  17425. smalltalk.send($1,"_messageSends_",[smalltalk.send(aNode,"_messageSends",[])]);
  17426. smalltalk.send($1,"_classReferences_",[smalltalk.send(aNode,"_classReferences",[])]);
  17427. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  17428. $2=smalltalk.send($1,"_yourself",[]);
  17429. smalltalk.send(self,"_method_",[$2]);
  17430. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  17431. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  17432. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  17433. $4=smalltalk.send($3,"_yourself",[]);
  17434. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[$4]);
  17435. })]);
  17436. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17437. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17438. })]);
  17439. $5=smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_hasLocalReturn",[]);
  17440. if(! smalltalk.assert($5)){
  17441. $6=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17442. smalltalk.send($6,"_variable_",[smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_pseudoVars",[]),"_at_",["self"])]);
  17443. $7=smalltalk.send($6,"_yourself",[]);
  17444. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[])]),"_add_",[$7]);
  17445. };
  17446. $8=smalltalk.send(self,"_method",[]);
  17447. return $8;
  17448. },
  17449. args: ["aNode"],
  17450. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09messageSends: aNode messageSends;\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\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",
  17451. messageSends: ["method:", "source:", "source", "new", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "method", "temps", "visit:", "nodes", "ifFalse:", "variable:", "at:", "pseudoVars", "hasLocalReturn"],
  17452. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRVariable", "IRReturn"]
  17453. }),
  17454. smalltalk.IRASTTranslator);
  17455. smalltalk.addMethod(
  17456. "_visitReturnNode_",
  17457. smalltalk.method({
  17458. selector: "visitReturnNode:",
  17459. category: 'visiting',
  17460. fn: function (aNode){
  17461. var self=this;
  17462. var $1;
  17463. var return_;
  17464. $1=smalltalk.send(aNode,"_nonLocalReturn",[]);
  17465. if(smalltalk.assert($1)){
  17466. return_=smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn),"_new",[]);
  17467. } else {
  17468. return_=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  17469. };
  17470. smalltalk.send(return_,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  17471. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17472. return smalltalk.send(return_,"_add_",[smalltalk.send(self,"_alias_",[each])]);
  17473. })]);
  17474. return return_;
  17475. },
  17476. args: ["aNode"],
  17477. 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",
  17478. messageSends: ["ifTrue:ifFalse:", "new", "nonLocalReturn", "scope:", "scope", "do:", "add:", "alias:", "nodes"],
  17479. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  17480. }),
  17481. smalltalk.IRASTTranslator);
  17482. smalltalk.addMethod(
  17483. "_visitSendNode_",
  17484. smalltalk.method({
  17485. selector: "visitSendNode:",
  17486. category: 'visiting',
  17487. fn: function (aNode){
  17488. var self=this;
  17489. var $1,$2;
  17490. var send;
  17491. var all;
  17492. var receiver;
  17493. var arguments;
  17494. send=smalltalk.send((smalltalk.IRSend || IRSend),"_new",[]);
  17495. smalltalk.send(send,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  17496. $1=smalltalk.send(send,"_index_",[smalltalk.send(aNode,"_index",[])]);
  17497. $2=smalltalk.send(aNode,"_superSend",[]);
  17498. if(smalltalk.assert($2)){
  17499. smalltalk.send(send,"_classSend_",[smalltalk.send(smalltalk.send(self,"_theClass",[]),"_superclass",[])]);
  17500. };
  17501. all=smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send([smalltalk.send(aNode,"_receiver",[])],"__comma",[smalltalk.send(aNode,"_arguments",[])])]);
  17502. receiver=smalltalk.send(all,"_first",[]);
  17503. arguments=smalltalk.send(all,"_allButFirst",[]);
  17504. smalltalk.send(send,"_add_",[receiver]);
  17505. smalltalk.send(arguments,"_do_",[(function(each){
  17506. return smalltalk.send(send,"_add_",[each]);
  17507. })]);
  17508. return send;
  17509. },
  17510. args: ["aNode"],
  17511. 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 \x0a all := self temporallyDependentList: { 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\x0a",
  17512. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "classSend:", "superclass", "theClass", "superSend", "temporallyDependentList:", ",", "arguments", "receiver", "first", "allButFirst", "add:", "do:"],
  17513. referencedClasses: ["IRSend"]
  17514. }),
  17515. smalltalk.IRASTTranslator);
  17516. smalltalk.addMethod(
  17517. "_visitSequenceNode_",
  17518. smalltalk.method({
  17519. selector: "visitSequenceNode:",
  17520. category: 'visiting',
  17521. fn: function (aNode){
  17522. var self=this;
  17523. var $2,$1;
  17524. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRSequence || IRSequence),"_new",[]),(function(){
  17525. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17526. var instruction;
  17527. instruction=smalltalk.send(self,"_visit_",[each]);
  17528. instruction;
  17529. $2=smalltalk.send(instruction,"_isVariable",[]);
  17530. if(! smalltalk.assert($2)){
  17531. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[instruction]);
  17532. };
  17533. })]);
  17534. })]);
  17535. return $1;
  17536. },
  17537. args: ["aNode"],
  17538. source: "visitSequenceNode: aNode\x0a\x09^ self \x0a\x09\x09withSequence: IRSequence new \x09\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 ]]]",
  17539. messageSends: ["withSequence:do:", "new", "do:", "visit:", "ifFalse:", "add:", "sequence", "isVariable", "nodes"],
  17540. referencedClasses: ["IRSequence"]
  17541. }),
  17542. smalltalk.IRASTTranslator);
  17543. smalltalk.addMethod(
  17544. "_visitValueNode_",
  17545. smalltalk.method({
  17546. selector: "visitValueNode:",
  17547. category: 'visiting',
  17548. fn: function (aNode){
  17549. var self=this;
  17550. var $2,$3,$1;
  17551. $2=smalltalk.send((smalltalk.IRValue || IRValue),"_new",[]);
  17552. smalltalk.send($2,"_value_",[smalltalk.send(aNode,"_value",[])]);
  17553. $3=smalltalk.send($2,"_yourself",[]);
  17554. $1=$3;
  17555. return $1;
  17556. },
  17557. args: ["aNode"],
  17558. source: "visitValueNode: aNode\x0a\x09^ IRValue new \x0a\x09\x09value: aNode value; \x0a\x09\x09yourself",
  17559. messageSends: ["value:", "value", "new", "yourself"],
  17560. referencedClasses: ["IRValue"]
  17561. }),
  17562. smalltalk.IRASTTranslator);
  17563. smalltalk.addMethod(
  17564. "_visitVariableNode_",
  17565. smalltalk.method({
  17566. selector: "visitVariableNode:",
  17567. category: 'visiting',
  17568. fn: function (aNode){
  17569. var self=this;
  17570. var $2,$3,$1;
  17571. $2=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17572. smalltalk.send($2,"_variable_",[smalltalk.send(aNode,"_binding",[])]);
  17573. $3=smalltalk.send($2,"_yourself",[]);
  17574. $1=$3;
  17575. return $1;
  17576. },
  17577. args: ["aNode"],
  17578. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new \x0a\x09\x09variable: aNode binding; \x0a\x09\x09yourself",
  17579. messageSends: ["variable:", "binding", "new", "yourself"],
  17580. referencedClasses: ["IRVariable"]
  17581. }),
  17582. smalltalk.IRASTTranslator);
  17583. smalltalk.addMethod(
  17584. "_withSequence_do_",
  17585. smalltalk.method({
  17586. selector: "withSequence:do:",
  17587. category: 'accessing',
  17588. fn: function (aSequence,aBlock){
  17589. var self=this;
  17590. var outerSequence;
  17591. outerSequence=smalltalk.send(self,"_sequence",[]);
  17592. smalltalk.send(self,"_sequence_",[aSequence]);
  17593. smalltalk.send(aBlock,"_value",[]);
  17594. smalltalk.send(self,"_sequence_",[outerSequence]);
  17595. return aSequence;
  17596. },
  17597. args: ["aSequence", "aBlock"],
  17598. 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",
  17599. messageSends: ["sequence", "sequence:", "value"],
  17600. referencedClasses: []
  17601. }),
  17602. smalltalk.IRASTTranslator);
  17603. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  17604. 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. "
  17605. smalltalk.addMethod(
  17606. "_accept_",
  17607. smalltalk.method({
  17608. selector: "accept:",
  17609. category: 'visiting',
  17610. fn: function (aVisitor){
  17611. var self=this;
  17612. var $1;
  17613. $1=smalltalk.send(aVisitor,"_visitIRInstruction_",[self]);
  17614. return $1;
  17615. },
  17616. args: ["aVisitor"],
  17617. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  17618. messageSends: ["visitIRInstruction:"],
  17619. referencedClasses: []
  17620. }),
  17621. smalltalk.IRInstruction);
  17622. smalltalk.addMethod(
  17623. "_add_",
  17624. smalltalk.method({
  17625. selector: "add:",
  17626. category: 'building',
  17627. fn: function (anObject){
  17628. var self=this;
  17629. var $1;
  17630. smalltalk.send(anObject,"_parent_",[self]);
  17631. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_add_",[anObject]);
  17632. return $1;
  17633. },
  17634. args: ["anObject"],
  17635. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  17636. messageSends: ["parent:", "add:", "instructions"],
  17637. referencedClasses: []
  17638. }),
  17639. smalltalk.IRInstruction);
  17640. smalltalk.addMethod(
  17641. "_canBeAssigned",
  17642. smalltalk.method({
  17643. selector: "canBeAssigned",
  17644. category: 'testing',
  17645. fn: function (){
  17646. var self=this;
  17647. return true;
  17648. },
  17649. args: [],
  17650. source: "canBeAssigned\x0a\x09^ true",
  17651. messageSends: [],
  17652. referencedClasses: []
  17653. }),
  17654. smalltalk.IRInstruction);
  17655. smalltalk.addMethod(
  17656. "_instructions",
  17657. smalltalk.method({
  17658. selector: "instructions",
  17659. category: 'accessing',
  17660. fn: function (){
  17661. var self=this;
  17662. var $1;
  17663. if(($receiver = self["@instructions"]) == nil || $receiver == undefined){
  17664. self["@instructions"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  17665. $1=self["@instructions"];
  17666. } else {
  17667. $1=self["@instructions"];
  17668. };
  17669. return $1;
  17670. },
  17671. args: [],
  17672. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  17673. messageSends: ["ifNil:", "new"],
  17674. referencedClasses: ["OrderedCollection"]
  17675. }),
  17676. smalltalk.IRInstruction);
  17677. smalltalk.addMethod(
  17678. "_isClosure",
  17679. smalltalk.method({
  17680. selector: "isClosure",
  17681. category: 'testing',
  17682. fn: function (){
  17683. var self=this;
  17684. return false;
  17685. },
  17686. args: [],
  17687. source: "isClosure\x0a\x09^ false",
  17688. messageSends: [],
  17689. referencedClasses: []
  17690. }),
  17691. smalltalk.IRInstruction);
  17692. smalltalk.addMethod(
  17693. "_isInlined",
  17694. smalltalk.method({
  17695. selector: "isInlined",
  17696. category: 'testing',
  17697. fn: function (){
  17698. var self=this;
  17699. return false;
  17700. },
  17701. args: [],
  17702. source: "isInlined\x0a\x09^ false",
  17703. messageSends: [],
  17704. referencedClasses: []
  17705. }),
  17706. smalltalk.IRInstruction);
  17707. smalltalk.addMethod(
  17708. "_isLocalReturn",
  17709. smalltalk.method({
  17710. selector: "isLocalReturn",
  17711. category: 'testing',
  17712. fn: function (){
  17713. var self=this;
  17714. return false;
  17715. },
  17716. args: [],
  17717. source: "isLocalReturn\x0a\x09^ false",
  17718. messageSends: [],
  17719. referencedClasses: []
  17720. }),
  17721. smalltalk.IRInstruction);
  17722. smalltalk.addMethod(
  17723. "_isReturn",
  17724. smalltalk.method({
  17725. selector: "isReturn",
  17726. category: 'testing',
  17727. fn: function (){
  17728. var self=this;
  17729. return false;
  17730. },
  17731. args: [],
  17732. source: "isReturn\x0a\x09^ false",
  17733. messageSends: [],
  17734. referencedClasses: []
  17735. }),
  17736. smalltalk.IRInstruction);
  17737. smalltalk.addMethod(
  17738. "_isSend",
  17739. smalltalk.method({
  17740. selector: "isSend",
  17741. category: 'testing',
  17742. fn: function (){
  17743. var self=this;
  17744. return false;
  17745. },
  17746. args: [],
  17747. source: "isSend\x0a\x09^ false",
  17748. messageSends: [],
  17749. referencedClasses: []
  17750. }),
  17751. smalltalk.IRInstruction);
  17752. smalltalk.addMethod(
  17753. "_isSequence",
  17754. smalltalk.method({
  17755. selector: "isSequence",
  17756. category: 'testing',
  17757. fn: function (){
  17758. var self=this;
  17759. return false;
  17760. },
  17761. args: [],
  17762. source: "isSequence\x0a\x09^ false",
  17763. messageSends: [],
  17764. referencedClasses: []
  17765. }),
  17766. smalltalk.IRInstruction);
  17767. smalltalk.addMethod(
  17768. "_isTempDeclaration",
  17769. smalltalk.method({
  17770. selector: "isTempDeclaration",
  17771. category: 'testing',
  17772. fn: function (){
  17773. var self=this;
  17774. return false;
  17775. },
  17776. args: [],
  17777. source: "isTempDeclaration\x0a\x09^ false",
  17778. messageSends: [],
  17779. referencedClasses: []
  17780. }),
  17781. smalltalk.IRInstruction);
  17782. smalltalk.addMethod(
  17783. "_isVariable",
  17784. smalltalk.method({
  17785. selector: "isVariable",
  17786. category: 'testing',
  17787. fn: function (){
  17788. var self=this;
  17789. return false;
  17790. },
  17791. args: [],
  17792. source: "isVariable\x0a\x09^ false",
  17793. messageSends: [],
  17794. referencedClasses: []
  17795. }),
  17796. smalltalk.IRInstruction);
  17797. smalltalk.addMethod(
  17798. "_parent",
  17799. smalltalk.method({
  17800. selector: "parent",
  17801. category: 'accessing',
  17802. fn: function (){
  17803. var self=this;
  17804. return self["@parent"];
  17805. },
  17806. args: [],
  17807. source: "parent\x0a\x09^ parent",
  17808. messageSends: [],
  17809. referencedClasses: []
  17810. }),
  17811. smalltalk.IRInstruction);
  17812. smalltalk.addMethod(
  17813. "_parent_",
  17814. smalltalk.method({
  17815. selector: "parent:",
  17816. category: 'accessing',
  17817. fn: function (anIRInstruction){
  17818. var self=this;
  17819. self["@parent"]=anIRInstruction;
  17820. return self},
  17821. args: ["anIRInstruction"],
  17822. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  17823. messageSends: [],
  17824. referencedClasses: []
  17825. }),
  17826. smalltalk.IRInstruction);
  17827. smalltalk.addMethod(
  17828. "_remove",
  17829. smalltalk.method({
  17830. selector: "remove",
  17831. category: 'building',
  17832. fn: function (){
  17833. var self=this;
  17834. smalltalk.send(smalltalk.send(self,"_parent",[]),"_remove_",[self]);
  17835. return self},
  17836. args: [],
  17837. source: "remove\x0a\x09self parent remove: self",
  17838. messageSends: ["remove:", "parent"],
  17839. referencedClasses: []
  17840. }),
  17841. smalltalk.IRInstruction);
  17842. smalltalk.addMethod(
  17843. "_remove_",
  17844. smalltalk.method({
  17845. selector: "remove:",
  17846. category: 'building',
  17847. fn: function (anIRInstruction){
  17848. var self=this;
  17849. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_remove_",[anIRInstruction]);
  17850. return self},
  17851. args: ["anIRInstruction"],
  17852. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  17853. messageSends: ["remove:", "instructions"],
  17854. referencedClasses: []
  17855. }),
  17856. smalltalk.IRInstruction);
  17857. smalltalk.addMethod(
  17858. "_replace_with_",
  17859. smalltalk.method({
  17860. selector: "replace:with:",
  17861. category: 'building',
  17862. fn: function (anIRInstruction,anotherIRInstruction){
  17863. var self=this;
  17864. smalltalk.send(anotherIRInstruction,"_parent_",[self]);
  17865. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_at_put_",[smalltalk.send(smalltalk.send(self,"_instructions",[]),"_indexOf_",[anIRInstruction]),anotherIRInstruction]);
  17866. return self},
  17867. args: ["anIRInstruction", "anotherIRInstruction"],
  17868. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions \x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  17869. messageSends: ["parent:", "at:put:", "indexOf:", "instructions"],
  17870. referencedClasses: []
  17871. }),
  17872. smalltalk.IRInstruction);
  17873. smalltalk.addMethod(
  17874. "_replaceWith_",
  17875. smalltalk.method({
  17876. selector: "replaceWith:",
  17877. category: 'building',
  17878. fn: function (anIRInstruction){
  17879. var self=this;
  17880. smalltalk.send(smalltalk.send(self,"_parent",[]),"_replace_with_",[self,anIRInstruction]);
  17881. return self},
  17882. args: ["anIRInstruction"],
  17883. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  17884. messageSends: ["replace:with:", "parent"],
  17885. referencedClasses: []
  17886. }),
  17887. smalltalk.IRInstruction);
  17888. smalltalk.addMethod(
  17889. "_on_",
  17890. smalltalk.method({
  17891. selector: "on:",
  17892. category: 'instance creation',
  17893. fn: function (aBuilder){
  17894. var self=this;
  17895. var $2,$3,$1;
  17896. $2=smalltalk.send(self,"_new",[]);
  17897. smalltalk.send($2,"_builder_",[aBuilder]);
  17898. $3=smalltalk.send($2,"_yourself",[]);
  17899. $1=$3;
  17900. return $1;
  17901. },
  17902. args: ["aBuilder"],
  17903. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  17904. messageSends: ["builder:", "new", "yourself"],
  17905. referencedClasses: []
  17906. }),
  17907. smalltalk.IRInstruction.klass);
  17908. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  17909. smalltalk.addMethod(
  17910. "_accept_",
  17911. smalltalk.method({
  17912. selector: "accept:",
  17913. category: 'visiting',
  17914. fn: function (aVisitor){
  17915. var self=this;
  17916. var $1;
  17917. $1=smalltalk.send(aVisitor,"_visitIRAssignment_",[self]);
  17918. return $1;
  17919. },
  17920. args: ["aVisitor"],
  17921. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  17922. messageSends: ["visitIRAssignment:"],
  17923. referencedClasses: []
  17924. }),
  17925. smalltalk.IRAssignment);
  17926. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  17927. smalltalk.addMethod(
  17928. "_accept_",
  17929. smalltalk.method({
  17930. selector: "accept:",
  17931. category: 'visiting',
  17932. fn: function (aVisitor){
  17933. var self=this;
  17934. var $1;
  17935. $1=smalltalk.send(aVisitor,"_visitIRDynamicArray_",[self]);
  17936. return $1;
  17937. },
  17938. args: ["aVisitor"],
  17939. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  17940. messageSends: ["visitIRDynamicArray:"],
  17941. referencedClasses: []
  17942. }),
  17943. smalltalk.IRDynamicArray);
  17944. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  17945. smalltalk.addMethod(
  17946. "_accept_",
  17947. smalltalk.method({
  17948. selector: "accept:",
  17949. category: 'visiting',
  17950. fn: function (aVisitor){
  17951. var self=this;
  17952. var $1;
  17953. $1=smalltalk.send(aVisitor,"_visitIRDynamicDictionary_",[self]);
  17954. return $1;
  17955. },
  17956. args: ["aVisitor"],
  17957. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  17958. messageSends: ["visitIRDynamicDictionary:"],
  17959. referencedClasses: []
  17960. }),
  17961. smalltalk.IRDynamicDictionary);
  17962. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  17963. smalltalk.addMethod(
  17964. "_scope",
  17965. smalltalk.method({
  17966. selector: "scope",
  17967. category: 'accessing',
  17968. fn: function (){
  17969. var self=this;
  17970. return self["@scope"];
  17971. },
  17972. args: [],
  17973. source: "scope\x0a\x09^ scope",
  17974. messageSends: [],
  17975. referencedClasses: []
  17976. }),
  17977. smalltalk.IRScopedInstruction);
  17978. smalltalk.addMethod(
  17979. "_scope_",
  17980. smalltalk.method({
  17981. selector: "scope:",
  17982. category: 'accessing',
  17983. fn: function (aScope){
  17984. var self=this;
  17985. self["@scope"]=aScope;
  17986. return self},
  17987. args: ["aScope"],
  17988. source: "scope: aScope\x0a\x09scope := aScope",
  17989. messageSends: [],
  17990. referencedClasses: []
  17991. }),
  17992. smalltalk.IRScopedInstruction);
  17993. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  17994. smalltalk.addMethod(
  17995. "_accept_",
  17996. smalltalk.method({
  17997. selector: "accept:",
  17998. category: 'visiting',
  17999. fn: function (aVisitor){
  18000. var self=this;
  18001. var $1;
  18002. $1=smalltalk.send(aVisitor,"_visitIRClosure_",[self]);
  18003. return $1;
  18004. },
  18005. args: ["aVisitor"],
  18006. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  18007. messageSends: ["visitIRClosure:"],
  18008. referencedClasses: []
  18009. }),
  18010. smalltalk.IRClosure);
  18011. smalltalk.addMethod(
  18012. "_arguments",
  18013. smalltalk.method({
  18014. selector: "arguments",
  18015. category: 'accessing',
  18016. fn: function (){
  18017. var self=this;
  18018. var $1;
  18019. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  18020. $1=[];
  18021. } else {
  18022. $1=self["@arguments"];
  18023. };
  18024. return $1;
  18025. },
  18026. args: [],
  18027. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  18028. messageSends: ["ifNil:"],
  18029. referencedClasses: []
  18030. }),
  18031. smalltalk.IRClosure);
  18032. smalltalk.addMethod(
  18033. "_arguments_",
  18034. smalltalk.method({
  18035. selector: "arguments:",
  18036. category: 'accessing',
  18037. fn: function (aCollection){
  18038. var self=this;
  18039. self["@arguments"]=aCollection;
  18040. return self},
  18041. args: ["aCollection"],
  18042. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  18043. messageSends: [],
  18044. referencedClasses: []
  18045. }),
  18046. smalltalk.IRClosure);
  18047. smalltalk.addMethod(
  18048. "_isClosure",
  18049. smalltalk.method({
  18050. selector: "isClosure",
  18051. category: 'testing',
  18052. fn: function (){
  18053. var self=this;
  18054. return true;
  18055. },
  18056. args: [],
  18057. source: "isClosure\x0a\x09^ true",
  18058. messageSends: [],
  18059. referencedClasses: []
  18060. }),
  18061. smalltalk.IRClosure);
  18062. smalltalk.addMethod(
  18063. "_scope_",
  18064. smalltalk.method({
  18065. selector: "scope:",
  18066. category: 'accessing',
  18067. fn: function (aScope){
  18068. var self=this;
  18069. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  18070. smalltalk.send(aScope,"_instruction_",[self]);
  18071. return self},
  18072. args: ["aScope"],
  18073. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  18074. messageSends: ["scope:", "instruction:"],
  18075. referencedClasses: []
  18076. }),
  18077. smalltalk.IRClosure);
  18078. smalltalk.addMethod(
  18079. "_sequence",
  18080. smalltalk.method({
  18081. selector: "sequence",
  18082. category: 'accessing',
  18083. fn: function (){
  18084. var self=this;
  18085. var $1;
  18086. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_last",[]);
  18087. return $1;
  18088. },
  18089. args: [],
  18090. source: "sequence\x0a\x09^ self instructions last",
  18091. messageSends: ["last", "instructions"],
  18092. referencedClasses: []
  18093. }),
  18094. smalltalk.IRClosure);
  18095. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  18096. smalltalk.IRMethod.comment="I am a method instruction"
  18097. smalltalk.addMethod(
  18098. "_accept_",
  18099. smalltalk.method({
  18100. selector: "accept:",
  18101. category: 'visiting',
  18102. fn: function (aVisitor){
  18103. var self=this;
  18104. var $1;
  18105. $1=smalltalk.send(aVisitor,"_visitIRMethod_",[self]);
  18106. return $1;
  18107. },
  18108. args: ["aVisitor"],
  18109. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  18110. messageSends: ["visitIRMethod:"],
  18111. referencedClasses: []
  18112. }),
  18113. smalltalk.IRMethod);
  18114. smalltalk.addMethod(
  18115. "_arguments",
  18116. smalltalk.method({
  18117. selector: "arguments",
  18118. category: 'accessing',
  18119. fn: function (){
  18120. var self=this;
  18121. return self["@arguments"];
  18122. },
  18123. args: [],
  18124. source: "arguments\x0a\x09^ arguments",
  18125. messageSends: [],
  18126. referencedClasses: []
  18127. }),
  18128. smalltalk.IRMethod);
  18129. smalltalk.addMethod(
  18130. "_arguments_",
  18131. smalltalk.method({
  18132. selector: "arguments:",
  18133. category: 'accessing',
  18134. fn: function (aCollection){
  18135. var self=this;
  18136. self["@arguments"]=aCollection;
  18137. return self},
  18138. args: ["aCollection"],
  18139. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  18140. messageSends: [],
  18141. referencedClasses: []
  18142. }),
  18143. smalltalk.IRMethod);
  18144. smalltalk.addMethod(
  18145. "_classReferences",
  18146. smalltalk.method({
  18147. selector: "classReferences",
  18148. category: 'accessing',
  18149. fn: function (){
  18150. var self=this;
  18151. return self["@classReferences"];
  18152. },
  18153. args: [],
  18154. source: "classReferences\x0a\x09^ classReferences",
  18155. messageSends: [],
  18156. referencedClasses: []
  18157. }),
  18158. smalltalk.IRMethod);
  18159. smalltalk.addMethod(
  18160. "_classReferences_",
  18161. smalltalk.method({
  18162. selector: "classReferences:",
  18163. category: 'accessing',
  18164. fn: function (aCollection){
  18165. var self=this;
  18166. self["@classReferences"]=aCollection;
  18167. return self},
  18168. args: ["aCollection"],
  18169. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  18170. messageSends: [],
  18171. referencedClasses: []
  18172. }),
  18173. smalltalk.IRMethod);
  18174. smalltalk.addMethod(
  18175. "_internalVariables",
  18176. smalltalk.method({
  18177. selector: "internalVariables",
  18178. category: 'accessing',
  18179. fn: function (){
  18180. var self=this;
  18181. var $1;
  18182. if(($receiver = self["@internalVariables"]) == nil || $receiver == undefined){
  18183. self["@internalVariables"]=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  18184. $1=self["@internalVariables"];
  18185. } else {
  18186. $1=self["@internalVariables"];
  18187. };
  18188. return $1;
  18189. },
  18190. args: [],
  18191. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  18192. messageSends: ["ifNil:", "new"],
  18193. referencedClasses: ["Set"]
  18194. }),
  18195. smalltalk.IRMethod);
  18196. smalltalk.addMethod(
  18197. "_messageSends",
  18198. smalltalk.method({
  18199. selector: "messageSends",
  18200. category: 'accessing',
  18201. fn: function (){
  18202. var self=this;
  18203. return self["@messageSends"];
  18204. },
  18205. args: [],
  18206. source: "messageSends\x0a\x09^ messageSends",
  18207. messageSends: [],
  18208. referencedClasses: []
  18209. }),
  18210. smalltalk.IRMethod);
  18211. smalltalk.addMethod(
  18212. "_messageSends_",
  18213. smalltalk.method({
  18214. selector: "messageSends:",
  18215. category: 'accessing',
  18216. fn: function (aCollection){
  18217. var self=this;
  18218. self["@messageSends"]=aCollection;
  18219. return self},
  18220. args: ["aCollection"],
  18221. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  18222. messageSends: [],
  18223. referencedClasses: []
  18224. }),
  18225. smalltalk.IRMethod);
  18226. smalltalk.addMethod(
  18227. "_scope_",
  18228. smalltalk.method({
  18229. selector: "scope:",
  18230. category: 'accessing',
  18231. fn: function (aScope){
  18232. var self=this;
  18233. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  18234. smalltalk.send(aScope,"_instruction_",[self]);
  18235. return self},
  18236. args: ["aScope"],
  18237. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  18238. messageSends: ["scope:", "instruction:"],
  18239. referencedClasses: []
  18240. }),
  18241. smalltalk.IRMethod);
  18242. smalltalk.addMethod(
  18243. "_selector",
  18244. smalltalk.method({
  18245. selector: "selector",
  18246. category: 'accessing',
  18247. fn: function (){
  18248. var self=this;
  18249. return self["@selector"];
  18250. },
  18251. args: [],
  18252. source: "selector\x0a\x09^ selector",
  18253. messageSends: [],
  18254. referencedClasses: []
  18255. }),
  18256. smalltalk.IRMethod);
  18257. smalltalk.addMethod(
  18258. "_selector_",
  18259. smalltalk.method({
  18260. selector: "selector:",
  18261. category: 'accessing',
  18262. fn: function (aString){
  18263. var self=this;
  18264. self["@selector"]=aString;
  18265. return self},
  18266. args: ["aString"],
  18267. source: "selector: aString\x0a\x09selector := aString",
  18268. messageSends: [],
  18269. referencedClasses: []
  18270. }),
  18271. smalltalk.IRMethod);
  18272. smalltalk.addMethod(
  18273. "_source",
  18274. smalltalk.method({
  18275. selector: "source",
  18276. category: 'accessing',
  18277. fn: function (){
  18278. var self=this;
  18279. return self["@source"];
  18280. },
  18281. args: [],
  18282. source: "source\x0a\x09^ source",
  18283. messageSends: [],
  18284. referencedClasses: []
  18285. }),
  18286. smalltalk.IRMethod);
  18287. smalltalk.addMethod(
  18288. "_source_",
  18289. smalltalk.method({
  18290. selector: "source:",
  18291. category: 'accessing',
  18292. fn: function (aString){
  18293. var self=this;
  18294. self["@source"]=aString;
  18295. return self},
  18296. args: ["aString"],
  18297. source: "source: aString\x0a\x09source := aString",
  18298. messageSends: [],
  18299. referencedClasses: []
  18300. }),
  18301. smalltalk.IRMethod);
  18302. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  18303. smalltalk.IRReturn.comment="I am a local return instruction."
  18304. smalltalk.addMethod(
  18305. "_accept_",
  18306. smalltalk.method({
  18307. selector: "accept:",
  18308. category: 'visiting',
  18309. fn: function (aVisitor){
  18310. var self=this;
  18311. var $1;
  18312. $1=smalltalk.send(aVisitor,"_visitIRReturn_",[self]);
  18313. return $1;
  18314. },
  18315. args: ["aVisitor"],
  18316. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  18317. messageSends: ["visitIRReturn:"],
  18318. referencedClasses: []
  18319. }),
  18320. smalltalk.IRReturn);
  18321. smalltalk.addMethod(
  18322. "_canBeAssigned",
  18323. smalltalk.method({
  18324. selector: "canBeAssigned",
  18325. category: 'testing',
  18326. fn: function (){
  18327. var self=this;
  18328. return false;
  18329. },
  18330. args: [],
  18331. source: "canBeAssigned\x0a\x09^ false",
  18332. messageSends: [],
  18333. referencedClasses: []
  18334. }),
  18335. smalltalk.IRReturn);
  18336. smalltalk.addMethod(
  18337. "_isBlockReturn",
  18338. smalltalk.method({
  18339. selector: "isBlockReturn",
  18340. category: 'testing',
  18341. fn: function (){
  18342. var self=this;
  18343. return false;
  18344. },
  18345. args: [],
  18346. source: "isBlockReturn\x0a\x09^ false",
  18347. messageSends: [],
  18348. referencedClasses: []
  18349. }),
  18350. smalltalk.IRReturn);
  18351. smalltalk.addMethod(
  18352. "_isLocalReturn",
  18353. smalltalk.method({
  18354. selector: "isLocalReturn",
  18355. category: 'testing',
  18356. fn: function (){
  18357. var self=this;
  18358. return true;
  18359. },
  18360. args: [],
  18361. source: "isLocalReturn\x0a\x09^ true",
  18362. messageSends: [],
  18363. referencedClasses: []
  18364. }),
  18365. smalltalk.IRReturn);
  18366. smalltalk.addMethod(
  18367. "_isNonLocalReturn",
  18368. smalltalk.method({
  18369. selector: "isNonLocalReturn",
  18370. category: 'testing',
  18371. fn: function (){
  18372. var self=this;
  18373. var $1;
  18374. $1=smalltalk.send(smalltalk.send(self,"_isLocalReturn",[]),"_not",[]);
  18375. return $1;
  18376. },
  18377. args: [],
  18378. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  18379. messageSends: ["not", "isLocalReturn"],
  18380. referencedClasses: []
  18381. }),
  18382. smalltalk.IRReturn);
  18383. smalltalk.addMethod(
  18384. "_isReturn",
  18385. smalltalk.method({
  18386. selector: "isReturn",
  18387. category: 'testing',
  18388. fn: function (){
  18389. var self=this;
  18390. return true;
  18391. },
  18392. args: [],
  18393. source: "isReturn\x0a\x09^ true",
  18394. messageSends: [],
  18395. referencedClasses: []
  18396. }),
  18397. smalltalk.IRReturn);
  18398. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  18399. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction."
  18400. smalltalk.addMethod(
  18401. "_accept_",
  18402. smalltalk.method({
  18403. selector: "accept:",
  18404. category: 'visiting',
  18405. fn: function (aVisitor){
  18406. var self=this;
  18407. var $1;
  18408. $1=smalltalk.send(aVisitor,"_visitIRBlockReturn_",[self]);
  18409. return $1;
  18410. },
  18411. args: ["aVisitor"],
  18412. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  18413. messageSends: ["visitIRBlockReturn:"],
  18414. referencedClasses: []
  18415. }),
  18416. smalltalk.IRBlockReturn);
  18417. smalltalk.addMethod(
  18418. "_isBlockReturn",
  18419. smalltalk.method({
  18420. selector: "isBlockReturn",
  18421. category: 'testing',
  18422. fn: function (){
  18423. var self=this;
  18424. return true;
  18425. },
  18426. args: [],
  18427. source: "isBlockReturn\x0a\x09^ true",
  18428. messageSends: [],
  18429. referencedClasses: []
  18430. }),
  18431. smalltalk.IRBlockReturn);
  18432. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  18433. smalltalk.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JS statement.\x0a\x0aSee IRNonLocalReturnHandling class"
  18434. smalltalk.addMethod(
  18435. "_accept_",
  18436. smalltalk.method({
  18437. selector: "accept:",
  18438. category: 'visiting',
  18439. fn: function (aVisitor){
  18440. var self=this;
  18441. var $1;
  18442. $1=smalltalk.send(aVisitor,"_visitIRNonLocalReturn_",[self]);
  18443. return $1;
  18444. },
  18445. args: ["aVisitor"],
  18446. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  18447. messageSends: ["visitIRNonLocalReturn:"],
  18448. referencedClasses: []
  18449. }),
  18450. smalltalk.IRNonLocalReturn);
  18451. smalltalk.addMethod(
  18452. "_isLocalReturn",
  18453. smalltalk.method({
  18454. selector: "isLocalReturn",
  18455. category: 'testing',
  18456. fn: function (){
  18457. var self=this;
  18458. return false;
  18459. },
  18460. args: [],
  18461. source: "isLocalReturn\x0a\x09^ false",
  18462. messageSends: [],
  18463. referencedClasses: []
  18464. }),
  18465. smalltalk.IRNonLocalReturn);
  18466. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  18467. smalltalk.IRSend.comment="I am a message send instruction. "
  18468. smalltalk.addMethod(
  18469. "_accept_",
  18470. smalltalk.method({
  18471. selector: "accept:",
  18472. category: 'visiting',
  18473. fn: function (aVisitor){
  18474. var self=this;
  18475. var $1;
  18476. $1=smalltalk.send(aVisitor,"_visitIRSend_",[self]);
  18477. return $1;
  18478. },
  18479. args: ["aVisitor"],
  18480. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  18481. messageSends: ["visitIRSend:"],
  18482. referencedClasses: []
  18483. }),
  18484. smalltalk.IRSend);
  18485. smalltalk.addMethod(
  18486. "_classSend",
  18487. smalltalk.method({
  18488. selector: "classSend",
  18489. category: 'accessing',
  18490. fn: function (){
  18491. var self=this;
  18492. return self["@classSend"];
  18493. },
  18494. args: [],
  18495. source: "classSend\x0a\x09^ classSend",
  18496. messageSends: [],
  18497. referencedClasses: []
  18498. }),
  18499. smalltalk.IRSend);
  18500. smalltalk.addMethod(
  18501. "_classSend_",
  18502. smalltalk.method({
  18503. selector: "classSend:",
  18504. category: 'accessing',
  18505. fn: function (aClass){
  18506. var self=this;
  18507. self["@classSend"]=aClass;
  18508. return self},
  18509. args: ["aClass"],
  18510. source: "classSend: aClass\x0a\x09classSend := aClass",
  18511. messageSends: [],
  18512. referencedClasses: []
  18513. }),
  18514. smalltalk.IRSend);
  18515. smalltalk.addMethod(
  18516. "_index",
  18517. smalltalk.method({
  18518. selector: "index",
  18519. category: 'accessing',
  18520. fn: function (){
  18521. var self=this;
  18522. return self["@index"];
  18523. },
  18524. args: [],
  18525. source: "index\x0a\x09^ index",
  18526. messageSends: [],
  18527. referencedClasses: []
  18528. }),
  18529. smalltalk.IRSend);
  18530. smalltalk.addMethod(
  18531. "_index_",
  18532. smalltalk.method({
  18533. selector: "index:",
  18534. category: 'accessing',
  18535. fn: function (anInteger){
  18536. var self=this;
  18537. self["@index"]=anInteger;
  18538. return self},
  18539. args: ["anInteger"],
  18540. source: "index: anInteger\x0a\x09index := anInteger",
  18541. messageSends: [],
  18542. referencedClasses: []
  18543. }),
  18544. smalltalk.IRSend);
  18545. smalltalk.addMethod(
  18546. "_isSend",
  18547. smalltalk.method({
  18548. selector: "isSend",
  18549. category: 'testing',
  18550. fn: function (){
  18551. var self=this;
  18552. return true;
  18553. },
  18554. args: [],
  18555. source: "isSend\x0a\x09^ true",
  18556. messageSends: [],
  18557. referencedClasses: []
  18558. }),
  18559. smalltalk.IRSend);
  18560. smalltalk.addMethod(
  18561. "_selector",
  18562. smalltalk.method({
  18563. selector: "selector",
  18564. category: 'accessing',
  18565. fn: function (){
  18566. var self=this;
  18567. return self["@selector"];
  18568. },
  18569. args: [],
  18570. source: "selector\x0a\x09^ selector",
  18571. messageSends: [],
  18572. referencedClasses: []
  18573. }),
  18574. smalltalk.IRSend);
  18575. smalltalk.addMethod(
  18576. "_selector_",
  18577. smalltalk.method({
  18578. selector: "selector:",
  18579. category: 'accessing',
  18580. fn: function (aString){
  18581. var self=this;
  18582. self["@selector"]=aString;
  18583. return self},
  18584. args: ["aString"],
  18585. source: "selector: aString\x0a\x09selector := aString",
  18586. messageSends: [],
  18587. referencedClasses: []
  18588. }),
  18589. smalltalk.IRSend);
  18590. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  18591. smalltalk.addMethod(
  18592. "_accept_",
  18593. smalltalk.method({
  18594. selector: "accept:",
  18595. category: 'visiting',
  18596. fn: function (aVisitor){
  18597. var self=this;
  18598. var $1;
  18599. $1=smalltalk.send(aVisitor,"_visitIRSequence_",[self]);
  18600. return $1;
  18601. },
  18602. args: ["aVisitor"],
  18603. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  18604. messageSends: ["visitIRSequence:"],
  18605. referencedClasses: []
  18606. }),
  18607. smalltalk.IRSequence);
  18608. smalltalk.addMethod(
  18609. "_isSequence",
  18610. smalltalk.method({
  18611. selector: "isSequence",
  18612. category: 'testing',
  18613. fn: function (){
  18614. var self=this;
  18615. return true;
  18616. },
  18617. args: [],
  18618. source: "isSequence\x0a\x09^ true",
  18619. messageSends: [],
  18620. referencedClasses: []
  18621. }),
  18622. smalltalk.IRSequence);
  18623. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  18624. smalltalk.addMethod(
  18625. "_accept_",
  18626. smalltalk.method({
  18627. selector: "accept:",
  18628. category: 'visiting',
  18629. fn: function (aVisitor){
  18630. var self=this;
  18631. var $1;
  18632. $1=smalltalk.send(aVisitor,"_visitIRBlockSequence_",[self]);
  18633. return $1;
  18634. },
  18635. args: ["aVisitor"],
  18636. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  18637. messageSends: ["visitIRBlockSequence:"],
  18638. referencedClasses: []
  18639. }),
  18640. smalltalk.IRBlockSequence);
  18641. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  18642. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  18643. smalltalk.addMethod(
  18644. "_accept_",
  18645. smalltalk.method({
  18646. selector: "accept:",
  18647. category: 'visiting',
  18648. fn: function (aVisitor){
  18649. var self=this;
  18650. var $1;
  18651. $1=smalltalk.send(aVisitor,"_visitIRTempDeclaration_",[self]);
  18652. return $1;
  18653. },
  18654. args: ["aVisitor"],
  18655. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  18656. messageSends: ["visitIRTempDeclaration:"],
  18657. referencedClasses: []
  18658. }),
  18659. smalltalk.IRTempDeclaration);
  18660. smalltalk.addMethod(
  18661. "_isTempDeclaration",
  18662. smalltalk.method({
  18663. selector: "isTempDeclaration",
  18664. category: 'visiting',
  18665. fn: function (){
  18666. var self=this;
  18667. return true;
  18668. },
  18669. args: [],
  18670. source: "isTempDeclaration\x0a\x09^ true",
  18671. messageSends: [],
  18672. referencedClasses: []
  18673. }),
  18674. smalltalk.IRTempDeclaration);
  18675. smalltalk.addMethod(
  18676. "_name",
  18677. smalltalk.method({
  18678. selector: "name",
  18679. category: 'accessing',
  18680. fn: function (){
  18681. var self=this;
  18682. return self["@name"];
  18683. },
  18684. args: [],
  18685. source: "name\x0a\x09^ name",
  18686. messageSends: [],
  18687. referencedClasses: []
  18688. }),
  18689. smalltalk.IRTempDeclaration);
  18690. smalltalk.addMethod(
  18691. "_name_",
  18692. smalltalk.method({
  18693. selector: "name:",
  18694. category: 'accessing',
  18695. fn: function (aString){
  18696. var self=this;
  18697. self["@name"]=aString;
  18698. return self},
  18699. args: ["aString"],
  18700. source: "name: aString\x0a\x09name := aString",
  18701. messageSends: [],
  18702. referencedClasses: []
  18703. }),
  18704. smalltalk.IRTempDeclaration);
  18705. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  18706. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  18707. smalltalk.addMethod(
  18708. "_accept_",
  18709. smalltalk.method({
  18710. selector: "accept:",
  18711. category: 'visiting',
  18712. fn: function (aVisitor){
  18713. var self=this;
  18714. var $1;
  18715. $1=smalltalk.send(aVisitor,"_visitIRValue_",[self]);
  18716. return $1;
  18717. },
  18718. args: ["aVisitor"],
  18719. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  18720. messageSends: ["visitIRValue:"],
  18721. referencedClasses: []
  18722. }),
  18723. smalltalk.IRValue);
  18724. smalltalk.addMethod(
  18725. "_value",
  18726. smalltalk.method({
  18727. selector: "value",
  18728. category: 'accessing',
  18729. fn: function (){
  18730. var self=this;
  18731. return self["@value"];
  18732. },
  18733. args: [],
  18734. source: "value\x0a\x09^value",
  18735. messageSends: [],
  18736. referencedClasses: []
  18737. }),
  18738. smalltalk.IRValue);
  18739. smalltalk.addMethod(
  18740. "_value_",
  18741. smalltalk.method({
  18742. selector: "value:",
  18743. category: 'accessing',
  18744. fn: function (aString){
  18745. var self=this;
  18746. self["@value"]=aString;
  18747. return self},
  18748. args: ["aString"],
  18749. source: "value: aString\x0a\x09value := aString",
  18750. messageSends: [],
  18751. referencedClasses: []
  18752. }),
  18753. smalltalk.IRValue);
  18754. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  18755. smalltalk.IRVariable.comment="I am a variable instruction."
  18756. smalltalk.addMethod(
  18757. "_accept_",
  18758. smalltalk.method({
  18759. selector: "accept:",
  18760. category: 'visiting',
  18761. fn: function (aVisitor){
  18762. var self=this;
  18763. var $1;
  18764. $1=smalltalk.send(aVisitor,"_visitIRVariable_",[self]);
  18765. return $1;
  18766. },
  18767. args: ["aVisitor"],
  18768. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  18769. messageSends: ["visitIRVariable:"],
  18770. referencedClasses: []
  18771. }),
  18772. smalltalk.IRVariable);
  18773. smalltalk.addMethod(
  18774. "_isVariable",
  18775. smalltalk.method({
  18776. selector: "isVariable",
  18777. category: 'testing',
  18778. fn: function (){
  18779. var self=this;
  18780. return true;
  18781. },
  18782. args: [],
  18783. source: "isVariable\x0a\x09^ true",
  18784. messageSends: [],
  18785. referencedClasses: []
  18786. }),
  18787. smalltalk.IRVariable);
  18788. smalltalk.addMethod(
  18789. "_variable",
  18790. smalltalk.method({
  18791. selector: "variable",
  18792. category: 'accessing',
  18793. fn: function (){
  18794. var self=this;
  18795. return self["@variable"];
  18796. },
  18797. args: [],
  18798. source: "variable\x0a\x09^ variable",
  18799. messageSends: [],
  18800. referencedClasses: []
  18801. }),
  18802. smalltalk.IRVariable);
  18803. smalltalk.addMethod(
  18804. "_variable_",
  18805. smalltalk.method({
  18806. selector: "variable:",
  18807. category: 'accessing',
  18808. fn: function (aScopeVariable){
  18809. var self=this;
  18810. self["@variable"]=aScopeVariable;
  18811. return self},
  18812. args: ["aScopeVariable"],
  18813. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  18814. messageSends: [],
  18815. referencedClasses: []
  18816. }),
  18817. smalltalk.IRVariable);
  18818. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  18819. smalltalk.addMethod(
  18820. "_accept_",
  18821. smalltalk.method({
  18822. selector: "accept:",
  18823. category: 'visiting',
  18824. fn: function (aVisitor){
  18825. var self=this;
  18826. var $1;
  18827. $1=smalltalk.send(aVisitor,"_visitIRVerbatim_",[self]);
  18828. return $1;
  18829. },
  18830. args: ["aVisitor"],
  18831. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  18832. messageSends: ["visitIRVerbatim:"],
  18833. referencedClasses: []
  18834. }),
  18835. smalltalk.IRVerbatim);
  18836. smalltalk.addMethod(
  18837. "_source",
  18838. smalltalk.method({
  18839. selector: "source",
  18840. category: 'accessing',
  18841. fn: function (){
  18842. var self=this;
  18843. return self["@source"];
  18844. },
  18845. args: [],
  18846. source: "source\x0a\x09^ source",
  18847. messageSends: [],
  18848. referencedClasses: []
  18849. }),
  18850. smalltalk.IRVerbatim);
  18851. smalltalk.addMethod(
  18852. "_source_",
  18853. smalltalk.method({
  18854. selector: "source:",
  18855. category: 'accessing',
  18856. fn: function (aString){
  18857. var self=this;
  18858. self["@source"]=aString;
  18859. return self},
  18860. args: ["aString"],
  18861. source: "source: aString\x0a\x09source := aString",
  18862. messageSends: [],
  18863. referencedClasses: []
  18864. }),
  18865. smalltalk.IRVerbatim);
  18866. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  18867. smalltalk.addMethod(
  18868. "_visit_",
  18869. smalltalk.method({
  18870. selector: "visit:",
  18871. category: 'visiting',
  18872. fn: function (anIRInstruction){
  18873. var self=this;
  18874. var $1;
  18875. $1=smalltalk.send(anIRInstruction,"_accept_",[self]);
  18876. return $1;
  18877. },
  18878. args: ["anIRInstruction"],
  18879. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  18880. messageSends: ["accept:"],
  18881. referencedClasses: []
  18882. }),
  18883. smalltalk.IRVisitor);
  18884. smalltalk.addMethod(
  18885. "_visitIRAssignment_",
  18886. smalltalk.method({
  18887. selector: "visitIRAssignment:",
  18888. category: 'visiting',
  18889. fn: function (anIRAssignment){
  18890. var self=this;
  18891. var $1;
  18892. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRAssignment]);
  18893. return $1;
  18894. },
  18895. args: ["anIRAssignment"],
  18896. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  18897. messageSends: ["visitIRInstruction:"],
  18898. referencedClasses: []
  18899. }),
  18900. smalltalk.IRVisitor);
  18901. smalltalk.addMethod(
  18902. "_visitIRBlockReturn_",
  18903. smalltalk.method({
  18904. selector: "visitIRBlockReturn:",
  18905. category: 'visiting',
  18906. fn: function (anIRBlockReturn){
  18907. var self=this;
  18908. var $1;
  18909. $1=smalltalk.send(self,"_visitIRReturn_",[anIRBlockReturn]);
  18910. return $1;
  18911. },
  18912. args: ["anIRBlockReturn"],
  18913. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  18914. messageSends: ["visitIRReturn:"],
  18915. referencedClasses: []
  18916. }),
  18917. smalltalk.IRVisitor);
  18918. smalltalk.addMethod(
  18919. "_visitIRBlockSequence_",
  18920. smalltalk.method({
  18921. selector: "visitIRBlockSequence:",
  18922. category: 'visiting',
  18923. fn: function (anIRBlockSequence){
  18924. var self=this;
  18925. var $1;
  18926. $1=smalltalk.send(self,"_visitIRSequence_",[anIRBlockSequence]);
  18927. return $1;
  18928. },
  18929. args: ["anIRBlockSequence"],
  18930. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  18931. messageSends: ["visitIRSequence:"],
  18932. referencedClasses: []
  18933. }),
  18934. smalltalk.IRVisitor);
  18935. smalltalk.addMethod(
  18936. "_visitIRClosure_",
  18937. smalltalk.method({
  18938. selector: "visitIRClosure:",
  18939. category: 'visiting',
  18940. fn: function (anIRClosure){
  18941. var self=this;
  18942. var $1;
  18943. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRClosure]);
  18944. return $1;
  18945. },
  18946. args: ["anIRClosure"],
  18947. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  18948. messageSends: ["visitIRInstruction:"],
  18949. referencedClasses: []
  18950. }),
  18951. smalltalk.IRVisitor);
  18952. smalltalk.addMethod(
  18953. "_visitIRDynamicArray_",
  18954. smalltalk.method({
  18955. selector: "visitIRDynamicArray:",
  18956. category: 'visiting',
  18957. fn: function (anIRDynamicArray){
  18958. var self=this;
  18959. var $1;
  18960. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicArray]);
  18961. return $1;
  18962. },
  18963. args: ["anIRDynamicArray"],
  18964. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  18965. messageSends: ["visitIRInstruction:"],
  18966. referencedClasses: []
  18967. }),
  18968. smalltalk.IRVisitor);
  18969. smalltalk.addMethod(
  18970. "_visitIRDynamicDictionary_",
  18971. smalltalk.method({
  18972. selector: "visitIRDynamicDictionary:",
  18973. category: 'visiting',
  18974. fn: function (anIRDynamicDictionary){
  18975. var self=this;
  18976. var $1;
  18977. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicDictionary]);
  18978. return $1;
  18979. },
  18980. args: ["anIRDynamicDictionary"],
  18981. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  18982. messageSends: ["visitIRInstruction:"],
  18983. referencedClasses: []
  18984. }),
  18985. smalltalk.IRVisitor);
  18986. smalltalk.addMethod(
  18987. "_visitIRInlinedClosure_",
  18988. smalltalk.method({
  18989. selector: "visitIRInlinedClosure:",
  18990. category: 'visiting',
  18991. fn: function (anIRInlinedClosure){
  18992. var self=this;
  18993. var $1;
  18994. $1=smalltalk.send(self,"_visitIRClosure_",[anIRInlinedClosure]);
  18995. return $1;
  18996. },
  18997. args: ["anIRInlinedClosure"],
  18998. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  18999. messageSends: ["visitIRClosure:"],
  19000. referencedClasses: []
  19001. }),
  19002. smalltalk.IRVisitor);
  19003. smalltalk.addMethod(
  19004. "_visitIRInlinedSequence_",
  19005. smalltalk.method({
  19006. selector: "visitIRInlinedSequence:",
  19007. category: 'visiting',
  19008. fn: function (anIRInlinedSequence){
  19009. var self=this;
  19010. var $1;
  19011. $1=smalltalk.send(self,"_visitIRSequence_",[anIRInlinedSequence]);
  19012. return $1;
  19013. },
  19014. args: ["anIRInlinedSequence"],
  19015. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  19016. messageSends: ["visitIRSequence:"],
  19017. referencedClasses: []
  19018. }),
  19019. smalltalk.IRVisitor);
  19020. smalltalk.addMethod(
  19021. "_visitIRInstruction_",
  19022. smalltalk.method({
  19023. selector: "visitIRInstruction:",
  19024. category: 'visiting',
  19025. fn: function (anIRInstruction){
  19026. var self=this;
  19027. smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_do_",[(function(each){
  19028. return smalltalk.send(self,"_visit_",[each]);
  19029. })]);
  19030. return anIRInstruction;
  19031. },
  19032. args: ["anIRInstruction"],
  19033. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  19034. messageSends: ["do:", "visit:", "instructions"],
  19035. referencedClasses: []
  19036. }),
  19037. smalltalk.IRVisitor);
  19038. smalltalk.addMethod(
  19039. "_visitIRMethod_",
  19040. smalltalk.method({
  19041. selector: "visitIRMethod:",
  19042. category: 'visiting',
  19043. fn: function (anIRMethod){
  19044. var self=this;
  19045. var $1;
  19046. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRMethod]);
  19047. return $1;
  19048. },
  19049. args: ["anIRMethod"],
  19050. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  19051. messageSends: ["visitIRInstruction:"],
  19052. referencedClasses: []
  19053. }),
  19054. smalltalk.IRVisitor);
  19055. smalltalk.addMethod(
  19056. "_visitIRNonLocalReturn_",
  19057. smalltalk.method({
  19058. selector: "visitIRNonLocalReturn:",
  19059. category: 'visiting',
  19060. fn: function (anIRNonLocalReturn){
  19061. var self=this;
  19062. var $1;
  19063. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturn]);
  19064. return $1;
  19065. },
  19066. args: ["anIRNonLocalReturn"],
  19067. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  19068. messageSends: ["visitIRInstruction:"],
  19069. referencedClasses: []
  19070. }),
  19071. smalltalk.IRVisitor);
  19072. smalltalk.addMethod(
  19073. "_visitIRNonLocalReturnHandling_",
  19074. smalltalk.method({
  19075. selector: "visitIRNonLocalReturnHandling:",
  19076. category: 'visiting',
  19077. fn: function (anIRNonLocalReturnHandling){
  19078. var self=this;
  19079. var $1;
  19080. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturnHandling]);
  19081. return $1;
  19082. },
  19083. args: ["anIRNonLocalReturnHandling"],
  19084. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  19085. messageSends: ["visitIRInstruction:"],
  19086. referencedClasses: []
  19087. }),
  19088. smalltalk.IRVisitor);
  19089. smalltalk.addMethod(
  19090. "_visitIRReturn_",
  19091. smalltalk.method({
  19092. selector: "visitIRReturn:",
  19093. category: 'visiting',
  19094. fn: function (anIRReturn){
  19095. var self=this;
  19096. var $1;
  19097. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRReturn]);
  19098. return $1;
  19099. },
  19100. args: ["anIRReturn"],
  19101. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  19102. messageSends: ["visitIRInstruction:"],
  19103. referencedClasses: []
  19104. }),
  19105. smalltalk.IRVisitor);
  19106. smalltalk.addMethod(
  19107. "_visitIRSend_",
  19108. smalltalk.method({
  19109. selector: "visitIRSend:",
  19110. category: 'visiting',
  19111. fn: function (anIRSend){
  19112. var self=this;
  19113. var $1;
  19114. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSend]);
  19115. return $1;
  19116. },
  19117. args: ["anIRSend"],
  19118. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  19119. messageSends: ["visitIRInstruction:"],
  19120. referencedClasses: []
  19121. }),
  19122. smalltalk.IRVisitor);
  19123. smalltalk.addMethod(
  19124. "_visitIRSequence_",
  19125. smalltalk.method({
  19126. selector: "visitIRSequence:",
  19127. category: 'visiting',
  19128. fn: function (anIRSequence){
  19129. var self=this;
  19130. var $1;
  19131. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSequence]);
  19132. return $1;
  19133. },
  19134. args: ["anIRSequence"],
  19135. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  19136. messageSends: ["visitIRInstruction:"],
  19137. referencedClasses: []
  19138. }),
  19139. smalltalk.IRVisitor);
  19140. smalltalk.addMethod(
  19141. "_visitIRTempDeclaration_",
  19142. smalltalk.method({
  19143. selector: "visitIRTempDeclaration:",
  19144. category: 'visiting',
  19145. fn: function (anIRTempDeclaration){
  19146. var self=this;
  19147. var $1;
  19148. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRTempDeclaration]);
  19149. return $1;
  19150. },
  19151. args: ["anIRTempDeclaration"],
  19152. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  19153. messageSends: ["visitIRInstruction:"],
  19154. referencedClasses: []
  19155. }),
  19156. smalltalk.IRVisitor);
  19157. smalltalk.addMethod(
  19158. "_visitIRValue_",
  19159. smalltalk.method({
  19160. selector: "visitIRValue:",
  19161. category: 'visiting',
  19162. fn: function (anIRValue){
  19163. var self=this;
  19164. var $1;
  19165. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRValue]);
  19166. return $1;
  19167. },
  19168. args: ["anIRValue"],
  19169. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  19170. messageSends: ["visitIRInstruction:"],
  19171. referencedClasses: []
  19172. }),
  19173. smalltalk.IRVisitor);
  19174. smalltalk.addMethod(
  19175. "_visitIRVariable_",
  19176. smalltalk.method({
  19177. selector: "visitIRVariable:",
  19178. category: 'visiting',
  19179. fn: function (anIRVariable){
  19180. var self=this;
  19181. var $1;
  19182. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVariable]);
  19183. return $1;
  19184. },
  19185. args: ["anIRVariable"],
  19186. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  19187. messageSends: ["visitIRInstruction:"],
  19188. referencedClasses: []
  19189. }),
  19190. smalltalk.IRVisitor);
  19191. smalltalk.addMethod(
  19192. "_visitIRVerbatim_",
  19193. smalltalk.method({
  19194. selector: "visitIRVerbatim:",
  19195. category: 'visiting',
  19196. fn: function (anIRVerbatim){
  19197. var self=this;
  19198. var $1;
  19199. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVerbatim]);
  19200. return $1;
  19201. },
  19202. args: ["anIRVerbatim"],
  19203. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  19204. messageSends: ["visitIRInstruction:"],
  19205. referencedClasses: []
  19206. }),
  19207. smalltalk.IRVisitor);
  19208. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  19209. smalltalk.addMethod(
  19210. "_contents",
  19211. smalltalk.method({
  19212. selector: "contents",
  19213. category: 'accessing',
  19214. fn: function (){
  19215. var self=this;
  19216. var $1;
  19217. $1=smalltalk.send(smalltalk.send(self,"_stream",[]),"_contents",[]);
  19218. return $1;
  19219. },
  19220. args: [],
  19221. source: "contents\x0a\x09^ self stream contents",
  19222. messageSends: ["contents", "stream"],
  19223. referencedClasses: []
  19224. }),
  19225. smalltalk.IRJSTranslator);
  19226. smalltalk.addMethod(
  19227. "_initialize",
  19228. smalltalk.method({
  19229. selector: "initialize",
  19230. category: 'initialization',
  19231. fn: function (){
  19232. var self=this;
  19233. smalltalk.send(self,"_initialize",[],smalltalk.IRVisitor);
  19234. self["@stream"]=smalltalk.send((smalltalk.JSStream || JSStream),"_new",[]);
  19235. return self},
  19236. args: [],
  19237. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  19238. messageSends: ["initialize", "new"],
  19239. referencedClasses: ["JSStream"]
  19240. }),
  19241. smalltalk.IRJSTranslator);
  19242. smalltalk.addMethod(
  19243. "_stream",
  19244. smalltalk.method({
  19245. selector: "stream",
  19246. category: 'accessing',
  19247. fn: function (){
  19248. var self=this;
  19249. return self["@stream"];
  19250. },
  19251. args: [],
  19252. source: "stream\x0a\x09^ stream",
  19253. messageSends: [],
  19254. referencedClasses: []
  19255. }),
  19256. smalltalk.IRJSTranslator);
  19257. smalltalk.addMethod(
  19258. "_stream_",
  19259. smalltalk.method({
  19260. selector: "stream:",
  19261. category: 'accessing',
  19262. fn: function (aStream){
  19263. var self=this;
  19264. self["@stream"]=aStream;
  19265. return self},
  19266. args: ["aStream"],
  19267. source: "stream: aStream\x0a\x09stream := aStream",
  19268. messageSends: [],
  19269. referencedClasses: []
  19270. }),
  19271. smalltalk.IRJSTranslator);
  19272. smalltalk.addMethod(
  19273. "_visitIRAssignment_",
  19274. smalltalk.method({
  19275. selector: "visitIRAssignment:",
  19276. category: 'visiting',
  19277. fn: function (anIRAssignment){
  19278. var self=this;
  19279. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_first",[])]);
  19280. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAssignment",[]);
  19281. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  19282. return self},
  19283. args: ["anIRAssignment"],
  19284. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  19285. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  19286. referencedClasses: []
  19287. }),
  19288. smalltalk.IRJSTranslator);
  19289. smalltalk.addMethod(
  19290. "_visitIRClosure_",
  19291. smalltalk.method({
  19292. selector: "visitIRClosure:",
  19293. category: 'visiting',
  19294. fn: function (anIRClosure){
  19295. var self=this;
  19296. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutClosureWith_arguments_",[(function(){
  19297. return smalltalk.send(self,"_visitIRClosure_",[anIRClosure],smalltalk.IRVisitor);
  19298. }),smalltalk.send(anIRClosure,"_arguments",[])]);
  19299. return self},
  19300. args: ["anIRClosure"],
  19301. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  19302. messageSends: ["nextPutClosureWith:arguments:", "visitIRClosure:", "arguments", "stream"],
  19303. referencedClasses: []
  19304. }),
  19305. smalltalk.IRJSTranslator);
  19306. smalltalk.addMethod(
  19307. "_visitIRDynamicArray_",
  19308. smalltalk.method({
  19309. selector: "visitIRDynamicArray:",
  19310. category: 'visiting',
  19311. fn: function (anIRDynamicArray){
  19312. var self=this;
  19313. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["["]);
  19314. smalltalk.send(smalltalk.send(anIRDynamicArray,"_instructions",[]),"_do_separatedBy_",[(function(each){
  19315. return smalltalk.send(self,"_visit_",[each]);
  19316. }),(function(){
  19317. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  19318. })]);
  19319. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  19320. return self},
  19321. args: ["anIRDynamicArray"],
  19322. 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: ']'",
  19323. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  19324. referencedClasses: []
  19325. }),
  19326. smalltalk.IRJSTranslator);
  19327. smalltalk.addMethod(
  19328. "_visitIRDynamicDictionary_",
  19329. smalltalk.method({
  19330. selector: "visitIRDynamicDictionary:",
  19331. category: 'visiting',
  19332. fn: function (anIRDynamicDictionary){
  19333. var self=this;
  19334. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  19335. smalltalk.send(smalltalk.send(anIRDynamicDictionary,"_instructions",[]),"_do_separatedBy_",[(function(each){
  19336. return smalltalk.send(self,"_visit_",[each]);
  19337. }),(function(){
  19338. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  19339. })]);
  19340. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["])"]);
  19341. return self},
  19342. args: ["anIRDynamicDictionary"],
  19343. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions \x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  19344. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  19345. referencedClasses: []
  19346. }),
  19347. smalltalk.IRJSTranslator);
  19348. smalltalk.addMethod(
  19349. "_visitIRMethod_",
  19350. smalltalk.method({
  19351. selector: "visitIRMethod:",
  19352. category: 'visiting',
  19353. fn: function (anIRMethod){
  19354. var self=this;
  19355. var $1,$2;
  19356. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutMethodDeclaration_with_",[anIRMethod,(function(){
  19357. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutFunctionWith_arguments_",[(function(){
  19358. $1=smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_notEmpty",[]);
  19359. if(smalltalk.assert($1)){
  19360. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVars_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_asArray",[]),"_collect_",[(function(each){
  19361. return smalltalk.send(smalltalk.send(each,"_variable",[]),"_alias",[]);
  19362. })])]);
  19363. };
  19364. $2=smalltalk.send(smalltalk.send(anIRMethod,"_scope",[]),"_hasNonLocalReturn",[]);
  19365. if(smalltalk.assert($2)){
  19366. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnHandlingWith_",[(function(){
  19367. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  19368. })]);
  19369. } else {
  19370. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  19371. };
  19372. }),smalltalk.send(anIRMethod,"_arguments",[])]);
  19373. })]);
  19374. return self},
  19375. args: ["anIRMethod"],
  19376. source: "visitIRMethod: anIRMethod\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod \x0a\x09\x09with: [ self stream \x0a\x09\x09\x09nextPutFunctionWith: [ \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 ]",
  19377. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "ifTrue:", "nextPutVars:", "collect:", "alias", "variable", "asArray", "internalVariables", "stream", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  19378. referencedClasses: []
  19379. }),
  19380. smalltalk.IRJSTranslator);
  19381. smalltalk.addMethod(
  19382. "_visitIRNonLocalReturn_",
  19383. smalltalk.method({
  19384. selector: "visitIRNonLocalReturn:",
  19385. category: 'visiting',
  19386. fn: function (anIRNonLocalReturn){
  19387. var self=this;
  19388. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  19389. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  19390. })]);
  19391. return self},
  19392. args: ["anIRNonLocalReturn"],
  19393. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  19394. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  19395. referencedClasses: []
  19396. }),
  19397. smalltalk.IRJSTranslator);
  19398. smalltalk.addMethod(
  19399. "_visitIRReturn_",
  19400. smalltalk.method({
  19401. selector: "visitIRReturn:",
  19402. category: 'visiting',
  19403. fn: function (anIRReturn){
  19404. var self=this;
  19405. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturnWith_",[(function(){
  19406. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  19407. })]);
  19408. return self},
  19409. args: ["anIRReturn"],
  19410. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  19411. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  19412. referencedClasses: []
  19413. }),
  19414. smalltalk.IRJSTranslator);
  19415. smalltalk.addMethod(
  19416. "_visitIRSend_",
  19417. smalltalk.method({
  19418. selector: "visitIRSend:",
  19419. category: 'visiting',
  19420. fn: function (anIRSend){
  19421. var self=this;
  19422. var $1;
  19423. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
  19424. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
  19425. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_selector",[]),"_asSelector",[])]),"__comma",["\x22,["])]);
  19426. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_allButFirst",[]),"_do_separatedBy_",[(function(each){
  19427. return smalltalk.send(self,"_visit_",[each]);
  19428. }),(function(){
  19429. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  19430. })]);
  19431. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["]"]);
  19432. $1=smalltalk.send(anIRSend,"_classSend",[]);
  19433. if(($receiver = $1) == nil || $receiver == undefined){
  19434. $1;
  19435. } else {
  19436. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(",","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_classSend",[]),"_asJavascript",[])])]);
  19437. };
  19438. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  19439. return self},
  19440. args: ["anIRSend"],
  19441. source: "visitIRSend: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09\x22anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asString ]\x0a\x09\x09ifFalse: [\x22\x0a\x09\x09\x09anIRSend classSend ifNotNil: [ \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]\x22]\x22.\x0a\x09self stream nextPutAll: ')'",
  19442. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "asJavascript", "classSend"],
  19443. referencedClasses: []
  19444. }),
  19445. smalltalk.IRJSTranslator);
  19446. smalltalk.addMethod(
  19447. "_visitIRSequence_",
  19448. smalltalk.method({
  19449. selector: "visitIRSequence:",
  19450. category: 'visiting',
  19451. fn: function (anIRSequence){
  19452. var self=this;
  19453. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutSequenceWith_",[(function(){
  19454. return smalltalk.send(smalltalk.send(anIRSequence,"_instructions",[]),"_do_",[(function(each){
  19455. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[smalltalk.send(self,"_visit_",[each])]);
  19456. })]);
  19457. })]);
  19458. return self},
  19459. args: ["anIRSequence"],
  19460. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  19461. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  19462. referencedClasses: []
  19463. }),
  19464. smalltalk.IRJSTranslator);
  19465. smalltalk.addMethod(
  19466. "_visitIRTempDeclaration_",
  19467. smalltalk.method({
  19468. selector: "visitIRTempDeclaration:",
  19469. category: 'visiting',
  19470. fn: function (anIRTempDeclaration){
  19471. var self=this;
  19472. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVar_",[smalltalk.send(smalltalk.send(anIRTempDeclaration,"_name",[]),"_asVariableName",[])]);
  19473. return self},
  19474. args: ["anIRTempDeclaration"],
  19475. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  19476. messageSends: ["nextPutVar:", "asVariableName", "name", "stream"],
  19477. referencedClasses: []
  19478. }),
  19479. smalltalk.IRJSTranslator);
  19480. smalltalk.addMethod(
  19481. "_visitIRValue_",
  19482. smalltalk.method({
  19483. selector: "visitIRValue:",
  19484. category: 'visiting',
  19485. fn: function (anIRValue){
  19486. var self=this;
  19487. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRValue,"_value",[]),"_asJavascript",[])]);
  19488. return self},
  19489. args: ["anIRValue"],
  19490. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  19491. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  19492. referencedClasses: []
  19493. }),
  19494. smalltalk.IRJSTranslator);
  19495. smalltalk.addMethod(
  19496. "_visitIRVariable_",
  19497. smalltalk.method({
  19498. selector: "visitIRVariable:",
  19499. category: 'visiting',
  19500. fn: function (anIRVariable){
  19501. var self=this;
  19502. var $1;
  19503. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_name",[]),"__eq",["thisContext"]);
  19504. if(smalltalk.assert($1)){
  19505. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.getThisContext()"]);
  19506. } else {
  19507. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_alias",[])]);
  19508. };
  19509. return self},
  19510. args: ["anIRVariable"],
  19511. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a \x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a \x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  19512. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  19513. referencedClasses: []
  19514. }),
  19515. smalltalk.IRJSTranslator);
  19516. smalltalk.addMethod(
  19517. "_visitIRVerbatim_",
  19518. smalltalk.method({
  19519. selector: "visitIRVerbatim:",
  19520. category: 'visiting',
  19521. fn: function (anIRVerbatim){
  19522. var self=this;
  19523. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  19524. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(anIRVerbatim,"_source",[])]);
  19525. })]);
  19526. return self},
  19527. args: ["anIRVerbatim"],
  19528. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  19529. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  19530. referencedClasses: []
  19531. }),
  19532. smalltalk.IRJSTranslator);
  19533. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  19534. smalltalk.addMethod(
  19535. "_contents",
  19536. smalltalk.method({
  19537. selector: "contents",
  19538. category: 'accessing',
  19539. fn: function (){
  19540. var self=this;
  19541. var $1;
  19542. $1=smalltalk.send(self["@stream"],"_contents",[]);
  19543. return $1;
  19544. },
  19545. args: [],
  19546. source: "contents\x0a\x09^ stream contents",
  19547. messageSends: ["contents"],
  19548. referencedClasses: []
  19549. }),
  19550. smalltalk.JSStream);
  19551. smalltalk.addMethod(
  19552. "_initialize",
  19553. smalltalk.method({
  19554. selector: "initialize",
  19555. category: 'initialization',
  19556. fn: function (){
  19557. var self=this;
  19558. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  19559. self["@stream"]=smalltalk.send("","_writeStream",[]);
  19560. return self},
  19561. args: [],
  19562. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  19563. messageSends: ["initialize", "writeStream"],
  19564. referencedClasses: []
  19565. }),
  19566. smalltalk.JSStream);
  19567. smalltalk.addMethod(
  19568. "_lf",
  19569. smalltalk.method({
  19570. selector: "lf",
  19571. category: 'streaming',
  19572. fn: function (){
  19573. var self=this;
  19574. smalltalk.send(self["@stream"],"_lf",[]);
  19575. return self},
  19576. args: [],
  19577. source: "lf\x0a\x09stream lf",
  19578. messageSends: ["lf"],
  19579. referencedClasses: []
  19580. }),
  19581. smalltalk.JSStream);
  19582. smalltalk.addMethod(
  19583. "_nextPut_",
  19584. smalltalk.method({
  19585. selector: "nextPut:",
  19586. category: 'streaming',
  19587. fn: function (aString){
  19588. var self=this;
  19589. smalltalk.send(self["@stream"],"_nextPut_",[aString]);
  19590. return self},
  19591. args: ["aString"],
  19592. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  19593. messageSends: ["nextPut:"],
  19594. referencedClasses: []
  19595. }),
  19596. smalltalk.JSStream);
  19597. smalltalk.addMethod(
  19598. "_nextPutAll_",
  19599. smalltalk.method({
  19600. selector: "nextPutAll:",
  19601. category: 'streaming',
  19602. fn: function (aString){
  19603. var self=this;
  19604. smalltalk.send(self["@stream"],"_nextPutAll_",[aString]);
  19605. return self},
  19606. args: ["aString"],
  19607. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  19608. messageSends: ["nextPutAll:"],
  19609. referencedClasses: []
  19610. }),
  19611. smalltalk.JSStream);
  19612. smalltalk.addMethod(
  19613. "_nextPutAssignment",
  19614. smalltalk.method({
  19615. selector: "nextPutAssignment",
  19616. category: 'streaming',
  19617. fn: function (){
  19618. var self=this;
  19619. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  19620. return self},
  19621. args: [],
  19622. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  19623. messageSends: ["nextPutAll:"],
  19624. referencedClasses: []
  19625. }),
  19626. smalltalk.JSStream);
  19627. smalltalk.addMethod(
  19628. "_nextPutClosureWith_arguments_",
  19629. smalltalk.method({
  19630. selector: "nextPutClosureWith:arguments:",
  19631. category: 'streaming',
  19632. fn: function (aBlock,anArray){
  19633. var self=this;
  19634. var $1;
  19635. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  19636. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  19637. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  19638. }),(function(){
  19639. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  19640. })]);
  19641. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19642. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19643. smalltalk.send(aBlock,"_value",[]);
  19644. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  19645. return self},
  19646. args: ["aBlock", "anArray"],
  19647. 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: '})'",
  19648. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  19649. referencedClasses: []
  19650. }),
  19651. smalltalk.JSStream);
  19652. smalltalk.addMethod(
  19653. "_nextPutFunctionWith_arguments_",
  19654. smalltalk.method({
  19655. selector: "nextPutFunctionWith:arguments:",
  19656. category: 'streaming',
  19657. fn: function (aBlock,anArray){
  19658. var self=this;
  19659. var $1,$2;
  19660. smalltalk.send(self["@stream"],"_nextPutAll_",["fn: function("]);
  19661. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  19662. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  19663. }),(function(){
  19664. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  19665. })]);
  19666. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19667. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19668. smalltalk.send(self["@stream"],"_nextPutAll_",["var self=this;"]);
  19669. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19670. smalltalk.send(aBlock,"_value",[]);
  19671. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19672. return self},
  19673. args: ["aBlock", "anArray"],
  19674. 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: '}'",
  19675. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  19676. referencedClasses: []
  19677. }),
  19678. smalltalk.JSStream);
  19679. smalltalk.addMethod(
  19680. "_nextPutIf_with_",
  19681. smalltalk.method({
  19682. selector: "nextPutIf:with:",
  19683. category: 'streaming',
  19684. fn: function (aBlock,anotherBlock){
  19685. var self=this;
  19686. var $1;
  19687. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  19688. smalltalk.send(aBlock,"_value",[]);
  19689. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19690. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19691. smalltalk.send(anotherBlock,"_value",[]);
  19692. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19693. return self},
  19694. args: ["aBlock", "anotherBlock"],
  19695. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  19696. messageSends: ["nextPutAll:", "value", "lf"],
  19697. referencedClasses: []
  19698. }),
  19699. smalltalk.JSStream);
  19700. smalltalk.addMethod(
  19701. "_nextPutIfElse_with_with_",
  19702. smalltalk.method({
  19703. selector: "nextPutIfElse:with:with:",
  19704. category: 'streaming',
  19705. fn: function (aBlock,ifBlock,elseBlock){
  19706. var self=this;
  19707. var $1,$2;
  19708. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  19709. smalltalk.send(aBlock,"_value",[]);
  19710. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19711. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19712. smalltalk.send(ifBlock,"_value",[]);
  19713. smalltalk.send(self["@stream"],"_nextPutAll_",["} else {"]);
  19714. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19715. smalltalk.send(elseBlock,"_value",[]);
  19716. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19717. return self},
  19718. args: ["aBlock", "ifBlock", "elseBlock"],
  19719. 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: '}'",
  19720. messageSends: ["nextPutAll:", "value", "lf"],
  19721. referencedClasses: []
  19722. }),
  19723. smalltalk.JSStream);
  19724. smalltalk.addMethod(
  19725. "_nextPutMethodDeclaration_with_",
  19726. smalltalk.method({
  19727. selector: "nextPutMethodDeclaration:with:",
  19728. category: 'streaming',
  19729. fn: function (aMethod,aBlock){
  19730. var self=this;
  19731. var $1,$2,$3;
  19732. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
  19733. smalltalk.send(self["@stream"],"_lf",[]);
  19734. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
  19735. smalltalk.send(self["@stream"],"_lf",[]);
  19736. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
  19737. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19738. smalltalk.send(aBlock,"_value",[]);
  19739. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
  19740. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
  19741. smalltalk.send(self["@stream"],"_lf",[]);
  19742. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
  19743. return smalltalk.send(each,"_value",[]);
  19744. })]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
  19745. smalltalk.send(self["@stream"],"_lf",[]);
  19746. $2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
  19747. smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
  19748. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
  19749. }),(function(){
  19750. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19751. })]);
  19752. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  19753. $3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  19754. return self},
  19755. args: ["aMethod", "aBlock"],
  19756. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: \x22', aMethod selector, '\x22,'; 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 \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: '})'",
  19757. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  19758. referencedClasses: ["String"]
  19759. }),
  19760. smalltalk.JSStream);
  19761. smalltalk.addMethod(
  19762. "_nextPutNonLocalReturnHandlingWith_",
  19763. smalltalk.method({
  19764. selector: "nextPutNonLocalReturnHandlingWith:",
  19765. category: 'streaming',
  19766. fn: function (aBlock){
  19767. var self=this;
  19768. var $1,$2;
  19769. smalltalk.send(self["@stream"],"_nextPutAll_",["var $early={};"]);
  19770. smalltalk.send(self["@stream"],"_lf",[]);
  19771. smalltalk.send(self["@stream"],"_nextPutAll_",["try {"]);
  19772. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19773. smalltalk.send(aBlock,"_value",[]);
  19774. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19775. smalltalk.send(self["@stream"],"_lf",[]);
  19776. smalltalk.send(self["@stream"],"_nextPutAll_",["catch(e) {if(e===$early)return e[0]; throw e}"]);
  19777. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19778. return self},
  19779. args: ["aBlock"],
  19780. 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",
  19781. messageSends: ["nextPutAll:", "lf", "value"],
  19782. referencedClasses: []
  19783. }),
  19784. smalltalk.JSStream);
  19785. smalltalk.addMethod(
  19786. "_nextPutNonLocalReturnWith_",
  19787. smalltalk.method({
  19788. selector: "nextPutNonLocalReturnWith:",
  19789. category: 'streaming',
  19790. fn: function (aBlock){
  19791. var self=this;
  19792. smalltalk.send(self["@stream"],"_nextPutAll_",["throw $early=["]);
  19793. smalltalk.send(aBlock,"_value",[]);
  19794. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  19795. return self},
  19796. args: ["aBlock"],
  19797. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  19798. messageSends: ["nextPutAll:", "value"],
  19799. referencedClasses: []
  19800. }),
  19801. smalltalk.JSStream);
  19802. smalltalk.addMethod(
  19803. "_nextPutReturn",
  19804. smalltalk.method({
  19805. selector: "nextPutReturn",
  19806. category: 'streaming',
  19807. fn: function (){
  19808. var self=this;
  19809. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  19810. return self},
  19811. args: [],
  19812. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  19813. messageSends: ["nextPutAll:"],
  19814. referencedClasses: []
  19815. }),
  19816. smalltalk.JSStream);
  19817. smalltalk.addMethod(
  19818. "_nextPutReturnWith_",
  19819. smalltalk.method({
  19820. selector: "nextPutReturnWith:",
  19821. category: 'streaming',
  19822. fn: function (aBlock){
  19823. var self=this;
  19824. smalltalk.send(self,"_nextPutReturn",[]);
  19825. smalltalk.send(aBlock,"_value",[]);
  19826. return self},
  19827. args: ["aBlock"],
  19828. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  19829. messageSends: ["nextPutReturn", "value"],
  19830. referencedClasses: []
  19831. }),
  19832. smalltalk.JSStream);
  19833. smalltalk.addMethod(
  19834. "_nextPutSendTo_selector_arguments_",
  19835. smalltalk.method({
  19836. selector: "nextPutSendTo:selector:arguments:",
  19837. category: 'streaming',
  19838. fn: function (receiver,selector,arguments){
  19839. var self=this;
  19840. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.send("]);
  19841. smalltalk.send(receiver,"_emitOn_",[self]);
  19842. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(selector,"_asSelector",[])]),"__comma",["\x22,["])]);
  19843. smalltalk.send(arguments,"_do_separatedBy_",[(function(each){
  19844. return smalltalk.send(each,"_emitOn_",[self]);
  19845. }),(function(){
  19846. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19847. })]);
  19848. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  19849. return self},
  19850. args: ["receiver", "selector", "arguments"],
  19851. source: "nextPutSendTo: receiver selector: selector arguments: arguments\x0a\x09stream nextPutAll: 'smalltalk.send('.\x0a\x09receiver emitOn: self. \x0a\x09stream nextPutAll: ',\x22', selector asSelector, '\x22,['.\x0a\x09arguments \x0a\x09\x09do: [ :each | each emitOn: self ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: '])'",
  19852. messageSends: ["nextPutAll:", "emitOn:", ",", "asSelector", "do:separatedBy:"],
  19853. referencedClasses: []
  19854. }),
  19855. smalltalk.JSStream);
  19856. smalltalk.addMethod(
  19857. "_nextPutSequenceWith_",
  19858. smalltalk.method({
  19859. selector: "nextPutSequenceWith:",
  19860. category: 'streaming',
  19861. fn: function (aBlock){
  19862. var self=this;
  19863. smalltalk.send(aBlock,"_value",[]);
  19864. return self},
  19865. args: ["aBlock"],
  19866. 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",
  19867. messageSends: ["value"],
  19868. referencedClasses: []
  19869. }),
  19870. smalltalk.JSStream);
  19871. smalltalk.addMethod(
  19872. "_nextPutStatement_with_",
  19873. smalltalk.method({
  19874. selector: "nextPutStatement:with:",
  19875. category: 'streaming',
  19876. fn: function (anInteger,aBlock){
  19877. var self=this;
  19878. var $1,$2;
  19879. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("case ","__comma",[smalltalk.send(anInteger,"_asString",[])]),"__comma",[":"])]);
  19880. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19881. smalltalk.send(self,"_nextPutStatementWith_",[aBlock]);
  19882. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=","__comma",[smalltalk.send(smalltalk.send(anInteger,"__plus",[(1)]),"_asString",[])]),"__comma",[";"])]);
  19883. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19884. return self},
  19885. args: ["anInteger", "aBlock"],
  19886. 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",
  19887. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  19888. referencedClasses: []
  19889. }),
  19890. smalltalk.JSStream);
  19891. smalltalk.addMethod(
  19892. "_nextPutStatementWith_",
  19893. smalltalk.method({
  19894. selector: "nextPutStatementWith:",
  19895. category: 'streaming',
  19896. fn: function (aBlock){
  19897. var self=this;
  19898. var $1;
  19899. smalltalk.send(aBlock,"_value",[]);
  19900. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  19901. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19902. return self},
  19903. args: ["aBlock"],
  19904. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  19905. messageSends: ["value", "nextPutAll:", "lf"],
  19906. referencedClasses: []
  19907. }),
  19908. smalltalk.JSStream);
  19909. smalltalk.addMethod(
  19910. "_nextPutVar_",
  19911. smalltalk.method({
  19912. selector: "nextPutVar:",
  19913. category: 'streaming',
  19914. fn: function (aString){
  19915. var self=this;
  19916. var $1;
  19917. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[aString]),"__comma",[";"])]);
  19918. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19919. return self},
  19920. args: ["aString"],
  19921. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  19922. messageSends: ["nextPutAll:", ",", "lf"],
  19923. referencedClasses: []
  19924. }),
  19925. smalltalk.JSStream);
  19926. smalltalk.addMethod(
  19927. "_nextPutVars_",
  19928. smalltalk.method({
  19929. selector: "nextPutVars:",
  19930. category: 'streaming',
  19931. fn: function (aCollection){
  19932. var self=this;
  19933. var $1;
  19934. smalltalk.send(self["@stream"],"_nextPutAll_",["var "]);
  19935. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  19936. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  19937. }),(function(){
  19938. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19939. })]);
  19940. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  19941. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19942. return self},
  19943. args: ["aCollection"],
  19944. source: "nextPutVars: aCollection\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection \x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  19945. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  19946. referencedClasses: []
  19947. }),
  19948. smalltalk.JSStream);
  19949. smalltalk.addMethod(
  19950. "_appendToInstruction_",
  19951. smalltalk.method({
  19952. selector: "appendToInstruction:",
  19953. category: '*Compiler-IR',
  19954. fn: function (anIRInstruction){
  19955. var self=this;
  19956. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  19957. return self},
  19958. args: ["anIRInstruction"],
  19959. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  19960. messageSends: ["appendBlock:"],
  19961. referencedClasses: []
  19962. }),
  19963. smalltalk.BlockClosure);
  19964. smalltalk.addMethod(
  19965. "_asVariableName",
  19966. smalltalk.method({
  19967. selector: "asVariableName",
  19968. category: '*Compiler-IR',
  19969. fn: function (){
  19970. var self=this;
  19971. var $2,$1;
  19972. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[self]);
  19973. if(smalltalk.assert($2)){
  19974. $1=smalltalk.send(self,"__comma",["_"]);
  19975. } else {
  19976. $1=self;
  19977. };
  19978. return $1;
  19979. },
  19980. args: [],
  19981. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  19982. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  19983. referencedClasses: ["Smalltalk"]
  19984. }),
  19985. smalltalk.String);
  19986. smalltalk.addPackage('Compiler-Inlining', {});
  19987. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  19988. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction."
  19989. smalltalk.addMethod(
  19990. "_accept_",
  19991. smalltalk.method({
  19992. selector: "accept:",
  19993. category: 'visiting',
  19994. fn: function (aVisitor){
  19995. var self=this;
  19996. var $1;
  19997. $1=smalltalk.send(aVisitor,"_visitIRInlinedAssignment_",[self]);
  19998. return $1;
  19999. },
  20000. args: ["aVisitor"],
  20001. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  20002. messageSends: ["visitIRInlinedAssignment:"],
  20003. referencedClasses: []
  20004. }),
  20005. smalltalk.IRInlinedAssignment);
  20006. smalltalk.addMethod(
  20007. "_isInlined",
  20008. smalltalk.method({
  20009. selector: "isInlined",
  20010. category: 'testing',
  20011. fn: function (){
  20012. var self=this;
  20013. return true;
  20014. },
  20015. args: [],
  20016. source: "isInlined\x0a\x09^ true",
  20017. messageSends: [],
  20018. referencedClasses: []
  20019. }),
  20020. smalltalk.IRInlinedAssignment);
  20021. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  20022. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction."
  20023. smalltalk.addMethod(
  20024. "_accept_",
  20025. smalltalk.method({
  20026. selector: "accept:",
  20027. category: 'visiting',
  20028. fn: function (aVisitor){
  20029. var self=this;
  20030. smalltalk.send(aVisitor,"_visitIRInlinedClosure_",[self]);
  20031. return self},
  20032. args: ["aVisitor"],
  20033. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  20034. messageSends: ["visitIRInlinedClosure:"],
  20035. referencedClasses: []
  20036. }),
  20037. smalltalk.IRInlinedClosure);
  20038. smalltalk.addMethod(
  20039. "_isInlined",
  20040. smalltalk.method({
  20041. selector: "isInlined",
  20042. category: 'testing',
  20043. fn: function (){
  20044. var self=this;
  20045. return true;
  20046. },
  20047. args: [],
  20048. source: "isInlined\x0a\x09^ true",
  20049. messageSends: [],
  20050. referencedClasses: []
  20051. }),
  20052. smalltalk.IRInlinedClosure);
  20053. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  20054. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction."
  20055. smalltalk.addMethod(
  20056. "_accept_",
  20057. smalltalk.method({
  20058. selector: "accept:",
  20059. category: 'visiting',
  20060. fn: function (aVisitor){
  20061. var self=this;
  20062. var $1;
  20063. $1=smalltalk.send(aVisitor,"_visitIRInlinedReturn_",[self]);
  20064. return $1;
  20065. },
  20066. args: ["aVisitor"],
  20067. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  20068. messageSends: ["visitIRInlinedReturn:"],
  20069. referencedClasses: []
  20070. }),
  20071. smalltalk.IRInlinedReturn);
  20072. smalltalk.addMethod(
  20073. "_isInlined",
  20074. smalltalk.method({
  20075. selector: "isInlined",
  20076. category: 'testing',
  20077. fn: function (){
  20078. var self=this;
  20079. return true;
  20080. },
  20081. args: [],
  20082. source: "isInlined\x0a\x09^ true",
  20083. messageSends: [],
  20084. referencedClasses: []
  20085. }),
  20086. smalltalk.IRInlinedReturn);
  20087. smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRInlinedReturn, [], 'Compiler-Inlining');
  20088. smalltalk.IRInlinedNonLocalReturn.comment="I represent an inlined non local return instruction."
  20089. smalltalk.addMethod(
  20090. "_accept_",
  20091. smalltalk.method({
  20092. selector: "accept:",
  20093. category: 'visiting',
  20094. fn: function (aVisitor){
  20095. var self=this;
  20096. var $1;
  20097. $1=smalltalk.send(aVisitor,"_visitIRInlinedNonLocalReturn_",[self]);
  20098. return $1;
  20099. },
  20100. args: ["aVisitor"],
  20101. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedNonLocalReturn: self",
  20102. messageSends: ["visitIRInlinedNonLocalReturn:"],
  20103. referencedClasses: []
  20104. }),
  20105. smalltalk.IRInlinedNonLocalReturn);
  20106. smalltalk.addMethod(
  20107. "_isInlined",
  20108. smalltalk.method({
  20109. selector: "isInlined",
  20110. category: 'testing',
  20111. fn: function (){
  20112. var self=this;
  20113. return true;
  20114. },
  20115. args: [],
  20116. source: "isInlined\x0a\x09^ true",
  20117. messageSends: [],
  20118. referencedClasses: []
  20119. }),
  20120. smalltalk.IRInlinedNonLocalReturn);
  20121. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  20122. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."
  20123. smalltalk.addMethod(
  20124. "_accept_",
  20125. smalltalk.method({
  20126. selector: "accept:",
  20127. category: 'visiting',
  20128. fn: function (aVisitor){
  20129. var self=this;
  20130. smalltalk.send(aVisitor,"_visitInlinedSend_",[self]);
  20131. return self},
  20132. args: ["aVisitor"],
  20133. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  20134. messageSends: ["visitInlinedSend:"],
  20135. referencedClasses: []
  20136. }),
  20137. smalltalk.IRInlinedSend);
  20138. smalltalk.addMethod(
  20139. "_isInlined",
  20140. smalltalk.method({
  20141. selector: "isInlined",
  20142. category: 'testing',
  20143. fn: function (){
  20144. var self=this;
  20145. return true;
  20146. },
  20147. args: [],
  20148. source: "isInlined\x0a\x09^ true",
  20149. messageSends: [],
  20150. referencedClasses: []
  20151. }),
  20152. smalltalk.IRInlinedSend);
  20153. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  20154. smalltalk.addMethod(
  20155. "_accept_",
  20156. smalltalk.method({
  20157. selector: "accept:",
  20158. category: 'visiting',
  20159. fn: function (aVisitor){
  20160. var self=this;
  20161. smalltalk.send(aVisitor,"_visitIRInlinedIfFalse_",[self]);
  20162. return self},
  20163. args: ["aVisitor"],
  20164. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  20165. messageSends: ["visitIRInlinedIfFalse:"],
  20166. referencedClasses: []
  20167. }),
  20168. smalltalk.IRInlinedIfFalse);
  20169. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  20170. smalltalk.addMethod(
  20171. "_accept_",
  20172. smalltalk.method({
  20173. selector: "accept:",
  20174. category: 'visiting',
  20175. fn: function (aVisitor){
  20176. var self=this;
  20177. smalltalk.send(aVisitor,"_visitIRInlinedIfNilIfNotNil_",[self]);
  20178. return self},
  20179. args: ["aVisitor"],
  20180. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  20181. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  20182. referencedClasses: []
  20183. }),
  20184. smalltalk.IRInlinedIfNilIfNotNil);
  20185. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  20186. smalltalk.addMethod(
  20187. "_accept_",
  20188. smalltalk.method({
  20189. selector: "accept:",
  20190. category: 'visiting',
  20191. fn: function (aVisitor){
  20192. var self=this;
  20193. smalltalk.send(aVisitor,"_visitIRInlinedIfTrue_",[self]);
  20194. return self},
  20195. args: ["aVisitor"],
  20196. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  20197. messageSends: ["visitIRInlinedIfTrue:"],
  20198. referencedClasses: []
  20199. }),
  20200. smalltalk.IRInlinedIfTrue);
  20201. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  20202. smalltalk.addMethod(
  20203. "_accept_",
  20204. smalltalk.method({
  20205. selector: "accept:",
  20206. category: 'visiting',
  20207. fn: function (aVisitor){
  20208. var self=this;
  20209. smalltalk.send(aVisitor,"_visitIRInlinedIfTrueIfFalse_",[self]);
  20210. return self},
  20211. args: ["aVisitor"],
  20212. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  20213. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  20214. referencedClasses: []
  20215. }),
  20216. smalltalk.IRInlinedIfTrueIfFalse);
  20217. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  20218. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."
  20219. smalltalk.addMethod(
  20220. "_accept_",
  20221. smalltalk.method({
  20222. selector: "accept:",
  20223. category: 'visiting',
  20224. fn: function (aVisitor){
  20225. var self=this;
  20226. smalltalk.send(aVisitor,"_visitIRInlinedSequence_",[self]);
  20227. return self},
  20228. args: ["aVisitor"],
  20229. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  20230. messageSends: ["visitIRInlinedSequence:"],
  20231. referencedClasses: []
  20232. }),
  20233. smalltalk.IRInlinedSequence);
  20234. smalltalk.addMethod(
  20235. "_isInlined",
  20236. smalltalk.method({
  20237. selector: "isInlined",
  20238. category: 'testing',
  20239. fn: function (){
  20240. var self=this;
  20241. return true;
  20242. },
  20243. args: [],
  20244. source: "isInlined\x0a\x09^ true",
  20245. messageSends: [],
  20246. referencedClasses: []
  20247. }),
  20248. smalltalk.IRInlinedSequence);
  20249. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  20250. 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`"
  20251. smalltalk.addMethod(
  20252. "_assignmentInliner",
  20253. smalltalk.method({
  20254. selector: "assignmentInliner",
  20255. category: 'factory',
  20256. fn: function (){
  20257. var self=this;
  20258. var $2,$3,$1;
  20259. $2=smalltalk.send((smalltalk.IRAssignmentInliner || IRAssignmentInliner),"_new",[]);
  20260. smalltalk.send($2,"_translator_",[self]);
  20261. $3=smalltalk.send($2,"_yourself",[]);
  20262. $1=$3;
  20263. return $1;
  20264. },
  20265. args: [],
  20266. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  20267. messageSends: ["translator:", "new", "yourself"],
  20268. referencedClasses: ["IRAssignmentInliner"]
  20269. }),
  20270. smalltalk.IRInliner);
  20271. smalltalk.addMethod(
  20272. "_nonLocalReturnInliner",
  20273. smalltalk.method({
  20274. selector: "nonLocalReturnInliner",
  20275. category: 'factory',
  20276. fn: function (){
  20277. var self=this;
  20278. var $2,$3,$1;
  20279. $2=smalltalk.send((smalltalk.IRNonLocalReturnInliner || IRNonLocalReturnInliner),"_new",[]);
  20280. smalltalk.send($2,"_translator_",[self]);
  20281. $3=smalltalk.send($2,"_yourself",[]);
  20282. $1=$3;
  20283. return $1;
  20284. },
  20285. args: [],
  20286. source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  20287. messageSends: ["translator:", "new", "yourself"],
  20288. referencedClasses: ["IRNonLocalReturnInliner"]
  20289. }),
  20290. smalltalk.IRInliner);
  20291. smalltalk.addMethod(
  20292. "_returnInliner",
  20293. smalltalk.method({
  20294. selector: "returnInliner",
  20295. category: 'factory',
  20296. fn: function (){
  20297. var self=this;
  20298. var $2,$3,$1;
  20299. $2=smalltalk.send((smalltalk.IRReturnInliner || IRReturnInliner),"_new",[]);
  20300. smalltalk.send($2,"_translator_",[self]);
  20301. $3=smalltalk.send($2,"_yourself",[]);
  20302. $1=$3;
  20303. return $1;
  20304. },
  20305. args: [],
  20306. source: "returnInliner\x0a\x09^ IRReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  20307. messageSends: ["translator:", "new", "yourself"],
  20308. referencedClasses: ["IRReturnInliner"]
  20309. }),
  20310. smalltalk.IRInliner);
  20311. smalltalk.addMethod(
  20312. "_sendInliner",
  20313. smalltalk.method({
  20314. selector: "sendInliner",
  20315. category: 'factory',
  20316. fn: function (){
  20317. var self=this;
  20318. var $2,$3,$1;
  20319. $2=smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_new",[]);
  20320. smalltalk.send($2,"_translator_",[self]);
  20321. $3=smalltalk.send($2,"_yourself",[]);
  20322. $1=$3;
  20323. return $1;
  20324. },
  20325. args: [],
  20326. source: "sendInliner\x0a\x09^ IRSendInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  20327. messageSends: ["translator:", "new", "yourself"],
  20328. referencedClasses: ["IRSendInliner"]
  20329. }),
  20330. smalltalk.IRInliner);
  20331. smalltalk.addMethod(
  20332. "_shouldInlineAssignment_",
  20333. smalltalk.method({
  20334. selector: "shouldInlineAssignment:",
  20335. category: 'testing',
  20336. fn: function (anIRAssignment){
  20337. var self=this;
  20338. var $1;
  20339. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20340. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[]),"_isSend",[]),"_and_",[(function(){
  20341. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  20342. })]);
  20343. })]);
  20344. return $1;
  20345. },
  20346. args: ["anIRAssignment"],
  20347. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [ \x0a\x09\x09anIRAssignment instructions last isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  20348. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
  20349. referencedClasses: []
  20350. }),
  20351. smalltalk.IRInliner);
  20352. smalltalk.addMethod(
  20353. "_shouldInlineReturn_",
  20354. smalltalk.method({
  20355. selector: "shouldInlineReturn:",
  20356. category: 'testing',
  20357. fn: function (anIRReturn){
  20358. var self=this;
  20359. var $1;
  20360. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20361. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[]),"_isSend",[]),"_and_",[(function(){
  20362. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[])]);
  20363. })]);
  20364. })]);
  20365. return $1;
  20366. },
  20367. args: ["anIRReturn"],
  20368. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [ \x0a\x09\x09anIRReturn instructions first isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  20369. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
  20370. referencedClasses: []
  20371. }),
  20372. smalltalk.IRInliner);
  20373. smalltalk.addMethod(
  20374. "_shouldInlineSend_",
  20375. smalltalk.method({
  20376. selector: "shouldInlineSend:",
  20377. category: 'testing',
  20378. fn: function (anIRSend){
  20379. var self=this;
  20380. var $1;
  20381. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20382. return smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_shouldInline_",[anIRSend]);
  20383. })]);
  20384. return $1;
  20385. },
  20386. args: ["anIRSend"],
  20387. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  20388. messageSends: ["and:", "shouldInline:", "not", "isInlined"],
  20389. referencedClasses: ["IRSendInliner"]
  20390. }),
  20391. smalltalk.IRInliner);
  20392. smalltalk.addMethod(
  20393. "_transformNonLocalReturn_",
  20394. smalltalk.method({
  20395. selector: "transformNonLocalReturn:",
  20396. category: 'visiting',
  20397. fn: function (anIRNonLocalReturn){
  20398. var self=this;
  20399. var $1,$2,$3,$4;
  20400. var localReturn;
  20401. $1=smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_canInlineNonLocalReturns",[]);
  20402. if(smalltalk.assert($1)){
  20403. smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_methodScope",[]),"_removeNonLocalReturn_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  20404. $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  20405. smalltalk.send($2,"_scope_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  20406. $3=smalltalk.send($2,"_yourself",[]);
  20407. localReturn=$3;
  20408. localReturn;
  20409. smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_instructions",[]),"_do_",[(function(each){
  20410. return smalltalk.send(localReturn,"_add_",[each]);
  20411. })]);
  20412. smalltalk.send(anIRNonLocalReturn,"_replaceWith_",[localReturn]);
  20413. return localReturn;
  20414. };
  20415. $4=smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  20416. return $4;
  20417. },
  20418. args: ["anIRNonLocalReturn"],
  20419. 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",
  20420. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
  20421. referencedClasses: ["IRReturn"]
  20422. }),
  20423. smalltalk.IRInliner);
  20424. smalltalk.addMethod(
  20425. "_visitIRAssignment_",
  20426. smalltalk.method({
  20427. selector: "visitIRAssignment:",
  20428. category: 'visiting',
  20429. fn: function (anIRAssignment){
  20430. var self=this;
  20431. var $2,$1;
  20432. $2=smalltalk.send(self,"_shouldInlineAssignment_",[anIRAssignment]);
  20433. if(smalltalk.assert($2)){
  20434. $1=smalltalk.send(smalltalk.send(self,"_assignmentInliner",[]),"_inlineAssignment_",[anIRAssignment]);
  20435. } else {
  20436. $1=smalltalk.send(self,"_visitIRAssignment_",[anIRAssignment],smalltalk.IRVisitor);
  20437. };
  20438. return $1;
  20439. },
  20440. args: ["anIRAssignment"],
  20441. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment) \x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  20442. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
  20443. referencedClasses: []
  20444. }),
  20445. smalltalk.IRInliner);
  20446. smalltalk.addMethod(
  20447. "_visitIRNonLocalReturn_",
  20448. smalltalk.method({
  20449. selector: "visitIRNonLocalReturn:",
  20450. category: 'visiting',
  20451. fn: function (anIRNonLocalReturn){
  20452. var self=this;
  20453. var $2,$1;
  20454. $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRNonLocalReturn]);
  20455. if(smalltalk.assert($2)){
  20456. $1=smalltalk.send(smalltalk.send(self,"_nonLocalReturnInliner",[]),"_inlineReturn_",[anIRNonLocalReturn]);
  20457. } else {
  20458. $1=smalltalk.send(self,"_transformNonLocalReturn_",[anIRNonLocalReturn]);
  20459. };
  20460. return $1;
  20461. },
  20462. args: ["anIRNonLocalReturn"],
  20463. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn) \x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ self transformNonLocalReturn: anIRNonLocalReturn ]",
  20464. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "nonLocalReturnInliner", "transformNonLocalReturn:", "shouldInlineReturn:"],
  20465. referencedClasses: []
  20466. }),
  20467. smalltalk.IRInliner);
  20468. smalltalk.addMethod(
  20469. "_visitIRReturn_",
  20470. smalltalk.method({
  20471. selector: "visitIRReturn:",
  20472. category: 'visiting',
  20473. fn: function (anIRReturn){
  20474. var self=this;
  20475. var $2,$1;
  20476. $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRReturn]);
  20477. if(smalltalk.assert($2)){
  20478. $1=smalltalk.send(smalltalk.send(self,"_returnInliner",[]),"_inlineReturn_",[anIRReturn]);
  20479. } else {
  20480. $1=smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  20481. };
  20482. return $1;
  20483. },
  20484. args: ["anIRReturn"],
  20485. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn) \x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  20486. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
  20487. referencedClasses: []
  20488. }),
  20489. smalltalk.IRInliner);
  20490. smalltalk.addMethod(
  20491. "_visitIRSend_",
  20492. smalltalk.method({
  20493. selector: "visitIRSend:",
  20494. category: 'visiting',
  20495. fn: function (anIRSend){
  20496. var self=this;
  20497. var $2,$1;
  20498. $2=smalltalk.send(self,"_shouldInlineSend_",[anIRSend]);
  20499. if(smalltalk.assert($2)){
  20500. $1=smalltalk.send(smalltalk.send(self,"_sendInliner",[]),"_inlineSend_",[anIRSend]);
  20501. } else {
  20502. $1=smalltalk.send(self,"_visitIRSend_",[anIRSend],smalltalk.IRVisitor);
  20503. };
  20504. return $1;
  20505. },
  20506. args: ["anIRSend"],
  20507. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  20508. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
  20509. referencedClasses: []
  20510. }),
  20511. smalltalk.IRInliner);
  20512. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  20513. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."
  20514. smalltalk.addMethod(
  20515. "_visitIRInlinedAssignment_",
  20516. smalltalk.method({
  20517. selector: "visitIRInlinedAssignment:",
  20518. category: 'visiting',
  20519. fn: function (anIRInlinedAssignment){
  20520. var self=this;
  20521. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedAssignment,"_instructions",[]),"_last",[])]);
  20522. return self},
  20523. args: ["anIRInlinedAssignment"],
  20524. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  20525. messageSends: ["visit:", "last", "instructions"],
  20526. referencedClasses: []
  20527. }),
  20528. smalltalk.IRInliningJSTranslator);
  20529. smalltalk.addMethod(
  20530. "_visitIRInlinedClosure_",
  20531. smalltalk.method({
  20532. selector: "visitIRInlinedClosure:",
  20533. category: 'visiting',
  20534. fn: function (anIRInlinedClosure){
  20535. var self=this;
  20536. smalltalk.send(smalltalk.send(anIRInlinedClosure,"_instructions",[]),"_do_",[(function(each){
  20537. return smalltalk.send(self,"_visit_",[each]);
  20538. })]);
  20539. return self},
  20540. args: ["anIRInlinedClosure"],
  20541. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  20542. messageSends: ["do:", "visit:", "instructions"],
  20543. referencedClasses: []
  20544. }),
  20545. smalltalk.IRInliningJSTranslator);
  20546. smalltalk.addMethod(
  20547. "_visitIRInlinedIfFalse_",
  20548. smalltalk.method({
  20549. selector: "visitIRInlinedIfFalse:",
  20550. category: 'visiting',
  20551. fn: function (anIRInlinedIfFalse){
  20552. var self=this;
  20553. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20554. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["! smalltalk.assert("]);
  20555. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_first",[])]);
  20556. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20557. }),(function(){
  20558. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_last",[])]);
  20559. })]);
  20560. return self},
  20561. args: ["anIRInlinedIfFalse"],
  20562. 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 ]",
  20563. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20564. referencedClasses: []
  20565. }),
  20566. smalltalk.IRInliningJSTranslator);
  20567. smalltalk.addMethod(
  20568. "_visitIRInlinedIfNil_",
  20569. smalltalk.method({
  20570. selector: "visitIRInlinedIfNil:",
  20571. category: 'visiting',
  20572. fn: function (anIRInlinedIfNil){
  20573. var self=this;
  20574. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20575. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
  20576. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_first",[])]);
  20577. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
  20578. }),(function(){
  20579. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_last",[])]);
  20580. })]);
  20581. return self},
  20582. args: ["anIRInlinedIfNil"],
  20583. 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 ]",
  20584. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20585. referencedClasses: []
  20586. }),
  20587. smalltalk.IRInliningJSTranslator);
  20588. smalltalk.addMethod(
  20589. "_visitIRInlinedIfNilIfNotNil_",
  20590. smalltalk.method({
  20591. selector: "visitIRInlinedIfNilIfNotNil:",
  20592. category: 'visiting',
  20593. fn: function (anIRInlinedIfNilIfNotNil){
  20594. var self=this;
  20595. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
  20596. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
  20597. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_first",[])]);
  20598. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
  20599. }),(function(){
  20600. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_second",[])]);
  20601. }),(function(){
  20602. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_third",[])]);
  20603. })]);
  20604. return self},
  20605. args: ["anIRInlinedIfNilIfNotNil"],
  20606. 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 ]",
  20607. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  20608. referencedClasses: []
  20609. }),
  20610. smalltalk.IRInliningJSTranslator);
  20611. smalltalk.addMethod(
  20612. "_visitIRInlinedIfTrue_",
  20613. smalltalk.method({
  20614. selector: "visitIRInlinedIfTrue:",
  20615. category: 'visiting',
  20616. fn: function (anIRInlinedIfTrue){
  20617. var self=this;
  20618. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20619. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
  20620. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_first",[])]);
  20621. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20622. }),(function(){
  20623. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_last",[])]);
  20624. })]);
  20625. return self},
  20626. args: ["anIRInlinedIfTrue"],
  20627. 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 ]",
  20628. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20629. referencedClasses: []
  20630. }),
  20631. smalltalk.IRInliningJSTranslator);
  20632. smalltalk.addMethod(
  20633. "_visitIRInlinedIfTrueIfFalse_",
  20634. smalltalk.method({
  20635. selector: "visitIRInlinedIfTrueIfFalse:",
  20636. category: 'visiting',
  20637. fn: function (anIRInlinedIfTrueIfFalse){
  20638. var self=this;
  20639. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
  20640. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
  20641. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_first",[])]);
  20642. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20643. }),(function(){
  20644. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_second",[])]);
  20645. }),(function(){
  20646. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_third",[])]);
  20647. })]);
  20648. return self},
  20649. args: ["anIRInlinedIfTrueIfFalse"],
  20650. 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 ]",
  20651. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  20652. referencedClasses: []
  20653. }),
  20654. smalltalk.IRInliningJSTranslator);
  20655. smalltalk.addMethod(
  20656. "_visitIRInlinedNonLocalReturn_",
  20657. smalltalk.method({
  20658. selector: "visitIRInlinedNonLocalReturn:",
  20659. category: 'visiting',
  20660. fn: function (anIRInlinedReturn){
  20661. var self=this;
  20662. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  20663. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  20664. })]);
  20665. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  20666. })]);
  20667. return self},
  20668. args: ["anIRInlinedReturn"],
  20669. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  20670. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
  20671. referencedClasses: []
  20672. }),
  20673. smalltalk.IRInliningJSTranslator);
  20674. smalltalk.addMethod(
  20675. "_visitIRInlinedReturn_",
  20676. smalltalk.method({
  20677. selector: "visitIRInlinedReturn:",
  20678. category: 'visiting',
  20679. fn: function (anIRInlinedReturn){
  20680. var self=this;
  20681. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  20682. return self},
  20683. args: ["anIRInlinedReturn"],
  20684. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  20685. messageSends: ["visit:", "last", "instructions"],
  20686. referencedClasses: []
  20687. }),
  20688. smalltalk.IRInliningJSTranslator);
  20689. smalltalk.addMethod(
  20690. "_visitIRInlinedSequence_",
  20691. smalltalk.method({
  20692. selector: "visitIRInlinedSequence:",
  20693. category: 'visiting',
  20694. fn: function (anIRInlinedSequence){
  20695. var self=this;
  20696. smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_do_",[(function(each){
  20697. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  20698. return smalltalk.send(self,"_visit_",[each]);
  20699. })]);
  20700. })]);
  20701. return self},
  20702. args: ["anIRInlinedSequence"],
  20703. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  20704. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  20705. referencedClasses: []
  20706. }),
  20707. smalltalk.IRInliningJSTranslator);
  20708. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  20709. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."
  20710. smalltalk.addMethod(
  20711. "_ifFalse_",
  20712. smalltalk.method({
  20713. selector: "ifFalse:",
  20714. category: 'inlining',
  20715. fn: function (anIRInstruction){
  20716. var self=this;
  20717. var $1;
  20718. $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse),"_new",[]),anIRInstruction]);
  20719. return $1;
  20720. },
  20721. args: ["anIRInstruction"],
  20722. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  20723. messageSends: ["inlinedSend:with:", "new"],
  20724. referencedClasses: ["IRInlinedIfFalse"]
  20725. }),
  20726. smalltalk.IRSendInliner);
  20727. smalltalk.addMethod(
  20728. "_ifFalse_ifTrue_",
  20729. smalltalk.method({
  20730. selector: "ifFalse:ifTrue:",
  20731. category: 'inlining',
  20732. fn: function (anIRInstruction,anotherIRInstruction){
  20733. var self=this;
  20734. var $1;
  20735. $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.symbolFor("ifTrue:ifFalse:"),[anotherIRInstruction,anIRInstruction]]);
  20736. return $1;
  20737. },
  20738. args: ["anIRInstruction", "anotherIRInstruction"],
  20739. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  20740. messageSends: ["perform:withArguments:"],
  20741. referencedClasses: []
  20742. }),
  20743. smalltalk.IRSendInliner);
  20744. smalltalk.addMethod(
  20745. "_ifNil_",
  20746. smalltalk.method({
  20747. selector: "ifNil:",
  20748. category: 'inlining',
  20749. fn: function (anIRInstruction){
  20750. var self=this;
  20751. var $2,$3,$4,$5,$1;
  20752. $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  20753. smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
  20754. $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
  20755. smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20756. $4=smalltalk.send($3,"_yourself",[]);
  20757. smalltalk.send($2,"_add_",[$4]);
  20758. $5=smalltalk.send($2,"_yourself",[]);
  20759. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,$5]);
  20760. return $1;
  20761. },
  20762. args: ["anIRInstruction"],
  20763. 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)",
  20764. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  20765. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  20766. }),
  20767. smalltalk.IRSendInliner);
  20768. smalltalk.addMethod(
  20769. "_ifNil_ifNotNil_",
  20770. smalltalk.method({
  20771. selector: "ifNil:ifNotNil:",
  20772. category: 'inlining',
  20773. fn: function (anIRInstruction,anotherIRInstruction){
  20774. var self=this;
  20775. var $1;
  20776. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,anotherIRInstruction]);
  20777. return $1;
  20778. },
  20779. args: ["anIRInstruction", "anotherIRInstruction"],
  20780. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  20781. messageSends: ["inlinedSend:with:with:", "new"],
  20782. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  20783. }),
  20784. smalltalk.IRSendInliner);
  20785. smalltalk.addMethod(
  20786. "_ifNotNil_",
  20787. smalltalk.method({
  20788. selector: "ifNotNil:",
  20789. category: 'inlining',
  20790. fn: function (anIRInstruction){
  20791. var self=this;
  20792. var $2,$3,$4,$5,$1;
  20793. $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  20794. smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
  20795. $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
  20796. smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20797. $4=smalltalk.send($3,"_yourself",[]);
  20798. smalltalk.send($2,"_add_",[$4]);
  20799. $5=smalltalk.send($2,"_yourself",[]);
  20800. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),$5,anIRInstruction]);
  20801. return $1;
  20802. },
  20803. args: ["anIRInstruction"],
  20804. 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",
  20805. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  20806. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  20807. }),
  20808. smalltalk.IRSendInliner);
  20809. smalltalk.addMethod(
  20810. "_ifNotNil_ifNil_",
  20811. smalltalk.method({
  20812. selector: "ifNotNil:ifNil:",
  20813. category: 'inlining',
  20814. fn: function (anIRInstruction,anotherIRInstruction){
  20815. var self=this;
  20816. var $1;
  20817. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anotherIRInstruction,anIRInstruction]);
  20818. return $1;
  20819. },
  20820. args: ["anIRInstruction", "anotherIRInstruction"],
  20821. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  20822. messageSends: ["inlinedSend:with:with:", "new"],
  20823. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  20824. }),
  20825. smalltalk.IRSendInliner);
  20826. smalltalk.addMethod(
  20827. "_ifTrue_",
  20828. smalltalk.method({
  20829. selector: "ifTrue:",
  20830. category: 'inlining',
  20831. fn: function (anIRInstruction){
  20832. var self=this;
  20833. var $1;
  20834. $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue),"_new",[]),anIRInstruction]);
  20835. return $1;
  20836. },
  20837. args: ["anIRInstruction"],
  20838. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  20839. messageSends: ["inlinedSend:with:", "new"],
  20840. referencedClasses: ["IRInlinedIfTrue"]
  20841. }),
  20842. smalltalk.IRSendInliner);
  20843. smalltalk.addMethod(
  20844. "_ifTrue_ifFalse_",
  20845. smalltalk.method({
  20846. selector: "ifTrue:ifFalse:",
  20847. category: 'inlining',
  20848. fn: function (anIRInstruction,anotherIRInstruction){
  20849. var self=this;
  20850. var $1;
  20851. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfTrueIfFalse || IRInlinedIfTrueIfFalse),"_new",[]),anIRInstruction,anotherIRInstruction]);
  20852. return $1;
  20853. },
  20854. args: ["anIRInstruction", "anotherIRInstruction"],
  20855. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  20856. messageSends: ["inlinedSend:with:with:", "new"],
  20857. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  20858. }),
  20859. smalltalk.IRSendInliner);
  20860. smalltalk.addMethod(
  20861. "_inlineClosure_",
  20862. smalltalk.method({
  20863. selector: "inlineClosure:",
  20864. category: 'inlining',
  20865. fn: function (anIRClosure){
  20866. var self=this;
  20867. var $1,$2;
  20868. var inlinedClosure;
  20869. var sequence;
  20870. var statements;
  20871. inlinedClosure=smalltalk.send(self,"_inlinedClosure",[]);
  20872. smalltalk.send(inlinedClosure,"_scope_",[smalltalk.send(anIRClosure,"_scope",[])]);
  20873. smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_do_",[(function(each){
  20874. $1=smalltalk.send(each,"_isSequence",[]);
  20875. if(! smalltalk.assert($1)){
  20876. return smalltalk.send(inlinedClosure,"_add_",[each]);
  20877. };
  20878. })]);
  20879. sequence=smalltalk.send(self,"_inlinedSequence",[]);
  20880. smalltalk.send(inlinedClosure,"_add_",[sequence]);
  20881. statements=smalltalk.send(smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
  20882. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  20883. smalltalk.send(smalltalk.send(statements,"_allButLast",[]),"_do_",[(function(each){
  20884. return smalltalk.send(sequence,"_add_",[each]);
  20885. })]);
  20886. $2=smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]),"_and_",[(function(){
  20887. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_isBlockReturn",[]);
  20888. })]);
  20889. if(smalltalk.assert($2)){
  20890. return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_instructions",[]),"_first",[])]);
  20891. } else {
  20892. return smalltalk.send(sequence,"_add_",[smalltalk.send(statements,"_last",[])]);
  20893. };
  20894. })]);
  20895. return inlinedClosure;
  20896. },
  20897. args: ["anIRClosure"],
  20898. 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 instructions do: [ :each | \x0a\x09\x09each isSequence ifFalse: [\x0a\x09\x09\x09inlinedClosure add: each ]].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\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",
  20899. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "ifFalse:", "add:", "isSequence", "instructions", "inlinedSequence", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"],
  20900. referencedClasses: []
  20901. }),
  20902. smalltalk.IRSendInliner);
  20903. smalltalk.addMethod(
  20904. "_inlineSend_",
  20905. smalltalk.method({
  20906. selector: "inlineSend:",
  20907. category: 'inlining',
  20908. fn: function (anIRSend){
  20909. var self=this;
  20910. var $1;
  20911. smalltalk.send(self,"_send_",[anIRSend]);
  20912. $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"_send",[]),"_selector",[]),smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_allButFirst",[])]);
  20913. return $1;
  20914. },
  20915. args: ["anIRSend"],
  20916. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self \x0a\x09\x09perform: self send selector \x0a\x09\x09withArguments: self send instructions allButFirst",
  20917. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  20918. referencedClasses: []
  20919. }),
  20920. smalltalk.IRSendInliner);
  20921. smalltalk.addMethod(
  20922. "_inlinedClosure",
  20923. smalltalk.method({
  20924. selector: "inlinedClosure",
  20925. category: 'factory',
  20926. fn: function (){
  20927. var self=this;
  20928. var $1;
  20929. $1=smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure),"_new",[]);
  20930. return $1;
  20931. },
  20932. args: [],
  20933. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  20934. messageSends: ["new"],
  20935. referencedClasses: ["IRInlinedClosure"]
  20936. }),
  20937. smalltalk.IRSendInliner);
  20938. smalltalk.addMethod(
  20939. "_inlinedSend_with_",
  20940. smalltalk.method({
  20941. selector: "inlinedSend:with:",
  20942. category: 'inlining',
  20943. fn: function (inlinedSend,anIRInstruction){
  20944. var self=this;
  20945. var $1,$2,$3;
  20946. var inlinedClosure;
  20947. $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
  20948. if(! smalltalk.assert($1)){
  20949. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20950. };
  20951. $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20952. if(! smalltalk.assert($2)){
  20953. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20954. };
  20955. inlinedClosure=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
  20956. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20957. $3=smalltalk.send(inlinedSend,"_add_",[inlinedClosure]);
  20958. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  20959. return inlinedSend;
  20960. },
  20961. args: ["inlinedSend", "anIRInstruction"],
  20962. 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",
  20963. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  20964. referencedClasses: []
  20965. }),
  20966. smalltalk.IRSendInliner);
  20967. smalltalk.addMethod(
  20968. "_inlinedSend_with_with_",
  20969. smalltalk.method({
  20970. selector: "inlinedSend:with:with:",
  20971. category: 'inlining',
  20972. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  20973. var self=this;
  20974. var $1,$2,$3,$4,$5;
  20975. var inlinedClosure1;
  20976. var inlinedClosure2;
  20977. $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
  20978. if(! smalltalk.assert($1)){
  20979. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20980. };
  20981. $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20982. if(! smalltalk.assert($2)){
  20983. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20984. };
  20985. $3=smalltalk.send(anotherIRInstruction,"_isClosure",[]);
  20986. if(! smalltalk.assert($3)){
  20987. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20988. };
  20989. $4=smalltalk.send(smalltalk.send(smalltalk.send(anotherIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20990. if(! smalltalk.assert($4)){
  20991. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20992. };
  20993. inlinedClosure1=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
  20994. inlinedClosure2=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anotherIRInstruction])]);
  20995. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20996. smalltalk.send(inlinedSend,"_add_",[inlinedClosure1]);
  20997. $5=smalltalk.send(inlinedSend,"_add_",[inlinedClosure2]);
  20998. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  20999. return inlinedSend;
  21000. },
  21001. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  21002. 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\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\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",
  21003. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  21004. referencedClasses: []
  21005. }),
  21006. smalltalk.IRSendInliner);
  21007. smalltalk.addMethod(
  21008. "_inlinedSequence",
  21009. smalltalk.method({
  21010. selector: "inlinedSequence",
  21011. category: 'factory',
  21012. fn: function (){
  21013. var self=this;
  21014. var $1;
  21015. $1=smalltalk.send((smalltalk.IRInlinedSequence || IRInlinedSequence),"_new",[]);
  21016. return $1;
  21017. },
  21018. args: [],
  21019. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  21020. messageSends: ["new"],
  21021. referencedClasses: ["IRInlinedSequence"]
  21022. }),
  21023. smalltalk.IRSendInliner);
  21024. smalltalk.addMethod(
  21025. "_inliningError_",
  21026. smalltalk.method({
  21027. selector: "inliningError:",
  21028. category: 'error handling',
  21029. fn: function (aString){
  21030. var self=this;
  21031. smalltalk.send((smalltalk.InliningError || InliningError),"_signal_",[aString]);
  21032. return self},
  21033. args: ["aString"],
  21034. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  21035. messageSends: ["signal:"],
  21036. referencedClasses: ["InliningError"]
  21037. }),
  21038. smalltalk.IRSendInliner);
  21039. smalltalk.addMethod(
  21040. "_send",
  21041. smalltalk.method({
  21042. selector: "send",
  21043. category: 'accessing',
  21044. fn: function (){
  21045. var self=this;
  21046. return self["@send"];
  21047. },
  21048. args: [],
  21049. source: "send\x0a\x09^ send",
  21050. messageSends: [],
  21051. referencedClasses: []
  21052. }),
  21053. smalltalk.IRSendInliner);
  21054. smalltalk.addMethod(
  21055. "_send_",
  21056. smalltalk.method({
  21057. selector: "send:",
  21058. category: 'accessing',
  21059. fn: function (anIRSend){
  21060. var self=this;
  21061. self["@send"]=anIRSend;
  21062. return self},
  21063. args: ["anIRSend"],
  21064. source: "send: anIRSend\x0a\x09send := anIRSend",
  21065. messageSends: [],
  21066. referencedClasses: []
  21067. }),
  21068. smalltalk.IRSendInliner);
  21069. smalltalk.addMethod(
  21070. "_translator",
  21071. smalltalk.method({
  21072. selector: "translator",
  21073. category: 'accessing',
  21074. fn: function (){
  21075. var self=this;
  21076. return self["@translator"];
  21077. },
  21078. args: [],
  21079. source: "translator\x0a\x09^ translator",
  21080. messageSends: [],
  21081. referencedClasses: []
  21082. }),
  21083. smalltalk.IRSendInliner);
  21084. smalltalk.addMethod(
  21085. "_translator_",
  21086. smalltalk.method({
  21087. selector: "translator:",
  21088. category: 'accessing',
  21089. fn: function (anASTTranslator){
  21090. var self=this;
  21091. self["@translator"]=anASTTranslator;
  21092. return self},
  21093. args: ["anASTTranslator"],
  21094. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  21095. messageSends: [],
  21096. referencedClasses: []
  21097. }),
  21098. smalltalk.IRSendInliner);
  21099. smalltalk.addMethod(
  21100. "_inlinedSelectors",
  21101. smalltalk.method({
  21102. selector: "inlinedSelectors",
  21103. category: 'accessing',
  21104. fn: function (){
  21105. var self=this;
  21106. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil"];
  21107. },
  21108. args: [],
  21109. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil')",
  21110. messageSends: [],
  21111. referencedClasses: []
  21112. }),
  21113. smalltalk.IRSendInliner.klass);
  21114. smalltalk.addMethod(
  21115. "_shouldInline_",
  21116. smalltalk.method({
  21117. selector: "shouldInline:",
  21118. category: 'accessing',
  21119. fn: function (anIRInstruction){
  21120. var self=this;
  21121. var $1,$2;
  21122. var $early={};
  21123. try {
  21124. $1=smalltalk.send(smalltalk.send(self,"_inlinedSelectors",[]),"_includes_",[smalltalk.send(anIRInstruction,"_selector",[])]);
  21125. if(! smalltalk.assert($1)){
  21126. return false;
  21127. };
  21128. smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_allButFirst",[]),"_do_",[(function(each){
  21129. $2=smalltalk.send(each,"_isClosure",[]);
  21130. if(! smalltalk.assert($2)){
  21131. throw $early=[false];
  21132. };
  21133. })]);
  21134. return true;
  21135. }
  21136. catch(e) {if(e===$early)return e[0]; throw e}
  21137. },
  21138. args: ["anIRInstruction"],
  21139. 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",
  21140. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
  21141. referencedClasses: []
  21142. }),
  21143. smalltalk.IRSendInliner.klass);
  21144. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  21145. 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};"
  21146. smalltalk.addMethod(
  21147. "_assignment",
  21148. smalltalk.method({
  21149. selector: "assignment",
  21150. category: 'accessing',
  21151. fn: function (){
  21152. var self=this;
  21153. return self["@assignment"];
  21154. },
  21155. args: [],
  21156. source: "assignment\x0a\x09^ assignment",
  21157. messageSends: [],
  21158. referencedClasses: []
  21159. }),
  21160. smalltalk.IRAssignmentInliner);
  21161. smalltalk.addMethod(
  21162. "_assignment_",
  21163. smalltalk.method({
  21164. selector: "assignment:",
  21165. category: 'accessing',
  21166. fn: function (aNode){
  21167. var self=this;
  21168. self["@assignment"]=aNode;
  21169. return self},
  21170. args: ["aNode"],
  21171. source: "assignment: aNode\x0a\x09assignment := aNode",
  21172. messageSends: [],
  21173. referencedClasses: []
  21174. }),
  21175. smalltalk.IRAssignmentInliner);
  21176. smalltalk.addMethod(
  21177. "_inlineAssignment_",
  21178. smalltalk.method({
  21179. selector: "inlineAssignment:",
  21180. category: 'inlining',
  21181. fn: function (anIRAssignment){
  21182. var self=this;
  21183. var inlinedAssignment;
  21184. smalltalk.send(self,"_assignment_",[anIRAssignment]);
  21185. inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment),"_new",[]);
  21186. smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_do_",[(function(each){
  21187. return smalltalk.send(inlinedAssignment,"_add_",[each]);
  21188. })]);
  21189. smalltalk.send(anIRAssignment,"_replaceWith_",[inlinedAssignment]);
  21190. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(inlinedAssignment,"_instructions",[]),"_last",[])]);
  21191. return inlinedAssignment;
  21192. },
  21193. args: ["anIRAssignment"],
  21194. 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",
  21195. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  21196. referencedClasses: ["IRInlinedAssignment"]
  21197. }),
  21198. smalltalk.IRAssignmentInliner);
  21199. smalltalk.addMethod(
  21200. "_inlineClosure_",
  21201. smalltalk.method({
  21202. selector: "inlineClosure:",
  21203. category: 'inlining',
  21204. fn: function (anIRClosure){
  21205. var self=this;
  21206. var $1,$2,$3;
  21207. var inlinedClosure;
  21208. var statements;
  21209. inlinedClosure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
  21210. statements=smalltalk.send(smalltalk.send(smalltalk.send(inlinedClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
  21211. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  21212. $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_canBeAssigned",[]);
  21213. if(smalltalk.assert($1)){
  21214. $2=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  21215. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_assignment",[]),"_instructions",[]),"_first",[])]);
  21216. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
  21217. $3=smalltalk.send($2,"_yourself",[]);
  21218. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
  21219. };
  21220. })]);
  21221. return inlinedClosure;
  21222. },
  21223. args: ["anIRClosure"],
  21224. 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",
  21225. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"],
  21226. referencedClasses: ["IRAssignment"]
  21227. }),
  21228. smalltalk.IRAssignmentInliner);
  21229. smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  21230. smalltalk.addMethod(
  21231. "_inlineClosure_",
  21232. smalltalk.method({
  21233. selector: "inlineClosure:",
  21234. category: 'inlining',
  21235. fn: function (anIRClosure){
  21236. var self=this;
  21237. var $1;
  21238. $1=smalltalk.send(self,"_inlineCLosure_",[anIRClosure],smalltalk.IRSendInliner);
  21239. return $1;
  21240. },
  21241. args: ["anIRClosure"],
  21242. source: "inlineClosure: anIRClosure\x0a\x09\x22| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last replaceWith: (IRNonLocalReturn new\x0a\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ inlinedClosure\x22\x0a\x0a\x09^ super inlineCLosure: anIRClosure",
  21243. messageSends: ["inlineCLosure:"],
  21244. referencedClasses: []
  21245. }),
  21246. smalltalk.IRNonLocalReturnInliner);
  21247. smalltalk.addMethod(
  21248. "_inlinedReturn",
  21249. smalltalk.method({
  21250. selector: "inlinedReturn",
  21251. category: 'factory',
  21252. fn: function (){
  21253. var self=this;
  21254. var $1;
  21255. $1=smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn),"_new",[]);
  21256. return $1;
  21257. },
  21258. args: [],
  21259. source: "inlinedReturn\x0a\x09^ IRInlinedNonLocalReturn new",
  21260. messageSends: ["new"],
  21261. referencedClasses: ["IRInlinedNonLocalReturn"]
  21262. }),
  21263. smalltalk.IRNonLocalReturnInliner);
  21264. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  21265. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."
  21266. smalltalk.addMethod(
  21267. "_inlineClosure_",
  21268. smalltalk.method({
  21269. selector: "inlineClosure:",
  21270. category: 'inlining',
  21271. fn: function (anIRClosure){
  21272. var self=this;
  21273. var $1,$2,$3;
  21274. var closure;
  21275. var statements;
  21276. closure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
  21277. statements=smalltalk.send(smalltalk.send(smalltalk.send(closure,"_instructions",[]),"_last",[]),"_instructions",[]);
  21278. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  21279. $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]);
  21280. if(! smalltalk.assert($1)){
  21281. $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  21282. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
  21283. $3=smalltalk.send($2,"_yourself",[]);
  21284. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
  21285. };
  21286. })]);
  21287. return closure;
  21288. },
  21289. args: ["anIRClosure"],
  21290. 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",
  21291. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"],
  21292. referencedClasses: ["IRReturn"]
  21293. }),
  21294. smalltalk.IRReturnInliner);
  21295. smalltalk.addMethod(
  21296. "_inlineReturn_",
  21297. smalltalk.method({
  21298. selector: "inlineReturn:",
  21299. category: 'inlining',
  21300. fn: function (anIRReturn){
  21301. var self=this;
  21302. var return_;
  21303. return_=smalltalk.send(self,"_inlinedReturn",[]);
  21304. smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_do_",[(function(each){
  21305. return smalltalk.send(return_,"_add_",[each]);
  21306. })]);
  21307. smalltalk.send(anIRReturn,"_replaceWith_",[return_]);
  21308. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(return_,"_instructions",[]),"_last",[])]);
  21309. return return_;
  21310. },
  21311. args: ["anIRReturn"],
  21312. 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",
  21313. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  21314. referencedClasses: []
  21315. }),
  21316. smalltalk.IRReturnInliner);
  21317. smalltalk.addMethod(
  21318. "_inlinedReturn",
  21319. smalltalk.method({
  21320. selector: "inlinedReturn",
  21321. category: 'factory',
  21322. fn: function (){
  21323. var self=this;
  21324. var $1;
  21325. $1=smalltalk.send((smalltalk.IRInlinedReturn || IRInlinedReturn),"_new",[]);
  21326. return $1;
  21327. },
  21328. args: [],
  21329. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  21330. messageSends: ["new"],
  21331. referencedClasses: ["IRInlinedReturn"]
  21332. }),
  21333. smalltalk.IRReturnInliner);
  21334. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  21335. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"
  21336. smalltalk.addMethod(
  21337. "_compileNode_",
  21338. smalltalk.method({
  21339. selector: "compileNode:",
  21340. category: 'compiling',
  21341. fn: function (aNode){
  21342. var self=this;
  21343. var $2,$3,$1;
  21344. var ir;
  21345. var stream;
  21346. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  21347. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  21348. smalltalk.send(smalltalk.send(self,"_inliner",[]),"_visit_",[ir]);
  21349. $2=smalltalk.send(self,"_irTranslator",[]);
  21350. smalltalk.send($2,"_visit_",[ir]);
  21351. $3=smalltalk.send($2,"_contents",[]);
  21352. $1=$3;
  21353. return $1;
  21354. },
  21355. args: ["aNode"],
  21356. 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",
  21357. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
  21358. referencedClasses: []
  21359. }),
  21360. smalltalk.InliningCodeGenerator);
  21361. smalltalk.addMethod(
  21362. "_inliner",
  21363. smalltalk.method({
  21364. selector: "inliner",
  21365. category: 'compiling',
  21366. fn: function (){
  21367. var self=this;
  21368. var $1;
  21369. $1=smalltalk.send((smalltalk.IRInliner || IRInliner),"_new",[]);
  21370. return $1;
  21371. },
  21372. args: [],
  21373. source: "inliner\x0a\x09^ IRInliner new",
  21374. messageSends: ["new"],
  21375. referencedClasses: ["IRInliner"]
  21376. }),
  21377. smalltalk.InliningCodeGenerator);
  21378. smalltalk.addMethod(
  21379. "_irTranslator",
  21380. smalltalk.method({
  21381. selector: "irTranslator",
  21382. category: 'compiling',
  21383. fn: function (){
  21384. var self=this;
  21385. var $1;
  21386. $1=smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator),"_new",[]);
  21387. return $1;
  21388. },
  21389. args: [],
  21390. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  21391. messageSends: ["new"],
  21392. referencedClasses: ["IRInliningJSTranslator"]
  21393. }),
  21394. smalltalk.InliningCodeGenerator);
  21395. smalltalk.addPackage('Compiler-Semantic', {});
  21396. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
  21397. 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."
  21398. smalltalk.addMethod(
  21399. "_addArg_",
  21400. smalltalk.method({
  21401. selector: "addArg:",
  21402. category: 'adding',
  21403. fn: function (aString) {
  21404. var self = this;
  21405. smalltalk.send(smalltalk.send(self, "_args", []), "_at_put_", [aString, smalltalk.send(smalltalk.ArgVar || ArgVar, "_on_", [aString])]);
  21406. smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_at_", [aString]), "_scope_", [self]);
  21407. return self;
  21408. },
  21409. args: ["aString"],
  21410. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  21411. messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
  21412. referencedClasses: ["ArgVar"]
  21413. }),
  21414. smalltalk.LexicalScope);
  21415. smalltalk.addMethod(
  21416. "_addTemp_",
  21417. smalltalk.method({
  21418. selector: "addTemp:",
  21419. category: 'adding',
  21420. fn: function (aString) {
  21421. var self = this;
  21422. smalltalk.send(smalltalk.send(self, "_temps", []), "_at_put_", [aString, smalltalk.send(smalltalk.TempVar || TempVar, "_on_", [aString])]);
  21423. smalltalk.send(smalltalk.send(smalltalk.send(self, "_temps", []), "_at_", [aString]), "_scope_", [self]);
  21424. return self;
  21425. },
  21426. args: ["aString"],
  21427. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  21428. messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
  21429. referencedClasses: ["TempVar"]
  21430. }),
  21431. smalltalk.LexicalScope);
  21432. smalltalk.addMethod(
  21433. "_allVariableNames",
  21434. smalltalk.method({
  21435. selector: "allVariableNames",
  21436. category: 'accessing',
  21437. fn: function () {
  21438. var self = this;
  21439. var $1;
  21440. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_keys", []), "__comma", [smalltalk.send(smalltalk.send(self, "_temps", []), "_keys", [])]);
  21441. return $1;
  21442. },
  21443. args: [],
  21444. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  21445. messageSends: [",", "keys", "temps", "args"],
  21446. referencedClasses: []
  21447. }),
  21448. smalltalk.LexicalScope);
  21449. smalltalk.addMethod(
  21450. "_args",
  21451. smalltalk.method({
  21452. selector: "args",
  21453. category: 'accessing',
  21454. fn: function () {
  21455. var self = this;
  21456. var $1;
  21457. if (($receiver = self['@args']) == nil || $receiver == undefined) {
  21458. self['@args'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21459. $1 = self['@args'];
  21460. } else {
  21461. $1 = self['@args'];
  21462. }
  21463. return $1;
  21464. },
  21465. args: [],
  21466. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  21467. messageSends: ["ifNil:", "new"],
  21468. referencedClasses: ["Dictionary"]
  21469. }),
  21470. smalltalk.LexicalScope);
  21471. smalltalk.addMethod(
  21472. "_bindingFor_",
  21473. smalltalk.method({
  21474. selector: "bindingFor:",
  21475. category: 'accessing',
  21476. fn: function (aStringOrNode) {
  21477. var self = this;
  21478. var $1;
  21479. $1 = smalltalk.send(smalltalk.send(self, "_pseudoVars", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return smalltalk.send(smalltalk.send(self, "_args", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return smalltalk.send(smalltalk.send(self, "_temps", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return nil;}]);}]);}]);
  21480. return $1;
  21481. },
  21482. args: ["aStringOrNode"],
  21483. 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 ]]]",
  21484. messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
  21485. referencedClasses: []
  21486. }),
  21487. smalltalk.LexicalScope);
  21488. smalltalk.addMethod(
  21489. "_canInlineNonLocalReturns",
  21490. smalltalk.method({
  21491. selector: "canInlineNonLocalReturns",
  21492. category: 'testing',
  21493. fn: function () {
  21494. var self = this;
  21495. var $1;
  21496. $1 = smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [function () {return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);}]);
  21497. return $1;
  21498. },
  21499. args: [],
  21500. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  21501. messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
  21502. referencedClasses: []
  21503. }),
  21504. smalltalk.LexicalScope);
  21505. smalltalk.addMethod(
  21506. "_instruction",
  21507. smalltalk.method({
  21508. selector: "instruction",
  21509. category: 'accessing',
  21510. fn: function () {
  21511. var self = this;
  21512. return self['@instruction'];
  21513. },
  21514. args: [],
  21515. source: "instruction\x0a\x09^ instruction",
  21516. messageSends: [],
  21517. referencedClasses: []
  21518. }),
  21519. smalltalk.LexicalScope);
  21520. smalltalk.addMethod(
  21521. "_instruction_",
  21522. smalltalk.method({
  21523. selector: "instruction:",
  21524. category: 'accessing',
  21525. fn: function (anIRInstruction) {
  21526. var self = this;
  21527. self['@instruction'] = anIRInstruction;
  21528. return self;
  21529. },
  21530. args: ["anIRInstruction"],
  21531. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  21532. messageSends: [],
  21533. referencedClasses: []
  21534. }),
  21535. smalltalk.LexicalScope);
  21536. smalltalk.addMethod(
  21537. "_isBlockScope",
  21538. smalltalk.method({
  21539. selector: "isBlockScope",
  21540. category: 'testing',
  21541. fn: function () {
  21542. var self = this;
  21543. var $1;
  21544. $1 = smalltalk.send(smalltalk.send(self, "_isMethodScope", []), "_not", []);
  21545. return $1;
  21546. },
  21547. args: [],
  21548. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  21549. messageSends: ["not", "isMethodScope"],
  21550. referencedClasses: []
  21551. }),
  21552. smalltalk.LexicalScope);
  21553. smalltalk.addMethod(
  21554. "_isInlined",
  21555. smalltalk.method({
  21556. selector: "isInlined",
  21557. category: 'testing',
  21558. fn: function () {
  21559. var self = this;
  21560. var $1;
  21561. $1 = smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
  21562. return $1;
  21563. },
  21564. args: [],
  21565. source: "isInlined\x0a\x09^ self instruction isInlined",
  21566. messageSends: ["isInlined", "instruction"],
  21567. referencedClasses: []
  21568. }),
  21569. smalltalk.LexicalScope);
  21570. smalltalk.addMethod(
  21571. "_isMethodScope",
  21572. smalltalk.method({
  21573. selector: "isMethodScope",
  21574. category: 'testing',
  21575. fn: function () {
  21576. var self = this;
  21577. return false;
  21578. },
  21579. args: [],
  21580. source: "isMethodScope\x0a\x09^ false",
  21581. messageSends: [],
  21582. referencedClasses: []
  21583. }),
  21584. smalltalk.LexicalScope);
  21585. smalltalk.addMethod(
  21586. "_lookupVariable_",
  21587. smalltalk.method({
  21588. selector: "lookupVariable:",
  21589. category: 'accessing',
  21590. fn: function (aNode) {
  21591. var self = this;
  21592. var $1;
  21593. var lookup;
  21594. lookup = smalltalk.send(self, "_bindingFor_", [aNode]);
  21595. if (($receiver = lookup) == nil || $receiver == undefined) {
  21596. $1 = smalltalk.send(self, "_outerScope", []);
  21597. if (($receiver = $1) == nil || $receiver == undefined) {
  21598. lookup = $1;
  21599. } else {
  21600. lookup = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_lookupVariable_", [aNode]);
  21601. }
  21602. } else {
  21603. }
  21604. return lookup;
  21605. },
  21606. args: ["aNode"],
  21607. 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",
  21608. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
  21609. referencedClasses: []
  21610. }),
  21611. smalltalk.LexicalScope);
  21612. smalltalk.addMethod(
  21613. "_methodScope",
  21614. smalltalk.method({
  21615. selector: "methodScope",
  21616. category: 'accessing',
  21617. fn: function () {
  21618. var self = this;
  21619. var $2, $1;
  21620. $2 = smalltalk.send(self, "_outerScope", []);
  21621. if (($receiver = $2) == nil || $receiver == undefined) {
  21622. $1 = $2;
  21623. } else {
  21624. $1 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_methodScope", []);
  21625. }
  21626. return $1;
  21627. },
  21628. args: [],
  21629. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  21630. messageSends: ["ifNotNil:", "methodScope", "outerScope"],
  21631. referencedClasses: []
  21632. }),
  21633. smalltalk.LexicalScope);
  21634. smalltalk.addMethod(
  21635. "_node",
  21636. smalltalk.method({
  21637. selector: "node",
  21638. category: 'accessing',
  21639. fn: function () {
  21640. var self = this;
  21641. return self['@node'];
  21642. },
  21643. args: [],
  21644. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  21645. messageSends: [],
  21646. referencedClasses: []
  21647. }),
  21648. smalltalk.LexicalScope);
  21649. smalltalk.addMethod(
  21650. "_node_",
  21651. smalltalk.method({
  21652. selector: "node:",
  21653. category: 'accessing',
  21654. fn: function (aNode) {
  21655. var self = this;
  21656. self['@node'] = aNode;
  21657. return self;
  21658. },
  21659. args: ["aNode"],
  21660. source: "node: aNode\x0a\x09node := aNode",
  21661. messageSends: [],
  21662. referencedClasses: []
  21663. }),
  21664. smalltalk.LexicalScope);
  21665. smalltalk.addMethod(
  21666. "_outerScope",
  21667. smalltalk.method({
  21668. selector: "outerScope",
  21669. category: 'accessing',
  21670. fn: function () {
  21671. var self = this;
  21672. return self['@outerScope'];
  21673. },
  21674. args: [],
  21675. source: "outerScope\x0a\x09^ outerScope",
  21676. messageSends: [],
  21677. referencedClasses: []
  21678. }),
  21679. smalltalk.LexicalScope);
  21680. smalltalk.addMethod(
  21681. "_outerScope_",
  21682. smalltalk.method({
  21683. selector: "outerScope:",
  21684. category: 'accessing',
  21685. fn: function (aLexicalScope) {
  21686. var self = this;
  21687. self['@outerScope'] = aLexicalScope;
  21688. return self;
  21689. },
  21690. args: ["aLexicalScope"],
  21691. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  21692. messageSends: [],
  21693. referencedClasses: []
  21694. }),
  21695. smalltalk.LexicalScope);
  21696. smalltalk.addMethod(
  21697. "_pseudoVars",
  21698. smalltalk.method({
  21699. selector: "pseudoVars",
  21700. category: 'accessing',
  21701. fn: function () {
  21702. var self = this;
  21703. var $1;
  21704. $1 = smalltalk.send(smalltalk.send(self, "_methodScope", []), "_pseudoVars", []);
  21705. return $1;
  21706. },
  21707. args: [],
  21708. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  21709. messageSends: ["pseudoVars", "methodScope"],
  21710. referencedClasses: []
  21711. }),
  21712. smalltalk.LexicalScope);
  21713. smalltalk.addMethod(
  21714. "_scopeLevel",
  21715. smalltalk.method({
  21716. selector: "scopeLevel",
  21717. category: 'accessing',
  21718. fn: function () {
  21719. var self = this;
  21720. var $3, $2, $1;
  21721. $3 = smalltalk.send(self, "_outerScope", []);
  21722. if (($receiver = $3) == nil || $receiver == undefined) {
  21723. $2 = 0;
  21724. } else {
  21725. $2 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_scopeLevel", []);
  21726. }
  21727. $1 = smalltalk.send($2, "__plus", [1]);
  21728. return $1;
  21729. },
  21730. args: [],
  21731. source: "scopeLevel\x0a\x09^ (self outerScope \x0a\x09\x09ifNil: [ 0 ]\x0a\x09\x09ifNotNil: [ self outerScope scopeLevel ]) + 1",
  21732. messageSends: ["+", "ifNil:ifNotNil:", "scopeLevel", "outerScope"],
  21733. referencedClasses: []
  21734. }),
  21735. smalltalk.LexicalScope);
  21736. smalltalk.addMethod(
  21737. "_temps",
  21738. smalltalk.method({
  21739. selector: "temps",
  21740. category: 'accessing',
  21741. fn: function () {
  21742. var self = this;
  21743. var $1;
  21744. if (($receiver = self['@temps']) == nil || $receiver == undefined) {
  21745. self['@temps'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21746. $1 = self['@temps'];
  21747. } else {
  21748. $1 = self['@temps'];
  21749. }
  21750. return $1;
  21751. },
  21752. args: [],
  21753. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  21754. messageSends: ["ifNil:", "new"],
  21755. referencedClasses: ["Dictionary"]
  21756. }),
  21757. smalltalk.LexicalScope);
  21758. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  21759. smalltalk.MethodLexicalScope.comment="I represent a method scope."
  21760. smalltalk.addMethod(
  21761. "_addIVar_",
  21762. smalltalk.method({
  21763. selector: "addIVar:",
  21764. category: 'adding',
  21765. fn: function (aString) {
  21766. var self = this;
  21767. smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_put_", [aString, smalltalk.send(smalltalk.InstanceVar || InstanceVar, "_on_", [aString])]);
  21768. smalltalk.send(smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_", [aString]), "_scope_", [self]);
  21769. return self;
  21770. },
  21771. args: ["aString"],
  21772. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  21773. messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
  21774. referencedClasses: ["InstanceVar"]
  21775. }),
  21776. smalltalk.MethodLexicalScope);
  21777. smalltalk.addMethod(
  21778. "_addNonLocalReturn_",
  21779. smalltalk.method({
  21780. selector: "addNonLocalReturn:",
  21781. category: 'adding',
  21782. fn: function (aScope) {
  21783. var self = this;
  21784. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
  21785. return self;
  21786. },
  21787. args: ["aScope"],
  21788. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  21789. messageSends: ["add:", "nonLocalReturns"],
  21790. referencedClasses: []
  21791. }),
  21792. smalltalk.MethodLexicalScope);
  21793. smalltalk.addMethod(
  21794. "_allVariableNames",
  21795. smalltalk.method({
  21796. selector: "allVariableNames",
  21797. category: 'accessing',
  21798. fn: function () {
  21799. var self = this;
  21800. var $1;
  21801. $1 = smalltalk.send(smalltalk.send(self, "_allVariableNames", [], smalltalk.LexicalScope), "__comma", [smalltalk.send(smalltalk.send(self, "_iVars", []), "_keys", [])]);
  21802. return $1;
  21803. },
  21804. args: [],
  21805. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  21806. messageSends: [",", "keys", "iVars", "allVariableNames"],
  21807. referencedClasses: []
  21808. }),
  21809. smalltalk.MethodLexicalScope);
  21810. smalltalk.addMethod(
  21811. "_bindingFor_",
  21812. smalltalk.method({
  21813. selector: "bindingFor:",
  21814. category: 'accessing',
  21815. fn: function (aNode) {
  21816. var self = this;
  21817. var $2, $1;
  21818. $2 = smalltalk.send(self, "_bindingFor_", [aNode], smalltalk.LexicalScope);
  21819. if (($receiver = $2) == nil || $receiver == undefined) {
  21820. $1 = smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_ifAbsent_", [smalltalk.send(aNode, "_value", []), function () {return nil;}]);
  21821. } else {
  21822. $1 = $2;
  21823. }
  21824. return $1;
  21825. },
  21826. args: ["aNode"],
  21827. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  21828. messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
  21829. referencedClasses: []
  21830. }),
  21831. smalltalk.MethodLexicalScope);
  21832. smalltalk.addMethod(
  21833. "_canInlineNonLocalReturns",
  21834. smalltalk.method({
  21835. selector: "canInlineNonLocalReturns",
  21836. category: 'testing',
  21837. fn: function () {
  21838. var self = this;
  21839. return true;
  21840. },
  21841. args: [],
  21842. source: "canInlineNonLocalReturns\x0a\x09^ true",
  21843. messageSends: [],
  21844. referencedClasses: []
  21845. }),
  21846. smalltalk.MethodLexicalScope);
  21847. smalltalk.addMethod(
  21848. "_hasLocalReturn",
  21849. smalltalk.method({
  21850. selector: "hasLocalReturn",
  21851. category: 'testing',
  21852. fn: function () {
  21853. var self = this;
  21854. var $1;
  21855. $1 = smalltalk.send(self, "_localReturn", []);
  21856. return $1;
  21857. },
  21858. args: [],
  21859. source: "hasLocalReturn\x0a\x09^ self localReturn",
  21860. messageSends: ["localReturn"],
  21861. referencedClasses: []
  21862. }),
  21863. smalltalk.MethodLexicalScope);
  21864. smalltalk.addMethod(
  21865. "_hasNonLocalReturn",
  21866. smalltalk.method({
  21867. selector: "hasNonLocalReturn",
  21868. category: 'testing',
  21869. fn: function () {
  21870. var self = this;
  21871. var $1;
  21872. $1 = smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_notEmpty", []);
  21873. return $1;
  21874. },
  21875. args: [],
  21876. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  21877. messageSends: ["notEmpty", "nonLocalReturns"],
  21878. referencedClasses: []
  21879. }),
  21880. smalltalk.MethodLexicalScope);
  21881. smalltalk.addMethod(
  21882. "_iVars",
  21883. smalltalk.method({
  21884. selector: "iVars",
  21885. category: 'accessing',
  21886. fn: function () {
  21887. var self = this;
  21888. var $1;
  21889. if (($receiver = self['@iVars']) == nil || $receiver == undefined) {
  21890. self['@iVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21891. $1 = self['@iVars'];
  21892. } else {
  21893. $1 = self['@iVars'];
  21894. }
  21895. return $1;
  21896. },
  21897. args: [],
  21898. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  21899. messageSends: ["ifNil:", "new"],
  21900. referencedClasses: ["Dictionary"]
  21901. }),
  21902. smalltalk.MethodLexicalScope);
  21903. smalltalk.addMethod(
  21904. "_isMethodScope",
  21905. smalltalk.method({
  21906. selector: "isMethodScope",
  21907. category: 'testing',
  21908. fn: function () {
  21909. var self = this;
  21910. return true;
  21911. },
  21912. args: [],
  21913. source: "isMethodScope\x0a\x09^ true",
  21914. messageSends: [],
  21915. referencedClasses: []
  21916. }),
  21917. smalltalk.MethodLexicalScope);
  21918. smalltalk.addMethod(
  21919. "_localReturn",
  21920. smalltalk.method({
  21921. selector: "localReturn",
  21922. category: 'accessing',
  21923. fn: function () {
  21924. var self = this;
  21925. var $1;
  21926. if (($receiver = self['@localReturn']) == nil || $receiver == undefined) {
  21927. $1 = false;
  21928. } else {
  21929. $1 = self['@localReturn'];
  21930. }
  21931. return $1;
  21932. },
  21933. args: [],
  21934. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  21935. messageSends: ["ifNil:"],
  21936. referencedClasses: []
  21937. }),
  21938. smalltalk.MethodLexicalScope);
  21939. smalltalk.addMethod(
  21940. "_localReturn_",
  21941. smalltalk.method({
  21942. selector: "localReturn:",
  21943. category: 'accessing',
  21944. fn: function (aBoolean) {
  21945. var self = this;
  21946. self['@localReturn'] = aBoolean;
  21947. return self;
  21948. },
  21949. args: ["aBoolean"],
  21950. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  21951. messageSends: [],
  21952. referencedClasses: []
  21953. }),
  21954. smalltalk.MethodLexicalScope);
  21955. smalltalk.addMethod(
  21956. "_methodScope",
  21957. smalltalk.method({
  21958. selector: "methodScope",
  21959. category: 'accessing',
  21960. fn: function () {
  21961. var self = this;
  21962. return self;
  21963. },
  21964. args: [],
  21965. source: "methodScope\x0a\x09^ self",
  21966. messageSends: [],
  21967. referencedClasses: []
  21968. }),
  21969. smalltalk.MethodLexicalScope);
  21970. smalltalk.addMethod(
  21971. "_nonLocalReturns",
  21972. smalltalk.method({
  21973. selector: "nonLocalReturns",
  21974. category: 'accessing',
  21975. fn: function () {
  21976. var self = this;
  21977. var $1;
  21978. if (($receiver = self['@nonLocalReturns']) == nil ||
  21979. $receiver == undefined) {
  21980. self['@nonLocalReturns'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  21981. $1 = self['@nonLocalReturns'];
  21982. } else {
  21983. $1 = self['@nonLocalReturns'];
  21984. }
  21985. return $1;
  21986. },
  21987. args: [],
  21988. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  21989. messageSends: ["ifNil:", "new"],
  21990. referencedClasses: ["OrderedCollection"]
  21991. }),
  21992. smalltalk.MethodLexicalScope);
  21993. smalltalk.addMethod(
  21994. "_pseudoVars",
  21995. smalltalk.method({
  21996. selector: "pseudoVars",
  21997. category: 'accessing',
  21998. fn: function () {
  21999. var self = this;
  22000. var $1, $2;
  22001. if (($receiver = self['@pseudoVars']) == nil || $receiver == undefined) {
  22002. self['@pseudoVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  22003. self['@pseudoVars'];
  22004. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_pseudoVariableNames", []), "_do_", [function (each) {$1 = smalltalk.send(smalltalk.PseudoVar || PseudoVar, "_on_", [each]);smalltalk.send($1, "_scope_", [smalltalk.send(self, "_methodScope", [])]);$2 = smalltalk.send($1, "_yourself", []);return smalltalk.send(self['@pseudoVars'], "_at_put_", [each, $2]);}]);
  22005. } else {
  22006. self['@pseudoVars'];
  22007. }
  22008. return self['@pseudoVars'];
  22009. },
  22010. args: [],
  22011. 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",
  22012. messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
  22013. referencedClasses: ["Dictionary", "PseudoVar", "Smalltalk"]
  22014. }),
  22015. smalltalk.MethodLexicalScope);
  22016. smalltalk.addMethod(
  22017. "_removeNonLocalReturn_",
  22018. smalltalk.method({
  22019. selector: "removeNonLocalReturn:",
  22020. category: 'adding',
  22021. fn: function (aScope) {
  22022. var self = this;
  22023. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, function () {}]);
  22024. return self;
  22025. },
  22026. args: ["aScope"],
  22027. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  22028. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  22029. referencedClasses: []
  22030. }),
  22031. smalltalk.MethodLexicalScope);
  22032. smalltalk.addMethod(
  22033. "_unknownVariables",
  22034. smalltalk.method({
  22035. selector: "unknownVariables",
  22036. category: 'accessing',
  22037. fn: function () {
  22038. var self = this;
  22039. var $1;
  22040. if (($receiver = self['@unknownVariables']) == nil ||
  22041. $receiver == undefined) {
  22042. self['@unknownVariables'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  22043. $1 = self['@unknownVariables'];
  22044. } else {
  22045. $1 = self['@unknownVariables'];
  22046. }
  22047. return $1;
  22048. },
  22049. args: [],
  22050. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  22051. messageSends: ["ifNil:", "new"],
  22052. referencedClasses: ["OrderedCollection"]
  22053. }),
  22054. smalltalk.MethodLexicalScope);
  22055. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  22056. 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."
  22057. smalltalk.addMethod(
  22058. "_alias",
  22059. smalltalk.method({
  22060. selector: "alias",
  22061. category: 'accessing',
  22062. fn: function () {
  22063. var self = this;
  22064. var $1;
  22065. $1 = smalltalk.send(smalltalk.send(self, "_name", []), "_asVariableName", []);
  22066. return $1;
  22067. },
  22068. args: [],
  22069. source: "alias\x0a\x09^ self name asVariableName",
  22070. messageSends: ["asVariableName", "name"],
  22071. referencedClasses: []
  22072. }),
  22073. smalltalk.ScopeVar);
  22074. smalltalk.addMethod(
  22075. "_isArgVar",
  22076. smalltalk.method({
  22077. selector: "isArgVar",
  22078. category: 'testing',
  22079. fn: function () {
  22080. var self = this;
  22081. return false;
  22082. },
  22083. args: [],
  22084. source: "isArgVar\x0a\x09^ false",
  22085. messageSends: [],
  22086. referencedClasses: []
  22087. }),
  22088. smalltalk.ScopeVar);
  22089. smalltalk.addMethod(
  22090. "_isClassRefVar",
  22091. smalltalk.method({
  22092. selector: "isClassRefVar",
  22093. category: 'testing',
  22094. fn: function () {
  22095. var self = this;
  22096. return false;
  22097. },
  22098. args: [],
  22099. source: "isClassRefVar\x0a\x09^ false",
  22100. messageSends: [],
  22101. referencedClasses: []
  22102. }),
  22103. smalltalk.ScopeVar);
  22104. smalltalk.addMethod(
  22105. "_isInstanceVar",
  22106. smalltalk.method({
  22107. selector: "isInstanceVar",
  22108. category: 'testing',
  22109. fn: function () {
  22110. var self = this;
  22111. return false;
  22112. },
  22113. args: [],
  22114. source: "isInstanceVar\x0a\x09^ false",
  22115. messageSends: [],
  22116. referencedClasses: []
  22117. }),
  22118. smalltalk.ScopeVar);
  22119. smalltalk.addMethod(
  22120. "_isPseudoVar",
  22121. smalltalk.method({
  22122. selector: "isPseudoVar",
  22123. category: 'testing',
  22124. fn: function () {
  22125. var self = this;
  22126. return false;
  22127. },
  22128. args: [],
  22129. source: "isPseudoVar\x0a\x09^ false",
  22130. messageSends: [],
  22131. referencedClasses: []
  22132. }),
  22133. smalltalk.ScopeVar);
  22134. smalltalk.addMethod(
  22135. "_isTempVar",
  22136. smalltalk.method({
  22137. selector: "isTempVar",
  22138. category: 'testing',
  22139. fn: function () {
  22140. var self = this;
  22141. return false;
  22142. },
  22143. args: [],
  22144. source: "isTempVar\x0a\x09^ false",
  22145. messageSends: [],
  22146. referencedClasses: []
  22147. }),
  22148. smalltalk.ScopeVar);
  22149. smalltalk.addMethod(
  22150. "_isUnknownVar",
  22151. smalltalk.method({
  22152. selector: "isUnknownVar",
  22153. category: 'testing',
  22154. fn: function () {
  22155. var self = this;
  22156. return false;
  22157. },
  22158. args: [],
  22159. source: "isUnknownVar\x0a\x09^ false",
  22160. messageSends: [],
  22161. referencedClasses: []
  22162. }),
  22163. smalltalk.ScopeVar);
  22164. smalltalk.addMethod(
  22165. "_name",
  22166. smalltalk.method({
  22167. selector: "name",
  22168. category: 'accessing',
  22169. fn: function () {
  22170. var self = this;
  22171. return self['@name'];
  22172. },
  22173. args: [],
  22174. source: "name\x0a\x09^ name",
  22175. messageSends: [],
  22176. referencedClasses: []
  22177. }),
  22178. smalltalk.ScopeVar);
  22179. smalltalk.addMethod(
  22180. "_name_",
  22181. smalltalk.method({
  22182. selector: "name:",
  22183. category: 'accessing',
  22184. fn: function (aString) {
  22185. var self = this;
  22186. self['@name'] = aString;
  22187. return self;
  22188. },
  22189. args: ["aString"],
  22190. source: "name: aString\x0a\x09name := aString",
  22191. messageSends: [],
  22192. referencedClasses: []
  22193. }),
  22194. smalltalk.ScopeVar);
  22195. smalltalk.addMethod(
  22196. "_scope",
  22197. smalltalk.method({
  22198. selector: "scope",
  22199. category: 'accessing',
  22200. fn: function () {
  22201. var self = this;
  22202. return self['@scope'];
  22203. },
  22204. args: [],
  22205. source: "scope\x0a\x09^ scope",
  22206. messageSends: [],
  22207. referencedClasses: []
  22208. }),
  22209. smalltalk.ScopeVar);
  22210. smalltalk.addMethod(
  22211. "_scope_",
  22212. smalltalk.method({
  22213. selector: "scope:",
  22214. category: 'accessing',
  22215. fn: function (aScope) {
  22216. var self = this;
  22217. self['@scope'] = aScope;
  22218. return self;
  22219. },
  22220. args: ["aScope"],
  22221. source: "scope: aScope\x0a\x09scope := aScope",
  22222. messageSends: [],
  22223. referencedClasses: []
  22224. }),
  22225. smalltalk.ScopeVar);
  22226. smalltalk.addMethod(
  22227. "_validateAssignment",
  22228. smalltalk.method({
  22229. selector: "validateAssignment",
  22230. category: 'testing',
  22231. fn: function () {
  22232. var self = this;
  22233. var $1, $2, $3;
  22234. $1 = smalltalk.send(smalltalk.send(self, "_isArgVar", []), "_or_", [function () {return smalltalk.send(self, "_isPseudoVar", []);}]);
  22235. if (smalltalk.assert($1)) {
  22236. $2 = smalltalk.send(smalltalk.InvalidAssignmentError || InvalidAssignmentError, "_new", []);
  22237. smalltalk.send($2, "_variableName_", [smalltalk.send(self, "_name", [])]);
  22238. $3 = smalltalk.send($2, "_signal", []);
  22239. }
  22240. return self;
  22241. },
  22242. args: [],
  22243. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  22244. messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
  22245. referencedClasses: ["InvalidAssignmentError"]
  22246. }),
  22247. smalltalk.ScopeVar);
  22248. smalltalk.addMethod(
  22249. "_on_",
  22250. smalltalk.method({
  22251. selector: "on:",
  22252. category: 'instance creation',
  22253. fn: function (aString) {
  22254. var self = this;
  22255. var $2, $3, $1;
  22256. $2 = smalltalk.send(self, "_new", []);
  22257. smalltalk.send($2, "_name_", [aString]);
  22258. $3 = smalltalk.send($2, "_yourself", []);
  22259. $1 = $3;
  22260. return $1;
  22261. },
  22262. args: ["aString"],
  22263. source: "on: aString\x0a\x09^ self new \x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22264. messageSends: ["name:", "new", "yourself"],
  22265. referencedClasses: []
  22266. }),
  22267. smalltalk.ScopeVar.klass);
  22268. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  22269. smalltalk.AliasVar.comment="I am an internally defined variable by the compiler"
  22270. smalltalk.addMethod(
  22271. "_node",
  22272. smalltalk.method({
  22273. selector: "node",
  22274. category: 'accessing',
  22275. fn: function () {
  22276. var self = this;
  22277. return self['@node'];
  22278. },
  22279. args: [],
  22280. source: "node\x0a\x09^ node",
  22281. messageSends: [],
  22282. referencedClasses: []
  22283. }),
  22284. smalltalk.AliasVar);
  22285. smalltalk.addMethod(
  22286. "_node_",
  22287. smalltalk.method({
  22288. selector: "node:",
  22289. category: 'accessing',
  22290. fn: function (aNode) {
  22291. var self = this;
  22292. self['@node'] = aNode;
  22293. return self;
  22294. },
  22295. args: ["aNode"],
  22296. source: "node: aNode\x0a\x09node := aNode",
  22297. messageSends: [],
  22298. referencedClasses: []
  22299. }),
  22300. smalltalk.AliasVar);
  22301. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22302. smalltalk.ArgVar.comment="I am an argument of a method or block."
  22303. smalltalk.addMethod(
  22304. "_isArgVar",
  22305. smalltalk.method({
  22306. selector: "isArgVar",
  22307. category: 'testing',
  22308. fn: function () {
  22309. var self = this;
  22310. return true;
  22311. },
  22312. args: [],
  22313. source: "isArgVar\x0a\x09^ true",
  22314. messageSends: [],
  22315. referencedClasses: []
  22316. }),
  22317. smalltalk.ArgVar);
  22318. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22319. smalltalk.ClassRefVar.comment="I am an class reference variable"
  22320. smalltalk.addMethod(
  22321. "_alias",
  22322. smalltalk.method({
  22323. selector: "alias",
  22324. category: 'accessing',
  22325. fn: function () {
  22326. var self = this;
  22327. var $1;
  22328. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [")"]);
  22329. return $1;
  22330. },
  22331. args: [],
  22332. source: "alias\x0a\x09^ '(smalltalk.', self name, ' || ', self name, ')'",
  22333. messageSends: [",", "name"],
  22334. referencedClasses: []
  22335. }),
  22336. smalltalk.ClassRefVar);
  22337. smalltalk.addMethod(
  22338. "_isClassRefVar",
  22339. smalltalk.method({
  22340. selector: "isClassRefVar",
  22341. category: 'testing',
  22342. fn: function () {
  22343. var self = this;
  22344. return true;
  22345. },
  22346. args: [],
  22347. source: "isClassRefVar\x0a\x09^ true",
  22348. messageSends: [],
  22349. referencedClasses: []
  22350. }),
  22351. smalltalk.ClassRefVar);
  22352. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22353. smalltalk.InstanceVar.comment="I am an instance variable of a method or block."
  22354. smalltalk.addMethod(
  22355. "_alias",
  22356. smalltalk.method({
  22357. selector: "alias",
  22358. category: 'testing',
  22359. fn: function () {
  22360. var self = this;
  22361. var $1;
  22362. $1 = smalltalk.send(smalltalk.send("self[\"@", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", ["\"]"]);
  22363. return $1;
  22364. },
  22365. args: [],
  22366. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  22367. messageSends: [",", "name"],
  22368. referencedClasses: []
  22369. }),
  22370. smalltalk.InstanceVar);
  22371. smalltalk.addMethod(
  22372. "_isInstanceVar",
  22373. smalltalk.method({
  22374. selector: "isInstanceVar",
  22375. category: 'testing',
  22376. fn: function () {
  22377. var self = this;
  22378. return true;
  22379. },
  22380. args: [],
  22381. source: "isInstanceVar\x0a\x09^ true",
  22382. messageSends: [],
  22383. referencedClasses: []
  22384. }),
  22385. smalltalk.InstanceVar);
  22386. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22387. smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"
  22388. smalltalk.addMethod(
  22389. "_alias",
  22390. smalltalk.method({
  22391. selector: "alias",
  22392. category: 'accessing',
  22393. fn: function () {
  22394. var self = this;
  22395. var $1;
  22396. $1 = smalltalk.send(self, "_name", []);
  22397. return $1;
  22398. },
  22399. args: [],
  22400. source: "alias\x0a\x09^ self name",
  22401. messageSends: ["name"],
  22402. referencedClasses: []
  22403. }),
  22404. smalltalk.PseudoVar);
  22405. smalltalk.addMethod(
  22406. "_isPseudoVar",
  22407. smalltalk.method({
  22408. selector: "isPseudoVar",
  22409. category: 'testing',
  22410. fn: function () {
  22411. var self = this;
  22412. return true;
  22413. },
  22414. args: [],
  22415. source: "isPseudoVar\x0a\x09^ true",
  22416. messageSends: [],
  22417. referencedClasses: []
  22418. }),
  22419. smalltalk.PseudoVar);
  22420. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22421. smalltalk.TempVar.comment="I am an temporary variable of a method or block."
  22422. smalltalk.addMethod(
  22423. "_isTempVar",
  22424. smalltalk.method({
  22425. selector: "isTempVar",
  22426. category: 'testing',
  22427. fn: function () {
  22428. var self = this;
  22429. return true;
  22430. },
  22431. args: [],
  22432. source: "isTempVar\x0a\x09^ true",
  22433. messageSends: [],
  22434. referencedClasses: []
  22435. }),
  22436. smalltalk.TempVar);
  22437. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22438. smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"
  22439. smalltalk.addMethod(
  22440. "_isUnknownVar",
  22441. smalltalk.method({
  22442. selector: "isUnknownVar",
  22443. category: 'testing',
  22444. fn: function () {
  22445. var self = this;
  22446. return true;
  22447. },
  22448. args: [],
  22449. source: "isUnknownVar\x0a\x09^ true",
  22450. messageSends: [],
  22451. referencedClasses: []
  22452. }),
  22453. smalltalk.UnknownVar);
  22454. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  22455. smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."
  22456. smalltalk.addMethod(
  22457. "_classReferences",
  22458. smalltalk.method({
  22459. selector: "classReferences",
  22460. category: 'accessing',
  22461. fn: function () {
  22462. var self = this;
  22463. var $1;
  22464. if (($receiver = self['@classReferences']) == nil ||
  22465. $receiver == undefined) {
  22466. self['@classReferences'] = smalltalk.send(smalltalk.Set || Set, "_new", []);
  22467. $1 = self['@classReferences'];
  22468. } else {
  22469. $1 = self['@classReferences'];
  22470. }
  22471. return $1;
  22472. },
  22473. args: [],
  22474. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  22475. messageSends: ["ifNil:", "new"],
  22476. referencedClasses: ["Set"]
  22477. }),
  22478. smalltalk.SemanticAnalyzer);
  22479. smalltalk.addMethod(
  22480. "_errorShadowingVariable_",
  22481. smalltalk.method({
  22482. selector: "errorShadowingVariable:",
  22483. category: 'error handling',
  22484. fn: function (aString) {
  22485. var self = this;
  22486. var $1, $2;
  22487. $1 = smalltalk.send(smalltalk.ShadowingVariableError || ShadowingVariableError, "_new", []);
  22488. smalltalk.send($1, "_variableName_", [aString]);
  22489. $2 = smalltalk.send($1, "_signal", []);
  22490. return self;
  22491. },
  22492. args: ["aString"],
  22493. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  22494. messageSends: ["variableName:", "new", "signal"],
  22495. referencedClasses: ["ShadowingVariableError"]
  22496. }),
  22497. smalltalk.SemanticAnalyzer);
  22498. smalltalk.addMethod(
  22499. "_errorUnknownVariable_",
  22500. smalltalk.method({
  22501. selector: "errorUnknownVariable:",
  22502. category: 'error handling',
  22503. fn: function (aNode) {
  22504. var self = this;
  22505. var $1, $2;
  22506. var notDefined;
  22507. notDefined = eval("typeof " + aNode._value() + " == \"undefined\"");
  22508. if (smalltalk.assert(notDefined)) {
  22509. $1 = smalltalk.send(smalltalk.UnknownVariableError || UnknownVariableError, "_new", []);
  22510. smalltalk.send($1, "_variableName_", [smalltalk.send(aNode, "_value", [])]);
  22511. $2 = smalltalk.send($1, "_signal", []);
  22512. } else {
  22513. smalltalk.send(smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_unknownVariables", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  22514. }
  22515. return self;
  22516. },
  22517. args: ["aNode"],
  22518. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window)\x22\x0a\x0a\x09| notDefined |\x0a\x0a\x09notDefined := <eval('typeof ' + aNode._value() + ' == \x22undefined\x22')>.\x0a\x0a\x09notDefined\x0a\x09\x09ifTrue: [ \x0a\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09signal ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09currentScope methodScope unknownVariables add: aNode value. ]",
  22519. messageSends: ["ifTrue:ifFalse:", "variableName:", "value", "new", "signal", "add:", "unknownVariables", "methodScope"],
  22520. referencedClasses: ["UnknownVariableError"]
  22521. }),
  22522. smalltalk.SemanticAnalyzer);
  22523. smalltalk.addMethod(
  22524. "_messageSends",
  22525. smalltalk.method({
  22526. selector: "messageSends",
  22527. category: 'accessing',
  22528. fn: function () {
  22529. var self = this;
  22530. var $1;
  22531. if (($receiver = self['@messageSends']) == nil ||
  22532. $receiver == undefined) {
  22533. self['@messageSends'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  22534. $1 = self['@messageSends'];
  22535. } else {
  22536. $1 = self['@messageSends'];
  22537. }
  22538. return $1;
  22539. },
  22540. args: [],
  22541. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  22542. messageSends: ["ifNil:", "new"],
  22543. referencedClasses: ["Dictionary"]
  22544. }),
  22545. smalltalk.SemanticAnalyzer);
  22546. smalltalk.addMethod(
  22547. "_newBlockScope",
  22548. smalltalk.method({
  22549. selector: "newBlockScope",
  22550. category: 'factory',
  22551. fn: function () {
  22552. var self = this;
  22553. var $1;
  22554. $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.LexicalScope || LexicalScope]);
  22555. return $1;
  22556. },
  22557. args: [],
  22558. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  22559. messageSends: ["newScopeOfClass:"],
  22560. referencedClasses: ["LexicalScope"]
  22561. }),
  22562. smalltalk.SemanticAnalyzer);
  22563. smalltalk.addMethod(
  22564. "_newMethodScope",
  22565. smalltalk.method({
  22566. selector: "newMethodScope",
  22567. category: 'factory',
  22568. fn: function () {
  22569. var self = this;
  22570. var $1;
  22571. $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.MethodLexicalScope || MethodLexicalScope]);
  22572. return $1;
  22573. },
  22574. args: [],
  22575. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  22576. messageSends: ["newScopeOfClass:"],
  22577. referencedClasses: ["MethodLexicalScope"]
  22578. }),
  22579. smalltalk.SemanticAnalyzer);
  22580. smalltalk.addMethod(
  22581. "_newScopeOfClass_",
  22582. smalltalk.method({
  22583. selector: "newScopeOfClass:",
  22584. category: 'factory',
  22585. fn: function (aLexicalScopeClass) {
  22586. var self = this;
  22587. var $2, $3, $1;
  22588. $2 = smalltalk.send(aLexicalScopeClass, "_new", []);
  22589. smalltalk.send($2, "_outerScope_", [self['@currentScope']]);
  22590. $3 = smalltalk.send($2, "_yourself", []);
  22591. $1 = $3;
  22592. return $1;
  22593. },
  22594. args: ["aLexicalScopeClass"],
  22595. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new \x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  22596. messageSends: ["outerScope:", "new", "yourself"],
  22597. referencedClasses: []
  22598. }),
  22599. smalltalk.SemanticAnalyzer);
  22600. smalltalk.addMethod(
  22601. "_popScope",
  22602. smalltalk.method({
  22603. selector: "popScope",
  22604. category: 'scope',
  22605. fn: function () {
  22606. var self = this;
  22607. if (($receiver = self['@currentScope']) == nil ||
  22608. $receiver == undefined) {
  22609. self['@currentScope'];
  22610. } else {
  22611. self['@currentScope'] = smalltalk.send(self['@currentScope'], "_outerScope", []);
  22612. self['@currentScope'];
  22613. }
  22614. return self;
  22615. },
  22616. args: [],
  22617. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  22618. messageSends: ["ifNotNil:", "outerScope"],
  22619. referencedClasses: []
  22620. }),
  22621. smalltalk.SemanticAnalyzer);
  22622. smalltalk.addMethod(
  22623. "_pushScope_",
  22624. smalltalk.method({
  22625. selector: "pushScope:",
  22626. category: 'scope',
  22627. fn: function (aScope) {
  22628. var self = this;
  22629. smalltalk.send(aScope, "_outerScope_", [self['@currentScope']]);
  22630. self['@currentScope'] = aScope;
  22631. return self;
  22632. },
  22633. args: ["aScope"],
  22634. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  22635. messageSends: ["outerScope:"],
  22636. referencedClasses: []
  22637. }),
  22638. smalltalk.SemanticAnalyzer);
  22639. smalltalk.addMethod(
  22640. "_theClass",
  22641. smalltalk.method({
  22642. selector: "theClass",
  22643. category: 'accessing',
  22644. fn: function () {
  22645. var self = this;
  22646. return self['@theClass'];
  22647. },
  22648. args: [],
  22649. source: "theClass\x0a\x09^ theClass",
  22650. messageSends: [],
  22651. referencedClasses: []
  22652. }),
  22653. smalltalk.SemanticAnalyzer);
  22654. smalltalk.addMethod(
  22655. "_theClass_",
  22656. smalltalk.method({
  22657. selector: "theClass:",
  22658. category: 'accessing',
  22659. fn: function (aClass) {
  22660. var self = this;
  22661. self['@theClass'] = aClass;
  22662. return self;
  22663. },
  22664. args: ["aClass"],
  22665. source: "theClass: aClass\x0a\x09theClass := aClass",
  22666. messageSends: [],
  22667. referencedClasses: []
  22668. }),
  22669. smalltalk.SemanticAnalyzer);
  22670. smalltalk.addMethod(
  22671. "_validateVariableScope_",
  22672. smalltalk.method({
  22673. selector: "validateVariableScope:",
  22674. category: 'scope',
  22675. fn: function (aString) {
  22676. var self = this;
  22677. var $1;
  22678. $1 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aString]);
  22679. if (($receiver = $1) == nil || $receiver == undefined) {
  22680. } else {
  22681. smalltalk.send(self, "_errorShadowingVariable_", [aString]);
  22682. }
  22683. return self;
  22684. },
  22685. args: ["aString"],
  22686. 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 ]",
  22687. messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
  22688. referencedClasses: []
  22689. }),
  22690. smalltalk.SemanticAnalyzer);
  22691. smalltalk.addMethod(
  22692. "_visitAssignmentNode_",
  22693. smalltalk.method({
  22694. selector: "visitAssignmentNode:",
  22695. category: 'visiting',
  22696. fn: function (aNode) {
  22697. var self = this;
  22698. smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.NodeVisitor);
  22699. smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
  22700. return self;
  22701. },
  22702. args: ["aNode"],
  22703. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  22704. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  22705. referencedClasses: []
  22706. }),
  22707. smalltalk.SemanticAnalyzer);
  22708. smalltalk.addMethod(
  22709. "_visitBlockNode_",
  22710. smalltalk.method({
  22711. selector: "visitBlockNode:",
  22712. category: 'visiting',
  22713. fn: function (aNode) {
  22714. var self = this;
  22715. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newBlockScope", [])]);
  22716. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22717. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  22718. smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
  22719. smalltalk.send(self, "_visitBlockNode_", [aNode], smalltalk.NodeVisitor);
  22720. smalltalk.send(self, "_popScope", []);
  22721. return self;
  22722. },
  22723. args: ["aNode"],
  22724. 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",
  22725. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
  22726. referencedClasses: []
  22727. }),
  22728. smalltalk.SemanticAnalyzer);
  22729. smalltalk.addMethod(
  22730. "_visitCascadeNode_",
  22731. smalltalk.method({
  22732. selector: "visitCascadeNode:",
  22733. category: 'visiting',
  22734. fn: function (aNode) {
  22735. var self = this;
  22736. var $1;
  22737. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_receiver_", [smalltalk.send(aNode, "_receiver", [])]);}]);
  22738. smalltalk.send(self, "_visitCascadeNode_", [aNode], smalltalk.NodeVisitor);
  22739. $1 = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_first", []), "_superSend", []);
  22740. if (smalltalk.assert($1)) {
  22741. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_superSend_", [true]);}]);
  22742. }
  22743. return self;
  22744. },
  22745. args: ["aNode"],
  22746. 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 ]]",
  22747. messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
  22748. referencedClasses: []
  22749. }),
  22750. smalltalk.SemanticAnalyzer);
  22751. smalltalk.addMethod(
  22752. "_visitClassReferenceNode_",
  22753. smalltalk.method({
  22754. selector: "visitClassReferenceNode:",
  22755. category: 'visiting',
  22756. fn: function (aNode) {
  22757. var self = this;
  22758. var $1, $2;
  22759. smalltalk.send(smalltalk.send(self, "_classReferences", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  22760. $1 = smalltalk.send(smalltalk.ClassRefVar || ClassRefVar, "_new", []);
  22761. smalltalk.send($1, "_name_", [smalltalk.send(aNode, "_value", [])]);
  22762. $2 = smalltalk.send($1, "_yourself", []);
  22763. smalltalk.send(aNode, "_binding_", [$2]);
  22764. return self;
  22765. },
  22766. args: ["aNode"],
  22767. source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
  22768. messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
  22769. referencedClasses: ["ClassRefVar"]
  22770. }),
  22771. smalltalk.SemanticAnalyzer);
  22772. smalltalk.addMethod(
  22773. "_visitMethodNode_",
  22774. smalltalk.method({
  22775. selector: "visitMethodNode:",
  22776. category: 'visiting',
  22777. fn: function (aNode) {
  22778. var self = this;
  22779. var $1;
  22780. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newMethodScope", [])]);
  22781. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22782. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  22783. smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);}]);
  22784. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
  22785. smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.NodeVisitor);
  22786. smalltalk.send(aNode, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);
  22787. $1 = smalltalk.send(aNode, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);
  22788. smalltalk.send(self, "_popScope", []);
  22789. return self;
  22790. },
  22791. args: ["aNode"],
  22792. 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\x09self popScope",
  22793. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "popScope"],
  22794. referencedClasses: []
  22795. }),
  22796. smalltalk.SemanticAnalyzer);
  22797. smalltalk.addMethod(
  22798. "_visitReturnNode_",
  22799. smalltalk.method({
  22800. selector: "visitReturnNode:",
  22801. category: 'visiting',
  22802. fn: function (aNode) {
  22803. var self = this;
  22804. var $1;
  22805. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22806. $1 = smalltalk.send(self['@currentScope'], "_isMethodScope", []);
  22807. if (smalltalk.assert($1)) {
  22808. smalltalk.send(self['@currentScope'], "_localReturn_", [true]);
  22809. } else {
  22810. smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);
  22811. }
  22812. smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.NodeVisitor);
  22813. return self;
  22814. },
  22815. args: ["aNode"],
  22816. 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",
  22817. messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
  22818. referencedClasses: []
  22819. }),
  22820. smalltalk.SemanticAnalyzer);
  22821. smalltalk.addMethod(
  22822. "_visitSendNode_",
  22823. smalltalk.method({
  22824. selector: "visitSendNode:",
  22825. category: 'visiting',
  22826. fn: function (aNode){
  22827. var self=this;
  22828. var $1,$2;
  22829. $1=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_value",[]),"__eq",["super"]);
  22830. if(smalltalk.assert($1)){
  22831. smalltalk.send(aNode,"_superSend_",[true]);
  22832. smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_value_",["self"]);
  22833. } else {
  22834. $2=smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_inlinedSelectors",[]),"_includes_",[smalltalk.send(aNode,"_selector",[])]);
  22835. if(smalltalk.assert($2)){
  22836. smalltalk.send(aNode,"_shouldBeInlined_",[true]);
  22837. smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_shouldBeAliased_",[true]);
  22838. };
  22839. };
  22840. smalltalk.send(smalltalk.send(self,"_messageSends",[]),"_at_ifAbsentPut_",[smalltalk.send(aNode,"_selector",[]),(function(){
  22841. return smalltalk.send((smalltalk.Set || Set),"_new",[]);
  22842. })]);
  22843. smalltalk.send(smalltalk.send(smalltalk.send(self,"_messageSends",[]),"_at_",[smalltalk.send(aNode,"_selector",[])]),"_add_",[aNode]);
  22844. smalltalk.send(aNode,"_index_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_messageSends",[]),"_at_",[smalltalk.send(aNode,"_selector",[])]),"_size",[])]);
  22845. smalltalk.send(self,"_visitSendNode_",[aNode],smalltalk.NodeVisitor);
  22846. return self},
  22847. args: ["aNode"],
  22848. 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\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",
  22849. messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "ifTrue:", "shouldBeInlined:", "shouldBeAliased:", "includes:", "selector", "inlinedSelectors", "=", "value", "at:ifAbsentPut:", "new", "messageSends", "add:", "at:", "index:", "size", "visitSendNode:"],
  22850. referencedClasses: ["IRSendInliner", "Set"]
  22851. }),
  22852. smalltalk.SemanticAnalyzer);
  22853. smalltalk.addMethod(
  22854. "_visitSequenceNode_",
  22855. smalltalk.method({
  22856. selector: "visitSequenceNode:",
  22857. category: 'visiting',
  22858. fn: function (aNode) {
  22859. var self = this;
  22860. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addTemp_", [each]);}]);
  22861. smalltalk.send(self, "_visitSequenceNode_", [aNode], smalltalk.NodeVisitor);
  22862. return self;
  22863. },
  22864. args: ["aNode"],
  22865. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  22866. messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
  22867. referencedClasses: []
  22868. }),
  22869. smalltalk.SemanticAnalyzer);
  22870. smalltalk.addMethod(
  22871. "_visitVariableNode_",
  22872. smalltalk.method({
  22873. selector: "visitVariableNode:",
  22874. category: 'visiting',
  22875. fn: function (aNode) {
  22876. var self = this;
  22877. var $2, $3, $4, $1;
  22878. $2 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aNode]);
  22879. if (($receiver = $2) == nil || $receiver == undefined) {
  22880. smalltalk.send(self, "_errorUnknownVariable_", [aNode]);
  22881. $3 = smalltalk.send(smalltalk.UnknownVar || UnknownVar, "_new", []);
  22882. smalltalk.send($3, "_name_", [smalltalk.send(aNode, "_value", [])]);
  22883. $4 = smalltalk.send($3, "_yourself", []);
  22884. $1 = $4;
  22885. } else {
  22886. $1 = $2;
  22887. }
  22888. smalltalk.send(aNode, "_binding_", [$1]);
  22889. return self;
  22890. },
  22891. args: ["aNode"],
  22892. 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 ])",
  22893. messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
  22894. referencedClasses: ["UnknownVar"]
  22895. }),
  22896. smalltalk.SemanticAnalyzer);
  22897. smalltalk.addMethod(
  22898. "_on_",
  22899. smalltalk.method({
  22900. selector: "on:",
  22901. category: 'instance creation',
  22902. fn: function (aClass) {
  22903. var self = this;
  22904. var $2, $3, $1;
  22905. $2 = smalltalk.send(self, "_new", []);
  22906. smalltalk.send($2, "_theClass_", [aClass]);
  22907. $3 = smalltalk.send($2, "_yourself", []);
  22908. $1 = $3;
  22909. return $1;
  22910. },
  22911. args: ["aClass"],
  22912. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22913. messageSends: ["theClass:", "new", "yourself"],
  22914. referencedClasses: []
  22915. }),
  22916. smalltalk.SemanticAnalyzer.klass);
  22917. smalltalk.parser = (function(){
  22918. /*
  22919. * Generated by PEG.js 0.7.0.
  22920. *
  22921. * http://pegjs.majda.cz/
  22922. */
  22923. function quote(s) {
  22924. /*
  22925. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  22926. * string literal except for the closing quote character, backslash,
  22927. * carriage return, line separator, paragraph separator, and line feed.
  22928. * Any character may appear in the form of an escape sequence.
  22929. *
  22930. * For portability, we also escape escape all control and non-ASCII
  22931. * characters. Note that "\0" and "\v" escape sequences are not used
  22932. * because JSHint does not like the first and IE the second.
  22933. */
  22934. return '"' + s
  22935. .replace(/\\/g, '\\\\') // backslash
  22936. .replace(/"/g, '\\"') // closing quote character
  22937. .replace(/\x08/g, '\\b') // backspace
  22938. .replace(/\t/g, '\\t') // horizontal tab
  22939. .replace(/\n/g, '\\n') // line feed
  22940. .replace(/\f/g, '\\f') // form feed
  22941. .replace(/\r/g, '\\r') // carriage return
  22942. .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
  22943. + '"';
  22944. }
  22945. var result = {
  22946. /*
  22947. * Parses the input with a generated parser. If the parsing is successfull,
  22948. * returns a value explicitly or implicitly specified by the grammar from
  22949. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  22950. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  22951. */
  22952. parse: function(input, startRule) {
  22953. var parseFunctions = {
  22954. "separator": parse_separator,
  22955. "comments": parse_comments,
  22956. "ws": parse_ws,
  22957. "identifier": parse_identifier,
  22958. "varIdentifier": parse_varIdentifier,
  22959. "keyword": parse_keyword,
  22960. "className": parse_className,
  22961. "string": parse_string,
  22962. "symbol": parse_symbol,
  22963. "number": parse_number,
  22964. "hex": parse_hex,
  22965. "float": parse_float,
  22966. "integer": parse_integer,
  22967. "literalArray": parse_literalArray,
  22968. "dynamicArray": parse_dynamicArray,
  22969. "dynamicDictionary": parse_dynamicDictionary,
  22970. "pseudoVariable": parse_pseudoVariable,
  22971. "literal": parse_literal,
  22972. "variable": parse_variable,
  22973. "classReference": parse_classReference,
  22974. "reference": parse_reference,
  22975. "keywordPair": parse_keywordPair,
  22976. "binarySelector": parse_binarySelector,
  22977. "keywordPattern": parse_keywordPattern,
  22978. "binaryPattern": parse_binaryPattern,
  22979. "unaryPattern": parse_unaryPattern,
  22980. "expression": parse_expression,
  22981. "expressionList": parse_expressionList,
  22982. "expressions": parse_expressions,
  22983. "assignment": parse_assignment,
  22984. "ret": parse_ret,
  22985. "temps": parse_temps,
  22986. "blockParamList": parse_blockParamList,
  22987. "subexpression": parse_subexpression,
  22988. "statements": parse_statements,
  22989. "sequence": parse_sequence,
  22990. "block": parse_block,
  22991. "operand": parse_operand,
  22992. "unaryMessage": parse_unaryMessage,
  22993. "unaryTail": parse_unaryTail,
  22994. "unarySend": parse_unarySend,
  22995. "binaryMessage": parse_binaryMessage,
  22996. "binaryTail": parse_binaryTail,
  22997. "binarySend": parse_binarySend,
  22998. "keywordMessage": parse_keywordMessage,
  22999. "keywordSend": parse_keywordSend,
  23000. "message": parse_message,
  23001. "cascade": parse_cascade,
  23002. "jsStatement": parse_jsStatement,
  23003. "method": parse_method
  23004. };
  23005. if (startRule !== undefined) {
  23006. if (parseFunctions[startRule] === undefined) {
  23007. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  23008. }
  23009. } else {
  23010. startRule = "method";
  23011. }
  23012. var pos = { offset: 0, line: 1, column: 1, seenCR: false };
  23013. var reportFailures = 0;
  23014. var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
  23015. var rightmostFailuresExpected = [];
  23016. var cache = {};
  23017. function padLeft(input, padding, length) {
  23018. var result = input;
  23019. var padLength = length - input.length;
  23020. for (var i = 0; i < padLength; i++) {
  23021. result = padding + result;
  23022. }
  23023. return result;
  23024. }
  23025. function escape(ch) {
  23026. var charCode = ch.charCodeAt(0);
  23027. var escapeChar;
  23028. var length;
  23029. if (charCode <= 0xFF) {
  23030. escapeChar = 'x';
  23031. length = 2;
  23032. } else {
  23033. escapeChar = 'u';
  23034. length = 4;
  23035. }
  23036. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  23037. }
  23038. function clone(object) {
  23039. var result = {};
  23040. for (var key in object) {
  23041. result[key] = object[key];
  23042. }
  23043. return result;
  23044. }
  23045. function advance(pos, n) {
  23046. var endOffset = pos.offset + n;
  23047. for (var offset = pos.offset; offset < endOffset; offset++) {
  23048. var ch = input.charAt(offset);
  23049. if (ch === "\n") {
  23050. if (!pos.seenCR) { pos.line++; }
  23051. pos.column = 1;
  23052. pos.seenCR = false;
  23053. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23054. pos.line++;
  23055. pos.column = 1;
  23056. pos.seenCR = true;
  23057. } else {
  23058. pos.column++;
  23059. pos.seenCR = false;
  23060. }
  23061. }
  23062. pos.offset += n;
  23063. }
  23064. function matchFailed(failure) {
  23065. if (pos.offset < rightmostFailuresPos.offset) {
  23066. return;
  23067. }
  23068. if (pos.offset > rightmostFailuresPos.offset) {
  23069. rightmostFailuresPos = clone(pos);
  23070. rightmostFailuresExpected = [];
  23071. }
  23072. rightmostFailuresExpected.push(failure);
  23073. }
  23074. function parse_separator() {
  23075. var cacheKey = "separator@" + pos.offset;
  23076. var cachedResult = cache[cacheKey];
  23077. if (cachedResult) {
  23078. pos = clone(cachedResult.nextPos);
  23079. return cachedResult.result;
  23080. }
  23081. var result0, result1;
  23082. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  23083. result1 = input.charAt(pos.offset);
  23084. advance(pos, 1);
  23085. } else {
  23086. result1 = null;
  23087. if (reportFailures === 0) {
  23088. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  23089. }
  23090. }
  23091. if (result1 !== null) {
  23092. result0 = [];
  23093. while (result1 !== null) {
  23094. result0.push(result1);
  23095. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  23096. result1 = input.charAt(pos.offset);
  23097. advance(pos, 1);
  23098. } else {
  23099. result1 = null;
  23100. if (reportFailures === 0) {
  23101. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  23102. }
  23103. }
  23104. }
  23105. } else {
  23106. result0 = null;
  23107. }
  23108. cache[cacheKey] = {
  23109. nextPos: clone(pos),
  23110. result: result0
  23111. };
  23112. return result0;
  23113. }
  23114. function parse_comments() {
  23115. var cacheKey = "comments@" + pos.offset;
  23116. var cachedResult = cache[cacheKey];
  23117. if (cachedResult) {
  23118. pos = clone(cachedResult.nextPos);
  23119. return cachedResult.result;
  23120. }
  23121. var result0, result1, result2, result3;
  23122. var pos0;
  23123. pos0 = clone(pos);
  23124. if (/^["]/.test(input.charAt(pos.offset))) {
  23125. result1 = input.charAt(pos.offset);
  23126. advance(pos, 1);
  23127. } else {
  23128. result1 = null;
  23129. if (reportFailures === 0) {
  23130. matchFailed("[\"]");
  23131. }
  23132. }
  23133. if (result1 !== null) {
  23134. result2 = [];
  23135. if (/^[^"]/.test(input.charAt(pos.offset))) {
  23136. result3 = input.charAt(pos.offset);
  23137. advance(pos, 1);
  23138. } else {
  23139. result3 = null;
  23140. if (reportFailures === 0) {
  23141. matchFailed("[^\"]");
  23142. }
  23143. }
  23144. while (result3 !== null) {
  23145. result2.push(result3);
  23146. if (/^[^"]/.test(input.charAt(pos.offset))) {
  23147. result3 = input.charAt(pos.offset);
  23148. advance(pos, 1);
  23149. } else {
  23150. result3 = null;
  23151. if (reportFailures === 0) {
  23152. matchFailed("[^\"]");
  23153. }
  23154. }
  23155. }
  23156. if (result2 !== null) {
  23157. if (/^["]/.test(input.charAt(pos.offset))) {
  23158. result3 = input.charAt(pos.offset);
  23159. advance(pos, 1);
  23160. } else {
  23161. result3 = null;
  23162. if (reportFailures === 0) {
  23163. matchFailed("[\"]");
  23164. }
  23165. }
  23166. if (result3 !== null) {
  23167. result1 = [result1, result2, result3];
  23168. } else {
  23169. result1 = null;
  23170. pos = clone(pos0);
  23171. }
  23172. } else {
  23173. result1 = null;
  23174. pos = clone(pos0);
  23175. }
  23176. } else {
  23177. result1 = null;
  23178. pos = clone(pos0);
  23179. }
  23180. if (result1 !== null) {
  23181. result0 = [];
  23182. while (result1 !== null) {
  23183. result0.push(result1);
  23184. pos0 = clone(pos);
  23185. if (/^["]/.test(input.charAt(pos.offset))) {
  23186. result1 = input.charAt(pos.offset);
  23187. advance(pos, 1);
  23188. } else {
  23189. result1 = null;
  23190. if (reportFailures === 0) {
  23191. matchFailed("[\"]");
  23192. }
  23193. }
  23194. if (result1 !== null) {
  23195. result2 = [];
  23196. if (/^[^"]/.test(input.charAt(pos.offset))) {
  23197. result3 = input.charAt(pos.offset);
  23198. advance(pos, 1);
  23199. } else {
  23200. result3 = null;
  23201. if (reportFailures === 0) {
  23202. matchFailed("[^\"]");
  23203. }
  23204. }
  23205. while (result3 !== null) {
  23206. result2.push(result3);
  23207. if (/^[^"]/.test(input.charAt(pos.offset))) {
  23208. result3 = input.charAt(pos.offset);
  23209. advance(pos, 1);
  23210. } else {
  23211. result3 = null;
  23212. if (reportFailures === 0) {
  23213. matchFailed("[^\"]");
  23214. }
  23215. }
  23216. }
  23217. if (result2 !== null) {
  23218. if (/^["]/.test(input.charAt(pos.offset))) {
  23219. result3 = input.charAt(pos.offset);
  23220. advance(pos, 1);
  23221. } else {
  23222. result3 = null;
  23223. if (reportFailures === 0) {
  23224. matchFailed("[\"]");
  23225. }
  23226. }
  23227. if (result3 !== null) {
  23228. result1 = [result1, result2, result3];
  23229. } else {
  23230. result1 = null;
  23231. pos = clone(pos0);
  23232. }
  23233. } else {
  23234. result1 = null;
  23235. pos = clone(pos0);
  23236. }
  23237. } else {
  23238. result1 = null;
  23239. pos = clone(pos0);
  23240. }
  23241. }
  23242. } else {
  23243. result0 = null;
  23244. }
  23245. cache[cacheKey] = {
  23246. nextPos: clone(pos),
  23247. result: result0
  23248. };
  23249. return result0;
  23250. }
  23251. function parse_ws() {
  23252. var cacheKey = "ws@" + pos.offset;
  23253. var cachedResult = cache[cacheKey];
  23254. if (cachedResult) {
  23255. pos = clone(cachedResult.nextPos);
  23256. return cachedResult.result;
  23257. }
  23258. var result0, result1;
  23259. result0 = [];
  23260. result1 = parse_separator();
  23261. if (result1 === null) {
  23262. result1 = parse_comments();
  23263. }
  23264. while (result1 !== null) {
  23265. result0.push(result1);
  23266. result1 = parse_separator();
  23267. if (result1 === null) {
  23268. result1 = parse_comments();
  23269. }
  23270. }
  23271. cache[cacheKey] = {
  23272. nextPos: clone(pos),
  23273. result: result0
  23274. };
  23275. return result0;
  23276. }
  23277. function parse_identifier() {
  23278. var cacheKey = "identifier@" + pos.offset;
  23279. var cachedResult = cache[cacheKey];
  23280. if (cachedResult) {
  23281. pos = clone(cachedResult.nextPos);
  23282. return cachedResult.result;
  23283. }
  23284. var result0, result1, result2;
  23285. var pos0, pos1;
  23286. pos0 = clone(pos);
  23287. pos1 = clone(pos);
  23288. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  23289. result0 = input.charAt(pos.offset);
  23290. advance(pos, 1);
  23291. } else {
  23292. result0 = null;
  23293. if (reportFailures === 0) {
  23294. matchFailed("[a-zA-Z]");
  23295. }
  23296. }
  23297. if (result0 !== null) {
  23298. result1 = [];
  23299. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23300. result2 = input.charAt(pos.offset);
  23301. advance(pos, 1);
  23302. } else {
  23303. result2 = null;
  23304. if (reportFailures === 0) {
  23305. matchFailed("[a-zA-Z0-9]");
  23306. }
  23307. }
  23308. while (result2 !== null) {
  23309. result1.push(result2);
  23310. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23311. result2 = input.charAt(pos.offset);
  23312. advance(pos, 1);
  23313. } else {
  23314. result2 = null;
  23315. if (reportFailures === 0) {
  23316. matchFailed("[a-zA-Z0-9]");
  23317. }
  23318. }
  23319. }
  23320. if (result1 !== null) {
  23321. result0 = [result0, result1];
  23322. } else {
  23323. result0 = null;
  23324. pos = clone(pos1);
  23325. }
  23326. } else {
  23327. result0 = null;
  23328. pos = clone(pos1);
  23329. }
  23330. if (result0 !== null) {
  23331. result0 = (function(offset, line, column, first, others) {return first + others.join("")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  23332. }
  23333. if (result0 === null) {
  23334. pos = clone(pos0);
  23335. }
  23336. cache[cacheKey] = {
  23337. nextPos: clone(pos),
  23338. result: result0
  23339. };
  23340. return result0;
  23341. }
  23342. function parse_varIdentifier() {
  23343. var cacheKey = "varIdentifier@" + pos.offset;
  23344. var cachedResult = cache[cacheKey];
  23345. if (cachedResult) {
  23346. pos = clone(cachedResult.nextPos);
  23347. return cachedResult.result;
  23348. }
  23349. var result0, result1, result2;
  23350. var pos0, pos1;
  23351. pos0 = clone(pos);
  23352. pos1 = clone(pos);
  23353. if (/^[a-z]/.test(input.charAt(pos.offset))) {
  23354. result0 = input.charAt(pos.offset);
  23355. advance(pos, 1);
  23356. } else {
  23357. result0 = null;
  23358. if (reportFailures === 0) {
  23359. matchFailed("[a-z]");
  23360. }
  23361. }
  23362. if (result0 !== null) {
  23363. result1 = [];
  23364. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23365. result2 = input.charAt(pos.offset);
  23366. advance(pos, 1);
  23367. } else {
  23368. result2 = null;
  23369. if (reportFailures === 0) {
  23370. matchFailed("[a-zA-Z0-9]");
  23371. }
  23372. }
  23373. while (result2 !== null) {
  23374. result1.push(result2);
  23375. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23376. result2 = input.charAt(pos.offset);
  23377. advance(pos, 1);
  23378. } else {
  23379. result2 = null;
  23380. if (reportFailures === 0) {
  23381. matchFailed("[a-zA-Z0-9]");
  23382. }
  23383. }
  23384. }
  23385. if (result1 !== null) {
  23386. result0 = [result0, result1];
  23387. } else {
  23388. result0 = null;
  23389. pos = clone(pos1);
  23390. }
  23391. } else {
  23392. result0 = null;
  23393. pos = clone(pos1);
  23394. }
  23395. if (result0 !== null) {
  23396. result0 = (function(offset, line, column, first, others) {return first + others.join("")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  23397. }
  23398. if (result0 === null) {
  23399. pos = clone(pos0);
  23400. }
  23401. cache[cacheKey] = {
  23402. nextPos: clone(pos),
  23403. result: result0
  23404. };
  23405. return result0;
  23406. }
  23407. function parse_keyword() {
  23408. var cacheKey = "keyword@" + pos.offset;
  23409. var cachedResult = cache[cacheKey];
  23410. if (cachedResult) {
  23411. pos = clone(cachedResult.nextPos);
  23412. return cachedResult.result;
  23413. }
  23414. var result0, result1;
  23415. var pos0, pos1;
  23416. pos0 = clone(pos);
  23417. pos1 = clone(pos);
  23418. result0 = parse_identifier();
  23419. if (result0 !== null) {
  23420. if (/^[:]/.test(input.charAt(pos.offset))) {
  23421. result1 = input.charAt(pos.offset);
  23422. advance(pos, 1);
  23423. } else {
  23424. result1 = null;
  23425. if (reportFailures === 0) {
  23426. matchFailed("[:]");
  23427. }
  23428. }
  23429. if (result1 !== null) {
  23430. result0 = [result0, result1];
  23431. } else {
  23432. result0 = null;
  23433. pos = clone(pos1);
  23434. }
  23435. } else {
  23436. result0 = null;
  23437. pos = clone(pos1);
  23438. }
  23439. if (result0 !== null) {
  23440. result0 = (function(offset, line, column, first, last) {return first + last})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  23441. }
  23442. if (result0 === null) {
  23443. pos = clone(pos0);
  23444. }
  23445. cache[cacheKey] = {
  23446. nextPos: clone(pos),
  23447. result: result0
  23448. };
  23449. return result0;
  23450. }
  23451. function parse_className() {
  23452. var cacheKey = "className@" + pos.offset;
  23453. var cachedResult = cache[cacheKey];
  23454. if (cachedResult) {
  23455. pos = clone(cachedResult.nextPos);
  23456. return cachedResult.result;
  23457. }
  23458. var result0, result1, result2;
  23459. var pos0, pos1;
  23460. pos0 = clone(pos);
  23461. pos1 = clone(pos);
  23462. if (/^[A-Z]/.test(input.charAt(pos.offset))) {
  23463. result0 = input.charAt(pos.offset);
  23464. advance(pos, 1);
  23465. } else {
  23466. result0 = null;
  23467. if (reportFailures === 0) {
  23468. matchFailed("[A-Z]");
  23469. }
  23470. }
  23471. if (result0 !== null) {
  23472. result1 = [];
  23473. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23474. result2 = input.charAt(pos.offset);
  23475. advance(pos, 1);
  23476. } else {
  23477. result2 = null;
  23478. if (reportFailures === 0) {
  23479. matchFailed("[a-zA-Z0-9]");
  23480. }
  23481. }
  23482. while (result2 !== null) {
  23483. result1.push(result2);
  23484. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  23485. result2 = input.charAt(pos.offset);
  23486. advance(pos, 1);
  23487. } else {
  23488. result2 = null;
  23489. if (reportFailures === 0) {
  23490. matchFailed("[a-zA-Z0-9]");
  23491. }
  23492. }
  23493. }
  23494. if (result1 !== null) {
  23495. result0 = [result0, result1];
  23496. } else {
  23497. result0 = null;
  23498. pos = clone(pos1);
  23499. }
  23500. } else {
  23501. result0 = null;
  23502. pos = clone(pos1);
  23503. }
  23504. if (result0 !== null) {
  23505. result0 = (function(offset, line, column, first, others) {return first + others.join("")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  23506. }
  23507. if (result0 === null) {
  23508. pos = clone(pos0);
  23509. }
  23510. cache[cacheKey] = {
  23511. nextPos: clone(pos),
  23512. result: result0
  23513. };
  23514. return result0;
  23515. }
  23516. function parse_string() {
  23517. var cacheKey = "string@" + pos.offset;
  23518. var cachedResult = cache[cacheKey];
  23519. if (cachedResult) {
  23520. pos = clone(cachedResult.nextPos);
  23521. return cachedResult.result;
  23522. }
  23523. var result0, result1, result2;
  23524. var pos0, pos1, pos2;
  23525. pos0 = clone(pos);
  23526. pos1 = clone(pos);
  23527. if (/^[']/.test(input.charAt(pos.offset))) {
  23528. result0 = input.charAt(pos.offset);
  23529. advance(pos, 1);
  23530. } else {
  23531. result0 = null;
  23532. if (reportFailures === 0) {
  23533. matchFailed("[']");
  23534. }
  23535. }
  23536. if (result0 !== null) {
  23537. result1 = [];
  23538. pos2 = clone(pos);
  23539. if (input.substr(pos.offset, 2) === "''") {
  23540. result2 = "''";
  23541. advance(pos, 2);
  23542. } else {
  23543. result2 = null;
  23544. if (reportFailures === 0) {
  23545. matchFailed("\"''\"");
  23546. }
  23547. }
  23548. if (result2 !== null) {
  23549. result2 = (function(offset, line, column) {return "'"})(pos2.offset, pos2.line, pos2.column);
  23550. }
  23551. if (result2 === null) {
  23552. pos = clone(pos2);
  23553. }
  23554. if (result2 === null) {
  23555. if (/^[^']/.test(input.charAt(pos.offset))) {
  23556. result2 = input.charAt(pos.offset);
  23557. advance(pos, 1);
  23558. } else {
  23559. result2 = null;
  23560. if (reportFailures === 0) {
  23561. matchFailed("[^']");
  23562. }
  23563. }
  23564. }
  23565. while (result2 !== null) {
  23566. result1.push(result2);
  23567. pos2 = clone(pos);
  23568. if (input.substr(pos.offset, 2) === "''") {
  23569. result2 = "''";
  23570. advance(pos, 2);
  23571. } else {
  23572. result2 = null;
  23573. if (reportFailures === 0) {
  23574. matchFailed("\"''\"");
  23575. }
  23576. }
  23577. if (result2 !== null) {
  23578. result2 = (function(offset, line, column) {return "'"})(pos2.offset, pos2.line, pos2.column);
  23579. }
  23580. if (result2 === null) {
  23581. pos = clone(pos2);
  23582. }
  23583. if (result2 === null) {
  23584. if (/^[^']/.test(input.charAt(pos.offset))) {
  23585. result2 = input.charAt(pos.offset);
  23586. advance(pos, 1);
  23587. } else {
  23588. result2 = null;
  23589. if (reportFailures === 0) {
  23590. matchFailed("[^']");
  23591. }
  23592. }
  23593. }
  23594. }
  23595. if (result1 !== null) {
  23596. if (/^[']/.test(input.charAt(pos.offset))) {
  23597. result2 = input.charAt(pos.offset);
  23598. advance(pos, 1);
  23599. } else {
  23600. result2 = null;
  23601. if (reportFailures === 0) {
  23602. matchFailed("[']");
  23603. }
  23604. }
  23605. if (result2 !== null) {
  23606. result0 = [result0, result1, result2];
  23607. } else {
  23608. result0 = null;
  23609. pos = clone(pos1);
  23610. }
  23611. } else {
  23612. result0 = null;
  23613. pos = clone(pos1);
  23614. }
  23615. } else {
  23616. result0 = null;
  23617. pos = clone(pos1);
  23618. }
  23619. if (result0 !== null) {
  23620. result0 = (function(offset, line, column, val) {
  23621. return smalltalk.ValueNode._new()
  23622. ._value_(val.join("").replace(/\"/ig, '"'))
  23623. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  23624. }
  23625. if (result0 === null) {
  23626. pos = clone(pos0);
  23627. }
  23628. cache[cacheKey] = {
  23629. nextPos: clone(pos),
  23630. result: result0
  23631. };
  23632. return result0;
  23633. }
  23634. function parse_symbol() {
  23635. var cacheKey = "symbol@" + pos.offset;
  23636. var cachedResult = cache[cacheKey];
  23637. if (cachedResult) {
  23638. pos = clone(cachedResult.nextPos);
  23639. return cachedResult.result;
  23640. }
  23641. var result0, result1, result2, result3;
  23642. var pos0, pos1, pos2;
  23643. pos0 = clone(pos);
  23644. pos1 = clone(pos);
  23645. if (input.charCodeAt(pos.offset) === 35) {
  23646. result0 = "#";
  23647. advance(pos, 1);
  23648. } else {
  23649. result0 = null;
  23650. if (reportFailures === 0) {
  23651. matchFailed("\"#\"");
  23652. }
  23653. }
  23654. if (result0 !== null) {
  23655. result1 = [];
  23656. pos2 = clone(pos);
  23657. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  23658. result3 = input.charAt(pos.offset);
  23659. advance(pos, 1);
  23660. } else {
  23661. result3 = null;
  23662. if (reportFailures === 0) {
  23663. matchFailed("[a-zA-Z0-9:]");
  23664. }
  23665. }
  23666. if (result3 !== null) {
  23667. result2 = [];
  23668. while (result3 !== null) {
  23669. result2.push(result3);
  23670. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  23671. result3 = input.charAt(pos.offset);
  23672. advance(pos, 1);
  23673. } else {
  23674. result3 = null;
  23675. if (reportFailures === 0) {
  23676. matchFailed("[a-zA-Z0-9:]");
  23677. }
  23678. }
  23679. }
  23680. } else {
  23681. result2 = null;
  23682. }
  23683. if (result2 !== null) {
  23684. result2 = (function(offset, line, column, digits) {return digits.join("")})(pos2.offset, pos2.line, pos2.column, result2);
  23685. }
  23686. if (result2 === null) {
  23687. pos = clone(pos2);
  23688. }
  23689. if (result2 === null) {
  23690. pos2 = clone(pos);
  23691. result2 = parse_string();
  23692. if (result2 !== null) {
  23693. result2 = (function(offset, line, column, node) {return node._value()})(pos2.offset, pos2.line, pos2.column, result2);
  23694. }
  23695. if (result2 === null) {
  23696. pos = clone(pos2);
  23697. }
  23698. }
  23699. while (result2 !== null) {
  23700. result1.push(result2);
  23701. pos2 = clone(pos);
  23702. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  23703. result3 = input.charAt(pos.offset);
  23704. advance(pos, 1);
  23705. } else {
  23706. result3 = null;
  23707. if (reportFailures === 0) {
  23708. matchFailed("[a-zA-Z0-9:]");
  23709. }
  23710. }
  23711. if (result3 !== null) {
  23712. result2 = [];
  23713. while (result3 !== null) {
  23714. result2.push(result3);
  23715. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  23716. result3 = input.charAt(pos.offset);
  23717. advance(pos, 1);
  23718. } else {
  23719. result3 = null;
  23720. if (reportFailures === 0) {
  23721. matchFailed("[a-zA-Z0-9:]");
  23722. }
  23723. }
  23724. }
  23725. } else {
  23726. result2 = null;
  23727. }
  23728. if (result2 !== null) {
  23729. result2 = (function(offset, line, column, digits) {return digits.join("")})(pos2.offset, pos2.line, pos2.column, result2);
  23730. }
  23731. if (result2 === null) {
  23732. pos = clone(pos2);
  23733. }
  23734. if (result2 === null) {
  23735. pos2 = clone(pos);
  23736. result2 = parse_string();
  23737. if (result2 !== null) {
  23738. result2 = (function(offset, line, column, node) {return node._value()})(pos2.offset, pos2.line, pos2.column, result2);
  23739. }
  23740. if (result2 === null) {
  23741. pos = clone(pos2);
  23742. }
  23743. }
  23744. }
  23745. if (result1 !== null) {
  23746. result0 = [result0, result1];
  23747. } else {
  23748. result0 = null;
  23749. pos = clone(pos1);
  23750. }
  23751. } else {
  23752. result0 = null;
  23753. pos = clone(pos1);
  23754. }
  23755. if (result0 !== null) {
  23756. result0 = (function(offset, line, column, val) {
  23757. return smalltalk.ValueNode._new()
  23758. ._value_(smalltalk.symbolFor(val.join("").replace(/\"/ig, '"')))
  23759. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  23760. }
  23761. if (result0 === null) {
  23762. pos = clone(pos0);
  23763. }
  23764. cache[cacheKey] = {
  23765. nextPos: clone(pos),
  23766. result: result0
  23767. };
  23768. return result0;
  23769. }
  23770. function parse_number() {
  23771. var cacheKey = "number@" + pos.offset;
  23772. var cachedResult = cache[cacheKey];
  23773. if (cachedResult) {
  23774. pos = clone(cachedResult.nextPos);
  23775. return cachedResult.result;
  23776. }
  23777. var result0;
  23778. var pos0;
  23779. pos0 = clone(pos);
  23780. result0 = parse_hex();
  23781. if (result0 === null) {
  23782. result0 = parse_float();
  23783. if (result0 === null) {
  23784. result0 = parse_integer();
  23785. }
  23786. }
  23787. if (result0 !== null) {
  23788. result0 = (function(offset, line, column, n) {
  23789. return smalltalk.ValueNode._new()
  23790. ._value_(n)
  23791. })(pos0.offset, pos0.line, pos0.column, result0);
  23792. }
  23793. if (result0 === null) {
  23794. pos = clone(pos0);
  23795. }
  23796. cache[cacheKey] = {
  23797. nextPos: clone(pos),
  23798. result: result0
  23799. };
  23800. return result0;
  23801. }
  23802. function parse_hex() {
  23803. var cacheKey = "hex@" + pos.offset;
  23804. var cachedResult = cache[cacheKey];
  23805. if (cachedResult) {
  23806. pos = clone(cachedResult.nextPos);
  23807. return cachedResult.result;
  23808. }
  23809. var result0, result1, result2, result3;
  23810. var pos0, pos1;
  23811. pos0 = clone(pos);
  23812. pos1 = clone(pos);
  23813. if (/^[\-]/.test(input.charAt(pos.offset))) {
  23814. result0 = input.charAt(pos.offset);
  23815. advance(pos, 1);
  23816. } else {
  23817. result0 = null;
  23818. if (reportFailures === 0) {
  23819. matchFailed("[\\-]");
  23820. }
  23821. }
  23822. result0 = result0 !== null ? result0 : "";
  23823. if (result0 !== null) {
  23824. if (input.substr(pos.offset, 3) === "16r") {
  23825. result1 = "16r";
  23826. advance(pos, 3);
  23827. } else {
  23828. result1 = null;
  23829. if (reportFailures === 0) {
  23830. matchFailed("\"16r\"");
  23831. }
  23832. }
  23833. if (result1 !== null) {
  23834. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  23835. result3 = input.charAt(pos.offset);
  23836. advance(pos, 1);
  23837. } else {
  23838. result3 = null;
  23839. if (reportFailures === 0) {
  23840. matchFailed("[0-9a-fA-F]");
  23841. }
  23842. }
  23843. if (result3 !== null) {
  23844. result2 = [];
  23845. while (result3 !== null) {
  23846. result2.push(result3);
  23847. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  23848. result3 = input.charAt(pos.offset);
  23849. advance(pos, 1);
  23850. } else {
  23851. result3 = null;
  23852. if (reportFailures === 0) {
  23853. matchFailed("[0-9a-fA-F]");
  23854. }
  23855. }
  23856. }
  23857. } else {
  23858. result2 = null;
  23859. }
  23860. if (result2 !== null) {
  23861. result0 = [result0, result1, result2];
  23862. } else {
  23863. result0 = null;
  23864. pos = clone(pos1);
  23865. }
  23866. } else {
  23867. result0 = null;
  23868. pos = clone(pos1);
  23869. }
  23870. } else {
  23871. result0 = null;
  23872. pos = clone(pos1);
  23873. }
  23874. if (result0 !== null) {
  23875. result0 = (function(offset, line, column, neg, num) {return parseInt((neg + num.join("")), 16)})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  23876. }
  23877. if (result0 === null) {
  23878. pos = clone(pos0);
  23879. }
  23880. cache[cacheKey] = {
  23881. nextPos: clone(pos),
  23882. result: result0
  23883. };
  23884. return result0;
  23885. }
  23886. function parse_float() {
  23887. var cacheKey = "float@" + pos.offset;
  23888. var cachedResult = cache[cacheKey];
  23889. if (cachedResult) {
  23890. pos = clone(cachedResult.nextPos);
  23891. return cachedResult.result;
  23892. }
  23893. var result0, result1, result2, result3, result4;
  23894. var pos0, pos1;
  23895. pos0 = clone(pos);
  23896. pos1 = clone(pos);
  23897. if (/^[\-]/.test(input.charAt(pos.offset))) {
  23898. result0 = input.charAt(pos.offset);
  23899. advance(pos, 1);
  23900. } else {
  23901. result0 = null;
  23902. if (reportFailures === 0) {
  23903. matchFailed("[\\-]");
  23904. }
  23905. }
  23906. result0 = result0 !== null ? result0 : "";
  23907. if (result0 !== null) {
  23908. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  23909. result2 = input.charAt(pos.offset);
  23910. advance(pos, 1);
  23911. } else {
  23912. result2 = null;
  23913. if (reportFailures === 0) {
  23914. matchFailed("[0-9]");
  23915. }
  23916. }
  23917. if (result2 !== null) {
  23918. result1 = [];
  23919. while (result2 !== null) {
  23920. result1.push(result2);
  23921. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  23922. result2 = input.charAt(pos.offset);
  23923. advance(pos, 1);
  23924. } else {
  23925. result2 = null;
  23926. if (reportFailures === 0) {
  23927. matchFailed("[0-9]");
  23928. }
  23929. }
  23930. }
  23931. } else {
  23932. result1 = null;
  23933. }
  23934. if (result1 !== null) {
  23935. if (input.charCodeAt(pos.offset) === 46) {
  23936. result2 = ".";
  23937. advance(pos, 1);
  23938. } else {
  23939. result2 = null;
  23940. if (reportFailures === 0) {
  23941. matchFailed("\".\"");
  23942. }
  23943. }
  23944. if (result2 !== null) {
  23945. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  23946. result4 = input.charAt(pos.offset);
  23947. advance(pos, 1);
  23948. } else {
  23949. result4 = null;
  23950. if (reportFailures === 0) {
  23951. matchFailed("[0-9]");
  23952. }
  23953. }
  23954. if (result4 !== null) {
  23955. result3 = [];
  23956. while (result4 !== null) {
  23957. result3.push(result4);
  23958. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  23959. result4 = input.charAt(pos.offset);
  23960. advance(pos, 1);
  23961. } else {
  23962. result4 = null;
  23963. if (reportFailures === 0) {
  23964. matchFailed("[0-9]");
  23965. }
  23966. }
  23967. }
  23968. } else {
  23969. result3 = null;
  23970. }
  23971. if (result3 !== null) {
  23972. result0 = [result0, result1, result2, result3];
  23973. } else {
  23974. result0 = null;
  23975. pos = clone(pos1);
  23976. }
  23977. } else {
  23978. result0 = null;
  23979. pos = clone(pos1);
  23980. }
  23981. } else {
  23982. result0 = null;
  23983. pos = clone(pos1);
  23984. }
  23985. } else {
  23986. result0 = null;
  23987. pos = clone(pos1);
  23988. }
  23989. if (result0 !== null) {
  23990. result0 = (function(offset, line, column, neg, int, dec) {return parseFloat((neg + int.join("") + "." + dec.join("")), 10)})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1], result0[3]);
  23991. }
  23992. if (result0 === null) {
  23993. pos = clone(pos0);
  23994. }
  23995. cache[cacheKey] = {
  23996. nextPos: clone(pos),
  23997. result: result0
  23998. };
  23999. return result0;
  24000. }
  24001. function parse_integer() {
  24002. var cacheKey = "integer@" + pos.offset;
  24003. var cachedResult = cache[cacheKey];
  24004. if (cachedResult) {
  24005. pos = clone(cachedResult.nextPos);
  24006. return cachedResult.result;
  24007. }
  24008. var result0, result1, result2;
  24009. var pos0, pos1;
  24010. pos0 = clone(pos);
  24011. pos1 = clone(pos);
  24012. if (/^[\-]/.test(input.charAt(pos.offset))) {
  24013. result0 = input.charAt(pos.offset);
  24014. advance(pos, 1);
  24015. } else {
  24016. result0 = null;
  24017. if (reportFailures === 0) {
  24018. matchFailed("[\\-]");
  24019. }
  24020. }
  24021. result0 = result0 !== null ? result0 : "";
  24022. if (result0 !== null) {
  24023. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  24024. result2 = input.charAt(pos.offset);
  24025. advance(pos, 1);
  24026. } else {
  24027. result2 = null;
  24028. if (reportFailures === 0) {
  24029. matchFailed("[0-9]");
  24030. }
  24031. }
  24032. if (result2 !== null) {
  24033. result1 = [];
  24034. while (result2 !== null) {
  24035. result1.push(result2);
  24036. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  24037. result2 = input.charAt(pos.offset);
  24038. advance(pos, 1);
  24039. } else {
  24040. result2 = null;
  24041. if (reportFailures === 0) {
  24042. matchFailed("[0-9]");
  24043. }
  24044. }
  24045. }
  24046. } else {
  24047. result1 = null;
  24048. }
  24049. if (result1 !== null) {
  24050. result0 = [result0, result1];
  24051. } else {
  24052. result0 = null;
  24053. pos = clone(pos1);
  24054. }
  24055. } else {
  24056. result0 = null;
  24057. pos = clone(pos1);
  24058. }
  24059. if (result0 !== null) {
  24060. result0 = (function(offset, line, column, neg, digits) {return (parseInt(neg+digits.join(""), 10))})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  24061. }
  24062. if (result0 === null) {
  24063. pos = clone(pos0);
  24064. }
  24065. cache[cacheKey] = {
  24066. nextPos: clone(pos),
  24067. result: result0
  24068. };
  24069. return result0;
  24070. }
  24071. function parse_literalArray() {
  24072. var cacheKey = "literalArray@" + pos.offset;
  24073. var cachedResult = cache[cacheKey];
  24074. if (cachedResult) {
  24075. pos = clone(cachedResult.nextPos);
  24076. return cachedResult.result;
  24077. }
  24078. var result0, result1, result2, result3, result4;
  24079. var pos0, pos1, pos2, pos3;
  24080. pos0 = clone(pos);
  24081. pos1 = clone(pos);
  24082. if (input.substr(pos.offset, 2) === "#(") {
  24083. result0 = "#(";
  24084. advance(pos, 2);
  24085. } else {
  24086. result0 = null;
  24087. if (reportFailures === 0) {
  24088. matchFailed("\"#(\"");
  24089. }
  24090. }
  24091. if (result0 !== null) {
  24092. result1 = parse_ws();
  24093. if (result1 !== null) {
  24094. result2 = [];
  24095. pos2 = clone(pos);
  24096. pos3 = clone(pos);
  24097. result3 = parse_literal();
  24098. if (result3 !== null) {
  24099. result4 = parse_ws();
  24100. if (result4 !== null) {
  24101. result3 = [result3, result4];
  24102. } else {
  24103. result3 = null;
  24104. pos = clone(pos3);
  24105. }
  24106. } else {
  24107. result3 = null;
  24108. pos = clone(pos3);
  24109. }
  24110. if (result3 !== null) {
  24111. result3 = (function(offset, line, column, lit) {return lit._value()})(pos2.offset, pos2.line, pos2.column, result3[0]);
  24112. }
  24113. if (result3 === null) {
  24114. pos = clone(pos2);
  24115. }
  24116. while (result3 !== null) {
  24117. result2.push(result3);
  24118. pos2 = clone(pos);
  24119. pos3 = clone(pos);
  24120. result3 = parse_literal();
  24121. if (result3 !== null) {
  24122. result4 = parse_ws();
  24123. if (result4 !== null) {
  24124. result3 = [result3, result4];
  24125. } else {
  24126. result3 = null;
  24127. pos = clone(pos3);
  24128. }
  24129. } else {
  24130. result3 = null;
  24131. pos = clone(pos3);
  24132. }
  24133. if (result3 !== null) {
  24134. result3 = (function(offset, line, column, lit) {return lit._value()})(pos2.offset, pos2.line, pos2.column, result3[0]);
  24135. }
  24136. if (result3 === null) {
  24137. pos = clone(pos2);
  24138. }
  24139. }
  24140. if (result2 !== null) {
  24141. result3 = parse_ws();
  24142. if (result3 !== null) {
  24143. if (input.charCodeAt(pos.offset) === 41) {
  24144. result4 = ")";
  24145. advance(pos, 1);
  24146. } else {
  24147. result4 = null;
  24148. if (reportFailures === 0) {
  24149. matchFailed("\")\"");
  24150. }
  24151. }
  24152. if (result4 !== null) {
  24153. result0 = [result0, result1, result2, result3, result4];
  24154. } else {
  24155. result0 = null;
  24156. pos = clone(pos1);
  24157. }
  24158. } else {
  24159. result0 = null;
  24160. pos = clone(pos1);
  24161. }
  24162. } else {
  24163. result0 = null;
  24164. pos = clone(pos1);
  24165. }
  24166. } else {
  24167. result0 = null;
  24168. pos = clone(pos1);
  24169. }
  24170. } else {
  24171. result0 = null;
  24172. pos = clone(pos1);
  24173. }
  24174. if (result0 !== null) {
  24175. result0 = (function(offset, line, column, lits) {
  24176. return smalltalk.ValueNode._new()
  24177. ._value_(lits)
  24178. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  24179. }
  24180. if (result0 === null) {
  24181. pos = clone(pos0);
  24182. }
  24183. cache[cacheKey] = {
  24184. nextPos: clone(pos),
  24185. result: result0
  24186. };
  24187. return result0;
  24188. }
  24189. function parse_dynamicArray() {
  24190. var cacheKey = "dynamicArray@" + pos.offset;
  24191. var cachedResult = cache[cacheKey];
  24192. if (cachedResult) {
  24193. pos = clone(cachedResult.nextPos);
  24194. return cachedResult.result;
  24195. }
  24196. var result0, result1, result2, result3, result4, result5;
  24197. var pos0, pos1;
  24198. pos0 = clone(pos);
  24199. pos1 = clone(pos);
  24200. if (input.charCodeAt(pos.offset) === 123) {
  24201. result0 = "{";
  24202. advance(pos, 1);
  24203. } else {
  24204. result0 = null;
  24205. if (reportFailures === 0) {
  24206. matchFailed("\"{\"");
  24207. }
  24208. }
  24209. if (result0 !== null) {
  24210. result1 = parse_ws();
  24211. if (result1 !== null) {
  24212. result2 = parse_expressions();
  24213. result2 = result2 !== null ? result2 : "";
  24214. if (result2 !== null) {
  24215. result3 = parse_ws();
  24216. if (result3 !== null) {
  24217. if (input.charCodeAt(pos.offset) === 46) {
  24218. result4 = ".";
  24219. advance(pos, 1);
  24220. } else {
  24221. result4 = null;
  24222. if (reportFailures === 0) {
  24223. matchFailed("\".\"");
  24224. }
  24225. }
  24226. result4 = result4 !== null ? result4 : "";
  24227. if (result4 !== null) {
  24228. if (input.charCodeAt(pos.offset) === 125) {
  24229. result5 = "}";
  24230. advance(pos, 1);
  24231. } else {
  24232. result5 = null;
  24233. if (reportFailures === 0) {
  24234. matchFailed("\"}\"");
  24235. }
  24236. }
  24237. if (result5 !== null) {
  24238. result0 = [result0, result1, result2, result3, result4, result5];
  24239. } else {
  24240. result0 = null;
  24241. pos = clone(pos1);
  24242. }
  24243. } else {
  24244. result0 = null;
  24245. pos = clone(pos1);
  24246. }
  24247. } else {
  24248. result0 = null;
  24249. pos = clone(pos1);
  24250. }
  24251. } else {
  24252. result0 = null;
  24253. pos = clone(pos1);
  24254. }
  24255. } else {
  24256. result0 = null;
  24257. pos = clone(pos1);
  24258. }
  24259. } else {
  24260. result0 = null;
  24261. pos = clone(pos1);
  24262. }
  24263. if (result0 !== null) {
  24264. result0 = (function(offset, line, column, expressions) {
  24265. return smalltalk.DynamicArrayNode._new()
  24266. ._nodes_(expressions)
  24267. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  24268. }
  24269. if (result0 === null) {
  24270. pos = clone(pos0);
  24271. }
  24272. cache[cacheKey] = {
  24273. nextPos: clone(pos),
  24274. result: result0
  24275. };
  24276. return result0;
  24277. }
  24278. function parse_dynamicDictionary() {
  24279. var cacheKey = "dynamicDictionary@" + pos.offset;
  24280. var cachedResult = cache[cacheKey];
  24281. if (cachedResult) {
  24282. pos = clone(cachedResult.nextPos);
  24283. return cachedResult.result;
  24284. }
  24285. var result0, result1, result2, result3, result4;
  24286. var pos0, pos1;
  24287. pos0 = clone(pos);
  24288. pos1 = clone(pos);
  24289. if (input.substr(pos.offset, 2) === "#{") {
  24290. result0 = "#{";
  24291. advance(pos, 2);
  24292. } else {
  24293. result0 = null;
  24294. if (reportFailures === 0) {
  24295. matchFailed("\"#{\"");
  24296. }
  24297. }
  24298. if (result0 !== null) {
  24299. result1 = parse_ws();
  24300. if (result1 !== null) {
  24301. result2 = parse_expressions();
  24302. result2 = result2 !== null ? result2 : "";
  24303. if (result2 !== null) {
  24304. result3 = parse_ws();
  24305. if (result3 !== null) {
  24306. if (input.charCodeAt(pos.offset) === 125) {
  24307. result4 = "}";
  24308. advance(pos, 1);
  24309. } else {
  24310. result4 = null;
  24311. if (reportFailures === 0) {
  24312. matchFailed("\"}\"");
  24313. }
  24314. }
  24315. if (result4 !== null) {
  24316. result0 = [result0, result1, result2, result3, result4];
  24317. } else {
  24318. result0 = null;
  24319. pos = clone(pos1);
  24320. }
  24321. } else {
  24322. result0 = null;
  24323. pos = clone(pos1);
  24324. }
  24325. } else {
  24326. result0 = null;
  24327. pos = clone(pos1);
  24328. }
  24329. } else {
  24330. result0 = null;
  24331. pos = clone(pos1);
  24332. }
  24333. } else {
  24334. result0 = null;
  24335. pos = clone(pos1);
  24336. }
  24337. if (result0 !== null) {
  24338. result0 = (function(offset, line, column, expressions) {
  24339. return smalltalk.DynamicDictionaryNode._new()
  24340. ._nodes_(expressions)
  24341. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  24342. }
  24343. if (result0 === null) {
  24344. pos = clone(pos0);
  24345. }
  24346. cache[cacheKey] = {
  24347. nextPos: clone(pos),
  24348. result: result0
  24349. };
  24350. return result0;
  24351. }
  24352. function parse_pseudoVariable() {
  24353. var cacheKey = "pseudoVariable@" + pos.offset;
  24354. var cachedResult = cache[cacheKey];
  24355. if (cachedResult) {
  24356. pos = clone(cachedResult.nextPos);
  24357. return cachedResult.result;
  24358. }
  24359. var result0;
  24360. var pos0, pos1;
  24361. pos0 = clone(pos);
  24362. pos1 = clone(pos);
  24363. if (input.substr(pos.offset, 4) === "true") {
  24364. result0 = "true";
  24365. advance(pos, 4);
  24366. } else {
  24367. result0 = null;
  24368. if (reportFailures === 0) {
  24369. matchFailed("\"true\"");
  24370. }
  24371. }
  24372. if (result0 !== null) {
  24373. result0 = (function(offset, line, column) {return true})(pos1.offset, pos1.line, pos1.column);
  24374. }
  24375. if (result0 === null) {
  24376. pos = clone(pos1);
  24377. }
  24378. if (result0 === null) {
  24379. pos1 = clone(pos);
  24380. if (input.substr(pos.offset, 5) === "false") {
  24381. result0 = "false";
  24382. advance(pos, 5);
  24383. } else {
  24384. result0 = null;
  24385. if (reportFailures === 0) {
  24386. matchFailed("\"false\"");
  24387. }
  24388. }
  24389. if (result0 !== null) {
  24390. result0 = (function(offset, line, column) {return false})(pos1.offset, pos1.line, pos1.column);
  24391. }
  24392. if (result0 === null) {
  24393. pos = clone(pos1);
  24394. }
  24395. if (result0 === null) {
  24396. pos1 = clone(pos);
  24397. if (input.substr(pos.offset, 3) === "nil") {
  24398. result0 = "nil";
  24399. advance(pos, 3);
  24400. } else {
  24401. result0 = null;
  24402. if (reportFailures === 0) {
  24403. matchFailed("\"nil\"");
  24404. }
  24405. }
  24406. if (result0 !== null) {
  24407. result0 = (function(offset, line, column) {return nil})(pos1.offset, pos1.line, pos1.column);
  24408. }
  24409. if (result0 === null) {
  24410. pos = clone(pos1);
  24411. }
  24412. }
  24413. }
  24414. if (result0 !== null) {
  24415. result0 = (function(offset, line, column, val) {
  24416. return smalltalk.ValueNode._new()
  24417. ._value_(val)
  24418. })(pos0.offset, pos0.line, pos0.column, result0);
  24419. }
  24420. if (result0 === null) {
  24421. pos = clone(pos0);
  24422. }
  24423. cache[cacheKey] = {
  24424. nextPos: clone(pos),
  24425. result: result0
  24426. };
  24427. return result0;
  24428. }
  24429. function parse_literal() {
  24430. var cacheKey = "literal@" + pos.offset;
  24431. var cachedResult = cache[cacheKey];
  24432. if (cachedResult) {
  24433. pos = clone(cachedResult.nextPos);
  24434. return cachedResult.result;
  24435. }
  24436. var result0;
  24437. result0 = parse_pseudoVariable();
  24438. if (result0 === null) {
  24439. result0 = parse_number();
  24440. if (result0 === null) {
  24441. result0 = parse_literalArray();
  24442. if (result0 === null) {
  24443. result0 = parse_dynamicDictionary();
  24444. if (result0 === null) {
  24445. result0 = parse_dynamicArray();
  24446. if (result0 === null) {
  24447. result0 = parse_string();
  24448. if (result0 === null) {
  24449. result0 = parse_symbol();
  24450. if (result0 === null) {
  24451. result0 = parse_block();
  24452. }
  24453. }
  24454. }
  24455. }
  24456. }
  24457. }
  24458. }
  24459. cache[cacheKey] = {
  24460. nextPos: clone(pos),
  24461. result: result0
  24462. };
  24463. return result0;
  24464. }
  24465. function parse_variable() {
  24466. var cacheKey = "variable@" + pos.offset;
  24467. var cachedResult = cache[cacheKey];
  24468. if (cachedResult) {
  24469. pos = clone(cachedResult.nextPos);
  24470. return cachedResult.result;
  24471. }
  24472. var result0;
  24473. var pos0;
  24474. pos0 = clone(pos);
  24475. result0 = parse_varIdentifier();
  24476. if (result0 !== null) {
  24477. result0 = (function(offset, line, column, identifier) {
  24478. return smalltalk.VariableNode._new()
  24479. ._value_(identifier)
  24480. })(pos0.offset, pos0.line, pos0.column, result0);
  24481. }
  24482. if (result0 === null) {
  24483. pos = clone(pos0);
  24484. }
  24485. cache[cacheKey] = {
  24486. nextPos: clone(pos),
  24487. result: result0
  24488. };
  24489. return result0;
  24490. }
  24491. function parse_classReference() {
  24492. var cacheKey = "classReference@" + pos.offset;
  24493. var cachedResult = cache[cacheKey];
  24494. if (cachedResult) {
  24495. pos = clone(cachedResult.nextPos);
  24496. return cachedResult.result;
  24497. }
  24498. var result0;
  24499. var pos0;
  24500. pos0 = clone(pos);
  24501. result0 = parse_className();
  24502. if (result0 !== null) {
  24503. result0 = (function(offset, line, column, className) {
  24504. return smalltalk.ClassReferenceNode._new()
  24505. ._value_(className)
  24506. })(pos0.offset, pos0.line, pos0.column, result0);
  24507. }
  24508. if (result0 === null) {
  24509. pos = clone(pos0);
  24510. }
  24511. cache[cacheKey] = {
  24512. nextPos: clone(pos),
  24513. result: result0
  24514. };
  24515. return result0;
  24516. }
  24517. function parse_reference() {
  24518. var cacheKey = "reference@" + pos.offset;
  24519. var cachedResult = cache[cacheKey];
  24520. if (cachedResult) {
  24521. pos = clone(cachedResult.nextPos);
  24522. return cachedResult.result;
  24523. }
  24524. var result0;
  24525. result0 = parse_variable();
  24526. if (result0 === null) {
  24527. result0 = parse_classReference();
  24528. }
  24529. cache[cacheKey] = {
  24530. nextPos: clone(pos),
  24531. result: result0
  24532. };
  24533. return result0;
  24534. }
  24535. function parse_keywordPair() {
  24536. var cacheKey = "keywordPair@" + pos.offset;
  24537. var cachedResult = cache[cacheKey];
  24538. if (cachedResult) {
  24539. pos = clone(cachedResult.nextPos);
  24540. return cachedResult.result;
  24541. }
  24542. var result0, result1, result2, result3;
  24543. var pos0, pos1;
  24544. pos0 = clone(pos);
  24545. pos1 = clone(pos);
  24546. result0 = parse_keyword();
  24547. if (result0 !== null) {
  24548. result1 = parse_ws();
  24549. if (result1 !== null) {
  24550. result2 = parse_binarySend();
  24551. if (result2 !== null) {
  24552. result3 = parse_ws();
  24553. if (result3 !== null) {
  24554. result0 = [result0, result1, result2, result3];
  24555. } else {
  24556. result0 = null;
  24557. pos = clone(pos1);
  24558. }
  24559. } else {
  24560. result0 = null;
  24561. pos = clone(pos1);
  24562. }
  24563. } else {
  24564. result0 = null;
  24565. pos = clone(pos1);
  24566. }
  24567. } else {
  24568. result0 = null;
  24569. pos = clone(pos1);
  24570. }
  24571. if (result0 !== null) {
  24572. result0 = (function(offset, line, column, key, arg) {return {key:key, arg: arg}})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  24573. }
  24574. if (result0 === null) {
  24575. pos = clone(pos0);
  24576. }
  24577. cache[cacheKey] = {
  24578. nextPos: clone(pos),
  24579. result: result0
  24580. };
  24581. return result0;
  24582. }
  24583. function parse_binarySelector() {
  24584. var cacheKey = "binarySelector@" + pos.offset;
  24585. var cachedResult = cache[cacheKey];
  24586. if (cachedResult) {
  24587. pos = clone(cachedResult.nextPos);
  24588. return cachedResult.result;
  24589. }
  24590. var result0, result1;
  24591. var pos0;
  24592. pos0 = clone(pos);
  24593. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  24594. result1 = input.charAt(pos.offset);
  24595. advance(pos, 1);
  24596. } else {
  24597. result1 = null;
  24598. if (reportFailures === 0) {
  24599. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  24600. }
  24601. }
  24602. if (result1 !== null) {
  24603. result0 = [];
  24604. while (result1 !== null) {
  24605. result0.push(result1);
  24606. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  24607. result1 = input.charAt(pos.offset);
  24608. advance(pos, 1);
  24609. } else {
  24610. result1 = null;
  24611. if (reportFailures === 0) {
  24612. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  24613. }
  24614. }
  24615. }
  24616. } else {
  24617. result0 = null;
  24618. }
  24619. if (result0 !== null) {
  24620. result0 = (function(offset, line, column, bin) {return bin.join("").replace(/\\/g, '\\\\')})(pos0.offset, pos0.line, pos0.column, result0);
  24621. }
  24622. if (result0 === null) {
  24623. pos = clone(pos0);
  24624. }
  24625. cache[cacheKey] = {
  24626. nextPos: clone(pos),
  24627. result: result0
  24628. };
  24629. return result0;
  24630. }
  24631. function parse_keywordPattern() {
  24632. var cacheKey = "keywordPattern@" + pos.offset;
  24633. var cachedResult = cache[cacheKey];
  24634. if (cachedResult) {
  24635. pos = clone(cachedResult.nextPos);
  24636. return cachedResult.result;
  24637. }
  24638. var result0, result1, result2, result3, result4;
  24639. var pos0, pos1, pos2;
  24640. pos0 = clone(pos);
  24641. pos1 = clone(pos);
  24642. pos2 = clone(pos);
  24643. result1 = parse_ws();
  24644. if (result1 !== null) {
  24645. result2 = parse_keyword();
  24646. if (result2 !== null) {
  24647. result3 = parse_ws();
  24648. if (result3 !== null) {
  24649. result4 = parse_identifier();
  24650. if (result4 !== null) {
  24651. result1 = [result1, result2, result3, result4];
  24652. } else {
  24653. result1 = null;
  24654. pos = clone(pos2);
  24655. }
  24656. } else {
  24657. result1 = null;
  24658. pos = clone(pos2);
  24659. }
  24660. } else {
  24661. result1 = null;
  24662. pos = clone(pos2);
  24663. }
  24664. } else {
  24665. result1 = null;
  24666. pos = clone(pos2);
  24667. }
  24668. if (result1 !== null) {
  24669. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg}})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  24670. }
  24671. if (result1 === null) {
  24672. pos = clone(pos1);
  24673. }
  24674. if (result1 !== null) {
  24675. result0 = [];
  24676. while (result1 !== null) {
  24677. result0.push(result1);
  24678. pos1 = clone(pos);
  24679. pos2 = clone(pos);
  24680. result1 = parse_ws();
  24681. if (result1 !== null) {
  24682. result2 = parse_keyword();
  24683. if (result2 !== null) {
  24684. result3 = parse_ws();
  24685. if (result3 !== null) {
  24686. result4 = parse_identifier();
  24687. if (result4 !== null) {
  24688. result1 = [result1, result2, result3, result4];
  24689. } else {
  24690. result1 = null;
  24691. pos = clone(pos2);
  24692. }
  24693. } else {
  24694. result1 = null;
  24695. pos = clone(pos2);
  24696. }
  24697. } else {
  24698. result1 = null;
  24699. pos = clone(pos2);
  24700. }
  24701. } else {
  24702. result1 = null;
  24703. pos = clone(pos2);
  24704. }
  24705. if (result1 !== null) {
  24706. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg}})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  24707. }
  24708. if (result1 === null) {
  24709. pos = clone(pos1);
  24710. }
  24711. }
  24712. } else {
  24713. result0 = null;
  24714. }
  24715. if (result0 !== null) {
  24716. result0 = (function(offset, line, column, pairs) {
  24717. var keywords = [];
  24718. var params = [];
  24719. for(var i=0;i<pairs.length;i++){
  24720. keywords.push(pairs[i].key);
  24721. }
  24722. for(var i=0;i<pairs.length;i++){
  24723. params.push(pairs[i].arg);
  24724. }
  24725. return [keywords.join(""), params]
  24726. })(pos0.offset, pos0.line, pos0.column, result0);
  24727. }
  24728. if (result0 === null) {
  24729. pos = clone(pos0);
  24730. }
  24731. cache[cacheKey] = {
  24732. nextPos: clone(pos),
  24733. result: result0
  24734. };
  24735. return result0;
  24736. }
  24737. function parse_binaryPattern() {
  24738. var cacheKey = "binaryPattern@" + pos.offset;
  24739. var cachedResult = cache[cacheKey];
  24740. if (cachedResult) {
  24741. pos = clone(cachedResult.nextPos);
  24742. return cachedResult.result;
  24743. }
  24744. var result0, result1, result2, result3;
  24745. var pos0, pos1;
  24746. pos0 = clone(pos);
  24747. pos1 = clone(pos);
  24748. result0 = parse_ws();
  24749. if (result0 !== null) {
  24750. result1 = parse_binarySelector();
  24751. if (result1 !== null) {
  24752. result2 = parse_ws();
  24753. if (result2 !== null) {
  24754. result3 = parse_identifier();
  24755. if (result3 !== null) {
  24756. result0 = [result0, result1, result2, result3];
  24757. } else {
  24758. result0 = null;
  24759. pos = clone(pos1);
  24760. }
  24761. } else {
  24762. result0 = null;
  24763. pos = clone(pos1);
  24764. }
  24765. } else {
  24766. result0 = null;
  24767. pos = clone(pos1);
  24768. }
  24769. } else {
  24770. result0 = null;
  24771. pos = clone(pos1);
  24772. }
  24773. if (result0 !== null) {
  24774. result0 = (function(offset, line, column, selector, arg) {return [selector, [arg]]})(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  24775. }
  24776. if (result0 === null) {
  24777. pos = clone(pos0);
  24778. }
  24779. cache[cacheKey] = {
  24780. nextPos: clone(pos),
  24781. result: result0
  24782. };
  24783. return result0;
  24784. }
  24785. function parse_unaryPattern() {
  24786. var cacheKey = "unaryPattern@" + pos.offset;
  24787. var cachedResult = cache[cacheKey];
  24788. if (cachedResult) {
  24789. pos = clone(cachedResult.nextPos);
  24790. return cachedResult.result;
  24791. }
  24792. var result0, result1;
  24793. var pos0, pos1;
  24794. pos0 = clone(pos);
  24795. pos1 = clone(pos);
  24796. result0 = parse_ws();
  24797. if (result0 !== null) {
  24798. result1 = parse_identifier();
  24799. if (result1 !== null) {
  24800. result0 = [result0, result1];
  24801. } else {
  24802. result0 = null;
  24803. pos = clone(pos1);
  24804. }
  24805. } else {
  24806. result0 = null;
  24807. pos = clone(pos1);
  24808. }
  24809. if (result0 !== null) {
  24810. result0 = (function(offset, line, column, selector) {return [selector, []]})(pos0.offset, pos0.line, pos0.column, result0[1]);
  24811. }
  24812. if (result0 === null) {
  24813. pos = clone(pos0);
  24814. }
  24815. cache[cacheKey] = {
  24816. nextPos: clone(pos),
  24817. result: result0
  24818. };
  24819. return result0;
  24820. }
  24821. function parse_expression() {
  24822. var cacheKey = "expression@" + pos.offset;
  24823. var cachedResult = cache[cacheKey];
  24824. if (cachedResult) {
  24825. pos = clone(cachedResult.nextPos);
  24826. return cachedResult.result;
  24827. }
  24828. var result0;
  24829. result0 = parse_assignment();
  24830. if (result0 === null) {
  24831. result0 = parse_cascade();
  24832. if (result0 === null) {
  24833. result0 = parse_keywordSend();
  24834. if (result0 === null) {
  24835. result0 = parse_binarySend();
  24836. if (result0 === null) {
  24837. result0 = parse_jsStatement();
  24838. }
  24839. }
  24840. }
  24841. }
  24842. cache[cacheKey] = {
  24843. nextPos: clone(pos),
  24844. result: result0
  24845. };
  24846. return result0;
  24847. }
  24848. function parse_expressionList() {
  24849. var cacheKey = "expressionList@" + pos.offset;
  24850. var cachedResult = cache[cacheKey];
  24851. if (cachedResult) {
  24852. pos = clone(cachedResult.nextPos);
  24853. return cachedResult.result;
  24854. }
  24855. var result0, result1, result2, result3;
  24856. var pos0, pos1;
  24857. pos0 = clone(pos);
  24858. pos1 = clone(pos);
  24859. result0 = parse_ws();
  24860. if (result0 !== null) {
  24861. if (input.charCodeAt(pos.offset) === 46) {
  24862. result1 = ".";
  24863. advance(pos, 1);
  24864. } else {
  24865. result1 = null;
  24866. if (reportFailures === 0) {
  24867. matchFailed("\".\"");
  24868. }
  24869. }
  24870. if (result1 !== null) {
  24871. result2 = parse_ws();
  24872. if (result2 !== null) {
  24873. result3 = parse_expression();
  24874. if (result3 !== null) {
  24875. result0 = [result0, result1, result2, result3];
  24876. } else {
  24877. result0 = null;
  24878. pos = clone(pos1);
  24879. }
  24880. } else {
  24881. result0 = null;
  24882. pos = clone(pos1);
  24883. }
  24884. } else {
  24885. result0 = null;
  24886. pos = clone(pos1);
  24887. }
  24888. } else {
  24889. result0 = null;
  24890. pos = clone(pos1);
  24891. }
  24892. if (result0 !== null) {
  24893. result0 = (function(offset, line, column, expression) {return expression})(pos0.offset, pos0.line, pos0.column, result0[3]);
  24894. }
  24895. if (result0 === null) {
  24896. pos = clone(pos0);
  24897. }
  24898. cache[cacheKey] = {
  24899. nextPos: clone(pos),
  24900. result: result0
  24901. };
  24902. return result0;
  24903. }
  24904. function parse_expressions() {
  24905. var cacheKey = "expressions@" + pos.offset;
  24906. var cachedResult = cache[cacheKey];
  24907. if (cachedResult) {
  24908. pos = clone(cachedResult.nextPos);
  24909. return cachedResult.result;
  24910. }
  24911. var result0, result1, result2;
  24912. var pos0, pos1;
  24913. pos0 = clone(pos);
  24914. pos1 = clone(pos);
  24915. result0 = parse_expression();
  24916. if (result0 !== null) {
  24917. result1 = [];
  24918. result2 = parse_expressionList();
  24919. while (result2 !== null) {
  24920. result1.push(result2);
  24921. result2 = parse_expressionList();
  24922. }
  24923. if (result1 !== null) {
  24924. result0 = [result0, result1];
  24925. } else {
  24926. result0 = null;
  24927. pos = clone(pos1);
  24928. }
  24929. } else {
  24930. result0 = null;
  24931. pos = clone(pos1);
  24932. }
  24933. if (result0 !== null) {
  24934. result0 = (function(offset, line, column, first, others) {
  24935. var result = [first];
  24936. for(var i=0;i<others.length;i++) {
  24937. result.push(others[i]);
  24938. }
  24939. return result;
  24940. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  24941. }
  24942. if (result0 === null) {
  24943. pos = clone(pos0);
  24944. }
  24945. cache[cacheKey] = {
  24946. nextPos: clone(pos),
  24947. result: result0
  24948. };
  24949. return result0;
  24950. }
  24951. function parse_assignment() {
  24952. var cacheKey = "assignment@" + pos.offset;
  24953. var cachedResult = cache[cacheKey];
  24954. if (cachedResult) {
  24955. pos = clone(cachedResult.nextPos);
  24956. return cachedResult.result;
  24957. }
  24958. var result0, result1, result2, result3, result4;
  24959. var pos0, pos1;
  24960. pos0 = clone(pos);
  24961. pos1 = clone(pos);
  24962. result0 = parse_variable();
  24963. if (result0 !== null) {
  24964. result1 = parse_ws();
  24965. if (result1 !== null) {
  24966. if (input.substr(pos.offset, 2) === ":=") {
  24967. result2 = ":=";
  24968. advance(pos, 2);
  24969. } else {
  24970. result2 = null;
  24971. if (reportFailures === 0) {
  24972. matchFailed("\":=\"");
  24973. }
  24974. }
  24975. if (result2 !== null) {
  24976. result3 = parse_ws();
  24977. if (result3 !== null) {
  24978. result4 = parse_expression();
  24979. if (result4 !== null) {
  24980. result0 = [result0, result1, result2, result3, result4];
  24981. } else {
  24982. result0 = null;
  24983. pos = clone(pos1);
  24984. }
  24985. } else {
  24986. result0 = null;
  24987. pos = clone(pos1);
  24988. }
  24989. } else {
  24990. result0 = null;
  24991. pos = clone(pos1);
  24992. }
  24993. } else {
  24994. result0 = null;
  24995. pos = clone(pos1);
  24996. }
  24997. } else {
  24998. result0 = null;
  24999. pos = clone(pos1);
  25000. }
  25001. if (result0 !== null) {
  25002. result0 = (function(offset, line, column, variable, expression) {
  25003. return smalltalk.AssignmentNode._new()
  25004. ._left_(variable)
  25005. ._right_(expression)
  25006. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  25007. }
  25008. if (result0 === null) {
  25009. pos = clone(pos0);
  25010. }
  25011. cache[cacheKey] = {
  25012. nextPos: clone(pos),
  25013. result: result0
  25014. };
  25015. return result0;
  25016. }
  25017. function parse_ret() {
  25018. var cacheKey = "ret@" + pos.offset;
  25019. var cachedResult = cache[cacheKey];
  25020. if (cachedResult) {
  25021. pos = clone(cachedResult.nextPos);
  25022. return cachedResult.result;
  25023. }
  25024. var result0, result1, result2, result3, result4;
  25025. var pos0, pos1;
  25026. pos0 = clone(pos);
  25027. pos1 = clone(pos);
  25028. if (input.charCodeAt(pos.offset) === 94) {
  25029. result0 = "^";
  25030. advance(pos, 1);
  25031. } else {
  25032. result0 = null;
  25033. if (reportFailures === 0) {
  25034. matchFailed("\"^\"");
  25035. }
  25036. }
  25037. if (result0 !== null) {
  25038. result1 = parse_ws();
  25039. if (result1 !== null) {
  25040. result2 = parse_expression();
  25041. if (result2 !== null) {
  25042. result3 = parse_ws();
  25043. if (result3 !== null) {
  25044. if (input.charCodeAt(pos.offset) === 46) {
  25045. result4 = ".";
  25046. advance(pos, 1);
  25047. } else {
  25048. result4 = null;
  25049. if (reportFailures === 0) {
  25050. matchFailed("\".\"");
  25051. }
  25052. }
  25053. result4 = result4 !== null ? result4 : "";
  25054. if (result4 !== null) {
  25055. result0 = [result0, result1, result2, result3, result4];
  25056. } else {
  25057. result0 = null;
  25058. pos = clone(pos1);
  25059. }
  25060. } else {
  25061. result0 = null;
  25062. pos = clone(pos1);
  25063. }
  25064. } else {
  25065. result0 = null;
  25066. pos = clone(pos1);
  25067. }
  25068. } else {
  25069. result0 = null;
  25070. pos = clone(pos1);
  25071. }
  25072. } else {
  25073. result0 = null;
  25074. pos = clone(pos1);
  25075. }
  25076. if (result0 !== null) {
  25077. result0 = (function(offset, line, column, expression) {
  25078. return smalltalk.ReturnNode._new()
  25079. ._nodes_([expression])
  25080. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  25081. }
  25082. if (result0 === null) {
  25083. pos = clone(pos0);
  25084. }
  25085. cache[cacheKey] = {
  25086. nextPos: clone(pos),
  25087. result: result0
  25088. };
  25089. return result0;
  25090. }
  25091. function parse_temps() {
  25092. var cacheKey = "temps@" + pos.offset;
  25093. var cachedResult = cache[cacheKey];
  25094. if (cachedResult) {
  25095. pos = clone(cachedResult.nextPos);
  25096. return cachedResult.result;
  25097. }
  25098. var result0, result1, result2, result3, result4;
  25099. var pos0, pos1, pos2, pos3;
  25100. pos0 = clone(pos);
  25101. pos1 = clone(pos);
  25102. if (input.charCodeAt(pos.offset) === 124) {
  25103. result0 = "|";
  25104. advance(pos, 1);
  25105. } else {
  25106. result0 = null;
  25107. if (reportFailures === 0) {
  25108. matchFailed("\"|\"");
  25109. }
  25110. }
  25111. if (result0 !== null) {
  25112. result1 = [];
  25113. pos2 = clone(pos);
  25114. pos3 = clone(pos);
  25115. result2 = parse_ws();
  25116. if (result2 !== null) {
  25117. result3 = parse_identifier();
  25118. if (result3 !== null) {
  25119. result4 = parse_ws();
  25120. if (result4 !== null) {
  25121. result2 = [result2, result3, result4];
  25122. } else {
  25123. result2 = null;
  25124. pos = clone(pos3);
  25125. }
  25126. } else {
  25127. result2 = null;
  25128. pos = clone(pos3);
  25129. }
  25130. } else {
  25131. result2 = null;
  25132. pos = clone(pos3);
  25133. }
  25134. if (result2 !== null) {
  25135. result2 = (function(offset, line, column, variable) {return variable})(pos2.offset, pos2.line, pos2.column, result2[1]);
  25136. }
  25137. if (result2 === null) {
  25138. pos = clone(pos2);
  25139. }
  25140. while (result2 !== null) {
  25141. result1.push(result2);
  25142. pos2 = clone(pos);
  25143. pos3 = clone(pos);
  25144. result2 = parse_ws();
  25145. if (result2 !== null) {
  25146. result3 = parse_identifier();
  25147. if (result3 !== null) {
  25148. result4 = parse_ws();
  25149. if (result4 !== null) {
  25150. result2 = [result2, result3, result4];
  25151. } else {
  25152. result2 = null;
  25153. pos = clone(pos3);
  25154. }
  25155. } else {
  25156. result2 = null;
  25157. pos = clone(pos3);
  25158. }
  25159. } else {
  25160. result2 = null;
  25161. pos = clone(pos3);
  25162. }
  25163. if (result2 !== null) {
  25164. result2 = (function(offset, line, column, variable) {return variable})(pos2.offset, pos2.line, pos2.column, result2[1]);
  25165. }
  25166. if (result2 === null) {
  25167. pos = clone(pos2);
  25168. }
  25169. }
  25170. if (result1 !== null) {
  25171. if (input.charCodeAt(pos.offset) === 124) {
  25172. result2 = "|";
  25173. advance(pos, 1);
  25174. } else {
  25175. result2 = null;
  25176. if (reportFailures === 0) {
  25177. matchFailed("\"|\"");
  25178. }
  25179. }
  25180. if (result2 !== null) {
  25181. result0 = [result0, result1, result2];
  25182. } else {
  25183. result0 = null;
  25184. pos = clone(pos1);
  25185. }
  25186. } else {
  25187. result0 = null;
  25188. pos = clone(pos1);
  25189. }
  25190. } else {
  25191. result0 = null;
  25192. pos = clone(pos1);
  25193. }
  25194. if (result0 !== null) {
  25195. result0 = (function(offset, line, column, vars) {return vars})(pos0.offset, pos0.line, pos0.column, result0[1]);
  25196. }
  25197. if (result0 === null) {
  25198. pos = clone(pos0);
  25199. }
  25200. cache[cacheKey] = {
  25201. nextPos: clone(pos),
  25202. result: result0
  25203. };
  25204. return result0;
  25205. }
  25206. function parse_blockParamList() {
  25207. var cacheKey = "blockParamList@" + pos.offset;
  25208. var cachedResult = cache[cacheKey];
  25209. if (cachedResult) {
  25210. pos = clone(cachedResult.nextPos);
  25211. return cachedResult.result;
  25212. }
  25213. var result0, result1, result2, result3, result4;
  25214. var pos0, pos1, pos2, pos3;
  25215. pos0 = clone(pos);
  25216. pos1 = clone(pos);
  25217. pos2 = clone(pos);
  25218. pos3 = clone(pos);
  25219. result1 = parse_ws();
  25220. if (result1 !== null) {
  25221. if (input.charCodeAt(pos.offset) === 58) {
  25222. result2 = ":";
  25223. advance(pos, 1);
  25224. } else {
  25225. result2 = null;
  25226. if (reportFailures === 0) {
  25227. matchFailed("\":\"");
  25228. }
  25229. }
  25230. if (result2 !== null) {
  25231. result3 = parse_ws();
  25232. if (result3 !== null) {
  25233. result4 = parse_identifier();
  25234. if (result4 !== null) {
  25235. result1 = [result1, result2, result3, result4];
  25236. } else {
  25237. result1 = null;
  25238. pos = clone(pos3);
  25239. }
  25240. } else {
  25241. result1 = null;
  25242. pos = clone(pos3);
  25243. }
  25244. } else {
  25245. result1 = null;
  25246. pos = clone(pos3);
  25247. }
  25248. } else {
  25249. result1 = null;
  25250. pos = clone(pos3);
  25251. }
  25252. if (result1 !== null) {
  25253. result1 = (function(offset, line, column, param) {return param})(pos2.offset, pos2.line, pos2.column, result1[3]);
  25254. }
  25255. if (result1 === null) {
  25256. pos = clone(pos2);
  25257. }
  25258. if (result1 !== null) {
  25259. result0 = [];
  25260. while (result1 !== null) {
  25261. result0.push(result1);
  25262. pos2 = clone(pos);
  25263. pos3 = clone(pos);
  25264. result1 = parse_ws();
  25265. if (result1 !== null) {
  25266. if (input.charCodeAt(pos.offset) === 58) {
  25267. result2 = ":";
  25268. advance(pos, 1);
  25269. } else {
  25270. result2 = null;
  25271. if (reportFailures === 0) {
  25272. matchFailed("\":\"");
  25273. }
  25274. }
  25275. if (result2 !== null) {
  25276. result3 = parse_ws();
  25277. if (result3 !== null) {
  25278. result4 = parse_identifier();
  25279. if (result4 !== null) {
  25280. result1 = [result1, result2, result3, result4];
  25281. } else {
  25282. result1 = null;
  25283. pos = clone(pos3);
  25284. }
  25285. } else {
  25286. result1 = null;
  25287. pos = clone(pos3);
  25288. }
  25289. } else {
  25290. result1 = null;
  25291. pos = clone(pos3);
  25292. }
  25293. } else {
  25294. result1 = null;
  25295. pos = clone(pos3);
  25296. }
  25297. if (result1 !== null) {
  25298. result1 = (function(offset, line, column, param) {return param})(pos2.offset, pos2.line, pos2.column, result1[3]);
  25299. }
  25300. if (result1 === null) {
  25301. pos = clone(pos2);
  25302. }
  25303. }
  25304. } else {
  25305. result0 = null;
  25306. }
  25307. if (result0 !== null) {
  25308. result1 = parse_ws();
  25309. if (result1 !== null) {
  25310. if (input.charCodeAt(pos.offset) === 124) {
  25311. result2 = "|";
  25312. advance(pos, 1);
  25313. } else {
  25314. result2 = null;
  25315. if (reportFailures === 0) {
  25316. matchFailed("\"|\"");
  25317. }
  25318. }
  25319. if (result2 !== null) {
  25320. result0 = [result0, result1, result2];
  25321. } else {
  25322. result0 = null;
  25323. pos = clone(pos1);
  25324. }
  25325. } else {
  25326. result0 = null;
  25327. pos = clone(pos1);
  25328. }
  25329. } else {
  25330. result0 = null;
  25331. pos = clone(pos1);
  25332. }
  25333. if (result0 !== null) {
  25334. result0 = (function(offset, line, column, params) {return params})(pos0.offset, pos0.line, pos0.column, result0[0]);
  25335. }
  25336. if (result0 === null) {
  25337. pos = clone(pos0);
  25338. }
  25339. cache[cacheKey] = {
  25340. nextPos: clone(pos),
  25341. result: result0
  25342. };
  25343. return result0;
  25344. }
  25345. function parse_subexpression() {
  25346. var cacheKey = "subexpression@" + pos.offset;
  25347. var cachedResult = cache[cacheKey];
  25348. if (cachedResult) {
  25349. pos = clone(cachedResult.nextPos);
  25350. return cachedResult.result;
  25351. }
  25352. var result0, result1, result2, result3, result4;
  25353. var pos0, pos1;
  25354. pos0 = clone(pos);
  25355. pos1 = clone(pos);
  25356. if (input.charCodeAt(pos.offset) === 40) {
  25357. result0 = "(";
  25358. advance(pos, 1);
  25359. } else {
  25360. result0 = null;
  25361. if (reportFailures === 0) {
  25362. matchFailed("\"(\"");
  25363. }
  25364. }
  25365. if (result0 !== null) {
  25366. result1 = parse_ws();
  25367. if (result1 !== null) {
  25368. result2 = parse_expression();
  25369. if (result2 !== null) {
  25370. result3 = parse_ws();
  25371. if (result3 !== null) {
  25372. if (input.charCodeAt(pos.offset) === 41) {
  25373. result4 = ")";
  25374. advance(pos, 1);
  25375. } else {
  25376. result4 = null;
  25377. if (reportFailures === 0) {
  25378. matchFailed("\")\"");
  25379. }
  25380. }
  25381. if (result4 !== null) {
  25382. result0 = [result0, result1, result2, result3, result4];
  25383. } else {
  25384. result0 = null;
  25385. pos = clone(pos1);
  25386. }
  25387. } else {
  25388. result0 = null;
  25389. pos = clone(pos1);
  25390. }
  25391. } else {
  25392. result0 = null;
  25393. pos = clone(pos1);
  25394. }
  25395. } else {
  25396. result0 = null;
  25397. pos = clone(pos1);
  25398. }
  25399. } else {
  25400. result0 = null;
  25401. pos = clone(pos1);
  25402. }
  25403. if (result0 !== null) {
  25404. result0 = (function(offset, line, column, expression) {return expression})(pos0.offset, pos0.line, pos0.column, result0[2]);
  25405. }
  25406. if (result0 === null) {
  25407. pos = clone(pos0);
  25408. }
  25409. cache[cacheKey] = {
  25410. nextPos: clone(pos),
  25411. result: result0
  25412. };
  25413. return result0;
  25414. }
  25415. function parse_statements() {
  25416. var cacheKey = "statements@" + pos.offset;
  25417. var cachedResult = cache[cacheKey];
  25418. if (cachedResult) {
  25419. pos = clone(cachedResult.nextPos);
  25420. return cachedResult.result;
  25421. }
  25422. var result0, result1, result2, result3, result4, result5, result6;
  25423. var pos0, pos1;
  25424. pos0 = clone(pos);
  25425. pos1 = clone(pos);
  25426. result0 = parse_ret();
  25427. if (result0 !== null) {
  25428. result1 = [];
  25429. if (/^[.]/.test(input.charAt(pos.offset))) {
  25430. result2 = input.charAt(pos.offset);
  25431. advance(pos, 1);
  25432. } else {
  25433. result2 = null;
  25434. if (reportFailures === 0) {
  25435. matchFailed("[.]");
  25436. }
  25437. }
  25438. while (result2 !== null) {
  25439. result1.push(result2);
  25440. if (/^[.]/.test(input.charAt(pos.offset))) {
  25441. result2 = input.charAt(pos.offset);
  25442. advance(pos, 1);
  25443. } else {
  25444. result2 = null;
  25445. if (reportFailures === 0) {
  25446. matchFailed("[.]");
  25447. }
  25448. }
  25449. }
  25450. if (result1 !== null) {
  25451. result0 = [result0, result1];
  25452. } else {
  25453. result0 = null;
  25454. pos = clone(pos1);
  25455. }
  25456. } else {
  25457. result0 = null;
  25458. pos = clone(pos1);
  25459. }
  25460. if (result0 !== null) {
  25461. result0 = (function(offset, line, column, ret) {return [ret]})(pos0.offset, pos0.line, pos0.column, result0[0]);
  25462. }
  25463. if (result0 === null) {
  25464. pos = clone(pos0);
  25465. }
  25466. if (result0 === null) {
  25467. pos0 = clone(pos);
  25468. pos1 = clone(pos);
  25469. result0 = parse_expressions();
  25470. if (result0 !== null) {
  25471. result1 = parse_ws();
  25472. if (result1 !== null) {
  25473. if (/^[.]/.test(input.charAt(pos.offset))) {
  25474. result3 = input.charAt(pos.offset);
  25475. advance(pos, 1);
  25476. } else {
  25477. result3 = null;
  25478. if (reportFailures === 0) {
  25479. matchFailed("[.]");
  25480. }
  25481. }
  25482. if (result3 !== null) {
  25483. result2 = [];
  25484. while (result3 !== null) {
  25485. result2.push(result3);
  25486. if (/^[.]/.test(input.charAt(pos.offset))) {
  25487. result3 = input.charAt(pos.offset);
  25488. advance(pos, 1);
  25489. } else {
  25490. result3 = null;
  25491. if (reportFailures === 0) {
  25492. matchFailed("[.]");
  25493. }
  25494. }
  25495. }
  25496. } else {
  25497. result2 = null;
  25498. }
  25499. if (result2 !== null) {
  25500. result3 = parse_ws();
  25501. if (result3 !== null) {
  25502. result4 = parse_ret();
  25503. if (result4 !== null) {
  25504. result5 = [];
  25505. if (/^[.]/.test(input.charAt(pos.offset))) {
  25506. result6 = input.charAt(pos.offset);
  25507. advance(pos, 1);
  25508. } else {
  25509. result6 = null;
  25510. if (reportFailures === 0) {
  25511. matchFailed("[.]");
  25512. }
  25513. }
  25514. while (result6 !== null) {
  25515. result5.push(result6);
  25516. if (/^[.]/.test(input.charAt(pos.offset))) {
  25517. result6 = input.charAt(pos.offset);
  25518. advance(pos, 1);
  25519. } else {
  25520. result6 = null;
  25521. if (reportFailures === 0) {
  25522. matchFailed("[.]");
  25523. }
  25524. }
  25525. }
  25526. if (result5 !== null) {
  25527. result0 = [result0, result1, result2, result3, result4, result5];
  25528. } else {
  25529. result0 = null;
  25530. pos = clone(pos1);
  25531. }
  25532. } else {
  25533. result0 = null;
  25534. pos = clone(pos1);
  25535. }
  25536. } else {
  25537. result0 = null;
  25538. pos = clone(pos1);
  25539. }
  25540. } else {
  25541. result0 = null;
  25542. pos = clone(pos1);
  25543. }
  25544. } else {
  25545. result0 = null;
  25546. pos = clone(pos1);
  25547. }
  25548. } else {
  25549. result0 = null;
  25550. pos = clone(pos1);
  25551. }
  25552. if (result0 !== null) {
  25553. result0 = (function(offset, line, column, exps, ret) {
  25554. var expressions = exps;
  25555. expressions.push(ret);
  25556. return expressions
  25557. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  25558. }
  25559. if (result0 === null) {
  25560. pos = clone(pos0);
  25561. }
  25562. if (result0 === null) {
  25563. pos0 = clone(pos);
  25564. pos1 = clone(pos);
  25565. result0 = parse_expressions();
  25566. result0 = result0 !== null ? result0 : "";
  25567. if (result0 !== null) {
  25568. result1 = [];
  25569. if (/^[.]/.test(input.charAt(pos.offset))) {
  25570. result2 = input.charAt(pos.offset);
  25571. advance(pos, 1);
  25572. } else {
  25573. result2 = null;
  25574. if (reportFailures === 0) {
  25575. matchFailed("[.]");
  25576. }
  25577. }
  25578. while (result2 !== null) {
  25579. result1.push(result2);
  25580. if (/^[.]/.test(input.charAt(pos.offset))) {
  25581. result2 = input.charAt(pos.offset);
  25582. advance(pos, 1);
  25583. } else {
  25584. result2 = null;
  25585. if (reportFailures === 0) {
  25586. matchFailed("[.]");
  25587. }
  25588. }
  25589. }
  25590. if (result1 !== null) {
  25591. result0 = [result0, result1];
  25592. } else {
  25593. result0 = null;
  25594. pos = clone(pos1);
  25595. }
  25596. } else {
  25597. result0 = null;
  25598. pos = clone(pos1);
  25599. }
  25600. if (result0 !== null) {
  25601. result0 = (function(offset, line, column, expressions) {
  25602. return expressions || []
  25603. })(pos0.offset, pos0.line, pos0.column, result0[0]);
  25604. }
  25605. if (result0 === null) {
  25606. pos = clone(pos0);
  25607. }
  25608. }
  25609. }
  25610. cache[cacheKey] = {
  25611. nextPos: clone(pos),
  25612. result: result0
  25613. };
  25614. return result0;
  25615. }
  25616. function parse_sequence() {
  25617. var cacheKey = "sequence@" + pos.offset;
  25618. var cachedResult = cache[cacheKey];
  25619. if (cachedResult) {
  25620. pos = clone(cachedResult.nextPos);
  25621. return cachedResult.result;
  25622. }
  25623. var result0, result1, result2, result3;
  25624. var pos0, pos1;
  25625. pos0 = clone(pos);
  25626. pos1 = clone(pos);
  25627. result0 = parse_temps();
  25628. result0 = result0 !== null ? result0 : "";
  25629. if (result0 !== null) {
  25630. result1 = parse_ws();
  25631. if (result1 !== null) {
  25632. result2 = parse_statements();
  25633. result2 = result2 !== null ? result2 : "";
  25634. if (result2 !== null) {
  25635. result3 = parse_ws();
  25636. if (result3 !== null) {
  25637. result0 = [result0, result1, result2, result3];
  25638. } else {
  25639. result0 = null;
  25640. pos = clone(pos1);
  25641. }
  25642. } else {
  25643. result0 = null;
  25644. pos = clone(pos1);
  25645. }
  25646. } else {
  25647. result0 = null;
  25648. pos = clone(pos1);
  25649. }
  25650. } else {
  25651. result0 = null;
  25652. pos = clone(pos1);
  25653. }
  25654. if (result0 !== null) {
  25655. result0 = (function(offset, line, column, temps, statements) {
  25656. return smalltalk.SequenceNode._new()
  25657. ._temps_(temps || [])
  25658. ._nodes_(statements || [])
  25659. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  25660. }
  25661. if (result0 === null) {
  25662. pos = clone(pos0);
  25663. }
  25664. cache[cacheKey] = {
  25665. nextPos: clone(pos),
  25666. result: result0
  25667. };
  25668. return result0;
  25669. }
  25670. function parse_block() {
  25671. var cacheKey = "block@" + pos.offset;
  25672. var cachedResult = cache[cacheKey];
  25673. if (cachedResult) {
  25674. pos = clone(cachedResult.nextPos);
  25675. return cachedResult.result;
  25676. }
  25677. var result0, result1, result2, result3, result4, result5, result6;
  25678. var pos0, pos1;
  25679. pos0 = clone(pos);
  25680. pos1 = clone(pos);
  25681. if (input.charCodeAt(pos.offset) === 91) {
  25682. result0 = "[";
  25683. advance(pos, 1);
  25684. } else {
  25685. result0 = null;
  25686. if (reportFailures === 0) {
  25687. matchFailed("\"[\"");
  25688. }
  25689. }
  25690. if (result0 !== null) {
  25691. result1 = parse_ws();
  25692. if (result1 !== null) {
  25693. result2 = parse_blockParamList();
  25694. result2 = result2 !== null ? result2 : "";
  25695. if (result2 !== null) {
  25696. result3 = parse_ws();
  25697. if (result3 !== null) {
  25698. result4 = parse_sequence();
  25699. result4 = result4 !== null ? result4 : "";
  25700. if (result4 !== null) {
  25701. result5 = parse_ws();
  25702. if (result5 !== null) {
  25703. if (input.charCodeAt(pos.offset) === 93) {
  25704. result6 = "]";
  25705. advance(pos, 1);
  25706. } else {
  25707. result6 = null;
  25708. if (reportFailures === 0) {
  25709. matchFailed("\"]\"");
  25710. }
  25711. }
  25712. if (result6 !== null) {
  25713. result0 = [result0, result1, result2, result3, result4, result5, result6];
  25714. } else {
  25715. result0 = null;
  25716. pos = clone(pos1);
  25717. }
  25718. } else {
  25719. result0 = null;
  25720. pos = clone(pos1);
  25721. }
  25722. } else {
  25723. result0 = null;
  25724. pos = clone(pos1);
  25725. }
  25726. } else {
  25727. result0 = null;
  25728. pos = clone(pos1);
  25729. }
  25730. } else {
  25731. result0 = null;
  25732. pos = clone(pos1);
  25733. }
  25734. } else {
  25735. result0 = null;
  25736. pos = clone(pos1);
  25737. }
  25738. } else {
  25739. result0 = null;
  25740. pos = clone(pos1);
  25741. }
  25742. if (result0 !== null) {
  25743. result0 = (function(offset, line, column, params, sequence) {
  25744. return smalltalk.BlockNode._new()
  25745. ._parameters_(params || [])
  25746. ._nodes_([sequence._asBlockSequenceNode()])
  25747. })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4]);
  25748. }
  25749. if (result0 === null) {
  25750. pos = clone(pos0);
  25751. }
  25752. cache[cacheKey] = {
  25753. nextPos: clone(pos),
  25754. result: result0
  25755. };
  25756. return result0;
  25757. }
  25758. function parse_operand() {
  25759. var cacheKey = "operand@" + pos.offset;
  25760. var cachedResult = cache[cacheKey];
  25761. if (cachedResult) {
  25762. pos = clone(cachedResult.nextPos);
  25763. return cachedResult.result;
  25764. }
  25765. var result0;
  25766. result0 = parse_literal();
  25767. if (result0 === null) {
  25768. result0 = parse_reference();
  25769. if (result0 === null) {
  25770. result0 = parse_subexpression();
  25771. }
  25772. }
  25773. cache[cacheKey] = {
  25774. nextPos: clone(pos),
  25775. result: result0
  25776. };
  25777. return result0;
  25778. }
  25779. function parse_unaryMessage() {
  25780. var cacheKey = "unaryMessage@" + pos.offset;
  25781. var cachedResult = cache[cacheKey];
  25782. if (cachedResult) {
  25783. pos = clone(cachedResult.nextPos);
  25784. return cachedResult.result;
  25785. }
  25786. var result0, result1, result2;
  25787. var pos0, pos1, pos2;
  25788. pos0 = clone(pos);
  25789. pos1 = clone(pos);
  25790. result0 = parse_ws();
  25791. if (result0 !== null) {
  25792. result1 = parse_identifier();
  25793. if (result1 !== null) {
  25794. pos2 = clone(pos);
  25795. reportFailures++;
  25796. if (/^[:]/.test(input.charAt(pos.offset))) {
  25797. result2 = input.charAt(pos.offset);
  25798. advance(pos, 1);
  25799. } else {
  25800. result2 = null;
  25801. if (reportFailures === 0) {
  25802. matchFailed("[:]");
  25803. }
  25804. }
  25805. reportFailures--;
  25806. if (result2 === null) {
  25807. result2 = "";
  25808. } else {
  25809. result2 = null;
  25810. pos = clone(pos2);
  25811. }
  25812. if (result2 !== null) {
  25813. result0 = [result0, result1, result2];
  25814. } else {
  25815. result0 = null;
  25816. pos = clone(pos1);
  25817. }
  25818. } else {
  25819. result0 = null;
  25820. pos = clone(pos1);
  25821. }
  25822. } else {
  25823. result0 = null;
  25824. pos = clone(pos1);
  25825. }
  25826. if (result0 !== null) {
  25827. result0 = (function(offset, line, column, selector) {
  25828. return smalltalk.SendNode._new()
  25829. ._selector_(selector)
  25830. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  25831. }
  25832. if (result0 === null) {
  25833. pos = clone(pos0);
  25834. }
  25835. cache[cacheKey] = {
  25836. nextPos: clone(pos),
  25837. result: result0
  25838. };
  25839. return result0;
  25840. }
  25841. function parse_unaryTail() {
  25842. var cacheKey = "unaryTail@" + pos.offset;
  25843. var cachedResult = cache[cacheKey];
  25844. if (cachedResult) {
  25845. pos = clone(cachedResult.nextPos);
  25846. return cachedResult.result;
  25847. }
  25848. var result0, result1, result2, result3;
  25849. var pos0, pos1;
  25850. pos0 = clone(pos);
  25851. pos1 = clone(pos);
  25852. result0 = parse_unaryMessage();
  25853. if (result0 !== null) {
  25854. result1 = parse_ws();
  25855. if (result1 !== null) {
  25856. result2 = parse_unaryTail();
  25857. result2 = result2 !== null ? result2 : "";
  25858. if (result2 !== null) {
  25859. result3 = parse_ws();
  25860. if (result3 !== null) {
  25861. result0 = [result0, result1, result2, result3];
  25862. } else {
  25863. result0 = null;
  25864. pos = clone(pos1);
  25865. }
  25866. } else {
  25867. result0 = null;
  25868. pos = clone(pos1);
  25869. }
  25870. } else {
  25871. result0 = null;
  25872. pos = clone(pos1);
  25873. }
  25874. } else {
  25875. result0 = null;
  25876. pos = clone(pos1);
  25877. }
  25878. if (result0 !== null) {
  25879. result0 = (function(offset, line, column, message, tail) {
  25880. if(tail) {
  25881. return tail._valueForReceiver_(message);
  25882. }
  25883. else {
  25884. return message;
  25885. }
  25886. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  25887. }
  25888. if (result0 === null) {
  25889. pos = clone(pos0);
  25890. }
  25891. cache[cacheKey] = {
  25892. nextPos: clone(pos),
  25893. result: result0
  25894. };
  25895. return result0;
  25896. }
  25897. function parse_unarySend() {
  25898. var cacheKey = "unarySend@" + pos.offset;
  25899. var cachedResult = cache[cacheKey];
  25900. if (cachedResult) {
  25901. pos = clone(cachedResult.nextPos);
  25902. return cachedResult.result;
  25903. }
  25904. var result0, result1, result2;
  25905. var pos0, pos1;
  25906. pos0 = clone(pos);
  25907. pos1 = clone(pos);
  25908. result0 = parse_operand();
  25909. if (result0 !== null) {
  25910. result1 = parse_ws();
  25911. if (result1 !== null) {
  25912. result2 = parse_unaryTail();
  25913. result2 = result2 !== null ? result2 : "";
  25914. if (result2 !== null) {
  25915. result0 = [result0, result1, result2];
  25916. } else {
  25917. result0 = null;
  25918. pos = clone(pos1);
  25919. }
  25920. } else {
  25921. result0 = null;
  25922. pos = clone(pos1);
  25923. }
  25924. } else {
  25925. result0 = null;
  25926. pos = clone(pos1);
  25927. }
  25928. if (result0 !== null) {
  25929. result0 = (function(offset, line, column, receiver, tail) {
  25930. if(tail) {
  25931. return tail._valueForReceiver_(receiver);
  25932. }
  25933. else {
  25934. return receiver;
  25935. }
  25936. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  25937. }
  25938. if (result0 === null) {
  25939. pos = clone(pos0);
  25940. }
  25941. cache[cacheKey] = {
  25942. nextPos: clone(pos),
  25943. result: result0
  25944. };
  25945. return result0;
  25946. }
  25947. function parse_binaryMessage() {
  25948. var cacheKey = "binaryMessage@" + pos.offset;
  25949. var cachedResult = cache[cacheKey];
  25950. if (cachedResult) {
  25951. pos = clone(cachedResult.nextPos);
  25952. return cachedResult.result;
  25953. }
  25954. var result0, result1, result2, result3;
  25955. var pos0, pos1;
  25956. pos0 = clone(pos);
  25957. pos1 = clone(pos);
  25958. result0 = parse_ws();
  25959. if (result0 !== null) {
  25960. result1 = parse_binarySelector();
  25961. if (result1 !== null) {
  25962. result2 = parse_ws();
  25963. if (result2 !== null) {
  25964. result3 = parse_unarySend();
  25965. if (result3 === null) {
  25966. result3 = parse_operand();
  25967. }
  25968. if (result3 !== null) {
  25969. result0 = [result0, result1, result2, result3];
  25970. } else {
  25971. result0 = null;
  25972. pos = clone(pos1);
  25973. }
  25974. } else {
  25975. result0 = null;
  25976. pos = clone(pos1);
  25977. }
  25978. } else {
  25979. result0 = null;
  25980. pos = clone(pos1);
  25981. }
  25982. } else {
  25983. result0 = null;
  25984. pos = clone(pos1);
  25985. }
  25986. if (result0 !== null) {
  25987. result0 = (function(offset, line, column, selector, arg) {
  25988. return smalltalk.SendNode._new()
  25989. ._selector_(selector)
  25990. ._arguments_([arg])
  25991. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  25992. }
  25993. if (result0 === null) {
  25994. pos = clone(pos0);
  25995. }
  25996. cache[cacheKey] = {
  25997. nextPos: clone(pos),
  25998. result: result0
  25999. };
  26000. return result0;
  26001. }
  26002. function parse_binaryTail() {
  26003. var cacheKey = "binaryTail@" + pos.offset;
  26004. var cachedResult = cache[cacheKey];
  26005. if (cachedResult) {
  26006. pos = clone(cachedResult.nextPos);
  26007. return cachedResult.result;
  26008. }
  26009. var result0, result1;
  26010. var pos0, pos1;
  26011. pos0 = clone(pos);
  26012. pos1 = clone(pos);
  26013. result0 = parse_binaryMessage();
  26014. if (result0 !== null) {
  26015. result1 = parse_binaryTail();
  26016. result1 = result1 !== null ? result1 : "";
  26017. if (result1 !== null) {
  26018. result0 = [result0, result1];
  26019. } else {
  26020. result0 = null;
  26021. pos = clone(pos1);
  26022. }
  26023. } else {
  26024. result0 = null;
  26025. pos = clone(pos1);
  26026. }
  26027. if (result0 !== null) {
  26028. result0 = (function(offset, line, column, message, tail) {
  26029. if(tail) {
  26030. return tail._valueForReceiver_(message);
  26031. }
  26032. else {
  26033. return message;
  26034. }
  26035. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  26036. }
  26037. if (result0 === null) {
  26038. pos = clone(pos0);
  26039. }
  26040. cache[cacheKey] = {
  26041. nextPos: clone(pos),
  26042. result: result0
  26043. };
  26044. return result0;
  26045. }
  26046. function parse_binarySend() {
  26047. var cacheKey = "binarySend@" + pos.offset;
  26048. var cachedResult = cache[cacheKey];
  26049. if (cachedResult) {
  26050. pos = clone(cachedResult.nextPos);
  26051. return cachedResult.result;
  26052. }
  26053. var result0, result1;
  26054. var pos0, pos1;
  26055. pos0 = clone(pos);
  26056. pos1 = clone(pos);
  26057. result0 = parse_unarySend();
  26058. if (result0 !== null) {
  26059. result1 = parse_binaryTail();
  26060. result1 = result1 !== null ? result1 : "";
  26061. if (result1 !== null) {
  26062. result0 = [result0, result1];
  26063. } else {
  26064. result0 = null;
  26065. pos = clone(pos1);
  26066. }
  26067. } else {
  26068. result0 = null;
  26069. pos = clone(pos1);
  26070. }
  26071. if (result0 !== null) {
  26072. result0 = (function(offset, line, column, receiver, tail) {
  26073. if(tail) {
  26074. return tail._valueForReceiver_(receiver);
  26075. }
  26076. else {
  26077. return receiver;
  26078. }
  26079. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  26080. }
  26081. if (result0 === null) {
  26082. pos = clone(pos0);
  26083. }
  26084. cache[cacheKey] = {
  26085. nextPos: clone(pos),
  26086. result: result0
  26087. };
  26088. return result0;
  26089. }
  26090. function parse_keywordMessage() {
  26091. var cacheKey = "keywordMessage@" + pos.offset;
  26092. var cachedResult = cache[cacheKey];
  26093. if (cachedResult) {
  26094. pos = clone(cachedResult.nextPos);
  26095. return cachedResult.result;
  26096. }
  26097. var result0, result1, result2, result3;
  26098. var pos0, pos1, pos2, pos3;
  26099. pos0 = clone(pos);
  26100. pos1 = clone(pos);
  26101. result0 = parse_ws();
  26102. if (result0 !== null) {
  26103. pos2 = clone(pos);
  26104. pos3 = clone(pos);
  26105. result2 = parse_keywordPair();
  26106. if (result2 !== null) {
  26107. result3 = parse_ws();
  26108. if (result3 !== null) {
  26109. result2 = [result2, result3];
  26110. } else {
  26111. result2 = null;
  26112. pos = clone(pos3);
  26113. }
  26114. } else {
  26115. result2 = null;
  26116. pos = clone(pos3);
  26117. }
  26118. if (result2 !== null) {
  26119. result2 = (function(offset, line, column, pair) {return pair})(pos2.offset, pos2.line, pos2.column, result2[0]);
  26120. }
  26121. if (result2 === null) {
  26122. pos = clone(pos2);
  26123. }
  26124. if (result2 !== null) {
  26125. result1 = [];
  26126. while (result2 !== null) {
  26127. result1.push(result2);
  26128. pos2 = clone(pos);
  26129. pos3 = clone(pos);
  26130. result2 = parse_keywordPair();
  26131. if (result2 !== null) {
  26132. result3 = parse_ws();
  26133. if (result3 !== null) {
  26134. result2 = [result2, result3];
  26135. } else {
  26136. result2 = null;
  26137. pos = clone(pos3);
  26138. }
  26139. } else {
  26140. result2 = null;
  26141. pos = clone(pos3);
  26142. }
  26143. if (result2 !== null) {
  26144. result2 = (function(offset, line, column, pair) {return pair})(pos2.offset, pos2.line, pos2.column, result2[0]);
  26145. }
  26146. if (result2 === null) {
  26147. pos = clone(pos2);
  26148. }
  26149. }
  26150. } else {
  26151. result1 = null;
  26152. }
  26153. if (result1 !== null) {
  26154. result0 = [result0, result1];
  26155. } else {
  26156. result0 = null;
  26157. pos = clone(pos1);
  26158. }
  26159. } else {
  26160. result0 = null;
  26161. pos = clone(pos1);
  26162. }
  26163. if (result0 !== null) {
  26164. result0 = (function(offset, line, column, pairs) {
  26165. var selector = [];
  26166. var args = [];
  26167. for(var i=0;i<pairs.length;i++) {
  26168. selector.push(pairs[i].key);
  26169. args.push(pairs[i].arg);
  26170. }
  26171. return smalltalk.SendNode._new()
  26172. ._selector_(selector.join(""))
  26173. ._arguments_(args)
  26174. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  26175. }
  26176. if (result0 === null) {
  26177. pos = clone(pos0);
  26178. }
  26179. cache[cacheKey] = {
  26180. nextPos: clone(pos),
  26181. result: result0
  26182. };
  26183. return result0;
  26184. }
  26185. function parse_keywordSend() {
  26186. var cacheKey = "keywordSend@" + pos.offset;
  26187. var cachedResult = cache[cacheKey];
  26188. if (cachedResult) {
  26189. pos = clone(cachedResult.nextPos);
  26190. return cachedResult.result;
  26191. }
  26192. var result0, result1;
  26193. var pos0, pos1;
  26194. pos0 = clone(pos);
  26195. pos1 = clone(pos);
  26196. result0 = parse_binarySend();
  26197. if (result0 !== null) {
  26198. result1 = parse_keywordMessage();
  26199. if (result1 !== null) {
  26200. result0 = [result0, result1];
  26201. } else {
  26202. result0 = null;
  26203. pos = clone(pos1);
  26204. }
  26205. } else {
  26206. result0 = null;
  26207. pos = clone(pos1);
  26208. }
  26209. if (result0 !== null) {
  26210. result0 = (function(offset, line, column, receiver, tail) {
  26211. return tail._valueForReceiver_(receiver);
  26212. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  26213. }
  26214. if (result0 === null) {
  26215. pos = clone(pos0);
  26216. }
  26217. cache[cacheKey] = {
  26218. nextPos: clone(pos),
  26219. result: result0
  26220. };
  26221. return result0;
  26222. }
  26223. function parse_message() {
  26224. var cacheKey = "message@" + pos.offset;
  26225. var cachedResult = cache[cacheKey];
  26226. if (cachedResult) {
  26227. pos = clone(cachedResult.nextPos);
  26228. return cachedResult.result;
  26229. }
  26230. var result0;
  26231. result0 = parse_binaryMessage();
  26232. if (result0 === null) {
  26233. result0 = parse_unaryMessage();
  26234. if (result0 === null) {
  26235. result0 = parse_keywordMessage();
  26236. }
  26237. }
  26238. cache[cacheKey] = {
  26239. nextPos: clone(pos),
  26240. result: result0
  26241. };
  26242. return result0;
  26243. }
  26244. function parse_cascade() {
  26245. var cacheKey = "cascade@" + pos.offset;
  26246. var cachedResult = cache[cacheKey];
  26247. if (cachedResult) {
  26248. pos = clone(cachedResult.nextPos);
  26249. return cachedResult.result;
  26250. }
  26251. var result0, result1, result2, result3, result4, result5, result6, result7;
  26252. var pos0, pos1, pos2, pos3;
  26253. pos0 = clone(pos);
  26254. pos1 = clone(pos);
  26255. result0 = parse_ws();
  26256. if (result0 !== null) {
  26257. result1 = parse_keywordSend();
  26258. if (result1 === null) {
  26259. result1 = parse_binarySend();
  26260. }
  26261. if (result1 !== null) {
  26262. pos2 = clone(pos);
  26263. pos3 = clone(pos);
  26264. result3 = parse_ws();
  26265. if (result3 !== null) {
  26266. if (input.charCodeAt(pos.offset) === 59) {
  26267. result4 = ";";
  26268. advance(pos, 1);
  26269. } else {
  26270. result4 = null;
  26271. if (reportFailures === 0) {
  26272. matchFailed("\";\"");
  26273. }
  26274. }
  26275. if (result4 !== null) {
  26276. result5 = parse_ws();
  26277. if (result5 !== null) {
  26278. result6 = parse_message();
  26279. if (result6 !== null) {
  26280. result7 = parse_ws();
  26281. if (result7 !== null) {
  26282. result3 = [result3, result4, result5, result6, result7];
  26283. } else {
  26284. result3 = null;
  26285. pos = clone(pos3);
  26286. }
  26287. } else {
  26288. result3 = null;
  26289. pos = clone(pos3);
  26290. }
  26291. } else {
  26292. result3 = null;
  26293. pos = clone(pos3);
  26294. }
  26295. } else {
  26296. result3 = null;
  26297. pos = clone(pos3);
  26298. }
  26299. } else {
  26300. result3 = null;
  26301. pos = clone(pos3);
  26302. }
  26303. if (result3 !== null) {
  26304. result3 = (function(offset, line, column, mess) {return mess})(pos2.offset, pos2.line, pos2.column, result3[3]);
  26305. }
  26306. if (result3 === null) {
  26307. pos = clone(pos2);
  26308. }
  26309. if (result3 !== null) {
  26310. result2 = [];
  26311. while (result3 !== null) {
  26312. result2.push(result3);
  26313. pos2 = clone(pos);
  26314. pos3 = clone(pos);
  26315. result3 = parse_ws();
  26316. if (result3 !== null) {
  26317. if (input.charCodeAt(pos.offset) === 59) {
  26318. result4 = ";";
  26319. advance(pos, 1);
  26320. } else {
  26321. result4 = null;
  26322. if (reportFailures === 0) {
  26323. matchFailed("\";\"");
  26324. }
  26325. }
  26326. if (result4 !== null) {
  26327. result5 = parse_ws();
  26328. if (result5 !== null) {
  26329. result6 = parse_message();
  26330. if (result6 !== null) {
  26331. result7 = parse_ws();
  26332. if (result7 !== null) {
  26333. result3 = [result3, result4, result5, result6, result7];
  26334. } else {
  26335. result3 = null;
  26336. pos = clone(pos3);
  26337. }
  26338. } else {
  26339. result3 = null;
  26340. pos = clone(pos3);
  26341. }
  26342. } else {
  26343. result3 = null;
  26344. pos = clone(pos3);
  26345. }
  26346. } else {
  26347. result3 = null;
  26348. pos = clone(pos3);
  26349. }
  26350. } else {
  26351. result3 = null;
  26352. pos = clone(pos3);
  26353. }
  26354. if (result3 !== null) {
  26355. result3 = (function(offset, line, column, mess) {return mess})(pos2.offset, pos2.line, pos2.column, result3[3]);
  26356. }
  26357. if (result3 === null) {
  26358. pos = clone(pos2);
  26359. }
  26360. }
  26361. } else {
  26362. result2 = null;
  26363. }
  26364. if (result2 !== null) {
  26365. result0 = [result0, result1, result2];
  26366. } else {
  26367. result0 = null;
  26368. pos = clone(pos1);
  26369. }
  26370. } else {
  26371. result0 = null;
  26372. pos = clone(pos1);
  26373. }
  26374. } else {
  26375. result0 = null;
  26376. pos = clone(pos1);
  26377. }
  26378. if (result0 !== null) {
  26379. result0 = (function(offset, line, column, send, messages) {
  26380. var cascade = [];
  26381. cascade.push(send);
  26382. for(var i=0;i<messages.length;i++) {
  26383. cascade.push(messages[i]);
  26384. }
  26385. return smalltalk.CascadeNode._new()
  26386. ._receiver_(send._receiver())
  26387. ._nodes_(cascade)
  26388. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]);
  26389. }
  26390. if (result0 === null) {
  26391. pos = clone(pos0);
  26392. }
  26393. cache[cacheKey] = {
  26394. nextPos: clone(pos),
  26395. result: result0
  26396. };
  26397. return result0;
  26398. }
  26399. function parse_jsStatement() {
  26400. var cacheKey = "jsStatement@" + pos.offset;
  26401. var cachedResult = cache[cacheKey];
  26402. if (cachedResult) {
  26403. pos = clone(cachedResult.nextPos);
  26404. return cachedResult.result;
  26405. }
  26406. var result0, result1, result2;
  26407. var pos0, pos1, pos2;
  26408. pos0 = clone(pos);
  26409. pos1 = clone(pos);
  26410. if (input.charCodeAt(pos.offset) === 60) {
  26411. result0 = "<";
  26412. advance(pos, 1);
  26413. } else {
  26414. result0 = null;
  26415. if (reportFailures === 0) {
  26416. matchFailed("\"<\"");
  26417. }
  26418. }
  26419. if (result0 !== null) {
  26420. result1 = [];
  26421. pos2 = clone(pos);
  26422. if (input.substr(pos.offset, 2) === ">>") {
  26423. result2 = ">>";
  26424. advance(pos, 2);
  26425. } else {
  26426. result2 = null;
  26427. if (reportFailures === 0) {
  26428. matchFailed("\">>\"");
  26429. }
  26430. }
  26431. if (result2 !== null) {
  26432. result2 = (function(offset, line, column) {return ">"})(pos2.offset, pos2.line, pos2.column);
  26433. }
  26434. if (result2 === null) {
  26435. pos = clone(pos2);
  26436. }
  26437. if (result2 === null) {
  26438. if (/^[^>]/.test(input.charAt(pos.offset))) {
  26439. result2 = input.charAt(pos.offset);
  26440. advance(pos, 1);
  26441. } else {
  26442. result2 = null;
  26443. if (reportFailures === 0) {
  26444. matchFailed("[^>]");
  26445. }
  26446. }
  26447. }
  26448. while (result2 !== null) {
  26449. result1.push(result2);
  26450. pos2 = clone(pos);
  26451. if (input.substr(pos.offset, 2) === ">>") {
  26452. result2 = ">>";
  26453. advance(pos, 2);
  26454. } else {
  26455. result2 = null;
  26456. if (reportFailures === 0) {
  26457. matchFailed("\">>\"");
  26458. }
  26459. }
  26460. if (result2 !== null) {
  26461. result2 = (function(offset, line, column) {return ">"})(pos2.offset, pos2.line, pos2.column);
  26462. }
  26463. if (result2 === null) {
  26464. pos = clone(pos2);
  26465. }
  26466. if (result2 === null) {
  26467. if (/^[^>]/.test(input.charAt(pos.offset))) {
  26468. result2 = input.charAt(pos.offset);
  26469. advance(pos, 1);
  26470. } else {
  26471. result2 = null;
  26472. if (reportFailures === 0) {
  26473. matchFailed("[^>]");
  26474. }
  26475. }
  26476. }
  26477. }
  26478. if (result1 !== null) {
  26479. if (input.charCodeAt(pos.offset) === 62) {
  26480. result2 = ">";
  26481. advance(pos, 1);
  26482. } else {
  26483. result2 = null;
  26484. if (reportFailures === 0) {
  26485. matchFailed("\">\"");
  26486. }
  26487. }
  26488. if (result2 !== null) {
  26489. result0 = [result0, result1, result2];
  26490. } else {
  26491. result0 = null;
  26492. pos = clone(pos1);
  26493. }
  26494. } else {
  26495. result0 = null;
  26496. pos = clone(pos1);
  26497. }
  26498. } else {
  26499. result0 = null;
  26500. pos = clone(pos1);
  26501. }
  26502. if (result0 !== null) {
  26503. result0 = (function(offset, line, column, val) {
  26504. return smalltalk.JSStatementNode._new()
  26505. ._source_(val.join(""))
  26506. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  26507. }
  26508. if (result0 === null) {
  26509. pos = clone(pos0);
  26510. }
  26511. cache[cacheKey] = {
  26512. nextPos: clone(pos),
  26513. result: result0
  26514. };
  26515. return result0;
  26516. }
  26517. function parse_method() {
  26518. var cacheKey = "method@" + pos.offset;
  26519. var cachedResult = cache[cacheKey];
  26520. if (cachedResult) {
  26521. pos = clone(cachedResult.nextPos);
  26522. return cachedResult.result;
  26523. }
  26524. var result0, result1, result2, result3, result4;
  26525. var pos0, pos1;
  26526. pos0 = clone(pos);
  26527. pos1 = clone(pos);
  26528. result0 = parse_ws();
  26529. if (result0 !== null) {
  26530. result1 = parse_keywordPattern();
  26531. if (result1 === null) {
  26532. result1 = parse_binaryPattern();
  26533. if (result1 === null) {
  26534. result1 = parse_unaryPattern();
  26535. }
  26536. }
  26537. if (result1 !== null) {
  26538. result2 = parse_ws();
  26539. if (result2 !== null) {
  26540. result3 = parse_sequence();
  26541. result3 = result3 !== null ? result3 : "";
  26542. if (result3 !== null) {
  26543. result4 = parse_ws();
  26544. if (result4 !== null) {
  26545. result0 = [result0, result1, result2, result3, result4];
  26546. } else {
  26547. result0 = null;
  26548. pos = clone(pos1);
  26549. }
  26550. } else {
  26551. result0 = null;
  26552. pos = clone(pos1);
  26553. }
  26554. } else {
  26555. result0 = null;
  26556. pos = clone(pos1);
  26557. }
  26558. } else {
  26559. result0 = null;
  26560. pos = clone(pos1);
  26561. }
  26562. } else {
  26563. result0 = null;
  26564. pos = clone(pos1);
  26565. }
  26566. if (result0 !== null) {
  26567. result0 = (function(offset, line, column, pattern, sequence) {
  26568. return smalltalk.MethodNode._new()
  26569. ._selector_(pattern[0])
  26570. ._arguments_(pattern[1])
  26571. ._nodes_([sequence])
  26572. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  26573. }
  26574. if (result0 === null) {
  26575. pos = clone(pos0);
  26576. }
  26577. cache[cacheKey] = {
  26578. nextPos: clone(pos),
  26579. result: result0
  26580. };
  26581. return result0;
  26582. }
  26583. function cleanupExpected(expected) {
  26584. expected.sort();
  26585. var lastExpected = null;
  26586. var cleanExpected = [];
  26587. for (var i = 0; i < expected.length; i++) {
  26588. if (expected[i] !== lastExpected) {
  26589. cleanExpected.push(expected[i]);
  26590. lastExpected = expected[i];
  26591. }
  26592. }
  26593. return cleanExpected;
  26594. }
  26595. var result = parseFunctions[startRule]();
  26596. /*
  26597. * The parser is now in one of the following three states:
  26598. *
  26599. * 1. The parser successfully parsed the whole input.
  26600. *
  26601. * - |result !== null|
  26602. * - |pos.offset === input.length|
  26603. * - |rightmostFailuresExpected| may or may not contain something
  26604. *
  26605. * 2. The parser successfully parsed only a part of the input.
  26606. *
  26607. * - |result !== null|
  26608. * - |pos.offset < input.length|
  26609. * - |rightmostFailuresExpected| may or may not contain something
  26610. *
  26611. * 3. The parser did not successfully parse any part of the input.
  26612. *
  26613. * - |result === null|
  26614. * - |pos.offset === 0|
  26615. * - |rightmostFailuresExpected| contains at least one failure
  26616. *
  26617. * All code following this comment (including called functions) must
  26618. * handle these states.
  26619. */
  26620. if (result === null || pos.offset !== input.length) {
  26621. var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
  26622. var found = offset < input.length ? input.charAt(offset) : null;
  26623. var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
  26624. throw new this.SyntaxError(
  26625. cleanupExpected(rightmostFailuresExpected),
  26626. found,
  26627. offset,
  26628. errorPosition.line,
  26629. errorPosition.column
  26630. );
  26631. }
  26632. return result;
  26633. },
  26634. /* Returns the parser source code. */
  26635. toSource: function() { return this._source; }
  26636. };
  26637. /* Thrown when a parser encounters a syntax error. */
  26638. result.SyntaxError = function(expected, found, offset, line, column) {
  26639. function buildMessage(expected, found) {
  26640. var expectedHumanized, foundHumanized;
  26641. switch (expected.length) {
  26642. case 0:
  26643. expectedHumanized = "end of input";
  26644. break;
  26645. case 1:
  26646. expectedHumanized = expected[0];
  26647. break;
  26648. default:
  26649. expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
  26650. + " or "
  26651. + expected[expected.length - 1];
  26652. }
  26653. foundHumanized = found ? quote(found) : "end of input";
  26654. return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
  26655. }
  26656. this.name = "SyntaxError";
  26657. this.expected = expected;
  26658. this.found = found;
  26659. this.message = buildMessage(expected, found);
  26660. this.offset = offset;
  26661. this.line = line;
  26662. this.column = column;
  26663. };
  26664. result.SyntaxError.prototype = Error.prototype;
  26665. return result;
  26666. })();
  26667. smalltalk.addPackage('REPL', {});
  26668. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'REPL');
  26669. smalltalk.addMethod(
  26670. "_close",
  26671. smalltalk.method({
  26672. selector: "close",
  26673. category: 'actions',
  26674. fn: function (){
  26675. var self=this;
  26676. smalltalk.send(smalltalk.send(process,"_stdin",[]),"_destroy",[]);
  26677. return self},
  26678. args: [],
  26679. source: "close\x0a\x09process stdin destroy",
  26680. messageSends: ["destroy", "stdin"],
  26681. referencedClasses: []
  26682. }),
  26683. smalltalk.Repl);
  26684. smalltalk.addMethod(
  26685. "_createInterface",
  26686. smalltalk.method({
  26687. selector: "createInterface",
  26688. category: 'actions',
  26689. fn: function (){
  26690. var self=this;
  26691. self["@interface"]=smalltalk.send(self["@readline"],"_createInterface_stdout_",[smalltalk.send(process,"_stdin",[]),smalltalk.send(process,"_stdout",[])]);
  26692. smalltalk.send(self["@interface"],"_on_do_",["line",(function(buffer){
  26693. return smalltalk.send(self,"_eval_",[buffer]);
  26694. })]);
  26695. smalltalk.send(self["@interface"],"_on_do_",["close",(function(){
  26696. return smalltalk.send(self,"_close",[]);
  26697. })]);
  26698. smalltalk.send(self,"_setPrompt",[]);
  26699. smalltalk.send(self["@interface"],"_prompt",[]);
  26700. return self},
  26701. args: [],
  26702. 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",
  26703. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"],
  26704. referencedClasses: []
  26705. }),
  26706. smalltalk.Repl);
  26707. smalltalk.addMethod(
  26708. "_eval_",
  26709. smalltalk.method({
  26710. selector: "eval:",
  26711. category: 'actions',
  26712. fn: function (buffer){
  26713. var self=this;
  26714. var $1,$2;
  26715. var result;
  26716. $1=smalltalk.send(buffer,"_isEmpty",[]);
  26717. if(! smalltalk.assert($1)){
  26718. smalltalk.send(self,"_try_catch_",[(function(){
  26719. result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_evaluateExpression_",[buffer]);
  26720. result;
  26721. return smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[result]);
  26722. }),(function(e){
  26723. $2=smalltalk.send(e,"_isSmalltalkError",[]);
  26724. if(smalltalk.assert($2)){
  26725. return smalltalk.send(smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_new",[]),"_handleError_",[e]);
  26726. } else {
  26727. return smalltalk.send(smalltalk.send(process,"_stdout",[]),"_write_",[smalltalk.send(e,"_jsStack",[])]);
  26728. };
  26729. })]);
  26730. };
  26731. smalltalk.send(self["@interface"],"_prompt",[]);
  26732. return self},
  26733. args: ["buffer"],
  26734. 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",
  26735. messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"],
  26736. referencedClasses: ["Compiler", "Transcript", "ErrorHandler"]
  26737. }),
  26738. smalltalk.Repl);
  26739. smalltalk.addMethod(
  26740. "_initialize",
  26741. smalltalk.method({
  26742. selector: "initialize",
  26743. category: 'initialization',
  26744. fn: function (){
  26745. var self=this;
  26746. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  26747. self["@readline"]=smalltalk.send(require,"_value_",["readline"]);
  26748. self["@util"]=smalltalk.send(require,"_value_",["util"]);
  26749. return self},
  26750. args: [],
  26751. source: "initialize\x0a\x09super initialize.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'",
  26752. messageSends: ["initialize", "value:"],
  26753. referencedClasses: []
  26754. }),
  26755. smalltalk.Repl);
  26756. smalltalk.addMethod(
  26757. "_prompt",
  26758. smalltalk.method({
  26759. selector: "prompt",
  26760. category: 'accessing',
  26761. fn: function (){
  26762. var self=this;
  26763. return "amber >> ";
  26764. },
  26765. args: [],
  26766. source: "prompt\x0a\x09^'amber >> '",
  26767. messageSends: [],
  26768. referencedClasses: []
  26769. }),
  26770. smalltalk.Repl);
  26771. smalltalk.addMethod(
  26772. "_setPrompt",
  26773. smalltalk.method({
  26774. selector: "setPrompt",
  26775. category: 'actions',
  26776. fn: function (){
  26777. var self=this;
  26778. smalltalk.send(self["@interface"],"_setPrompt_",[smalltalk.send(self,"_prompt",[])]);
  26779. return self},
  26780. args: [],
  26781. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  26782. messageSends: ["setPrompt:", "prompt"],
  26783. referencedClasses: []
  26784. }),
  26785. smalltalk.Repl);
  26786. smalltalk.addMethod(
  26787. "_main",
  26788. smalltalk.method({
  26789. selector: "main",
  26790. category: 'not yet classified',
  26791. fn: function (){
  26792. var self=this;
  26793. smalltalk.send(smalltalk.send(self,"_new",[]),"_createInterface",[]);
  26794. return self},
  26795. args: [],
  26796. source: "main\x0a\x09self new createInterface",
  26797. messageSends: ["createInterface", "new"],
  26798. referencedClasses: []
  26799. }),
  26800. smalltalk.Repl.klass);
  26801. smalltalk.init(smalltalk.Object); //metaclasses are in through Class
  26802. smalltalk.classes()._do_(function(each) {
  26803. each._initialize()});
  26804. /* Similar to jQuery(document).ready() */
  26805. if(this.smalltalkReady) {
  26806. this.smalltalkReady();
  26807. }
  26808. smalltalk.Repl._main()