amber.js 821 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726
  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. st.reservedWords = ['break', 'case', 'catch', 'char', 'class', 'continue', 'debugger',
  85. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  86. 'if', 'in', 'instanceof', 'new', 'private', 'protected',
  87. 'public', 'return', 'static', 'switch', 'this', 'throw',
  88. 'try', 'typeof', 'var', 'void', 'while', 'with', 'yield'];
  89. /* The symbol table ensures symbol unicity */
  90. symbolTable = {};
  91. st.symbolFor = function(string) {
  92. if(symbolTable[string] === undefined) {
  93. symbolTable[string] = new SmalltalkSymbol(string);
  94. };
  95. return symbolTable[string];
  96. };
  97. /* Unique ID number generator */
  98. oid = 0;
  99. st.nextId = function() {
  100. oid += 1;
  101. return oid;
  102. };
  103. /* We hold all Packages in a separate Object */
  104. st.packages = {};
  105. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  106. function pkg(spec) {
  107. var that = new SmalltalkPackage();
  108. that.pkgName = spec.pkgName;
  109. that.organization = new SmalltalkOrganizer();
  110. that.properties = spec.properties || {};
  111. return that;
  112. };
  113. /* Smalltalk class creation. A class is an instance of an automatically
  114. created metaclass object. Newly created classes (not their metaclass)
  115. should be added to the smalltalk object, see smalltalk.addClass().
  116. Superclass linking is *not* handled here, see smalltalk.init() */
  117. function klass(spec) {
  118. var spec = spec || {};
  119. var meta = metaclass();
  120. var that = setupClass(meta.instanceClass, spec);
  121. that.className = spec.className;
  122. meta.className = spec.className + ' class';
  123. if(spec.superclass) {
  124. that.superclass = spec.superclass;
  125. meta.superclass = spec.superclass.klass;
  126. }
  127. return that;
  128. }
  129. function metaclass() {
  130. var meta = setupClass(new SmalltalkMetaclass(), {})
  131. meta.instanceClass = new meta.fn;
  132. return meta;
  133. }
  134. function setupClass(that, spec) {
  135. that.fn = spec.fn || function(){};
  136. that.iVarNames = spec.iVarNames || [];
  137. Object.defineProperty(that, "toString", {
  138. value: function() { return 'Smalltalk ' + this.className; },
  139. configurable: true // no writable - in par with ES6 methods
  140. });
  141. that.organization = new SmalltalkOrganizer();
  142. that.pkg = spec.pkg;
  143. Object.defineProperties(that.fn.prototype, {
  144. methods: { value: {}, enumerable: false, configurable: true, writable: true },
  145. inheritedMethods: { value: {}, enumerable: false, configurable: true, writable: true },
  146. klass: { value: that, enumerable: false, configurable: true, writable: true }
  147. });
  148. return that;
  149. };
  150. /* Smalltalk method object. To add a method to a class,
  151. use smalltalk.addMethod() */
  152. st.method = function(spec) {
  153. var that = new SmalltalkMethod();
  154. that.selector = spec.selector;
  155. that.jsSelector = spec.jsSelector;
  156. that.args = spec.args || {};
  157. that.category = spec.category;
  158. that.source = spec.source;
  159. that.messageSends = spec.messageSends || [];
  160. that.referencedClasses = spec.referencedClasses || [];
  161. that.fn = spec.fn;
  162. return that;
  163. };
  164. /* Initialize a class in its class hierarchy. Handle both class and
  165. metaclasses. */
  166. st.init = function(klass) {
  167. st.initClass(klass);
  168. if(klass.klass && !klass.meta) {
  169. st.initClass(klass.klass);
  170. }
  171. };
  172. st.initClass = function(klass) {
  173. var subclasses = st.subclasses(klass);
  174. var methods, prototype = klass.fn.prototype;
  175. if(klass.superclass && klass.superclass !== nil) {
  176. methods = st.methods(klass.superclass);
  177. //Methods linking
  178. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  179. var key = keys[i];
  180. if(!prototype.methods[key]) {
  181. prototype.inheritedMethods[key] = methods[key];
  182. Object.defineProperty(prototype, methods[key].jsSelector, {
  183. value: methods[key].fn, configurable: true, writable: true
  184. });
  185. }
  186. }
  187. }
  188. for(var i=0; i<subclasses.length; i++) {
  189. st.initClass(subclasses[i]);
  190. }
  191. };
  192. /* Answer all registered Packages as Array */
  193. st.packages.all = function() {
  194. var packages = [];
  195. for(var i in st.packages) {
  196. if (!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  197. packages.push(st.packages[i]);
  198. }
  199. return packages
  200. };
  201. /* Answer all registered Smalltalk classes */
  202. st.classes = function() {
  203. var classes = [], names = Object.keys(st), l = names.length;
  204. for (var i=0; i<l; i++) {
  205. var name = names[i];
  206. if (name.search(/^[A-Z]/) !== -1) {
  207. classes.push(st[name]);
  208. }
  209. }
  210. return classes;
  211. };
  212. /* Answer all methods (included inherited ones) of klass. */
  213. st.methods = function(klass) {
  214. var methods = {};
  215. inheritedMethods = klass.fn.prototype.inheritedMethods;
  216. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  217. methods[keys[i]] = inheritedMethods[keys[i]];
  218. }
  219. var inheritedMethods = klass.fn.prototype.methods;
  220. for(var i=0, keys=Object.keys(inheritedMethods); i<keys.length; i++) {
  221. methods[keys[i]] = inheritedMethods[keys[i]];
  222. }
  223. return methods;
  224. };
  225. /* Answer the direct subclasses of klass. */
  226. st.subclasses = function(klass) {
  227. var subclasses = [];
  228. var classes = st.classes();
  229. for(var i=0; i < classes.length; i++) {
  230. var c = classes[i];
  231. if(c.fn) {
  232. //Classes
  233. if(c.superclass === klass) {
  234. subclasses.push(c);
  235. }
  236. c = c.klass;
  237. //Metaclasses
  238. if(c && c.superclass === klass) {
  239. subclasses.push(c);
  240. }
  241. }
  242. }
  243. return subclasses;
  244. };
  245. /* Create a new class wrapping a JavaScript constructor, and add it to the
  246. global smalltalk object. Package is lazily created if it does not exist with given name. */
  247. st.wrapClassName = function(className, pkgName, fn, superclass) {
  248. var pkg = st.addPackage(pkgName);
  249. st[className] = klass({
  250. className: className,
  251. superclass: superclass,
  252. pkg: pkg,
  253. fn: fn
  254. });
  255. };
  256. /* Create an alias for an existing class */
  257. st.alias = function(klass, alias) {
  258. st[alias] = klass;
  259. }
  260. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  261. If pkgName is null or empty we return nil, which is an allowed package for a class.
  262. If package already exists we still update the properties of it. */
  263. st.addPackage = function(pkgName, properties) {
  264. if(!pkgName) {return nil;}
  265. if(!(st.packages[pkgName])) {
  266. st.packages[pkgName] = pkg({
  267. pkgName: pkgName,
  268. properties: properties
  269. });
  270. } else {
  271. if(properties) {
  272. st.packages[pkgName].properties = properties;
  273. }
  274. }
  275. return st.packages[pkgName];
  276. };
  277. /* Add a class to the smalltalk object, creating a new one if needed.
  278. A Package is lazily created if it does not exist with given name. */
  279. st.addClass = function(className, superclass, iVarNames, pkgName) {
  280. var pkg = st.addPackage(pkgName);
  281. if(st[className]) {
  282. st[className].superclass = superclass;
  283. st[className].iVarNames = iVarNames;
  284. st[className].pkg = pkg || st[className].pkg;
  285. } else {
  286. st[className] = klass({
  287. className: className,
  288. superclass: superclass,
  289. pkg: pkg,
  290. iVarNames: iVarNames
  291. });
  292. }
  293. pkg.organization.addElement(st[className]);
  294. };
  295. st.removeClass = function(klass) {
  296. klass.pkg.organization.removeElement(klass);
  297. delete st[klass.className];
  298. };
  299. /* Add/remove a method to/from a class */
  300. st.addMethod = function(jsSelector, method, klass) {
  301. Object.defineProperty(klass.fn.prototype, jsSelector, {
  302. value: method.fn, configurable: true, writable: true
  303. });
  304. klass.fn.prototype.methods[method.selector] = method;
  305. method.methodClass = klass;
  306. method.jsSelector = jsSelector;
  307. klass.organization.addElement(method.category);
  308. };
  309. st.removeMethod = function(method) {
  310. var protocol = method.category;
  311. var klass = method.methodClass;
  312. var methods = klass.fn.prototype.methods;
  313. delete klass.fn.prototype[method.selector._asSelector()];
  314. delete methods[method.selector];
  315. var selectors = Object.keys(methods);
  316. var shouldDeleteProtocol = true;
  317. for(var i= 0, l = selectors.length; i<l; i++) {
  318. if(methods[selectors[i]].category === protocol) {
  319. shouldDeleteProtocol = false;
  320. break;
  321. };
  322. };
  323. if(shouldDeleteProtocol) {
  324. klass.organization.removeElement(protocol)
  325. };
  326. };
  327. /* Handles unhandled errors during message sends */
  328. st.send = function(receiver, selector, args, klass) {
  329. if(st.thisContext) {
  330. return withContextSend(receiver, selector, args, klass);
  331. } else {
  332. try {return withContextSend(receiver, selector, args, klass)}
  333. catch(error) {
  334. // Reset the context stack in any case
  335. st.thisContext = undefined;
  336. if(error.smalltalkError) {
  337. handleError(error);
  338. } else {
  339. throw(error);
  340. }
  341. }
  342. }
  343. };
  344. function withContextSend(receiver, selector, args, klass) {
  345. var call, method;
  346. if(receiver == null) {
  347. receiver = nil;
  348. }
  349. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  350. if(method) {
  351. var context = pushContext(receiver, selector, method, args);
  352. call = method.apply(receiver, args);
  353. popContext(context);
  354. return call;
  355. } else {
  356. return messageNotUnderstood(receiver, selector, args);
  357. }
  358. };
  359. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  360. (See the Smalltalk class ErrorHandler and its subclasses */
  361. function handleError(error) {
  362. if(!error.cc) {
  363. smalltalk.ErrorHandler._current()._handleError_(error);
  364. }
  365. };
  366. /* Handles #dnu: *and* JavaScript method calls.
  367. if the receiver has no klass, we consider it a JS object (outside of the
  368. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  369. function messageNotUnderstood(receiver, selector, args) {
  370. /* Handles JS method calls. */
  371. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  372. return callJavaScriptMethod(receiver, selector, args);
  373. }
  374. /* Handles not understood messages. Also see the Amber counter-part
  375. Object>>doesNotUnderstand: */
  376. return receiver._doesNotUnderstand_(
  377. st.Message._new()
  378. ._selector_(st.convertSelector(selector))
  379. ._arguments_(args)
  380. );
  381. };
  382. /* Call a method of a JS object, or answer a property if it exists.
  383. Else try wrapping a JSObjectProxy around the receiver.
  384. If the object property is a function, then call it, except if it starts with
  385. an uppercase character (we probably want to answer the function itself in this
  386. case and send it #new from Amber).
  387. Converts keyword-based selectors by using the first
  388. keyword only, but keeping all message arguments.
  389. Example:
  390. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  391. function callJavaScriptMethod(receiver, selector, args) {
  392. var jsSelector = selector._asJavaScriptSelector();
  393. var jsProperty = receiver[jsSelector];
  394. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  395. return jsProperty.apply(receiver, args);
  396. } else if(jsProperty !== undefined) {
  397. if(args[0]) {
  398. receiver[jsSelector] = args[0];
  399. return nil;
  400. } else {
  401. return jsProperty;
  402. }
  403. }
  404. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  405. };
  406. /* Reuse one old context stored in oldContext */
  407. st.oldContext = null;
  408. /* Handle thisContext pseudo variable */
  409. st.getThisContext = function() {
  410. if(st.thisContext) {
  411. return st.thisContext.copy();
  412. }
  413. };
  414. function pushContext(receiver, selector, method, temps) {
  415. var c = st.oldContext, tc = st.thisContext;
  416. if (!c) {
  417. return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, tc);
  418. }
  419. st.oldContext = null;
  420. c.homeContext = tc;
  421. c.pc = 1;
  422. c.receiver = receiver;
  423. c.selector = selector;
  424. c.method = method;
  425. c.temps = temps || {};
  426. return st.thisContext = c;
  427. };
  428. function popContext(context) {
  429. st.thisContext = context.homeContext;
  430. context.homeContext = undefined;
  431. st.oldContext = context;
  432. };
  433. /* Convert a string to a valid smalltalk selector.
  434. if you modify the following functions, also change String>>asSelector
  435. accordingly */
  436. st.convertSelector = function(selector) {
  437. if(selector.match(/__/)) {
  438. return convertBinarySelector(selector);
  439. } else {
  440. return convertKeywordSelector(selector);
  441. }
  442. };
  443. function convertKeywordSelector(selector) {
  444. return selector.replace(/^_/, '').replace(/_/g, ':');
  445. };
  446. function convertBinarySelector(selector) {
  447. return selector
  448. .replace(/^_/, '')
  449. .replace(/_plus/, '+')
  450. .replace(/_minus/, '-')
  451. .replace(/_star/, '*')
  452. .replace(/_slash/, '/')
  453. .replace(/_gt/, '>')
  454. .replace(/_lt/, '<')
  455. .replace(/_eq/, '=')
  456. .replace(/_comma/, ',')
  457. .replace(/_at/, '@')
  458. };
  459. /* Converts a JavaScript object to valid Smalltalk Object */
  460. st.readJSObject = function(js) {
  461. var object = js;
  462. var readObject = (js.constructor === Object);
  463. var readArray = (js.constructor === Array);
  464. if(readObject) {
  465. object = smalltalk.Dictionary._new();
  466. }
  467. for(var i in js) {
  468. if(readObject) {
  469. object._at_put_(i, st.readJSObject(js[i]));
  470. }
  471. if(readArray) {
  472. object[i] = st.readJSObject(js[i]);
  473. }
  474. }
  475. return object;
  476. };
  477. /* Boolean assertion */
  478. st.assert = function(shouldBeBoolean) {
  479. if ((undefined !== shouldBeBoolean) && (shouldBeBoolean.klass === smalltalk.Boolean)) {
  480. return shouldBeBoolean;
  481. } else {
  482. smalltalk.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  483. }
  484. }
  485. };
  486. function SmalltalkMethodContext(receiver, selector, method, temps, home) {
  487. this.receiver = receiver;
  488. this.selector = selector;
  489. this.method = method;
  490. this.temps = temps || {};
  491. this.homeContext = home;
  492. };
  493. SmalltalkMethodContext.prototype.copy = function() {
  494. var home = this.homeContext;
  495. if(home) {home = home.copy()}
  496. return new SmalltalkMethodContext(
  497. this.receiver,
  498. this.selector,
  499. this.method,
  500. this.temps,
  501. home
  502. );
  503. };
  504. SmalltalkMethodContext.prototype.resume = function() {
  505. //Brutally set the receiver as thisContext, then re-enter the function
  506. smalltalk.thisContext = this;
  507. return this.method.apply(receiver, temps);
  508. };
  509. /* Global Smalltalk objects. */
  510. var nil = new SmalltalkNil();
  511. var smalltalk = new Smalltalk();
  512. if(this.jQuery) {
  513. this.jQuery.allowJavaScriptCalls = true;
  514. }
  515. /****************************************************************************************/
  516. /* Base classes wrapping. If you edit this part, do not forget to set the superclass of the
  517. object metaclass to Class after the definition of Object */
  518. smalltalk.wrapClassName("Object", "Kernel", SmalltalkObject);
  519. smalltalk.wrapClassName("Smalltalk", "Kernel", Smalltalk, smalltalk.Object);
  520. smalltalk.wrapClassName("Package", "Kernel", SmalltalkPackage, smalltalk.Object);
  521. smalltalk.wrapClassName("Behavior", "Kernel", SmalltalkBehavior, smalltalk.Object);
  522. smalltalk.wrapClassName("Class", "Kernel", SmalltalkClass, smalltalk.Behavior);
  523. smalltalk.wrapClassName("Metaclass", "Kernel", SmalltalkMetaclass, smalltalk.Behavior);
  524. smalltalk.wrapClassName("CompiledMethod", "Kernel", SmalltalkMethod, smalltalk.Object);
  525. smalltalk.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, smalltalk.Object);
  526. smalltalk.Object.klass.superclass = smalltalk.Class;
  527. smalltalk.wrapClassName("Number", "Kernel", Number, smalltalk.Object);
  528. smalltalk.wrapClassName("BlockClosure", "Kernel", Function, smalltalk.Object);
  529. smalltalk.wrapClassName("Boolean", "Kernel", Boolean, smalltalk.Object);
  530. smalltalk.wrapClassName("Date", "Kernel", Date, smalltalk.Object);
  531. smalltalk.wrapClassName("UndefinedObject", "Kernel", SmalltalkNil, smalltalk.Object);
  532. smalltalk.wrapClassName("Collection", "Kernel", null, smalltalk.Object);
  533. smalltalk.wrapClassName("SequenceableCollection", "Kernel", null, smalltalk.Collection);
  534. smalltalk.wrapClassName("CharacterArray", "Kernel", null, smalltalk.SequenceableCollection);
  535. smalltalk.wrapClassName("String", "Kernel", String, smalltalk.CharacterArray);
  536. smalltalk.wrapClassName("Symbol", "Kernel", SmalltalkSymbol, smalltalk.CharacterArray);
  537. smalltalk.wrapClassName("Array", "Kernel", Array, smalltalk.SequenceableCollection);
  538. smalltalk.wrapClassName("RegularExpression", "Kernel", RegExp, smalltalk.String);
  539. smalltalk.wrapClassName("Error", "Kernel", Error, smalltalk.Object);
  540. smalltalk.wrapClassName("MethodContext", "Kernel", SmalltalkMethodContext, smalltalk.Object);
  541. /* Alias definitions */
  542. smalltalk.alias(smalltalk.Array, "OrderedCollection");
  543. smalltalk.alias(smalltalk.Date, "Time");
  544. smalltalk.addPackage('Kernel-Objects', {});
  545. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  546. 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."
  547. smalltalk.addMethod(
  548. "__minus_gt",
  549. smalltalk.method({
  550. selector: "->",
  551. category: 'converting',
  552. fn: function (anObject) {
  553. var self = this;
  554. var $1;
  555. $1 = smalltalk.send(smalltalk.Association || Association, "_key_value_", [self, anObject]);
  556. return $1;
  557. },
  558. args: ["anObject"],
  559. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  560. messageSends: ["key:value:"],
  561. referencedClasses: ["Association"]
  562. }),
  563. smalltalk.Object);
  564. smalltalk.addMethod(
  565. "__eq",
  566. smalltalk.method({
  567. selector: "=",
  568. category: 'comparing',
  569. fn: function (anObject) {
  570. var self = this;
  571. var $1;
  572. $1 = smalltalk.send(self, "__eq_eq", [anObject]);
  573. return $1;
  574. },
  575. args: ["anObject"],
  576. source: "= anObject\x0a\x09^self == anObject",
  577. messageSends: ["=="],
  578. referencedClasses: []
  579. }),
  580. smalltalk.Object);
  581. smalltalk.addMethod(
  582. "__eq_eq",
  583. smalltalk.method({
  584. selector: "==",
  585. category: 'comparing',
  586. fn: function (anObject) {
  587. var self = this;
  588. var $1;
  589. $1 = smalltalk.send(smalltalk.send(self, "_identityHash", []), "__eq", [smalltalk.send(anObject, "_identityHash", [])]);
  590. return $1;
  591. },
  592. args: ["anObject"],
  593. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  594. messageSends: ["=", "identityHash"],
  595. referencedClasses: []
  596. }),
  597. smalltalk.Object);
  598. smalltalk.addMethod(
  599. "_asJSON",
  600. smalltalk.method({
  601. selector: "asJSON",
  602. category: 'converting',
  603. fn: function () {
  604. var self = this;
  605. var variables;
  606. variables = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  607. 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", [])]);}]);
  608. return variables;
  609. },
  610. args: [],
  611. 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",
  612. messageSends: ["new", "do:", "at:put:", "asJSON", "instVarAt:", "allInstanceVariableNames", "class"],
  613. referencedClasses: ["HashedCollection"]
  614. }),
  615. smalltalk.Object);
  616. smalltalk.addMethod(
  617. "_asJSONString",
  618. smalltalk.method({
  619. selector: "asJSONString",
  620. category: 'converting',
  621. fn: function () {
  622. var self = this;
  623. var $1;
  624. $1 = smalltalk.send(smalltalk.JSON || JSON, "_stringify_", [smalltalk.send(self, "_asJSON", [])]);
  625. return $1;
  626. },
  627. args: [],
  628. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  629. messageSends: ["stringify:", "asJSON"],
  630. referencedClasses: ["JSON"]
  631. }),
  632. smalltalk.Object);
  633. smalltalk.addMethod(
  634. "_asJavascript",
  635. smalltalk.method({
  636. selector: "asJavascript",
  637. category: 'converting',
  638. fn: function () {
  639. var self = this;
  640. var $1;
  641. $1 = smalltalk.send(self, "_asString", []);
  642. return $1;
  643. },
  644. args: [],
  645. source: "asJavascript\x0a\x09^self asString",
  646. messageSends: ["asString"],
  647. referencedClasses: []
  648. }),
  649. smalltalk.Object);
  650. smalltalk.addMethod(
  651. "_asString",
  652. smalltalk.method({
  653. selector: "asString",
  654. category: 'converting',
  655. fn: function () {
  656. var self = this;
  657. var $1;
  658. $1 = smalltalk.send(self, "_printString", []);
  659. return $1;
  660. },
  661. args: [],
  662. source: "asString\x0a\x09^self printString",
  663. messageSends: ["printString"],
  664. referencedClasses: []
  665. }),
  666. smalltalk.Object);
  667. smalltalk.addMethod(
  668. "_basicAt_",
  669. smalltalk.method({
  670. selector: "basicAt:",
  671. category: 'accessing',
  672. fn: function (aString) {
  673. var self = this;
  674. return self[aString];
  675. return self;
  676. },
  677. args: ["aString"],
  678. source: "basicAt: aString\x0a\x09<return self[aString]>",
  679. messageSends: [],
  680. referencedClasses: []
  681. }),
  682. smalltalk.Object);
  683. smalltalk.addMethod(
  684. "_basicAt_put_",
  685. smalltalk.method({
  686. selector: "basicAt:put:",
  687. category: 'accessing',
  688. fn: function (aString, anObject) {
  689. var self = this;
  690. return self[aString] = anObject;
  691. return self;
  692. },
  693. args: ["aString", "anObject"],
  694. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  695. messageSends: [],
  696. referencedClasses: []
  697. }),
  698. smalltalk.Object);
  699. smalltalk.addMethod(
  700. "_basicDelete_",
  701. smalltalk.method({
  702. selector: "basicDelete:",
  703. category: 'accessing',
  704. fn: function (aString) {
  705. var self = this;
  706. delete self[aString];
  707. return aString;
  708. return self;
  709. },
  710. args: ["aString"],
  711. source: "basicDelete: aString\x0a <delete self[aString]; return aString>",
  712. messageSends: [],
  713. referencedClasses: []
  714. }),
  715. smalltalk.Object);
  716. smalltalk.addMethod(
  717. "_basicPerform_",
  718. smalltalk.method({
  719. selector: "basicPerform:",
  720. category: 'message handling',
  721. fn: function (aSymbol) {
  722. var self = this;
  723. var $1;
  724. $1 = smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  725. return $1;
  726. },
  727. args: ["aSymbol"],
  728. source: "basicPerform: aSymbol \x0a\x09^self basicPerform: aSymbol withArguments: #()",
  729. messageSends: ["basicPerform:withArguments:"],
  730. referencedClasses: []
  731. }),
  732. smalltalk.Object);
  733. smalltalk.addMethod(
  734. "_basicPerform_withArguments_",
  735. smalltalk.method({
  736. selector: "basicPerform:withArguments:",
  737. category: 'message handling',
  738. fn: function (aSymbol, aCollection) {
  739. var self = this;
  740. return self[aSymbol].apply(self, aCollection);
  741. return self;
  742. },
  743. args: ["aSymbol", "aCollection"],
  744. source: "basicPerform: aSymbol withArguments: aCollection\x0a\x09<return self[aSymbol].apply(self, aCollection);>",
  745. messageSends: [],
  746. referencedClasses: []
  747. }),
  748. smalltalk.Object);
  749. smalltalk.addMethod(
  750. "_class",
  751. smalltalk.method({
  752. selector: "class",
  753. category: 'accessing',
  754. fn: function () {
  755. var self = this;
  756. return self.klass;
  757. return self;
  758. },
  759. args: [],
  760. source: "class\x0a\x09<return self.klass>",
  761. messageSends: [],
  762. referencedClasses: []
  763. }),
  764. smalltalk.Object);
  765. smalltalk.addMethod(
  766. "_copy",
  767. smalltalk.method({
  768. selector: "copy",
  769. category: 'copying',
  770. fn: function () {
  771. var self = this;
  772. var $1;
  773. $1 = smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  774. return $1;
  775. },
  776. args: [],
  777. source: "copy\x0a\x09^self shallowCopy postCopy",
  778. messageSends: ["postCopy", "shallowCopy"],
  779. referencedClasses: []
  780. }),
  781. smalltalk.Object);
  782. smalltalk.addMethod(
  783. "_deepCopy",
  784. smalltalk.method({
  785. selector: "deepCopy",
  786. category: 'copying',
  787. fn: function () {
  788. var self = this;
  789. var copy = self.klass._new();
  790. for (var i in self) {
  791. if (/^@.+/.test(i)) {
  792. copy[i] = self[i]._deepCopy();
  793. }
  794. }
  795. return copy;
  796. return self;
  797. },
  798. args: [],
  799. 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>",
  800. messageSends: [],
  801. referencedClasses: []
  802. }),
  803. smalltalk.Object);
  804. smalltalk.addMethod(
  805. "_deprecatedAPI",
  806. smalltalk.method({
  807. selector: "deprecatedAPI",
  808. category: 'error handling',
  809. fn: function () {
  810. var self = this;
  811. 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", [")"])]);
  812. return self;
  813. },
  814. args: [],
  815. 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, ')'",
  816. messageSends: ["warn:", ",", "asString", "home"],
  817. referencedClasses: []
  818. }),
  819. smalltalk.Object);
  820. smalltalk.addMethod(
  821. "_doesNotUnderstand_",
  822. smalltalk.method({
  823. selector: "doesNotUnderstand:",
  824. category: 'error handling',
  825. fn: function (aMessage) {
  826. var self = this;
  827. var $1, $2;
  828. $1 = smalltalk.send(smalltalk.MessageNotUnderstood || MessageNotUnderstood, "_new", []);
  829. smalltalk.send($1, "_receiver_", [self]);
  830. smalltalk.send($1, "_message_", [aMessage]);
  831. $2 = smalltalk.send($1, "_signal", []);
  832. return self;
  833. },
  834. args: ["aMessage"],
  835. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  836. messageSends: ["receiver:", "new", "message:", "signal"],
  837. referencedClasses: ["MessageNotUnderstood"]
  838. }),
  839. smalltalk.Object);
  840. smalltalk.addMethod(
  841. "_error_",
  842. smalltalk.method({
  843. selector: "error:",
  844. category: 'error handling',
  845. fn: function (aString) {
  846. var self = this;
  847. smalltalk.send(smalltalk.Error || Error, "_signal_", [aString]);
  848. return self;
  849. },
  850. args: ["aString"],
  851. source: "error: aString\x0a\x09Error signal: aString",
  852. messageSends: ["signal:"],
  853. referencedClasses: ["Error"]
  854. }),
  855. smalltalk.Object);
  856. smalltalk.addMethod(
  857. "_halt",
  858. smalltalk.method({
  859. selector: "halt",
  860. category: 'error handling',
  861. fn: function () {
  862. var self = this;
  863. smalltalk.send(self, "_error_", ["Halt encountered"]);
  864. return self;
  865. },
  866. args: [],
  867. source: "halt\x0a\x09self error: 'Halt encountered'",
  868. messageSends: ["error:"],
  869. referencedClasses: []
  870. }),
  871. smalltalk.Object);
  872. smalltalk.addMethod(
  873. "_identityHash",
  874. smalltalk.method({
  875. selector: "identityHash",
  876. category: 'accessing',
  877. fn: function () {
  878. var self = this;
  879. var hash = self.identityHash;
  880. if (hash) {
  881. return hash;
  882. }
  883. hash = smalltalk.nextId();
  884. Object.defineProperty(self, "identityHash", {value: hash});
  885. return hash;
  886. return self;
  887. },
  888. args: [],
  889. 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>",
  890. messageSends: [],
  891. referencedClasses: []
  892. }),
  893. smalltalk.Object);
  894. smalltalk.addMethod(
  895. "_ifNil_",
  896. smalltalk.method({
  897. selector: "ifNil:",
  898. category: 'testing',
  899. fn: function (aBlock) {
  900. var self = this;
  901. return self;
  902. },
  903. args: ["aBlock"],
  904. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  905. messageSends: [],
  906. referencedClasses: []
  907. }),
  908. smalltalk.Object);
  909. smalltalk.addMethod(
  910. "_ifNil_ifNotNil_",
  911. smalltalk.method({
  912. selector: "ifNil:ifNotNil:",
  913. category: 'testing',
  914. fn: function (aBlock, anotherBlock) {
  915. var self = this;
  916. var $1;
  917. $1 = smalltalk.send(anotherBlock, "_value", []);
  918. return $1;
  919. },
  920. args: ["aBlock", "anotherBlock"],
  921. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  922. messageSends: ["value"],
  923. referencedClasses: []
  924. }),
  925. smalltalk.Object);
  926. smalltalk.addMethod(
  927. "_ifNotNil_",
  928. smalltalk.method({
  929. selector: "ifNotNil:",
  930. category: 'testing',
  931. fn: function (aBlock) {
  932. var self = this;
  933. var $1;
  934. $1 = smalltalk.send(aBlock, "_value", []);
  935. return $1;
  936. },
  937. args: ["aBlock"],
  938. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  939. messageSends: ["value"],
  940. referencedClasses: []
  941. }),
  942. smalltalk.Object);
  943. smalltalk.addMethod(
  944. "_ifNotNil_ifNil_",
  945. smalltalk.method({
  946. selector: "ifNotNil:ifNil:",
  947. category: 'testing',
  948. fn: function (aBlock, anotherBlock) {
  949. var self = this;
  950. var $1;
  951. $1 = smalltalk.send(aBlock, "_value", []);
  952. return $1;
  953. },
  954. args: ["aBlock", "anotherBlock"],
  955. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  956. messageSends: ["value"],
  957. referencedClasses: []
  958. }),
  959. smalltalk.Object);
  960. smalltalk.addMethod(
  961. "_initialize",
  962. smalltalk.method({
  963. selector: "initialize",
  964. category: 'initialization',
  965. fn: function () {
  966. var self = this;
  967. return self;
  968. },
  969. args: [],
  970. source: "initialize",
  971. messageSends: [],
  972. referencedClasses: []
  973. }),
  974. smalltalk.Object);
  975. smalltalk.addMethod(
  976. "_instVarAt_",
  977. smalltalk.method({
  978. selector: "instVarAt:",
  979. category: 'accessing',
  980. fn: function (aSymbol) {
  981. var self = this;
  982. var varname;
  983. varname = smalltalk.send(aSymbol, "_asString", []);
  984. return self["@" + varname];
  985. return self;
  986. },
  987. args: ["aSymbol"],
  988. source: "instVarAt: aSymbol\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<return self['@'+varname]>",
  989. messageSends: ["asString"],
  990. referencedClasses: []
  991. }),
  992. smalltalk.Object);
  993. smalltalk.addMethod(
  994. "_instVarAt_put_",
  995. smalltalk.method({
  996. selector: "instVarAt:put:",
  997. category: 'accessing',
  998. fn: function (aSymbol, anObject) {
  999. var self = this;
  1000. var varname;
  1001. varname = smalltalk.send(aSymbol, "_asString", []);
  1002. self["@" + varname] = anObject;
  1003. return self;
  1004. },
  1005. args: ["aSymbol", "anObject"],
  1006. source: "instVarAt: aSymbol put: anObject\x0a\x09| varname |\x0a\x09varname := aSymbol asString.\x0a\x09<self['@' + varname] = anObject>",
  1007. messageSends: ["asString"],
  1008. referencedClasses: []
  1009. }),
  1010. smalltalk.Object);
  1011. smalltalk.addMethod(
  1012. "_isClass",
  1013. smalltalk.method({
  1014. selector: "isClass",
  1015. category: 'testing',
  1016. fn: function () {
  1017. var self = this;
  1018. return false;
  1019. },
  1020. args: [],
  1021. source: "isClass\x0a\x09^false",
  1022. messageSends: [],
  1023. referencedClasses: []
  1024. }),
  1025. smalltalk.Object);
  1026. smalltalk.addMethod(
  1027. "_isKindOf_",
  1028. smalltalk.method({
  1029. selector: "isKindOf:",
  1030. category: 'testing',
  1031. fn: function (aClass) {
  1032. var self = this;
  1033. var $2, $1;
  1034. $2 = smalltalk.send(self, "_isMemberOf_", [aClass]);
  1035. if (smalltalk.assert($2)) {
  1036. $1 = true;
  1037. } else {
  1038. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);
  1039. }
  1040. return $1;
  1041. },
  1042. args: ["aClass"],
  1043. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: [self class inheritsFrom: aClass]",
  1044. messageSends: ["ifTrue:ifFalse:", "inheritsFrom:", "class", "isMemberOf:"],
  1045. referencedClasses: []
  1046. }),
  1047. smalltalk.Object);
  1048. smalltalk.addMethod(
  1049. "_isMemberOf_",
  1050. smalltalk.method({
  1051. selector: "isMemberOf:",
  1052. category: 'testing',
  1053. fn: function (aClass) {
  1054. var self = this;
  1055. var $1;
  1056. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  1057. return $1;
  1058. },
  1059. args: ["aClass"],
  1060. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1061. messageSends: ["=", "class"],
  1062. referencedClasses: []
  1063. }),
  1064. smalltalk.Object);
  1065. smalltalk.addMethod(
  1066. "_isMetaclass",
  1067. smalltalk.method({
  1068. selector: "isMetaclass",
  1069. category: 'testing',
  1070. fn: function () {
  1071. var self = this;
  1072. return false;
  1073. },
  1074. args: [],
  1075. source: "isMetaclass\x0a\x09^false",
  1076. messageSends: [],
  1077. referencedClasses: []
  1078. }),
  1079. smalltalk.Object);
  1080. smalltalk.addMethod(
  1081. "_isNil",
  1082. smalltalk.method({
  1083. selector: "isNil",
  1084. category: 'testing',
  1085. fn: function () {
  1086. var self = this;
  1087. return false;
  1088. },
  1089. args: [],
  1090. source: "isNil\x0a\x09^false",
  1091. messageSends: [],
  1092. referencedClasses: []
  1093. }),
  1094. smalltalk.Object);
  1095. smalltalk.addMethod(
  1096. "_isNumber",
  1097. smalltalk.method({
  1098. selector: "isNumber",
  1099. category: 'testing',
  1100. fn: function () {
  1101. var self = this;
  1102. return false;
  1103. },
  1104. args: [],
  1105. source: "isNumber\x0a\x09^false",
  1106. messageSends: [],
  1107. referencedClasses: []
  1108. }),
  1109. smalltalk.Object);
  1110. smalltalk.addMethod(
  1111. "_isParseFailure",
  1112. smalltalk.method({
  1113. selector: "isParseFailure",
  1114. category: 'testing',
  1115. fn: function () {
  1116. var self = this;
  1117. return false;
  1118. },
  1119. args: [],
  1120. source: "isParseFailure\x0a\x09^false",
  1121. messageSends: [],
  1122. referencedClasses: []
  1123. }),
  1124. smalltalk.Object);
  1125. smalltalk.addMethod(
  1126. "_isString",
  1127. smalltalk.method({
  1128. selector: "isString",
  1129. category: 'testing',
  1130. fn: function () {
  1131. var self = this;
  1132. return false;
  1133. },
  1134. args: [],
  1135. source: "isString\x0a\x09^false",
  1136. messageSends: [],
  1137. referencedClasses: []
  1138. }),
  1139. smalltalk.Object);
  1140. smalltalk.addMethod(
  1141. "_isSymbol",
  1142. smalltalk.method({
  1143. selector: "isSymbol",
  1144. category: 'testing',
  1145. fn: function () {
  1146. var self = this;
  1147. return false;
  1148. },
  1149. args: [],
  1150. source: "isSymbol\x0a\x09^false",
  1151. messageSends: [],
  1152. referencedClasses: []
  1153. }),
  1154. smalltalk.Object);
  1155. smalltalk.addMethod(
  1156. "_log_block_",
  1157. smalltalk.method({
  1158. selector: "log:block:",
  1159. category: 'printing',
  1160. fn: function (aString, aBlock) {
  1161. var self = this;
  1162. var result;
  1163. 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", [])])]);
  1164. return result;
  1165. },
  1166. args: ["aString", "aBlock"],
  1167. source: "log: aString block: aBlock\x0a\x0a\x09| result |\x0a\x09console log: aString, ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.\x0a\x09^result",
  1168. messageSends: ["log:", ",", "printString", "millisecondsToRun:", "value"],
  1169. referencedClasses: ["Date"]
  1170. }),
  1171. smalltalk.Object);
  1172. smalltalk.addMethod(
  1173. "_notNil",
  1174. smalltalk.method({
  1175. selector: "notNil",
  1176. category: 'testing',
  1177. fn: function () {
  1178. var self = this;
  1179. var $1;
  1180. $1 = smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  1181. return $1;
  1182. },
  1183. args: [],
  1184. source: "notNil\x0a\x09^self isNil not",
  1185. messageSends: ["not", "isNil"],
  1186. referencedClasses: []
  1187. }),
  1188. smalltalk.Object);
  1189. smalltalk.addMethod(
  1190. "_perform_",
  1191. smalltalk.method({
  1192. selector: "perform:",
  1193. category: 'message handling',
  1194. fn: function (aSymbol) {
  1195. var self = this;
  1196. var $1;
  1197. $1 = smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  1198. return $1;
  1199. },
  1200. args: ["aSymbol"],
  1201. source: "perform: aSymbol\x0a\x09^self perform: aSymbol withArguments: #()",
  1202. messageSends: ["perform:withArguments:"],
  1203. referencedClasses: []
  1204. }),
  1205. smalltalk.Object);
  1206. smalltalk.addMethod(
  1207. "_perform_withArguments_",
  1208. smalltalk.method({
  1209. selector: "perform:withArguments:",
  1210. category: 'message handling',
  1211. fn: function (aSymbol, aCollection) {
  1212. var self = this;
  1213. var selector;
  1214. selector = smalltalk.send(aSymbol, "_asSelector", []);
  1215. return smalltalk.send(self, selector, aCollection);
  1216. return self;
  1217. },
  1218. args: ["aSymbol", "aCollection"],
  1219. source: "perform: aSymbol withArguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSymbol asSelector.\x0a\x09<return smalltalk.send(self, selector, aCollection)>",
  1220. messageSends: ["asSelector"],
  1221. referencedClasses: []
  1222. }),
  1223. smalltalk.Object);
  1224. smalltalk.addMethod(
  1225. "_postCopy",
  1226. smalltalk.method({
  1227. selector: "postCopy",
  1228. category: 'copying',
  1229. fn: function () {
  1230. var self = this;
  1231. return self;
  1232. },
  1233. args: [],
  1234. source: "postCopy",
  1235. messageSends: [],
  1236. referencedClasses: []
  1237. }),
  1238. smalltalk.Object);
  1239. smalltalk.addMethod(
  1240. "_printNl",
  1241. smalltalk.method({
  1242. selector: "printNl",
  1243. category: 'printing',
  1244. fn: function () {
  1245. var self = this;
  1246. console.log(self);
  1247. return self;
  1248. },
  1249. args: [],
  1250. source: "printNl\x0a\x09<console.log(self)>",
  1251. messageSends: [],
  1252. referencedClasses: []
  1253. }),
  1254. smalltalk.Object);
  1255. smalltalk.addMethod(
  1256. "_printString",
  1257. smalltalk.method({
  1258. selector: "printString",
  1259. category: 'printing',
  1260. fn: function () {
  1261. var self = this;
  1262. var $1;
  1263. $1 = smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  1264. return $1;
  1265. },
  1266. args: [],
  1267. source: "printString\x0a\x09^'a ', self class name",
  1268. messageSends: [",", "name", "class"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.Object);
  1272. smalltalk.addMethod(
  1273. "_respondsTo_",
  1274. smalltalk.method({
  1275. selector: "respondsTo:",
  1276. category: 'testing',
  1277. fn: function (aSelector) {
  1278. var self = this;
  1279. var $1;
  1280. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_canUnderstand_", [aSelector]);
  1281. return $1;
  1282. },
  1283. args: ["aSelector"],
  1284. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  1285. messageSends: ["canUnderstand:", "class"],
  1286. referencedClasses: []
  1287. }),
  1288. smalltalk.Object);
  1289. smalltalk.addMethod(
  1290. "_shallowCopy",
  1291. smalltalk.method({
  1292. selector: "shallowCopy",
  1293. category: 'copying',
  1294. fn: function () {
  1295. var self = this;
  1296. var copy = self.klass._new();
  1297. for (var i in self) {
  1298. if (/^@.+/.test(i)) {
  1299. copy[i] = self[i];
  1300. }
  1301. }
  1302. return copy;
  1303. return self;
  1304. },
  1305. args: [],
  1306. 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>",
  1307. messageSends: [],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.Object);
  1311. smalltalk.addMethod(
  1312. "_shouldNotImplement",
  1313. smalltalk.method({
  1314. selector: "shouldNotImplement",
  1315. category: 'error handling',
  1316. fn: function () {
  1317. var self = this;
  1318. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  1319. return self;
  1320. },
  1321. args: [],
  1322. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  1323. messageSends: ["error:", ",", "name", "class"],
  1324. referencedClasses: []
  1325. }),
  1326. smalltalk.Object);
  1327. smalltalk.addMethod(
  1328. "_size",
  1329. smalltalk.method({
  1330. selector: "size",
  1331. category: 'accessing',
  1332. fn: function () {
  1333. var self = this;
  1334. smalltalk.send(self, "_error_", ["Object not indexable"]);
  1335. return self;
  1336. },
  1337. args: [],
  1338. source: "size\x0a\x09self error: 'Object not indexable'",
  1339. messageSends: ["error:"],
  1340. referencedClasses: []
  1341. }),
  1342. smalltalk.Object);
  1343. smalltalk.addMethod(
  1344. "_storeOn_",
  1345. smalltalk.method({
  1346. selector: "storeOn:",
  1347. category: 'printing',
  1348. fn: function (aStream) {
  1349. var self = this;
  1350. smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [])]);
  1351. return self;
  1352. },
  1353. args: ["aStream"],
  1354. source: "storeOn: aStream\x0a\x09aStream nextPutAll: self printString",
  1355. messageSends: ["nextPutAll:", "printString"],
  1356. referencedClasses: []
  1357. }),
  1358. smalltalk.Object);
  1359. smalltalk.addMethod(
  1360. "_storeString",
  1361. smalltalk.method({
  1362. selector: "storeString",
  1363. category: 'printing',
  1364. fn: function () {
  1365. var self = this;
  1366. var $1;
  1367. $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (s) {return smalltalk.send(self, "_storeOn_", [s]);}]);
  1368. return $1;
  1369. },
  1370. args: [],
  1371. 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]",
  1372. messageSends: ["streamContents:", "storeOn:"],
  1373. referencedClasses: ["String"]
  1374. }),
  1375. smalltalk.Object);
  1376. smalltalk.addMethod(
  1377. "_subclassResponsibility",
  1378. smalltalk.method({
  1379. selector: "subclassResponsibility",
  1380. category: 'error handling',
  1381. fn: function () {
  1382. var self = this;
  1383. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  1384. return self;
  1385. },
  1386. args: [],
  1387. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  1388. messageSends: ["error:"],
  1389. referencedClasses: []
  1390. }),
  1391. smalltalk.Object);
  1392. smalltalk.addMethod(
  1393. "_throw_",
  1394. smalltalk.method({
  1395. selector: "throw:",
  1396. category: 'error handling',
  1397. fn: function (anObject) {
  1398. var self = this;
  1399. throw anObject;
  1400. return self;
  1401. },
  1402. args: ["anObject"],
  1403. source: "throw: anObject\x0a\x09< throw anObject >",
  1404. messageSends: [],
  1405. referencedClasses: []
  1406. }),
  1407. smalltalk.Object);
  1408. smalltalk.addMethod(
  1409. "_try_catch_",
  1410. smalltalk.method({
  1411. selector: "try:catch:",
  1412. category: 'error handling',
  1413. fn: function (aBlock, anotherBlock) {
  1414. var self = this;
  1415. try {
  1416. result = aBlock();
  1417. } catch (e) {
  1418. result = anotherBlock(e);
  1419. }
  1420. return result;
  1421. return self;
  1422. },
  1423. args: ["aBlock", "anotherBlock"],
  1424. source: "try: aBlock catch: anotherBlock\x0a\x09<try{result = aBlock()} catch(e) {result = anotherBlock(e)};\x0a\x09return result;>",
  1425. messageSends: [],
  1426. referencedClasses: []
  1427. }),
  1428. smalltalk.Object);
  1429. smalltalk.addMethod(
  1430. "_value",
  1431. smalltalk.method({
  1432. selector: "value",
  1433. category: 'accessing',
  1434. fn: function () {
  1435. var self = this;
  1436. return self;
  1437. },
  1438. args: [],
  1439. source: "value\x0a\x09^ self",
  1440. messageSends: [],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.Object);
  1444. smalltalk.addMethod(
  1445. "_yourself",
  1446. smalltalk.method({
  1447. selector: "yourself",
  1448. category: 'accessing',
  1449. fn: function () {
  1450. var self = this;
  1451. return self;
  1452. },
  1453. args: [],
  1454. source: "yourself\x0a\x09^self",
  1455. messageSends: [],
  1456. referencedClasses: []
  1457. }),
  1458. smalltalk.Object);
  1459. smalltalk.addMethod(
  1460. "_~_eq",
  1461. smalltalk.method({
  1462. selector: "~=",
  1463. category: 'comparing',
  1464. fn: function (anObject) {
  1465. var self = this;
  1466. var $1;
  1467. $1 = smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq", [false]);
  1468. return $1;
  1469. },
  1470. args: ["anObject"],
  1471. source: "~= anObject\x0a\x09^(self = anObject) = false",
  1472. messageSends: ["="],
  1473. referencedClasses: []
  1474. }),
  1475. smalltalk.Object);
  1476. smalltalk.addMethod(
  1477. "_~~",
  1478. smalltalk.method({
  1479. selector: "~~",
  1480. category: 'comparing',
  1481. fn: function (anObject) {
  1482. var self = this;
  1483. var $1;
  1484. $1 = smalltalk.send(smalltalk.send(self, "__eq_eq", [anObject]), "__eq", [false]);
  1485. return $1;
  1486. },
  1487. args: ["anObject"],
  1488. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  1489. messageSends: ["=", "=="],
  1490. referencedClasses: []
  1491. }),
  1492. smalltalk.Object);
  1493. smalltalk.addMethod(
  1494. "_initialize",
  1495. smalltalk.method({
  1496. selector: "initialize",
  1497. category: 'initialization',
  1498. fn: function () {
  1499. var self = this;
  1500. return self;
  1501. },
  1502. args: [],
  1503. source: "initialize\x0a\x09\x22no op\x22",
  1504. messageSends: [],
  1505. referencedClasses: []
  1506. }),
  1507. smalltalk.Object.klass);
  1508. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  1509. 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`."
  1510. smalltalk.addMethod(
  1511. "_&",
  1512. smalltalk.method({
  1513. selector: "&",
  1514. category: 'controlling',
  1515. fn: function (aBoolean) {
  1516. var self = this;
  1517. if (self == true) {
  1518. return aBoolean;
  1519. } else {
  1520. return false;
  1521. }
  1522. return self;
  1523. },
  1524. args: ["aBoolean"],
  1525. source: "& aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09 } else {\x0a\x09\x09return false;\x0a\x09 }\x0a\x09>",
  1526. messageSends: [],
  1527. referencedClasses: []
  1528. }),
  1529. smalltalk.Boolean);
  1530. smalltalk.addMethod(
  1531. "__eq",
  1532. smalltalk.method({
  1533. selector: "=",
  1534. category: 'comparing',
  1535. fn: function (aBoolean) {
  1536. var self = this;
  1537. var $1;
  1538. $1 = smalltalk.send(smalltalk.send(aBoolean, "_class", []), "__eq", [smalltalk.send(self, "_class", [])]);
  1539. if (!smalltalk.assert($1)) {
  1540. return false;
  1541. }
  1542. return Boolean(self == true) == aBoolean;
  1543. return self;
  1544. },
  1545. args: ["aBoolean"],
  1546. source: "= aBoolean\x0a\x09aBoolean class = self class ifFalse: [^false].\x0a\x09<return Boolean(self == true) == aBoolean>",
  1547. messageSends: ["ifFalse:", "=", "class"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.Boolean);
  1551. smalltalk.addMethod(
  1552. "__eq_eq",
  1553. smalltalk.method({
  1554. selector: "==",
  1555. category: 'comparing',
  1556. fn: function (aBoolean) {
  1557. var self = this;
  1558. var $1;
  1559. $1 = smalltalk.send(self, "__eq", [aBoolean]);
  1560. return $1;
  1561. },
  1562. args: ["aBoolean"],
  1563. source: "== aBoolean\x0a\x09^self = aBoolean",
  1564. messageSends: ["="],
  1565. referencedClasses: []
  1566. }),
  1567. smalltalk.Boolean);
  1568. smalltalk.addMethod(
  1569. "_and_",
  1570. smalltalk.method({
  1571. selector: "and:",
  1572. category: 'controlling',
  1573. fn: function (aBlock) {
  1574. var self = this;
  1575. var $2, $1;
  1576. $2 = smalltalk.send(self, "__eq", [true]);
  1577. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [aBlock, function () {return false;}]);
  1578. return $1;
  1579. },
  1580. args: ["aBlock"],
  1581. source: "and: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: aBlock\x0a\x09 ifFalse: [false]",
  1582. messageSends: ["ifTrue:ifFalse:", "="],
  1583. referencedClasses: []
  1584. }),
  1585. smalltalk.Boolean);
  1586. smalltalk.addMethod(
  1587. "_asJSON",
  1588. smalltalk.method({
  1589. selector: "asJSON",
  1590. category: 'converting',
  1591. fn: function () {
  1592. var self = this;
  1593. return self;
  1594. },
  1595. args: [],
  1596. source: "asJSON\x0a\x09^self",
  1597. messageSends: [],
  1598. referencedClasses: []
  1599. }),
  1600. smalltalk.Boolean);
  1601. smalltalk.addMethod(
  1602. "_deepCopy",
  1603. smalltalk.method({
  1604. selector: "deepCopy",
  1605. category: 'copying',
  1606. fn: function () {
  1607. var self = this;
  1608. return self;
  1609. },
  1610. args: [],
  1611. source: "deepCopy\x0a\x09^self",
  1612. messageSends: [],
  1613. referencedClasses: []
  1614. }),
  1615. smalltalk.Boolean);
  1616. smalltalk.addMethod(
  1617. "_ifFalse_",
  1618. smalltalk.method({
  1619. selector: "ifFalse:",
  1620. category: 'controlling',
  1621. fn: function (aBlock) {
  1622. var self = this;
  1623. var $1;
  1624. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [function () {}, aBlock]);
  1625. return $1;
  1626. },
  1627. args: ["aBlock"],
  1628. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  1629. messageSends: ["ifTrue:ifFalse:"],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.Boolean);
  1633. smalltalk.addMethod(
  1634. "_ifFalse_ifTrue_",
  1635. smalltalk.method({
  1636. selector: "ifFalse:ifTrue:",
  1637. category: 'controlling',
  1638. fn: function (aBlock, anotherBlock) {
  1639. var self = this;
  1640. var $1;
  1641. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  1642. return $1;
  1643. },
  1644. args: ["aBlock", "anotherBlock"],
  1645. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  1646. messageSends: ["ifTrue:ifFalse:"],
  1647. referencedClasses: []
  1648. }),
  1649. smalltalk.Boolean);
  1650. smalltalk.addMethod(
  1651. "_ifTrue_",
  1652. smalltalk.method({
  1653. selector: "ifTrue:",
  1654. category: 'controlling',
  1655. fn: function (aBlock) {
  1656. var self = this;
  1657. var $1;
  1658. $1 = smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, function () {}]);
  1659. return $1;
  1660. },
  1661. args: ["aBlock"],
  1662. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  1663. messageSends: ["ifTrue:ifFalse:"],
  1664. referencedClasses: []
  1665. }),
  1666. smalltalk.Boolean);
  1667. smalltalk.addMethod(
  1668. "_ifTrue_ifFalse_",
  1669. smalltalk.method({
  1670. selector: "ifTrue:ifFalse:",
  1671. category: 'controlling',
  1672. fn: function (aBlock, anotherBlock) {
  1673. var self = this;
  1674. if (self == true) {
  1675. return aBlock();
  1676. } else {
  1677. return anotherBlock();
  1678. }
  1679. return self;
  1680. },
  1681. args: ["aBlock", "anotherBlock"],
  1682. 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>",
  1683. messageSends: [],
  1684. referencedClasses: []
  1685. }),
  1686. smalltalk.Boolean);
  1687. smalltalk.addMethod(
  1688. "_not",
  1689. smalltalk.method({
  1690. selector: "not",
  1691. category: 'controlling',
  1692. fn: function () {
  1693. var self = this;
  1694. var $1;
  1695. $1 = smalltalk.send(self, "__eq", [false]);
  1696. return $1;
  1697. },
  1698. args: [],
  1699. source: "not\x0a\x09^self = false",
  1700. messageSends: ["="],
  1701. referencedClasses: []
  1702. }),
  1703. smalltalk.Boolean);
  1704. smalltalk.addMethod(
  1705. "_or_",
  1706. smalltalk.method({
  1707. selector: "or:",
  1708. category: 'controlling',
  1709. fn: function (aBlock) {
  1710. var self = this;
  1711. var $2, $1;
  1712. $2 = smalltalk.send(self, "__eq", [true]);
  1713. $1 = smalltalk.send($2, "_ifTrue_ifFalse_", [function () {return true;}, aBlock]);
  1714. return $1;
  1715. },
  1716. args: ["aBlock"],
  1717. source: "or: aBlock\x0a\x09^self = true\x0a\x09 ifTrue: [true]\x0a\x09 ifFalse: aBlock",
  1718. messageSends: ["ifTrue:ifFalse:", "="],
  1719. referencedClasses: []
  1720. }),
  1721. smalltalk.Boolean);
  1722. smalltalk.addMethod(
  1723. "_printString",
  1724. smalltalk.method({
  1725. selector: "printString",
  1726. category: 'printing',
  1727. fn: function () {
  1728. var self = this;
  1729. return self.toString();
  1730. return self;
  1731. },
  1732. args: [],
  1733. source: "printString\x0a\x09<return self.toString()>",
  1734. messageSends: [],
  1735. referencedClasses: []
  1736. }),
  1737. smalltalk.Boolean);
  1738. smalltalk.addMethod(
  1739. "_shallowCopy",
  1740. smalltalk.method({
  1741. selector: "shallowCopy",
  1742. category: 'copying',
  1743. fn: function () {
  1744. var self = this;
  1745. return self;
  1746. },
  1747. args: [],
  1748. source: "shallowCopy\x0a\x09^self",
  1749. messageSends: [],
  1750. referencedClasses: []
  1751. }),
  1752. smalltalk.Boolean);
  1753. smalltalk.addMethod(
  1754. "_|",
  1755. smalltalk.method({
  1756. selector: "|",
  1757. category: 'controlling',
  1758. fn: function (aBoolean) {
  1759. var self = this;
  1760. if (self == true) {
  1761. return true;
  1762. } else {
  1763. return aBoolean;
  1764. }
  1765. return self;
  1766. },
  1767. args: ["aBoolean"],
  1768. source: "| aBoolean\x0a\x09<\x0a\x09 if(self == true) {\x0a\x09\x09return true;\x0a\x09 } else {\x0a\x09\x09return aBoolean;\x0a\x09 }\x0a\x09>",
  1769. messageSends: [],
  1770. referencedClasses: []
  1771. }),
  1772. smalltalk.Boolean);
  1773. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  1774. 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."
  1775. smalltalk.addMethod(
  1776. "__plus",
  1777. smalltalk.method({
  1778. selector: "+",
  1779. category: 'arithmetic',
  1780. fn: function (aDate) {
  1781. var self = this;
  1782. return self + aDate;
  1783. return self;
  1784. },
  1785. args: ["aDate"],
  1786. source: "+ aDate\x0a\x09<return self + aDate>",
  1787. messageSends: [],
  1788. referencedClasses: []
  1789. }),
  1790. smalltalk.Date);
  1791. smalltalk.addMethod(
  1792. "__minus",
  1793. smalltalk.method({
  1794. selector: "-",
  1795. category: 'arithmetic',
  1796. fn: function (aDate) {
  1797. var self = this;
  1798. return self - aDate;
  1799. return self;
  1800. },
  1801. args: ["aDate"],
  1802. source: "- aDate\x0a\x09<return self - aDate>",
  1803. messageSends: [],
  1804. referencedClasses: []
  1805. }),
  1806. smalltalk.Date);
  1807. smalltalk.addMethod(
  1808. "__lt",
  1809. smalltalk.method({
  1810. selector: "<",
  1811. category: 'comparing',
  1812. fn: function (aDate) {
  1813. var self = this;
  1814. return self < aDate;
  1815. return self;
  1816. },
  1817. args: ["aDate"],
  1818. source: "< aDate\x0a\x09<return self < aDate>",
  1819. messageSends: [],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.Date);
  1823. smalltalk.addMethod(
  1824. "__lt_eq",
  1825. smalltalk.method({
  1826. selector: "<=",
  1827. category: 'comparing',
  1828. fn: function (aDate) {
  1829. var self = this;
  1830. return self <= aDate;
  1831. return self;
  1832. },
  1833. args: ["aDate"],
  1834. source: "<= aDate\x0a\x09<return self <= aDate>",
  1835. messageSends: [],
  1836. referencedClasses: []
  1837. }),
  1838. smalltalk.Date);
  1839. smalltalk.addMethod(
  1840. "__gt",
  1841. smalltalk.method({
  1842. selector: ">",
  1843. category: 'comparing',
  1844. fn: function (aDate) {
  1845. var self = this;
  1846. return self > aDate;
  1847. return self;
  1848. },
  1849. args: ["aDate"],
  1850. source: "> aDate\x0a\x09<return self >> aDate>",
  1851. messageSends: [],
  1852. referencedClasses: []
  1853. }),
  1854. smalltalk.Date);
  1855. smalltalk.addMethod(
  1856. "__gt_eq",
  1857. smalltalk.method({
  1858. selector: ">=",
  1859. category: 'comparing',
  1860. fn: function (aDate) {
  1861. var self = this;
  1862. return self >= aDate;
  1863. return self;
  1864. },
  1865. args: ["aDate"],
  1866. source: ">= aDate\x0a\x09<return self >>= aDate>",
  1867. messageSends: [],
  1868. referencedClasses: []
  1869. }),
  1870. smalltalk.Date);
  1871. smalltalk.addMethod(
  1872. "_asDateString",
  1873. smalltalk.method({
  1874. selector: "asDateString",
  1875. category: 'converting',
  1876. fn: function () {
  1877. var self = this;
  1878. return self.toDateString();
  1879. return self;
  1880. },
  1881. args: [],
  1882. source: "asDateString\x0a\x09<return self.toDateString()>",
  1883. messageSends: [],
  1884. referencedClasses: []
  1885. }),
  1886. smalltalk.Date);
  1887. smalltalk.addMethod(
  1888. "_asLocaleString",
  1889. smalltalk.method({
  1890. selector: "asLocaleString",
  1891. category: 'converting',
  1892. fn: function () {
  1893. var self = this;
  1894. return self.toLocaleString();
  1895. return self;
  1896. },
  1897. args: [],
  1898. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  1899. messageSends: [],
  1900. referencedClasses: []
  1901. }),
  1902. smalltalk.Date);
  1903. smalltalk.addMethod(
  1904. "_asMilliseconds",
  1905. smalltalk.method({
  1906. selector: "asMilliseconds",
  1907. category: 'converting',
  1908. fn: function () {
  1909. var self = this;
  1910. var $1;
  1911. $1 = smalltalk.send(self, "_time", []);
  1912. return $1;
  1913. },
  1914. args: [],
  1915. source: "asMilliseconds\x0a\x09^self time",
  1916. messageSends: ["time"],
  1917. referencedClasses: []
  1918. }),
  1919. smalltalk.Date);
  1920. smalltalk.addMethod(
  1921. "_asNumber",
  1922. smalltalk.method({
  1923. selector: "asNumber",
  1924. category: 'converting',
  1925. fn: function () {
  1926. var self = this;
  1927. var $1;
  1928. $1 = smalltalk.send(self, "_asMilliseconds", []);
  1929. return $1;
  1930. },
  1931. args: [],
  1932. source: "asNumber\x0a\x09^self asMilliseconds",
  1933. messageSends: ["asMilliseconds"],
  1934. referencedClasses: []
  1935. }),
  1936. smalltalk.Date);
  1937. smalltalk.addMethod(
  1938. "_asString",
  1939. smalltalk.method({
  1940. selector: "asString",
  1941. category: 'converting',
  1942. fn: function () {
  1943. var self = this;
  1944. return self.toString();
  1945. return self;
  1946. },
  1947. args: [],
  1948. source: "asString\x0a\x09<return self.toString()>",
  1949. messageSends: [],
  1950. referencedClasses: []
  1951. }),
  1952. smalltalk.Date);
  1953. smalltalk.addMethod(
  1954. "_asTimeString",
  1955. smalltalk.method({
  1956. selector: "asTimeString",
  1957. category: 'converting',
  1958. fn: function () {
  1959. var self = this;
  1960. return self.toTimeString();
  1961. return self;
  1962. },
  1963. args: [],
  1964. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  1965. messageSends: [],
  1966. referencedClasses: []
  1967. }),
  1968. smalltalk.Date);
  1969. smalltalk.addMethod(
  1970. "_day",
  1971. smalltalk.method({
  1972. selector: "day",
  1973. category: 'accessing',
  1974. fn: function () {
  1975. var self = this;
  1976. var $1;
  1977. $1 = smalltalk.send(self, "_dayOfWeek", []);
  1978. return $1;
  1979. },
  1980. args: [],
  1981. source: "day\x0a\x09^self dayOfWeek",
  1982. messageSends: ["dayOfWeek"],
  1983. referencedClasses: []
  1984. }),
  1985. smalltalk.Date);
  1986. smalltalk.addMethod(
  1987. "_day_",
  1988. smalltalk.method({
  1989. selector: "day:",
  1990. category: 'accessing',
  1991. fn: function (aNumber) {
  1992. var self = this;
  1993. smalltalk.send(self, "_dayOfWeek_", [aNumber]);
  1994. return self;
  1995. },
  1996. args: ["aNumber"],
  1997. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  1998. messageSends: ["dayOfWeek:"],
  1999. referencedClasses: []
  2000. }),
  2001. smalltalk.Date);
  2002. smalltalk.addMethod(
  2003. "_dayOfMonth",
  2004. smalltalk.method({
  2005. selector: "dayOfMonth",
  2006. category: 'accessing',
  2007. fn: function () {
  2008. var self = this;
  2009. return self.getDate();
  2010. return self;
  2011. },
  2012. args: [],
  2013. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2014. messageSends: [],
  2015. referencedClasses: []
  2016. }),
  2017. smalltalk.Date);
  2018. smalltalk.addMethod(
  2019. "_dayOfMonth_",
  2020. smalltalk.method({
  2021. selector: "dayOfMonth:",
  2022. category: 'accessing',
  2023. fn: function (aNumber) {
  2024. var self = this;
  2025. self.setDate(aNumber);
  2026. return self;
  2027. },
  2028. args: ["aNumber"],
  2029. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2030. messageSends: [],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.Date);
  2034. smalltalk.addMethod(
  2035. "_dayOfWeek",
  2036. smalltalk.method({
  2037. selector: "dayOfWeek",
  2038. category: 'accessing',
  2039. fn: function () {
  2040. var self = this;
  2041. return self.getDay() + 1;
  2042. return self;
  2043. },
  2044. args: [],
  2045. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2046. messageSends: [],
  2047. referencedClasses: []
  2048. }),
  2049. smalltalk.Date);
  2050. smalltalk.addMethod(
  2051. "_dayOfWeek_",
  2052. smalltalk.method({
  2053. selector: "dayOfWeek:",
  2054. category: 'accessing',
  2055. fn: function (aNumber) {
  2056. var self = this;
  2057. return self.setDay(aNumber - 1);
  2058. return self;
  2059. },
  2060. args: ["aNumber"],
  2061. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2062. messageSends: [],
  2063. referencedClasses: []
  2064. }),
  2065. smalltalk.Date);
  2066. smalltalk.addMethod(
  2067. "_hours",
  2068. smalltalk.method({
  2069. selector: "hours",
  2070. category: 'accessing',
  2071. fn: function () {
  2072. var self = this;
  2073. return self.getHours();
  2074. return self;
  2075. },
  2076. args: [],
  2077. source: "hours\x0a\x09<return self.getHours()>",
  2078. messageSends: [],
  2079. referencedClasses: []
  2080. }),
  2081. smalltalk.Date);
  2082. smalltalk.addMethod(
  2083. "_hours_",
  2084. smalltalk.method({
  2085. selector: "hours:",
  2086. category: 'accessing',
  2087. fn: function (aNumber) {
  2088. var self = this;
  2089. self.setHours(aNumber);
  2090. return self;
  2091. },
  2092. args: ["aNumber"],
  2093. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2094. messageSends: [],
  2095. referencedClasses: []
  2096. }),
  2097. smalltalk.Date);
  2098. smalltalk.addMethod(
  2099. "_milliseconds",
  2100. smalltalk.method({
  2101. selector: "milliseconds",
  2102. category: 'accessing',
  2103. fn: function () {
  2104. var self = this;
  2105. return self.getMilliseconds();
  2106. return self;
  2107. },
  2108. args: [],
  2109. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2110. messageSends: [],
  2111. referencedClasses: []
  2112. }),
  2113. smalltalk.Date);
  2114. smalltalk.addMethod(
  2115. "_milliseconds_",
  2116. smalltalk.method({
  2117. selector: "milliseconds:",
  2118. category: 'accessing',
  2119. fn: function (aNumber) {
  2120. var self = this;
  2121. self.setMilliseconds(aNumber);
  2122. return self;
  2123. },
  2124. args: ["aNumber"],
  2125. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2126. messageSends: [],
  2127. referencedClasses: []
  2128. }),
  2129. smalltalk.Date);
  2130. smalltalk.addMethod(
  2131. "_minutes",
  2132. smalltalk.method({
  2133. selector: "minutes",
  2134. category: 'accessing',
  2135. fn: function () {
  2136. var self = this;
  2137. return self.getMinutes();
  2138. return self;
  2139. },
  2140. args: [],
  2141. source: "minutes\x0a\x09<return self.getMinutes()>",
  2142. messageSends: [],
  2143. referencedClasses: []
  2144. }),
  2145. smalltalk.Date);
  2146. smalltalk.addMethod(
  2147. "_minutes_",
  2148. smalltalk.method({
  2149. selector: "minutes:",
  2150. category: 'accessing',
  2151. fn: function (aNumber) {
  2152. var self = this;
  2153. self.setMinutes(aNumber);
  2154. return self;
  2155. },
  2156. args: ["aNumber"],
  2157. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2158. messageSends: [],
  2159. referencedClasses: []
  2160. }),
  2161. smalltalk.Date);
  2162. smalltalk.addMethod(
  2163. "_month",
  2164. smalltalk.method({
  2165. selector: "month",
  2166. category: 'accessing',
  2167. fn: function () {
  2168. var self = this;
  2169. return self.getMonth() + 1;
  2170. return self;
  2171. },
  2172. args: [],
  2173. source: "month\x0a\x09<return self.getMonth() + 1>",
  2174. messageSends: [],
  2175. referencedClasses: []
  2176. }),
  2177. smalltalk.Date);
  2178. smalltalk.addMethod(
  2179. "_month_",
  2180. smalltalk.method({
  2181. selector: "month:",
  2182. category: 'accessing',
  2183. fn: function (aNumber) {
  2184. var self = this;
  2185. self.setMonth(aNumber - 1);
  2186. return self;
  2187. },
  2188. args: ["aNumber"],
  2189. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2190. messageSends: [],
  2191. referencedClasses: []
  2192. }),
  2193. smalltalk.Date);
  2194. smalltalk.addMethod(
  2195. "_printString",
  2196. smalltalk.method({
  2197. selector: "printString",
  2198. category: 'printing',
  2199. fn: function () {
  2200. var self = this;
  2201. var $1;
  2202. $1 = smalltalk.send(self, "_asString", []);
  2203. return $1;
  2204. },
  2205. args: [],
  2206. source: "printString\x0a\x09^self asString",
  2207. messageSends: ["asString"],
  2208. referencedClasses: []
  2209. }),
  2210. smalltalk.Date);
  2211. smalltalk.addMethod(
  2212. "_seconds",
  2213. smalltalk.method({
  2214. selector: "seconds",
  2215. category: 'accessing',
  2216. fn: function () {
  2217. var self = this;
  2218. return self.getSeconds();
  2219. return self;
  2220. },
  2221. args: [],
  2222. source: "seconds\x0a\x09<return self.getSeconds()>",
  2223. messageSends: [],
  2224. referencedClasses: []
  2225. }),
  2226. smalltalk.Date);
  2227. smalltalk.addMethod(
  2228. "_seconds_",
  2229. smalltalk.method({
  2230. selector: "seconds:",
  2231. category: 'accessing',
  2232. fn: function (aNumber) {
  2233. var self = this;
  2234. self.setSeconds(aNumber);
  2235. return self;
  2236. },
  2237. args: ["aNumber"],
  2238. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  2239. messageSends: [],
  2240. referencedClasses: []
  2241. }),
  2242. smalltalk.Date);
  2243. smalltalk.addMethod(
  2244. "_time",
  2245. smalltalk.method({
  2246. selector: "time",
  2247. category: 'accessing',
  2248. fn: function () {
  2249. var self = this;
  2250. return self.getTime();
  2251. return self;
  2252. },
  2253. args: [],
  2254. source: "time\x0a\x09<return self.getTime()>",
  2255. messageSends: [],
  2256. referencedClasses: []
  2257. }),
  2258. smalltalk.Date);
  2259. smalltalk.addMethod(
  2260. "_time_",
  2261. smalltalk.method({
  2262. selector: "time:",
  2263. category: 'accessing',
  2264. fn: function (aNumber) {
  2265. var self = this;
  2266. self.setTime(aNumber);
  2267. return self;
  2268. },
  2269. args: ["aNumber"],
  2270. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  2271. messageSends: [],
  2272. referencedClasses: []
  2273. }),
  2274. smalltalk.Date);
  2275. smalltalk.addMethod(
  2276. "_year",
  2277. smalltalk.method({
  2278. selector: "year",
  2279. category: 'accessing',
  2280. fn: function () {
  2281. var self = this;
  2282. return self.getFullYear();
  2283. return self;
  2284. },
  2285. args: [],
  2286. source: "year\x0a\x09<return self.getFullYear()>",
  2287. messageSends: [],
  2288. referencedClasses: []
  2289. }),
  2290. smalltalk.Date);
  2291. smalltalk.addMethod(
  2292. "_year_",
  2293. smalltalk.method({
  2294. selector: "year:",
  2295. category: 'accessing',
  2296. fn: function (aNumber) {
  2297. var self = this;
  2298. self.setFullYear(aNumber);
  2299. return self;
  2300. },
  2301. args: ["aNumber"],
  2302. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  2303. messageSends: [],
  2304. referencedClasses: []
  2305. }),
  2306. smalltalk.Date);
  2307. smalltalk.addMethod(
  2308. "_fromMilliseconds_",
  2309. smalltalk.method({
  2310. selector: "fromMilliseconds:",
  2311. category: 'instance creation',
  2312. fn: function (aNumber) {
  2313. var self = this;
  2314. var $1;
  2315. $1 = smalltalk.send(self, "_new_", [aNumber]);
  2316. return $1;
  2317. },
  2318. args: ["aNumber"],
  2319. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  2320. messageSends: ["new:"],
  2321. referencedClasses: []
  2322. }),
  2323. smalltalk.Date.klass);
  2324. smalltalk.addMethod(
  2325. "_fromSeconds_",
  2326. smalltalk.method({
  2327. selector: "fromSeconds:",
  2328. category: 'instance creation',
  2329. fn: function (aNumber) {
  2330. var self = this;
  2331. var $1;
  2332. $1 = smalltalk.send(self, "_fromMilliseconds_", [smalltalk.send(aNumber, "__star", [1000])]);
  2333. return $1;
  2334. },
  2335. args: ["aNumber"],
  2336. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  2337. messageSends: ["fromMilliseconds:", "*"],
  2338. referencedClasses: []
  2339. }),
  2340. smalltalk.Date.klass);
  2341. smalltalk.addMethod(
  2342. "_fromString_",
  2343. smalltalk.method({
  2344. selector: "fromString:",
  2345. category: 'instance creation',
  2346. fn: function (aString) {
  2347. var self = this;
  2348. var $1;
  2349. $1 = smalltalk.send(self, "_new_", [aString]);
  2350. return $1;
  2351. },
  2352. args: ["aString"],
  2353. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  2354. messageSends: ["new:"],
  2355. referencedClasses: []
  2356. }),
  2357. smalltalk.Date.klass);
  2358. smalltalk.addMethod(
  2359. "_millisecondsToRun_",
  2360. smalltalk.method({
  2361. selector: "millisecondsToRun:",
  2362. category: 'instance creation',
  2363. fn: function (aBlock) {
  2364. var self = this;
  2365. var $1;
  2366. var t;
  2367. t = smalltalk.send(smalltalk.Date || Date, "_now", []);
  2368. smalltalk.send(aBlock, "_value", []);
  2369. $1 = smalltalk.send(smalltalk.send(smalltalk.Date || Date, "_now", []), "__minus", [t]);
  2370. return $1;
  2371. },
  2372. args: ["aBlock"],
  2373. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  2374. messageSends: ["now", "value", "-"],
  2375. referencedClasses: ["Date"]
  2376. }),
  2377. smalltalk.Date.klass);
  2378. smalltalk.addMethod(
  2379. "_new_",
  2380. smalltalk.method({
  2381. selector: "new:",
  2382. category: 'instance creation',
  2383. fn: function (anObject) {
  2384. var self = this;
  2385. return new Date(anObject);
  2386. return self;
  2387. },
  2388. args: ["anObject"],
  2389. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  2390. messageSends: [],
  2391. referencedClasses: []
  2392. }),
  2393. smalltalk.Date.klass);
  2394. smalltalk.addMethod(
  2395. "_now",
  2396. smalltalk.method({
  2397. selector: "now",
  2398. category: 'instance creation',
  2399. fn: function () {
  2400. var self = this;
  2401. var $1;
  2402. $1 = smalltalk.send(self, "_today", []);
  2403. return $1;
  2404. },
  2405. args: [],
  2406. source: "now\x0a\x09^self today",
  2407. messageSends: ["today"],
  2408. referencedClasses: []
  2409. }),
  2410. smalltalk.Date.klass);
  2411. smalltalk.addMethod(
  2412. "_today",
  2413. smalltalk.method({
  2414. selector: "today",
  2415. category: 'instance creation',
  2416. fn: function () {
  2417. var self = this;
  2418. var $1;
  2419. $1 = smalltalk.send(self, "_new", []);
  2420. return $1;
  2421. },
  2422. args: [],
  2423. source: "today\x0a\x09^self new",
  2424. messageSends: ["new"],
  2425. referencedClasses: []
  2426. }),
  2427. smalltalk.Date.klass);
  2428. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Objects');
  2429. 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`."
  2430. smalltalk.addMethod(
  2431. "_at_",
  2432. smalltalk.method({
  2433. selector: "at:",
  2434. category: 'accessing',
  2435. fn: function (aSymbol) {
  2436. var self = this;
  2437. var attr;
  2438. attr = smalltalk.send(aSymbol, "_asString", []);
  2439. return self['@jsObject'][attr];
  2440. return self;
  2441. },
  2442. args: ["aSymbol"],
  2443. source: "at: aSymbol\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<return self['@jsObject'][attr]>",
  2444. messageSends: ["asString"],
  2445. referencedClasses: []
  2446. }),
  2447. smalltalk.JSObjectProxy);
  2448. smalltalk.addMethod(
  2449. "_at_put_",
  2450. smalltalk.method({
  2451. selector: "at:put:",
  2452. category: 'accessing',
  2453. fn: function (aSymbol, anObject) {
  2454. var self = this;
  2455. var attr;
  2456. attr = smalltalk.send(aSymbol, "_asString", []);
  2457. self['@jsObject'][attr] = anObject;
  2458. return self;
  2459. },
  2460. args: ["aSymbol", "anObject"],
  2461. source: "at: aSymbol put: anObject\x0a\x09| attr |\x0a\x09attr := aSymbol asString.\x0a\x09<self['@jsObject'][attr] = anObject>",
  2462. messageSends: ["asString"],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.JSObjectProxy);
  2466. smalltalk.addMethod(
  2467. "_doesNotUnderstand_",
  2468. smalltalk.method({
  2469. selector: "doesNotUnderstand:",
  2470. category: 'proxy',
  2471. fn: function (aMessage) {
  2472. var self = this;
  2473. var obj;
  2474. var selector;
  2475. var jsSelector;
  2476. var arguments;
  2477. obj = smalltalk.send(self, "_jsObject", []);
  2478. selector = smalltalk.send(aMessage, "_selector", []);
  2479. jsSelector = smalltalk.send(selector, "_asJavaScriptSelector", []);
  2480. arguments = smalltalk.send(aMessage, "_arguments", []);
  2481. if (obj[jsSelector] != undefined) {
  2482. return smalltalk.send(obj, jsSelector, arguments);
  2483. }
  2484. smalltalk.send(self, "_doesNotUnderstand_", [aMessage], smalltalk.Object);
  2485. return self;
  2486. },
  2487. args: ["aMessage"],
  2488. 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(obj[jsSelector] != undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.\x0a\x09super doesNotUnderstand: aMessage",
  2489. messageSends: ["jsObject", "selector", "asJavaScriptSelector", "arguments", "doesNotUnderstand:"],
  2490. referencedClasses: []
  2491. }),
  2492. smalltalk.JSObjectProxy);
  2493. smalltalk.addMethod(
  2494. "_inspectOn_",
  2495. smalltalk.method({
  2496. selector: "inspectOn:",
  2497. category: 'proxy',
  2498. fn: function (anInspector) {
  2499. var self = this;
  2500. var variables;
  2501. variables = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  2502. smalltalk.send(variables, "_at_put_", ["#self", smalltalk.send(self, "_jsObject", [])]);
  2503. smalltalk.send(anInspector, "_setLabel_", [smalltalk.send(self, "_printString", [])]);
  2504. for (var i in self['@jsObject']) {
  2505. variables._at_put_(i, self['@jsObject'][i]);
  2506. }
  2507. smalltalk.send(anInspector, "_setVariables_", [variables]);
  2508. return self;
  2509. },
  2510. args: ["anInspector"],
  2511. 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",
  2512. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "setVariables:"],
  2513. referencedClasses: ["Dictionary"]
  2514. }),
  2515. smalltalk.JSObjectProxy);
  2516. smalltalk.addMethod(
  2517. "_jsObject",
  2518. smalltalk.method({
  2519. selector: "jsObject",
  2520. category: 'accessing',
  2521. fn: function () {
  2522. var self = this;
  2523. return self['@jsObject'];
  2524. },
  2525. args: [],
  2526. source: "jsObject\x0a\x09^jsObject",
  2527. messageSends: [],
  2528. referencedClasses: []
  2529. }),
  2530. smalltalk.JSObjectProxy);
  2531. smalltalk.addMethod(
  2532. "_jsObject_",
  2533. smalltalk.method({
  2534. selector: "jsObject:",
  2535. category: 'accessing',
  2536. fn: function (aJSObject) {
  2537. var self = this;
  2538. self['@jsObject'] = aJSObject;
  2539. return self;
  2540. },
  2541. args: ["aJSObject"],
  2542. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  2543. messageSends: [],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.JSObjectProxy);
  2547. smalltalk.addMethod(
  2548. "_printString",
  2549. smalltalk.method({
  2550. selector: "printString",
  2551. category: 'proxy',
  2552. fn: function () {
  2553. var self = this;
  2554. var $1;
  2555. $1 = smalltalk.send(smalltalk.send(self, "_jsObject", []), "_toString", []);
  2556. return $1;
  2557. },
  2558. args: [],
  2559. source: "printString\x0a\x09^self jsObject toString",
  2560. messageSends: ["toString", "jsObject"],
  2561. referencedClasses: []
  2562. }),
  2563. smalltalk.JSObjectProxy);
  2564. smalltalk.addMethod(
  2565. "_on_",
  2566. smalltalk.method({
  2567. selector: "on:",
  2568. category: 'instance creation',
  2569. fn: function (aJSObject) {
  2570. var self = this;
  2571. var $2, $3, $1;
  2572. $2 = smalltalk.send(self, "_new", []);
  2573. smalltalk.send($2, "_jsObject_", [aJSObject]);
  2574. $3 = smalltalk.send($2, "_yourself", []);
  2575. $1 = $3;
  2576. return $1;
  2577. },
  2578. args: ["aJSObject"],
  2579. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  2580. messageSends: ["jsObject:", "new", "yourself"],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.JSObjectProxy.klass);
  2584. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  2585. 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]."
  2586. smalltalk.addMethod(
  2587. "_&",
  2588. smalltalk.method({
  2589. selector: "&",
  2590. category: 'converting',
  2591. fn: function (aNumber) {
  2592. var self = this;
  2593. return self & aNumber;
  2594. return self;
  2595. },
  2596. args: ["aNumber"],
  2597. source: "& aNumber\x0a\x09<return self & aNumber>",
  2598. messageSends: [],
  2599. referencedClasses: []
  2600. }),
  2601. smalltalk.Number);
  2602. smalltalk.addMethod(
  2603. "__star",
  2604. smalltalk.method({
  2605. selector: "*",
  2606. category: 'arithmetic',
  2607. fn: function (aNumber) {
  2608. var self = this;
  2609. return self * aNumber;
  2610. return self;
  2611. },
  2612. args: ["aNumber"],
  2613. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  2614. messageSends: [],
  2615. referencedClasses: []
  2616. }),
  2617. smalltalk.Number);
  2618. smalltalk.addMethod(
  2619. "__plus",
  2620. smalltalk.method({
  2621. selector: "+",
  2622. category: 'arithmetic',
  2623. fn: function (aNumber) {
  2624. var self = this;
  2625. return self + aNumber;
  2626. return self;
  2627. },
  2628. args: ["aNumber"],
  2629. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  2630. messageSends: [],
  2631. referencedClasses: []
  2632. }),
  2633. smalltalk.Number);
  2634. smalltalk.addMethod(
  2635. "__minus",
  2636. smalltalk.method({
  2637. selector: "-",
  2638. category: 'arithmetic',
  2639. fn: function (aNumber) {
  2640. var self = this;
  2641. return self - aNumber;
  2642. return self;
  2643. },
  2644. args: ["aNumber"],
  2645. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  2646. messageSends: [],
  2647. referencedClasses: []
  2648. }),
  2649. smalltalk.Number);
  2650. smalltalk.addMethod(
  2651. "__slash",
  2652. smalltalk.method({
  2653. selector: "/",
  2654. category: 'arithmetic',
  2655. fn: function (aNumber) {
  2656. var self = this;
  2657. return self / aNumber;
  2658. return self;
  2659. },
  2660. args: ["aNumber"],
  2661. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  2662. messageSends: [],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.Number);
  2666. smalltalk.addMethod(
  2667. "__lt",
  2668. smalltalk.method({
  2669. selector: "<",
  2670. category: 'comparing',
  2671. fn: function (aNumber) {
  2672. var self = this;
  2673. return self < aNumber;
  2674. return self;
  2675. },
  2676. args: ["aNumber"],
  2677. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  2678. messageSends: [],
  2679. referencedClasses: []
  2680. }),
  2681. smalltalk.Number);
  2682. smalltalk.addMethod(
  2683. "__lt_eq",
  2684. smalltalk.method({
  2685. selector: "<=",
  2686. category: 'comparing',
  2687. fn: function (aNumber) {
  2688. var self = this;
  2689. return self <= aNumber;
  2690. return self;
  2691. },
  2692. args: ["aNumber"],
  2693. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  2694. messageSends: [],
  2695. referencedClasses: []
  2696. }),
  2697. smalltalk.Number);
  2698. smalltalk.addMethod(
  2699. "__eq",
  2700. smalltalk.method({
  2701. selector: "=",
  2702. category: 'comparing',
  2703. fn: function (aNumber) {
  2704. var self = this;
  2705. var $1;
  2706. $1 = smalltalk.send(aNumber, "_isNumber", []);
  2707. if (!smalltalk.assert($1)) {
  2708. return false;
  2709. }
  2710. return Number(self) == aNumber;
  2711. return self;
  2712. },
  2713. args: ["aNumber"],
  2714. source: "= aNumber\x0a\x09aNumber isNumber ifFalse: [^false]. \x0a\x09<return Number(self) == aNumber>",
  2715. messageSends: ["ifFalse:", "isNumber"],
  2716. referencedClasses: []
  2717. }),
  2718. smalltalk.Number);
  2719. smalltalk.addMethod(
  2720. "__gt",
  2721. smalltalk.method({
  2722. selector: ">",
  2723. category: 'comparing',
  2724. fn: function (aNumber) {
  2725. var self = this;
  2726. return self > aNumber;
  2727. return self;
  2728. },
  2729. args: ["aNumber"],
  2730. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  2731. messageSends: [],
  2732. referencedClasses: []
  2733. }),
  2734. smalltalk.Number);
  2735. smalltalk.addMethod(
  2736. "__gt_eq",
  2737. smalltalk.method({
  2738. selector: ">=",
  2739. category: 'comparing',
  2740. fn: function (aNumber) {
  2741. var self = this;
  2742. return self >= aNumber;
  2743. return self;
  2744. },
  2745. args: ["aNumber"],
  2746. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  2747. messageSends: [],
  2748. referencedClasses: []
  2749. }),
  2750. smalltalk.Number);
  2751. smalltalk.addMethod(
  2752. "__at",
  2753. smalltalk.method({
  2754. selector: "@",
  2755. category: 'converting',
  2756. fn: function (aNumber) {
  2757. var self = this;
  2758. var $1;
  2759. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, aNumber]);
  2760. return $1;
  2761. },
  2762. args: ["aNumber"],
  2763. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  2764. messageSends: ["x:y:"],
  2765. referencedClasses: ["Point"]
  2766. }),
  2767. smalltalk.Number);
  2768. smalltalk.addMethod(
  2769. "_\x5c\x5c",
  2770. smalltalk.method({
  2771. selector: "\x5c\x5c",
  2772. category: 'arithmetic',
  2773. fn: function (aNumber) {
  2774. var self = this;
  2775. return self % aNumber;
  2776. return self;
  2777. },
  2778. args: ["aNumber"],
  2779. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  2780. messageSends: [],
  2781. referencedClasses: []
  2782. }),
  2783. smalltalk.Number);
  2784. smalltalk.addMethod(
  2785. "_abs",
  2786. smalltalk.method({
  2787. selector: "abs",
  2788. category: 'arithmetic',
  2789. fn: function () {
  2790. var self = this;
  2791. var $1;
  2792. $1 = Math.abs(self);
  2793. return $1;
  2794. },
  2795. args: [],
  2796. source: "abs\x0a\x09^ <Math.abs(self);>",
  2797. messageSends: [],
  2798. referencedClasses: []
  2799. }),
  2800. smalltalk.Number);
  2801. smalltalk.addMethod(
  2802. "_asJSON",
  2803. smalltalk.method({
  2804. selector: "asJSON",
  2805. category: 'converting',
  2806. fn: function () {
  2807. var self = this;
  2808. return self;
  2809. },
  2810. args: [],
  2811. source: "asJSON\x0a\x09^self",
  2812. messageSends: [],
  2813. referencedClasses: []
  2814. }),
  2815. smalltalk.Number);
  2816. smalltalk.addMethod(
  2817. "_asJavascript",
  2818. smalltalk.method({
  2819. selector: "asJavascript",
  2820. category: 'converting',
  2821. fn: function () {
  2822. var self = this;
  2823. var $1;
  2824. $1 = smalltalk.send(smalltalk.send("(", "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [")"]);
  2825. return $1;
  2826. },
  2827. args: [],
  2828. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  2829. messageSends: [",", "printString"],
  2830. referencedClasses: []
  2831. }),
  2832. smalltalk.Number);
  2833. smalltalk.addMethod(
  2834. "_asPoint",
  2835. smalltalk.method({
  2836. selector: "asPoint",
  2837. category: 'converting',
  2838. fn: function () {
  2839. var self = this;
  2840. var $1;
  2841. $1 = smalltalk.send(smalltalk.Point || Point, "_x_y_", [self, self]);
  2842. return $1;
  2843. },
  2844. args: [],
  2845. source: "asPoint\x0a\x09^Point x: self y: self",
  2846. messageSends: ["x:y:"],
  2847. referencedClasses: ["Point"]
  2848. }),
  2849. smalltalk.Number);
  2850. smalltalk.addMethod(
  2851. "_asString",
  2852. smalltalk.method({
  2853. selector: "asString",
  2854. category: 'converting',
  2855. fn: function () {
  2856. var self = this;
  2857. var $1;
  2858. $1 = smalltalk.send(self, "_printString", []);
  2859. return $1;
  2860. },
  2861. args: [],
  2862. source: "asString\x0a\x09^self printString",
  2863. messageSends: ["printString"],
  2864. referencedClasses: []
  2865. }),
  2866. smalltalk.Number);
  2867. smalltalk.addMethod(
  2868. "_atRandom",
  2869. smalltalk.method({
  2870. selector: "atRandom",
  2871. category: 'converting',
  2872. fn: function () {
  2873. var self = this;
  2874. var $1;
  2875. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Random || Random, "_new", []), "_next", []), "__star", [self]), "_truncated", []), "__plus", [1]);
  2876. return $1;
  2877. },
  2878. args: [],
  2879. source: "atRandom\x0a ^(Random new next * self) truncated + 1",
  2880. messageSends: ["+", "truncated", "*", "next", "new"],
  2881. referencedClasses: ["Random"]
  2882. }),
  2883. smalltalk.Number);
  2884. smalltalk.addMethod(
  2885. "_clearInterval",
  2886. smalltalk.method({
  2887. selector: "clearInterval",
  2888. category: 'timeouts/intervals',
  2889. fn: function () {
  2890. var self = this;
  2891. clearInterval(Number(self));
  2892. return self;
  2893. },
  2894. args: [],
  2895. source: "clearInterval\x0a\x09<clearInterval(Number(self))>",
  2896. messageSends: [],
  2897. referencedClasses: []
  2898. }),
  2899. smalltalk.Number);
  2900. smalltalk.addMethod(
  2901. "_clearTimeout",
  2902. smalltalk.method({
  2903. selector: "clearTimeout",
  2904. category: 'timeouts/intervals',
  2905. fn: function () {
  2906. var self = this;
  2907. clearTimeout(Number(self));
  2908. return self;
  2909. },
  2910. args: [],
  2911. source: "clearTimeout\x0a\x09<clearTimeout(Number(self))>",
  2912. messageSends: [],
  2913. referencedClasses: []
  2914. }),
  2915. smalltalk.Number);
  2916. smalltalk.addMethod(
  2917. "_copy",
  2918. smalltalk.method({
  2919. selector: "copy",
  2920. category: 'copying',
  2921. fn: function () {
  2922. var self = this;
  2923. return self;
  2924. },
  2925. args: [],
  2926. source: "copy\x0a\x09^self",
  2927. messageSends: [],
  2928. referencedClasses: []
  2929. }),
  2930. smalltalk.Number);
  2931. smalltalk.addMethod(
  2932. "_deepCopy",
  2933. smalltalk.method({
  2934. selector: "deepCopy",
  2935. category: 'copying',
  2936. fn: function () {
  2937. var self = this;
  2938. var $1;
  2939. $1 = smalltalk.send(self, "_copy", []);
  2940. return $1;
  2941. },
  2942. args: [],
  2943. source: "deepCopy\x0a\x09^self copy",
  2944. messageSends: ["copy"],
  2945. referencedClasses: []
  2946. }),
  2947. smalltalk.Number);
  2948. smalltalk.addMethod(
  2949. "_even",
  2950. smalltalk.method({
  2951. selector: "even",
  2952. category: 'testing',
  2953. fn: function () {
  2954. var self = this;
  2955. var $1;
  2956. $1 = smalltalk.send(0, "__eq", [smalltalk.send(self, "_\\\\", [2])]);
  2957. return $1;
  2958. },
  2959. args: [],
  2960. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  2961. messageSends: ["=", "\x5c\x5c\x5c\x5c"],
  2962. referencedClasses: []
  2963. }),
  2964. smalltalk.Number);
  2965. smalltalk.addMethod(
  2966. "_identityHash",
  2967. smalltalk.method({
  2968. selector: "identityHash",
  2969. category: 'accessing',
  2970. fn: function () {
  2971. var self = this;
  2972. var $1;
  2973. $1 = smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", ["n"]);
  2974. return $1;
  2975. },
  2976. args: [],
  2977. source: "identityHash\x0a\x09^self asString, 'n'",
  2978. messageSends: [",", "asString"],
  2979. referencedClasses: []
  2980. }),
  2981. smalltalk.Number);
  2982. smalltalk.addMethod(
  2983. "_isNumber",
  2984. smalltalk.method({
  2985. selector: "isNumber",
  2986. category: 'testing',
  2987. fn: function () {
  2988. var self = this;
  2989. return true;
  2990. },
  2991. args: [],
  2992. source: "isNumber\x0a\x09^true",
  2993. messageSends: [],
  2994. referencedClasses: []
  2995. }),
  2996. smalltalk.Number);
  2997. smalltalk.addMethod(
  2998. "_isZero",
  2999. smalltalk.method({
  3000. selector: "isZero",
  3001. category: 'testing',
  3002. fn: function () {
  3003. var self = this;
  3004. var $1;
  3005. $1 = smalltalk.send(self, "__eq", [0]);
  3006. return $1;
  3007. },
  3008. args: [],
  3009. source: "isZero\x0a\x09^self = 0",
  3010. messageSends: ["="],
  3011. referencedClasses: []
  3012. }),
  3013. smalltalk.Number);
  3014. smalltalk.addMethod(
  3015. "_max_",
  3016. smalltalk.method({
  3017. selector: "max:",
  3018. category: 'arithmetic',
  3019. fn: function (aNumber) {
  3020. var self = this;
  3021. return Math.max(self, aNumber);
  3022. return self;
  3023. },
  3024. args: ["aNumber"],
  3025. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3026. messageSends: [],
  3027. referencedClasses: []
  3028. }),
  3029. smalltalk.Number);
  3030. smalltalk.addMethod(
  3031. "_min_",
  3032. smalltalk.method({
  3033. selector: "min:",
  3034. category: 'arithmetic',
  3035. fn: function (aNumber) {
  3036. var self = this;
  3037. return Math.min(self, aNumber);
  3038. return self;
  3039. },
  3040. args: ["aNumber"],
  3041. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3042. messageSends: [],
  3043. referencedClasses: []
  3044. }),
  3045. smalltalk.Number);
  3046. smalltalk.addMethod(
  3047. "_negated",
  3048. smalltalk.method({
  3049. selector: "negated",
  3050. category: 'arithmetic',
  3051. fn: function () {
  3052. var self = this;
  3053. var $1;
  3054. $1 = smalltalk.send(0, "__minus", [self]);
  3055. return $1;
  3056. },
  3057. args: [],
  3058. source: "negated\x0a\x09^0 - self",
  3059. messageSends: ["-"],
  3060. referencedClasses: []
  3061. }),
  3062. smalltalk.Number);
  3063. smalltalk.addMethod(
  3064. "_negative",
  3065. smalltalk.method({
  3066. selector: "negative",
  3067. category: 'testing',
  3068. fn: function () {
  3069. var self = this;
  3070. var $1;
  3071. $1 = smalltalk.send(self, "__lt", [0]);
  3072. return $1;
  3073. },
  3074. args: [],
  3075. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3076. messageSends: ["<"],
  3077. referencedClasses: []
  3078. }),
  3079. smalltalk.Number);
  3080. smalltalk.addMethod(
  3081. "_odd",
  3082. smalltalk.method({
  3083. selector: "odd",
  3084. category: 'testing',
  3085. fn: function () {
  3086. var self = this;
  3087. var $1;
  3088. $1 = smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  3089. return $1;
  3090. },
  3091. args: [],
  3092. source: "odd\x0a\x09^ self even not",
  3093. messageSends: ["not", "even"],
  3094. referencedClasses: []
  3095. }),
  3096. smalltalk.Number);
  3097. smalltalk.addMethod(
  3098. "_positive",
  3099. smalltalk.method({
  3100. selector: "positive",
  3101. category: 'testing',
  3102. fn: function () {
  3103. var self = this;
  3104. var $1;
  3105. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3106. return $1;
  3107. },
  3108. args: [],
  3109. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3110. messageSends: [">="],
  3111. referencedClasses: []
  3112. }),
  3113. smalltalk.Number);
  3114. smalltalk.addMethod(
  3115. "_printShowingDecimalPlaces_",
  3116. smalltalk.method({
  3117. selector: "printShowingDecimalPlaces:",
  3118. category: 'printing',
  3119. fn: function (placesDesired) {
  3120. var self = this;
  3121. return self.toFixed(placesDesired);
  3122. return self;
  3123. },
  3124. args: ["placesDesired"],
  3125. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3126. messageSends: [],
  3127. referencedClasses: []
  3128. }),
  3129. smalltalk.Number);
  3130. smalltalk.addMethod(
  3131. "_printString",
  3132. smalltalk.method({
  3133. selector: "printString",
  3134. category: 'printing',
  3135. fn: function () {
  3136. var self = this;
  3137. return String(self);
  3138. return self;
  3139. },
  3140. args: [],
  3141. source: "printString\x0a\x09<return String(self)>",
  3142. messageSends: [],
  3143. referencedClasses: []
  3144. }),
  3145. smalltalk.Number);
  3146. smalltalk.addMethod(
  3147. "_rounded",
  3148. smalltalk.method({
  3149. selector: "rounded",
  3150. category: 'converting',
  3151. fn: function () {
  3152. var self = this;
  3153. return Math.round(self);
  3154. return self;
  3155. },
  3156. args: [],
  3157. source: "rounded\x0a\x09<return Math.round(self);>",
  3158. messageSends: [],
  3159. referencedClasses: []
  3160. }),
  3161. smalltalk.Number);
  3162. smalltalk.addMethod(
  3163. "_sqrt",
  3164. smalltalk.method({
  3165. selector: "sqrt",
  3166. category: 'arithmetic',
  3167. fn: function () {
  3168. var self = this;
  3169. return Math.sqrt(self);
  3170. return self;
  3171. },
  3172. args: [],
  3173. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3174. messageSends: [],
  3175. referencedClasses: []
  3176. }),
  3177. smalltalk.Number);
  3178. smalltalk.addMethod(
  3179. "_squared",
  3180. smalltalk.method({
  3181. selector: "squared",
  3182. category: 'arithmetic',
  3183. fn: function () {
  3184. var self = this;
  3185. var $1;
  3186. $1 = smalltalk.send(self, "__star", [self]);
  3187. return $1;
  3188. },
  3189. args: [],
  3190. source: "squared\x0a\x09^self * self",
  3191. messageSends: ["*"],
  3192. referencedClasses: []
  3193. }),
  3194. smalltalk.Number);
  3195. smalltalk.addMethod(
  3196. "_timesRepeat_",
  3197. smalltalk.method({
  3198. selector: "timesRepeat:",
  3199. category: 'enumerating',
  3200. fn: function (aBlock) {
  3201. var self = this;
  3202. var integer;
  3203. var count;
  3204. integer = smalltalk.send(self, "_truncated", []);
  3205. count = 1;
  3206. smalltalk.send(function () {return smalltalk.send(count, "__gt", [self]);}, "_whileFalse_", [function () {smalltalk.send(aBlock, "_value", []);count = smalltalk.send(count, "__plus", [1]);return count;}]);
  3207. return self;
  3208. },
  3209. args: ["aBlock"],
  3210. source: "timesRepeat: aBlock\x0a\x09| integer count |\x0a\x09integer := self truncated.\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  3211. messageSends: ["truncated", "whileFalse:", "value", "+", ">"],
  3212. referencedClasses: []
  3213. }),
  3214. smalltalk.Number);
  3215. smalltalk.addMethod(
  3216. "_to_",
  3217. smalltalk.method({
  3218. selector: "to:",
  3219. category: 'converting',
  3220. fn: function (aNumber) {
  3221. var self = this;
  3222. var array;
  3223. var first;
  3224. var last;
  3225. var count;
  3226. first = smalltalk.send(self, "_truncated", []);
  3227. last = smalltalk.send(smalltalk.send(aNumber, "_truncated", []), "__plus", [1]);
  3228. count = 1;
  3229. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3230. 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;}]);
  3231. return array;
  3232. },
  3233. args: ["aNumber"],
  3234. 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",
  3235. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  3236. referencedClasses: ["Array"]
  3237. }),
  3238. smalltalk.Number);
  3239. smalltalk.addMethod(
  3240. "_to_by_",
  3241. smalltalk.method({
  3242. selector: "to:by:",
  3243. category: 'converting',
  3244. fn: function (stop, step) {
  3245. var self = this;
  3246. var $1, $2;
  3247. var array;
  3248. var value;
  3249. var pos;
  3250. value = self;
  3251. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3252. pos = 1;
  3253. $1 = smalltalk.send(step, "__eq", [0]);
  3254. if (smalltalk.assert($1)) {
  3255. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3256. }
  3257. $2 = smalltalk.send(step, "__lt", [0]);
  3258. if (smalltalk.assert($2)) {
  3259. 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;}]);
  3260. } else {
  3261. 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;}]);
  3262. }
  3263. return array;
  3264. },
  3265. args: ["stop", "step"],
  3266. 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",
  3267. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  3268. referencedClasses: ["Array"]
  3269. }),
  3270. smalltalk.Number);
  3271. smalltalk.addMethod(
  3272. "_to_by_do_",
  3273. smalltalk.method({
  3274. selector: "to:by:do:",
  3275. category: 'enumerating',
  3276. fn: function (stop, step, aBlock) {
  3277. var self = this;
  3278. var $1, $2;
  3279. var value;
  3280. value = self;
  3281. $1 = smalltalk.send(step, "__eq", [0]);
  3282. if (smalltalk.assert($1)) {
  3283. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  3284. }
  3285. $2 = smalltalk.send(step, "__lt", [0]);
  3286. if (smalltalk.assert($2)) {
  3287. 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;}]);
  3288. } else {
  3289. 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;}]);
  3290. }
  3291. return self;
  3292. },
  3293. args: ["stop", "step", "aBlock"],
  3294. 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]]",
  3295. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  3296. referencedClasses: []
  3297. }),
  3298. smalltalk.Number);
  3299. smalltalk.addMethod(
  3300. "_to_do_",
  3301. smalltalk.method({
  3302. selector: "to:do:",
  3303. category: 'enumerating',
  3304. fn: function (stop, aBlock) {
  3305. var self = this;
  3306. var nextValue;
  3307. nextValue = self;
  3308. 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;}]);
  3309. return self;
  3310. },
  3311. args: ["stop", "aBlock"],
  3312. 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]",
  3313. messageSends: ["whileTrue:", "value:", "+", "<="],
  3314. referencedClasses: []
  3315. }),
  3316. smalltalk.Number);
  3317. smalltalk.addMethod(
  3318. "_truncated",
  3319. smalltalk.method({
  3320. selector: "truncated",
  3321. category: 'converting',
  3322. fn: function () {
  3323. var self = this;
  3324. var $1;
  3325. var result;
  3326. $1 = smalltalk.send(self, "__gt_eq", [0]);
  3327. if (smalltalk.assert($1)) {
  3328. result = Math.floor(self);
  3329. } else {
  3330. result = Math.floor(self * -1) * -1;
  3331. }
  3332. return result;
  3333. },
  3334. args: [],
  3335. 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",
  3336. messageSends: ["ifTrue:ifFalse:", ">="],
  3337. referencedClasses: []
  3338. }),
  3339. smalltalk.Number);
  3340. smalltalk.addMethod(
  3341. "_|",
  3342. smalltalk.method({
  3343. selector: "|",
  3344. category: 'converting',
  3345. fn: function (aNumber) {
  3346. var self = this;
  3347. return self | aNumber;
  3348. return self;
  3349. },
  3350. args: ["aNumber"],
  3351. source: "| aNumber\x0a\x09<return self | aNumber>",
  3352. messageSends: [],
  3353. referencedClasses: []
  3354. }),
  3355. smalltalk.Number);
  3356. smalltalk.addMethod(
  3357. "_pi",
  3358. smalltalk.method({
  3359. selector: "pi",
  3360. category: 'instance creation',
  3361. fn: function () {
  3362. var self = this;
  3363. return Math.PI;
  3364. return self;
  3365. },
  3366. args: [],
  3367. source: "pi\x0a\x09<return Math.PI>",
  3368. messageSends: [],
  3369. referencedClasses: []
  3370. }),
  3371. smalltalk.Number.klass);
  3372. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  3373. smalltalk.addMethod(
  3374. "_addElement_",
  3375. smalltalk.method({
  3376. selector: "addElement:",
  3377. category: 'accessing',
  3378. fn: function (anObject) {
  3379. var self = this;
  3380. self.addElement(anObject);
  3381. return self;
  3382. },
  3383. args: ["anObject"],
  3384. source: "addElement: anObject\x0a\x09<self.addElement(anObject)>",
  3385. messageSends: [],
  3386. referencedClasses: []
  3387. }),
  3388. smalltalk.Organizer);
  3389. smalltalk.addMethod(
  3390. "_elements",
  3391. smalltalk.method({
  3392. selector: "elements",
  3393. category: 'accessing',
  3394. fn: function () {
  3395. var self = this;
  3396. var $1;
  3397. $1 = smalltalk.send(smalltalk.send(self, "_basicAt_", ["elements"]), "_copy", []);
  3398. return $1;
  3399. },
  3400. args: [],
  3401. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  3402. messageSends: ["copy", "basicAt:"],
  3403. referencedClasses: []
  3404. }),
  3405. smalltalk.Organizer);
  3406. smalltalk.addMethod(
  3407. "_removeElement_",
  3408. smalltalk.method({
  3409. selector: "removeElement:",
  3410. category: 'accessing',
  3411. fn: function (anObject) {
  3412. var self = this;
  3413. self.removeElement(anObject);
  3414. return self;
  3415. },
  3416. args: ["anObject"],
  3417. source: "removeElement: anObject\x0a\x09<self.removeElement(anObject)>",
  3418. messageSends: [],
  3419. referencedClasses: []
  3420. }),
  3421. smalltalk.Organizer);
  3422. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  3423. 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'"
  3424. smalltalk.addMethod(
  3425. "_classes",
  3426. smalltalk.method({
  3427. selector: "classes",
  3428. category: 'classes',
  3429. fn: function () {
  3430. var self = this;
  3431. var $1;
  3432. $1 = smalltalk.send(smalltalk.send(self, "_organization", []), "_elements", []);
  3433. return $1;
  3434. },
  3435. args: [],
  3436. source: "classes\x0a\x09^ self organization elements",
  3437. messageSends: ["elements", "organization"],
  3438. referencedClasses: []
  3439. }),
  3440. smalltalk.Package);
  3441. smalltalk.addMethod(
  3442. "_commitPathJs",
  3443. smalltalk.method({
  3444. selector: "commitPathJs",
  3445. category: 'accessing',
  3446. fn: function () {
  3447. var self = this;
  3448. var $1;
  3449. if (($receiver = self['@commitPathJs']) == nil ||
  3450. $receiver == undefined) {
  3451. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);
  3452. } else {
  3453. $1 = self['@commitPathJs'];
  3454. }
  3455. return $1;
  3456. },
  3457. args: [],
  3458. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  3459. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  3460. referencedClasses: []
  3461. }),
  3462. smalltalk.Package);
  3463. smalltalk.addMethod(
  3464. "_commitPathJs_",
  3465. smalltalk.method({
  3466. selector: "commitPathJs:",
  3467. category: 'accessing',
  3468. fn: function (aString) {
  3469. var self = this;
  3470. self['@commitPathJs'] = aString;
  3471. return self;
  3472. },
  3473. args: ["aString"],
  3474. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  3475. messageSends: [],
  3476. referencedClasses: []
  3477. }),
  3478. smalltalk.Package);
  3479. smalltalk.addMethod(
  3480. "_commitPathSt",
  3481. smalltalk.method({
  3482. selector: "commitPathSt",
  3483. category: 'accessing',
  3484. fn: function () {
  3485. var self = this;
  3486. var $1;
  3487. if (($receiver = self['@commitPathSt']) == nil ||
  3488. $receiver == undefined) {
  3489. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);
  3490. } else {
  3491. $1 = self['@commitPathSt'];
  3492. }
  3493. return $1;
  3494. },
  3495. args: [],
  3496. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  3497. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  3498. referencedClasses: []
  3499. }),
  3500. smalltalk.Package);
  3501. smalltalk.addMethod(
  3502. "_commitPathSt_",
  3503. smalltalk.method({
  3504. selector: "commitPathSt:",
  3505. category: 'accessing',
  3506. fn: function (aString) {
  3507. var self = this;
  3508. self['@commitPathSt'] = aString;
  3509. return self;
  3510. },
  3511. args: ["aString"],
  3512. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  3513. messageSends: [],
  3514. referencedClasses: []
  3515. }),
  3516. smalltalk.Package);
  3517. smalltalk.addMethod(
  3518. "_dependencies",
  3519. smalltalk.method({
  3520. selector: "dependencies",
  3521. category: 'accessing',
  3522. fn: function () {
  3523. var self = this;
  3524. var $1;
  3525. $1 = smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  3526. return $1;
  3527. },
  3528. args: [],
  3529. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  3530. messageSends: ["propertyAt:ifAbsent:"],
  3531. referencedClasses: []
  3532. }),
  3533. smalltalk.Package);
  3534. smalltalk.addMethod(
  3535. "_dependencies_",
  3536. smalltalk.method({
  3537. selector: "dependencies:",
  3538. category: 'accessing',
  3539. fn: function (anArray) {
  3540. var self = this;
  3541. var $1;
  3542. $1 = smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  3543. return $1;
  3544. },
  3545. args: ["anArray"],
  3546. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  3547. messageSends: ["propertyAt:put:"],
  3548. referencedClasses: []
  3549. }),
  3550. smalltalk.Package);
  3551. smalltalk.addMethod(
  3552. "_jsProperties",
  3553. smalltalk.method({
  3554. selector: "jsProperties",
  3555. category: 'private',
  3556. fn: function () {
  3557. var self = this;
  3558. return self.properties;
  3559. return self;
  3560. },
  3561. args: [],
  3562. source: "jsProperties\x0a\x09<return self.properties>",
  3563. messageSends: [],
  3564. referencedClasses: []
  3565. }),
  3566. smalltalk.Package);
  3567. smalltalk.addMethod(
  3568. "_jsProperties_",
  3569. smalltalk.method({
  3570. selector: "jsProperties:",
  3571. category: 'private',
  3572. fn: function (aJSObject) {
  3573. var self = this;
  3574. return self.properties = aJSObject;
  3575. return self;
  3576. },
  3577. args: ["aJSObject"],
  3578. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3579. messageSends: [],
  3580. referencedClasses: []
  3581. }),
  3582. smalltalk.Package);
  3583. smalltalk.addMethod(
  3584. "_name",
  3585. smalltalk.method({
  3586. selector: "name",
  3587. category: 'accessing',
  3588. fn: function () {
  3589. var self = this;
  3590. return self.pkgName;
  3591. return self;
  3592. },
  3593. args: [],
  3594. source: "name\x0a\x09<return self.pkgName>",
  3595. messageSends: [],
  3596. referencedClasses: []
  3597. }),
  3598. smalltalk.Package);
  3599. smalltalk.addMethod(
  3600. "_name_",
  3601. smalltalk.method({
  3602. selector: "name:",
  3603. category: 'accessing',
  3604. fn: function (aString) {
  3605. var self = this;
  3606. self.pkgName = aString;
  3607. return self;
  3608. },
  3609. args: ["aString"],
  3610. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3611. messageSends: [],
  3612. referencedClasses: []
  3613. }),
  3614. smalltalk.Package);
  3615. smalltalk.addMethod(
  3616. "_organization",
  3617. smalltalk.method({
  3618. selector: "organization",
  3619. category: 'accessing',
  3620. fn: function () {
  3621. var self = this;
  3622. var $1;
  3623. $1 = smalltalk.send(self, "_basicAt_", ["organization"]);
  3624. return $1;
  3625. },
  3626. args: [],
  3627. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3628. messageSends: ["basicAt:"],
  3629. referencedClasses: []
  3630. }),
  3631. smalltalk.Package);
  3632. smalltalk.addMethod(
  3633. "_printString",
  3634. smalltalk.method({
  3635. selector: "printString",
  3636. category: 'printing',
  3637. fn: function () {
  3638. var self = this;
  3639. var $1;
  3640. $1 = smalltalk.send(self, "_name", []);
  3641. return $1;
  3642. },
  3643. args: [],
  3644. source: "printString\x0a\x09^self name",
  3645. messageSends: ["name"],
  3646. referencedClasses: []
  3647. }),
  3648. smalltalk.Package);
  3649. smalltalk.addMethod(
  3650. "_properties",
  3651. smalltalk.method({
  3652. selector: "properties",
  3653. category: 'accessing',
  3654. fn: function () {
  3655. var self = this;
  3656. var $1;
  3657. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  3658. return $1;
  3659. },
  3660. args: [],
  3661. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3662. messageSends: ["readJSObject:", "basicAt:", "current"],
  3663. referencedClasses: ["Smalltalk"]
  3664. }),
  3665. smalltalk.Package);
  3666. smalltalk.addMethod(
  3667. "_properties_",
  3668. smalltalk.method({
  3669. selector: "properties:",
  3670. category: 'accessing',
  3671. fn: function (aDict) {
  3672. var self = this;
  3673. var object;
  3674. object = {};
  3675. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  3676. return self.properties = object;
  3677. return self;
  3678. },
  3679. args: ["aDict"],
  3680. 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>",
  3681. messageSends: ["keysAndValuesDo:"],
  3682. referencedClasses: []
  3683. }),
  3684. smalltalk.Package);
  3685. smalltalk.addMethod(
  3686. "_propertiesAsJSON",
  3687. smalltalk.method({
  3688. selector: "propertiesAsJSON",
  3689. category: 'private',
  3690. fn: function () {
  3691. var self = this;
  3692. return JSON.stringify(self.properties);
  3693. return self;
  3694. },
  3695. args: [],
  3696. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3697. messageSends: [],
  3698. referencedClasses: []
  3699. }),
  3700. smalltalk.Package);
  3701. smalltalk.addMethod(
  3702. "_propertyAt_",
  3703. smalltalk.method({
  3704. selector: "propertyAt:",
  3705. category: 'properties',
  3706. fn: function (key) {
  3707. var self = this;
  3708. return self.properties[key];
  3709. return self;
  3710. },
  3711. args: ["key"],
  3712. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3713. messageSends: [],
  3714. referencedClasses: []
  3715. }),
  3716. smalltalk.Package);
  3717. smalltalk.addMethod(
  3718. "_propertyAt_ifAbsent_",
  3719. smalltalk.method({
  3720. selector: "propertyAt:ifAbsent:",
  3721. category: 'properties',
  3722. fn: function (key, block) {
  3723. var self = this;
  3724. var $2, $1;
  3725. $2 = smalltalk.send(self, "_propertyAt_", [key]);
  3726. if (($receiver = $2) == nil || $receiver == undefined) {
  3727. $1 = smalltalk.send(block, "_value", []);
  3728. } else {
  3729. $1 = $2;
  3730. }
  3731. return $1;
  3732. },
  3733. args: ["key", "block"],
  3734. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3735. messageSends: ["ifNil:", "value", "propertyAt:"],
  3736. referencedClasses: []
  3737. }),
  3738. smalltalk.Package);
  3739. smalltalk.addMethod(
  3740. "_propertyAt_put_",
  3741. smalltalk.method({
  3742. selector: "propertyAt:put:",
  3743. category: 'properties',
  3744. fn: function (key, value) {
  3745. var self = this;
  3746. return self.properties[key] = value;
  3747. return self;
  3748. },
  3749. args: ["key", "value"],
  3750. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3751. messageSends: [],
  3752. referencedClasses: []
  3753. }),
  3754. smalltalk.Package);
  3755. smalltalk.addMethod(
  3756. "_sortedClasses",
  3757. smalltalk.method({
  3758. selector: "sortedClasses",
  3759. category: 'classes',
  3760. fn: function () {
  3761. var self = this;
  3762. var $1;
  3763. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  3764. return $1;
  3765. },
  3766. args: [],
  3767. 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",
  3768. messageSends: ["sortedClasses:", "classes", "class"],
  3769. referencedClasses: []
  3770. }),
  3771. smalltalk.Package);
  3772. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3773. smalltalk.addMethod(
  3774. "_commitToLocalStorage_",
  3775. smalltalk.method({
  3776. selector: "commitToLocalStorage:",
  3777. category: 'loading-storing',
  3778. fn: function (aPackageName) {
  3779. var self = this;
  3780. var key;
  3781. var sourceCode;
  3782. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  3783. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  3784. localStorage[key] = escape(sourceCode);
  3785. return self;
  3786. },
  3787. args: ["aPackageName"],
  3788. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  3789. messageSends: [",", "exportPackage:", "new"],
  3790. referencedClasses: ["Exporter"]
  3791. }),
  3792. smalltalk.Package.klass);
  3793. smalltalk.addMethod(
  3794. "_defaultCommitPathJs",
  3795. smalltalk.method({
  3796. selector: "defaultCommitPathJs",
  3797. category: 'commit paths',
  3798. fn: function () {
  3799. var self = this;
  3800. var $1;
  3801. if (($receiver = self['@defaultCommitPathJs']) == nil ||
  3802. $receiver == undefined) {
  3803. self['@defaultCommitPathJs'] = "js";
  3804. $1 = self['@defaultCommitPathJs'];
  3805. } else {
  3806. $1 = self['@defaultCommitPathJs'];
  3807. }
  3808. return $1;
  3809. },
  3810. args: [],
  3811. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3812. messageSends: ["ifNil:"],
  3813. referencedClasses: []
  3814. }),
  3815. smalltalk.Package.klass);
  3816. smalltalk.addMethod(
  3817. "_defaultCommitPathJs_",
  3818. smalltalk.method({
  3819. selector: "defaultCommitPathJs:",
  3820. category: 'commit paths',
  3821. fn: function (aString) {
  3822. var self = this;
  3823. self['@defaultCommitPathJs'] = aString;
  3824. return self;
  3825. },
  3826. args: ["aString"],
  3827. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3828. messageSends: [],
  3829. referencedClasses: []
  3830. }),
  3831. smalltalk.Package.klass);
  3832. smalltalk.addMethod(
  3833. "_defaultCommitPathSt",
  3834. smalltalk.method({
  3835. selector: "defaultCommitPathSt",
  3836. category: 'commit paths',
  3837. fn: function () {
  3838. var self = this;
  3839. var $1;
  3840. if (($receiver = self['@defaultCommitPathSt']) == nil ||
  3841. $receiver == undefined) {
  3842. self['@defaultCommitPathSt'] = "st";
  3843. $1 = self['@defaultCommitPathSt'];
  3844. } else {
  3845. $1 = self['@defaultCommitPathSt'];
  3846. }
  3847. return $1;
  3848. },
  3849. args: [],
  3850. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3851. messageSends: ["ifNil:"],
  3852. referencedClasses: []
  3853. }),
  3854. smalltalk.Package.klass);
  3855. smalltalk.addMethod(
  3856. "_defaultCommitPathSt_",
  3857. smalltalk.method({
  3858. selector: "defaultCommitPathSt:",
  3859. category: 'commit paths',
  3860. fn: function (aString) {
  3861. var self = this;
  3862. self['@defaultCommitPathSt'] = aString;
  3863. return self;
  3864. },
  3865. args: ["aString"],
  3866. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3867. messageSends: [],
  3868. referencedClasses: []
  3869. }),
  3870. smalltalk.Package.klass);
  3871. smalltalk.addMethod(
  3872. "_fetch_",
  3873. smalltalk.method({
  3874. selector: "fetch:",
  3875. category: 'loading-storing',
  3876. fn: function (aPackageName) {
  3877. var self = this;
  3878. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  3879. return self;
  3880. },
  3881. args: ["aPackageName"],
  3882. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  3883. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  3884. referencedClasses: []
  3885. }),
  3886. smalltalk.Package.klass);
  3887. smalltalk.addMethod(
  3888. "_fetch_prefix_",
  3889. smalltalk.method({
  3890. selector: "fetch:prefix:",
  3891. category: 'loading-storing',
  3892. fn: function (aPackageName, aPrefix) {
  3893. var self = this;
  3894. smalltalk.send(jQuery, "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), function () {return smalltalk.send(smalltalk.Package || Package, "_init_", [aPackageName]);}]);
  3895. return self;
  3896. },
  3897. args: ["aPackageName", "aPrefix"],
  3898. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  3899. messageSends: ["getScript:onSuccess:", ",", "init:"],
  3900. referencedClasses: ["Package"]
  3901. }),
  3902. smalltalk.Package.klass);
  3903. smalltalk.addMethod(
  3904. "_init_",
  3905. smalltalk.method({
  3906. selector: "init:",
  3907. category: 'loading-storing',
  3908. fn: function (aPackageName) {
  3909. var self = this;
  3910. var $1, $2;
  3911. $1 = smalltalk.send(smalltalk.send(smalltalk, "_classes", []), "_select_", [function (each) {return each.pkg.pkgName == aPackageName;}]);
  3912. smalltalk.send($1, "_do_", [function (each) {return smalltalk.init(each);}]);
  3913. $2 = smalltalk.send($1, "_do_", [function (each) {return smalltalk.send(each, "_initialize", []);}]);
  3914. return self;
  3915. },
  3916. args: ["aPackageName"],
  3917. 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 ]",
  3918. messageSends: ["do:", "select:", "classes", "initialize"],
  3919. referencedClasses: []
  3920. }),
  3921. smalltalk.Package.klass);
  3922. smalltalk.addMethod(
  3923. "_named_",
  3924. smalltalk.method({
  3925. selector: "named:",
  3926. category: 'not yet classified',
  3927. fn: function (aPackageName) {
  3928. var self = this;
  3929. var $1;
  3930. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  3931. return $1;
  3932. },
  3933. args: ["aPackageName"],
  3934. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3935. messageSends: ["packageAt:", "current"],
  3936. referencedClasses: ["Smalltalk"]
  3937. }),
  3938. smalltalk.Package.klass);
  3939. smalltalk.addMethod(
  3940. "_named_ifAbsent_",
  3941. smalltalk.method({
  3942. selector: "named:ifAbsent:",
  3943. category: 'not yet classified',
  3944. fn: function (aPackageName, aBlock) {
  3945. var self = this;
  3946. var $1;
  3947. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  3948. return $1;
  3949. },
  3950. args: ["aPackageName", "aBlock"],
  3951. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3952. messageSends: ["packageAt:ifAbsent:", "current"],
  3953. referencedClasses: ["Smalltalk"]
  3954. }),
  3955. smalltalk.Package.klass);
  3956. smalltalk.addMethod(
  3957. "_resetCommitPaths",
  3958. smalltalk.method({
  3959. selector: "resetCommitPaths",
  3960. category: 'commit paths',
  3961. fn: function () {
  3962. var self = this;
  3963. self['@defaultCommitPathJs'] = nil;
  3964. self['@defaultCommitPathSt'] = nil;
  3965. return self;
  3966. },
  3967. args: [],
  3968. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  3969. messageSends: [],
  3970. referencedClasses: []
  3971. }),
  3972. smalltalk.Package.klass);
  3973. smalltalk.addMethod(
  3974. "_sortedClasses_",
  3975. smalltalk.method({
  3976. selector: "sortedClasses:",
  3977. category: 'sorting',
  3978. fn: function (classes) {
  3979. var self = this;
  3980. var $1;
  3981. var children;
  3982. var others;
  3983. var nodes;
  3984. var expandedClasses;
  3985. children = [];
  3986. others = [];
  3987. 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]);}}]);
  3988. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  3989. 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", [])]);}]);
  3990. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3991. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  3992. return expandedClasses;
  3993. },
  3994. args: ["classes"],
  3995. 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",
  3996. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  3997. referencedClasses: ["ClassSorterNode", "Array"]
  3998. }),
  3999. smalltalk.Package.klass);
  4000. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4001. 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."
  4002. smalltalk.addMethod(
  4003. "__star",
  4004. smalltalk.method({
  4005. selector: "*",
  4006. category: 'arithmetic',
  4007. fn: function (aPoint) {
  4008. var self = this;
  4009. var $1;
  4010. $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", [])])]);
  4011. return $1;
  4012. },
  4013. args: ["aPoint"],
  4014. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4015. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4016. referencedClasses: ["Point"]
  4017. }),
  4018. smalltalk.Point);
  4019. smalltalk.addMethod(
  4020. "__plus",
  4021. smalltalk.method({
  4022. selector: "+",
  4023. category: 'arithmetic',
  4024. fn: function (aPoint) {
  4025. var self = this;
  4026. var $1;
  4027. $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", [])])]);
  4028. return $1;
  4029. },
  4030. args: ["aPoint"],
  4031. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4032. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4033. referencedClasses: ["Point"]
  4034. }),
  4035. smalltalk.Point);
  4036. smalltalk.addMethod(
  4037. "__minus",
  4038. smalltalk.method({
  4039. selector: "-",
  4040. category: 'arithmetic',
  4041. fn: function (aPoint) {
  4042. var self = this;
  4043. var $1;
  4044. $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", [])])]);
  4045. return $1;
  4046. },
  4047. args: ["aPoint"],
  4048. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4049. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4050. referencedClasses: ["Point"]
  4051. }),
  4052. smalltalk.Point);
  4053. smalltalk.addMethod(
  4054. "__slash",
  4055. smalltalk.method({
  4056. selector: "/",
  4057. category: 'arithmetic',
  4058. fn: function (aPoint) {
  4059. var self = this;
  4060. var $1;
  4061. $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", [])])]);
  4062. return $1;
  4063. },
  4064. args: ["aPoint"],
  4065. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4066. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4067. referencedClasses: ["Point"]
  4068. }),
  4069. smalltalk.Point);
  4070. smalltalk.addMethod(
  4071. "__eq",
  4072. smalltalk.method({
  4073. selector: "=",
  4074. category: 'arithmetic',
  4075. fn: function (aPoint) {
  4076. var self = this;
  4077. var $1;
  4078. $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", [])])]);}]);
  4079. return $1;
  4080. },
  4081. args: ["aPoint"],
  4082. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4083. messageSends: ["and:", "&", "=", "y", "x", "class"],
  4084. referencedClasses: []
  4085. }),
  4086. smalltalk.Point);
  4087. smalltalk.addMethod(
  4088. "_asPoint",
  4089. smalltalk.method({
  4090. selector: "asPoint",
  4091. category: 'converting',
  4092. fn: function () {
  4093. var self = this;
  4094. return self;
  4095. },
  4096. args: [],
  4097. source: "asPoint\x0a\x09^self",
  4098. messageSends: [],
  4099. referencedClasses: []
  4100. }),
  4101. smalltalk.Point);
  4102. smalltalk.addMethod(
  4103. "_printString",
  4104. smalltalk.method({
  4105. selector: "printString",
  4106. category: 'printing',
  4107. fn: function () {
  4108. var self = this;
  4109. var $2, $1;
  4110. $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", [])]);}]);
  4111. return $1;
  4112. },
  4113. args: [],
  4114. 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]",
  4115. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "space", "and:", "negative", "notNil"],
  4116. referencedClasses: ["String"]
  4117. }),
  4118. smalltalk.Point);
  4119. smalltalk.addMethod(
  4120. "_translateBy_",
  4121. smalltalk.method({
  4122. selector: "translateBy:",
  4123. category: 'transforming',
  4124. fn: function (delta) {
  4125. var self = this;
  4126. var $1;
  4127. $1 = smalltalk.send(smalltalk.send(smalltalk.send(delta, "_x", []), "__plus", [self['@x']]), "__at", [smalltalk.send(smalltalk.send(delta, "_y", []), "__plus", [self['@y']])]);
  4128. return $1;
  4129. },
  4130. args: ["delta"],
  4131. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4132. messageSends: ["@", "+", "y", "x"],
  4133. referencedClasses: []
  4134. }),
  4135. smalltalk.Point);
  4136. smalltalk.addMethod(
  4137. "_x",
  4138. smalltalk.method({
  4139. selector: "x",
  4140. category: 'accessing',
  4141. fn: function () {
  4142. var self = this;
  4143. return self['@x'];
  4144. },
  4145. args: [],
  4146. source: "x\x0a\x09^x",
  4147. messageSends: [],
  4148. referencedClasses: []
  4149. }),
  4150. smalltalk.Point);
  4151. smalltalk.addMethod(
  4152. "_x_",
  4153. smalltalk.method({
  4154. selector: "x:",
  4155. category: 'accessing',
  4156. fn: function (aNumber) {
  4157. var self = this;
  4158. self['@x'] = aNumber;
  4159. return self;
  4160. },
  4161. args: ["aNumber"],
  4162. source: "x: aNumber\x0a\x09x := aNumber",
  4163. messageSends: [],
  4164. referencedClasses: []
  4165. }),
  4166. smalltalk.Point);
  4167. smalltalk.addMethod(
  4168. "_y",
  4169. smalltalk.method({
  4170. selector: "y",
  4171. category: 'accessing',
  4172. fn: function () {
  4173. var self = this;
  4174. return self['@y'];
  4175. },
  4176. args: [],
  4177. source: "y\x0a\x09^y",
  4178. messageSends: [],
  4179. referencedClasses: []
  4180. }),
  4181. smalltalk.Point);
  4182. smalltalk.addMethod(
  4183. "_y_",
  4184. smalltalk.method({
  4185. selector: "y:",
  4186. category: 'accessing',
  4187. fn: function (aNumber) {
  4188. var self = this;
  4189. self['@y'] = aNumber;
  4190. return self;
  4191. },
  4192. args: ["aNumber"],
  4193. source: "y: aNumber\x0a\x09y := aNumber",
  4194. messageSends: [],
  4195. referencedClasses: []
  4196. }),
  4197. smalltalk.Point);
  4198. smalltalk.addMethod(
  4199. "_x_y_",
  4200. smalltalk.method({
  4201. selector: "x:y:",
  4202. category: 'instance creation',
  4203. fn: function (aNumber, anotherNumber) {
  4204. var self = this;
  4205. var $2, $3, $1;
  4206. $2 = smalltalk.send(self, "_new", []);
  4207. smalltalk.send($2, "_x_", [aNumber]);
  4208. smalltalk.send($2, "_y_", [anotherNumber]);
  4209. $3 = smalltalk.send($2, "_yourself", []);
  4210. $1 = $3;
  4211. return $1;
  4212. },
  4213. args: ["aNumber", "anotherNumber"],
  4214. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4215. messageSends: ["x:", "new", "y:", "yourself"],
  4216. referencedClasses: []
  4217. }),
  4218. smalltalk.Point.klass);
  4219. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4220. 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'`."
  4221. smalltalk.addMethod(
  4222. "_next",
  4223. smalltalk.method({
  4224. selector: "next",
  4225. category: 'accessing',
  4226. fn: function () {
  4227. var self = this;
  4228. return Math.random();
  4229. return self;
  4230. },
  4231. args: [],
  4232. source: "next\x0a\x09<return Math.random()>",
  4233. messageSends: [],
  4234. referencedClasses: []
  4235. }),
  4236. smalltalk.Random);
  4237. smalltalk.addMethod(
  4238. "_next_",
  4239. smalltalk.method({
  4240. selector: "next:",
  4241. category: 'accessing',
  4242. fn: function (anInteger) {
  4243. var self = this;
  4244. var $1;
  4245. $1 = smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  4246. return $1;
  4247. },
  4248. args: ["anInteger"],
  4249. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  4250. messageSends: ["collect:", "next", "to:"],
  4251. referencedClasses: []
  4252. }),
  4253. smalltalk.Random);
  4254. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  4255. 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"
  4256. smalltalk.addMethod(
  4257. "_at_",
  4258. smalltalk.method({
  4259. selector: "at:",
  4260. category: 'accessing',
  4261. fn: function (aSymbol) {
  4262. var self = this;
  4263. return self[aSymbol._asString()];
  4264. return self;
  4265. },
  4266. args: ["aSymbol"],
  4267. source: "at: aSymbol\x0a\x09<return self[aSymbol._asString()]>",
  4268. messageSends: [],
  4269. referencedClasses: []
  4270. }),
  4271. smalltalk.Smalltalk);
  4272. smalltalk.addMethod(
  4273. "_basicParse_",
  4274. smalltalk.method({
  4275. selector: "basicParse:",
  4276. category: 'accessing',
  4277. fn: function (aString) {
  4278. var self = this;
  4279. return smalltalk.parser.parse(aString);
  4280. return self;
  4281. },
  4282. args: ["aString"],
  4283. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  4284. messageSends: [],
  4285. referencedClasses: []
  4286. }),
  4287. smalltalk.Smalltalk);
  4288. smalltalk.addMethod(
  4289. "_classes",
  4290. smalltalk.method({
  4291. selector: "classes",
  4292. category: 'classes',
  4293. fn: function () {
  4294. var self = this;
  4295. return self.classes();
  4296. return self;
  4297. },
  4298. args: [],
  4299. source: "classes\x0a\x09<return self.classes()>",
  4300. messageSends: [],
  4301. referencedClasses: []
  4302. }),
  4303. smalltalk.Smalltalk);
  4304. smalltalk.addMethod(
  4305. "_createPackage_",
  4306. smalltalk.method({
  4307. selector: "createPackage:",
  4308. category: 'private',
  4309. fn: function (packageName) {
  4310. var self = this;
  4311. return smalltalk.addPackage(packageName, nil);
  4312. return self;
  4313. },
  4314. args: ["packageName"],
  4315. 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)>",
  4316. messageSends: [],
  4317. referencedClasses: []
  4318. }),
  4319. smalltalk.Smalltalk);
  4320. smalltalk.addMethod(
  4321. "_createPackage_properties_",
  4322. smalltalk.method({
  4323. selector: "createPackage:properties:",
  4324. category: 'private',
  4325. fn: function (packageName, aDict) {
  4326. var self = this;
  4327. var object;
  4328. object = {};
  4329. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  4330. return smalltalk.addPackage(packageName, object);
  4331. return self;
  4332. },
  4333. args: ["packageName", "aDict"],
  4334. 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)>",
  4335. messageSends: ["keysAndValuesDo:"],
  4336. referencedClasses: []
  4337. }),
  4338. smalltalk.Smalltalk);
  4339. smalltalk.addMethod(
  4340. "_deleteClass_",
  4341. smalltalk.method({
  4342. selector: "deleteClass:",
  4343. category: 'private',
  4344. fn: function (aClass) {
  4345. var self = this;
  4346. self.removeClass(aClass);
  4347. return self;
  4348. },
  4349. args: ["aClass"],
  4350. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a \x0a\x09<self.removeClass(aClass)>",
  4351. messageSends: [],
  4352. referencedClasses: []
  4353. }),
  4354. smalltalk.Smalltalk);
  4355. smalltalk.addMethod(
  4356. "_deletePackage_",
  4357. smalltalk.method({
  4358. selector: "deletePackage:",
  4359. category: 'private',
  4360. fn: function (packageName) {
  4361. var self = this;
  4362. delete smalltalk.packages[packageName];
  4363. return self;
  4364. },
  4365. args: ["packageName"],
  4366. 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]>",
  4367. messageSends: [],
  4368. referencedClasses: []
  4369. }),
  4370. smalltalk.Smalltalk);
  4371. smalltalk.addMethod(
  4372. "_packageAt_",
  4373. smalltalk.method({
  4374. selector: "packageAt:",
  4375. category: 'packages',
  4376. fn: function (packageName) {
  4377. var self = this;
  4378. return self.packages[packageName];
  4379. return self;
  4380. },
  4381. args: ["packageName"],
  4382. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  4383. messageSends: [],
  4384. referencedClasses: []
  4385. }),
  4386. smalltalk.Smalltalk);
  4387. smalltalk.addMethod(
  4388. "_packageAt_ifAbsent_",
  4389. smalltalk.method({
  4390. selector: "packageAt:ifAbsent:",
  4391. category: 'packages',
  4392. fn: function (packageName, aBlock) {
  4393. var self = this;
  4394. var $2, $1;
  4395. $2 = smalltalk.send(self, "_packageAt_", [packageName]);
  4396. $1 = smalltalk.send($2, "_ifNil_", [aBlock]);
  4397. return $1;
  4398. },
  4399. args: ["packageName", "aBlock"],
  4400. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  4401. messageSends: ["ifNil:", "packageAt:"],
  4402. referencedClasses: []
  4403. }),
  4404. smalltalk.Smalltalk);
  4405. smalltalk.addMethod(
  4406. "_packages",
  4407. smalltalk.method({
  4408. selector: "packages",
  4409. category: 'packages',
  4410. fn: function () {
  4411. var self = this;
  4412. return self.packages.all();
  4413. return self;
  4414. },
  4415. args: [],
  4416. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  4417. messageSends: [],
  4418. referencedClasses: []
  4419. }),
  4420. smalltalk.Smalltalk);
  4421. smalltalk.addMethod(
  4422. "_parse_",
  4423. smalltalk.method({
  4424. selector: "parse:",
  4425. category: 'accessing',
  4426. fn: function (aString) {
  4427. var self = this;
  4428. var result;
  4429. 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", []);}]);
  4430. return result;
  4431. },
  4432. args: ["aString"],
  4433. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  4434. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  4435. referencedClasses: []
  4436. }),
  4437. smalltalk.Smalltalk);
  4438. smalltalk.addMethod(
  4439. "_parseError_parsing_",
  4440. smalltalk.method({
  4441. selector: "parseError:parsing:",
  4442. category: 'accessing',
  4443. fn: function (anException, aString) {
  4444. var self = this;
  4445. var $1;
  4446. var row;
  4447. var col;
  4448. var message;
  4449. var lines;
  4450. var badLine;
  4451. var code;
  4452. row = anException.line;
  4453. col = anException.column;
  4454. message = anException.message;
  4455. lines = smalltalk.send(aString, "_lines", []);
  4456. badLine = smalltalk.send(lines, "_at_", [row]);
  4457. 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", [])])]);
  4458. smalltalk.send(lines, "_at_put_", [row, badLine]);
  4459. 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", [])])]);}]);}]);
  4460. $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])]);
  4461. return $1;
  4462. },
  4463. args: ["anException", "aString"],
  4464. 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)",
  4465. messageSends: ["lines", "at:", ",", "copyFrom:to:", "size", "-", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "lf", "asString", "messageText:", "new"],
  4466. referencedClasses: ["String", "ParseError"]
  4467. }),
  4468. smalltalk.Smalltalk);
  4469. smalltalk.addMethod(
  4470. "_pseudoVariableNames",
  4471. smalltalk.method({
  4472. selector: "pseudoVariableNames",
  4473. category: 'packages',
  4474. fn: function () {
  4475. var self = this;
  4476. return ["self", "super", "nil", "true", "false", "thisContext"];
  4477. },
  4478. args: [],
  4479. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  4480. messageSends: [],
  4481. referencedClasses: []
  4482. }),
  4483. smalltalk.Smalltalk);
  4484. smalltalk.addMethod(
  4485. "_readJSObject_",
  4486. smalltalk.method({
  4487. selector: "readJSObject:",
  4488. category: 'accessing',
  4489. fn: function (anObject) {
  4490. var self = this;
  4491. return self.readJSObject(anObject);
  4492. return self;
  4493. },
  4494. args: ["anObject"],
  4495. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  4496. messageSends: [],
  4497. referencedClasses: []
  4498. }),
  4499. smalltalk.Smalltalk);
  4500. smalltalk.addMethod(
  4501. "_removeClass_",
  4502. smalltalk.method({
  4503. selector: "removeClass:",
  4504. category: 'classes',
  4505. fn: function (aClass) {
  4506. var self = this;
  4507. var $1, $2, $3;
  4508. $1 = smalltalk.send(aClass, "_isMetaclass", []);
  4509. if (smalltalk.assert($1)) {
  4510. smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);
  4511. }
  4512. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  4513. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  4514. smalltalk.send(self, "_deleteClass_", [aClass]);
  4515. $2 = smalltalk.send(smalltalk.ClassRemoved || ClassRemoved, "_new", []);
  4516. smalltalk.send($2, "_theClass_", [aClass]);
  4517. $3 = smalltalk.send($2, "_yourself", []);
  4518. smalltalk.send(smalltalk.send(smalltalk.SystemAnnouncer || SystemAnnouncer, "_current", []), "_announce_", [$3]);
  4519. return self;
  4520. },
  4521. args: ["aClass"],
  4522. 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)",
  4523. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "do:", "removeCompiledMethod:", "values", "methodDictionary", "class", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  4524. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  4525. }),
  4526. smalltalk.Smalltalk);
  4527. smalltalk.addMethod(
  4528. "_removePackage_",
  4529. smalltalk.method({
  4530. selector: "removePackage:",
  4531. category: 'packages',
  4532. fn: function (packageName) {
  4533. var self = this;
  4534. var pkg;
  4535. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4536. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  4537. smalltalk.send(self, "_deletePackage_", [packageName]);
  4538. return self;
  4539. },
  4540. args: ["packageName"],
  4541. 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",
  4542. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4543. referencedClasses: []
  4544. }),
  4545. smalltalk.Smalltalk);
  4546. smalltalk.addMethod(
  4547. "_renamePackage_to_",
  4548. smalltalk.method({
  4549. selector: "renamePackage:to:",
  4550. category: 'packages',
  4551. fn: function (packageName, newName) {
  4552. var self = this;
  4553. var $1;
  4554. var pkg;
  4555. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4556. $1 = smalltalk.send(self, "_packageAt_", [newName]);
  4557. if (($receiver = $1) == nil || $receiver == undefined) {
  4558. } else {
  4559. smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);
  4560. }
  4561. smalltalk.packages[newName] = smalltalk.packages[packageName];
  4562. smalltalk.send(pkg, "_name_", [newName]);
  4563. smalltalk.send(self, "_deletePackage_", [packageName]);
  4564. return self;
  4565. },
  4566. args: ["packageName", "newName"],
  4567. 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.",
  4568. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  4569. referencedClasses: []
  4570. }),
  4571. smalltalk.Smalltalk);
  4572. smalltalk.addMethod(
  4573. "_reservedWords",
  4574. smalltalk.method({
  4575. selector: "reservedWords",
  4576. category: 'accessing',
  4577. fn: function () {
  4578. var self = this;
  4579. return self.reservedWords;
  4580. return self;
  4581. },
  4582. args: [],
  4583. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4584. messageSends: [],
  4585. referencedClasses: []
  4586. }),
  4587. smalltalk.Smalltalk);
  4588. smalltalk.addMethod(
  4589. "_send_to_arguments_",
  4590. smalltalk.method({
  4591. selector: "send:to:arguments:",
  4592. category: 'accessing',
  4593. fn: function (aSelector, anObject, aCollection) {
  4594. var self = this;
  4595. var selector;
  4596. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  4597. return self.send(anObject, selector, aCollection);
  4598. return self;
  4599. },
  4600. args: ["aSelector", "anObject", "aCollection"],
  4601. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<return self.send(anObject, selector, aCollection)>",
  4602. messageSends: ["asSelector", "asString"],
  4603. referencedClasses: []
  4604. }),
  4605. smalltalk.Smalltalk);
  4606. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4607. smalltalk.addMethod(
  4608. "_current",
  4609. smalltalk.method({
  4610. selector: "current",
  4611. category: 'accessing',
  4612. fn: function () {
  4613. var self = this;
  4614. return smalltalk;
  4615. return self;
  4616. },
  4617. args: [],
  4618. source: "current\x0a\x09<return smalltalk>",
  4619. messageSends: [],
  4620. referencedClasses: []
  4621. }),
  4622. smalltalk.Smalltalk.klass);
  4623. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4624. 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."
  4625. smalltalk.addMethod(
  4626. "_asJSON",
  4627. smalltalk.method({
  4628. selector: "asJSON",
  4629. category: 'converting',
  4630. fn: function () {
  4631. var self = this;
  4632. return null;
  4633. },
  4634. args: [],
  4635. source: "asJSON\x0a\x09^null",
  4636. messageSends: [],
  4637. referencedClasses: []
  4638. }),
  4639. smalltalk.UndefinedObject);
  4640. smalltalk.addMethod(
  4641. "_deepCopy",
  4642. smalltalk.method({
  4643. selector: "deepCopy",
  4644. category: 'copying',
  4645. fn: function () {
  4646. var self = this;
  4647. return self;
  4648. },
  4649. args: [],
  4650. source: "deepCopy\x0a\x09^self",
  4651. messageSends: [],
  4652. referencedClasses: []
  4653. }),
  4654. smalltalk.UndefinedObject);
  4655. smalltalk.addMethod(
  4656. "_ifNil_",
  4657. smalltalk.method({
  4658. selector: "ifNil:",
  4659. category: 'testing',
  4660. fn: function (aBlock) {
  4661. var self = this;
  4662. var $1;
  4663. $1 = smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {}]);
  4664. return $1;
  4665. },
  4666. args: ["aBlock"],
  4667. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4668. messageSends: ["ifNil:ifNotNil:"],
  4669. referencedClasses: []
  4670. }),
  4671. smalltalk.UndefinedObject);
  4672. smalltalk.addMethod(
  4673. "_ifNil_ifNotNil_",
  4674. smalltalk.method({
  4675. selector: "ifNil:ifNotNil:",
  4676. category: 'testing',
  4677. fn: function (aBlock, anotherBlock) {
  4678. var self = this;
  4679. var $1;
  4680. $1 = smalltalk.send(aBlock, "_value", []);
  4681. return $1;
  4682. },
  4683. args: ["aBlock", "anotherBlock"],
  4684. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4685. messageSends: ["value"],
  4686. referencedClasses: []
  4687. }),
  4688. smalltalk.UndefinedObject);
  4689. smalltalk.addMethod(
  4690. "_ifNotNil_",
  4691. smalltalk.method({
  4692. selector: "ifNotNil:",
  4693. category: 'testing',
  4694. fn: function (aBlock) {
  4695. var self = this;
  4696. return self;
  4697. },
  4698. args: ["aBlock"],
  4699. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4700. messageSends: [],
  4701. referencedClasses: []
  4702. }),
  4703. smalltalk.UndefinedObject);
  4704. smalltalk.addMethod(
  4705. "_ifNotNil_ifNil_",
  4706. smalltalk.method({
  4707. selector: "ifNotNil:ifNil:",
  4708. category: 'testing',
  4709. fn: function (aBlock, anotherBlock) {
  4710. var self = this;
  4711. var $1;
  4712. $1 = smalltalk.send(anotherBlock, "_value", []);
  4713. return $1;
  4714. },
  4715. args: ["aBlock", "anotherBlock"],
  4716. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4717. messageSends: ["value"],
  4718. referencedClasses: []
  4719. }),
  4720. smalltalk.UndefinedObject);
  4721. smalltalk.addMethod(
  4722. "_isNil",
  4723. smalltalk.method({
  4724. selector: "isNil",
  4725. category: 'testing',
  4726. fn: function () {
  4727. var self = this;
  4728. return true;
  4729. },
  4730. args: [],
  4731. source: "isNil\x0a\x09^true",
  4732. messageSends: [],
  4733. referencedClasses: []
  4734. }),
  4735. smalltalk.UndefinedObject);
  4736. smalltalk.addMethod(
  4737. "_notNil",
  4738. smalltalk.method({
  4739. selector: "notNil",
  4740. category: 'testing',
  4741. fn: function () {
  4742. var self = this;
  4743. return false;
  4744. },
  4745. args: [],
  4746. source: "notNil\x0a\x09^false",
  4747. messageSends: [],
  4748. referencedClasses: []
  4749. }),
  4750. smalltalk.UndefinedObject);
  4751. smalltalk.addMethod(
  4752. "_printString",
  4753. smalltalk.method({
  4754. selector: "printString",
  4755. category: 'printing',
  4756. fn: function () {
  4757. var self = this;
  4758. return "nil";
  4759. },
  4760. args: [],
  4761. source: "printString\x0a ^'nil'",
  4762. messageSends: [],
  4763. referencedClasses: []
  4764. }),
  4765. smalltalk.UndefinedObject);
  4766. smalltalk.addMethod(
  4767. "_shallowCopy",
  4768. smalltalk.method({
  4769. selector: "shallowCopy",
  4770. category: 'copying',
  4771. fn: function () {
  4772. var self = this;
  4773. return self;
  4774. },
  4775. args: [],
  4776. source: "shallowCopy\x0a\x09^self",
  4777. messageSends: [],
  4778. referencedClasses: []
  4779. }),
  4780. smalltalk.UndefinedObject);
  4781. smalltalk.addMethod(
  4782. "_subclass_instanceVariableNames_",
  4783. smalltalk.method({
  4784. selector: "subclass:instanceVariableNames:",
  4785. category: 'class creation',
  4786. fn: function (aString, anotherString) {
  4787. var self = this;
  4788. var $1;
  4789. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4790. return $1;
  4791. },
  4792. args: ["aString", "anotherString"],
  4793. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4794. messageSends: ["subclass:instanceVariableNames:package:"],
  4795. referencedClasses: []
  4796. }),
  4797. smalltalk.UndefinedObject);
  4798. smalltalk.addMethod(
  4799. "_subclass_instanceVariableNames_category_",
  4800. smalltalk.method({
  4801. selector: "subclass:instanceVariableNames:category:",
  4802. category: 'class creation',
  4803. fn: function (aString, aString2, aString3) {
  4804. var self = this;
  4805. var $1;
  4806. smalltalk.send(self, "_deprecatedAPI", []);
  4807. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4808. return $1;
  4809. },
  4810. args: ["aString", "aString2", "aString3"],
  4811. 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",
  4812. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4813. referencedClasses: []
  4814. }),
  4815. smalltalk.UndefinedObject);
  4816. smalltalk.addMethod(
  4817. "_subclass_instanceVariableNames_package_",
  4818. smalltalk.method({
  4819. selector: "subclass:instanceVariableNames:package:",
  4820. category: 'class creation',
  4821. fn: function (aString, aString2, aString3) {
  4822. var self = this;
  4823. var $1;
  4824. $1 = smalltalk.send(smalltalk.send(smalltalk.ClassBuilder || ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
  4825. return $1;
  4826. },
  4827. args: ["aString", "aString2", "aString3"],
  4828. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString instanceVariableNames: aString2 package: aString3",
  4829. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new"],
  4830. referencedClasses: ["ClassBuilder"]
  4831. }),
  4832. smalltalk.UndefinedObject);
  4833. smalltalk.addMethod(
  4834. "_new",
  4835. smalltalk.method({
  4836. selector: "new",
  4837. category: 'instance creation',
  4838. fn: function () {
  4839. var self = this;
  4840. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  4841. return self;
  4842. },
  4843. args: [],
  4844. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4845. messageSends: ["error:"],
  4846. referencedClasses: []
  4847. }),
  4848. smalltalk.UndefinedObject.klass);
  4849. smalltalk.addPackage('Kernel-Classes', {});
  4850. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  4851. 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."
  4852. smalltalk.addMethod(
  4853. "_addCompiledMethod_",
  4854. smalltalk.method({
  4855. selector: "addCompiledMethod:",
  4856. category: 'compiling',
  4857. fn: function (aMethod){
  4858. var self=this;
  4859. var $1,$2;
  4860. smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  4861. ;
  4862. $1=smalltalk.send((smalltalk.MethodAdded || MethodAdded),"_new",[]);
  4863. smalltalk.send($1,"_theClass_",[self]);
  4864. smalltalk.send($1,"_method_",[aMethod]);
  4865. $2=smalltalk.send($1,"_yourself",[]);
  4866. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  4867. return self},
  4868. args: ["aMethod"],
  4869. 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)",
  4870. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  4871. referencedClasses: ["MethodAdded", "SystemAnnouncer"]
  4872. }),
  4873. smalltalk.Behavior);
  4874. smalltalk.addMethod(
  4875. "_allInstanceVariableNames",
  4876. smalltalk.method({
  4877. selector: "allInstanceVariableNames",
  4878. category: 'accessing',
  4879. fn: function (){
  4880. var self=this;
  4881. var $1;
  4882. var result;
  4883. result=smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_copy",[]);
  4884. $1=smalltalk.send(self,"_superclass",[]);
  4885. if(($receiver = $1) == nil || $receiver == undefined){
  4886. $1;
  4887. } else {
  4888. smalltalk.send(result,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allInstanceVariableNames",[])]);
  4889. };
  4890. return result;
  4891. },
  4892. args: [],
  4893. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  4894. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  4895. referencedClasses: []
  4896. }),
  4897. smalltalk.Behavior);
  4898. smalltalk.addMethod(
  4899. "_allSubclasses",
  4900. smalltalk.method({
  4901. selector: "allSubclasses",
  4902. category: 'accessing',
  4903. fn: function (){
  4904. var self=this;
  4905. var result;
  4906. result=smalltalk.send(self,"_subclasses",[]);
  4907. smalltalk.send(smalltalk.send(self,"_subclasses",[]),"_do_",[(function(each){
  4908. return smalltalk.send(result,"_addAll_",[smalltalk.send(each,"_allSubclasses",[])]);
  4909. })]);
  4910. return result;
  4911. },
  4912. args: [],
  4913. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  4914. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  4915. referencedClasses: []
  4916. }),
  4917. smalltalk.Behavior);
  4918. smalltalk.addMethod(
  4919. "_allSuperclasses",
  4920. smalltalk.method({
  4921. selector: "allSuperclasses",
  4922. category: 'accessing',
  4923. fn: function (){
  4924. var self=this;
  4925. var $1,$3,$4,$2;
  4926. $1=smalltalk.send(self,"_superclass",[]);
  4927. if(($receiver = $1) == nil || $receiver == undefined){
  4928. return [];
  4929. } else {
  4930. $1;
  4931. };
  4932. $3=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_with_",[smalltalk.send(self,"_superclass",[])]);
  4933. smalltalk.send($3,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allSuperclasses",[])]);
  4934. $4=smalltalk.send($3,"_yourself",[]);
  4935. $2=$4;
  4936. return $2;
  4937. },
  4938. args: [],
  4939. source: "allSuperclasses\x0a\x09\x0a self superclass ifNil: [ ^ #() ].\x0a \x0a\x09^ (OrderedCollection with: self superclass) \x0a \x09addAll: self superclass allSuperclasses;\x0a yourself",
  4940. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  4941. referencedClasses: ["OrderedCollection"]
  4942. }),
  4943. smalltalk.Behavior);
  4944. smalltalk.addMethod(
  4945. "_basicNew",
  4946. smalltalk.method({
  4947. selector: "basicNew",
  4948. category: 'instance creation',
  4949. fn: function (){
  4950. var self=this;
  4951. return new self.fn();
  4952. ;
  4953. return self},
  4954. args: [],
  4955. source: "basicNew\x0a\x09<return new self.fn()>",
  4956. messageSends: [],
  4957. referencedClasses: []
  4958. }),
  4959. smalltalk.Behavior);
  4960. smalltalk.addMethod(
  4961. "_canUnderstand_",
  4962. smalltalk.method({
  4963. selector: "canUnderstand:",
  4964. category: 'testing',
  4965. fn: function (aSelector){
  4966. var self=this;
  4967. var $1;
  4968. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]),"_includes_",[smalltalk.send(aSelector,"_asString",[])]),"_or_",[(function(){
  4969. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_superclass",[]),"_notNil",[]),"_and_",[(function(){
  4970. return smalltalk.send(smalltalk.send(self,"_superclass",[]),"_canUnderstand_",[aSelector]);
  4971. })]);
  4972. })]);
  4973. return $1;
  4974. },
  4975. args: ["aSelector"],
  4976. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  4977. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  4978. referencedClasses: []
  4979. }),
  4980. smalltalk.Behavior);
  4981. smalltalk.addMethod(
  4982. "_comment",
  4983. smalltalk.method({
  4984. selector: "comment",
  4985. category: 'accessing',
  4986. fn: function (){
  4987. var self=this;
  4988. var $2,$1;
  4989. $2=smalltalk.send(self,"_basicAt_",["comment"]);
  4990. if(($receiver = $2) == nil || $receiver == undefined){
  4991. $1="";
  4992. } else {
  4993. $1=$2;
  4994. };
  4995. return $1;
  4996. },
  4997. args: [],
  4998. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  4999. messageSends: ["ifNil:", "basicAt:"],
  5000. referencedClasses: []
  5001. }),
  5002. smalltalk.Behavior);
  5003. smalltalk.addMethod(
  5004. "_comment_",
  5005. smalltalk.method({
  5006. selector: "comment:",
  5007. category: 'accessing',
  5008. fn: function (aString){
  5009. var self=this;
  5010. var $1,$2;
  5011. smalltalk.send(self,"_basicAt_put_",["comment",aString]);
  5012. $1=smalltalk.send((smalltalk.ClassCommentChanged || ClassCommentChanged),"_new",[]);
  5013. smalltalk.send($1,"_theClass_",[self]);
  5014. $2=smalltalk.send($1,"_yourself",[]);
  5015. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5016. return self},
  5017. args: ["aString"],
  5018. source: "comment: aString\x0a self basicAt: 'comment' put: aString.\x0a SystemAnnouncer current\x0a \x09announce: (ClassCommentChanged new\x0a \x09theClass: self;\x0a yourself)",
  5019. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  5020. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  5021. }),
  5022. smalltalk.Behavior);
  5023. smalltalk.addMethod(
  5024. "_commentStamp",
  5025. smalltalk.method({
  5026. selector: "commentStamp",
  5027. category: 'accessing',
  5028. fn: function (){
  5029. var self=this;
  5030. var $2,$3,$1;
  5031. $2=smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader),"_new",[]);
  5032. smalltalk.send($2,"_class_",[self]);
  5033. $3=smalltalk.send($2,"_yourself",[]);
  5034. $1=$3;
  5035. return $1;
  5036. },
  5037. args: [],
  5038. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5039. messageSends: ["class:", "new", "yourself"],
  5040. referencedClasses: ["ClassCommentReader"]
  5041. }),
  5042. smalltalk.Behavior);
  5043. smalltalk.addMethod(
  5044. "_commentStamp_prior_",
  5045. smalltalk.method({
  5046. selector: "commentStamp:prior:",
  5047. category: 'accessing',
  5048. fn: function (aStamp,prior){
  5049. var self=this;
  5050. var $1;
  5051. $1=smalltalk.send(self,"_commentStamp",[]);
  5052. return $1;
  5053. },
  5054. args: ["aStamp", "prior"],
  5055. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  5056. messageSends: ["commentStamp"],
  5057. referencedClasses: []
  5058. }),
  5059. smalltalk.Behavior);
  5060. smalltalk.addMethod(
  5061. "_compile_",
  5062. smalltalk.method({
  5063. selector: "compile:",
  5064. category: 'compiling',
  5065. fn: function (aString){
  5066. var self=this;
  5067. smalltalk.send(self,"_compile_category_",[aString,""]);
  5068. return self},
  5069. args: ["aString"],
  5070. source: "compile: aString\x0a\x09self compile: aString category: ''",
  5071. messageSends: ["compile:category:"],
  5072. referencedClasses: []
  5073. }),
  5074. smalltalk.Behavior);
  5075. smalltalk.addMethod(
  5076. "_compile_category_",
  5077. smalltalk.method({
  5078. selector: "compile:category:",
  5079. category: 'compiling',
  5080. fn: function (aString,anotherString){
  5081. var self=this;
  5082. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self,anotherString]);
  5083. return self},
  5084. args: ["aString", "anotherString"],
  5085. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString \x0a forClass: self \x0a category: anotherString",
  5086. messageSends: ["install:forClass:category:", "new"],
  5087. referencedClasses: ["Compiler"]
  5088. }),
  5089. smalltalk.Behavior);
  5090. smalltalk.addMethod(
  5091. "_definition",
  5092. smalltalk.method({
  5093. selector: "definition",
  5094. category: 'accessing',
  5095. fn: function (){
  5096. var self=this;
  5097. return "";
  5098. },
  5099. args: [],
  5100. source: "definition\x0a\x09^ ''",
  5101. messageSends: [],
  5102. referencedClasses: []
  5103. }),
  5104. smalltalk.Behavior);
  5105. smalltalk.addMethod(
  5106. "_inheritsFrom_",
  5107. smalltalk.method({
  5108. selector: "inheritsFrom:",
  5109. category: 'testing',
  5110. fn: function (aClass){
  5111. var self=this;
  5112. var $1;
  5113. $1=smalltalk.send(smalltalk.send(aClass,"_allSubclasses",[]),"_includes_",[self]);
  5114. return $1;
  5115. },
  5116. args: ["aClass"],
  5117. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  5118. messageSends: ["includes:", "allSubclasses"],
  5119. referencedClasses: []
  5120. }),
  5121. smalltalk.Behavior);
  5122. smalltalk.addMethod(
  5123. "_instanceVariableNames",
  5124. smalltalk.method({
  5125. selector: "instanceVariableNames",
  5126. category: 'accessing',
  5127. fn: function (){
  5128. var self=this;
  5129. return self.iVarNames;
  5130. ;
  5131. return self},
  5132. args: [],
  5133. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5134. messageSends: [],
  5135. referencedClasses: []
  5136. }),
  5137. smalltalk.Behavior);
  5138. smalltalk.addMethod(
  5139. "_methodAt_",
  5140. smalltalk.method({
  5141. selector: "methodAt:",
  5142. category: 'accessing',
  5143. fn: function (aSymbol){
  5144. var self=this;
  5145. return smalltalk.methods(self)[aSymbol._asString()];
  5146. ;
  5147. return self},
  5148. args: ["aSymbol"],
  5149. source: "methodAt: aSymbol\x0a\x09<return smalltalk.methods(self)[aSymbol._asString()]>",
  5150. messageSends: [],
  5151. referencedClasses: []
  5152. }),
  5153. smalltalk.Behavior);
  5154. smalltalk.addMethod(
  5155. "_methodDictionary",
  5156. smalltalk.method({
  5157. selector: "methodDictionary",
  5158. category: 'accessing',
  5159. fn: function (){
  5160. var self=this;
  5161. var dict = smalltalk.HashedCollection._new();
  5162. var methods = self.fn.prototype.methods;
  5163. for(var i in methods) {
  5164. if(methods[i].selector) {
  5165. dict._at_put_(methods[i].selector, methods[i]);
  5166. }
  5167. };
  5168. return dict;
  5169. ;
  5170. return self},
  5171. args: [],
  5172. 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>",
  5173. messageSends: [],
  5174. referencedClasses: []
  5175. }),
  5176. smalltalk.Behavior);
  5177. smalltalk.addMethod(
  5178. "_methods",
  5179. smalltalk.method({
  5180. selector: "methods",
  5181. category: 'accessing',
  5182. fn: function (){
  5183. var self=this;
  5184. var $1;
  5185. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]);
  5186. return $1;
  5187. },
  5188. args: [],
  5189. source: "methods\x0a\x09^ self methodDictionary values",
  5190. messageSends: ["values", "methodDictionary"],
  5191. referencedClasses: []
  5192. }),
  5193. smalltalk.Behavior);
  5194. smalltalk.addMethod(
  5195. "_methodsFor_",
  5196. smalltalk.method({
  5197. selector: "methodsFor:",
  5198. category: 'accessing',
  5199. fn: function (aString){
  5200. var self=this;
  5201. var $2,$3,$1;
  5202. $2=smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader),"_new",[]);
  5203. smalltalk.send($2,"_class_category_",[self,aString]);
  5204. $3=smalltalk.send($2,"_yourself",[]);
  5205. $1=$3;
  5206. return $1;
  5207. },
  5208. args: ["aString"],
  5209. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  5210. messageSends: ["class:category:", "new", "yourself"],
  5211. referencedClasses: ["ClassCategoryReader"]
  5212. }),
  5213. smalltalk.Behavior);
  5214. smalltalk.addMethod(
  5215. "_methodsFor_stamp_",
  5216. smalltalk.method({
  5217. selector: "methodsFor:stamp:",
  5218. category: 'accessing',
  5219. fn: function (aString,aStamp){
  5220. var self=this;
  5221. var $1;
  5222. $1=smalltalk.send(self,"_methodsFor_",[aString]);
  5223. return $1;
  5224. },
  5225. args: ["aString", "aStamp"],
  5226. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  5227. messageSends: ["methodsFor:"],
  5228. referencedClasses: []
  5229. }),
  5230. smalltalk.Behavior);
  5231. smalltalk.addMethod(
  5232. "_methodsInProtocol_",
  5233. smalltalk.method({
  5234. selector: "methodsInProtocol:",
  5235. category: 'accessing',
  5236. fn: function (aString){
  5237. var self=this;
  5238. var $1;
  5239. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_select_",[(function(each){
  5240. return smalltalk.send(smalltalk.send(each,"_protocol",[]),"__eq",[aString]);
  5241. })]);
  5242. return $1;
  5243. },
  5244. args: ["aString"],
  5245. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  5246. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  5247. referencedClasses: []
  5248. }),
  5249. smalltalk.Behavior);
  5250. smalltalk.addMethod(
  5251. "_name",
  5252. smalltalk.method({
  5253. selector: "name",
  5254. category: 'accessing',
  5255. fn: function (){
  5256. var self=this;
  5257. return self.className || nil;
  5258. ;
  5259. return self},
  5260. args: [],
  5261. source: "name\x0a\x09<return self.className || nil>",
  5262. messageSends: [],
  5263. referencedClasses: []
  5264. }),
  5265. smalltalk.Behavior);
  5266. smalltalk.addMethod(
  5267. "_new",
  5268. smalltalk.method({
  5269. selector: "new",
  5270. category: 'instance creation',
  5271. fn: function (){
  5272. var self=this;
  5273. var $1;
  5274. $1=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  5275. return $1;
  5276. },
  5277. args: [],
  5278. source: "new\x0a\x09^self basicNew initialize",
  5279. messageSends: ["initialize", "basicNew"],
  5280. referencedClasses: []
  5281. }),
  5282. smalltalk.Behavior);
  5283. smalltalk.addMethod(
  5284. "_organization",
  5285. smalltalk.method({
  5286. selector: "organization",
  5287. category: 'accessing',
  5288. fn: function (){
  5289. var self=this;
  5290. var $1;
  5291. $1=smalltalk.send(self,"_basicAt_",["organization"]);
  5292. return $1;
  5293. },
  5294. args: [],
  5295. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5296. messageSends: ["basicAt:"],
  5297. referencedClasses: []
  5298. }),
  5299. smalltalk.Behavior);
  5300. smalltalk.addMethod(
  5301. "_protocols",
  5302. smalltalk.method({
  5303. selector: "protocols",
  5304. category: 'accessing',
  5305. fn: function (){
  5306. var self=this;
  5307. var $1;
  5308. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_organization",[]),"_elements",[]),"_sorted",[]);
  5309. return $1;
  5310. },
  5311. args: [],
  5312. source: "protocols\x0a ^ self organization elements sorted",
  5313. messageSends: ["sorted", "elements", "organization"],
  5314. referencedClasses: []
  5315. }),
  5316. smalltalk.Behavior);
  5317. smalltalk.addMethod(
  5318. "_protocolsDo_",
  5319. smalltalk.method({
  5320. selector: "protocolsDo:",
  5321. category: 'accessing',
  5322. fn: function (aBlock){
  5323. var self=this;
  5324. var methodsByCategory;
  5325. methodsByCategory=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  5326. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_values",[]),"_do_",[(function(m){
  5327. return smalltalk.send(smalltalk.send(methodsByCategory,"_at_ifAbsentPut_",[smalltalk.send(m,"_category",[]),(function(){
  5328. return smalltalk.send((smalltalk.Array || Array),"_new",[]);
  5329. })]),"_add_",[m]);
  5330. })]);
  5331. smalltalk.send(smalltalk.send(self,"_protocols",[]),"_do_",[(function(category){
  5332. return smalltalk.send(aBlock,"_value_value_",[category,smalltalk.send(methodsByCategory,"_at_",[category])]);
  5333. })]);
  5334. return self},
  5335. args: ["aBlock"],
  5336. 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)]",
  5337. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  5338. referencedClasses: ["HashedCollection", "Array"]
  5339. }),
  5340. smalltalk.Behavior);
  5341. smalltalk.addMethod(
  5342. "_prototype",
  5343. smalltalk.method({
  5344. selector: "prototype",
  5345. category: 'accessing',
  5346. fn: function (){
  5347. var self=this;
  5348. return self.fn.prototype;
  5349. ;
  5350. return self},
  5351. args: [],
  5352. source: "prototype\x0a\x09<return self.fn.prototype>",
  5353. messageSends: [],
  5354. referencedClasses: []
  5355. }),
  5356. smalltalk.Behavior);
  5357. smalltalk.addMethod(
  5358. "_removeCompiledMethod_",
  5359. smalltalk.method({
  5360. selector: "removeCompiledMethod:",
  5361. category: 'compiling',
  5362. fn: function (aMethod){
  5363. var self=this;
  5364. var $1,$2;
  5365. smalltalk.removeMethod(aMethod)
  5366. smalltalk.init(self);
  5367. ;
  5368. ;
  5369. $1=smalltalk.send((smalltalk.MethodRemoved || MethodRemoved),"_new",[]);
  5370. smalltalk.send($1,"_theClass_",[self]);
  5371. smalltalk.send($1,"_method_",[aMethod]);
  5372. $2=smalltalk.send($1,"_yourself",[]);
  5373. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5374. return self},
  5375. args: ["aMethod"],
  5376. 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)",
  5377. messageSends: ["announce:", "theClass:", "new", "method:", "yourself", "current"],
  5378. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  5379. }),
  5380. smalltalk.Behavior);
  5381. smalltalk.addMethod(
  5382. "_selectors",
  5383. smalltalk.method({
  5384. selector: "selectors",
  5385. category: 'accessing',
  5386. fn: function (){
  5387. var self=this;
  5388. var $1;
  5389. $1=smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]);
  5390. return $1;
  5391. },
  5392. args: [],
  5393. source: "selectors\x0a\x09^ self methodDictionary keys",
  5394. messageSends: ["keys", "methodDictionary"],
  5395. referencedClasses: []
  5396. }),
  5397. smalltalk.Behavior);
  5398. smalltalk.addMethod(
  5399. "_subclasses",
  5400. smalltalk.method({
  5401. selector: "subclasses",
  5402. category: 'accessing',
  5403. fn: function (){
  5404. var self=this;
  5405. return smalltalk.subclasses(self);
  5406. ;
  5407. return self},
  5408. args: [],
  5409. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  5410. messageSends: [],
  5411. referencedClasses: []
  5412. }),
  5413. smalltalk.Behavior);
  5414. smalltalk.addMethod(
  5415. "_superclass",
  5416. smalltalk.method({
  5417. selector: "superclass",
  5418. category: 'accessing',
  5419. fn: function (){
  5420. var self=this;
  5421. return self.superclass || nil;
  5422. ;
  5423. return self},
  5424. args: [],
  5425. source: "superclass\x0a\x09<return self.superclass || nil>",
  5426. messageSends: [],
  5427. referencedClasses: []
  5428. }),
  5429. smalltalk.Behavior);
  5430. smalltalk.addMethod(
  5431. "_theMetaClass",
  5432. smalltalk.method({
  5433. selector: "theMetaClass",
  5434. category: 'accessing',
  5435. fn: function (){
  5436. var self=this;
  5437. var $1;
  5438. $1=smalltalk.send(self,"_class",[]);
  5439. return $1;
  5440. },
  5441. args: [],
  5442. source: "theMetaClass\x0a\x09^ self class",
  5443. messageSends: ["class"],
  5444. referencedClasses: []
  5445. }),
  5446. smalltalk.Behavior);
  5447. smalltalk.addMethod(
  5448. "_theNonMetaClass",
  5449. smalltalk.method({
  5450. selector: "theNonMetaClass",
  5451. category: 'accessing',
  5452. fn: function (){
  5453. var self=this;
  5454. return self;
  5455. },
  5456. args: [],
  5457. source: "theNonMetaClass\x0a\x09^ self",
  5458. messageSends: [],
  5459. referencedClasses: []
  5460. }),
  5461. smalltalk.Behavior);
  5462. smalltalk.addMethod(
  5463. "_withAllSubclasses",
  5464. smalltalk.method({
  5465. selector: "withAllSubclasses",
  5466. category: 'accessing',
  5467. fn: function (){
  5468. var self=this;
  5469. var $2,$3,$1;
  5470. $2=smalltalk.send((smalltalk.Array || Array),"_with_",[self]);
  5471. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_allSubclasses",[])]);
  5472. $3=smalltalk.send($2,"_yourself",[]);
  5473. $1=$3;
  5474. return $1;
  5475. },
  5476. args: [],
  5477. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  5478. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  5479. referencedClasses: ["Array"]
  5480. }),
  5481. smalltalk.Behavior);
  5482. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  5483. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  5484. smalltalk.addMethod(
  5485. "_asJavascript",
  5486. smalltalk.method({
  5487. selector: "asJavascript",
  5488. category: 'converting',
  5489. fn: function (){
  5490. var self=this;
  5491. var $1;
  5492. $1=smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_name",[])]);
  5493. return $1;
  5494. },
  5495. args: [],
  5496. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  5497. messageSends: [",", "name"],
  5498. referencedClasses: []
  5499. }),
  5500. smalltalk.Class);
  5501. smalltalk.addMethod(
  5502. "_category",
  5503. smalltalk.method({
  5504. selector: "category",
  5505. category: 'accessing',
  5506. fn: function (){
  5507. var self=this;
  5508. var $2,$1;
  5509. $2=smalltalk.send(self,"_package",[]);
  5510. if(($receiver = $2) == nil || $receiver == undefined){
  5511. $1="Unclassified";
  5512. } else {
  5513. $1=smalltalk.send(smalltalk.send(self,"_package",[]),"_name",[]);
  5514. };
  5515. return $1;
  5516. },
  5517. args: [],
  5518. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  5519. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  5520. referencedClasses: []
  5521. }),
  5522. smalltalk.Class);
  5523. smalltalk.addMethod(
  5524. "_definition",
  5525. smalltalk.method({
  5526. selector: "definition",
  5527. category: 'accessing',
  5528. fn: function (){
  5529. var self=this;
  5530. var $2,$3,$1;
  5531. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5532. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_asString",[])]);
  5533. smalltalk.send(stream,"_nextPutAll_",[" subclass: #"]);
  5534. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_name",[])]);
  5535. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send((smalltalk.String || String),"_lf",[]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5536. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5537. $2;
  5538. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5539. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5540. }),(function(){
  5541. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5542. })]);
  5543. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",[smalltalk.send((smalltalk.String || String),"_tab",[])])]);
  5544. smalltalk.send(stream,"_nextPutAll_",["package: '"]);
  5545. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_category",[])]);
  5546. $3=smalltalk.send(stream,"_nextPutAll_",["'"]);
  5547. return $3;
  5548. })]);
  5549. return $1;
  5550. },
  5551. args: [],
  5552. 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: '''' ]",
  5553. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  5554. referencedClasses: ["String"]
  5555. }),
  5556. smalltalk.Class);
  5557. smalltalk.addMethod(
  5558. "_isClass",
  5559. smalltalk.method({
  5560. selector: "isClass",
  5561. category: 'testing',
  5562. fn: function (){
  5563. var self=this;
  5564. return true;
  5565. },
  5566. args: [],
  5567. source: "isClass\x0a\x09^true",
  5568. messageSends: [],
  5569. referencedClasses: []
  5570. }),
  5571. smalltalk.Class);
  5572. smalltalk.addMethod(
  5573. "_package",
  5574. smalltalk.method({
  5575. selector: "package",
  5576. category: 'accessing',
  5577. fn: function (){
  5578. var self=this;
  5579. return self.pkg;
  5580. ;
  5581. return self},
  5582. args: [],
  5583. source: "package\x0a\x09<return self.pkg>",
  5584. messageSends: [],
  5585. referencedClasses: []
  5586. }),
  5587. smalltalk.Class);
  5588. smalltalk.addMethod(
  5589. "_package_",
  5590. smalltalk.method({
  5591. selector: "package:",
  5592. category: 'accessing',
  5593. fn: function (aPackage){
  5594. var self=this;
  5595. self.pkg = aPackage;
  5596. ;
  5597. return self},
  5598. args: ["aPackage"],
  5599. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  5600. messageSends: [],
  5601. referencedClasses: []
  5602. }),
  5603. smalltalk.Class);
  5604. smalltalk.addMethod(
  5605. "_printString",
  5606. smalltalk.method({
  5607. selector: "printString",
  5608. category: 'printing',
  5609. fn: function (){
  5610. var self=this;
  5611. var $1;
  5612. $1=smalltalk.send(self,"_name",[]);
  5613. return $1;
  5614. },
  5615. args: [],
  5616. source: "printString\x0a\x09^self name",
  5617. messageSends: ["name"],
  5618. referencedClasses: []
  5619. }),
  5620. smalltalk.Class);
  5621. smalltalk.addMethod(
  5622. "_rename_",
  5623. smalltalk.method({
  5624. selector: "rename:",
  5625. category: 'accessing',
  5626. fn: function (aString){
  5627. var self=this;
  5628. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_renameClass_to_",[self,aString]);
  5629. return self},
  5630. args: ["aString"],
  5631. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  5632. messageSends: ["renameClass:to:", "new"],
  5633. referencedClasses: ["ClassBuilder"]
  5634. }),
  5635. smalltalk.Class);
  5636. smalltalk.addMethod(
  5637. "_subclass_instanceVariableNames_",
  5638. smalltalk.method({
  5639. selector: "subclass:instanceVariableNames:",
  5640. category: 'class creation',
  5641. fn: function (aString,anotherString){
  5642. var self=this;
  5643. var $1;
  5644. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,anotherString,nil]);
  5645. return $1;
  5646. },
  5647. args: ["aString", "anotherString"],
  5648. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5649. messageSends: ["subclass:instanceVariableNames:package:"],
  5650. referencedClasses: []
  5651. }),
  5652. smalltalk.Class);
  5653. smalltalk.addMethod(
  5654. "_subclass_instanceVariableNames_category_",
  5655. smalltalk.method({
  5656. selector: "subclass:instanceVariableNames:category:",
  5657. category: 'class creation',
  5658. fn: function (aString,aString2,aString3){
  5659. var self=this;
  5660. var $1;
  5661. smalltalk.send(self,"_deprecatedAPI",[]);
  5662. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5663. return $1;
  5664. },
  5665. args: ["aString", "aString2", "aString3"],
  5666. 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",
  5667. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5668. referencedClasses: []
  5669. }),
  5670. smalltalk.Class);
  5671. smalltalk.addMethod(
  5672. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  5673. smalltalk.method({
  5674. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5675. category: 'class creation',
  5676. fn: function (aString,aString2,classVars,pools,aString3){
  5677. var self=this;
  5678. var $1;
  5679. $1=smalltalk.send(self,"_subclass_instanceVariableNames_package_",[aString,aString2,aString3]);
  5680. return $1;
  5681. },
  5682. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5683. 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",
  5684. messageSends: ["subclass:instanceVariableNames:package:"],
  5685. referencedClasses: []
  5686. }),
  5687. smalltalk.Class);
  5688. smalltalk.addMethod(
  5689. "_subclass_instanceVariableNames_package_",
  5690. smalltalk.method({
  5691. selector: "subclass:instanceVariableNames:package:",
  5692. category: 'class creation',
  5693. fn: function (aString,aString2,aString3){
  5694. var self=this;
  5695. var $1;
  5696. $1=smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_superclass_subclass_instanceVariableNames_package_",[self,smalltalk.send(aString,"_asString",[]),aString2,aString3]);
  5697. return $1;
  5698. },
  5699. args: ["aString", "aString2", "aString3"],
  5700. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5701. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  5702. referencedClasses: ["ClassBuilder"]
  5703. }),
  5704. smalltalk.Class);
  5705. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  5706. 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."
  5707. smalltalk.addMethod(
  5708. "_asJavascript",
  5709. smalltalk.method({
  5710. selector: "asJavascript",
  5711. category: 'converting',
  5712. fn: function (){
  5713. var self=this;
  5714. var $1;
  5715. $1=smalltalk.send(smalltalk.send("smalltalk.","__comma",[smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[])]),"__comma",[".klass"]);
  5716. return $1;
  5717. },
  5718. args: [],
  5719. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  5720. messageSends: [",", "name", "instanceClass"],
  5721. referencedClasses: []
  5722. }),
  5723. smalltalk.Metaclass);
  5724. smalltalk.addMethod(
  5725. "_definition",
  5726. smalltalk.method({
  5727. selector: "definition",
  5728. category: 'accessing',
  5729. fn: function (){
  5730. var self=this;
  5731. var $2,$1;
  5732. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  5733. smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_asString",[])]);
  5734. smalltalk.send(stream,"_nextPutAll_",[" class "]);
  5735. $2=smalltalk.send(stream,"_nextPutAll_",["instanceVariableNames: '"]);
  5736. $2;
  5737. smalltalk.send(smalltalk.send(self,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
  5738. return smalltalk.send(stream,"_nextPutAll_",[each]);
  5739. }),(function(){
  5740. return smalltalk.send(stream,"_nextPutAll_",[" "]);
  5741. })]);
  5742. return smalltalk.send(stream,"_nextPutAll_",["'"]);
  5743. })]);
  5744. return $1;
  5745. },
  5746. args: [],
  5747. 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: '''' ]",
  5748. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  5749. referencedClasses: ["String"]
  5750. }),
  5751. smalltalk.Metaclass);
  5752. smalltalk.addMethod(
  5753. "_instanceClass",
  5754. smalltalk.method({
  5755. selector: "instanceClass",
  5756. category: 'accessing',
  5757. fn: function (){
  5758. var self=this;
  5759. return self.instanceClass;
  5760. ;
  5761. return self},
  5762. args: [],
  5763. source: "instanceClass\x0a\x09<return self.instanceClass>",
  5764. messageSends: [],
  5765. referencedClasses: []
  5766. }),
  5767. smalltalk.Metaclass);
  5768. smalltalk.addMethod(
  5769. "_instanceVariableNames_",
  5770. smalltalk.method({
  5771. selector: "instanceVariableNames:",
  5772. category: 'accessing',
  5773. fn: function (aCollection){
  5774. var self=this;
  5775. smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_class_instanceVariableNames_",[self,aCollection]);
  5776. return self},
  5777. args: ["aCollection"],
  5778. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  5779. messageSends: ["class:instanceVariableNames:", "new"],
  5780. referencedClasses: ["ClassBuilder"]
  5781. }),
  5782. smalltalk.Metaclass);
  5783. smalltalk.addMethod(
  5784. "_isMetaclass",
  5785. smalltalk.method({
  5786. selector: "isMetaclass",
  5787. category: 'testing',
  5788. fn: function (){
  5789. var self=this;
  5790. return true;
  5791. },
  5792. args: [],
  5793. source: "isMetaclass\x0a\x09^true",
  5794. messageSends: [],
  5795. referencedClasses: []
  5796. }),
  5797. smalltalk.Metaclass);
  5798. smalltalk.addMethod(
  5799. "_printString",
  5800. smalltalk.method({
  5801. selector: "printString",
  5802. category: 'printing',
  5803. fn: function (){
  5804. var self=this;
  5805. var $1;
  5806. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
  5807. return $1;
  5808. },
  5809. args: [],
  5810. source: "printString\x0a\x09^self instanceClass name, ' class'",
  5811. messageSends: [",", "name", "instanceClass"],
  5812. referencedClasses: []
  5813. }),
  5814. smalltalk.Metaclass);
  5815. smalltalk.addMethod(
  5816. "_theMetaClass",
  5817. smalltalk.method({
  5818. selector: "theMetaClass",
  5819. category: 'accessing',
  5820. fn: function (){
  5821. var self=this;
  5822. return self;
  5823. },
  5824. args: [],
  5825. source: "theMetaClass\x0a\x09^ self",
  5826. messageSends: [],
  5827. referencedClasses: []
  5828. }),
  5829. smalltalk.Metaclass);
  5830. smalltalk.addMethod(
  5831. "_theNonMetaClass",
  5832. smalltalk.method({
  5833. selector: "theNonMetaClass",
  5834. category: 'accessing',
  5835. fn: function (){
  5836. var self=this;
  5837. var $1;
  5838. $1=smalltalk.send(self,"_instanceClass",[]);
  5839. return $1;
  5840. },
  5841. args: [],
  5842. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  5843. messageSends: ["instanceClass"],
  5844. referencedClasses: []
  5845. }),
  5846. smalltalk.Metaclass);
  5847. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  5848. 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:`."
  5849. smalltalk.addMethod(
  5850. "_addSubclassOf_named_instanceVariableNames_",
  5851. smalltalk.method({
  5852. selector: "addSubclassOf:named:instanceVariableNames:",
  5853. category: 'private',
  5854. fn: function (aClass,aString,aCollection){
  5855. var self=this;
  5856. smalltalk.addClass(aString, aClass, aCollection);
  5857. return smalltalk[aString];
  5858. ;
  5859. return self},
  5860. args: ["aClass", "aString", "aCollection"],
  5861. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection\x0a\x09<smalltalk.addClass(aString, aClass, aCollection);\x0a\x09 return smalltalk[aString]>",
  5862. messageSends: [],
  5863. referencedClasses: []
  5864. }),
  5865. smalltalk.ClassBuilder);
  5866. smalltalk.addMethod(
  5867. "_addSubclassOf_named_instanceVariableNames_package_",
  5868. smalltalk.method({
  5869. selector: "addSubclassOf:named:instanceVariableNames:package:",
  5870. category: 'private',
  5871. fn: function (aClass,aString,aCollection,packageName){
  5872. var self=this;
  5873. smalltalk.addClass(aString, aClass, aCollection, packageName);
  5874. return smalltalk[aString];
  5875. ;
  5876. return self},
  5877. args: ["aClass", "aString", "aCollection", "packageName"],
  5878. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09 return smalltalk[aString]>",
  5879. messageSends: [],
  5880. referencedClasses: []
  5881. }),
  5882. smalltalk.ClassBuilder);
  5883. smalltalk.addMethod(
  5884. "_class_instanceVariableNames_",
  5885. smalltalk.method({
  5886. selector: "class:instanceVariableNames:",
  5887. category: 'class creation',
  5888. fn: function (aClass,aString){
  5889. var self=this;
  5890. var $1,$2,$3;
  5891. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  5892. if(! smalltalk.assert($1)){
  5893. smalltalk.send(self,"_error_",[smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" is not a metaclass"])]);
  5894. };
  5895. smalltalk.send(aClass,"_basicAt_put_",["iVarNames",smalltalk.send(self,"_instanceVariableNamesFor_",[aString])]);
  5896. $2=smalltalk.send((smalltalk.ClassDefinitionChanged || ClassDefinitionChanged),"_new",[]);
  5897. smalltalk.send($2,"_theClass_",[aClass]);
  5898. $3=smalltalk.send($2,"_yourself",[]);
  5899. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  5900. smalltalk.send(self,"_setupClass_",[aClass]);
  5901. return self},
  5902. args: ["aClass", "aString"],
  5903. 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",
  5904. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:", "instanceVariableNamesFor:", "announce:", "theClass:", "new", "yourself", "current", "setupClass:"],
  5905. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  5906. }),
  5907. smalltalk.ClassBuilder);
  5908. smalltalk.addMethod(
  5909. "_copyClass_named_",
  5910. smalltalk.method({
  5911. selector: "copyClass:named:",
  5912. category: 'private',
  5913. fn: function (aClass,aString){
  5914. var self=this;
  5915. var newClass;
  5916. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[smalltalk.send(aClass,"_superclass",[]),aString,smalltalk.send(aClass,"_instanceVariableNames",[]),smalltalk.send(smalltalk.send(aClass,"_package",[]),"_name",[])]);
  5917. smalltalk.send(self,"_setupClass_",[newClass]);
  5918. smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  5919. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),newClass,smalltalk.send(each,"_category",[])]);
  5920. })]);
  5921. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_methodDictionary",[]),"_values",[]),"_do_",[(function(each){
  5922. return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[smalltalk.send(each,"_source",[]),smalltalk.send(newClass,"_class",[]),smalltalk.send(each,"_category",[])]);
  5923. })]);
  5924. smalltalk.send(self,"_setupClass_",[newClass]);
  5925. return newClass;
  5926. },
  5927. args: ["aClass", "aString"],
  5928. 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",
  5929. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "class"],
  5930. referencedClasses: ["Compiler"]
  5931. }),
  5932. smalltalk.ClassBuilder);
  5933. smalltalk.addMethod(
  5934. "_instanceVariableNamesFor_",
  5935. smalltalk.method({
  5936. selector: "instanceVariableNamesFor:",
  5937. category: 'private',
  5938. fn: function (aString){
  5939. var self=this;
  5940. var $1;
  5941. $1=smalltalk.send(smalltalk.send(aString,"_tokenize_",[" "]),"_reject_",[(function(each){
  5942. return smalltalk.send(each,"_isEmpty",[]);
  5943. })]);
  5944. return $1;
  5945. },
  5946. args: ["aString"],
  5947. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [:each | each isEmpty]",
  5948. messageSends: ["reject:", "isEmpty", "tokenize:"],
  5949. referencedClasses: []
  5950. }),
  5951. smalltalk.ClassBuilder);
  5952. smalltalk.addMethod(
  5953. "_renameClass_to_",
  5954. smalltalk.method({
  5955. selector: "renameClass:to:",
  5956. category: 'class creation',
  5957. fn: function (aClass,aString){
  5958. var self=this;
  5959. var $1,$2;
  5960. smalltalk[aString] = aClass;
  5961. delete smalltalk[aClass.className];
  5962. aClass.className = aString;
  5963. ;
  5964. ;
  5965. $1=smalltalk.send((smalltalk.ClassRenamed || ClassRenamed),"_new",[]);
  5966. smalltalk.send($1,"_theClass_",[aClass]);
  5967. $2=smalltalk.send($1,"_yourself",[]);
  5968. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$2]);
  5969. return self},
  5970. args: ["aClass", "aString"],
  5971. 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",
  5972. messageSends: ["announce:", "theClass:", "new", "yourself", "current"],
  5973. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  5974. }),
  5975. smalltalk.ClassBuilder);
  5976. smalltalk.addMethod(
  5977. "_setupClass_",
  5978. smalltalk.method({
  5979. selector: "setupClass:",
  5980. category: 'private',
  5981. fn: function (aClass){
  5982. var self=this;
  5983. smalltalk.init(aClass);;
  5984. ;
  5985. return self},
  5986. args: ["aClass"],
  5987. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  5988. messageSends: [],
  5989. referencedClasses: []
  5990. }),
  5991. smalltalk.ClassBuilder);
  5992. smalltalk.addMethod(
  5993. "_superclass_subclass_",
  5994. smalltalk.method({
  5995. selector: "superclass:subclass:",
  5996. category: 'class creation',
  5997. fn: function (aClass,aString){
  5998. var self=this;
  5999. var $1;
  6000. $1=smalltalk.send(self,"_superclass_subclass_instanceVariableNames_package_",[aClass,aString,"",nil]);
  6001. return $1;
  6002. },
  6003. args: ["aClass", "aString"],
  6004. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  6005. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6006. referencedClasses: []
  6007. }),
  6008. smalltalk.ClassBuilder);
  6009. smalltalk.addMethod(
  6010. "_superclass_subclass_instanceVariableNames_package_",
  6011. smalltalk.method({
  6012. selector: "superclass:subclass:instanceVariableNames:package:",
  6013. category: 'class creation',
  6014. fn: function (aClass,aString,aString2,aString3){
  6015. var self=this;
  6016. var $1,$2,$3;
  6017. var newClass;
  6018. if(($receiver = aString3) == nil || $receiver == undefined){
  6019. $1="unclassified";
  6020. } else {
  6021. $1=aString3;
  6022. };
  6023. newClass=smalltalk.send(self,"_addSubclassOf_named_instanceVariableNames_package_",[aClass,aString,smalltalk.send(self,"_instanceVariableNamesFor_",[aString2]),$1]);
  6024. smalltalk.send(self,"_setupClass_",[newClass]);
  6025. $2=smalltalk.send((smalltalk.ClassAdded || ClassAdded),"_new",[]);
  6026. smalltalk.send($2,"_theClass_",[newClass]);
  6027. $3=smalltalk.send($2,"_yourself",[]);
  6028. smalltalk.send(smalltalk.send((smalltalk.SystemAnnouncer || SystemAnnouncer),"_current",[]),"_announce_",[$3]);
  6029. return newClass;
  6030. },
  6031. args: ["aClass", "aString", "aString2", "aString3"],
  6032. 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",
  6033. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  6034. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  6035. }),
  6036. smalltalk.ClassBuilder);
  6037. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
  6038. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  6039. smalltalk.addMethod(
  6040. "_class_category_",
  6041. smalltalk.method({
  6042. selector: "class:category:",
  6043. category: 'accessing',
  6044. fn: function (aClass,aString){
  6045. var self=this;
  6046. self["@class"]=aClass;
  6047. self["@category"]=aString;
  6048. return self},
  6049. args: ["aClass", "aString"],
  6050. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6051. messageSends: [],
  6052. referencedClasses: []
  6053. }),
  6054. smalltalk.ClassCategoryReader);
  6055. smalltalk.addMethod(
  6056. "_compileMethod_",
  6057. smalltalk.method({
  6058. selector: "compileMethod:",
  6059. category: 'private',
  6060. fn: function (aString){
  6061. var self=this;
  6062. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_install_forClass_category_",[aString,self["@class"],self["@category"]]);
  6063. return self},
  6064. args: ["aString"],
  6065. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  6066. messageSends: ["install:forClass:category:", "new"],
  6067. referencedClasses: ["Compiler"]
  6068. }),
  6069. smalltalk.ClassCategoryReader);
  6070. smalltalk.addMethod(
  6071. "_initialize",
  6072. smalltalk.method({
  6073. selector: "initialize",
  6074. category: 'initialization',
  6075. fn: function (){
  6076. var self=this;
  6077. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6078. self["@chunkParser"]=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_new",[]);
  6079. return self},
  6080. args: [],
  6081. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  6082. messageSends: ["initialize", "new"],
  6083. referencedClasses: ["ChunkParser"]
  6084. }),
  6085. smalltalk.ClassCategoryReader);
  6086. smalltalk.addMethod(
  6087. "_scanFrom_",
  6088. smalltalk.method({
  6089. selector: "scanFrom:",
  6090. category: 'fileIn',
  6091. fn: function (aChunkParser){
  6092. var self=this;
  6093. var chunk;
  6094. smalltalk.send((function(){
  6095. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6096. chunk;
  6097. return smalltalk.send(chunk,"_isEmpty",[]);
  6098. }),"_whileFalse_",[(function(){
  6099. return smalltalk.send(self,"_compileMethod_",[chunk]);
  6100. })]);
  6101. smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_setupClass_",[self["@class"]]);
  6102. return self},
  6103. args: ["aChunkParser"],
  6104. 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",
  6105. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  6106. referencedClasses: ["Compiler"]
  6107. }),
  6108. smalltalk.ClassCategoryReader);
  6109. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
  6110. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.\x0aSee `ClassCategoryReader` too."
  6111. smalltalk.addMethod(
  6112. "_class_",
  6113. smalltalk.method({
  6114. selector: "class:",
  6115. category: 'accessing',
  6116. fn: function (aClass){
  6117. var self=this;
  6118. self["@class"]=aClass;
  6119. return self},
  6120. args: ["aClass"],
  6121. source: "class: aClass\x0a\x09class := aClass",
  6122. messageSends: [],
  6123. referencedClasses: []
  6124. }),
  6125. smalltalk.ClassCommentReader);
  6126. smalltalk.addMethod(
  6127. "_initialize",
  6128. smalltalk.method({
  6129. selector: "initialize",
  6130. category: 'initialization',
  6131. fn: function (){
  6132. var self=this;
  6133. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  6134. self["@chunkParser"]=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_new",[]);
  6135. return self},
  6136. args: [],
  6137. source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
  6138. messageSends: ["initialize", "new"],
  6139. referencedClasses: ["ChunkParser"]
  6140. }),
  6141. smalltalk.ClassCommentReader);
  6142. smalltalk.addMethod(
  6143. "_scanFrom_",
  6144. smalltalk.method({
  6145. selector: "scanFrom:",
  6146. category: 'fileIn',
  6147. fn: function (aChunkParser){
  6148. var self=this;
  6149. var $1;
  6150. var chunk;
  6151. chunk=smalltalk.send(aChunkParser,"_nextChunk",[]);
  6152. $1=smalltalk.send(chunk,"_isEmpty",[]);
  6153. if(! smalltalk.assert($1)){
  6154. smalltalk.send(self,"_setComment_",[chunk]);
  6155. };
  6156. return self},
  6157. args: ["aChunkParser"],
  6158. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  6159. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  6160. referencedClasses: []
  6161. }),
  6162. smalltalk.ClassCommentReader);
  6163. smalltalk.addMethod(
  6164. "_setComment_",
  6165. smalltalk.method({
  6166. selector: "setComment:",
  6167. category: 'private',
  6168. fn: function (aString){
  6169. var self=this;
  6170. smalltalk.send(self["@class"],"_comment_",[aString]);
  6171. return self},
  6172. args: ["aString"],
  6173. source: "setComment: aString\x0a class comment: aString",
  6174. messageSends: ["comment:"],
  6175. referencedClasses: []
  6176. }),
  6177. smalltalk.ClassCommentReader);
  6178. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  6179. smalltalk.addMethod(
  6180. "_getNodesFrom_",
  6181. smalltalk.method({
  6182. selector: "getNodesFrom:",
  6183. category: 'accessing',
  6184. fn: function (aCollection){
  6185. var self=this;
  6186. var $1;
  6187. var children;
  6188. var others;
  6189. children=[];
  6190. others=[];
  6191. smalltalk.send(aCollection,"_do_",[(function(each){
  6192. $1=smalltalk.send(smalltalk.send(each,"_superclass",[]),"__eq",[smalltalk.send(self,"_theClass",[])]);
  6193. if(smalltalk.assert($1)){
  6194. return smalltalk.send(children,"_add_",[each]);
  6195. } else {
  6196. return smalltalk.send(others,"_add_",[each]);
  6197. };
  6198. })]);
  6199. self["@nodes"]=smalltalk.send(children,"_collect_",[(function(each){
  6200. return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode),"_on_classes_level_",[each,others,smalltalk.send(smalltalk.send(self,"_level",[]),"__plus",[(1)])]);
  6201. })]);
  6202. return self},
  6203. args: ["aCollection"],
  6204. 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]",
  6205. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  6206. referencedClasses: ["ClassSorterNode"]
  6207. }),
  6208. smalltalk.ClassSorterNode);
  6209. smalltalk.addMethod(
  6210. "_level",
  6211. smalltalk.method({
  6212. selector: "level",
  6213. category: 'accessing',
  6214. fn: function (){
  6215. var self=this;
  6216. return self["@level"];
  6217. },
  6218. args: [],
  6219. source: "level\x0a\x09^level",
  6220. messageSends: [],
  6221. referencedClasses: []
  6222. }),
  6223. smalltalk.ClassSorterNode);
  6224. smalltalk.addMethod(
  6225. "_level_",
  6226. smalltalk.method({
  6227. selector: "level:",
  6228. category: 'accessing',
  6229. fn: function (anInteger){
  6230. var self=this;
  6231. self["@level"]=anInteger;
  6232. return self},
  6233. args: ["anInteger"],
  6234. source: "level: anInteger\x0a\x09level := anInteger",
  6235. messageSends: [],
  6236. referencedClasses: []
  6237. }),
  6238. smalltalk.ClassSorterNode);
  6239. smalltalk.addMethod(
  6240. "_nodes",
  6241. smalltalk.method({
  6242. selector: "nodes",
  6243. category: 'accessing',
  6244. fn: function (){
  6245. var self=this;
  6246. return self["@nodes"];
  6247. },
  6248. args: [],
  6249. source: "nodes\x0a\x09^nodes",
  6250. messageSends: [],
  6251. referencedClasses: []
  6252. }),
  6253. smalltalk.ClassSorterNode);
  6254. smalltalk.addMethod(
  6255. "_theClass",
  6256. smalltalk.method({
  6257. selector: "theClass",
  6258. category: 'accessing',
  6259. fn: function (){
  6260. var self=this;
  6261. return self["@theClass"];
  6262. },
  6263. args: [],
  6264. source: "theClass\x0a\x09^theClass",
  6265. messageSends: [],
  6266. referencedClasses: []
  6267. }),
  6268. smalltalk.ClassSorterNode);
  6269. smalltalk.addMethod(
  6270. "_theClass_",
  6271. smalltalk.method({
  6272. selector: "theClass:",
  6273. category: 'accessing',
  6274. fn: function (aClass){
  6275. var self=this;
  6276. self["@theClass"]=aClass;
  6277. return self},
  6278. args: ["aClass"],
  6279. source: "theClass: aClass\x0a\x09theClass := aClass",
  6280. messageSends: [],
  6281. referencedClasses: []
  6282. }),
  6283. smalltalk.ClassSorterNode);
  6284. smalltalk.addMethod(
  6285. "_traverseClassesWith_",
  6286. smalltalk.method({
  6287. selector: "traverseClassesWith:",
  6288. category: 'visiting',
  6289. fn: function (aCollection){
  6290. var self=this;
  6291. smalltalk.send(aCollection,"_add_",[smalltalk.send(self,"_theClass",[])]);
  6292. smalltalk.send(smalltalk.send(smalltalk.send(self,"_nodes",[]),"_sorted_",[(function(a,b){
  6293. return smalltalk.send(smalltalk.send(smalltalk.send(a,"_theClass",[]),"_name",[]),"__lt_eq",[smalltalk.send(smalltalk.send(b,"_theClass",[]),"_name",[])]);
  6294. })]),"_do_",[(function(aNode){
  6295. return smalltalk.send(aNode,"_traverseClassesWith_",[aCollection]);
  6296. })]);
  6297. return self},
  6298. args: ["aCollection"],
  6299. 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 ].",
  6300. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  6301. referencedClasses: []
  6302. }),
  6303. smalltalk.ClassSorterNode);
  6304. smalltalk.addMethod(
  6305. "_on_classes_level_",
  6306. smalltalk.method({
  6307. selector: "on:classes:level:",
  6308. category: 'instance creation',
  6309. fn: function (aClass,aCollection,anInteger){
  6310. var self=this;
  6311. var $2,$3,$1;
  6312. $2=smalltalk.send(self,"_new",[]);
  6313. smalltalk.send($2,"_theClass_",[aClass]);
  6314. smalltalk.send($2,"_level_",[anInteger]);
  6315. smalltalk.send($2,"_getNodesFrom_",[aCollection]);
  6316. $3=smalltalk.send($2,"_yourself",[]);
  6317. $1=$3;
  6318. return $1;
  6319. },
  6320. args: ["aClass", "aCollection", "anInteger"],
  6321. 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",
  6322. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  6323. referencedClasses: []
  6324. }),
  6325. smalltalk.ClassSorterNode.klass);
  6326. smalltalk.addPackage('Kernel-Methods', {});
  6327. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  6328. 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."
  6329. smalltalk.addMethod(
  6330. "_applyTo_arguments_",
  6331. smalltalk.method({
  6332. selector: "applyTo:arguments:",
  6333. category: 'evaluating',
  6334. fn: function (anObject, aCollection) {
  6335. var self = this;
  6336. return self.apply(anObject, aCollection);
  6337. return self;
  6338. },
  6339. args: ["anObject", "aCollection"],
  6340. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  6341. messageSends: [],
  6342. referencedClasses: []
  6343. }),
  6344. smalltalk.BlockClosure);
  6345. smalltalk.addMethod(
  6346. "_compiledSource",
  6347. smalltalk.method({
  6348. selector: "compiledSource",
  6349. category: 'accessing',
  6350. fn: function () {
  6351. var self = this;
  6352. return self.toString();
  6353. return self;
  6354. },
  6355. args: [],
  6356. source: "compiledSource\x0a\x09<return self.toString()>",
  6357. messageSends: [],
  6358. referencedClasses: []
  6359. }),
  6360. smalltalk.BlockClosure);
  6361. smalltalk.addMethod(
  6362. "_ensure_",
  6363. smalltalk.method({
  6364. selector: "ensure:",
  6365. category: 'evaluating',
  6366. fn: function (aBlock){
  6367. var self=this;
  6368. try{return self()}finally{aBlock._value()};
  6369. ;
  6370. return self},
  6371. args: ["aBlock"],
  6372. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  6373. messageSends: [],
  6374. referencedClasses: []
  6375. }),
  6376. smalltalk.BlockClosure);
  6377. smalltalk.addMethod(
  6378. "_fork",
  6379. smalltalk.method({
  6380. selector: "fork",
  6381. category: 'timeout/interval',
  6382. fn: function (){
  6383. var self=this;
  6384. smalltalk.send(smalltalk.send((smalltalk.ForkPool || ForkPool),"_default",[]),"_fork_",[self]);
  6385. return self},
  6386. args: [],
  6387. source: "fork\x0a\x09ForkPool default fork: self",
  6388. messageSends: ["fork:", "default"],
  6389. referencedClasses: ["ForkPool"]
  6390. }),
  6391. smalltalk.BlockClosure);
  6392. smalltalk.addMethod(
  6393. "_new",
  6394. smalltalk.method({
  6395. selector: "new",
  6396. category: 'evaluating',
  6397. fn: function () {
  6398. var self = this;
  6399. return new self;
  6400. return self;
  6401. },
  6402. args: [],
  6403. 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()>",
  6404. messageSends: [],
  6405. referencedClasses: []
  6406. }),
  6407. smalltalk.BlockClosure);
  6408. smalltalk.addMethod(
  6409. "_newValue_",
  6410. smalltalk.method({
  6411. selector: "newValue:",
  6412. category: 'evaluating',
  6413. fn: function (anObject) {
  6414. var self = this;
  6415. return new self(anObject);
  6416. return self;
  6417. },
  6418. args: ["anObject"],
  6419. 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)>",
  6420. messageSends: [],
  6421. referencedClasses: []
  6422. }),
  6423. smalltalk.BlockClosure);
  6424. smalltalk.addMethod(
  6425. "_newValue_value_",
  6426. smalltalk.method({
  6427. selector: "newValue:value:",
  6428. category: 'evaluating',
  6429. fn: function (anObject, anObject2) {
  6430. var self = this;
  6431. return new self(anObject, anObject2);
  6432. return self;
  6433. },
  6434. args: ["anObject", "anObject2"],
  6435. 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)>",
  6436. messageSends: [],
  6437. referencedClasses: []
  6438. }),
  6439. smalltalk.BlockClosure);
  6440. smalltalk.addMethod(
  6441. "_newValue_value_value_",
  6442. smalltalk.method({
  6443. selector: "newValue:value:value:",
  6444. category: 'evaluating',
  6445. fn: function (anObject, anObject2, anObject3) {
  6446. var self = this;
  6447. return new self(anObject, anObject2);
  6448. return self;
  6449. },
  6450. args: ["anObject", "anObject2", "anObject3"],
  6451. 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)>",
  6452. messageSends: [],
  6453. referencedClasses: []
  6454. }),
  6455. smalltalk.BlockClosure);
  6456. smalltalk.addMethod(
  6457. "_numArgs",
  6458. smalltalk.method({
  6459. selector: "numArgs",
  6460. category: 'accessing',
  6461. fn: function () {
  6462. var self = this;
  6463. return self.length;
  6464. return self;
  6465. },
  6466. args: [],
  6467. source: "numArgs\x0a\x09<return self.length>",
  6468. messageSends: [],
  6469. referencedClasses: []
  6470. }),
  6471. smalltalk.BlockClosure);
  6472. smalltalk.addMethod(
  6473. "_on_do_",
  6474. smalltalk.method({
  6475. selector: "on:do:",
  6476. category: 'error handling',
  6477. fn: function (anErrorClass, aBlock) {
  6478. var self = this;
  6479. var $2, $1;
  6480. $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", []);}}]);
  6481. return $1;
  6482. },
  6483. args: ["anErrorClass", "aBlock"],
  6484. 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]]",
  6485. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  6486. referencedClasses: []
  6487. }),
  6488. smalltalk.BlockClosure);
  6489. smalltalk.addMethod(
  6490. "_timeToRun",
  6491. smalltalk.method({
  6492. selector: "timeToRun",
  6493. category: 'evaluating',
  6494. fn: function () {
  6495. var self = this;
  6496. var $1;
  6497. $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
  6498. return $1;
  6499. },
  6500. args: [],
  6501. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  6502. messageSends: ["millisecondsToRun:"],
  6503. referencedClasses: ["Date"]
  6504. }),
  6505. smalltalk.BlockClosure);
  6506. smalltalk.addMethod(
  6507. "_value",
  6508. smalltalk.method({
  6509. selector: "value",
  6510. category: 'evaluating',
  6511. fn: function () {
  6512. var self = this;
  6513. return self();
  6514. return self;
  6515. },
  6516. args: [],
  6517. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  6518. messageSends: [],
  6519. referencedClasses: []
  6520. }),
  6521. smalltalk.BlockClosure);
  6522. smalltalk.addMethod(
  6523. "_value_",
  6524. smalltalk.method({
  6525. selector: "value:",
  6526. category: 'evaluating',
  6527. fn: function (anArg) {
  6528. var self = this;
  6529. return self(anArg);
  6530. return self;
  6531. },
  6532. args: ["anArg"],
  6533. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  6534. messageSends: [],
  6535. referencedClasses: []
  6536. }),
  6537. smalltalk.BlockClosure);
  6538. smalltalk.addMethod(
  6539. "_value_value_",
  6540. smalltalk.method({
  6541. selector: "value:value:",
  6542. category: 'evaluating',
  6543. fn: function (firstArg, secondArg) {
  6544. var self = this;
  6545. return self(firstArg, secondArg);
  6546. return self;
  6547. },
  6548. args: ["firstArg", "secondArg"],
  6549. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  6550. messageSends: [],
  6551. referencedClasses: []
  6552. }),
  6553. smalltalk.BlockClosure);
  6554. smalltalk.addMethod(
  6555. "_value_value_value_",
  6556. smalltalk.method({
  6557. selector: "value:value:value:",
  6558. category: 'evaluating',
  6559. fn: function (firstArg, secondArg, thirdArg) {
  6560. var self = this;
  6561. return self(firstArg, secondArg, thirdArg);
  6562. return self;
  6563. },
  6564. args: ["firstArg", "secondArg", "thirdArg"],
  6565. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  6566. messageSends: [],
  6567. referencedClasses: []
  6568. }),
  6569. smalltalk.BlockClosure);
  6570. smalltalk.addMethod(
  6571. "_valueWithInterval_",
  6572. smalltalk.method({
  6573. selector: "valueWithInterval:",
  6574. category: 'timeout/interval',
  6575. fn: function (aNumber) {
  6576. var self = this;
  6577. return setInterval(self, aNumber);
  6578. return self;
  6579. },
  6580. args: ["aNumber"],
  6581. source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
  6582. messageSends: [],
  6583. referencedClasses: []
  6584. }),
  6585. smalltalk.BlockClosure);
  6586. smalltalk.addMethod(
  6587. "_valueWithPossibleArguments_",
  6588. smalltalk.method({
  6589. selector: "valueWithPossibleArguments:",
  6590. category: 'evaluating',
  6591. fn: function (aCollection) {
  6592. var self = this;
  6593. return self.apply(null, aCollection);
  6594. return self;
  6595. },
  6596. args: ["aCollection"],
  6597. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  6598. messageSends: [],
  6599. referencedClasses: []
  6600. }),
  6601. smalltalk.BlockClosure);
  6602. smalltalk.addMethod(
  6603. "_valueWithTimeout_",
  6604. smalltalk.method({
  6605. selector: "valueWithTimeout:",
  6606. category: 'timeout/interval',
  6607. fn: function (aNumber) {
  6608. var self = this;
  6609. return setTimeout(self, aNumber);
  6610. return self;
  6611. },
  6612. args: ["aNumber"],
  6613. source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
  6614. messageSends: [],
  6615. referencedClasses: []
  6616. }),
  6617. smalltalk.BlockClosure);
  6618. smalltalk.addMethod(
  6619. "_whileFalse",
  6620. smalltalk.method({
  6621. selector: "whileFalse",
  6622. category: 'controlling',
  6623. fn: function () {
  6624. var self = this;
  6625. smalltalk.send(self, "_whileFalse_", [function () {}]);
  6626. return self;
  6627. },
  6628. args: [],
  6629. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  6630. messageSends: ["whileFalse:"],
  6631. referencedClasses: []
  6632. }),
  6633. smalltalk.BlockClosure);
  6634. smalltalk.addMethod(
  6635. "_whileFalse_",
  6636. smalltalk.method({
  6637. selector: "whileFalse:",
  6638. category: 'controlling',
  6639. fn: function (aBlock) {
  6640. var self = this;
  6641. while (!self()) {
  6642. aBlock();
  6643. }
  6644. return self;
  6645. },
  6646. args: ["aBlock"],
  6647. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  6648. messageSends: [],
  6649. referencedClasses: []
  6650. }),
  6651. smalltalk.BlockClosure);
  6652. smalltalk.addMethod(
  6653. "_whileTrue",
  6654. smalltalk.method({
  6655. selector: "whileTrue",
  6656. category: 'controlling',
  6657. fn: function () {
  6658. var self = this;
  6659. smalltalk.send(self, "_whileTrue_", [function () {}]);
  6660. return self;
  6661. },
  6662. args: [],
  6663. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  6664. messageSends: ["whileTrue:"],
  6665. referencedClasses: []
  6666. }),
  6667. smalltalk.BlockClosure);
  6668. smalltalk.addMethod(
  6669. "_whileTrue_",
  6670. smalltalk.method({
  6671. selector: "whileTrue:",
  6672. category: 'controlling',
  6673. fn: function (aBlock) {
  6674. var self = this;
  6675. while (self()) {
  6676. aBlock();
  6677. }
  6678. return self;
  6679. },
  6680. args: ["aBlock"],
  6681. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  6682. messageSends: [],
  6683. referencedClasses: []
  6684. }),
  6685. smalltalk.BlockClosure);
  6686. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  6687. 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"
  6688. smalltalk.addMethod(
  6689. "_arguments",
  6690. smalltalk.method({
  6691. selector: "arguments",
  6692. category: 'accessing',
  6693. fn: function () {
  6694. var self = this;
  6695. return self.args || [];
  6696. return self;
  6697. },
  6698. args: [],
  6699. source: "arguments\x0a\x09<return self.args || []>",
  6700. messageSends: [],
  6701. referencedClasses: []
  6702. }),
  6703. smalltalk.CompiledMethod);
  6704. smalltalk.addMethod(
  6705. "_category",
  6706. smalltalk.method({
  6707. selector: "category",
  6708. category: 'accessing',
  6709. fn: function () {
  6710. var self = this;
  6711. var $2, $1;
  6712. $2 = smalltalk.send(self, "_basicAt_", ["category"]);
  6713. if (($receiver = $2) == nil || $receiver == undefined) {
  6714. $1 = "";
  6715. } else {
  6716. $1 = $2;
  6717. }
  6718. return $1;
  6719. },
  6720. args: [],
  6721. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  6722. messageSends: ["ifNil:", "basicAt:"],
  6723. referencedClasses: []
  6724. }),
  6725. smalltalk.CompiledMethod);
  6726. smalltalk.addMethod(
  6727. "_category_",
  6728. smalltalk.method({
  6729. selector: "category:",
  6730. category: 'accessing',
  6731. fn: function (aString){
  6732. var self=this;
  6733. var $1;
  6734. var oldCategory;
  6735. oldCategory=smalltalk.send(self,"_category",[]);
  6736. smalltalk.send(self,"_basicAt_put_",["category",aString]);
  6737. $1=smalltalk.send(self,"_methodClass",[]);
  6738. if(($receiver = $1) == nil || $receiver == undefined){
  6739. $1;
  6740. } else {
  6741. smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
  6742. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
  6743. return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
  6744. })]),"_ifEmpty_",[(function(){
  6745. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
  6746. })]);
  6747. };
  6748. return self},
  6749. args: ["aString"],
  6750. 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 ] ]",
  6751. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  6752. referencedClasses: []
  6753. }),
  6754. smalltalk.CompiledMethod);
  6755. smalltalk.addMethod(
  6756. "_fn",
  6757. smalltalk.method({
  6758. selector: "fn",
  6759. category: 'accessing',
  6760. fn: function () {
  6761. var self = this;
  6762. var $1;
  6763. $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
  6764. return $1;
  6765. },
  6766. args: [],
  6767. source: "fn\x0a\x09^self basicAt: 'fn'",
  6768. messageSends: ["basicAt:"],
  6769. referencedClasses: []
  6770. }),
  6771. smalltalk.CompiledMethod);
  6772. smalltalk.addMethod(
  6773. "_fn_",
  6774. smalltalk.method({
  6775. selector: "fn:",
  6776. category: 'accessing',
  6777. fn: function (aBlock) {
  6778. var self = this;
  6779. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  6780. return self;
  6781. },
  6782. args: ["aBlock"],
  6783. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  6784. messageSends: ["basicAt:put:"],
  6785. referencedClasses: []
  6786. }),
  6787. smalltalk.CompiledMethod);
  6788. smalltalk.addMethod(
  6789. "_messageSends",
  6790. smalltalk.method({
  6791. selector: "messageSends",
  6792. category: 'accessing',
  6793. fn: function () {
  6794. var self = this;
  6795. var $1;
  6796. $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
  6797. return $1;
  6798. },
  6799. args: [],
  6800. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  6801. messageSends: ["basicAt:"],
  6802. referencedClasses: []
  6803. }),
  6804. smalltalk.CompiledMethod);
  6805. smalltalk.addMethod(
  6806. "_methodClass",
  6807. smalltalk.method({
  6808. selector: "methodClass",
  6809. category: 'accessing',
  6810. fn: function () {
  6811. var self = this;
  6812. var $1;
  6813. $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
  6814. return $1;
  6815. },
  6816. args: [],
  6817. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  6818. messageSends: ["basicAt:"],
  6819. referencedClasses: []
  6820. }),
  6821. smalltalk.CompiledMethod);
  6822. smalltalk.addMethod(
  6823. "_protocol",
  6824. smalltalk.method({
  6825. selector: "protocol",
  6826. category: 'accessing',
  6827. fn: function () {
  6828. var self = this;
  6829. var $1;
  6830. $1 = smalltalk.send(self, "_category", []);
  6831. return $1;
  6832. },
  6833. args: [],
  6834. source: "protocol\x0a\x09^ self category",
  6835. messageSends: ["category"],
  6836. referencedClasses: []
  6837. }),
  6838. smalltalk.CompiledMethod);
  6839. smalltalk.addMethod(
  6840. "_referencedClasses",
  6841. smalltalk.method({
  6842. selector: "referencedClasses",
  6843. category: 'accessing',
  6844. fn: function () {
  6845. var self = this;
  6846. var $1;
  6847. $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  6848. return $1;
  6849. },
  6850. args: [],
  6851. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  6852. messageSends: ["basicAt:"],
  6853. referencedClasses: []
  6854. }),
  6855. smalltalk.CompiledMethod);
  6856. smalltalk.addMethod(
  6857. "_selector",
  6858. smalltalk.method({
  6859. selector: "selector",
  6860. category: 'accessing',
  6861. fn: function () {
  6862. var self = this;
  6863. var $1;
  6864. $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
  6865. return $1;
  6866. },
  6867. args: [],
  6868. source: "selector\x0a\x09^self basicAt: 'selector'",
  6869. messageSends: ["basicAt:"],
  6870. referencedClasses: []
  6871. }),
  6872. smalltalk.CompiledMethod);
  6873. smalltalk.addMethod(
  6874. "_selector_",
  6875. smalltalk.method({
  6876. selector: "selector:",
  6877. category: 'accessing',
  6878. fn: function (aString) {
  6879. var self = this;
  6880. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  6881. return self;
  6882. },
  6883. args: ["aString"],
  6884. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  6885. messageSends: ["basicAt:put:"],
  6886. referencedClasses: []
  6887. }),
  6888. smalltalk.CompiledMethod);
  6889. smalltalk.addMethod(
  6890. "_source",
  6891. smalltalk.method({
  6892. selector: "source",
  6893. category: 'accessing',
  6894. fn: function () {
  6895. var self = this;
  6896. var $2, $1;
  6897. $2 = smalltalk.send(self, "_basicAt_", ["source"]);
  6898. if (($receiver = $2) == nil || $receiver == undefined) {
  6899. $1 = "";
  6900. } else {
  6901. $1 = $2;
  6902. }
  6903. return $1;
  6904. },
  6905. args: [],
  6906. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  6907. messageSends: ["ifNil:", "basicAt:"],
  6908. referencedClasses: []
  6909. }),
  6910. smalltalk.CompiledMethod);
  6911. smalltalk.addMethod(
  6912. "_source_",
  6913. smalltalk.method({
  6914. selector: "source:",
  6915. category: 'accessing',
  6916. fn: function (aString) {
  6917. var self = this;
  6918. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  6919. return self;
  6920. },
  6921. args: ["aString"],
  6922. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  6923. messageSends: ["basicAt:put:"],
  6924. referencedClasses: []
  6925. }),
  6926. smalltalk.CompiledMethod);
  6927. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  6928. smalltalk.addMethod(
  6929. "_addWorker",
  6930. smalltalk.method({
  6931. selector: "addWorker",
  6932. category: 'action',
  6933. fn: function (){
  6934. var self=this;
  6935. smalltalk.send(self["@worker"],"_valueWithTimeout_",[(0)]);
  6936. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__plus",[(1)]);
  6937. return self},
  6938. args: [],
  6939. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
  6940. messageSends: ["valueWithTimeout:", "+"],
  6941. referencedClasses: []
  6942. }),
  6943. smalltalk.ForkPool);
  6944. smalltalk.addMethod(
  6945. "_fork_",
  6946. smalltalk.method({
  6947. selector: "fork:",
  6948. category: 'action',
  6949. fn: function (aBlock){
  6950. var self=this;
  6951. var $1;
  6952. $1=smalltalk.send(self["@poolSize"],"__lt",[self["@maxPoolSize"]]);
  6953. if(smalltalk.assert($1)){
  6954. smalltalk.send(self,"_addWorker",[]);
  6955. };
  6956. smalltalk.send(self["@queue"],"_back_",[aBlock]);
  6957. return self},
  6958. args: ["aBlock"],
  6959. source: "fork: aBlock\x0a\x09poolSize < maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
  6960. messageSends: ["ifTrue:", "addWorker", "<", "back:"],
  6961. referencedClasses: []
  6962. }),
  6963. smalltalk.ForkPool);
  6964. smalltalk.addMethod(
  6965. "_initialize",
  6966. smalltalk.method({
  6967. selector: "initialize",
  6968. category: 'initialization',
  6969. fn: function (){
  6970. var self=this;
  6971. var $1;
  6972. var sentinel;
  6973. self["@poolSize"]=(0);
  6974. self["@maxPoolSize"]=smalltalk.send(smalltalk.send(self,"_class",[]),"_defaultMaxPoolSize",[]);
  6975. self["@queue"]=smalltalk.send((smalltalk.Queue || Queue),"_new",[]);
  6976. sentinel=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  6977. self["@worker"]=(function(){
  6978. var block;
  6979. self["@poolSize"]=smalltalk.send(self["@poolSize"],"__minus",[(1)]);
  6980. self["@poolSize"];
  6981. block=smalltalk.send(self["@queue"],"_frontIfAbsent_",[(function(){
  6982. return sentinel;
  6983. })]);
  6984. block;
  6985. $1=smalltalk.send(block,"__eq_eq",[sentinel]);
  6986. if(! smalltalk.assert($1)){
  6987. return smalltalk.send((function(){
  6988. return smalltalk.send(block,"_value",[]);
  6989. }),"_ensure_",[(function(){
  6990. return smalltalk.send(self,"_addWorker",[]);
  6991. })]);
  6992. };
  6993. });
  6994. return self},
  6995. args: [],
  6996. source: "initialize\x0a\x09| sentinel |\x0a\x09poolSize := 0.\x0a maxPoolSize := self class defaultMaxPoolSize.\x0a queue := Queue new.\x0a sentinel := Object new.\x0a worker := [\x0a\x09\x09| block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]].",
  6997. messageSends: ["defaultMaxPoolSize", "class", "new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  6998. referencedClasses: ["Queue", "Object"]
  6999. }),
  7000. smalltalk.ForkPool);
  7001. smalltalk.ForkPool.klass.iVarNames = ['default'];
  7002. smalltalk.addMethod(
  7003. "_default",
  7004. smalltalk.method({
  7005. selector: "default",
  7006. category: 'accessing',
  7007. fn: function (){
  7008. var self=this;
  7009. var $1;
  7010. if(($receiver = self["@default"]) == nil || $receiver == undefined){
  7011. self["@default"]=smalltalk.send(self,"_new",[]);
  7012. $1=self["@default"];
  7013. } else {
  7014. $1=self["@default"];
  7015. };
  7016. return $1;
  7017. },
  7018. args: [],
  7019. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  7020. messageSends: ["ifNil:", "new"],
  7021. referencedClasses: []
  7022. }),
  7023. smalltalk.ForkPool.klass);
  7024. smalltalk.addMethod(
  7025. "_defaultMaxPoolSize",
  7026. smalltalk.method({
  7027. selector: "defaultMaxPoolSize",
  7028. category: 'accessing',
  7029. fn: function (){
  7030. var self=this;
  7031. return (100);
  7032. },
  7033. args: [],
  7034. source: "defaultMaxPoolSize\x0a\x09^100",
  7035. messageSends: [],
  7036. referencedClasses: []
  7037. }),
  7038. smalltalk.ForkPool.klass);
  7039. smalltalk.addMethod(
  7040. "_resetDefault",
  7041. smalltalk.method({
  7042. selector: "resetDefault",
  7043. category: 'accessing',
  7044. fn: function (){
  7045. var self=this;
  7046. self["@default"]=nil;
  7047. return self},
  7048. args: [],
  7049. source: "resetDefault\x0a\x09default := nil",
  7050. messageSends: [],
  7051. referencedClasses: []
  7052. }),
  7053. smalltalk.ForkPool.klass);
  7054. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  7055. 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:`"
  7056. smalltalk.addMethod(
  7057. "_arguments",
  7058. smalltalk.method({
  7059. selector: "arguments",
  7060. category: 'accessing',
  7061. fn: function () {
  7062. var self = this;
  7063. return self['@arguments'];
  7064. },
  7065. args: [],
  7066. source: "arguments\x0a\x09^arguments",
  7067. messageSends: [],
  7068. referencedClasses: []
  7069. }),
  7070. smalltalk.Message);
  7071. smalltalk.addMethod(
  7072. "_arguments_",
  7073. smalltalk.method({
  7074. selector: "arguments:",
  7075. category: 'accessing',
  7076. fn: function (anArray) {
  7077. var self = this;
  7078. self['@arguments'] = anArray;
  7079. return self;
  7080. },
  7081. args: ["anArray"],
  7082. source: "arguments: anArray\x0a\x09arguments := anArray",
  7083. messageSends: [],
  7084. referencedClasses: []
  7085. }),
  7086. smalltalk.Message);
  7087. smalltalk.addMethod(
  7088. "_printString",
  7089. smalltalk.method({
  7090. selector: "printString",
  7091. category: 'printing',
  7092. fn: function () {
  7093. var self = this;
  7094. var $2, $1;
  7095. $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;}]);
  7096. return $1;
  7097. },
  7098. args: [],
  7099. 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]",
  7100. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  7101. referencedClasses: ["String"]
  7102. }),
  7103. smalltalk.Message);
  7104. smalltalk.addMethod(
  7105. "_selector",
  7106. smalltalk.method({
  7107. selector: "selector",
  7108. category: 'accessing',
  7109. fn: function () {
  7110. var self = this;
  7111. return self['@selector'];
  7112. },
  7113. args: [],
  7114. source: "selector\x0a\x09^selector",
  7115. messageSends: [],
  7116. referencedClasses: []
  7117. }),
  7118. smalltalk.Message);
  7119. smalltalk.addMethod(
  7120. "_selector_",
  7121. smalltalk.method({
  7122. selector: "selector:",
  7123. category: 'accessing',
  7124. fn: function (aString) {
  7125. var self = this;
  7126. self['@selector'] = aString;
  7127. return self;
  7128. },
  7129. args: ["aString"],
  7130. source: "selector: aString\x0a\x09selector := aString",
  7131. messageSends: [],
  7132. referencedClasses: []
  7133. }),
  7134. smalltalk.Message);
  7135. smalltalk.addMethod(
  7136. "_sendTo_",
  7137. smalltalk.method({
  7138. selector: "sendTo:",
  7139. category: 'printing',
  7140. fn: function (anObject) {
  7141. var self = this;
  7142. var $1;
  7143. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
  7144. return $1;
  7145. },
  7146. args: ["anObject"],
  7147. source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
  7148. messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
  7149. referencedClasses: ["Smalltalk"]
  7150. }),
  7151. smalltalk.Message);
  7152. smalltalk.addMethod(
  7153. "_selector_arguments_",
  7154. smalltalk.method({
  7155. selector: "selector:arguments:",
  7156. category: 'instance creation',
  7157. fn: function (aString, anArray) {
  7158. var self = this;
  7159. var $2, $3, $1;
  7160. $2 = smalltalk.send(self, "_new", []);
  7161. smalltalk.send($2, "_selector_", [aString]);
  7162. smalltalk.send($2, "_arguments_", [anArray]);
  7163. $3 = smalltalk.send($2, "_yourself", []);
  7164. $1 = $3;
  7165. return $1;
  7166. },
  7167. args: ["aString", "anArray"],
  7168. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  7169. messageSends: ["selector:", "new", "arguments:", "yourself"],
  7170. referencedClasses: []
  7171. }),
  7172. smalltalk.Message.klass);
  7173. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  7174. 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."
  7175. smalltalk.addMethod(
  7176. "_asString",
  7177. smalltalk.method({
  7178. selector: "asString",
  7179. category: 'accessing',
  7180. fn: function () {
  7181. var self = this;
  7182. var $1;
  7183. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
  7184. return $1;
  7185. },
  7186. args: [],
  7187. source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
  7188. messageSends: [",", "selector", "printString", "class", "receiver"],
  7189. referencedClasses: []
  7190. }),
  7191. smalltalk.MethodContext);
  7192. smalltalk.addMethod(
  7193. "_home",
  7194. smalltalk.method({
  7195. selector: "home",
  7196. category: 'accessing',
  7197. fn: function () {
  7198. var self = this;
  7199. return self.homeContext;
  7200. return self;
  7201. },
  7202. args: [],
  7203. source: "home\x0a\x09<return self.homeContext>",
  7204. messageSends: [],
  7205. referencedClasses: []
  7206. }),
  7207. smalltalk.MethodContext);
  7208. smalltalk.addMethod(
  7209. "_pc",
  7210. smalltalk.method({
  7211. selector: "pc",
  7212. category: 'accessing',
  7213. fn: function () {
  7214. var self = this;
  7215. return self.pc;
  7216. return self;
  7217. },
  7218. args: [],
  7219. source: "pc\x0a\x09<return self.pc>",
  7220. messageSends: [],
  7221. referencedClasses: []
  7222. }),
  7223. smalltalk.MethodContext);
  7224. smalltalk.addMethod(
  7225. "_printString",
  7226. smalltalk.method({
  7227. selector: "printString",
  7228. category: 'accessing',
  7229. fn: function () {
  7230. var self = this;
  7231. var $1;
  7232. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
  7233. return $1;
  7234. },
  7235. args: [],
  7236. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  7237. messageSends: [",", "asString", "printString"],
  7238. referencedClasses: []
  7239. }),
  7240. smalltalk.MethodContext);
  7241. smalltalk.addMethod(
  7242. "_receiver",
  7243. smalltalk.method({
  7244. selector: "receiver",
  7245. category: 'accessing',
  7246. fn: function () {
  7247. var self = this;
  7248. return self.receiver;
  7249. return self;
  7250. },
  7251. args: [],
  7252. source: "receiver\x0a\x09<return self.receiver>",
  7253. messageSends: [],
  7254. referencedClasses: []
  7255. }),
  7256. smalltalk.MethodContext);
  7257. smalltalk.addMethod(
  7258. "_selector",
  7259. smalltalk.method({
  7260. selector: "selector",
  7261. category: 'accessing',
  7262. fn: function () {
  7263. var self = this;
  7264. return smalltalk.convertSelector(self.selector);
  7265. return self;
  7266. },
  7267. args: [],
  7268. source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
  7269. messageSends: [],
  7270. referencedClasses: []
  7271. }),
  7272. smalltalk.MethodContext);
  7273. smalltalk.addMethod(
  7274. "_temps",
  7275. smalltalk.method({
  7276. selector: "temps",
  7277. category: 'accessing',
  7278. fn: function () {
  7279. var self = this;
  7280. return self.temps;
  7281. return self;
  7282. },
  7283. args: [],
  7284. source: "temps\x0a\x09<return self.temps>",
  7285. messageSends: [],
  7286. referencedClasses: []
  7287. }),
  7288. smalltalk.MethodContext);
  7289. smalltalk.addPackage('Kernel-Collections', {});
  7290. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  7291. smalltalk.addMethod(
  7292. "__eq",
  7293. smalltalk.method({
  7294. selector: "=",
  7295. category: 'comparing',
  7296. fn: function (anAssociation){
  7297. var self=this;
  7298. var $1;
  7299. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(anAssociation,"_class",[])]),"_and_",[(function(){
  7300. return smalltalk.send(smalltalk.send(smalltalk.send(self,"_key",[]),"__eq",[smalltalk.send(anAssociation,"_key",[])]),"_and_",[(function(){
  7301. return smalltalk.send(smalltalk.send(self,"_value",[]),"__eq",[smalltalk.send(anAssociation,"_value",[])]);
  7302. })]);
  7303. })]);
  7304. return $1;
  7305. },
  7306. args: ["anAssociation"],
  7307. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  7308. messageSends: ["and:", "=", "value", "key", "class"],
  7309. referencedClasses: []
  7310. }),
  7311. smalltalk.Association);
  7312. smalltalk.addMethod(
  7313. "_key",
  7314. smalltalk.method({
  7315. selector: "key",
  7316. category: 'accessing',
  7317. fn: function (){
  7318. var self=this;
  7319. return self["@key"];
  7320. },
  7321. args: [],
  7322. source: "key\x0a\x09^key",
  7323. messageSends: [],
  7324. referencedClasses: []
  7325. }),
  7326. smalltalk.Association);
  7327. smalltalk.addMethod(
  7328. "_key_",
  7329. smalltalk.method({
  7330. selector: "key:",
  7331. category: 'accessing',
  7332. fn: function (aKey){
  7333. var self=this;
  7334. self["@key"]=aKey;
  7335. return self},
  7336. args: ["aKey"],
  7337. source: "key: aKey\x0a\x09key := aKey",
  7338. messageSends: [],
  7339. referencedClasses: []
  7340. }),
  7341. smalltalk.Association);
  7342. smalltalk.addMethod(
  7343. "_printString",
  7344. smalltalk.method({
  7345. selector: "printString",
  7346. category: 'printing',
  7347. fn: function (){
  7348. var self=this;
  7349. var $1;
  7350. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  7351. return smalltalk.send(self,"_storeOn_",[aStream]);
  7352. })]);
  7353. return $1;
  7354. },
  7355. args: [],
  7356. 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]",
  7357. messageSends: ["streamContents:", "storeOn:"],
  7358. referencedClasses: ["String"]
  7359. }),
  7360. smalltalk.Association);
  7361. smalltalk.addMethod(
  7362. "_storeOn_",
  7363. smalltalk.method({
  7364. selector: "storeOn:",
  7365. category: 'printing',
  7366. fn: function (aStream){
  7367. var self=this;
  7368. smalltalk.send(self["@key"],"_storeOn_",[aStream]);
  7369. smalltalk.send(aStream,"_nextPutAll_",["->"]);
  7370. smalltalk.send(self["@value"],"_storeOn_",[aStream]);
  7371. return self},
  7372. args: ["aStream"],
  7373. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  7374. messageSends: ["storeOn:", "nextPutAll:"],
  7375. referencedClasses: []
  7376. }),
  7377. smalltalk.Association);
  7378. smalltalk.addMethod(
  7379. "_value",
  7380. smalltalk.method({
  7381. selector: "value",
  7382. category: 'accessing',
  7383. fn: function (){
  7384. var self=this;
  7385. return self["@value"];
  7386. },
  7387. args: [],
  7388. source: "value\x0a\x09^value",
  7389. messageSends: [],
  7390. referencedClasses: []
  7391. }),
  7392. smalltalk.Association);
  7393. smalltalk.addMethod(
  7394. "_value_",
  7395. smalltalk.method({
  7396. selector: "value:",
  7397. category: 'accessing',
  7398. fn: function (aValue){
  7399. var self=this;
  7400. self["@value"]=aValue;
  7401. return self},
  7402. args: ["aValue"],
  7403. source: "value: aValue\x0a\x09value := aValue",
  7404. messageSends: [],
  7405. referencedClasses: []
  7406. }),
  7407. smalltalk.Association);
  7408. smalltalk.addMethod(
  7409. "_key_value_",
  7410. smalltalk.method({
  7411. selector: "key:value:",
  7412. category: 'instance creation',
  7413. fn: function (aKey,aValue){
  7414. var self=this;
  7415. var $2,$3,$1;
  7416. $2=smalltalk.send(self,"_new",[]);
  7417. smalltalk.send($2,"_key_",[aKey]);
  7418. smalltalk.send($2,"_value_",[aValue]);
  7419. $3=smalltalk.send($2,"_yourself",[]);
  7420. $1=$3;
  7421. return $1;
  7422. },
  7423. args: ["aKey", "aValue"],
  7424. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7425. messageSends: ["key:", "new", "value:", "yourself"],
  7426. referencedClasses: []
  7427. }),
  7428. smalltalk.Association.klass);
  7429. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  7430. smalltalk.addMethod(
  7431. "__comma",
  7432. smalltalk.method({
  7433. selector: ",",
  7434. category: 'copying',
  7435. fn: function (aCollection){
  7436. var self=this;
  7437. var $2,$3,$1;
  7438. $2=smalltalk.send(self,"_copy",[]);
  7439. smalltalk.send($2,"_addAll_",[aCollection]);
  7440. $3=smalltalk.send($2,"_yourself",[]);
  7441. $1=$3;
  7442. return $1;
  7443. },
  7444. args: ["aCollection"],
  7445. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  7446. messageSends: ["addAll:", "copy", "yourself"],
  7447. referencedClasses: []
  7448. }),
  7449. smalltalk.Collection);
  7450. smalltalk.addMethod(
  7451. "_add_",
  7452. smalltalk.method({
  7453. selector: "add:",
  7454. category: 'adding/removing',
  7455. fn: function (anObject){
  7456. var self=this;
  7457. smalltalk.send(self,"_subclassResponsibility",[]);
  7458. return self},
  7459. args: ["anObject"],
  7460. source: "add: anObject\x0a\x09self subclassResponsibility",
  7461. messageSends: ["subclassResponsibility"],
  7462. referencedClasses: []
  7463. }),
  7464. smalltalk.Collection);
  7465. smalltalk.addMethod(
  7466. "_addAll_",
  7467. smalltalk.method({
  7468. selector: "addAll:",
  7469. category: 'adding/removing',
  7470. fn: function (aCollection){
  7471. var self=this;
  7472. smalltalk.send(aCollection,"_do_",[(function(each){
  7473. return smalltalk.send(self,"_add_",[each]);
  7474. })]);
  7475. return aCollection;
  7476. },
  7477. args: ["aCollection"],
  7478. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  7479. messageSends: ["do:", "add:"],
  7480. referencedClasses: []
  7481. }),
  7482. smalltalk.Collection);
  7483. smalltalk.addMethod(
  7484. "_asArray",
  7485. smalltalk.method({
  7486. selector: "asArray",
  7487. category: 'converting',
  7488. fn: function (){
  7489. var self=this;
  7490. var $1;
  7491. $1=smalltalk.send((smalltalk.Array || Array),"_withAll_",[self]);
  7492. return $1;
  7493. },
  7494. args: [],
  7495. source: "asArray\x0a\x09^Array withAll: self",
  7496. messageSends: ["withAll:"],
  7497. referencedClasses: ["Array"]
  7498. }),
  7499. smalltalk.Collection);
  7500. smalltalk.addMethod(
  7501. "_asJSON",
  7502. smalltalk.method({
  7503. selector: "asJSON",
  7504. category: 'converting',
  7505. fn: function (){
  7506. var self=this;
  7507. var $1;
  7508. $1=smalltalk.send(smalltalk.send(self,"_asArray",[]),"_collect_",[(function(each){
  7509. return smalltalk.send(each,"_asJSON",[]);
  7510. })]);
  7511. return $1;
  7512. },
  7513. args: [],
  7514. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  7515. messageSends: ["collect:", "asJSON", "asArray"],
  7516. referencedClasses: []
  7517. }),
  7518. smalltalk.Collection);
  7519. smalltalk.addMethod(
  7520. "_asOrderedCollection",
  7521. smalltalk.method({
  7522. selector: "asOrderedCollection",
  7523. category: 'converting',
  7524. fn: function (){
  7525. var self=this;
  7526. var $1;
  7527. $1=smalltalk.send(self,"_asArray",[]);
  7528. return $1;
  7529. },
  7530. args: [],
  7531. source: "asOrderedCollection\x0a\x09^self asArray",
  7532. messageSends: ["asArray"],
  7533. referencedClasses: []
  7534. }),
  7535. smalltalk.Collection);
  7536. smalltalk.addMethod(
  7537. "_asSet",
  7538. smalltalk.method({
  7539. selector: "asSet",
  7540. category: 'converting',
  7541. fn: function (){
  7542. var self=this;
  7543. var $1;
  7544. $1=smalltalk.send((smalltalk.Set || Set),"_withAll_",[self]);
  7545. return $1;
  7546. },
  7547. args: [],
  7548. source: "asSet\x0a\x09^Set withAll: self",
  7549. messageSends: ["withAll:"],
  7550. referencedClasses: ["Set"]
  7551. }),
  7552. smalltalk.Collection);
  7553. smalltalk.addMethod(
  7554. "_collect_",
  7555. smalltalk.method({
  7556. selector: "collect:",
  7557. category: 'enumerating',
  7558. fn: function (aBlock){
  7559. var self=this;
  7560. var $1;
  7561. var stream;
  7562. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  7563. smalltalk.send(self,"_do_",[(function(each){
  7564. return smalltalk.send(stream,"_nextPut_",[smalltalk.send(aBlock,"_value_",[each])]);
  7565. })]);
  7566. $1=smalltalk.send(stream,"_contents",[]);
  7567. return $1;
  7568. },
  7569. args: ["aBlock"],
  7570. 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",
  7571. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  7572. referencedClasses: []
  7573. }),
  7574. smalltalk.Collection);
  7575. smalltalk.addMethod(
  7576. "_copyWith_",
  7577. smalltalk.method({
  7578. selector: "copyWith:",
  7579. category: 'copying',
  7580. fn: function (anObject){
  7581. var self=this;
  7582. var $2,$3,$1;
  7583. $2=smalltalk.send(self,"_copy",[]);
  7584. smalltalk.send($2,"_add_",[anObject]);
  7585. $3=smalltalk.send($2,"_yourself",[]);
  7586. $1=$3;
  7587. return $1;
  7588. },
  7589. args: ["anObject"],
  7590. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  7591. messageSends: ["add:", "copy", "yourself"],
  7592. referencedClasses: []
  7593. }),
  7594. smalltalk.Collection);
  7595. smalltalk.addMethod(
  7596. "_copyWithAll_",
  7597. smalltalk.method({
  7598. selector: "copyWithAll:",
  7599. category: 'copying',
  7600. fn: function (aCollection){
  7601. var self=this;
  7602. var $2,$3,$1;
  7603. $2=smalltalk.send(self,"_copy",[]);
  7604. smalltalk.send($2,"_addAll_",[aCollection]);
  7605. $3=smalltalk.send($2,"_yourself",[]);
  7606. $1=$3;
  7607. return $1;
  7608. },
  7609. args: ["aCollection"],
  7610. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  7611. messageSends: ["addAll:", "copy", "yourself"],
  7612. referencedClasses: []
  7613. }),
  7614. smalltalk.Collection);
  7615. smalltalk.addMethod(
  7616. "_copyWithoutAll_",
  7617. smalltalk.method({
  7618. selector: "copyWithoutAll:",
  7619. category: 'copying',
  7620. fn: function (aCollection){
  7621. var self=this;
  7622. var $1;
  7623. $1=smalltalk.send(self,"_reject_",[(function(each){
  7624. return smalltalk.send(aCollection,"_includes_",[each]);
  7625. })]);
  7626. return $1;
  7627. },
  7628. args: ["aCollection"],
  7629. 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]",
  7630. messageSends: ["reject:", "includes:"],
  7631. referencedClasses: []
  7632. }),
  7633. smalltalk.Collection);
  7634. smalltalk.addMethod(
  7635. "_detect_",
  7636. smalltalk.method({
  7637. selector: "detect:",
  7638. category: 'enumerating',
  7639. fn: function (aBlock){
  7640. var self=this;
  7641. var $1;
  7642. $1=smalltalk.send(self,"_detect_ifNone_",[aBlock,(function(){
  7643. return smalltalk.send(self,"_errorNotFound",[]);
  7644. })]);
  7645. return $1;
  7646. },
  7647. args: ["aBlock"],
  7648. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  7649. messageSends: ["detect:ifNone:", "errorNotFound"],
  7650. referencedClasses: []
  7651. }),
  7652. smalltalk.Collection);
  7653. smalltalk.addMethod(
  7654. "_detect_ifNone_",
  7655. smalltalk.method({
  7656. selector: "detect:ifNone:",
  7657. category: 'enumerating',
  7658. fn: function (aBlock,anotherBlock){
  7659. var self=this;
  7660. for(var i = 0; i < self.length; i++)
  7661. if(aBlock(self[i]))
  7662. return self[i];
  7663. return anotherBlock();
  7664. ;
  7665. ;
  7666. return self},
  7667. args: ["aBlock", "anotherBlock"],
  7668. 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>",
  7669. messageSends: [],
  7670. referencedClasses: []
  7671. }),
  7672. smalltalk.Collection);
  7673. smalltalk.addMethod(
  7674. "_do_",
  7675. smalltalk.method({
  7676. selector: "do:",
  7677. category: 'enumerating',
  7678. fn: function (aBlock){
  7679. var self=this;
  7680. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  7681. ;
  7682. return self},
  7683. args: ["aBlock"],
  7684. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  7685. messageSends: [],
  7686. referencedClasses: []
  7687. }),
  7688. smalltalk.Collection);
  7689. smalltalk.addMethod(
  7690. "_do_separatedBy_",
  7691. smalltalk.method({
  7692. selector: "do:separatedBy:",
  7693. category: 'enumerating',
  7694. fn: function (aBlock,anotherBlock){
  7695. var self=this;
  7696. var first;
  7697. first=true;
  7698. smalltalk.send(self,"_do_",[(function(each){
  7699. if(smalltalk.assert(first)){
  7700. first=false;
  7701. first;
  7702. } else {
  7703. smalltalk.send(anotherBlock,"_value",[]);
  7704. };
  7705. return smalltalk.send(aBlock,"_value_",[each]);
  7706. })]);
  7707. return self},
  7708. args: ["aBlock", "anotherBlock"],
  7709. 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]",
  7710. messageSends: ["do:", "ifTrue:ifFalse:", "value", "value:"],
  7711. referencedClasses: []
  7712. }),
  7713. smalltalk.Collection);
  7714. smalltalk.addMethod(
  7715. "_errorNotFound",
  7716. smalltalk.method({
  7717. selector: "errorNotFound",
  7718. category: 'error handling',
  7719. fn: function (){
  7720. var self=this;
  7721. smalltalk.send(self,"_error_",["Object is not in the collection"]);
  7722. return self},
  7723. args: [],
  7724. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7725. messageSends: ["error:"],
  7726. referencedClasses: []
  7727. }),
  7728. smalltalk.Collection);
  7729. smalltalk.addMethod(
  7730. "_ifEmpty_",
  7731. smalltalk.method({
  7732. selector: "ifEmpty:",
  7733. category: 'testing',
  7734. fn: function (aBlock){
  7735. var self=this;
  7736. var $2,$1;
  7737. $2=smalltalk.send(self,"_isEmpty",[]);
  7738. if(smalltalk.assert($2)){
  7739. $1=smalltalk.send(aBlock,"_value",[]);
  7740. } else {
  7741. $1=self;
  7742. };
  7743. return $1;
  7744. },
  7745. args: ["aBlock"],
  7746. 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 ]",
  7747. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  7748. referencedClasses: []
  7749. }),
  7750. smalltalk.Collection);
  7751. smalltalk.addMethod(
  7752. "_ifNotEmpty_",
  7753. smalltalk.method({
  7754. selector: "ifNotEmpty:",
  7755. category: 'testing',
  7756. fn: function (aBlock){
  7757. var self=this;
  7758. var $1;
  7759. $1=smalltalk.send(self,"_notEmpty",[]);
  7760. smalltalk.send($1,"_ifTrue_",[aBlock]);
  7761. return self},
  7762. args: ["aBlock"],
  7763. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  7764. messageSends: ["ifTrue:", "notEmpty"],
  7765. referencedClasses: []
  7766. }),
  7767. smalltalk.Collection);
  7768. smalltalk.addMethod(
  7769. "_includes_",
  7770. smalltalk.method({
  7771. selector: "includes:",
  7772. category: 'testing',
  7773. fn: function (anObject){
  7774. var self=this;
  7775. var i = self.length;
  7776. while (i--) {
  7777. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  7778. }
  7779. return false
  7780. ;
  7781. ;
  7782. return self},
  7783. args: ["anObject"],
  7784. 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>",
  7785. messageSends: [],
  7786. referencedClasses: []
  7787. }),
  7788. smalltalk.Collection);
  7789. smalltalk.addMethod(
  7790. "_inject_into_",
  7791. smalltalk.method({
  7792. selector: "inject:into:",
  7793. category: 'enumerating',
  7794. fn: function (anObject,aBlock){
  7795. var self=this;
  7796. var result;
  7797. result=anObject;
  7798. smalltalk.send(self,"_do_",[(function(each){
  7799. result=smalltalk.send(aBlock,"_value_value_",[result,each]);
  7800. return result;
  7801. })]);
  7802. return result;
  7803. },
  7804. args: ["anObject", "aBlock"],
  7805. 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",
  7806. messageSends: ["do:", "value:value:"],
  7807. referencedClasses: []
  7808. }),
  7809. smalltalk.Collection);
  7810. smalltalk.addMethod(
  7811. "_intersection_",
  7812. smalltalk.method({
  7813. selector: "intersection:",
  7814. category: 'enumerating',
  7815. fn: function (aCollection){
  7816. var self=this;
  7817. var $1,$2;
  7818. var set;
  7819. var outputSet;
  7820. set=smalltalk.send(self,"_asSet",[]);
  7821. outputSet=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  7822. smalltalk.send(aCollection,"_do_",[(function(each){
  7823. $1=smalltalk.send(smalltalk.send(set,"_includes_",[each]),"_and_",[(function(){
  7824. return smalltalk.send(smalltalk.send(outputSet,"_includes_",[each]),"_not",[]);
  7825. })]);
  7826. if(smalltalk.assert($1)){
  7827. return smalltalk.send(outputSet,"_add_",[each]);
  7828. };
  7829. })]);
  7830. $2=smalltalk.send(smalltalk.send(self,"_class",[]),"_withAll_",[smalltalk.send(outputSet,"_asArray",[])]);
  7831. return $2;
  7832. },
  7833. args: ["aCollection"],
  7834. 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",
  7835. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  7836. referencedClasses: ["Set"]
  7837. }),
  7838. smalltalk.Collection);
  7839. smalltalk.addMethod(
  7840. "_isEmpty",
  7841. smalltalk.method({
  7842. selector: "isEmpty",
  7843. category: 'testing',
  7844. fn: function (){
  7845. var self=this;
  7846. var $1;
  7847. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  7848. return $1;
  7849. },
  7850. args: [],
  7851. source: "isEmpty\x0a\x09^self size = 0",
  7852. messageSends: ["=", "size"],
  7853. referencedClasses: []
  7854. }),
  7855. smalltalk.Collection);
  7856. smalltalk.addMethod(
  7857. "_notEmpty",
  7858. smalltalk.method({
  7859. selector: "notEmpty",
  7860. category: 'testing',
  7861. fn: function (){
  7862. var self=this;
  7863. var $1;
  7864. $1=smalltalk.send(smalltalk.send(self,"_isEmpty",[]),"_not",[]);
  7865. return $1;
  7866. },
  7867. args: [],
  7868. source: "notEmpty\x0a\x09^self isEmpty not",
  7869. messageSends: ["not", "isEmpty"],
  7870. referencedClasses: []
  7871. }),
  7872. smalltalk.Collection);
  7873. smalltalk.addMethod(
  7874. "_occurrencesOf_",
  7875. smalltalk.method({
  7876. selector: "occurrencesOf:",
  7877. category: 'accessing',
  7878. fn: function (anObject){
  7879. var self=this;
  7880. var $1;
  7881. var tally;
  7882. tally=(0);
  7883. smalltalk.send(self,"_do_",[(function(each){
  7884. $1=smalltalk.send(anObject,"__eq",[each]);
  7885. if(smalltalk.assert($1)){
  7886. tally=smalltalk.send(tally,"__plus",[(1)]);
  7887. return tally;
  7888. };
  7889. })]);
  7890. return tally;
  7891. },
  7892. args: ["anObject"],
  7893. 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",
  7894. messageSends: ["do:", "ifTrue:", "+", "="],
  7895. referencedClasses: []
  7896. }),
  7897. smalltalk.Collection);
  7898. smalltalk.addMethod(
  7899. "_printString",
  7900. smalltalk.method({
  7901. selector: "printString",
  7902. category: 'printing',
  7903. fn: function (){
  7904. var self=this;
  7905. var $1;
  7906. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  7907. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_printString",[],smalltalk.Object),"__comma",[" ("])]);
  7908. smalltalk.send(self,"_do_separatedBy_",[(function(each){
  7909. return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(each,"_printString",[])]);
  7910. }),(function(){
  7911. return smalltalk.send(aStream,"_nextPutAll_",[" "]);
  7912. })]);
  7913. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  7914. })]);
  7915. return $1;
  7916. },
  7917. args: [],
  7918. 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: ')']",
  7919. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  7920. referencedClasses: ["String"]
  7921. }),
  7922. smalltalk.Collection);
  7923. smalltalk.addMethod(
  7924. "_readStream",
  7925. smalltalk.method({
  7926. selector: "readStream",
  7927. category: 'accessing',
  7928. fn: function (){
  7929. var self=this;
  7930. var $1;
  7931. $1=smalltalk.send(self,"_stream",[]);
  7932. return $1;
  7933. },
  7934. args: [],
  7935. source: "readStream\x0a\x09^self stream",
  7936. messageSends: ["stream"],
  7937. referencedClasses: []
  7938. }),
  7939. smalltalk.Collection);
  7940. smalltalk.addMethod(
  7941. "_reject_",
  7942. smalltalk.method({
  7943. selector: "reject:",
  7944. category: 'enumerating',
  7945. fn: function (aBlock){
  7946. var self=this;
  7947. var $1;
  7948. $1=smalltalk.send(self,"_select_",[(function(each){
  7949. return smalltalk.send(smalltalk.send(aBlock,"_value_",[each]),"__eq",[false]);
  7950. })]);
  7951. return $1;
  7952. },
  7953. args: ["aBlock"],
  7954. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  7955. messageSends: ["select:", "=", "value:"],
  7956. referencedClasses: []
  7957. }),
  7958. smalltalk.Collection);
  7959. smalltalk.addMethod(
  7960. "_remove_",
  7961. smalltalk.method({
  7962. selector: "remove:",
  7963. category: 'adding/removing',
  7964. fn: function (anObject){
  7965. var self=this;
  7966. var $1;
  7967. $1=smalltalk.send(self,"_remove_ifAbsent_",[anObject,(function(){
  7968. return smalltalk.send(self,"_errorNotFound",[]);
  7969. })]);
  7970. return $1;
  7971. },
  7972. args: ["anObject"],
  7973. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  7974. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  7975. referencedClasses: []
  7976. }),
  7977. smalltalk.Collection);
  7978. smalltalk.addMethod(
  7979. "_remove_ifAbsent_",
  7980. smalltalk.method({
  7981. selector: "remove:ifAbsent:",
  7982. category: 'adding/removing',
  7983. fn: function (anObject,aBlock){
  7984. var self=this;
  7985. smalltalk.send(self,"_subclassResponsibility",[]);
  7986. return self},
  7987. args: ["anObject", "aBlock"],
  7988. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  7989. messageSends: ["subclassResponsibility"],
  7990. referencedClasses: []
  7991. }),
  7992. smalltalk.Collection);
  7993. smalltalk.addMethod(
  7994. "_select_",
  7995. smalltalk.method({
  7996. selector: "select:",
  7997. category: 'enumerating',
  7998. fn: function (aBlock){
  7999. var self=this;
  8000. var $1,$2;
  8001. var stream;
  8002. stream=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]),"_writeStream",[]);
  8003. smalltalk.send(self,"_do_",[(function(each){
  8004. $1=smalltalk.send(aBlock,"_value_",[each]);
  8005. if(smalltalk.assert($1)){
  8006. return smalltalk.send(stream,"_nextPut_",[each]);
  8007. };
  8008. })]);
  8009. $2=smalltalk.send(stream,"_contents",[]);
  8010. return $2;
  8011. },
  8012. args: ["aBlock"],
  8013. 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",
  8014. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  8015. referencedClasses: []
  8016. }),
  8017. smalltalk.Collection);
  8018. smalltalk.addMethod(
  8019. "_size",
  8020. smalltalk.method({
  8021. selector: "size",
  8022. category: 'accessing',
  8023. fn: function (){
  8024. var self=this;
  8025. smalltalk.send(self,"_subclassResponsibility",[]);
  8026. return self},
  8027. args: [],
  8028. source: "size\x0a\x09self subclassResponsibility",
  8029. messageSends: ["subclassResponsibility"],
  8030. referencedClasses: []
  8031. }),
  8032. smalltalk.Collection);
  8033. smalltalk.addMethod(
  8034. "_stream",
  8035. smalltalk.method({
  8036. selector: "stream",
  8037. category: 'accessing',
  8038. fn: function (){
  8039. var self=this;
  8040. var $1;
  8041. $1=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[self]);
  8042. return $1;
  8043. },
  8044. args: [],
  8045. source: "stream\x0a\x09^self streamClass on: self",
  8046. messageSends: ["on:", "streamClass"],
  8047. referencedClasses: []
  8048. }),
  8049. smalltalk.Collection);
  8050. smalltalk.addMethod(
  8051. "_streamClass",
  8052. smalltalk.method({
  8053. selector: "streamClass",
  8054. category: 'accessing',
  8055. fn: function (){
  8056. var self=this;
  8057. var $1;
  8058. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_streamClass",[]);
  8059. return $1;
  8060. },
  8061. args: [],
  8062. source: "streamClass\x0a\x09^self class streamClass",
  8063. messageSends: ["streamClass", "class"],
  8064. referencedClasses: []
  8065. }),
  8066. smalltalk.Collection);
  8067. smalltalk.addMethod(
  8068. "_writeStream",
  8069. smalltalk.method({
  8070. selector: "writeStream",
  8071. category: 'accessing',
  8072. fn: function (){
  8073. var self=this;
  8074. var $1;
  8075. $1=smalltalk.send(self,"_stream",[]);
  8076. return $1;
  8077. },
  8078. args: [],
  8079. source: "writeStream\x0a\x09^self stream",
  8080. messageSends: ["stream"],
  8081. referencedClasses: []
  8082. }),
  8083. smalltalk.Collection);
  8084. smalltalk.addMethod(
  8085. "_new_",
  8086. smalltalk.method({
  8087. selector: "new:",
  8088. category: 'instance creation',
  8089. fn: function (anInteger){
  8090. var self=this;
  8091. var $1;
  8092. $1=smalltalk.send(self,"_new",[]);
  8093. return $1;
  8094. },
  8095. args: ["anInteger"],
  8096. source: "new: anInteger\x0a\x09^self new",
  8097. messageSends: ["new"],
  8098. referencedClasses: []
  8099. }),
  8100. smalltalk.Collection.klass);
  8101. smalltalk.addMethod(
  8102. "_streamClass",
  8103. smalltalk.method({
  8104. selector: "streamClass",
  8105. category: 'accessing',
  8106. fn: function (){
  8107. var self=this;
  8108. return (smalltalk.Stream || Stream);
  8109. },
  8110. args: [],
  8111. source: "streamClass\x0a\x09 ^Stream",
  8112. messageSends: [],
  8113. referencedClasses: ["Stream"]
  8114. }),
  8115. smalltalk.Collection.klass);
  8116. smalltalk.addMethod(
  8117. "_with_",
  8118. smalltalk.method({
  8119. selector: "with:",
  8120. category: 'instance creation',
  8121. fn: function (anObject){
  8122. var self=this;
  8123. var $2,$3,$1;
  8124. $2=smalltalk.send(self,"_new",[]);
  8125. smalltalk.send($2,"_add_",[anObject]);
  8126. $3=smalltalk.send($2,"_yourself",[]);
  8127. $1=$3;
  8128. return $1;
  8129. },
  8130. args: ["anObject"],
  8131. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8132. messageSends: ["add:", "new", "yourself"],
  8133. referencedClasses: []
  8134. }),
  8135. smalltalk.Collection.klass);
  8136. smalltalk.addMethod(
  8137. "_with_with_",
  8138. smalltalk.method({
  8139. selector: "with:with:",
  8140. category: 'instance creation',
  8141. fn: function (anObject,anotherObject){
  8142. var self=this;
  8143. var $2,$3,$1;
  8144. $2=smalltalk.send(self,"_new",[]);
  8145. smalltalk.send($2,"_add_",[anObject]);
  8146. smalltalk.send($2,"_add_",[anotherObject]);
  8147. $3=smalltalk.send($2,"_yourself",[]);
  8148. $1=$3;
  8149. return $1;
  8150. },
  8151. args: ["anObject", "anotherObject"],
  8152. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8153. messageSends: ["add:", "new", "yourself"],
  8154. referencedClasses: []
  8155. }),
  8156. smalltalk.Collection.klass);
  8157. smalltalk.addMethod(
  8158. "_with_with_with_",
  8159. smalltalk.method({
  8160. selector: "with:with:with:",
  8161. category: 'instance creation',
  8162. fn: function (firstObject,secondObject,thirdObject){
  8163. var self=this;
  8164. var $2,$3,$1;
  8165. $2=smalltalk.send(self,"_new",[]);
  8166. smalltalk.send($2,"_add_",[firstObject]);
  8167. smalltalk.send($2,"_add_",[secondObject]);
  8168. smalltalk.send($2,"_add_",[thirdObject]);
  8169. $3=smalltalk.send($2,"_yourself",[]);
  8170. $1=$3;
  8171. return $1;
  8172. },
  8173. args: ["firstObject", "secondObject", "thirdObject"],
  8174. 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",
  8175. messageSends: ["add:", "new", "yourself"],
  8176. referencedClasses: []
  8177. }),
  8178. smalltalk.Collection.klass);
  8179. smalltalk.addMethod(
  8180. "_withAll_",
  8181. smalltalk.method({
  8182. selector: "withAll:",
  8183. category: 'instance creation',
  8184. fn: function (aCollection){
  8185. var self=this;
  8186. var $2,$3,$1;
  8187. $2=smalltalk.send(self,"_new",[]);
  8188. smalltalk.send($2,"_addAll_",[aCollection]);
  8189. $3=smalltalk.send($2,"_yourself",[]);
  8190. $1=$3;
  8191. return $1;
  8192. },
  8193. args: ["aCollection"],
  8194. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8195. messageSends: ["addAll:", "new", "yourself"],
  8196. referencedClasses: []
  8197. }),
  8198. smalltalk.Collection.klass);
  8199. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  8200. 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."
  8201. smalltalk.addMethod(
  8202. "__comma",
  8203. smalltalk.method({
  8204. selector: ",",
  8205. category: 'copying',
  8206. fn: function (aCollection){
  8207. var self=this;
  8208. smalltalk.send(self,"_shouldNotImplement",[]);
  8209. return self},
  8210. args: ["aCollection"],
  8211. source: ", aCollection\x0a\x09self shouldNotImplement",
  8212. messageSends: ["shouldNotImplement"],
  8213. referencedClasses: []
  8214. }),
  8215. smalltalk.HashedCollection);
  8216. smalltalk.addMethod(
  8217. "__eq",
  8218. smalltalk.method({
  8219. selector: "=",
  8220. category: 'comparing',
  8221. fn: function (aHashedCollection){
  8222. var self=this;
  8223. var $1,$2,$3;
  8224. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aHashedCollection,"_class",[])]);
  8225. if(! smalltalk.assert($1)){
  8226. return false;
  8227. };
  8228. $2=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aHashedCollection,"_size",[])]);
  8229. if(! smalltalk.assert($2)){
  8230. return false;
  8231. };
  8232. $3=smalltalk.send(smalltalk.send(self,"_associations",[]),"__eq",[smalltalk.send(aHashedCollection,"_associations",[])]);
  8233. return $3;
  8234. },
  8235. args: ["aHashedCollection"],
  8236. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  8237. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  8238. referencedClasses: []
  8239. }),
  8240. smalltalk.HashedCollection);
  8241. smalltalk.addMethod(
  8242. "_add_",
  8243. smalltalk.method({
  8244. selector: "add:",
  8245. category: 'adding/removing',
  8246. fn: function (anAssociation){
  8247. var self=this;
  8248. smalltalk.send(self,"_at_put_",[smalltalk.send(anAssociation,"_key",[]),smalltalk.send(anAssociation,"_value",[])]);
  8249. return self},
  8250. args: ["anAssociation"],
  8251. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8252. messageSends: ["at:put:", "key", "value"],
  8253. referencedClasses: []
  8254. }),
  8255. smalltalk.HashedCollection);
  8256. smalltalk.addMethod(
  8257. "_addAll_",
  8258. smalltalk.method({
  8259. selector: "addAll:",
  8260. category: 'adding/removing',
  8261. fn: function (aHashedCollection){
  8262. var self=this;
  8263. smalltalk.send(self,"_addAll_",[smalltalk.send(aHashedCollection,"_associations",[])],smalltalk.Collection);
  8264. return aHashedCollection;
  8265. },
  8266. args: ["aHashedCollection"],
  8267. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  8268. messageSends: ["addAll:", "associations"],
  8269. referencedClasses: []
  8270. }),
  8271. smalltalk.HashedCollection);
  8272. smalltalk.addMethod(
  8273. "_asDictionary",
  8274. smalltalk.method({
  8275. selector: "asDictionary",
  8276. category: 'converting',
  8277. fn: function (){
  8278. var self=this;
  8279. var $1;
  8280. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  8281. return $1;
  8282. },
  8283. args: [],
  8284. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  8285. messageSends: ["fromPairs:", "associations"],
  8286. referencedClasses: ["Dictionary"]
  8287. }),
  8288. smalltalk.HashedCollection);
  8289. smalltalk.addMethod(
  8290. "_asJSON",
  8291. smalltalk.method({
  8292. selector: "asJSON",
  8293. category: 'converting',
  8294. fn: function (){
  8295. var self=this;
  8296. var c;
  8297. c=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8298. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8299. return smalltalk.send(c,"_at_put_",[key,smalltalk.send(value,"_asJSON",[])]);
  8300. })]);
  8301. return c;
  8302. },
  8303. args: [],
  8304. 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",
  8305. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  8306. referencedClasses: []
  8307. }),
  8308. smalltalk.HashedCollection);
  8309. smalltalk.addMethod(
  8310. "_associations",
  8311. smalltalk.method({
  8312. selector: "associations",
  8313. category: 'accessing',
  8314. fn: function (){
  8315. var self=this;
  8316. var associations;
  8317. associations=[];
  8318. smalltalk.send(smalltalk.send(self,"_keys",[]),"_do_",[(function(each){
  8319. return smalltalk.send(associations,"_add_",[smalltalk.send((smalltalk.Association || Association),"_key_value_",[each,smalltalk.send(self,"_at_",[each])])]);
  8320. })]);
  8321. return associations;
  8322. },
  8323. args: [],
  8324. 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",
  8325. messageSends: ["do:", "add:", "key:value:", "at:", "keys"],
  8326. referencedClasses: ["Association"]
  8327. }),
  8328. smalltalk.HashedCollection);
  8329. smalltalk.addMethod(
  8330. "_associationsDo_",
  8331. smalltalk.method({
  8332. selector: "associationsDo:",
  8333. category: 'enumerating',
  8334. fn: function (aBlock){
  8335. var self=this;
  8336. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_",[aBlock]);
  8337. return self},
  8338. args: ["aBlock"],
  8339. source: "associationsDo: aBlock\x0a\x09self associations do: aBlock",
  8340. messageSends: ["do:", "associations"],
  8341. referencedClasses: []
  8342. }),
  8343. smalltalk.HashedCollection);
  8344. smalltalk.addMethod(
  8345. "_at_",
  8346. smalltalk.method({
  8347. selector: "at:",
  8348. category: 'accessing',
  8349. fn: function (aKey){
  8350. var self=this;
  8351. var $1;
  8352. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8353. return smalltalk.send(self,"_errorNotFound",[]);
  8354. })]);
  8355. return $1;
  8356. },
  8357. args: ["aKey"],
  8358. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  8359. messageSends: ["at:ifAbsent:", "errorNotFound"],
  8360. referencedClasses: []
  8361. }),
  8362. smalltalk.HashedCollection);
  8363. smalltalk.addMethod(
  8364. "_at_ifAbsent_",
  8365. smalltalk.method({
  8366. selector: "at:ifAbsent:",
  8367. category: 'accessing',
  8368. fn: function (aKey,aBlock){
  8369. var self=this;
  8370. var $2,$1;
  8371. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8372. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8373. return smalltalk.send(self,"_basicAt_",[aKey]);
  8374. }),aBlock]);
  8375. return $1;
  8376. },
  8377. args: ["aKey", "aBlock"],
  8378. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  8379. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  8380. referencedClasses: []
  8381. }),
  8382. smalltalk.HashedCollection);
  8383. smalltalk.addMethod(
  8384. "_at_ifAbsentPut_",
  8385. smalltalk.method({
  8386. selector: "at:ifAbsentPut:",
  8387. category: 'accessing',
  8388. fn: function (aKey,aBlock){
  8389. var self=this;
  8390. var $1;
  8391. $1=smalltalk.send(self,"_at_ifAbsent_",[aKey,(function(){
  8392. return smalltalk.send(self,"_at_put_",[aKey,smalltalk.send(aBlock,"_value",[])]);
  8393. })]);
  8394. return $1;
  8395. },
  8396. args: ["aKey", "aBlock"],
  8397. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  8398. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  8399. referencedClasses: []
  8400. }),
  8401. smalltalk.HashedCollection);
  8402. smalltalk.addMethod(
  8403. "_at_ifPresent_",
  8404. smalltalk.method({
  8405. selector: "at:ifPresent:",
  8406. category: 'accessing',
  8407. fn: function (aKey,aBlock){
  8408. var self=this;
  8409. var $2,$1;
  8410. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8411. if(smalltalk.assert($2)){
  8412. $1=smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8413. } else {
  8414. $1=nil;
  8415. };
  8416. return $1;
  8417. },
  8418. args: ["aKey", "aBlock"],
  8419. 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 ]",
  8420. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8421. referencedClasses: []
  8422. }),
  8423. smalltalk.HashedCollection);
  8424. smalltalk.addMethod(
  8425. "_at_ifPresent_ifAbsent_",
  8426. smalltalk.method({
  8427. selector: "at:ifPresent:ifAbsent:",
  8428. category: 'accessing',
  8429. fn: function (aKey,aBlock,anotherBlock){
  8430. var self=this;
  8431. var $2,$1;
  8432. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8433. $1=smalltalk.send($2,"_ifTrue_ifFalse_",[(function(){
  8434. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_at_",[aKey])]);
  8435. }),anotherBlock]);
  8436. return $1;
  8437. },
  8438. args: ["aKey", "aBlock", "anotherBlock"],
  8439. 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",
  8440. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  8441. referencedClasses: []
  8442. }),
  8443. smalltalk.HashedCollection);
  8444. smalltalk.addMethod(
  8445. "_at_put_",
  8446. smalltalk.method({
  8447. selector: "at:put:",
  8448. category: 'accessing',
  8449. fn: function (aKey,aValue){
  8450. var self=this;
  8451. var $1;
  8452. $1=smalltalk.send(self,"_basicAt_put_",[aKey,aValue]);
  8453. return $1;
  8454. },
  8455. args: ["aKey", "aValue"],
  8456. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  8457. messageSends: ["basicAt:put:"],
  8458. referencedClasses: []
  8459. }),
  8460. smalltalk.HashedCollection);
  8461. smalltalk.addMethod(
  8462. "_collect_",
  8463. smalltalk.method({
  8464. selector: "collect:",
  8465. category: 'enumerating',
  8466. fn: function (aBlock){
  8467. var self=this;
  8468. var newDict;
  8469. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8470. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8471. return smalltalk.send(newDict,"_at_put_",[key,smalltalk.send(aBlock,"_value_",[value])]);
  8472. })]);
  8473. return newDict;
  8474. },
  8475. args: ["aBlock"],
  8476. 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",
  8477. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  8478. referencedClasses: []
  8479. }),
  8480. smalltalk.HashedCollection);
  8481. smalltalk.addMethod(
  8482. "_copyFrom_to_",
  8483. smalltalk.method({
  8484. selector: "copyFrom:to:",
  8485. category: 'copying',
  8486. fn: function (anIndex,anotherIndex){
  8487. var self=this;
  8488. smalltalk.send(self,"_shouldNotImplement",[]);
  8489. return self},
  8490. args: ["anIndex", "anotherIndex"],
  8491. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self shouldNotImplement",
  8492. messageSends: ["shouldNotImplement"],
  8493. referencedClasses: []
  8494. }),
  8495. smalltalk.HashedCollection);
  8496. smalltalk.addMethod(
  8497. "_deepCopy",
  8498. smalltalk.method({
  8499. selector: "deepCopy",
  8500. category: 'copying',
  8501. fn: function (){
  8502. var self=this;
  8503. var copy;
  8504. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8505. smalltalk.send(self,"_associationsDo_",[(function(each){
  8506. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(smalltalk.send(each,"_value",[]),"_deepCopy",[])]);
  8507. })]);
  8508. return copy;
  8509. },
  8510. args: [],
  8511. 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",
  8512. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "deepCopy", "value"],
  8513. referencedClasses: []
  8514. }),
  8515. smalltalk.HashedCollection);
  8516. smalltalk.addMethod(
  8517. "_detect_ifNone_",
  8518. smalltalk.method({
  8519. selector: "detect:ifNone:",
  8520. category: 'enumerating',
  8521. fn: function (aBlock,anotherBlock){
  8522. var self=this;
  8523. var $1;
  8524. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_detect_ifNone_",[aBlock,anotherBlock]);
  8525. return $1;
  8526. },
  8527. args: ["aBlock", "anotherBlock"],
  8528. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  8529. messageSends: ["detect:ifNone:", "values"],
  8530. referencedClasses: []
  8531. }),
  8532. smalltalk.HashedCollection);
  8533. smalltalk.addMethod(
  8534. "_do_",
  8535. smalltalk.method({
  8536. selector: "do:",
  8537. category: 'enumerating',
  8538. fn: function (aBlock){
  8539. var self=this;
  8540. smalltalk.send(smalltalk.send(self,"_values",[]),"_do_",[aBlock]);
  8541. return self},
  8542. args: ["aBlock"],
  8543. source: "do: aBlock\x0a\x09self values do: aBlock",
  8544. messageSends: ["do:", "values"],
  8545. referencedClasses: []
  8546. }),
  8547. smalltalk.HashedCollection);
  8548. smalltalk.addMethod(
  8549. "_includes_",
  8550. smalltalk.method({
  8551. selector: "includes:",
  8552. category: 'enumerating',
  8553. fn: function (anObject){
  8554. var self=this;
  8555. var $1;
  8556. $1=smalltalk.send(smalltalk.send(self,"_values",[]),"_includes_",[anObject]);
  8557. return $1;
  8558. },
  8559. args: ["anObject"],
  8560. source: "includes: anObject\x0a\x09^self values includes: anObject",
  8561. messageSends: ["includes:", "values"],
  8562. referencedClasses: []
  8563. }),
  8564. smalltalk.HashedCollection);
  8565. smalltalk.addMethod(
  8566. "_includesKey_",
  8567. smalltalk.method({
  8568. selector: "includesKey:",
  8569. category: 'testing',
  8570. fn: function (aKey){
  8571. var self=this;
  8572. return self.hasOwnProperty(aKey);
  8573. ;
  8574. return self},
  8575. args: ["aKey"],
  8576. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  8577. messageSends: [],
  8578. referencedClasses: []
  8579. }),
  8580. smalltalk.HashedCollection);
  8581. smalltalk.addMethod(
  8582. "_keys",
  8583. smalltalk.method({
  8584. selector: "keys",
  8585. category: 'accessing',
  8586. fn: function (){
  8587. var self=this;
  8588. if ('function'===typeof Object.keys) return Object.keys(self);
  8589. var keys = [];
  8590. for(var i in self) {
  8591. if(self.hasOwnProperty(i)) {
  8592. keys.push(i);
  8593. }
  8594. };
  8595. return keys;
  8596. ;
  8597. ;
  8598. return self},
  8599. args: [],
  8600. 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>",
  8601. messageSends: [],
  8602. referencedClasses: []
  8603. }),
  8604. smalltalk.HashedCollection);
  8605. smalltalk.addMethod(
  8606. "_keysAndValuesDo_",
  8607. smalltalk.method({
  8608. selector: "keysAndValuesDo:",
  8609. category: 'enumerating',
  8610. fn: function (aBlock){
  8611. var self=this;
  8612. smalltalk.send(self,"_associationsDo_",[(function(each){
  8613. return smalltalk.send(aBlock,"_value_value_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8614. })]);
  8615. return self},
  8616. args: ["aBlock"],
  8617. source: "keysAndValuesDo: aBlock\x0a\x09self associationsDo: [:each |\x0a\x09 aBlock value: each key value: each value]",
  8618. messageSends: ["associationsDo:", "value:value:", "key", "value"],
  8619. referencedClasses: []
  8620. }),
  8621. smalltalk.HashedCollection);
  8622. smalltalk.addMethod(
  8623. "_printString",
  8624. smalltalk.method({
  8625. selector: "printString",
  8626. category: 'printing',
  8627. fn: function (){
  8628. var self=this;
  8629. var $1;
  8630. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  8631. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("a ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])]),"__comma",["("])]);
  8632. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8633. return smalltalk.send(each,"_storeOn_",[aStream]);
  8634. }),(function(){
  8635. return smalltalk.send(aStream,"_nextPutAll_",[" , "]);
  8636. })]);
  8637. return smalltalk.send(aStream,"_nextPutAll_",[")"]);
  8638. })]);
  8639. return $1;
  8640. },
  8641. args: [],
  8642. 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: ')']",
  8643. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  8644. referencedClasses: ["String"]
  8645. }),
  8646. smalltalk.HashedCollection);
  8647. smalltalk.addMethod(
  8648. "_remove_ifAbsent_",
  8649. smalltalk.method({
  8650. selector: "remove:ifAbsent:",
  8651. category: 'adding/removing',
  8652. fn: function (aKey,aBlock){
  8653. var self=this;
  8654. var $1;
  8655. $1=smalltalk.send(self,"_removeKey_ifAbsent_",[aKey,aBlock]);
  8656. return $1;
  8657. },
  8658. args: ["aKey", "aBlock"],
  8659. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  8660. messageSends: ["removeKey:ifAbsent:"],
  8661. referencedClasses: []
  8662. }),
  8663. smalltalk.HashedCollection);
  8664. smalltalk.addMethod(
  8665. "_removeKey_",
  8666. smalltalk.method({
  8667. selector: "removeKey:",
  8668. category: 'adding/removing',
  8669. fn: function (aKey){
  8670. var self=this;
  8671. var $1;
  8672. $1=smalltalk.send(self,"_remove_",[aKey]);
  8673. return $1;
  8674. },
  8675. args: ["aKey"],
  8676. source: "removeKey: aKey\x0a ^self remove: aKey",
  8677. messageSends: ["remove:"],
  8678. referencedClasses: []
  8679. }),
  8680. smalltalk.HashedCollection);
  8681. smalltalk.addMethod(
  8682. "_removeKey_ifAbsent_",
  8683. smalltalk.method({
  8684. selector: "removeKey:ifAbsent:",
  8685. category: 'adding/removing',
  8686. fn: function (aKey,aBlock){
  8687. var self=this;
  8688. var $2,$1;
  8689. $2=smalltalk.send(self,"_includesKey_",[aKey]);
  8690. if(smalltalk.assert($2)){
  8691. $1=smalltalk.send(self,"_basicDelete_",[aKey]);
  8692. } else {
  8693. $1=smalltalk.send(aBlock,"_value",[]);
  8694. };
  8695. return $1;
  8696. },
  8697. args: ["aKey", "aBlock"],
  8698. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  8699. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  8700. referencedClasses: []
  8701. }),
  8702. smalltalk.HashedCollection);
  8703. smalltalk.addMethod(
  8704. "_select_",
  8705. smalltalk.method({
  8706. selector: "select:",
  8707. category: 'enumerating',
  8708. fn: function (aBlock){
  8709. var self=this;
  8710. var $1;
  8711. var newDict;
  8712. newDict=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8713. smalltalk.send(self,"_keysAndValuesDo_",[(function(key,value){
  8714. $1=smalltalk.send(aBlock,"_value_",[value]);
  8715. if(smalltalk.assert($1)){
  8716. return smalltalk.send(newDict,"_at_put_",[key,value]);
  8717. };
  8718. })]);
  8719. return newDict;
  8720. },
  8721. args: ["aBlock"],
  8722. 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",
  8723. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  8724. referencedClasses: []
  8725. }),
  8726. smalltalk.HashedCollection);
  8727. smalltalk.addMethod(
  8728. "_shallowCopy",
  8729. smalltalk.method({
  8730. selector: "shallowCopy",
  8731. category: 'copying',
  8732. fn: function (){
  8733. var self=this;
  8734. var copy;
  8735. copy=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  8736. smalltalk.send(self,"_associationsDo_",[(function(each){
  8737. return smalltalk.send(copy,"_at_put_",[smalltalk.send(each,"_key",[]),smalltalk.send(each,"_value",[])]);
  8738. })]);
  8739. return copy;
  8740. },
  8741. args: [],
  8742. 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",
  8743. messageSends: ["new", "class", "associationsDo:", "at:put:", "key", "value"],
  8744. referencedClasses: []
  8745. }),
  8746. smalltalk.HashedCollection);
  8747. smalltalk.addMethod(
  8748. "_size",
  8749. smalltalk.method({
  8750. selector: "size",
  8751. category: 'accessing',
  8752. fn: function (){
  8753. var self=this;
  8754. var $1;
  8755. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_size",[]);
  8756. return $1;
  8757. },
  8758. args: [],
  8759. source: "size\x0a\x09^self keys size",
  8760. messageSends: ["size", "keys"],
  8761. referencedClasses: []
  8762. }),
  8763. smalltalk.HashedCollection);
  8764. smalltalk.addMethod(
  8765. "_storeOn_",
  8766. smalltalk.method({
  8767. selector: "storeOn:",
  8768. category: 'printing',
  8769. fn: function (aStream){
  8770. var self=this;
  8771. smalltalk.send(aStream,"_nextPutAll_",["#{"]);
  8772. smalltalk.send(smalltalk.send(self,"_associations",[]),"_do_separatedBy_",[(function(each){
  8773. return smalltalk.send(each,"_storeOn_",[aStream]);
  8774. }),(function(){
  8775. return smalltalk.send(aStream,"_nextPutAll_",[". "]);
  8776. })]);
  8777. smalltalk.send(aStream,"_nextPutAll_",["}"]);
  8778. return self},
  8779. args: ["aStream"],
  8780. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  8781. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  8782. referencedClasses: []
  8783. }),
  8784. smalltalk.HashedCollection);
  8785. smalltalk.addMethod(
  8786. "_values",
  8787. smalltalk.method({
  8788. selector: "values",
  8789. category: 'accessing',
  8790. fn: function (){
  8791. var self=this;
  8792. var $1;
  8793. $1=smalltalk.send(smalltalk.send(self,"_keys",[]),"_collect_",[(function(each){
  8794. return smalltalk.send(self,"_at_",[each]);
  8795. })]);
  8796. return $1;
  8797. },
  8798. args: [],
  8799. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  8800. messageSends: ["collect:", "at:", "keys"],
  8801. referencedClasses: []
  8802. }),
  8803. smalltalk.HashedCollection);
  8804. smalltalk.addMethod(
  8805. "_fromPairs_",
  8806. smalltalk.method({
  8807. selector: "fromPairs:",
  8808. category: 'instance creation',
  8809. fn: function (aCollection){
  8810. var self=this;
  8811. var dict;
  8812. dict=smalltalk.send(self,"_new",[]);
  8813. smalltalk.send(aCollection,"_do_",[(function(each){
  8814. return smalltalk.send(dict,"_add_",[each]);
  8815. })]);
  8816. return dict;
  8817. },
  8818. args: ["aCollection"],
  8819. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  8820. messageSends: ["new", "do:", "add:"],
  8821. referencedClasses: []
  8822. }),
  8823. smalltalk.HashedCollection.klass);
  8824. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  8825. smalltalk.addMethod(
  8826. "_asHashedCollection",
  8827. smalltalk.method({
  8828. selector: "asHashedCollection",
  8829. category: 'converting',
  8830. fn: function (){
  8831. var self=this;
  8832. var $1;
  8833. $1=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_fromPairs_",[smalltalk.send(self,"_associations",[])]);
  8834. return $1;
  8835. },
  8836. args: [],
  8837. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  8838. messageSends: ["fromPairs:", "associations"],
  8839. referencedClasses: ["HashedCollection"]
  8840. }),
  8841. smalltalk.Dictionary);
  8842. smalltalk.addMethod(
  8843. "_asJSON",
  8844. smalltalk.method({
  8845. selector: "asJSON",
  8846. category: 'converting',
  8847. fn: function (){
  8848. var self=this;
  8849. var $1;
  8850. $1=smalltalk.send(smalltalk.send(self,"_asHashedCollection",[]),"_asJSON",[]);
  8851. return $1;
  8852. },
  8853. args: [],
  8854. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  8855. messageSends: ["asJSON", "asHashedCollection"],
  8856. referencedClasses: []
  8857. }),
  8858. smalltalk.Dictionary);
  8859. smalltalk.addMethod(
  8860. "_at_ifAbsent_",
  8861. smalltalk.method({
  8862. selector: "at:ifAbsent:",
  8863. category: 'accessing',
  8864. fn: function (aKey,aBlock){
  8865. var self=this;
  8866. var index;
  8867. for(var i=0;i<self['@keys'].length;i++){
  8868. if(self['@keys'][i].__eq(aKey)) {index = i;}
  8869. };
  8870. if(typeof index === 'undefined') {
  8871. return aBlock();
  8872. } else {
  8873. return self['@values'][index];
  8874. }
  8875. ;
  8876. ;
  8877. return self},
  8878. args: ["aKey", "aBlock"],
  8879. 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>",
  8880. messageSends: [],
  8881. referencedClasses: []
  8882. }),
  8883. smalltalk.Dictionary);
  8884. smalltalk.addMethod(
  8885. "_at_put_",
  8886. smalltalk.method({
  8887. selector: "at:put:",
  8888. category: 'accessing',
  8889. fn: function (aKey,aValue){
  8890. var self=this;
  8891. var index = self['@keys'].indexOf(aKey);
  8892. if(index === -1) {
  8893. self['@values'].push(aValue);
  8894. self['@keys'].push(aKey);
  8895. } else {
  8896. self['@values'][index] = aValue;
  8897. };
  8898. return aValue;
  8899. ;
  8900. ;
  8901. return self},
  8902. args: ["aKey", "aValue"],
  8903. 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>",
  8904. messageSends: [],
  8905. referencedClasses: []
  8906. }),
  8907. smalltalk.Dictionary);
  8908. smalltalk.addMethod(
  8909. "_includesKey_",
  8910. smalltalk.method({
  8911. selector: "includesKey:",
  8912. category: 'testing',
  8913. fn: function (aKey){
  8914. var self=this;
  8915. var $1;
  8916. $1=smalltalk.send(self["@keys"],"_includes_",[aKey]);
  8917. return $1;
  8918. },
  8919. args: ["aKey"],
  8920. source: "includesKey: aKey\x0a\x09^keys includes: aKey",
  8921. messageSends: ["includes:"],
  8922. referencedClasses: []
  8923. }),
  8924. smalltalk.Dictionary);
  8925. smalltalk.addMethod(
  8926. "_initialize",
  8927. smalltalk.method({
  8928. selector: "initialize",
  8929. category: 'initialization',
  8930. fn: function (){
  8931. var self=this;
  8932. smalltalk.send(self,"_initialize",[],smalltalk.HashedCollection);
  8933. self["@keys"]=[];
  8934. self["@values"]=[];
  8935. return self},
  8936. args: [],
  8937. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  8938. messageSends: ["initialize"],
  8939. referencedClasses: []
  8940. }),
  8941. smalltalk.Dictionary);
  8942. smalltalk.addMethod(
  8943. "_keyAtValue_",
  8944. smalltalk.method({
  8945. selector: "keyAtValue:",
  8946. category: 'accessing',
  8947. fn: function (anObject){
  8948. var self=this;
  8949. var $1;
  8950. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_associations",[]),"_detect_ifNone_",[(function(k,v){
  8951. return smalltalk.send(v,"__eq_eq",[anObject]);
  8952. }),(function(){
  8953. return smalltalk.send(self,"_error_",["Not found"]);
  8954. })]),"_key",[]);
  8955. return $1;
  8956. },
  8957. args: ["anObject"],
  8958. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  8959. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  8960. referencedClasses: []
  8961. }),
  8962. smalltalk.Dictionary);
  8963. smalltalk.addMethod(
  8964. "_keys",
  8965. smalltalk.method({
  8966. selector: "keys",
  8967. category: 'accessing',
  8968. fn: function (){
  8969. var self=this;
  8970. var $1;
  8971. $1=smalltalk.send(self["@keys"],"_copy",[]);
  8972. return $1;
  8973. },
  8974. args: [],
  8975. source: "keys\x0a\x09^keys copy",
  8976. messageSends: ["copy"],
  8977. referencedClasses: []
  8978. }),
  8979. smalltalk.Dictionary);
  8980. smalltalk.addMethod(
  8981. "_removeKey_ifAbsent_",
  8982. smalltalk.method({
  8983. selector: "removeKey:ifAbsent:",
  8984. category: 'adding/removing',
  8985. fn: function (aKey,aBlock){
  8986. var self=this;
  8987. var index = self['@keys'].indexOf(aKey);
  8988. if(index === -1) {
  8989. return aBlock()
  8990. } else {
  8991. var value;
  8992. self['@keys'].splice(index, 1);
  8993. value = self['@values'].splice(index, 1);
  8994. return value[0];
  8995. };
  8996. ;
  8997. ;
  8998. return self},
  8999. args: ["aKey", "aBlock"],
  9000. 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 >",
  9001. messageSends: [],
  9002. referencedClasses: []
  9003. }),
  9004. smalltalk.Dictionary);
  9005. smalltalk.addMethod(
  9006. "_valueAt_",
  9007. smalltalk.method({
  9008. selector: "valueAt:",
  9009. category: 'accessing',
  9010. fn: function (anObject){
  9011. var self=this;
  9012. var $1;
  9013. $1=smalltalk.send(self,"_associationsDo_",[(2)]);
  9014. return $1;
  9015. },
  9016. args: ["anObject"],
  9017. source: "valueAt: anObject\x0a\x0a\x09^ self associationsDo:2",
  9018. messageSends: ["associationsDo:"],
  9019. referencedClasses: []
  9020. }),
  9021. smalltalk.Dictionary);
  9022. smalltalk.addMethod(
  9023. "_values",
  9024. smalltalk.method({
  9025. selector: "values",
  9026. category: 'accessing',
  9027. fn: function (){
  9028. var self=this;
  9029. var $1;
  9030. $1=smalltalk.send(self["@values"],"_copy",[]);
  9031. return $1;
  9032. },
  9033. args: [],
  9034. source: "values\x0a\x09^values copy",
  9035. messageSends: ["copy"],
  9036. referencedClasses: []
  9037. }),
  9038. smalltalk.Dictionary);
  9039. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9040. smalltalk.addMethod(
  9041. "__eq",
  9042. smalltalk.method({
  9043. selector: "=",
  9044. category: 'comparing',
  9045. fn: function (aCollection){
  9046. var self=this;
  9047. var $1,$2;
  9048. var $early={};
  9049. try {
  9050. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  9051. return smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aCollection,"_size",[])]);
  9052. })]);
  9053. if(! smalltalk.assert($1)){
  9054. return false;
  9055. };
  9056. smalltalk.send(self,"_withIndexDo_",[(function(each,i){
  9057. $2=smalltalk.send(smalltalk.send(aCollection,"_at_",[i]),"__eq",[each]);
  9058. if(! smalltalk.assert($2)){
  9059. throw $early=[false];
  9060. };
  9061. })]);
  9062. return true;
  9063. }
  9064. catch(e) {if(e===$early)return e[0]; throw e}
  9065. },
  9066. args: ["aCollection"],
  9067. 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",
  9068. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  9069. referencedClasses: []
  9070. }),
  9071. smalltalk.SequenceableCollection);
  9072. smalltalk.addMethod(
  9073. "_addLast_",
  9074. smalltalk.method({
  9075. selector: "addLast:",
  9076. category: 'adding',
  9077. fn: function (anObject){
  9078. var self=this;
  9079. smalltalk.send(self,"_add_",[anObject]);
  9080. return self},
  9081. args: ["anObject"],
  9082. source: "addLast: anObject\x0a\x09self add: anObject",
  9083. messageSends: ["add:"],
  9084. referencedClasses: []
  9085. }),
  9086. smalltalk.SequenceableCollection);
  9087. smalltalk.addMethod(
  9088. "_allButFirst",
  9089. smalltalk.method({
  9090. selector: "allButFirst",
  9091. category: 'accessing',
  9092. fn: function (){
  9093. var self=this;
  9094. var $1;
  9095. $1=smalltalk.send(self,"_copyFrom_to_",[(2),smalltalk.send(self,"_size",[])]);
  9096. return $1;
  9097. },
  9098. args: [],
  9099. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  9100. messageSends: ["copyFrom:to:", "size"],
  9101. referencedClasses: []
  9102. }),
  9103. smalltalk.SequenceableCollection);
  9104. smalltalk.addMethod(
  9105. "_allButLast",
  9106. smalltalk.method({
  9107. selector: "allButLast",
  9108. category: 'accessing',
  9109. fn: function (){
  9110. var self=this;
  9111. var $1;
  9112. $1=smalltalk.send(self,"_copyFrom_to_",[(1),smalltalk.send(smalltalk.send(self,"_size",[]),"__minus",[(1)])]);
  9113. return $1;
  9114. },
  9115. args: [],
  9116. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  9117. messageSends: ["copyFrom:to:", "-", "size"],
  9118. referencedClasses: []
  9119. }),
  9120. smalltalk.SequenceableCollection);
  9121. smalltalk.addMethod(
  9122. "_at_",
  9123. smalltalk.method({
  9124. selector: "at:",
  9125. category: 'accessing',
  9126. fn: function (anIndex){
  9127. var self=this;
  9128. var $1;
  9129. $1=smalltalk.send(self,"_at_ifAbsent_",[anIndex,(function(){
  9130. return smalltalk.send(self,"_errorNotFound",[]);
  9131. })]);
  9132. return $1;
  9133. },
  9134. args: ["anIndex"],
  9135. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  9136. messageSends: ["at:ifAbsent:", "errorNotFound"],
  9137. referencedClasses: []
  9138. }),
  9139. smalltalk.SequenceableCollection);
  9140. smalltalk.addMethod(
  9141. "_at_ifAbsent_",
  9142. smalltalk.method({
  9143. selector: "at:ifAbsent:",
  9144. category: 'accessing',
  9145. fn: function (anIndex,aBlock){
  9146. var self=this;
  9147. smalltalk.send(self,"_subclassResponsibility",[]);
  9148. return self},
  9149. args: ["anIndex", "aBlock"],
  9150. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9151. messageSends: ["subclassResponsibility"],
  9152. referencedClasses: []
  9153. }),
  9154. smalltalk.SequenceableCollection);
  9155. smalltalk.addMethod(
  9156. "_at_put_",
  9157. smalltalk.method({
  9158. selector: "at:put:",
  9159. category: 'accessing',
  9160. fn: function (anIndex,anObject){
  9161. var self=this;
  9162. smalltalk.send(self,"_subclassResponsibility",[]);
  9163. return self},
  9164. args: ["anIndex", "anObject"],
  9165. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  9166. messageSends: ["subclassResponsibility"],
  9167. referencedClasses: []
  9168. }),
  9169. smalltalk.SequenceableCollection);
  9170. smalltalk.addMethod(
  9171. "_atRandom",
  9172. smalltalk.method({
  9173. selector: "atRandom",
  9174. category: 'accessing',
  9175. fn: function (){
  9176. var self=this;
  9177. var $1;
  9178. $1=smalltalk.send(self,"_at_",[smalltalk.send(smalltalk.send(self,"_size",[]),"_atRandom",[])]);
  9179. return $1;
  9180. },
  9181. args: [],
  9182. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9183. messageSends: ["at:", "atRandom", "size"],
  9184. referencedClasses: []
  9185. }),
  9186. smalltalk.SequenceableCollection);
  9187. smalltalk.addMethod(
  9188. "_copyFrom_to_",
  9189. smalltalk.method({
  9190. selector: "copyFrom:to:",
  9191. category: 'copying',
  9192. fn: function (anIndex,anotherIndex){
  9193. var self=this;
  9194. var range;
  9195. var newCollection;
  9196. range=smalltalk.send(anIndex,"_to_",[anotherIndex]);
  9197. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(range,"_size",[])]);
  9198. smalltalk.send(range,"_withIndexDo_",[(function(each,i){
  9199. return smalltalk.send(newCollection,"_at_put_",[i,smalltalk.send(self,"_at_",[each])]);
  9200. })]);
  9201. return newCollection;
  9202. },
  9203. args: ["anIndex", "anotherIndex"],
  9204. 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",
  9205. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  9206. referencedClasses: []
  9207. }),
  9208. smalltalk.SequenceableCollection);
  9209. smalltalk.addMethod(
  9210. "_deepCopy",
  9211. smalltalk.method({
  9212. selector: "deepCopy",
  9213. category: 'copying',
  9214. fn: function (){
  9215. var self=this;
  9216. var newCollection;
  9217. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9218. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9219. return smalltalk.send(newCollection,"_at_put_",[index,smalltalk.send(each,"_deepCopy",[])]);
  9220. })]);
  9221. return newCollection;
  9222. },
  9223. args: [],
  9224. 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",
  9225. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  9226. referencedClasses: []
  9227. }),
  9228. smalltalk.SequenceableCollection);
  9229. smalltalk.addMethod(
  9230. "_first",
  9231. smalltalk.method({
  9232. selector: "first",
  9233. category: 'accessing',
  9234. fn: function (){
  9235. var self=this;
  9236. var $1;
  9237. $1=smalltalk.send(self,"_at_",[(1)]);
  9238. return $1;
  9239. },
  9240. args: [],
  9241. source: "first\x0a\x09^self at: 1",
  9242. messageSends: ["at:"],
  9243. referencedClasses: []
  9244. }),
  9245. smalltalk.SequenceableCollection);
  9246. smalltalk.addMethod(
  9247. "_first_",
  9248. smalltalk.method({
  9249. selector: "first:",
  9250. category: 'accessing',
  9251. fn: function (n){
  9252. var self=this;
  9253. var $1;
  9254. $1=smalltalk.send(self,"_copyFrom_to_",[(1),n]);
  9255. return $1;
  9256. },
  9257. args: ["n"],
  9258. 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",
  9259. messageSends: ["copyFrom:to:"],
  9260. referencedClasses: []
  9261. }),
  9262. smalltalk.SequenceableCollection);
  9263. smalltalk.addMethod(
  9264. "_fourth",
  9265. smalltalk.method({
  9266. selector: "fourth",
  9267. category: 'accessing',
  9268. fn: function (){
  9269. var self=this;
  9270. var $1;
  9271. $1=smalltalk.send(self,"_at_",[(4)]);
  9272. return $1;
  9273. },
  9274. args: [],
  9275. source: "fourth\x0a\x09^self at: 4",
  9276. messageSends: ["at:"],
  9277. referencedClasses: []
  9278. }),
  9279. smalltalk.SequenceableCollection);
  9280. smalltalk.addMethod(
  9281. "_indexOf_",
  9282. smalltalk.method({
  9283. selector: "indexOf:",
  9284. category: 'accessing',
  9285. fn: function (anObject){
  9286. var self=this;
  9287. var $1;
  9288. $1=smalltalk.send(self,"_indexOf_ifAbsent_",[anObject,(function(){
  9289. return smalltalk.send(self,"_errorNotFound",[]);
  9290. })]);
  9291. return $1;
  9292. },
  9293. args: ["anObject"],
  9294. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  9295. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  9296. referencedClasses: []
  9297. }),
  9298. smalltalk.SequenceableCollection);
  9299. smalltalk.addMethod(
  9300. "_indexOf_ifAbsent_",
  9301. smalltalk.method({
  9302. selector: "indexOf:ifAbsent:",
  9303. category: 'accessing',
  9304. fn: function (anObject,aBlock){
  9305. var self=this;
  9306. for(var i=0;i<self.length;i++) {
  9307. if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
  9308. };
  9309. return aBlock();
  9310. ;
  9311. ;
  9312. return self},
  9313. args: ["anObject", "aBlock"],
  9314. 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>",
  9315. messageSends: [],
  9316. referencedClasses: []
  9317. }),
  9318. smalltalk.SequenceableCollection);
  9319. smalltalk.addMethod(
  9320. "_indexOf_startingAt_",
  9321. smalltalk.method({
  9322. selector: "indexOf:startingAt:",
  9323. category: 'accessing',
  9324. fn: function (anObject,start){
  9325. var self=this;
  9326. var $1;
  9327. $1=smalltalk.send(self,"_indexOf_startingAt_ifAbsent_",[anObject,start,(function(){
  9328. return (0);
  9329. })]);
  9330. return $1;
  9331. },
  9332. args: ["anObject", "start"],
  9333. 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]",
  9334. messageSends: ["indexOf:startingAt:ifAbsent:"],
  9335. referencedClasses: []
  9336. }),
  9337. smalltalk.SequenceableCollection);
  9338. smalltalk.addMethod(
  9339. "_indexOf_startingAt_ifAbsent_",
  9340. smalltalk.method({
  9341. selector: "indexOf:startingAt:ifAbsent:",
  9342. category: 'accessing',
  9343. fn: function (anObject,start,aBlock){
  9344. var self=this;
  9345. for(var i=start-1;i<self.length;i++){
  9346. if(self[i].__eq(anObject)) {return i+1}
  9347. }
  9348. return aBlock();
  9349. ;
  9350. ;
  9351. return self},
  9352. args: ["anObject", "start", "aBlock"],
  9353. 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>",
  9354. messageSends: [],
  9355. referencedClasses: []
  9356. }),
  9357. smalltalk.SequenceableCollection);
  9358. smalltalk.addMethod(
  9359. "_last",
  9360. smalltalk.method({
  9361. selector: "last",
  9362. category: 'accessing',
  9363. fn: function (){
  9364. var self=this;
  9365. var $1;
  9366. $1=smalltalk.send(self,"_at_",[smalltalk.send(self,"_size",[])]);
  9367. return $1;
  9368. },
  9369. args: [],
  9370. source: "last\x0a\x09^self at: self size",
  9371. messageSends: ["at:", "size"],
  9372. referencedClasses: []
  9373. }),
  9374. smalltalk.SequenceableCollection);
  9375. smalltalk.addMethod(
  9376. "_removeLast",
  9377. smalltalk.method({
  9378. selector: "removeLast",
  9379. category: 'adding',
  9380. fn: function (){
  9381. var self=this;
  9382. smalltalk.send(self,"_remove_",[smalltalk.send(self,"_last",[])]);
  9383. return self},
  9384. args: [],
  9385. source: "removeLast\x0a\x09self remove: self last",
  9386. messageSends: ["remove:", "last"],
  9387. referencedClasses: []
  9388. }),
  9389. smalltalk.SequenceableCollection);
  9390. smalltalk.addMethod(
  9391. "_reversed",
  9392. smalltalk.method({
  9393. selector: "reversed",
  9394. category: 'converting',
  9395. fn: function (){
  9396. var self=this;
  9397. smalltalk.send(self,"_subclassResponsibility",[]);
  9398. return self},
  9399. args: [],
  9400. source: "reversed\x0a\x09self subclassResponsibility",
  9401. messageSends: ["subclassResponsibility"],
  9402. referencedClasses: []
  9403. }),
  9404. smalltalk.SequenceableCollection);
  9405. smalltalk.addMethod(
  9406. "_second",
  9407. smalltalk.method({
  9408. selector: "second",
  9409. category: 'accessing',
  9410. fn: function (){
  9411. var self=this;
  9412. var $1;
  9413. $1=smalltalk.send(self,"_at_",[(2)]);
  9414. return $1;
  9415. },
  9416. args: [],
  9417. source: "second\x0a\x09^self at: 2",
  9418. messageSends: ["at:"],
  9419. referencedClasses: []
  9420. }),
  9421. smalltalk.SequenceableCollection);
  9422. smalltalk.addMethod(
  9423. "_shallowCopy",
  9424. smalltalk.method({
  9425. selector: "shallowCopy",
  9426. category: 'copying',
  9427. fn: function (){
  9428. var self=this;
  9429. var newCollection;
  9430. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  9431. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  9432. return smalltalk.send(newCollection,"_at_put_",[index,each]);
  9433. })]);
  9434. return newCollection;
  9435. },
  9436. args: [],
  9437. 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",
  9438. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  9439. referencedClasses: []
  9440. }),
  9441. smalltalk.SequenceableCollection);
  9442. smalltalk.addMethod(
  9443. "_third",
  9444. smalltalk.method({
  9445. selector: "third",
  9446. category: 'accessing',
  9447. fn: function (){
  9448. var self=this;
  9449. var $1;
  9450. $1=smalltalk.send(self,"_at_",[(3)]);
  9451. return $1;
  9452. },
  9453. args: [],
  9454. source: "third\x0a\x09^self at: 3",
  9455. messageSends: ["at:"],
  9456. referencedClasses: []
  9457. }),
  9458. smalltalk.SequenceableCollection);
  9459. smalltalk.addMethod(
  9460. "_withIndexDo_",
  9461. smalltalk.method({
  9462. selector: "withIndexDo:",
  9463. category: 'enumerating',
  9464. fn: function (aBlock){
  9465. var self=this;
  9466. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  9467. ;
  9468. return self},
  9469. args: ["aBlock"],
  9470. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  9471. messageSends: [],
  9472. referencedClasses: []
  9473. }),
  9474. smalltalk.SequenceableCollection);
  9475. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9476. smalltalk.addMethod(
  9477. "_add_",
  9478. smalltalk.method({
  9479. selector: "add:",
  9480. category: 'adding/removing',
  9481. fn: function (anObject){
  9482. var self=this;
  9483. self.push(anObject); return anObject;;
  9484. ;
  9485. return self},
  9486. args: ["anObject"],
  9487. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  9488. messageSends: [],
  9489. referencedClasses: []
  9490. }),
  9491. smalltalk.Array);
  9492. smalltalk.addMethod(
  9493. "_asJavascript",
  9494. smalltalk.method({
  9495. selector: "asJavascript",
  9496. category: 'converting',
  9497. fn: function (){
  9498. var self=this;
  9499. var $1;
  9500. $1=smalltalk.send(smalltalk.send("[","__comma",[smalltalk.send(smalltalk.send(self,"_collect_",[(function(each){
  9501. return smalltalk.send(each,"_asJavascript",[]);
  9502. })]),"_join_",[", "])]),"__comma",["]"]);
  9503. return $1;
  9504. },
  9505. args: [],
  9506. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  9507. messageSends: [",", "join:", "collect:", "asJavascript"],
  9508. referencedClasses: []
  9509. }),
  9510. smalltalk.Array);
  9511. smalltalk.addMethod(
  9512. "_at_ifAbsent_",
  9513. smalltalk.method({
  9514. selector: "at:ifAbsent:",
  9515. category: 'accessing',
  9516. fn: function (anIndex,aBlock){
  9517. var self=this;
  9518. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  9519. return self[anIndex - 1];
  9520. ;
  9521. ;
  9522. return self},
  9523. args: ["anIndex", "aBlock"],
  9524. 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>",
  9525. messageSends: [],
  9526. referencedClasses: []
  9527. }),
  9528. smalltalk.Array);
  9529. smalltalk.addMethod(
  9530. "_at_put_",
  9531. smalltalk.method({
  9532. selector: "at:put:",
  9533. category: 'accessing',
  9534. fn: function (anIndex,anObject){
  9535. var self=this;
  9536. return self[anIndex - 1] = anObject;
  9537. ;
  9538. return self},
  9539. args: ["anIndex", "anObject"],
  9540. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  9541. messageSends: [],
  9542. referencedClasses: []
  9543. }),
  9544. smalltalk.Array);
  9545. smalltalk.addMethod(
  9546. "_join_",
  9547. smalltalk.method({
  9548. selector: "join:",
  9549. category: 'enumerating',
  9550. fn: function (aString){
  9551. var self=this;
  9552. return self.join(aString);
  9553. ;
  9554. return self},
  9555. args: ["aString"],
  9556. source: "join: aString\x0a\x09<return self.join(aString)>",
  9557. messageSends: [],
  9558. referencedClasses: []
  9559. }),
  9560. smalltalk.Array);
  9561. smalltalk.addMethod(
  9562. "_remove_ifAbsent_",
  9563. smalltalk.method({
  9564. selector: "remove:ifAbsent:",
  9565. category: 'adding/removing',
  9566. fn: function (anObject,aBlock){
  9567. var self=this;
  9568. for(var i=0;i<self.length;i++) {
  9569. if(self[i] == anObject) {
  9570. self.splice(i,1);
  9571. return self;
  9572. }
  9573. }
  9574. ;
  9575. ;
  9576. smalltalk.send(aBlock,"_value",[]);
  9577. return self},
  9578. args: ["anObject", "aBlock"],
  9579. 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",
  9580. messageSends: ["value"],
  9581. referencedClasses: []
  9582. }),
  9583. smalltalk.Array);
  9584. smalltalk.addMethod(
  9585. "_removeFrom_to_",
  9586. smalltalk.method({
  9587. selector: "removeFrom:to:",
  9588. category: 'adding/removing',
  9589. fn: function (aNumber,anotherNumber){
  9590. var self=this;
  9591. self.splice(aNumber - 1,anotherNumber - 1);
  9592. ;
  9593. return self},
  9594. args: ["aNumber", "anotherNumber"],
  9595. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  9596. messageSends: [],
  9597. referencedClasses: []
  9598. }),
  9599. smalltalk.Array);
  9600. smalltalk.addMethod(
  9601. "_reversed",
  9602. smalltalk.method({
  9603. selector: "reversed",
  9604. category: 'converting',
  9605. fn: function (){
  9606. var self=this;
  9607. return self._copy().reverse();
  9608. ;
  9609. return self},
  9610. args: [],
  9611. source: "reversed\x0a\x09<return self._copy().reverse()>",
  9612. messageSends: [],
  9613. referencedClasses: []
  9614. }),
  9615. smalltalk.Array);
  9616. smalltalk.addMethod(
  9617. "_size",
  9618. smalltalk.method({
  9619. selector: "size",
  9620. category: 'accessing',
  9621. fn: function (){
  9622. var self=this;
  9623. return self.length;
  9624. ;
  9625. return self},
  9626. args: [],
  9627. source: "size\x0a\x09<return self.length>",
  9628. messageSends: [],
  9629. referencedClasses: []
  9630. }),
  9631. smalltalk.Array);
  9632. smalltalk.addMethod(
  9633. "_sort",
  9634. smalltalk.method({
  9635. selector: "sort",
  9636. category: 'enumerating',
  9637. fn: function (){
  9638. var self=this;
  9639. var $1;
  9640. $1=smalltalk.send(self,"_basicPerform_",["sort"]);
  9641. return $1;
  9642. },
  9643. args: [],
  9644. source: "sort\x0a ^self basicPerform: 'sort'",
  9645. messageSends: ["basicPerform:"],
  9646. referencedClasses: []
  9647. }),
  9648. smalltalk.Array);
  9649. smalltalk.addMethod(
  9650. "_sort_",
  9651. smalltalk.method({
  9652. selector: "sort:",
  9653. category: 'enumerating',
  9654. fn: function (aBlock){
  9655. var self=this;
  9656. return self.sort(function(a, b) {
  9657. if(aBlock(a,b)) {return -1} else {return 1}
  9658. })
  9659. ;
  9660. ;
  9661. return self},
  9662. args: ["aBlock"],
  9663. 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>",
  9664. messageSends: [],
  9665. referencedClasses: []
  9666. }),
  9667. smalltalk.Array);
  9668. smalltalk.addMethod(
  9669. "_sorted",
  9670. smalltalk.method({
  9671. selector: "sorted",
  9672. category: 'enumerating',
  9673. fn: function (){
  9674. var self=this;
  9675. var $1;
  9676. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort",[]);
  9677. return $1;
  9678. },
  9679. args: [],
  9680. source: "sorted\x0a\x09^self copy sort",
  9681. messageSends: ["sort", "copy"],
  9682. referencedClasses: []
  9683. }),
  9684. smalltalk.Array);
  9685. smalltalk.addMethod(
  9686. "_sorted_",
  9687. smalltalk.method({
  9688. selector: "sorted:",
  9689. category: 'enumerating',
  9690. fn: function (aBlock){
  9691. var self=this;
  9692. var $1;
  9693. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort_",[aBlock]);
  9694. return $1;
  9695. },
  9696. args: ["aBlock"],
  9697. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  9698. messageSends: ["sort:", "copy"],
  9699. referencedClasses: []
  9700. }),
  9701. smalltalk.Array);
  9702. smalltalk.addMethod(
  9703. "_new_",
  9704. smalltalk.method({
  9705. selector: "new:",
  9706. category: 'instance creation',
  9707. fn: function (anInteger){
  9708. var self=this;
  9709. return new Array(anInteger);
  9710. ;
  9711. return self},
  9712. args: ["anInteger"],
  9713. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  9714. messageSends: [],
  9715. referencedClasses: []
  9716. }),
  9717. smalltalk.Array.klass);
  9718. smalltalk.addMethod(
  9719. "_with_",
  9720. smalltalk.method({
  9721. selector: "with:",
  9722. category: 'instance creation',
  9723. fn: function (anObject){
  9724. var self=this;
  9725. var $2,$3,$1;
  9726. $2=smalltalk.send(self,"_new_",[(1)]);
  9727. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9728. $3=smalltalk.send($2,"_yourself",[]);
  9729. $1=$3;
  9730. return $1;
  9731. },
  9732. args: ["anObject"],
  9733. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  9734. messageSends: ["at:put:", "new:", "yourself"],
  9735. referencedClasses: []
  9736. }),
  9737. smalltalk.Array.klass);
  9738. smalltalk.addMethod(
  9739. "_with_with_",
  9740. smalltalk.method({
  9741. selector: "with:with:",
  9742. category: 'instance creation',
  9743. fn: function (anObject,anObject2){
  9744. var self=this;
  9745. var $2,$3,$1;
  9746. $2=smalltalk.send(self,"_new_",[(2)]);
  9747. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9748. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9749. $3=smalltalk.send($2,"_yourself",[]);
  9750. $1=$3;
  9751. return $1;
  9752. },
  9753. args: ["anObject", "anObject2"],
  9754. 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",
  9755. messageSends: ["at:put:", "new:", "yourself"],
  9756. referencedClasses: []
  9757. }),
  9758. smalltalk.Array.klass);
  9759. smalltalk.addMethod(
  9760. "_with_with_with_",
  9761. smalltalk.method({
  9762. selector: "with:with:with:",
  9763. category: 'instance creation',
  9764. fn: function (anObject,anObject2,anObject3){
  9765. var self=this;
  9766. var $2,$3,$1;
  9767. $2=smalltalk.send(self,"_new_",[(3)]);
  9768. smalltalk.send($2,"_at_put_",[(1),anObject]);
  9769. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  9770. smalltalk.send($2,"_at_put_",[(3),anObject3]);
  9771. $3=smalltalk.send($2,"_yourself",[]);
  9772. $1=$3;
  9773. return $1;
  9774. },
  9775. args: ["anObject", "anObject2", "anObject3"],
  9776. 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",
  9777. messageSends: ["at:put:", "new:", "yourself"],
  9778. referencedClasses: []
  9779. }),
  9780. smalltalk.Array.klass);
  9781. smalltalk.addMethod(
  9782. "_withAll_",
  9783. smalltalk.method({
  9784. selector: "withAll:",
  9785. category: 'instance creation',
  9786. fn: function (aCollection){
  9787. var self=this;
  9788. var instance;
  9789. var index;
  9790. index=(1);
  9791. instance=smalltalk.send(self,"_new_",[smalltalk.send(aCollection,"_size",[])]);
  9792. smalltalk.send(aCollection,"_do_",[(function(each){
  9793. smalltalk.send(instance,"_at_put_",[index,each]);
  9794. index=smalltalk.send(index,"__plus",[(1)]);
  9795. return index;
  9796. })]);
  9797. return instance;
  9798. },
  9799. args: ["aCollection"],
  9800. 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",
  9801. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  9802. referencedClasses: []
  9803. }),
  9804. smalltalk.Array.klass);
  9805. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  9806. smalltalk.addMethod(
  9807. "__comma",
  9808. smalltalk.method({
  9809. selector: ",",
  9810. category: 'copying',
  9811. fn: function (aString){
  9812. var self=this;
  9813. var $1;
  9814. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__comma",[smalltalk.send(aString,"_asString",[])]);
  9815. return $1;
  9816. },
  9817. args: ["aString"],
  9818. source: ", aString\x0a\x09^self asString, aString asString",
  9819. messageSends: [",", "asString"],
  9820. referencedClasses: []
  9821. }),
  9822. smalltalk.CharacterArray);
  9823. smalltalk.addMethod(
  9824. "_add_",
  9825. smalltalk.method({
  9826. selector: "add:",
  9827. category: 'adding',
  9828. fn: function (anObject){
  9829. var self=this;
  9830. smalltalk.send(self,"_errorReadOnly",[]);
  9831. return self},
  9832. args: ["anObject"],
  9833. source: "add: anObject\x0a\x09self errorReadOnly",
  9834. messageSends: ["errorReadOnly"],
  9835. referencedClasses: []
  9836. }),
  9837. smalltalk.CharacterArray);
  9838. smalltalk.addMethod(
  9839. "_asLowercase",
  9840. smalltalk.method({
  9841. selector: "asLowercase",
  9842. category: 'converting',
  9843. fn: function (){
  9844. var self=this;
  9845. var $1;
  9846. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asLowercase",[])]);
  9847. return $1;
  9848. },
  9849. args: [],
  9850. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  9851. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  9852. referencedClasses: []
  9853. }),
  9854. smalltalk.CharacterArray);
  9855. smalltalk.addMethod(
  9856. "_asNumber",
  9857. smalltalk.method({
  9858. selector: "asNumber",
  9859. category: 'converting',
  9860. fn: function (){
  9861. var self=this;
  9862. var $1;
  9863. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asNumber",[]);
  9864. return $1;
  9865. },
  9866. args: [],
  9867. source: "asNumber\x0a\x09^self asString asNumber",
  9868. messageSends: ["asNumber", "asString"],
  9869. referencedClasses: []
  9870. }),
  9871. smalltalk.CharacterArray);
  9872. smalltalk.addMethod(
  9873. "_asString",
  9874. smalltalk.method({
  9875. selector: "asString",
  9876. category: 'converting',
  9877. fn: function (){
  9878. var self=this;
  9879. var $1;
  9880. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  9881. return $1;
  9882. },
  9883. args: [],
  9884. source: "asString\x0a\x09^self subclassResponsibility",
  9885. messageSends: ["subclassResponsibility"],
  9886. referencedClasses: []
  9887. }),
  9888. smalltalk.CharacterArray);
  9889. smalltalk.addMethod(
  9890. "_asSymbol",
  9891. smalltalk.method({
  9892. selector: "asSymbol",
  9893. category: 'converting',
  9894. fn: function (){
  9895. var self=this;
  9896. var $1;
  9897. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  9898. return $1;
  9899. },
  9900. args: [],
  9901. source: "asSymbol\x0a\x09^self subclassResponsibility",
  9902. messageSends: ["subclassResponsibility"],
  9903. referencedClasses: []
  9904. }),
  9905. smalltalk.CharacterArray);
  9906. smalltalk.addMethod(
  9907. "_asUppercase",
  9908. smalltalk.method({
  9909. selector: "asUppercase",
  9910. category: 'converting',
  9911. fn: function (){
  9912. var self=this;
  9913. var $1;
  9914. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asUppercase",[])]);
  9915. return $1;
  9916. },
  9917. args: [],
  9918. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  9919. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  9920. referencedClasses: []
  9921. }),
  9922. smalltalk.CharacterArray);
  9923. smalltalk.addMethod(
  9924. "_at_put_",
  9925. smalltalk.method({
  9926. selector: "at:put:",
  9927. category: 'accessing',
  9928. fn: function (anIndex,anObject){
  9929. var self=this;
  9930. smalltalk.send(self,"_errorReadOnly",[]);
  9931. return self},
  9932. args: ["anIndex", "anObject"],
  9933. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  9934. messageSends: ["errorReadOnly"],
  9935. referencedClasses: []
  9936. }),
  9937. smalltalk.CharacterArray);
  9938. smalltalk.addMethod(
  9939. "_errorReadOnly",
  9940. smalltalk.method({
  9941. selector: "errorReadOnly",
  9942. category: 'error handling',
  9943. fn: function (){
  9944. var self=this;
  9945. smalltalk.send(self,"_error_",["Object is read-only"]);
  9946. return self},
  9947. args: [],
  9948. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  9949. messageSends: ["error:"],
  9950. referencedClasses: []
  9951. }),
  9952. smalltalk.CharacterArray);
  9953. smalltalk.addMethod(
  9954. "_printString",
  9955. smalltalk.method({
  9956. selector: "printString",
  9957. category: 'printing',
  9958. fn: function (){
  9959. var self=this;
  9960. var $1;
  9961. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_printString",[]);
  9962. return $1;
  9963. },
  9964. args: [],
  9965. source: "printString\x0a\x09^self asString printString",
  9966. messageSends: ["printString", "asString"],
  9967. referencedClasses: []
  9968. }),
  9969. smalltalk.CharacterArray);
  9970. smalltalk.addMethod(
  9971. "_remove_",
  9972. smalltalk.method({
  9973. selector: "remove:",
  9974. category: 'adding',
  9975. fn: function (anObject){
  9976. var self=this;
  9977. smalltalk.send(self,"_errorReadOnly",[]);
  9978. return self},
  9979. args: ["anObject"],
  9980. source: "remove: anObject\x0a\x09self errorReadOnly",
  9981. messageSends: ["errorReadOnly"],
  9982. referencedClasses: []
  9983. }),
  9984. smalltalk.CharacterArray);
  9985. smalltalk.addMethod(
  9986. "_fromString_",
  9987. smalltalk.method({
  9988. selector: "fromString:",
  9989. category: 'instance creation',
  9990. fn: function (aString){
  9991. var self=this;
  9992. smalltalk.send(self,"_subclassResponsibility",[]);
  9993. return self},
  9994. args: ["aString"],
  9995. source: "fromString: aString\x0a\x09self subclassResponsibility",
  9996. messageSends: ["subclassResponsibility"],
  9997. referencedClasses: []
  9998. }),
  9999. smalltalk.CharacterArray.klass);
  10000. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  10001. smalltalk.addMethod(
  10002. "__comma",
  10003. smalltalk.method({
  10004. selector: ",",
  10005. category: 'copying',
  10006. fn: function (aString){
  10007. var self=this;
  10008. return self + aString;
  10009. ;
  10010. return self},
  10011. args: ["aString"],
  10012. source: ", aString\x0a\x09<return self + aString>",
  10013. messageSends: [],
  10014. referencedClasses: []
  10015. }),
  10016. smalltalk.String);
  10017. smalltalk.addMethod(
  10018. "__lt",
  10019. smalltalk.method({
  10020. selector: "<",
  10021. category: 'comparing',
  10022. fn: function (aString){
  10023. var self=this;
  10024. return String(self) < aString._asString();
  10025. ;
  10026. return self},
  10027. args: ["aString"],
  10028. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  10029. messageSends: [],
  10030. referencedClasses: []
  10031. }),
  10032. smalltalk.String);
  10033. smalltalk.addMethod(
  10034. "__lt_eq",
  10035. smalltalk.method({
  10036. selector: "<=",
  10037. category: 'comparing',
  10038. fn: function (aString){
  10039. var self=this;
  10040. return String(self) <= aString._asString();
  10041. ;
  10042. return self},
  10043. args: ["aString"],
  10044. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  10045. messageSends: [],
  10046. referencedClasses: []
  10047. }),
  10048. smalltalk.String);
  10049. smalltalk.addMethod(
  10050. "__eq",
  10051. smalltalk.method({
  10052. selector: "=",
  10053. category: 'comparing',
  10054. fn: function (aString){
  10055. var self=this;
  10056. var $1;
  10057. $1=smalltalk.send(smalltalk.send(aString,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  10058. if(! smalltalk.assert($1)){
  10059. return false;
  10060. };
  10061. return String(self) === String(aString);
  10062. ;
  10063. return self},
  10064. args: ["aString"],
  10065. source: "= aString\x0a\x09aString class = self class ifFalse: [^false].\x0a\x09<return String(self) === String(aString)>",
  10066. messageSends: ["ifFalse:", "=", "class"],
  10067. referencedClasses: []
  10068. }),
  10069. smalltalk.String);
  10070. smalltalk.addMethod(
  10071. "__eq_eq",
  10072. smalltalk.method({
  10073. selector: "==",
  10074. category: 'comparing',
  10075. fn: function (aString){
  10076. var self=this;
  10077. var $1;
  10078. $1=smalltalk.send(self,"__eq",[aString]);
  10079. return $1;
  10080. },
  10081. args: ["aString"],
  10082. source: "== aString\x0a\x09^self = aString",
  10083. messageSends: ["="],
  10084. referencedClasses: []
  10085. }),
  10086. smalltalk.String);
  10087. smalltalk.addMethod(
  10088. "__gt",
  10089. smalltalk.method({
  10090. selector: ">",
  10091. category: 'comparing',
  10092. fn: function (aString){
  10093. var self=this;
  10094. return String(self) > aString._asString();
  10095. ;
  10096. return self},
  10097. args: ["aString"],
  10098. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  10099. messageSends: [],
  10100. referencedClasses: []
  10101. }),
  10102. smalltalk.String);
  10103. smalltalk.addMethod(
  10104. "__gt_eq",
  10105. smalltalk.method({
  10106. selector: ">=",
  10107. category: 'comparing',
  10108. fn: function (aString){
  10109. var self=this;
  10110. return String(self) >= aString._asString();
  10111. ;
  10112. return self},
  10113. args: ["aString"],
  10114. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  10115. messageSends: [],
  10116. referencedClasses: []
  10117. }),
  10118. smalltalk.String);
  10119. smalltalk.addMethod(
  10120. "_asJSON",
  10121. smalltalk.method({
  10122. selector: "asJSON",
  10123. category: 'converting',
  10124. fn: function (){
  10125. var self=this;
  10126. return self;
  10127. },
  10128. args: [],
  10129. source: "asJSON\x0a\x09^self",
  10130. messageSends: [],
  10131. referencedClasses: []
  10132. }),
  10133. smalltalk.String);
  10134. smalltalk.addMethod(
  10135. "_asJavaScriptSelector",
  10136. smalltalk.method({
  10137. selector: "asJavaScriptSelector",
  10138. category: 'converting',
  10139. fn: function (){
  10140. var self=this;
  10141. var $1;
  10142. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asSelector",[]),"_replace_with_",["^_",""]),"_replace_with_",["_.*",""]);
  10143. return $1;
  10144. },
  10145. args: [],
  10146. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  10147. messageSends: ["replace:with:", "asSelector"],
  10148. referencedClasses: []
  10149. }),
  10150. smalltalk.String);
  10151. smalltalk.addMethod(
  10152. "_asJavascript",
  10153. smalltalk.method({
  10154. selector: "asJavascript",
  10155. category: 'converting',
  10156. fn: function (){
  10157. var self=this;
  10158. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10159. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10160. else
  10161. return "\"" + self + "\"";
  10162. ;
  10163. ;
  10164. return self},
  10165. args: [],
  10166. 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>",
  10167. messageSends: [],
  10168. referencedClasses: []
  10169. }),
  10170. smalltalk.String);
  10171. smalltalk.addMethod(
  10172. "_asLowercase",
  10173. smalltalk.method({
  10174. selector: "asLowercase",
  10175. category: 'converting',
  10176. fn: function (){
  10177. var self=this;
  10178. return self.toLowerCase();
  10179. ;
  10180. return self},
  10181. args: [],
  10182. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  10183. messageSends: [],
  10184. referencedClasses: []
  10185. }),
  10186. smalltalk.String);
  10187. smalltalk.addMethod(
  10188. "_asNumber",
  10189. smalltalk.method({
  10190. selector: "asNumber",
  10191. category: 'converting',
  10192. fn: function (){
  10193. var self=this;
  10194. return Number(self);
  10195. ;
  10196. return self},
  10197. args: [],
  10198. source: "asNumber\x0a\x09<return Number(self)>",
  10199. messageSends: [],
  10200. referencedClasses: []
  10201. }),
  10202. smalltalk.String);
  10203. smalltalk.addMethod(
  10204. "_asSelector",
  10205. smalltalk.method({
  10206. selector: "asSelector",
  10207. category: 'converting',
  10208. fn: function (){
  10209. var self=this;
  10210. var selector;
  10211. selector=smalltalk.send("_","__comma",[self]);
  10212. selector=smalltalk.send(selector,"_replace_with_",[":","_"]);
  10213. selector=smalltalk.send(selector,"_replace_with_",["[+]","_plus"]);
  10214. selector=smalltalk.send(selector,"_replace_with_",["-","_minus"]);
  10215. selector=smalltalk.send(selector,"_replace_with_",["[*]","_star"]);
  10216. selector=smalltalk.send(selector,"_replace_with_",["[/]","_slash"]);
  10217. selector=smalltalk.send(selector,"_replace_with_",[">","_gt"]);
  10218. selector=smalltalk.send(selector,"_replace_with_",["<","_lt"]);
  10219. selector=smalltalk.send(selector,"_replace_with_",["=","_eq"]);
  10220. selector=smalltalk.send(selector,"_replace_with_",[",","_comma"]);
  10221. selector=smalltalk.send(selector,"_replace_with_",["[@]","_at"]);
  10222. return selector;
  10223. },
  10224. args: [],
  10225. 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",
  10226. messageSends: [",", "replace:with:"],
  10227. referencedClasses: []
  10228. }),
  10229. smalltalk.String);
  10230. smalltalk.addMethod(
  10231. "_asString",
  10232. smalltalk.method({
  10233. selector: "asString",
  10234. category: 'converting',
  10235. fn: function (){
  10236. var self=this;
  10237. return self;
  10238. },
  10239. args: [],
  10240. source: "asString\x0a\x09^self",
  10241. messageSends: [],
  10242. referencedClasses: []
  10243. }),
  10244. smalltalk.String);
  10245. smalltalk.addMethod(
  10246. "_asSymbol",
  10247. smalltalk.method({
  10248. selector: "asSymbol",
  10249. category: 'converting',
  10250. fn: function (){
  10251. var self=this;
  10252. var $1;
  10253. $1=smalltalk.send((smalltalk.Symbol || Symbol),"_lookup_",[self]);
  10254. return $1;
  10255. },
  10256. args: [],
  10257. source: "asSymbol\x0a\x09^Symbol lookup: self",
  10258. messageSends: ["lookup:"],
  10259. referencedClasses: ["Symbol"]
  10260. }),
  10261. smalltalk.String);
  10262. smalltalk.addMethod(
  10263. "_asUppercase",
  10264. smalltalk.method({
  10265. selector: "asUppercase",
  10266. category: 'converting',
  10267. fn: function (){
  10268. var self=this;
  10269. return self.toUpperCase();
  10270. ;
  10271. return self},
  10272. args: [],
  10273. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  10274. messageSends: [],
  10275. referencedClasses: []
  10276. }),
  10277. smalltalk.String);
  10278. smalltalk.addMethod(
  10279. "_asciiValue",
  10280. smalltalk.method({
  10281. selector: "asciiValue",
  10282. category: 'accessing',
  10283. fn: function (){
  10284. var self=this;
  10285. return self.charCodeAt(0);;
  10286. ;
  10287. return self},
  10288. args: [],
  10289. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  10290. messageSends: [],
  10291. referencedClasses: []
  10292. }),
  10293. smalltalk.String);
  10294. smalltalk.addMethod(
  10295. "_at_ifAbsent_",
  10296. smalltalk.method({
  10297. selector: "at:ifAbsent:",
  10298. category: 'accessing',
  10299. fn: function (anIndex,aBlock){
  10300. var self=this;
  10301. return String(self).charAt(anIndex - 1) || aBlock();
  10302. ;
  10303. return self},
  10304. args: ["anIndex", "aBlock"],
  10305. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  10306. messageSends: [],
  10307. referencedClasses: []
  10308. }),
  10309. smalltalk.String);
  10310. smalltalk.addMethod(
  10311. "_copyFrom_to_",
  10312. smalltalk.method({
  10313. selector: "copyFrom:to:",
  10314. category: 'copying',
  10315. fn: function (anIndex,anotherIndex){
  10316. var self=this;
  10317. return self.substring(anIndex - 1, anotherIndex);
  10318. ;
  10319. return self},
  10320. args: ["anIndex", "anotherIndex"],
  10321. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  10322. messageSends: [],
  10323. referencedClasses: []
  10324. }),
  10325. smalltalk.String);
  10326. smalltalk.addMethod(
  10327. "_deepCopy",
  10328. smalltalk.method({
  10329. selector: "deepCopy",
  10330. category: 'copying',
  10331. fn: function (){
  10332. var self=this;
  10333. var $1;
  10334. $1=smalltalk.send(self,"_shallowCopy",[]);
  10335. return $1;
  10336. },
  10337. args: [],
  10338. source: "deepCopy\x0a\x09^self shallowCopy",
  10339. messageSends: ["shallowCopy"],
  10340. referencedClasses: []
  10341. }),
  10342. smalltalk.String);
  10343. smalltalk.addMethod(
  10344. "_do_",
  10345. smalltalk.method({
  10346. selector: "do:",
  10347. category: 'enumerating',
  10348. fn: function (aBlock){
  10349. var self=this;
  10350. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  10351. ;
  10352. return self},
  10353. args: ["aBlock"],
  10354. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  10355. messageSends: [],
  10356. referencedClasses: []
  10357. }),
  10358. smalltalk.String);
  10359. smalltalk.addMethod(
  10360. "_escaped",
  10361. smalltalk.method({
  10362. selector: "escaped",
  10363. category: 'accessing',
  10364. fn: function (){
  10365. var self=this;
  10366. return escape(self);
  10367. ;
  10368. return self},
  10369. args: [],
  10370. source: "escaped\x0a\x09<return escape(self)>",
  10371. messageSends: [],
  10372. referencedClasses: []
  10373. }),
  10374. smalltalk.String);
  10375. smalltalk.addMethod(
  10376. "_includesSubString_",
  10377. smalltalk.method({
  10378. selector: "includesSubString:",
  10379. category: 'testing',
  10380. fn: function (subString){
  10381. var self=this;
  10382. return self.indexOf(subString) != -1 ;
  10383. ;
  10384. return self},
  10385. args: ["subString"],
  10386. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  10387. messageSends: [],
  10388. referencedClasses: []
  10389. }),
  10390. smalltalk.String);
  10391. smalltalk.addMethod(
  10392. "_isString",
  10393. smalltalk.method({
  10394. selector: "isString",
  10395. category: 'testing',
  10396. fn: function (){
  10397. var self=this;
  10398. return true;
  10399. },
  10400. args: [],
  10401. source: "isString\x0a\x09^true",
  10402. messageSends: [],
  10403. referencedClasses: []
  10404. }),
  10405. smalltalk.String);
  10406. smalltalk.addMethod(
  10407. "_join_",
  10408. smalltalk.method({
  10409. selector: "join:",
  10410. category: 'split join',
  10411. fn: function (aCollection){
  10412. var self=this;
  10413. var $1;
  10414. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  10415. return smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  10416. return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(each,"_asString",[])]);
  10417. }),(function(){
  10418. return smalltalk.send(stream,"_nextPutAll_",[self]);
  10419. })]);
  10420. })]);
  10421. return $1;
  10422. },
  10423. args: ["aCollection"],
  10424. 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]]",
  10425. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  10426. referencedClasses: ["String"]
  10427. }),
  10428. smalltalk.String);
  10429. smalltalk.addMethod(
  10430. "_lineIndicesDo_",
  10431. smalltalk.method({
  10432. selector: "lineIndicesDo:",
  10433. category: 'split join',
  10434. fn: function (aBlock){
  10435. var self=this;
  10436. var $1,$2,$3;
  10437. var $early={};
  10438. try {
  10439. var cr;
  10440. var lf;
  10441. var start;
  10442. var sz;
  10443. var nextLF;
  10444. var nextCR;
  10445. start=(1);
  10446. sz=smalltalk.send(self,"_size",[]);
  10447. cr=smalltalk.send((smalltalk.String || String),"_cr",[]);
  10448. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,(1)]);
  10449. lf=smalltalk.send((smalltalk.String || String),"_lf",[]);
  10450. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,(1)]);
  10451. smalltalk.send((function(){
  10452. return smalltalk.send(start,"__lt_eq",[sz]);
  10453. }),"_whileTrue_",[(function(){
  10454. $1=smalltalk.send(smalltalk.send(nextLF,"__eq",[(0)]),"_and_",[(function(){
  10455. return smalltalk.send(nextCR,"__eq",[(0)]);
  10456. })]);
  10457. if(smalltalk.assert($1)){
  10458. smalltalk.send(aBlock,"_value_value_value_",[start,sz,sz]);
  10459. throw $early=[self];
  10460. };
  10461. $2=smalltalk.send(smalltalk.send(nextCR,"__eq",[(0)]),"_or_",[(function(){
  10462. return smalltalk.send(smalltalk.send((0),"__lt",[nextLF]),"_and_",[(function(){
  10463. return smalltalk.send(nextLF,"__lt",[nextCR]);
  10464. })]);
  10465. })]);
  10466. if(smalltalk.assert($2)){
  10467. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextLF,"__minus",[(1)]),nextLF]);
  10468. start=smalltalk.send((1),"__plus",[nextLF]);
  10469. start;
  10470. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10471. return nextLF;
  10472. } else {
  10473. $3=smalltalk.send(smalltalk.send((1),"__plus",[nextCR]),"__eq",[nextLF]);
  10474. if(smalltalk.assert($3)){
  10475. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextLF]);
  10476. start=smalltalk.send((1),"__plus",[nextLF]);
  10477. start;
  10478. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10479. nextCR;
  10480. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  10481. return nextLF;
  10482. } else {
  10483. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextCR]);
  10484. start=smalltalk.send((1),"__plus",[nextCR]);
  10485. start;
  10486. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  10487. return nextCR;
  10488. };
  10489. };
  10490. })]);
  10491. return self}
  10492. catch(e) {if(e===$early)return e[0]; throw e}
  10493. },
  10494. args: ["aBlock"],
  10495. 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 ]]]",
  10496. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  10497. referencedClasses: ["String"]
  10498. }),
  10499. smalltalk.String);
  10500. smalltalk.addMethod(
  10501. "_lineNumber_",
  10502. smalltalk.method({
  10503. selector: "lineNumber:",
  10504. category: 'split join',
  10505. fn: function (anIndex){
  10506. var self=this;
  10507. var $1,$2;
  10508. var $early={};
  10509. try {
  10510. var lineCount;
  10511. lineCount=(0);
  10512. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10513. lineCount=smalltalk.send(lineCount,"__plus",[(1)]);
  10514. $1=smalltalk.send(lineCount,"__eq",[anIndex]);
  10515. if(smalltalk.assert($1)){
  10516. $2=smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters]);
  10517. throw $early=[$2];
  10518. };
  10519. })]);
  10520. return nil;
  10521. }
  10522. catch(e) {if(e===$early)return e[0]; throw e}
  10523. },
  10524. args: ["anIndex"],
  10525. 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",
  10526. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  10527. referencedClasses: []
  10528. }),
  10529. smalltalk.String);
  10530. smalltalk.addMethod(
  10531. "_lines",
  10532. smalltalk.method({
  10533. selector: "lines",
  10534. category: 'split join',
  10535. fn: function (){
  10536. var self=this;
  10537. var lines;
  10538. lines=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  10539. smalltalk.send(self,"_linesDo_",[(function(aLine){
  10540. return smalltalk.send(lines,"_add_",[aLine]);
  10541. })]);
  10542. return lines;
  10543. },
  10544. args: [],
  10545. 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",
  10546. messageSends: ["new", "linesDo:", "add:"],
  10547. referencedClasses: ["Array"]
  10548. }),
  10549. smalltalk.String);
  10550. smalltalk.addMethod(
  10551. "_linesDo_",
  10552. smalltalk.method({
  10553. selector: "linesDo:",
  10554. category: 'split join',
  10555. fn: function (aBlock){
  10556. var self=this;
  10557. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  10558. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters])]);
  10559. })]);
  10560. return self},
  10561. args: ["aBlock"],
  10562. 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)]",
  10563. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  10564. referencedClasses: []
  10565. }),
  10566. smalltalk.String);
  10567. smalltalk.addMethod(
  10568. "_match_",
  10569. smalltalk.method({
  10570. selector: "match:",
  10571. category: 'regular expressions',
  10572. fn: function (aRegexp){
  10573. var self=this;
  10574. return self.search(aRegexp) != -1;
  10575. ;
  10576. return self},
  10577. args: ["aRegexp"],
  10578. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  10579. messageSends: [],
  10580. referencedClasses: []
  10581. }),
  10582. smalltalk.String);
  10583. smalltalk.addMethod(
  10584. "_matchesOf_",
  10585. smalltalk.method({
  10586. selector: "matchesOf:",
  10587. category: 'regular expressions',
  10588. fn: function (aRegularExpression){
  10589. var self=this;
  10590. return self.match(aRegularExpression);
  10591. ;
  10592. return self},
  10593. args: ["aRegularExpression"],
  10594. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  10595. messageSends: [],
  10596. referencedClasses: []
  10597. }),
  10598. smalltalk.String);
  10599. smalltalk.addMethod(
  10600. "_printNl",
  10601. smalltalk.method({
  10602. selector: "printNl",
  10603. category: 'printing',
  10604. fn: function (){
  10605. var self=this;
  10606. console.log(self);
  10607. ;
  10608. return self},
  10609. args: [],
  10610. source: "printNl\x0a\x09<console.log(self)>",
  10611. messageSends: [],
  10612. referencedClasses: []
  10613. }),
  10614. smalltalk.String);
  10615. smalltalk.addMethod(
  10616. "_printString",
  10617. smalltalk.method({
  10618. selector: "printString",
  10619. category: 'printing',
  10620. fn: function (){
  10621. var self=this;
  10622. var $1;
  10623. $1=smalltalk.send(smalltalk.send("'","__comma",[self]),"__comma",["'"]);
  10624. return $1;
  10625. },
  10626. args: [],
  10627. source: "printString\x0a\x09^'''', self, ''''",
  10628. messageSends: [","],
  10629. referencedClasses: []
  10630. }),
  10631. smalltalk.String);
  10632. smalltalk.addMethod(
  10633. "_replace_with_",
  10634. smalltalk.method({
  10635. selector: "replace:with:",
  10636. category: 'regular expressions',
  10637. fn: function (aString,anotherString){
  10638. var self=this;
  10639. var $1;
  10640. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[aString,"g"]),anotherString]);
  10641. return $1;
  10642. },
  10643. args: ["aString", "anotherString"],
  10644. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  10645. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  10646. referencedClasses: ["RegularExpression"]
  10647. }),
  10648. smalltalk.String);
  10649. smalltalk.addMethod(
  10650. "_replaceRegexp_with_",
  10651. smalltalk.method({
  10652. selector: "replaceRegexp:with:",
  10653. category: 'regular expressions',
  10654. fn: function (aRegexp,aString){
  10655. var self=this;
  10656. return self.replace(aRegexp, aString);
  10657. ;
  10658. return self},
  10659. args: ["aRegexp", "aString"],
  10660. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  10661. messageSends: [],
  10662. referencedClasses: []
  10663. }),
  10664. smalltalk.String);
  10665. smalltalk.addMethod(
  10666. "_reversed",
  10667. smalltalk.method({
  10668. selector: "reversed",
  10669. category: 'converting',
  10670. fn: function (){
  10671. var self=this;
  10672. return self.split("").reverse().join("");
  10673. ;
  10674. return self},
  10675. args: [],
  10676. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  10677. messageSends: [],
  10678. referencedClasses: []
  10679. }),
  10680. smalltalk.String);
  10681. smalltalk.addMethod(
  10682. "_shallowCopy",
  10683. smalltalk.method({
  10684. selector: "shallowCopy",
  10685. category: 'copying',
  10686. fn: function (){
  10687. var self=this;
  10688. var $1;
  10689. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[self]);
  10690. return $1;
  10691. },
  10692. args: [],
  10693. source: "shallowCopy\x0a\x09^self class fromString: self",
  10694. messageSends: ["fromString:", "class"],
  10695. referencedClasses: []
  10696. }),
  10697. smalltalk.String);
  10698. smalltalk.addMethod(
  10699. "_size",
  10700. smalltalk.method({
  10701. selector: "size",
  10702. category: 'accessing',
  10703. fn: function (){
  10704. var self=this;
  10705. return self.length;
  10706. ;
  10707. return self},
  10708. args: [],
  10709. source: "size\x0a\x09<return self.length>",
  10710. messageSends: [],
  10711. referencedClasses: []
  10712. }),
  10713. smalltalk.String);
  10714. smalltalk.addMethod(
  10715. "_tokenize_",
  10716. smalltalk.method({
  10717. selector: "tokenize:",
  10718. category: 'converting',
  10719. fn: function (aString){
  10720. var self=this;
  10721. return self.split(aString);
  10722. ;
  10723. return self},
  10724. args: ["aString"],
  10725. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  10726. messageSends: [],
  10727. referencedClasses: []
  10728. }),
  10729. smalltalk.String);
  10730. smalltalk.addMethod(
  10731. "_trimBoth",
  10732. smalltalk.method({
  10733. selector: "trimBoth",
  10734. category: 'regular expressions',
  10735. fn: function (){
  10736. var self=this;
  10737. var $1;
  10738. $1=smalltalk.send(self,"_trimBoth_",["\x5cs"]);
  10739. return $1;
  10740. },
  10741. args: [],
  10742. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  10743. messageSends: ["trimBoth:"],
  10744. referencedClasses: []
  10745. }),
  10746. smalltalk.String);
  10747. smalltalk.addMethod(
  10748. "_trimBoth_",
  10749. smalltalk.method({
  10750. selector: "trimBoth:",
  10751. category: 'regular expressions',
  10752. fn: function (separators){
  10753. var self=this;
  10754. var $1;
  10755. $1=smalltalk.send(smalltalk.send(self,"_trimLeft_",[separators]),"_trimRight_",[separators]);
  10756. return $1;
  10757. },
  10758. args: ["separators"],
  10759. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  10760. messageSends: ["trimRight:", "trimLeft:"],
  10761. referencedClasses: []
  10762. }),
  10763. smalltalk.String);
  10764. smalltalk.addMethod(
  10765. "_trimLeft",
  10766. smalltalk.method({
  10767. selector: "trimLeft",
  10768. category: 'regular expressions',
  10769. fn: function (){
  10770. var self=this;
  10771. var $1;
  10772. $1=smalltalk.send(self,"_trimLeft_",["\x5cs"]);
  10773. return $1;
  10774. },
  10775. args: [],
  10776. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  10777. messageSends: ["trimLeft:"],
  10778. referencedClasses: []
  10779. }),
  10780. smalltalk.String);
  10781. smalltalk.addMethod(
  10782. "_trimLeft_",
  10783. smalltalk.method({
  10784. selector: "trimLeft:",
  10785. category: 'regular expressions',
  10786. fn: function (separators){
  10787. var self=this;
  10788. var $1;
  10789. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("^[","__comma",[separators]),"__comma",["]+"]),"g"]),""]);
  10790. return $1;
  10791. },
  10792. args: ["separators"],
  10793. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  10794. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10795. referencedClasses: ["RegularExpression"]
  10796. }),
  10797. smalltalk.String);
  10798. smalltalk.addMethod(
  10799. "_trimRight",
  10800. smalltalk.method({
  10801. selector: "trimRight",
  10802. category: 'regular expressions',
  10803. fn: function (){
  10804. var self=this;
  10805. var $1;
  10806. $1=smalltalk.send(self,"_trimRight_",["\x5cs"]);
  10807. return $1;
  10808. },
  10809. args: [],
  10810. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  10811. messageSends: ["trimRight:"],
  10812. referencedClasses: []
  10813. }),
  10814. smalltalk.String);
  10815. smalltalk.addMethod(
  10816. "_trimRight_",
  10817. smalltalk.method({
  10818. selector: "trimRight:",
  10819. category: 'regular expressions',
  10820. fn: function (separators){
  10821. var self=this;
  10822. var $1;
  10823. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("[","__comma",[separators]),"__comma",["]+$"]),"g"]),""]);
  10824. return $1;
  10825. },
  10826. args: ["separators"],
  10827. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  10828. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  10829. referencedClasses: ["RegularExpression"]
  10830. }),
  10831. smalltalk.String);
  10832. smalltalk.addMethod(
  10833. "_unescaped",
  10834. smalltalk.method({
  10835. selector: "unescaped",
  10836. category: 'accessing',
  10837. fn: function (){
  10838. var self=this;
  10839. return unescape(self);
  10840. ;
  10841. return self},
  10842. args: [],
  10843. source: "unescaped\x0a\x09<return unescape(self)>",
  10844. messageSends: [],
  10845. referencedClasses: []
  10846. }),
  10847. smalltalk.String);
  10848. smalltalk.addMethod(
  10849. "_withIndexDo_",
  10850. smalltalk.method({
  10851. selector: "withIndexDo:",
  10852. category: 'enumerating',
  10853. fn: function (aBlock){
  10854. var self=this;
  10855. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  10856. ;
  10857. return self},
  10858. args: ["aBlock"],
  10859. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  10860. messageSends: [],
  10861. referencedClasses: []
  10862. }),
  10863. smalltalk.String);
  10864. smalltalk.addMethod(
  10865. "_cr",
  10866. smalltalk.method({
  10867. selector: "cr",
  10868. category: 'accessing',
  10869. fn: function (){
  10870. var self=this;
  10871. return '\r';
  10872. ;
  10873. return self},
  10874. args: [],
  10875. source: "cr\x0a\x09<return '\x5cr'>",
  10876. messageSends: [],
  10877. referencedClasses: []
  10878. }),
  10879. smalltalk.String.klass);
  10880. smalltalk.addMethod(
  10881. "_crlf",
  10882. smalltalk.method({
  10883. selector: "crlf",
  10884. category: 'accessing',
  10885. fn: function (){
  10886. var self=this;
  10887. return '\r\n';
  10888. ;
  10889. return self},
  10890. args: [],
  10891. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  10892. messageSends: [],
  10893. referencedClasses: []
  10894. }),
  10895. smalltalk.String.klass);
  10896. smalltalk.addMethod(
  10897. "_fromCharCode_",
  10898. smalltalk.method({
  10899. selector: "fromCharCode:",
  10900. category: 'instance creation',
  10901. fn: function (anInteger){
  10902. var self=this;
  10903. return String.fromCharCode(anInteger);
  10904. ;
  10905. return self},
  10906. args: ["anInteger"],
  10907. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  10908. messageSends: [],
  10909. referencedClasses: []
  10910. }),
  10911. smalltalk.String.klass);
  10912. smalltalk.addMethod(
  10913. "_fromString_",
  10914. smalltalk.method({
  10915. selector: "fromString:",
  10916. category: 'instance creation',
  10917. fn: function (aString){
  10918. var self=this;
  10919. return new self.fn(aString);
  10920. ;
  10921. return self},
  10922. args: ["aString"],
  10923. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  10924. messageSends: [],
  10925. referencedClasses: []
  10926. }),
  10927. smalltalk.String.klass);
  10928. smalltalk.addMethod(
  10929. "_lf",
  10930. smalltalk.method({
  10931. selector: "lf",
  10932. category: 'accessing',
  10933. fn: function (){
  10934. var self=this;
  10935. return '\n';
  10936. ;
  10937. return self},
  10938. args: [],
  10939. source: "lf\x0a\x09<return '\x5cn'>",
  10940. messageSends: [],
  10941. referencedClasses: []
  10942. }),
  10943. smalltalk.String.klass);
  10944. smalltalk.addMethod(
  10945. "_space",
  10946. smalltalk.method({
  10947. selector: "space",
  10948. category: 'accessing',
  10949. fn: function (){
  10950. var self=this;
  10951. return ' ';
  10952. ;
  10953. return self},
  10954. args: [],
  10955. source: "space\x0a\x09<return ' '>",
  10956. messageSends: [],
  10957. referencedClasses: []
  10958. }),
  10959. smalltalk.String.klass);
  10960. smalltalk.addMethod(
  10961. "_streamClass",
  10962. smalltalk.method({
  10963. selector: "streamClass",
  10964. category: 'accessing',
  10965. fn: function (){
  10966. var self=this;
  10967. return (smalltalk.StringStream || StringStream);
  10968. },
  10969. args: [],
  10970. source: "streamClass\x0a\x09 ^StringStream",
  10971. messageSends: [],
  10972. referencedClasses: ["StringStream"]
  10973. }),
  10974. smalltalk.String.klass);
  10975. smalltalk.addMethod(
  10976. "_streamContents_",
  10977. smalltalk.method({
  10978. selector: "streamContents:",
  10979. category: 'instance creation',
  10980. fn: function (blockWithArg){
  10981. var self=this;
  10982. var $1;
  10983. var stream;
  10984. stream=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[smalltalk.send((smalltalk.String || String),"_new",[])]);
  10985. smalltalk.send(blockWithArg,"_value_",[stream]);
  10986. $1=smalltalk.send(stream,"_contents",[]);
  10987. return $1;
  10988. },
  10989. args: ["blockWithArg"],
  10990. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  10991. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  10992. referencedClasses: ["String"]
  10993. }),
  10994. smalltalk.String.klass);
  10995. smalltalk.addMethod(
  10996. "_tab",
  10997. smalltalk.method({
  10998. selector: "tab",
  10999. category: 'accessing',
  11000. fn: function (){
  11001. var self=this;
  11002. return '\t';
  11003. ;
  11004. return self},
  11005. args: [],
  11006. source: "tab\x0a\x09<return '\x5ct'>",
  11007. messageSends: [],
  11008. referencedClasses: []
  11009. }),
  11010. smalltalk.String.klass);
  11011. smalltalk.addMethod(
  11012. "_value_",
  11013. smalltalk.method({
  11014. selector: "value:",
  11015. category: 'instance creation',
  11016. fn: function (aUTFCharCode){
  11017. var self=this;
  11018. return String.fromCharCode(aUTFCharCode);;
  11019. ;
  11020. return self},
  11021. args: ["aUTFCharCode"],
  11022. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  11023. messageSends: [],
  11024. referencedClasses: []
  11025. }),
  11026. smalltalk.String.klass);
  11027. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  11028. smalltalk.addMethod(
  11029. "__lt",
  11030. smalltalk.method({
  11031. selector: "<",
  11032. category: 'comparing',
  11033. fn: function (aSymbol){
  11034. var self=this;
  11035. var $1;
  11036. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt",[smalltalk.send(aSymbol,"_asString",[])]);
  11037. return $1;
  11038. },
  11039. args: ["aSymbol"],
  11040. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  11041. messageSends: ["<", "asString"],
  11042. referencedClasses: []
  11043. }),
  11044. smalltalk.Symbol);
  11045. smalltalk.addMethod(
  11046. "__lt_eq",
  11047. smalltalk.method({
  11048. selector: "<=",
  11049. category: 'comparing',
  11050. fn: function (aSymbol){
  11051. var self=this;
  11052. var $1;
  11053. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11054. return $1;
  11055. },
  11056. args: ["aSymbol"],
  11057. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  11058. messageSends: ["<=", "asString"],
  11059. referencedClasses: []
  11060. }),
  11061. smalltalk.Symbol);
  11062. smalltalk.addMethod(
  11063. "__eq",
  11064. smalltalk.method({
  11065. selector: "=",
  11066. category: 'comparing',
  11067. fn: function (aSymbol){
  11068. var self=this;
  11069. var $1,$2;
  11070. $1=smalltalk.send(smalltalk.send(aSymbol,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  11071. if(! smalltalk.assert($1)){
  11072. return false;
  11073. };
  11074. $2=smalltalk.send(smalltalk.send(self,"_asString",[]),"__eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11075. return $2;
  11076. },
  11077. args: ["aSymbol"],
  11078. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  11079. messageSends: ["ifFalse:", "=", "class", "asString"],
  11080. referencedClasses: []
  11081. }),
  11082. smalltalk.Symbol);
  11083. smalltalk.addMethod(
  11084. "__gt",
  11085. smalltalk.method({
  11086. selector: ">",
  11087. category: 'comparing',
  11088. fn: function (aSymbol){
  11089. var self=this;
  11090. var $1;
  11091. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt",[smalltalk.send(aSymbol,"_asString",[])]);
  11092. return $1;
  11093. },
  11094. args: ["aSymbol"],
  11095. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  11096. messageSends: [">", "asString"],
  11097. referencedClasses: []
  11098. }),
  11099. smalltalk.Symbol);
  11100. smalltalk.addMethod(
  11101. "__gt_eq",
  11102. smalltalk.method({
  11103. selector: ">=",
  11104. category: 'comparing',
  11105. fn: function (aSymbol){
  11106. var self=this;
  11107. var $1;
  11108. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  11109. return $1;
  11110. },
  11111. args: ["aSymbol"],
  11112. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  11113. messageSends: [">=", "asString"],
  11114. referencedClasses: []
  11115. }),
  11116. smalltalk.Symbol);
  11117. smalltalk.addMethod(
  11118. "_asJSON",
  11119. smalltalk.method({
  11120. selector: "asJSON",
  11121. category: 'converting',
  11122. fn: function (){
  11123. var self=this;
  11124. var $1;
  11125. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asJSON",[]);
  11126. return $1;
  11127. },
  11128. args: [],
  11129. source: "asJSON\x0a\x09^self asString asJSON",
  11130. messageSends: ["asJSON", "asString"],
  11131. referencedClasses: []
  11132. }),
  11133. smalltalk.Symbol);
  11134. smalltalk.addMethod(
  11135. "_asJavascript",
  11136. smalltalk.method({
  11137. selector: "asJavascript",
  11138. category: 'converting',
  11139. fn: function (){
  11140. var self=this;
  11141. var $1;
  11142. $1=smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22","__comma",[smalltalk.send(self,"_asString",[])]),"__comma",["\x22)"]);
  11143. return $1;
  11144. },
  11145. args: [],
  11146. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  11147. messageSends: [",", "asString"],
  11148. referencedClasses: []
  11149. }),
  11150. smalltalk.Symbol);
  11151. smalltalk.addMethod(
  11152. "_asSelector",
  11153. smalltalk.method({
  11154. selector: "asSelector",
  11155. category: 'converting',
  11156. fn: function (){
  11157. var self=this;
  11158. var $1;
  11159. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSelector",[]);
  11160. return $1;
  11161. },
  11162. args: [],
  11163. source: "asSelector\x0a\x09^self asString asSelector",
  11164. messageSends: ["asSelector", "asString"],
  11165. referencedClasses: []
  11166. }),
  11167. smalltalk.Symbol);
  11168. smalltalk.addMethod(
  11169. "_asString",
  11170. smalltalk.method({
  11171. selector: "asString",
  11172. category: 'converting',
  11173. fn: function (){
  11174. var self=this;
  11175. return self.value;
  11176. ;
  11177. return self},
  11178. args: [],
  11179. source: "asString\x0a\x09<return self.value>",
  11180. messageSends: [],
  11181. referencedClasses: []
  11182. }),
  11183. smalltalk.Symbol);
  11184. smalltalk.addMethod(
  11185. "_asSymbol",
  11186. smalltalk.method({
  11187. selector: "asSymbol",
  11188. category: 'converting',
  11189. fn: function (){
  11190. var self=this;
  11191. return self;
  11192. },
  11193. args: [],
  11194. source: "asSymbol\x0a\x09^self",
  11195. messageSends: [],
  11196. referencedClasses: []
  11197. }),
  11198. smalltalk.Symbol);
  11199. smalltalk.addMethod(
  11200. "_at_ifAbsent_",
  11201. smalltalk.method({
  11202. selector: "at:ifAbsent:",
  11203. category: 'accessing',
  11204. fn: function (anIndex,aBlock){
  11205. var self=this;
  11206. var $1;
  11207. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_at_ifAbsent_",[anIndex,aBlock]);
  11208. return $1;
  11209. },
  11210. args: ["anIndex", "aBlock"],
  11211. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  11212. messageSends: ["at:ifAbsent:", "asString"],
  11213. referencedClasses: []
  11214. }),
  11215. smalltalk.Symbol);
  11216. smalltalk.addMethod(
  11217. "_collect_",
  11218. smalltalk.method({
  11219. selector: "collect:",
  11220. category: 'enumerating',
  11221. fn: function (aBlock){
  11222. var self=this;
  11223. var $1;
  11224. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_collect_",[aBlock]),"_asSymbol",[]);
  11225. return $1;
  11226. },
  11227. args: ["aBlock"],
  11228. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  11229. messageSends: ["asSymbol", "collect:", "asString"],
  11230. referencedClasses: []
  11231. }),
  11232. smalltalk.Symbol);
  11233. smalltalk.addMethod(
  11234. "_copyFrom_to_",
  11235. smalltalk.method({
  11236. selector: "copyFrom:to:",
  11237. category: 'copying',
  11238. fn: function (anIndex,anotherIndex){
  11239. var self=this;
  11240. var $1;
  11241. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_copyFrom_to_",[anIndex,anotherIndex])]);
  11242. return $1;
  11243. },
  11244. args: ["anIndex", "anotherIndex"],
  11245. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  11246. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  11247. referencedClasses: []
  11248. }),
  11249. smalltalk.Symbol);
  11250. smalltalk.addMethod(
  11251. "_deepCopy",
  11252. smalltalk.method({
  11253. selector: "deepCopy",
  11254. category: 'copying',
  11255. fn: function (){
  11256. var self=this;
  11257. return self;
  11258. },
  11259. args: [],
  11260. source: "deepCopy\x0a\x09^self",
  11261. messageSends: [],
  11262. referencedClasses: []
  11263. }),
  11264. smalltalk.Symbol);
  11265. smalltalk.addMethod(
  11266. "_detect_",
  11267. smalltalk.method({
  11268. selector: "detect:",
  11269. category: 'enumerating',
  11270. fn: function (aBlock){
  11271. var self=this;
  11272. var $1;
  11273. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_detect_",[aBlock]);
  11274. return $1;
  11275. },
  11276. args: ["aBlock"],
  11277. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  11278. messageSends: ["detect:", "asString"],
  11279. referencedClasses: []
  11280. }),
  11281. smalltalk.Symbol);
  11282. smalltalk.addMethod(
  11283. "_do_",
  11284. smalltalk.method({
  11285. selector: "do:",
  11286. category: 'enumerating',
  11287. fn: function (aBlock){
  11288. var self=this;
  11289. smalltalk.send(smalltalk.send(self,"_asString",[]),"_do_",[aBlock]);
  11290. return self},
  11291. args: ["aBlock"],
  11292. source: "do: aBlock\x0a\x09self asString do: aBlock",
  11293. messageSends: ["do:", "asString"],
  11294. referencedClasses: []
  11295. }),
  11296. smalltalk.Symbol);
  11297. smalltalk.addMethod(
  11298. "_isSymbol",
  11299. smalltalk.method({
  11300. selector: "isSymbol",
  11301. category: 'printing',
  11302. fn: function (){
  11303. var self=this;
  11304. return true;
  11305. },
  11306. args: [],
  11307. source: "isSymbol\x0a\x09^true",
  11308. messageSends: [],
  11309. referencedClasses: []
  11310. }),
  11311. smalltalk.Symbol);
  11312. smalltalk.addMethod(
  11313. "_printString",
  11314. smalltalk.method({
  11315. selector: "printString",
  11316. category: 'printing',
  11317. fn: function (){
  11318. var self=this;
  11319. var $1;
  11320. $1=smalltalk.send("#","__comma",[smalltalk.send(self,"_asString",[])]);
  11321. return $1;
  11322. },
  11323. args: [],
  11324. source: "printString\x0a\x09^'#', self asString",
  11325. messageSends: [",", "asString"],
  11326. referencedClasses: []
  11327. }),
  11328. smalltalk.Symbol);
  11329. smalltalk.addMethod(
  11330. "_select_",
  11331. smalltalk.method({
  11332. selector: "select:",
  11333. category: 'enumerating',
  11334. fn: function (aBlock){
  11335. var self=this;
  11336. var $1;
  11337. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_select_",[aBlock]),"_asSymbol",[]);
  11338. return $1;
  11339. },
  11340. args: ["aBlock"],
  11341. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  11342. messageSends: ["asSymbol", "select:", "asString"],
  11343. referencedClasses: []
  11344. }),
  11345. smalltalk.Symbol);
  11346. smalltalk.addMethod(
  11347. "_shallowCopy",
  11348. smalltalk.method({
  11349. selector: "shallowCopy",
  11350. category: 'copying',
  11351. fn: function (){
  11352. var self=this;
  11353. return self;
  11354. },
  11355. args: [],
  11356. source: "shallowCopy\x0a\x09^self",
  11357. messageSends: [],
  11358. referencedClasses: []
  11359. }),
  11360. smalltalk.Symbol);
  11361. smalltalk.addMethod(
  11362. "_size",
  11363. smalltalk.method({
  11364. selector: "size",
  11365. category: 'accessing',
  11366. fn: function (){
  11367. var self=this;
  11368. var $1;
  11369. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_size",[]);
  11370. return $1;
  11371. },
  11372. args: [],
  11373. source: "size\x0a\x09^self asString size",
  11374. messageSends: ["size", "asString"],
  11375. referencedClasses: []
  11376. }),
  11377. smalltalk.Symbol);
  11378. smalltalk.addMethod(
  11379. "_value_",
  11380. smalltalk.method({
  11381. selector: "value:",
  11382. category: 'evaluating',
  11383. fn: function (anObject){
  11384. var self=this;
  11385. var $1;
  11386. $1=smalltalk.send(anObject,"_perform_",[self]);
  11387. return $1;
  11388. },
  11389. args: ["anObject"],
  11390. source: "value: anObject \x0a\x09^anObject perform: self",
  11391. messageSends: ["perform:"],
  11392. referencedClasses: []
  11393. }),
  11394. smalltalk.Symbol);
  11395. smalltalk.addMethod(
  11396. "_withIndexDo_",
  11397. smalltalk.method({
  11398. selector: "withIndexDo:",
  11399. category: 'enumerating',
  11400. fn: function (aBlock){
  11401. var self=this;
  11402. smalltalk.send(smalltalk.send(self,"_asString",[]),"_withIndexDo_",[aBlock]);
  11403. return self},
  11404. args: ["aBlock"],
  11405. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  11406. messageSends: ["withIndexDo:", "asString"],
  11407. referencedClasses: []
  11408. }),
  11409. smalltalk.Symbol);
  11410. smalltalk.addMethod(
  11411. "_basicNew",
  11412. smalltalk.method({
  11413. selector: "basicNew",
  11414. category: 'instance creation',
  11415. fn: function (){
  11416. var self=this;
  11417. smalltalk.send(self,"_shouldNotImplement",[]);
  11418. return self},
  11419. args: [],
  11420. source: "basicNew\x0a\x09self shouldNotImplement",
  11421. messageSends: ["shouldNotImplement"],
  11422. referencedClasses: []
  11423. }),
  11424. smalltalk.Symbol.klass);
  11425. smalltalk.addMethod(
  11426. "_fromString_",
  11427. smalltalk.method({
  11428. selector: "fromString:",
  11429. category: 'instance creation',
  11430. fn: function (aString){
  11431. var self=this;
  11432. var $1;
  11433. $1=smalltalk.send(self,"_lookup_",[aString]);
  11434. return $1;
  11435. },
  11436. args: ["aString"],
  11437. source: "fromString: aString\x0a\x09^self lookup: aString",
  11438. messageSends: ["lookup:"],
  11439. referencedClasses: []
  11440. }),
  11441. smalltalk.Symbol.klass);
  11442. smalltalk.addMethod(
  11443. "_lookup_",
  11444. smalltalk.method({
  11445. selector: "lookup:",
  11446. category: 'instance creation',
  11447. fn: function (aString){
  11448. var self=this;
  11449. return smalltalk.symbolFor(aString);;
  11450. ;
  11451. return self},
  11452. args: ["aString"],
  11453. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  11454. messageSends: [],
  11455. referencedClasses: []
  11456. }),
  11457. smalltalk.Symbol.klass);
  11458. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  11459. smalltalk.addMethod(
  11460. "__eq",
  11461. smalltalk.method({
  11462. selector: "=",
  11463. category: 'comparing',
  11464. fn: function (aCollection){
  11465. var self=this;
  11466. var $1;
  11467. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  11468. return smalltalk.send(self["@elements"],"__eq",[smalltalk.send(aCollection,"_asArray",[])]);
  11469. })]);
  11470. return $1;
  11471. },
  11472. args: ["aCollection"],
  11473. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  11474. messageSends: ["and:", "=", "asArray", "class"],
  11475. referencedClasses: []
  11476. }),
  11477. smalltalk.Set);
  11478. smalltalk.addMethod(
  11479. "_add_",
  11480. smalltalk.method({
  11481. selector: "add:",
  11482. category: 'adding/removing',
  11483. fn: function (anObject){
  11484. var self=this;
  11485. var found;
  11486. for(var i=0; i < self['@elements'].length; i++) {
  11487. if(anObject == self['@elements'][i]) {
  11488. found = true;
  11489. break;
  11490. }
  11491. }
  11492. if(!found) {self['@elements'].push(anObject)}
  11493. ;
  11494. ;
  11495. return self},
  11496. args: ["anObject"],
  11497. 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>",
  11498. messageSends: [],
  11499. referencedClasses: []
  11500. }),
  11501. smalltalk.Set);
  11502. smalltalk.addMethod(
  11503. "_asArray",
  11504. smalltalk.method({
  11505. selector: "asArray",
  11506. category: 'converting',
  11507. fn: function (){
  11508. var self=this;
  11509. var $1;
  11510. $1=smalltalk.send(self["@elements"],"_copy",[]);
  11511. return $1;
  11512. },
  11513. args: [],
  11514. source: "asArray\x0a\x09^elements copy",
  11515. messageSends: ["copy"],
  11516. referencedClasses: []
  11517. }),
  11518. smalltalk.Set);
  11519. smalltalk.addMethod(
  11520. "_detect_ifNone_",
  11521. smalltalk.method({
  11522. selector: "detect:ifNone:",
  11523. category: 'enumerating',
  11524. fn: function (aBlock,anotherBlock){
  11525. var self=this;
  11526. var $1;
  11527. $1=smalltalk.send(self["@elements"],"_detect_ifNone_",[aBlock,anotherBlock]);
  11528. return $1;
  11529. },
  11530. args: ["aBlock", "anotherBlock"],
  11531. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  11532. messageSends: ["detect:ifNone:"],
  11533. referencedClasses: []
  11534. }),
  11535. smalltalk.Set);
  11536. smalltalk.addMethod(
  11537. "_do_",
  11538. smalltalk.method({
  11539. selector: "do:",
  11540. category: 'enumerating',
  11541. fn: function (aBlock){
  11542. var self=this;
  11543. smalltalk.send(self["@elements"],"_do_",[aBlock]);
  11544. return self},
  11545. args: ["aBlock"],
  11546. source: "do: aBlock\x0a\x09elements do: aBlock",
  11547. messageSends: ["do:"],
  11548. referencedClasses: []
  11549. }),
  11550. smalltalk.Set);
  11551. smalltalk.addMethod(
  11552. "_includes_",
  11553. smalltalk.method({
  11554. selector: "includes:",
  11555. category: 'testing',
  11556. fn: function (anObject){
  11557. var self=this;
  11558. var $1;
  11559. $1=smalltalk.send(self["@elements"],"_includes_",[anObject]);
  11560. return $1;
  11561. },
  11562. args: ["anObject"],
  11563. source: "includes: anObject\x0a\x09^elements includes: anObject",
  11564. messageSends: ["includes:"],
  11565. referencedClasses: []
  11566. }),
  11567. smalltalk.Set);
  11568. smalltalk.addMethod(
  11569. "_initialize",
  11570. smalltalk.method({
  11571. selector: "initialize",
  11572. category: 'initialization',
  11573. fn: function (){
  11574. var self=this;
  11575. smalltalk.send(self,"_initialize",[],smalltalk.Collection);
  11576. self["@elements"]=[];
  11577. return self},
  11578. args: [],
  11579. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  11580. messageSends: ["initialize"],
  11581. referencedClasses: []
  11582. }),
  11583. smalltalk.Set);
  11584. smalltalk.addMethod(
  11585. "_remove_",
  11586. smalltalk.method({
  11587. selector: "remove:",
  11588. category: 'adding/removing',
  11589. fn: function (anObject){
  11590. var self=this;
  11591. smalltalk.send(self["@elements"],"_remove_",[anObject]);
  11592. return self},
  11593. args: ["anObject"],
  11594. source: "remove: anObject\x0a\x09elements remove: anObject",
  11595. messageSends: ["remove:"],
  11596. referencedClasses: []
  11597. }),
  11598. smalltalk.Set);
  11599. smalltalk.addMethod(
  11600. "_select_",
  11601. smalltalk.method({
  11602. selector: "select:",
  11603. category: 'enumerating',
  11604. fn: function (aBlock){
  11605. var self=this;
  11606. var $1;
  11607. var collection;
  11608. collection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  11609. smalltalk.send(self,"_do_",[(function(each){
  11610. $1=smalltalk.send(aBlock,"_value_",[each]);
  11611. if(smalltalk.assert($1)){
  11612. return smalltalk.send(collection,"_add_",[each]);
  11613. };
  11614. })]);
  11615. return collection;
  11616. },
  11617. args: ["aBlock"],
  11618. 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",
  11619. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  11620. referencedClasses: []
  11621. }),
  11622. smalltalk.Set);
  11623. smalltalk.addMethod(
  11624. "_size",
  11625. smalltalk.method({
  11626. selector: "size",
  11627. category: 'accessing',
  11628. fn: function (){
  11629. var self=this;
  11630. var $1;
  11631. $1=smalltalk.send(self["@elements"],"_size",[]);
  11632. return $1;
  11633. },
  11634. args: [],
  11635. source: "size\x0a\x09^elements size",
  11636. messageSends: ["size"],
  11637. referencedClasses: []
  11638. }),
  11639. smalltalk.Set);
  11640. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  11641. smalltalk.addMethod(
  11642. "_back_",
  11643. smalltalk.method({
  11644. selector: "back:",
  11645. category: 'accessing',
  11646. fn: function (anObject){
  11647. var self=this;
  11648. smalltalk.send(self["@write"],"_add_",[anObject]);
  11649. return self},
  11650. args: ["anObject"],
  11651. source: "back: anObject\x0a\x09write add: anObject\x0a",
  11652. messageSends: ["add:"],
  11653. referencedClasses: []
  11654. }),
  11655. smalltalk.Queue);
  11656. smalltalk.addMethod(
  11657. "_front",
  11658. smalltalk.method({
  11659. selector: "front",
  11660. category: 'accessing',
  11661. fn: function (){
  11662. var self=this;
  11663. var $1;
  11664. $1=smalltalk.send(self,"_frontIfAbsent_",[(function(){
  11665. return smalltalk.send(self,"_error_",["Cannot read from empty Queue."]);
  11666. })]);
  11667. return $1;
  11668. },
  11669. args: [],
  11670. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.']\x0a",
  11671. messageSends: ["frontIfAbsent:", "error:"],
  11672. referencedClasses: []
  11673. }),
  11674. smalltalk.Queue);
  11675. smalltalk.addMethod(
  11676. "_frontIfAbsent_",
  11677. smalltalk.method({
  11678. selector: "frontIfAbsent:",
  11679. category: 'accessing',
  11680. fn: function (aBlock){
  11681. var self=this;
  11682. var $1,$2,$3;
  11683. var $early={};
  11684. try {
  11685. var result;
  11686. result=smalltalk.send(self["@read"],"_at_ifAbsent_",[self["@readIndex"],(function(){
  11687. $1=smalltalk.send(self["@write"],"_isEmpty",[]);
  11688. if(smalltalk.assert($1)){
  11689. $2=smalltalk.send(self["@readIndex"],"__gt",[(1)]);
  11690. if(smalltalk.assert($2)){
  11691. self["@read"]=[];
  11692. self["@read"];
  11693. self["@readIndex"]=(1);
  11694. self["@readIndex"];
  11695. };
  11696. $3=smalltalk.send(aBlock,"_value",[]);
  11697. throw $early=[$3];
  11698. };
  11699. self["@read"]=self["@write"];
  11700. self["@read"];
  11701. self["@readIndex"]=(1);
  11702. self["@readIndex"];
  11703. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11704. self["@write"];
  11705. return smalltalk.send(self["@read"],"_first",[]);
  11706. })]);
  11707. smalltalk.send(self["@read"],"_at_put_",[self["@readIndex"],nil]);
  11708. self["@readIndex"]=smalltalk.send(self["@readIndex"],"__plus",[(1)]);
  11709. return result;
  11710. }
  11711. catch(e) {if(e===$early)return e[0]; throw e}
  11712. },
  11713. args: ["aBlock"],
  11714. 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",
  11715. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  11716. referencedClasses: ["OrderedCollection"]
  11717. }),
  11718. smalltalk.Queue);
  11719. smalltalk.addMethod(
  11720. "_initialize",
  11721. smalltalk.method({
  11722. selector: "initialize",
  11723. category: 'initialization',
  11724. fn: function (){
  11725. var self=this;
  11726. self["@read"]=[];
  11727. self["@readIndex"]=(1);
  11728. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  11729. return self},
  11730. args: [],
  11731. source: "initialize\x0a\x09read := #().\x0a readIndex := 1.\x0a write := OrderedCollection new",
  11732. messageSends: ["new"],
  11733. referencedClasses: ["OrderedCollection"]
  11734. }),
  11735. smalltalk.Queue);
  11736. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  11737. smalltalk.addMethod(
  11738. "_compile_",
  11739. smalltalk.method({
  11740. selector: "compile:",
  11741. category: 'evaluating',
  11742. fn: function (aString){
  11743. var self=this;
  11744. return self.compile(aString);
  11745. ;
  11746. return self},
  11747. args: ["aString"],
  11748. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  11749. messageSends: [],
  11750. referencedClasses: []
  11751. }),
  11752. smalltalk.RegularExpression);
  11753. smalltalk.addMethod(
  11754. "_exec_",
  11755. smalltalk.method({
  11756. selector: "exec:",
  11757. category: 'evaluating',
  11758. fn: function (aString){
  11759. var self=this;
  11760. return self.exec(aString) || nil;
  11761. ;
  11762. return self},
  11763. args: ["aString"],
  11764. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  11765. messageSends: [],
  11766. referencedClasses: []
  11767. }),
  11768. smalltalk.RegularExpression);
  11769. smalltalk.addMethod(
  11770. "_test_",
  11771. smalltalk.method({
  11772. selector: "test:",
  11773. category: 'evaluating',
  11774. fn: function (aString){
  11775. var self=this;
  11776. return self.test(aString);
  11777. ;
  11778. return self},
  11779. args: ["aString"],
  11780. source: "test: aString\x0a\x09<return self.test(aString)>",
  11781. messageSends: [],
  11782. referencedClasses: []
  11783. }),
  11784. smalltalk.RegularExpression);
  11785. smalltalk.addMethod(
  11786. "_fromString_",
  11787. smalltalk.method({
  11788. selector: "fromString:",
  11789. category: 'instance creation',
  11790. fn: function (aString){
  11791. var self=this;
  11792. var $1;
  11793. $1=smalltalk.send(self,"_fromString_flag_",[aString,""]);
  11794. return $1;
  11795. },
  11796. args: ["aString"],
  11797. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  11798. messageSends: ["fromString:flag:"],
  11799. referencedClasses: []
  11800. }),
  11801. smalltalk.RegularExpression.klass);
  11802. smalltalk.addMethod(
  11803. "_fromString_flag_",
  11804. smalltalk.method({
  11805. selector: "fromString:flag:",
  11806. category: 'instance creation',
  11807. fn: function (aString,anotherString){
  11808. var self=this;
  11809. return new RegExp(aString, anotherString);
  11810. ;
  11811. return self},
  11812. args: ["aString", "anotherString"],
  11813. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  11814. messageSends: [],
  11815. referencedClasses: []
  11816. }),
  11817. smalltalk.RegularExpression.klass);
  11818. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  11819. smalltalk.addMethod(
  11820. "_atEnd",
  11821. smalltalk.method({
  11822. selector: "atEnd",
  11823. category: 'testing',
  11824. fn: function (){
  11825. var self=this;
  11826. var $1;
  11827. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[smalltalk.send(self,"_size",[])]);
  11828. return $1;
  11829. },
  11830. args: [],
  11831. source: "atEnd\x0a\x09^self position = self size",
  11832. messageSends: ["=", "size", "position"],
  11833. referencedClasses: []
  11834. }),
  11835. smalltalk.Stream);
  11836. smalltalk.addMethod(
  11837. "_atStart",
  11838. smalltalk.method({
  11839. selector: "atStart",
  11840. category: 'testing',
  11841. fn: function (){
  11842. var self=this;
  11843. var $1;
  11844. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[(0)]);
  11845. return $1;
  11846. },
  11847. args: [],
  11848. source: "atStart\x0a\x09^self position = 0",
  11849. messageSends: ["=", "position"],
  11850. referencedClasses: []
  11851. }),
  11852. smalltalk.Stream);
  11853. smalltalk.addMethod(
  11854. "_close",
  11855. smalltalk.method({
  11856. selector: "close",
  11857. category: 'actions',
  11858. fn: function (){
  11859. var self=this;
  11860. return self},
  11861. args: [],
  11862. source: "close",
  11863. messageSends: [],
  11864. referencedClasses: []
  11865. }),
  11866. smalltalk.Stream);
  11867. smalltalk.addMethod(
  11868. "_collection",
  11869. smalltalk.method({
  11870. selector: "collection",
  11871. category: 'accessing',
  11872. fn: function (){
  11873. var self=this;
  11874. return self["@collection"];
  11875. },
  11876. args: [],
  11877. source: "collection\x0a\x09^collection",
  11878. messageSends: [],
  11879. referencedClasses: []
  11880. }),
  11881. smalltalk.Stream);
  11882. smalltalk.addMethod(
  11883. "_contents",
  11884. smalltalk.method({
  11885. selector: "contents",
  11886. category: 'accessing',
  11887. fn: function (){
  11888. var self=this;
  11889. var $1;
  11890. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_streamSize",[])]);
  11891. return $1;
  11892. },
  11893. args: [],
  11894. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  11895. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  11896. referencedClasses: []
  11897. }),
  11898. smalltalk.Stream);
  11899. smalltalk.addMethod(
  11900. "_do_",
  11901. smalltalk.method({
  11902. selector: "do:",
  11903. category: 'enumerating',
  11904. fn: function (aBlock){
  11905. var self=this;
  11906. smalltalk.send((function(){
  11907. return smalltalk.send(self,"_atEnd",[]);
  11908. }),"_whileFalse_",[(function(){
  11909. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_next",[])]);
  11910. })]);
  11911. return self},
  11912. args: ["aBlock"],
  11913. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  11914. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  11915. referencedClasses: []
  11916. }),
  11917. smalltalk.Stream);
  11918. smalltalk.addMethod(
  11919. "_flush",
  11920. smalltalk.method({
  11921. selector: "flush",
  11922. category: 'actions',
  11923. fn: function (){
  11924. var self=this;
  11925. return self},
  11926. args: [],
  11927. source: "flush",
  11928. messageSends: [],
  11929. referencedClasses: []
  11930. }),
  11931. smalltalk.Stream);
  11932. smalltalk.addMethod(
  11933. "_isEmpty",
  11934. smalltalk.method({
  11935. selector: "isEmpty",
  11936. category: 'testing',
  11937. fn: function (){
  11938. var self=this;
  11939. var $1;
  11940. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  11941. return $1;
  11942. },
  11943. args: [],
  11944. source: "isEmpty\x0a\x09^self size = 0",
  11945. messageSends: ["=", "size"],
  11946. referencedClasses: []
  11947. }),
  11948. smalltalk.Stream);
  11949. smalltalk.addMethod(
  11950. "_next",
  11951. smalltalk.method({
  11952. selector: "next",
  11953. category: 'reading',
  11954. fn: function (){
  11955. var self=this;
  11956. var $2,$1;
  11957. $2=smalltalk.send(self,"_atEnd",[]);
  11958. if(smalltalk.assert($2)){
  11959. $1=nil;
  11960. } else {
  11961. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  11962. $1=smalltalk.send(self["@collection"],"_at_",[smalltalk.send(self,"_position",[])]);
  11963. };
  11964. return $1;
  11965. },
  11966. args: [],
  11967. 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]",
  11968. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  11969. referencedClasses: []
  11970. }),
  11971. smalltalk.Stream);
  11972. smalltalk.addMethod(
  11973. "_next_",
  11974. smalltalk.method({
  11975. selector: "next:",
  11976. category: 'reading',
  11977. fn: function (anInteger){
  11978. var self=this;
  11979. var $1;
  11980. var tempCollection;
  11981. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  11982. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  11983. $1=smalltalk.send(self,"_atEnd",[]);
  11984. if(! smalltalk.assert($1)){
  11985. return smalltalk.send(tempCollection,"_add_",[smalltalk.send(self,"_next",[])]);
  11986. };
  11987. })]);
  11988. return tempCollection;
  11989. },
  11990. args: ["anInteger"],
  11991. 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",
  11992. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  11993. referencedClasses: []
  11994. }),
  11995. smalltalk.Stream);
  11996. smalltalk.addMethod(
  11997. "_nextPut_",
  11998. smalltalk.method({
  11999. selector: "nextPut:",
  12000. category: 'writing',
  12001. fn: function (anObject){
  12002. var self=this;
  12003. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12004. smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_put_",[smalltalk.send(self,"_position",[]),anObject]);
  12005. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12006. return self},
  12007. args: ["anObject"],
  12008. 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)",
  12009. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  12010. referencedClasses: []
  12011. }),
  12012. smalltalk.Stream);
  12013. smalltalk.addMethod(
  12014. "_nextPutAll_",
  12015. smalltalk.method({
  12016. selector: "nextPutAll:",
  12017. category: 'writing',
  12018. fn: function (aCollection){
  12019. var self=this;
  12020. smalltalk.send(aCollection,"_do_",[(function(each){
  12021. return smalltalk.send(self,"_nextPut_",[each]);
  12022. })]);
  12023. return self},
  12024. args: ["aCollection"],
  12025. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  12026. messageSends: ["do:", "nextPut:"],
  12027. referencedClasses: []
  12028. }),
  12029. smalltalk.Stream);
  12030. smalltalk.addMethod(
  12031. "_peek",
  12032. smalltalk.method({
  12033. selector: "peek",
  12034. category: 'reading',
  12035. fn: function (){
  12036. var self=this;
  12037. var $2,$1;
  12038. $2=smalltalk.send(self,"_atEnd",[]);
  12039. if(! smalltalk.assert($2)){
  12040. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  12041. };
  12042. return $1;
  12043. },
  12044. args: [],
  12045. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  12046. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  12047. referencedClasses: []
  12048. }),
  12049. smalltalk.Stream);
  12050. smalltalk.addMethod(
  12051. "_position",
  12052. smalltalk.method({
  12053. selector: "position",
  12054. category: 'accessing',
  12055. fn: function (){
  12056. var self=this;
  12057. var $1;
  12058. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  12059. self["@position"]=(0);
  12060. $1=self["@position"];
  12061. } else {
  12062. $1=self["@position"];
  12063. };
  12064. return $1;
  12065. },
  12066. args: [],
  12067. source: "position\x0a\x09^position ifNil: [position := 0]",
  12068. messageSends: ["ifNil:"],
  12069. referencedClasses: []
  12070. }),
  12071. smalltalk.Stream);
  12072. smalltalk.addMethod(
  12073. "_position_",
  12074. smalltalk.method({
  12075. selector: "position:",
  12076. category: 'accessing',
  12077. fn: function (anInteger){
  12078. var self=this;
  12079. self["@position"]=anInteger;
  12080. return self},
  12081. args: ["anInteger"],
  12082. source: "position: anInteger\x0a\x09position := anInteger",
  12083. messageSends: [],
  12084. referencedClasses: []
  12085. }),
  12086. smalltalk.Stream);
  12087. smalltalk.addMethod(
  12088. "_reset",
  12089. smalltalk.method({
  12090. selector: "reset",
  12091. category: 'actions',
  12092. fn: function (){
  12093. var self=this;
  12094. smalltalk.send(self,"_position_",[(0)]);
  12095. return self},
  12096. args: [],
  12097. source: "reset\x0a\x09self position: 0",
  12098. messageSends: ["position:"],
  12099. referencedClasses: []
  12100. }),
  12101. smalltalk.Stream);
  12102. smalltalk.addMethod(
  12103. "_resetContents",
  12104. smalltalk.method({
  12105. selector: "resetContents",
  12106. category: 'actions',
  12107. fn: function (){
  12108. var self=this;
  12109. smalltalk.send(self,"_reset",[]);
  12110. smalltalk.send(self,"_setStreamSize_",[(0)]);
  12111. return self},
  12112. args: [],
  12113. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12114. messageSends: ["reset", "setStreamSize:"],
  12115. referencedClasses: []
  12116. }),
  12117. smalltalk.Stream);
  12118. smalltalk.addMethod(
  12119. "_setCollection_",
  12120. smalltalk.method({
  12121. selector: "setCollection:",
  12122. category: 'accessing',
  12123. fn: function (aCollection){
  12124. var self=this;
  12125. self["@collection"]=aCollection;
  12126. return self},
  12127. args: ["aCollection"],
  12128. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12129. messageSends: [],
  12130. referencedClasses: []
  12131. }),
  12132. smalltalk.Stream);
  12133. smalltalk.addMethod(
  12134. "_setStreamSize_",
  12135. smalltalk.method({
  12136. selector: "setStreamSize:",
  12137. category: 'accessing',
  12138. fn: function (anInteger){
  12139. var self=this;
  12140. self["@streamSize"]=anInteger;
  12141. return self},
  12142. args: ["anInteger"],
  12143. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12144. messageSends: [],
  12145. referencedClasses: []
  12146. }),
  12147. smalltalk.Stream);
  12148. smalltalk.addMethod(
  12149. "_setToEnd",
  12150. smalltalk.method({
  12151. selector: "setToEnd",
  12152. category: 'positioning',
  12153. fn: function (){
  12154. var self=this;
  12155. smalltalk.send(self,"_position_",[smalltalk.send(self,"_size",[])]);
  12156. return self},
  12157. args: [],
  12158. source: "setToEnd\x0a\x09self position: self size",
  12159. messageSends: ["position:", "size"],
  12160. referencedClasses: []
  12161. }),
  12162. smalltalk.Stream);
  12163. smalltalk.addMethod(
  12164. "_size",
  12165. smalltalk.method({
  12166. selector: "size",
  12167. category: 'accessing',
  12168. fn: function (){
  12169. var self=this;
  12170. var $1;
  12171. $1=smalltalk.send(self,"_streamSize",[]);
  12172. return $1;
  12173. },
  12174. args: [],
  12175. source: "size\x0a\x09^self streamSize",
  12176. messageSends: ["streamSize"],
  12177. referencedClasses: []
  12178. }),
  12179. smalltalk.Stream);
  12180. smalltalk.addMethod(
  12181. "_skip_",
  12182. smalltalk.method({
  12183. selector: "skip:",
  12184. category: 'positioning',
  12185. fn: function (anInteger){
  12186. var self=this;
  12187. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[anInteger]),"_min_max_",[smalltalk.send(self,"_size",[]),(0)])]);
  12188. return self},
  12189. args: ["anInteger"],
  12190. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  12191. messageSends: ["position:", "min:max:", "size", "+", "position"],
  12192. referencedClasses: []
  12193. }),
  12194. smalltalk.Stream);
  12195. smalltalk.addMethod(
  12196. "_streamSize",
  12197. smalltalk.method({
  12198. selector: "streamSize",
  12199. category: 'accessing',
  12200. fn: function (){
  12201. var self=this;
  12202. return self["@streamSize"];
  12203. },
  12204. args: [],
  12205. source: "streamSize\x0a\x09^streamSize",
  12206. messageSends: [],
  12207. referencedClasses: []
  12208. }),
  12209. smalltalk.Stream);
  12210. smalltalk.addMethod(
  12211. "_on_",
  12212. smalltalk.method({
  12213. selector: "on:",
  12214. category: 'instance creation',
  12215. fn: function (aCollection){
  12216. var self=this;
  12217. var $2,$3,$1;
  12218. $2=smalltalk.send(self,"_new",[]);
  12219. smalltalk.send($2,"_setCollection_",[aCollection]);
  12220. smalltalk.send($2,"_setStreamSize_",[smalltalk.send(aCollection,"_size",[])]);
  12221. $3=smalltalk.send($2,"_yourself",[]);
  12222. $1=$3;
  12223. return $1;
  12224. },
  12225. args: ["aCollection"],
  12226. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12227. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  12228. referencedClasses: []
  12229. }),
  12230. smalltalk.Stream.klass);
  12231. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  12232. smalltalk.addMethod(
  12233. "_cr",
  12234. smalltalk.method({
  12235. selector: "cr",
  12236. category: 'writing',
  12237. fn: function (){
  12238. var self=this;
  12239. var $1;
  12240. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  12241. return $1;
  12242. },
  12243. args: [],
  12244. source: "cr\x0a\x09^self nextPutAll: String cr",
  12245. messageSends: ["nextPutAll:", "cr"],
  12246. referencedClasses: ["String"]
  12247. }),
  12248. smalltalk.StringStream);
  12249. smalltalk.addMethod(
  12250. "_crlf",
  12251. smalltalk.method({
  12252. selector: "crlf",
  12253. category: 'writing',
  12254. fn: function (){
  12255. var self=this;
  12256. var $1;
  12257. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_crlf",[])]);
  12258. return $1;
  12259. },
  12260. args: [],
  12261. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  12262. messageSends: ["nextPutAll:", "crlf"],
  12263. referencedClasses: ["String"]
  12264. }),
  12265. smalltalk.StringStream);
  12266. smalltalk.addMethod(
  12267. "_lf",
  12268. smalltalk.method({
  12269. selector: "lf",
  12270. category: 'writing',
  12271. fn: function (){
  12272. var self=this;
  12273. var $1;
  12274. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_lf",[])]);
  12275. return $1;
  12276. },
  12277. args: [],
  12278. source: "lf\x0a\x09^self nextPutAll: String lf",
  12279. messageSends: ["nextPutAll:", "lf"],
  12280. referencedClasses: ["String"]
  12281. }),
  12282. smalltalk.StringStream);
  12283. smalltalk.addMethod(
  12284. "_next_",
  12285. smalltalk.method({
  12286. selector: "next:",
  12287. category: 'reading',
  12288. fn: function (anInteger){
  12289. var self=this;
  12290. var $1;
  12291. var tempCollection;
  12292. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  12293. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  12294. $1=smalltalk.send(self,"_atEnd",[]);
  12295. if(! smalltalk.assert($1)){
  12296. tempCollection=smalltalk.send(tempCollection,"__comma",[smalltalk.send(self,"_next",[])]);
  12297. return tempCollection;
  12298. };
  12299. })]);
  12300. return tempCollection;
  12301. },
  12302. args: ["anInteger"],
  12303. 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",
  12304. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  12305. referencedClasses: []
  12306. }),
  12307. smalltalk.StringStream);
  12308. smalltalk.addMethod(
  12309. "_nextPut_",
  12310. smalltalk.method({
  12311. selector: "nextPut:",
  12312. category: 'writing',
  12313. fn: function (aString){
  12314. var self=this;
  12315. smalltalk.send(self,"_nextPutAll_",[aString]);
  12316. return self},
  12317. args: ["aString"],
  12318. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  12319. messageSends: ["nextPutAll:"],
  12320. referencedClasses: []
  12321. }),
  12322. smalltalk.StringStream);
  12323. smalltalk.addMethod(
  12324. "_nextPutAll_",
  12325. smalltalk.method({
  12326. selector: "nextPutAll:",
  12327. category: 'writing',
  12328. fn: function (aString){
  12329. var self=this;
  12330. 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",[])])])]);
  12331. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[smalltalk.send(aString,"_size",[])])]);
  12332. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  12333. return self},
  12334. args: ["aString"],
  12335. 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)",
  12336. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  12337. referencedClasses: []
  12338. }),
  12339. smalltalk.StringStream);
  12340. smalltalk.addMethod(
  12341. "_space",
  12342. smalltalk.method({
  12343. selector: "space",
  12344. category: 'writing',
  12345. fn: function (){
  12346. var self=this;
  12347. smalltalk.send(self,"_nextPut_",[" "]);
  12348. return self},
  12349. args: [],
  12350. source: "space\x0a\x09self nextPut: ' '",
  12351. messageSends: ["nextPut:"],
  12352. referencedClasses: []
  12353. }),
  12354. smalltalk.StringStream);
  12355. smalltalk.addPackage('Kernel-Exceptions', {});
  12356. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  12357. smalltalk.addMethod(
  12358. "_context",
  12359. smalltalk.method({
  12360. selector: "context",
  12361. category: 'accessing',
  12362. fn: function (){
  12363. var self=this;
  12364. return self.context;
  12365. ;
  12366. return self},
  12367. args: [],
  12368. source: "context\x0a\x09<return self.context>",
  12369. messageSends: [],
  12370. referencedClasses: []
  12371. }),
  12372. smalltalk.Error);
  12373. smalltalk.addMethod(
  12374. "_isSmalltalkError",
  12375. smalltalk.method({
  12376. selector: "isSmalltalkError",
  12377. category: 'testing',
  12378. fn: function (){
  12379. var self=this;
  12380. return self.smalltalkError === true;
  12381. ;
  12382. return self},
  12383. args: [],
  12384. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  12385. messageSends: [],
  12386. referencedClasses: []
  12387. }),
  12388. smalltalk.Error);
  12389. smalltalk.addMethod(
  12390. "_jsStack",
  12391. smalltalk.method({
  12392. selector: "jsStack",
  12393. category: 'accessing',
  12394. fn: function (){
  12395. var self=this;
  12396. return self.stack;
  12397. ;
  12398. return self},
  12399. args: [],
  12400. source: "jsStack\x0a\x09<return self.stack>",
  12401. messageSends: [],
  12402. referencedClasses: []
  12403. }),
  12404. smalltalk.Error);
  12405. smalltalk.addMethod(
  12406. "_messageText",
  12407. smalltalk.method({
  12408. selector: "messageText",
  12409. category: 'accessing',
  12410. fn: function (){
  12411. var self=this;
  12412. return self["@messageText"];
  12413. },
  12414. args: [],
  12415. source: "messageText\x0a\x09^messageText",
  12416. messageSends: [],
  12417. referencedClasses: []
  12418. }),
  12419. smalltalk.Error);
  12420. smalltalk.addMethod(
  12421. "_messageText_",
  12422. smalltalk.method({
  12423. selector: "messageText:",
  12424. category: 'accessing',
  12425. fn: function (aString){
  12426. var self=this;
  12427. self["@messageText"]=aString;
  12428. return self},
  12429. args: ["aString"],
  12430. source: "messageText: aString\x0a\x09messageText := aString",
  12431. messageSends: [],
  12432. referencedClasses: []
  12433. }),
  12434. smalltalk.Error);
  12435. smalltalk.addMethod(
  12436. "_signal",
  12437. smalltalk.method({
  12438. selector: "signal",
  12439. category: 'signaling',
  12440. fn: function (){
  12441. var self=this;
  12442. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  12443. ;
  12444. return self},
  12445. args: [],
  12446. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  12447. messageSends: [],
  12448. referencedClasses: []
  12449. }),
  12450. smalltalk.Error);
  12451. smalltalk.addMethod(
  12452. "_signal_",
  12453. smalltalk.method({
  12454. selector: "signal:",
  12455. category: 'signaling',
  12456. fn: function (aString){
  12457. var self=this;
  12458. smalltalk.send(self,"_messageText_",[aString]);
  12459. smalltalk.send(self,"_signal",[]);
  12460. return self},
  12461. args: ["aString"],
  12462. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  12463. messageSends: ["messageText:", "signal"],
  12464. referencedClasses: []
  12465. }),
  12466. smalltalk.Error);
  12467. smalltalk.addMethod(
  12468. "_signal",
  12469. smalltalk.method({
  12470. selector: "signal",
  12471. category: 'instance creation',
  12472. fn: function (){
  12473. var self=this;
  12474. var $1;
  12475. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
  12476. return $1;
  12477. },
  12478. args: [],
  12479. source: "signal\x0a\x09^self new signal",
  12480. messageSends: ["signal", "new"],
  12481. referencedClasses: []
  12482. }),
  12483. smalltalk.Error.klass);
  12484. smalltalk.addMethod(
  12485. "_signal_",
  12486. smalltalk.method({
  12487. selector: "signal:",
  12488. category: 'instance creation',
  12489. fn: function (aString){
  12490. var self=this;
  12491. var $1;
  12492. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
  12493. return $1;
  12494. },
  12495. args: ["aString"],
  12496. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  12497. messageSends: ["signal:", "new"],
  12498. referencedClasses: []
  12499. }),
  12500. smalltalk.Error.klass);
  12501. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  12502. smalltalk.addMethod(
  12503. "_message",
  12504. smalltalk.method({
  12505. selector: "message",
  12506. category: 'accessing',
  12507. fn: function (){
  12508. var self=this;
  12509. return self["@message"];
  12510. },
  12511. args: [],
  12512. source: "message\x0a\x09^message",
  12513. messageSends: [],
  12514. referencedClasses: []
  12515. }),
  12516. smalltalk.MessageNotUnderstood);
  12517. smalltalk.addMethod(
  12518. "_message_",
  12519. smalltalk.method({
  12520. selector: "message:",
  12521. category: 'accessing',
  12522. fn: function (aMessage){
  12523. var self=this;
  12524. self["@message"]=aMessage;
  12525. return self},
  12526. args: ["aMessage"],
  12527. source: "message: aMessage\x0a\x09message := aMessage",
  12528. messageSends: [],
  12529. referencedClasses: []
  12530. }),
  12531. smalltalk.MessageNotUnderstood);
  12532. smalltalk.addMethod(
  12533. "_messageText",
  12534. smalltalk.method({
  12535. selector: "messageText",
  12536. category: 'accessing',
  12537. fn: function (){
  12538. var self=this;
  12539. var $1;
  12540. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
  12541. return $1;
  12542. },
  12543. args: [],
  12544. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  12545. messageSends: [",", "selector", "message", "asString", "receiver"],
  12546. referencedClasses: []
  12547. }),
  12548. smalltalk.MessageNotUnderstood);
  12549. smalltalk.addMethod(
  12550. "_receiver",
  12551. smalltalk.method({
  12552. selector: "receiver",
  12553. category: 'accessing',
  12554. fn: function (){
  12555. var self=this;
  12556. return self["@receiver"];
  12557. },
  12558. args: [],
  12559. source: "receiver\x0a\x09^receiver",
  12560. messageSends: [],
  12561. referencedClasses: []
  12562. }),
  12563. smalltalk.MessageNotUnderstood);
  12564. smalltalk.addMethod(
  12565. "_receiver_",
  12566. smalltalk.method({
  12567. selector: "receiver:",
  12568. category: 'accessing',
  12569. fn: function (anObject){
  12570. var self=this;
  12571. self["@receiver"]=anObject;
  12572. return self},
  12573. args: ["anObject"],
  12574. source: "receiver: anObject\x0a\x09receiver := anObject",
  12575. messageSends: [],
  12576. referencedClasses: []
  12577. }),
  12578. smalltalk.MessageNotUnderstood);
  12579. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  12580. smalltalk.addMethod(
  12581. "_object",
  12582. smalltalk.method({
  12583. selector: "object",
  12584. category: 'accessing',
  12585. fn: function (){
  12586. var self=this;
  12587. return self["@object"];
  12588. },
  12589. args: [],
  12590. source: "object\x0a\x09^ object",
  12591. messageSends: [],
  12592. referencedClasses: []
  12593. }),
  12594. smalltalk.NonBooleanReceiver);
  12595. smalltalk.addMethod(
  12596. "_object_",
  12597. smalltalk.method({
  12598. selector: "object:",
  12599. category: 'accessing',
  12600. fn: function (anObject){
  12601. var self=this;
  12602. self["@object"]=anObject;
  12603. return self},
  12604. args: ["anObject"],
  12605. source: "object: anObject\x0a\x09object := anObject",
  12606. messageSends: [],
  12607. referencedClasses: []
  12608. }),
  12609. smalltalk.NonBooleanReceiver);
  12610. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  12611. smalltalk.addMethod(
  12612. "_handleError_",
  12613. smalltalk.method({
  12614. selector: "handleError:",
  12615. category: 'error handling',
  12616. fn: function (anError){
  12617. var self=this;
  12618. var $1;
  12619. $1=smalltalk.send(anError,"_context",[]);
  12620. if(($receiver = $1) == nil || $receiver == undefined){
  12621. $1;
  12622. } else {
  12623. smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
  12624. };
  12625. smalltalk.send(self,"_logError_",[anError]);
  12626. return self},
  12627. args: ["anError"],
  12628. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  12629. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  12630. referencedClasses: []
  12631. }),
  12632. smalltalk.ErrorHandler);
  12633. smalltalk.addMethod(
  12634. "_log_",
  12635. smalltalk.method({
  12636. selector: "log:",
  12637. category: 'private',
  12638. fn: function (aString){
  12639. var self=this;
  12640. smalltalk.send(console,"_log_",[aString]);
  12641. return self},
  12642. args: ["aString"],
  12643. source: "log: aString\x0a\x09console log: aString",
  12644. messageSends: ["log:"],
  12645. referencedClasses: []
  12646. }),
  12647. smalltalk.ErrorHandler);
  12648. smalltalk.addMethod(
  12649. "_logContext_",
  12650. smalltalk.method({
  12651. selector: "logContext:",
  12652. category: 'private',
  12653. fn: function (aContext){
  12654. var self=this;
  12655. var $1;
  12656. $1=smalltalk.send(aContext,"_home",[]);
  12657. if(($receiver = $1) == nil || $receiver == undefined){
  12658. $1;
  12659. } else {
  12660. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12661. };
  12662. smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
  12663. return self},
  12664. args: ["aContext"],
  12665. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
  12666. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "selector", "asString", "receiver"],
  12667. referencedClasses: []
  12668. }),
  12669. smalltalk.ErrorHandler);
  12670. smalltalk.addMethod(
  12671. "_logError_",
  12672. smalltalk.method({
  12673. selector: "logError:",
  12674. category: 'private',
  12675. fn: function (anError){
  12676. var self=this;
  12677. smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
  12678. return self},
  12679. args: ["anError"],
  12680. source: "logError: anError\x0a\x09self log: anError messageText",
  12681. messageSends: ["log:", "messageText"],
  12682. referencedClasses: []
  12683. }),
  12684. smalltalk.ErrorHandler);
  12685. smalltalk.addMethod(
  12686. "_logErrorContext_",
  12687. smalltalk.method({
  12688. selector: "logErrorContext:",
  12689. category: 'private',
  12690. fn: function (aContext){
  12691. var self=this;
  12692. var $1;
  12693. if(($receiver = aContext) == nil || $receiver == undefined){
  12694. aContext;
  12695. } else {
  12696. $1=smalltalk.send(aContext,"_home",[]);
  12697. if(($receiver = $1) == nil || $receiver == undefined){
  12698. $1;
  12699. } else {
  12700. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  12701. };
  12702. };
  12703. return self},
  12704. args: ["aContext"],
  12705. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  12706. messageSends: ["ifNotNil:", "logContext:", "home"],
  12707. referencedClasses: []
  12708. }),
  12709. smalltalk.ErrorHandler);
  12710. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  12711. smalltalk.addMethod(
  12712. "_current",
  12713. smalltalk.method({
  12714. selector: "current",
  12715. category: 'accessing',
  12716. fn: function (){
  12717. var self=this;
  12718. var $1;
  12719. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  12720. self["@current"]=smalltalk.send(self,"_new",[]);
  12721. $1=self["@current"];
  12722. } else {
  12723. $1=self["@current"];
  12724. };
  12725. return $1;
  12726. },
  12727. args: [],
  12728. source: "current\x0a\x09^current ifNil: [current := self new]",
  12729. messageSends: ["ifNil:", "new"],
  12730. referencedClasses: []
  12731. }),
  12732. smalltalk.ErrorHandler.klass);
  12733. smalltalk.addMethod(
  12734. "_initialize",
  12735. smalltalk.method({
  12736. selector: "initialize",
  12737. category: 'initialization',
  12738. fn: function (){
  12739. var self=this;
  12740. smalltalk.send(self,"_register",[]);
  12741. return self},
  12742. args: [],
  12743. source: "initialize\x0a\x09self register",
  12744. messageSends: ["register"],
  12745. referencedClasses: []
  12746. }),
  12747. smalltalk.ErrorHandler.klass);
  12748. smalltalk.addMethod(
  12749. "_register",
  12750. smalltalk.method({
  12751. selector: "register",
  12752. category: 'initialization',
  12753. fn: function (){
  12754. var self=this;
  12755. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
  12756. return self},
  12757. args: [],
  12758. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  12759. messageSends: ["setCurrent:", "new"],
  12760. referencedClasses: ["ErrorHandler"]
  12761. }),
  12762. smalltalk.ErrorHandler.klass);
  12763. smalltalk.addMethod(
  12764. "_setCurrent_",
  12765. smalltalk.method({
  12766. selector: "setCurrent:",
  12767. category: 'accessing',
  12768. fn: function (anHandler){
  12769. var self=this;
  12770. self["@current"]=anHandler;
  12771. return self},
  12772. args: ["anHandler"],
  12773. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  12774. messageSends: [],
  12775. referencedClasses: []
  12776. }),
  12777. smalltalk.ErrorHandler.klass);
  12778. smalltalk.addPackage('Kernel-Transcript', {});
  12779. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  12780. smalltalk.addMethod(
  12781. "_clear",
  12782. smalltalk.method({
  12783. selector: "clear",
  12784. category: 'printing',
  12785. fn: function (){
  12786. var self=this;
  12787. return self},
  12788. args: [],
  12789. source: "clear\x0a\x09\x22no op\x22",
  12790. messageSends: [],
  12791. referencedClasses: []
  12792. }),
  12793. smalltalk.ConsoleTranscript);
  12794. smalltalk.addMethod(
  12795. "_cr",
  12796. smalltalk.method({
  12797. selector: "cr",
  12798. category: 'printing',
  12799. fn: function (){
  12800. var self=this;
  12801. return self},
  12802. args: [],
  12803. source: "cr\x0a\x09\x22no op\x22",
  12804. messageSends: [],
  12805. referencedClasses: []
  12806. }),
  12807. smalltalk.ConsoleTranscript);
  12808. smalltalk.addMethod(
  12809. "_open",
  12810. smalltalk.method({
  12811. selector: "open",
  12812. category: 'actions',
  12813. fn: function (){
  12814. var self=this;
  12815. return self},
  12816. args: [],
  12817. source: "open",
  12818. messageSends: [],
  12819. referencedClasses: []
  12820. }),
  12821. smalltalk.ConsoleTranscript);
  12822. smalltalk.addMethod(
  12823. "_show_",
  12824. smalltalk.method({
  12825. selector: "show:",
  12826. category: 'printing',
  12827. fn: function (anObject){
  12828. var self=this;
  12829. var string;
  12830. string=smalltalk.send(anObject,"_asString",[]);
  12831. console.log(String(string));
  12832. ;
  12833. return self},
  12834. args: ["anObject"],
  12835. source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
  12836. messageSends: ["asString"],
  12837. referencedClasses: []
  12838. }),
  12839. smalltalk.ConsoleTranscript);
  12840. smalltalk.addMethod(
  12841. "_initialize",
  12842. smalltalk.method({
  12843. selector: "initialize",
  12844. category: 'initialization',
  12845. fn: function (){
  12846. var self=this;
  12847. smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
  12848. return self},
  12849. args: [],
  12850. source: "initialize\x0a\x09Transcript register: self new",
  12851. messageSends: ["register:", "new"],
  12852. referencedClasses: ["Transcript"]
  12853. }),
  12854. smalltalk.ConsoleTranscript.klass);
  12855. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  12856. smalltalk.Transcript.klass.iVarNames = ['current'];
  12857. smalltalk.addMethod(
  12858. "_clear",
  12859. smalltalk.method({
  12860. selector: "clear",
  12861. category: 'printing',
  12862. fn: function (){
  12863. var self=this;
  12864. smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
  12865. return self},
  12866. args: [],
  12867. source: "clear\x0a self current clear",
  12868. messageSends: ["clear", "current"],
  12869. referencedClasses: []
  12870. }),
  12871. smalltalk.Transcript.klass);
  12872. smalltalk.addMethod(
  12873. "_cr",
  12874. smalltalk.method({
  12875. selector: "cr",
  12876. category: 'printing',
  12877. fn: function (){
  12878. var self=this;
  12879. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  12880. return self},
  12881. args: [],
  12882. source: "cr\x0a self current show: String cr",
  12883. messageSends: ["show:", "cr", "current"],
  12884. referencedClasses: ["String"]
  12885. }),
  12886. smalltalk.Transcript.klass);
  12887. smalltalk.addMethod(
  12888. "_current",
  12889. smalltalk.method({
  12890. selector: "current",
  12891. category: 'instance creation',
  12892. fn: function (){
  12893. var self=this;
  12894. return self["@current"];
  12895. },
  12896. args: [],
  12897. source: "current\x0a ^current",
  12898. messageSends: [],
  12899. referencedClasses: []
  12900. }),
  12901. smalltalk.Transcript.klass);
  12902. smalltalk.addMethod(
  12903. "_new",
  12904. smalltalk.method({
  12905. selector: "new",
  12906. category: 'instance creation',
  12907. fn: function (){
  12908. var self=this;
  12909. smalltalk.send(self,"_shouldNotImplement",[]);
  12910. return self},
  12911. args: [],
  12912. source: "new\x0a self shouldNotImplement",
  12913. messageSends: ["shouldNotImplement"],
  12914. referencedClasses: []
  12915. }),
  12916. smalltalk.Transcript.klass);
  12917. smalltalk.addMethod(
  12918. "_open",
  12919. smalltalk.method({
  12920. selector: "open",
  12921. category: 'instance creation',
  12922. fn: function (){
  12923. var self=this;
  12924. smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
  12925. return self},
  12926. args: [],
  12927. source: "open\x0a self current open",
  12928. messageSends: ["open", "current"],
  12929. referencedClasses: []
  12930. }),
  12931. smalltalk.Transcript.klass);
  12932. smalltalk.addMethod(
  12933. "_register_",
  12934. smalltalk.method({
  12935. selector: "register:",
  12936. category: 'instance creation',
  12937. fn: function (aTranscript){
  12938. var self=this;
  12939. self["@current"]=aTranscript;
  12940. return self},
  12941. args: ["aTranscript"],
  12942. source: "register: aTranscript\x0a\x09current := aTranscript",
  12943. messageSends: [],
  12944. referencedClasses: []
  12945. }),
  12946. smalltalk.Transcript.klass);
  12947. smalltalk.addMethod(
  12948. "_show_",
  12949. smalltalk.method({
  12950. selector: "show:",
  12951. category: 'printing',
  12952. fn: function (anObject){
  12953. var self=this;
  12954. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
  12955. return self},
  12956. args: ["anObject"],
  12957. source: "show: anObject\x0a self current show: anObject",
  12958. messageSends: ["show:", "current"],
  12959. referencedClasses: []
  12960. }),
  12961. smalltalk.Transcript.klass);
  12962. smalltalk.addPackage('Kernel-Announcements', {});
  12963. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['block', 'announcementClass'], 'Kernel-Announcements');
  12964. smalltalk.addMethod(
  12965. "_announcementClass",
  12966. smalltalk.method({
  12967. selector: "announcementClass",
  12968. category: 'accessing',
  12969. fn: function (){
  12970. var self=this;
  12971. return self["@announcementClass"];
  12972. },
  12973. args: [],
  12974. source: "announcementClass\x0a\x09^announcementClass",
  12975. messageSends: [],
  12976. referencedClasses: []
  12977. }),
  12978. smalltalk.AnnouncementSubscription);
  12979. smalltalk.addMethod(
  12980. "_announcementClass_",
  12981. smalltalk.method({
  12982. selector: "announcementClass:",
  12983. category: 'accessing',
  12984. fn: function (aClass){
  12985. var self=this;
  12986. self["@announcementClass"]=aClass;
  12987. return self},
  12988. args: ["aClass"],
  12989. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  12990. messageSends: [],
  12991. referencedClasses: []
  12992. }),
  12993. smalltalk.AnnouncementSubscription);
  12994. smalltalk.addMethod(
  12995. "_block",
  12996. smalltalk.method({
  12997. selector: "block",
  12998. category: 'accessing',
  12999. fn: function (){
  13000. var self=this;
  13001. return self["@block"];
  13002. },
  13003. args: [],
  13004. source: "block\x0a\x09^block",
  13005. messageSends: [],
  13006. referencedClasses: []
  13007. }),
  13008. smalltalk.AnnouncementSubscription);
  13009. smalltalk.addMethod(
  13010. "_block_",
  13011. smalltalk.method({
  13012. selector: "block:",
  13013. category: 'accessing',
  13014. fn: function (aBlock){
  13015. var self=this;
  13016. self["@block"]=aBlock;
  13017. return self},
  13018. args: ["aBlock"],
  13019. source: "block: aBlock\x0a\x09block := aBlock",
  13020. messageSends: [],
  13021. referencedClasses: []
  13022. }),
  13023. smalltalk.AnnouncementSubscription);
  13024. smalltalk.addMethod(
  13025. "_deliver_",
  13026. smalltalk.method({
  13027. selector: "deliver:",
  13028. category: 'announcing',
  13029. fn: function (anAnnouncement){
  13030. var self=this;
  13031. var $1;
  13032. $1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
  13033. if(smalltalk.assert($1)){
  13034. smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
  13035. };
  13036. return self},
  13037. args: ["anAnnouncement"],
  13038. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
  13039. messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
  13040. referencedClasses: []
  13041. }),
  13042. smalltalk.AnnouncementSubscription);
  13043. smalltalk.addMethod(
  13044. "_handlesAnnouncement_",
  13045. smalltalk.method({
  13046. selector: "handlesAnnouncement:",
  13047. category: 'announcing',
  13048. fn: function (anAnnouncement){
  13049. var self=this;
  13050. var $1;
  13051. $1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
  13052. return $1;
  13053. },
  13054. args: ["anAnnouncement"],
  13055. source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
  13056. messageSends: ["isKindOf:", "announcementClass"],
  13057. referencedClasses: []
  13058. }),
  13059. smalltalk.AnnouncementSubscription);
  13060. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  13061. smalltalk.addMethod(
  13062. "_announce_",
  13063. smalltalk.method({
  13064. selector: "announce:",
  13065. category: 'announcing',
  13066. fn: function (anAnnouncement){
  13067. var self=this;
  13068. smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
  13069. return smalltalk.send(each,"_deliver_",[anAnnouncement]);
  13070. })]);
  13071. return self},
  13072. args: ["anAnnouncement"],
  13073. source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
  13074. messageSends: ["do:", "deliver:"],
  13075. referencedClasses: []
  13076. }),
  13077. smalltalk.Announcer);
  13078. smalltalk.addMethod(
  13079. "_initialize",
  13080. smalltalk.method({
  13081. selector: "initialize",
  13082. category: 'initialization',
  13083. fn: function (){
  13084. var self=this;
  13085. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  13086. self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  13087. return self},
  13088. args: [],
  13089. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
  13090. messageSends: ["initialize", "new"],
  13091. referencedClasses: ["Array"]
  13092. }),
  13093. smalltalk.Announcer);
  13094. smalltalk.addMethod(
  13095. "_on_do_",
  13096. smalltalk.method({
  13097. selector: "on:do:",
  13098. category: 'subscribing',
  13099. fn: function (aClass,aBlock){
  13100. var self=this;
  13101. var $1,$2;
  13102. $1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
  13103. smalltalk.send($1,"_block_",[aBlock]);
  13104. smalltalk.send($1,"_announcementClass_",[aClass]);
  13105. $2=smalltalk.send($1,"_yourself",[]);
  13106. smalltalk.send(self["@subscriptions"],"_add_",[$2]);
  13107. return self},
  13108. args: ["aClass", "aBlock"],
  13109. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  13110. messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
  13111. referencedClasses: ["AnnouncementSubscription"]
  13112. }),
  13113. smalltalk.Announcer);
  13114. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  13115. smalltalk.SystemAnnouncer.comment="My unique instance #current is the global announcer handling all Amber system-related announces"
  13116. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  13117. smalltalk.addMethod(
  13118. "_current",
  13119. smalltalk.method({
  13120. selector: "current",
  13121. category: 'accessing',
  13122. fn: function (){
  13123. var self=this;
  13124. var $1;
  13125. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  13126. self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
  13127. $1=self["@current"];
  13128. } else {
  13129. $1=self["@current"];
  13130. };
  13131. return $1;
  13132. },
  13133. args: [],
  13134. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  13135. messageSends: ["ifNil:", "new"],
  13136. referencedClasses: []
  13137. }),
  13138. smalltalk.SystemAnnouncer.klass);
  13139. smalltalk.addMethod(
  13140. "_new",
  13141. smalltalk.method({
  13142. selector: "new",
  13143. category: 'instance creation',
  13144. fn: function (){
  13145. var self=this;
  13146. smalltalk.send(self,"_shouldNotImplement",[]);
  13147. return self},
  13148. args: [],
  13149. source: "new\x0a\x09self shouldNotImplement",
  13150. messageSends: ["shouldNotImplement"],
  13151. referencedClasses: []
  13152. }),
  13153. smalltalk.SystemAnnouncer.klass);
  13154. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  13155. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements"
  13156. smalltalk.addMethod(
  13157. "_theClass",
  13158. smalltalk.method({
  13159. selector: "theClass",
  13160. category: 'accessing',
  13161. fn: function (){
  13162. var self=this;
  13163. return self["@theClass"];
  13164. },
  13165. args: [],
  13166. source: "theClass\x0a\x09^ theClass",
  13167. messageSends: [],
  13168. referencedClasses: []
  13169. }),
  13170. smalltalk.SystemAnnouncement);
  13171. smalltalk.addMethod(
  13172. "_theClass_",
  13173. smalltalk.method({
  13174. selector: "theClass:",
  13175. category: 'accessing',
  13176. fn: function (aClass){
  13177. var self=this;
  13178. self["@theClass"]=aClass;
  13179. return self},
  13180. args: ["aClass"],
  13181. source: "theClass: aClass\x0a\x09theClass := aClass",
  13182. messageSends: [],
  13183. referencedClasses: []
  13184. }),
  13185. smalltalk.SystemAnnouncement);
  13186. smalltalk.addClass('ClassAdded', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13187. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods"
  13188. smalltalk.addClass('ClassCommentChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13189. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)"
  13190. smalltalk.addClass('ClassDefinitionChanged', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13191. smalltalk.ClassDefinitionChanged.comment="I am emitted when the defintion of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:"
  13192. smalltalk.addClass('ClassRemoved', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13193. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:"
  13194. smalltalk.addClass('ClassRenamed', smalltalk.SystemAnnouncement, [], 'Kernel-Announcements');
  13195. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:"
  13196. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  13197. smalltalk.addMethod(
  13198. "_method",
  13199. smalltalk.method({
  13200. selector: "method",
  13201. category: 'accessing',
  13202. fn: function (){
  13203. var self=this;
  13204. return self["@method"];
  13205. },
  13206. args: [],
  13207. source: "method\x0a\x09^ method",
  13208. messageSends: [],
  13209. referencedClasses: []
  13210. }),
  13211. smalltalk.MethodAnnouncement);
  13212. smalltalk.addMethod(
  13213. "_method_",
  13214. smalltalk.method({
  13215. selector: "method:",
  13216. category: 'accessing',
  13217. fn: function (aCompiledMethod){
  13218. var self=this;
  13219. self["@method"]=aCompiledMethod;
  13220. return self},
  13221. args: ["aCompiledMethod"],
  13222. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  13223. messageSends: [],
  13224. referencedClasses: []
  13225. }),
  13226. smalltalk.MethodAnnouncement);
  13227. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13228. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  13229. smalltalk.addPackage('Compiler-Core', {});
  13230. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  13231. 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`"
  13232. smalltalk.addMethod(
  13233. "_codeGeneratorClass",
  13234. smalltalk.method({
  13235. selector: "codeGeneratorClass",
  13236. category: 'accessing',
  13237. fn: function (){
  13238. var self=this;
  13239. var $1;
  13240. if(($receiver = self["@codeGeneratorClass"]) == nil || $receiver == undefined){
  13241. $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
  13242. } else {
  13243. $1=self["@codeGeneratorClass"];
  13244. };
  13245. return $1;
  13246. },
  13247. args: [],
  13248. source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
  13249. messageSends: ["ifNil:"],
  13250. referencedClasses: ["InliningCodeGenerator"]
  13251. }),
  13252. smalltalk.Compiler);
  13253. smalltalk.addMethod(
  13254. "_codeGeneratorClass_",
  13255. smalltalk.method({
  13256. selector: "codeGeneratorClass:",
  13257. category: 'accessing',
  13258. fn: function (aClass){
  13259. var self=this;
  13260. self["@codeGeneratorClass"]=aClass;
  13261. return self},
  13262. args: ["aClass"],
  13263. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  13264. messageSends: [],
  13265. referencedClasses: []
  13266. }),
  13267. smalltalk.Compiler);
  13268. smalltalk.addMethod(
  13269. "_compile_",
  13270. smalltalk.method({
  13271. selector: "compile:",
  13272. category: 'compiling',
  13273. fn: function (aString){
  13274. var self=this;
  13275. var $1;
  13276. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[aString])]);
  13277. return $1;
  13278. },
  13279. args: ["aString"],
  13280. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  13281. messageSends: ["compileNode:", "parse:"],
  13282. referencedClasses: []
  13283. }),
  13284. smalltalk.Compiler);
  13285. smalltalk.addMethod(
  13286. "_compile_forClass_",
  13287. smalltalk.method({
  13288. selector: "compile:forClass:",
  13289. category: 'compiling',
  13290. fn: function (aString,aClass){
  13291. var self=this;
  13292. var $1;
  13293. smalltalk.send(self,"_currentClass_",[aClass]);
  13294. smalltalk.send(self,"_source_",[aString]);
  13295. $1=smalltalk.send(self,"_compile_",[aString]);
  13296. return $1;
  13297. },
  13298. args: ["aString", "aClass"],
  13299. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  13300. messageSends: ["currentClass:", "source:", "compile:"],
  13301. referencedClasses: []
  13302. }),
  13303. smalltalk.Compiler);
  13304. smalltalk.addMethod(
  13305. "_compileExpression_",
  13306. smalltalk.method({
  13307. selector: "compileExpression:",
  13308. category: 'compiling',
  13309. fn: function (aString){
  13310. var self=this;
  13311. var $1;
  13312. smalltalk.send(self,"_currentClass_",[(smalltalk.DoIt || DoIt)]);
  13313. smalltalk.send(self,"_source_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  13314. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[smalltalk.send(self,"_source",[])])]);
  13315. return $1;
  13316. },
  13317. args: ["aString"],
  13318. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  13319. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  13320. referencedClasses: ["DoIt"]
  13321. }),
  13322. smalltalk.Compiler);
  13323. smalltalk.addMethod(
  13324. "_compileNode_",
  13325. smalltalk.method({
  13326. selector: "compileNode:",
  13327. category: 'compiling',
  13328. fn: function (aNode){
  13329. var self=this;
  13330. var $1;
  13331. var generator;
  13332. var result;
  13333. generator=smalltalk.send(smalltalk.send(self,"_codeGeneratorClass",[]),"_new",[]);
  13334. smalltalk.send(generator,"_source_",[smalltalk.send(self,"_source",[])]);
  13335. $1=smalltalk.send(generator,"_currentClass_",[smalltalk.send(self,"_currentClass",[])]);
  13336. result=smalltalk.send(generator,"_compileNode_",[aNode]);
  13337. smalltalk.send(self,"_unknownVariables_",[[]]);
  13338. return result;
  13339. },
  13340. args: ["aNode"],
  13341. 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",
  13342. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  13343. referencedClasses: []
  13344. }),
  13345. smalltalk.Compiler);
  13346. smalltalk.addMethod(
  13347. "_currentClass",
  13348. smalltalk.method({
  13349. selector: "currentClass",
  13350. category: 'accessing',
  13351. fn: function (){
  13352. var self=this;
  13353. return self["@currentClass"];
  13354. },
  13355. args: [],
  13356. source: "currentClass\x0a\x09^currentClass",
  13357. messageSends: [],
  13358. referencedClasses: []
  13359. }),
  13360. smalltalk.Compiler);
  13361. smalltalk.addMethod(
  13362. "_currentClass_",
  13363. smalltalk.method({
  13364. selector: "currentClass:",
  13365. category: 'accessing',
  13366. fn: function (aClass){
  13367. var self=this;
  13368. self["@currentClass"]=aClass;
  13369. return self},
  13370. args: ["aClass"],
  13371. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  13372. messageSends: [],
  13373. referencedClasses: []
  13374. }),
  13375. smalltalk.Compiler);
  13376. smalltalk.addMethod(
  13377. "_eval_",
  13378. smalltalk.method({
  13379. selector: "eval:",
  13380. category: 'compiling',
  13381. fn: function (aString){
  13382. var self=this;
  13383. return eval(aString);
  13384. ;
  13385. return self},
  13386. args: ["aString"],
  13387. source: "eval: aString\x0a\x09<return eval(aString)>",
  13388. messageSends: [],
  13389. referencedClasses: []
  13390. }),
  13391. smalltalk.Compiler);
  13392. smalltalk.addMethod(
  13393. "_evaluateExpression_",
  13394. smalltalk.method({
  13395. selector: "evaluateExpression:",
  13396. category: 'compiling',
  13397. fn: function (aString){
  13398. var self=this;
  13399. var result;
  13400. smalltalk.send((smalltalk.DoIt || DoIt),"_addCompiledMethod_",[smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compileExpression_",[aString])])]);
  13401. result=smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]),"_doIt",[]);
  13402. smalltalk.send((smalltalk.DoIt || DoIt),"_removeCompiledMethod_",[smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_methodDictionary",[]),"_at_",["doIt"])]);
  13403. return result;
  13404. },
  13405. args: ["aString"],
  13406. 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",
  13407. messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
  13408. referencedClasses: ["DoIt"]
  13409. }),
  13410. smalltalk.Compiler);
  13411. smalltalk.addMethod(
  13412. "_install_forClass_category_",
  13413. smalltalk.method({
  13414. selector: "install:forClass:category:",
  13415. category: 'compiling',
  13416. fn: function (aString,aBehavior,anotherString){
  13417. var self=this;
  13418. var compiled;
  13419. compiled=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compile_forClass_",[aString,aBehavior])]);
  13420. smalltalk.send(compiled,"_category_",[anotherString]);
  13421. smalltalk.send(aBehavior,"_addCompiledMethod_",[compiled]);
  13422. smalltalk.send(self,"_setupClass_",[aBehavior]);
  13423. return compiled;
  13424. },
  13425. args: ["aString", "aBehavior", "anotherString"],
  13426. 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",
  13427. messageSends: ["eval:", "compile:forClass:", "category:", "addCompiledMethod:", "setupClass:"],
  13428. referencedClasses: []
  13429. }),
  13430. smalltalk.Compiler);
  13431. smalltalk.addMethod(
  13432. "_parse_",
  13433. smalltalk.method({
  13434. selector: "parse:",
  13435. category: 'compiling',
  13436. fn: function (aString){
  13437. var self=this;
  13438. var $1;
  13439. $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_parse_",[aString]);
  13440. return $1;
  13441. },
  13442. args: ["aString"],
  13443. source: "parse: aString\x0a ^Smalltalk current parse: aString",
  13444. messageSends: ["parse:", "current"],
  13445. referencedClasses: ["Smalltalk"]
  13446. }),
  13447. smalltalk.Compiler);
  13448. smalltalk.addMethod(
  13449. "_parseExpression_",
  13450. smalltalk.method({
  13451. selector: "parseExpression:",
  13452. category: 'compiling',
  13453. fn: function (aString){
  13454. var self=this;
  13455. var $1;
  13456. $1=smalltalk.send(self,"_parse_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  13457. return $1;
  13458. },
  13459. args: ["aString"],
  13460. source: "parseExpression: aString\x0a ^self parse: 'doIt ^[', aString, '] value'",
  13461. messageSends: ["parse:", ","],
  13462. referencedClasses: []
  13463. }),
  13464. smalltalk.Compiler);
  13465. smalltalk.addMethod(
  13466. "_recompile_",
  13467. smalltalk.method({
  13468. selector: "recompile:",
  13469. category: 'compiling',
  13470. fn: function (aClass){
  13471. var self=this;
  13472. var $1;
  13473. smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_do_",[(function(each){
  13474. smalltalk.send(console,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(each,"_selector",[])])]);
  13475. return smalltalk.send(self,"_install_forClass_category_",[smalltalk.send(each,"_source",[]),aClass,smalltalk.send(each,"_category",[])]);
  13476. })]);
  13477. smalltalk.send(self,"_setupClass_",[aClass]);
  13478. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  13479. if(! smalltalk.assert($1)){
  13480. smalltalk.send(self,"_recompile_",[smalltalk.send(aClass,"_class",[])]);
  13481. };
  13482. return self},
  13483. args: ["aClass"],
  13484. 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]",
  13485. messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "setupClass:", "ifFalse:", "recompile:", "class", "isMetaclass"],
  13486. referencedClasses: []
  13487. }),
  13488. smalltalk.Compiler);
  13489. smalltalk.addMethod(
  13490. "_recompileAll",
  13491. smalltalk.method({
  13492. selector: "recompileAll",
  13493. category: 'compiling',
  13494. fn: function (){
  13495. var self=this;
  13496. var $1;
  13497. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  13498. smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[each]);
  13499. $1=smalltalk.send((smalltalk.Transcript || Transcript),"_cr",[]);
  13500. $1;
  13501. return smalltalk.send((function(){
  13502. return smalltalk.send(self,"_recompile_",[each]);
  13503. }),"_valueWithTimeout_",[(100)]);
  13504. })]);
  13505. return self},
  13506. args: [],
  13507. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09Transcript show: each; cr.\x0a\x09\x09[self recompile: each] valueWithTimeout: 100]",
  13508. messageSends: ["do:", "show:", "cr", "valueWithTimeout:", "recompile:", "classes", "current"],
  13509. referencedClasses: ["Transcript", "Smalltalk"]
  13510. }),
  13511. smalltalk.Compiler);
  13512. smalltalk.addMethod(
  13513. "_setupClass_",
  13514. smalltalk.method({
  13515. selector: "setupClass:",
  13516. category: 'compiling',
  13517. fn: function (aClass){
  13518. var self=this;
  13519. smalltalk.init(aClass);
  13520. ;
  13521. return self},
  13522. args: ["aClass"],
  13523. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass)>",
  13524. messageSends: [],
  13525. referencedClasses: []
  13526. }),
  13527. smalltalk.Compiler);
  13528. smalltalk.addMethod(
  13529. "_source",
  13530. smalltalk.method({
  13531. selector: "source",
  13532. category: 'accessing',
  13533. fn: function (){
  13534. var self=this;
  13535. var $1;
  13536. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  13537. $1="";
  13538. } else {
  13539. $1=self["@source"];
  13540. };
  13541. return $1;
  13542. },
  13543. args: [],
  13544. source: "source\x0a\x09^source ifNil: ['']",
  13545. messageSends: ["ifNil:"],
  13546. referencedClasses: []
  13547. }),
  13548. smalltalk.Compiler);
  13549. smalltalk.addMethod(
  13550. "_source_",
  13551. smalltalk.method({
  13552. selector: "source:",
  13553. category: 'accessing',
  13554. fn: function (aString){
  13555. var self=this;
  13556. self["@source"]=aString;
  13557. return self},
  13558. args: ["aString"],
  13559. source: "source: aString\x0a\x09source := aString",
  13560. messageSends: [],
  13561. referencedClasses: []
  13562. }),
  13563. smalltalk.Compiler);
  13564. smalltalk.addMethod(
  13565. "_unknownVariables",
  13566. smalltalk.method({
  13567. selector: "unknownVariables",
  13568. category: 'accessing',
  13569. fn: function (){
  13570. var self=this;
  13571. return self["@unknownVariables"];
  13572. },
  13573. args: [],
  13574. source: "unknownVariables\x0a\x09^unknownVariables",
  13575. messageSends: [],
  13576. referencedClasses: []
  13577. }),
  13578. smalltalk.Compiler);
  13579. smalltalk.addMethod(
  13580. "_unknownVariables_",
  13581. smalltalk.method({
  13582. selector: "unknownVariables:",
  13583. category: 'accessing',
  13584. fn: function (aCollection){
  13585. var self=this;
  13586. self["@unknownVariables"]=aCollection;
  13587. return self},
  13588. args: ["aCollection"],
  13589. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  13590. messageSends: [],
  13591. referencedClasses: []
  13592. }),
  13593. smalltalk.Compiler);
  13594. smalltalk.addMethod(
  13595. "_recompile_",
  13596. smalltalk.method({
  13597. selector: "recompile:",
  13598. category: 'compiling',
  13599. fn: function (aClass){
  13600. var self=this;
  13601. smalltalk.send(smalltalk.send(self,"_new",[]),"_recompile_",[aClass]);
  13602. return self},
  13603. args: ["aClass"],
  13604. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  13605. messageSends: ["recompile:", "new"],
  13606. referencedClasses: []
  13607. }),
  13608. smalltalk.Compiler.klass);
  13609. smalltalk.addMethod(
  13610. "_recompileAll",
  13611. smalltalk.method({
  13612. selector: "recompileAll",
  13613. category: 'compiling',
  13614. fn: function (){
  13615. var self=this;
  13616. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  13617. return smalltalk.send(self,"_recompile_",[each]);
  13618. })]);
  13619. return self},
  13620. args: [],
  13621. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  13622. messageSends: ["do:", "recompile:", "classes", "current"],
  13623. referencedClasses: ["Smalltalk"]
  13624. }),
  13625. smalltalk.Compiler.klass);
  13626. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  13627. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`."
  13628. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  13629. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors."
  13630. smalltalk.addMethod(
  13631. "_visit_",
  13632. smalltalk.method({
  13633. selector: "visit:",
  13634. category: 'visiting',
  13635. fn: function (aNode){
  13636. var self=this;
  13637. var $1;
  13638. $1=smalltalk.send(aNode,"_accept_",[self]);
  13639. return $1;
  13640. },
  13641. args: ["aNode"],
  13642. source: "visit: aNode\x0a\x09^ aNode accept: self",
  13643. messageSends: ["accept:"],
  13644. referencedClasses: []
  13645. }),
  13646. smalltalk.NodeVisitor);
  13647. smalltalk.addMethod(
  13648. "_visitAll_",
  13649. smalltalk.method({
  13650. selector: "visitAll:",
  13651. category: 'visiting',
  13652. fn: function (aCollection){
  13653. var self=this;
  13654. var $1;
  13655. $1=smalltalk.send(aCollection,"_do_",[(function(each){
  13656. return smalltalk.send(self,"_visit_",[each]);
  13657. })]);
  13658. return $1;
  13659. },
  13660. args: ["aCollection"],
  13661. source: "visitAll: aCollection\x0a\x09^ aCollection do: [ :each | self visit: each ]",
  13662. messageSends: ["do:", "visit:"],
  13663. referencedClasses: []
  13664. }),
  13665. smalltalk.NodeVisitor);
  13666. smalltalk.addMethod(
  13667. "_visitAssignmentNode_",
  13668. smalltalk.method({
  13669. selector: "visitAssignmentNode:",
  13670. category: 'visiting',
  13671. fn: function (aNode){
  13672. var self=this;
  13673. var $1;
  13674. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13675. return $1;
  13676. },
  13677. args: ["aNode"],
  13678. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  13679. messageSends: ["visitNode:"],
  13680. referencedClasses: []
  13681. }),
  13682. smalltalk.NodeVisitor);
  13683. smalltalk.addMethod(
  13684. "_visitBlockNode_",
  13685. smalltalk.method({
  13686. selector: "visitBlockNode:",
  13687. category: 'visiting',
  13688. fn: function (aNode){
  13689. var self=this;
  13690. var $1;
  13691. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13692. return $1;
  13693. },
  13694. args: ["aNode"],
  13695. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  13696. messageSends: ["visitNode:"],
  13697. referencedClasses: []
  13698. }),
  13699. smalltalk.NodeVisitor);
  13700. smalltalk.addMethod(
  13701. "_visitBlockSequenceNode_",
  13702. smalltalk.method({
  13703. selector: "visitBlockSequenceNode:",
  13704. category: 'visiting',
  13705. fn: function (aNode){
  13706. var self=this;
  13707. var $1;
  13708. $1=smalltalk.send(self,"_visitSequenceNode_",[aNode]);
  13709. return $1;
  13710. },
  13711. args: ["aNode"],
  13712. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  13713. messageSends: ["visitSequenceNode:"],
  13714. referencedClasses: []
  13715. }),
  13716. smalltalk.NodeVisitor);
  13717. smalltalk.addMethod(
  13718. "_visitCascadeNode_",
  13719. smalltalk.method({
  13720. selector: "visitCascadeNode:",
  13721. category: 'visiting',
  13722. fn: function (aNode){
  13723. var self=this;
  13724. var $1;
  13725. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13726. return $1;
  13727. },
  13728. args: ["aNode"],
  13729. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  13730. messageSends: ["visitNode:"],
  13731. referencedClasses: []
  13732. }),
  13733. smalltalk.NodeVisitor);
  13734. smalltalk.addMethod(
  13735. "_visitClassReferenceNode_",
  13736. smalltalk.method({
  13737. selector: "visitClassReferenceNode:",
  13738. category: 'visiting',
  13739. fn: function (aNode){
  13740. var self=this;
  13741. var $1;
  13742. $1=smalltalk.send(self,"_visitVariableNode_",[aNode]);
  13743. return $1;
  13744. },
  13745. args: ["aNode"],
  13746. source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
  13747. messageSends: ["visitVariableNode:"],
  13748. referencedClasses: []
  13749. }),
  13750. smalltalk.NodeVisitor);
  13751. smalltalk.addMethod(
  13752. "_visitDynamicArrayNode_",
  13753. smalltalk.method({
  13754. selector: "visitDynamicArrayNode:",
  13755. category: 'visiting',
  13756. fn: function (aNode){
  13757. var self=this;
  13758. var $1;
  13759. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13760. return $1;
  13761. },
  13762. args: ["aNode"],
  13763. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  13764. messageSends: ["visitNode:"],
  13765. referencedClasses: []
  13766. }),
  13767. smalltalk.NodeVisitor);
  13768. smalltalk.addMethod(
  13769. "_visitDynamicDictionaryNode_",
  13770. smalltalk.method({
  13771. selector: "visitDynamicDictionaryNode:",
  13772. category: 'visiting',
  13773. fn: function (aNode){
  13774. var self=this;
  13775. var $1;
  13776. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13777. return $1;
  13778. },
  13779. args: ["aNode"],
  13780. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  13781. messageSends: ["visitNode:"],
  13782. referencedClasses: []
  13783. }),
  13784. smalltalk.NodeVisitor);
  13785. smalltalk.addMethod(
  13786. "_visitJSStatementNode_",
  13787. smalltalk.method({
  13788. selector: "visitJSStatementNode:",
  13789. category: 'visiting',
  13790. fn: function (aNode){
  13791. var self=this;
  13792. var $1;
  13793. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13794. return $1;
  13795. },
  13796. args: ["aNode"],
  13797. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  13798. messageSends: ["visitNode:"],
  13799. referencedClasses: []
  13800. }),
  13801. smalltalk.NodeVisitor);
  13802. smalltalk.addMethod(
  13803. "_visitMethodNode_",
  13804. smalltalk.method({
  13805. selector: "visitMethodNode:",
  13806. category: 'visiting',
  13807. fn: function (aNode){
  13808. var self=this;
  13809. var $1;
  13810. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13811. return $1;
  13812. },
  13813. args: ["aNode"],
  13814. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  13815. messageSends: ["visitNode:"],
  13816. referencedClasses: []
  13817. }),
  13818. smalltalk.NodeVisitor);
  13819. smalltalk.addMethod(
  13820. "_visitNode_",
  13821. smalltalk.method({
  13822. selector: "visitNode:",
  13823. category: 'visiting',
  13824. fn: function (aNode){
  13825. var self=this;
  13826. var $1;
  13827. $1=smalltalk.send(self,"_visitAll_",[smalltalk.send(aNode,"_nodes",[])]);
  13828. return $1;
  13829. },
  13830. args: ["aNode"],
  13831. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  13832. messageSends: ["visitAll:", "nodes"],
  13833. referencedClasses: []
  13834. }),
  13835. smalltalk.NodeVisitor);
  13836. smalltalk.addMethod(
  13837. "_visitReturnNode_",
  13838. smalltalk.method({
  13839. selector: "visitReturnNode:",
  13840. category: 'visiting',
  13841. fn: function (aNode){
  13842. var self=this;
  13843. var $1;
  13844. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13845. return $1;
  13846. },
  13847. args: ["aNode"],
  13848. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  13849. messageSends: ["visitNode:"],
  13850. referencedClasses: []
  13851. }),
  13852. smalltalk.NodeVisitor);
  13853. smalltalk.addMethod(
  13854. "_visitSendNode_",
  13855. smalltalk.method({
  13856. selector: "visitSendNode:",
  13857. category: 'visiting',
  13858. fn: function (aNode){
  13859. var self=this;
  13860. var $1;
  13861. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13862. return $1;
  13863. },
  13864. args: ["aNode"],
  13865. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  13866. messageSends: ["visitNode:"],
  13867. referencedClasses: []
  13868. }),
  13869. smalltalk.NodeVisitor);
  13870. smalltalk.addMethod(
  13871. "_visitSequenceNode_",
  13872. smalltalk.method({
  13873. selector: "visitSequenceNode:",
  13874. category: 'visiting',
  13875. fn: function (aNode){
  13876. var self=this;
  13877. var $1;
  13878. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13879. return $1;
  13880. },
  13881. args: ["aNode"],
  13882. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  13883. messageSends: ["visitNode:"],
  13884. referencedClasses: []
  13885. }),
  13886. smalltalk.NodeVisitor);
  13887. smalltalk.addMethod(
  13888. "_visitValueNode_",
  13889. smalltalk.method({
  13890. selector: "visitValueNode:",
  13891. category: 'visiting',
  13892. fn: function (aNode){
  13893. var self=this;
  13894. var $1;
  13895. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13896. return $1;
  13897. },
  13898. args: ["aNode"],
  13899. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  13900. messageSends: ["visitNode:"],
  13901. referencedClasses: []
  13902. }),
  13903. smalltalk.NodeVisitor);
  13904. smalltalk.addMethod(
  13905. "_visitVariableNode_",
  13906. smalltalk.method({
  13907. selector: "visitVariableNode:",
  13908. category: 'visiting',
  13909. fn: function (aNode){
  13910. var self=this;
  13911. var $1;
  13912. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  13913. return $1;
  13914. },
  13915. args: ["aNode"],
  13916. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  13917. messageSends: ["visitNode:"],
  13918. referencedClasses: []
  13919. }),
  13920. smalltalk.NodeVisitor);
  13921. smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler-Core');
  13922. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API."
  13923. smalltalk.addMethod(
  13924. "_classNameFor_",
  13925. smalltalk.method({
  13926. selector: "classNameFor:",
  13927. category: 'accessing',
  13928. fn: function (aClass){
  13929. var self=this;
  13930. var $2,$3,$1;
  13931. $2=smalltalk.send(aClass,"_isMetaclass",[]);
  13932. if(smalltalk.assert($2)){
  13933. $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
  13934. } else {
  13935. $3=smalltalk.send(aClass,"_isNil",[]);
  13936. if(smalltalk.assert($3)){
  13937. $1="nil";
  13938. } else {
  13939. $1=smalltalk.send(aClass,"_name",[]);
  13940. };
  13941. };
  13942. return $1;
  13943. },
  13944. args: ["aClass"],
  13945. 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]]",
  13946. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  13947. referencedClasses: []
  13948. }),
  13949. smalltalk.AbstractCodeGenerator);
  13950. smalltalk.addMethod(
  13951. "_compileNode_",
  13952. smalltalk.method({
  13953. selector: "compileNode:",
  13954. category: 'compiling',
  13955. fn: function (aNode){
  13956. var self=this;
  13957. smalltalk.send(self,"_subclassResponsibility",[]);
  13958. return self},
  13959. args: ["aNode"],
  13960. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  13961. messageSends: ["subclassResponsibility"],
  13962. referencedClasses: []
  13963. }),
  13964. smalltalk.AbstractCodeGenerator);
  13965. smalltalk.addMethod(
  13966. "_currentClass",
  13967. smalltalk.method({
  13968. selector: "currentClass",
  13969. category: 'accessing',
  13970. fn: function (){
  13971. var self=this;
  13972. return self["@currentClass"];
  13973. },
  13974. args: [],
  13975. source: "currentClass\x0a\x09^currentClass",
  13976. messageSends: [],
  13977. referencedClasses: []
  13978. }),
  13979. smalltalk.AbstractCodeGenerator);
  13980. smalltalk.addMethod(
  13981. "_currentClass_",
  13982. smalltalk.method({
  13983. selector: "currentClass:",
  13984. category: 'accessing',
  13985. fn: function (aClass){
  13986. var self=this;
  13987. self["@currentClass"]=aClass;
  13988. return self},
  13989. args: ["aClass"],
  13990. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  13991. messageSends: [],
  13992. referencedClasses: []
  13993. }),
  13994. smalltalk.AbstractCodeGenerator);
  13995. smalltalk.addMethod(
  13996. "_pseudoVariables",
  13997. smalltalk.method({
  13998. selector: "pseudoVariables",
  13999. category: 'accessing',
  14000. fn: function (){
  14001. var self=this;
  14002. return ["self", "super", "true", "false", "nil", "thisContext"];
  14003. },
  14004. args: [],
  14005. source: "pseudoVariables\x0a\x09^#('self' 'super' 'true' 'false' 'nil' 'thisContext')",
  14006. messageSends: [],
  14007. referencedClasses: []
  14008. }),
  14009. smalltalk.AbstractCodeGenerator);
  14010. smalltalk.addMethod(
  14011. "_safeVariableNameFor_",
  14012. smalltalk.method({
  14013. selector: "safeVariableNameFor:",
  14014. category: 'accessing',
  14015. fn: function (aString){
  14016. var self=this;
  14017. var $2,$1;
  14018. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[aString]);
  14019. if(smalltalk.assert($2)){
  14020. $1=smalltalk.send(aString,"__comma",["_"]);
  14021. } else {
  14022. $1=aString;
  14023. };
  14024. return $1;
  14025. },
  14026. args: ["aString"],
  14027. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  14028. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  14029. referencedClasses: ["Smalltalk"]
  14030. }),
  14031. smalltalk.AbstractCodeGenerator);
  14032. smalltalk.addMethod(
  14033. "_source",
  14034. smalltalk.method({
  14035. selector: "source",
  14036. category: 'accessing',
  14037. fn: function (){
  14038. var self=this;
  14039. var $1;
  14040. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  14041. $1="";
  14042. } else {
  14043. $1=self["@source"];
  14044. };
  14045. return $1;
  14046. },
  14047. args: [],
  14048. source: "source\x0a\x09^source ifNil: ['']",
  14049. messageSends: ["ifNil:"],
  14050. referencedClasses: []
  14051. }),
  14052. smalltalk.AbstractCodeGenerator);
  14053. smalltalk.addMethod(
  14054. "_source_",
  14055. smalltalk.method({
  14056. selector: "source:",
  14057. category: 'accessing',
  14058. fn: function (aString){
  14059. var self=this;
  14060. self["@source"]=aString;
  14061. return self},
  14062. args: ["aString"],
  14063. source: "source: aString\x0a\x09source := aString",
  14064. messageSends: [],
  14065. referencedClasses: []
  14066. }),
  14067. smalltalk.AbstractCodeGenerator);
  14068. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  14069. 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."
  14070. smalltalk.addMethod(
  14071. "_compileNode_",
  14072. smalltalk.method({
  14073. selector: "compileNode:",
  14074. category: 'compiling',
  14075. fn: function (aNode){
  14076. var self=this;
  14077. var $2,$3,$1;
  14078. var ir;
  14079. var stream;
  14080. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  14081. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  14082. $2=smalltalk.send(self,"_irTranslator",[]);
  14083. smalltalk.send($2,"_visit_",[ir]);
  14084. $3=smalltalk.send($2,"_contents",[]);
  14085. $1=$3;
  14086. return $1;
  14087. },
  14088. args: ["aNode"],
  14089. 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",
  14090. messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
  14091. referencedClasses: []
  14092. }),
  14093. smalltalk.CodeGenerator);
  14094. smalltalk.addMethod(
  14095. "_irTranslator",
  14096. smalltalk.method({
  14097. selector: "irTranslator",
  14098. category: 'compiling',
  14099. fn: function (){
  14100. var self=this;
  14101. var $1;
  14102. $1=smalltalk.send((smalltalk.IRJSTranslator || IRJSTranslator),"_new",[]);
  14103. return $1;
  14104. },
  14105. args: [],
  14106. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  14107. messageSends: ["new"],
  14108. referencedClasses: ["IRJSTranslator"]
  14109. }),
  14110. smalltalk.CodeGenerator);
  14111. smalltalk.addMethod(
  14112. "_semanticAnalyzer",
  14113. smalltalk.method({
  14114. selector: "semanticAnalyzer",
  14115. category: 'compiling',
  14116. fn: function (){
  14117. var self=this;
  14118. var $1;
  14119. $1=smalltalk.send((smalltalk.SemanticAnalyzer || SemanticAnalyzer),"_on_",[smalltalk.send(self,"_currentClass",[])]);
  14120. return $1;
  14121. },
  14122. args: [],
  14123. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  14124. messageSends: ["on:", "currentClass"],
  14125. referencedClasses: ["SemanticAnalyzer"]
  14126. }),
  14127. smalltalk.CodeGenerator);
  14128. smalltalk.addMethod(
  14129. "_translator",
  14130. smalltalk.method({
  14131. selector: "translator",
  14132. category: 'compiling',
  14133. fn: function (){
  14134. var self=this;
  14135. var $2,$3,$1;
  14136. $2=smalltalk.send((smalltalk.IRASTTranslator || IRASTTranslator),"_new",[]);
  14137. smalltalk.send($2,"_source_",[smalltalk.send(self,"_source",[])]);
  14138. smalltalk.send($2,"_theClass_",[smalltalk.send(self,"_currentClass",[])]);
  14139. $3=smalltalk.send($2,"_yourself",[]);
  14140. $1=$3;
  14141. return $1;
  14142. },
  14143. args: [],
  14144. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  14145. messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
  14146. referencedClasses: ["IRASTTranslator"]
  14147. }),
  14148. smalltalk.CodeGenerator);
  14149. smalltalk.addClass('FunCodeGenerator', smalltalk.AbstractCodeGenerator, ['stream', 'nestedBlocks', 'earlyReturn', 'currentSelector', 'unknownVariables', 'tempVariables', 'messageSends', 'referencedClasses', 'classReferenced', 'argVariables'], 'Compiler-Core');
  14150. smalltalk.addMethod(
  14151. "_argVariables",
  14152. smalltalk.method({
  14153. selector: "argVariables",
  14154. category: 'accessing',
  14155. fn: function (){
  14156. var self=this;
  14157. var $1;
  14158. $1=smalltalk.send(self["@argVariables"],"_copy",[]);
  14159. return $1;
  14160. },
  14161. args: [],
  14162. source: "argVariables\x0a\x09^argVariables copy",
  14163. messageSends: ["copy"],
  14164. referencedClasses: []
  14165. }),
  14166. smalltalk.FunCodeGenerator);
  14167. smalltalk.addMethod(
  14168. "_checkClass_for_",
  14169. smalltalk.method({
  14170. selector: "checkClass:for:",
  14171. category: 'optimizations',
  14172. fn: function (aClassName,receiver){
  14173. var self=this;
  14174. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("((($receiver = ","__comma",[receiver]),"__comma",[").klass === smalltalk."]),"__comma",[aClassName]),"__comma",[") ? "])]);
  14175. return self},
  14176. args: ["aClassName", "receiver"],
  14177. source: "checkClass: aClassName for: receiver\x0a stream nextPutAll: '((($receiver = ', receiver, ').klass === smalltalk.', aClassName, ') ? '",
  14178. messageSends: ["nextPutAll:", ","],
  14179. referencedClasses: []
  14180. }),
  14181. smalltalk.FunCodeGenerator);
  14182. smalltalk.addMethod(
  14183. "_compileNode_",
  14184. smalltalk.method({
  14185. selector: "compileNode:",
  14186. category: 'compiling',
  14187. fn: function (aNode){
  14188. var self=this;
  14189. var $1;
  14190. self["@stream"]=smalltalk.send("","_writeStream",[]);
  14191. smalltalk.send(self,"_visit_",[aNode]);
  14192. $1=smalltalk.send(self["@stream"],"_contents",[]);
  14193. return $1;
  14194. },
  14195. args: ["aNode"],
  14196. source: "compileNode: aNode\x0a\x09stream := '' writeStream.\x0a\x09self visit: aNode.\x0a\x09^stream contents",
  14197. messageSends: ["writeStream", "visit:", "contents"],
  14198. referencedClasses: []
  14199. }),
  14200. smalltalk.FunCodeGenerator);
  14201. smalltalk.addMethod(
  14202. "_initialize",
  14203. smalltalk.method({
  14204. selector: "initialize",
  14205. category: 'initialization',
  14206. fn: function (){
  14207. var self=this;
  14208. smalltalk.send(self,"_initialize",[],smalltalk.AbstractCodeGenerator);
  14209. self["@stream"]=smalltalk.send("","_writeStream",[]);
  14210. self["@unknownVariables"]=[];
  14211. self["@tempVariables"]=[];
  14212. self["@argVariables"]=[];
  14213. self["@messageSends"]=[];
  14214. self["@classReferenced"]=[];
  14215. return self},
  14216. args: [],
  14217. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream. \x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09messageSends := #().\x0a\x09classReferenced := #()",
  14218. messageSends: ["initialize", "writeStream"],
  14219. referencedClasses: []
  14220. }),
  14221. smalltalk.FunCodeGenerator);
  14222. smalltalk.addMethod(
  14223. "_inline_receiver_argumentNodes_",
  14224. smalltalk.method({
  14225. selector: "inline:receiver:argumentNodes:",
  14226. category: 'optimizations',
  14227. fn: function (aSelector,receiver,aCollection){
  14228. var self=this;
  14229. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  14230. var inlined;
  14231. inlined=false;
  14232. $1=smalltalk.send(aSelector,"__eq",["ifFalse:"]);
  14233. if(smalltalk.assert($1)){
  14234. $2=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14235. if(smalltalk.assert($2)){
  14236. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14237. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  14238. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14239. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  14240. inlined=true;
  14241. inlined;
  14242. };
  14243. };
  14244. $3=smalltalk.send(aSelector,"__eq",["ifTrue:"]);
  14245. if(smalltalk.assert($3)){
  14246. $4=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14247. if(smalltalk.assert($4)){
  14248. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14249. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  14250. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14251. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  14252. inlined=true;
  14253. inlined;
  14254. };
  14255. };
  14256. $5=smalltalk.send(aSelector,"__eq",["ifTrue:ifFalse:"]);
  14257. if(smalltalk.assert($5)){
  14258. $6=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14259. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14260. })]);
  14261. if(smalltalk.assert($6)){
  14262. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14263. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  14264. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14265. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14266. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14267. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  14268. inlined=true;
  14269. inlined;
  14270. };
  14271. };
  14272. $7=smalltalk.send(aSelector,"__eq",["ifFalse:ifTrue:"]);
  14273. if(smalltalk.assert($7)){
  14274. $8=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14275. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14276. })]);
  14277. if(smalltalk.assert($8)){
  14278. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  14279. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  14280. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14281. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14282. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14283. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  14284. inlined=true;
  14285. inlined;
  14286. };
  14287. };
  14288. $9=smalltalk.send(aSelector,"__eq",["<"]);
  14289. if(smalltalk.assert($9)){
  14290. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14291. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <"]);
  14292. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14293. inlined=true;
  14294. inlined;
  14295. };
  14296. $10=smalltalk.send(aSelector,"__eq",["<="]);
  14297. if(smalltalk.assert($10)){
  14298. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14299. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <="]);
  14300. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14301. inlined=true;
  14302. inlined;
  14303. };
  14304. $11=smalltalk.send(aSelector,"__eq",[">"]);
  14305. if(smalltalk.assert($11)){
  14306. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14307. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >"]);
  14308. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14309. inlined=true;
  14310. inlined;
  14311. };
  14312. $12=smalltalk.send(aSelector,"__eq",[">="]);
  14313. if(smalltalk.assert($12)){
  14314. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14315. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >="]);
  14316. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14317. inlined=true;
  14318. inlined;
  14319. };
  14320. $13=smalltalk.send(aSelector,"__eq",["+"]);
  14321. if(smalltalk.assert($13)){
  14322. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14323. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver +"]);
  14324. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14325. inlined=true;
  14326. inlined;
  14327. };
  14328. $14=smalltalk.send(aSelector,"__eq",["-"]);
  14329. if(smalltalk.assert($14)){
  14330. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14331. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver -"]);
  14332. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14333. inlined=true;
  14334. inlined;
  14335. };
  14336. $15=smalltalk.send(aSelector,"__eq",["*"]);
  14337. if(smalltalk.assert($15)){
  14338. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14339. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver *"]);
  14340. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14341. inlined=true;
  14342. inlined;
  14343. };
  14344. $16=smalltalk.send(aSelector,"__eq",["/"]);
  14345. if(smalltalk.assert($16)){
  14346. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  14347. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver /"]);
  14348. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14349. inlined=true;
  14350. inlined;
  14351. };
  14352. return inlined;
  14353. },
  14354. args: ["aSelector", "receiver", "aCollection"],
  14355. 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",
  14356. messageSends: ["ifTrue:", "checkClass:for:", "nextPutAll:", "visit:", "first", "isBlockNode", "=", "second", "and:"],
  14357. referencedClasses: []
  14358. }),
  14359. smalltalk.FunCodeGenerator);
  14360. smalltalk.addMethod(
  14361. "_inlineLiteral_receiverNode_argumentNodes_",
  14362. smalltalk.method({
  14363. selector: "inlineLiteral:receiverNode:argumentNodes:",
  14364. category: 'optimizations',
  14365. fn: function (aSelector,anObject,aCollection){
  14366. var self=this;
  14367. 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;
  14368. var inlined;
  14369. inlined=false;
  14370. $1=smalltalk.send(aSelector,"__eq",["whileTrue:"]);
  14371. if(smalltalk.assert($1)){
  14372. $2=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  14373. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14374. })]);
  14375. if(smalltalk.assert($2)){
  14376. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  14377. smalltalk.send(self,"_visit_",[anObject]);
  14378. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  14379. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14380. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  14381. inlined=true;
  14382. inlined;
  14383. };
  14384. };
  14385. $3=smalltalk.send(aSelector,"__eq",["whileFalse:"]);
  14386. if(smalltalk.assert($3)){
  14387. $4=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  14388. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14389. })]);
  14390. if(smalltalk.assert($4)){
  14391. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  14392. smalltalk.send(self,"_visit_",[anObject]);
  14393. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  14394. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14395. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  14396. inlined=true;
  14397. inlined;
  14398. };
  14399. };
  14400. $5=smalltalk.send(aSelector,"__eq",["whileTrue"]);
  14401. if(smalltalk.assert($5)){
  14402. $6=smalltalk.send(anObject,"_isBlockNode",[]);
  14403. if(smalltalk.assert($6)){
  14404. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  14405. smalltalk.send(self,"_visit_",[anObject]);
  14406. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  14407. inlined=true;
  14408. inlined;
  14409. };
  14410. };
  14411. $7=smalltalk.send(aSelector,"__eq",["whileFalse"]);
  14412. if(smalltalk.assert($7)){
  14413. $8=smalltalk.send(anObject,"_isBlockNode",[]);
  14414. if(smalltalk.assert($8)){
  14415. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  14416. smalltalk.send(self,"_visit_",[anObject]);
  14417. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  14418. inlined=true;
  14419. inlined;
  14420. };
  14421. };
  14422. $9=smalltalk.send(aSelector,"__eq",["+"]);
  14423. if(smalltalk.assert($9)){
  14424. $10=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14425. if(smalltalk.assert($10)){
  14426. smalltalk.send(self,"_visit_",[anObject]);
  14427. smalltalk.send(self["@stream"],"_nextPutAll_",[" + "]);
  14428. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14429. inlined=true;
  14430. inlined;
  14431. };
  14432. };
  14433. $11=smalltalk.send(aSelector,"__eq",["-"]);
  14434. if(smalltalk.assert($11)){
  14435. $12=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14436. if(smalltalk.assert($12)){
  14437. smalltalk.send(self,"_visit_",[anObject]);
  14438. smalltalk.send(self["@stream"],"_nextPutAll_",[" - "]);
  14439. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14440. inlined=true;
  14441. inlined;
  14442. };
  14443. };
  14444. $13=smalltalk.send(aSelector,"__eq",["*"]);
  14445. if(smalltalk.assert($13)){
  14446. $14=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14447. if(smalltalk.assert($14)){
  14448. smalltalk.send(self,"_visit_",[anObject]);
  14449. smalltalk.send(self["@stream"],"_nextPutAll_",[" * "]);
  14450. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14451. inlined=true;
  14452. inlined;
  14453. };
  14454. };
  14455. $15=smalltalk.send(aSelector,"__eq",["/"]);
  14456. if(smalltalk.assert($15)){
  14457. $16=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14458. if(smalltalk.assert($16)){
  14459. smalltalk.send(self,"_visit_",[anObject]);
  14460. smalltalk.send(self["@stream"],"_nextPutAll_",[" / "]);
  14461. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14462. inlined=true;
  14463. inlined;
  14464. };
  14465. };
  14466. $17=smalltalk.send(aSelector,"__eq",["<"]);
  14467. if(smalltalk.assert($17)){
  14468. $18=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14469. if(smalltalk.assert($18)){
  14470. smalltalk.send(self,"_visit_",[anObject]);
  14471. smalltalk.send(self["@stream"],"_nextPutAll_",[" < "]);
  14472. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14473. inlined=true;
  14474. inlined;
  14475. };
  14476. };
  14477. $19=smalltalk.send(aSelector,"__eq",["<="]);
  14478. if(smalltalk.assert($19)){
  14479. $20=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14480. if(smalltalk.assert($20)){
  14481. smalltalk.send(self,"_visit_",[anObject]);
  14482. smalltalk.send(self["@stream"],"_nextPutAll_",[" <= "]);
  14483. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14484. inlined=true;
  14485. inlined;
  14486. };
  14487. };
  14488. $21=smalltalk.send(aSelector,"__eq",[">"]);
  14489. if(smalltalk.assert($21)){
  14490. $22=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14491. if(smalltalk.assert($22)){
  14492. smalltalk.send(self,"_visit_",[anObject]);
  14493. smalltalk.send(self["@stream"],"_nextPutAll_",[" > "]);
  14494. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14495. inlined=true;
  14496. inlined;
  14497. };
  14498. };
  14499. $23=smalltalk.send(aSelector,"__eq",[">="]);
  14500. if(smalltalk.assert($23)){
  14501. $24=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  14502. if(smalltalk.assert($24)){
  14503. smalltalk.send(self,"_visit_",[anObject]);
  14504. smalltalk.send(self["@stream"],"_nextPutAll_",[" >= "]);
  14505. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14506. inlined=true;
  14507. inlined;
  14508. };
  14509. };
  14510. $25=smalltalk.send(aSelector,"__eq",["ifNil:"]);
  14511. if(smalltalk.assert($25)){
  14512. $26=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14513. if(smalltalk.assert($26)){
  14514. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14515. smalltalk.send(self,"_visit_",[anObject]);
  14516. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14517. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14518. smalltalk.send(self["@stream"],"_nextPutAll_",["() : $receiver"]);
  14519. inlined=true;
  14520. inlined;
  14521. };
  14522. };
  14523. $27=smalltalk.send(aSelector,"__eq",["ifNotNil:"]);
  14524. if(smalltalk.assert($27)){
  14525. $28=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  14526. if(smalltalk.assert($28)){
  14527. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14528. smalltalk.send(self,"_visit_",[anObject]);
  14529. smalltalk.send(self["@stream"],"_nextPutAll_",[") != nil && $receiver != undefined) ? "]);
  14530. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14531. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil"]);
  14532. inlined=true;
  14533. inlined;
  14534. };
  14535. };
  14536. $29=smalltalk.send(aSelector,"__eq",["ifNil:ifNotNil:"]);
  14537. if(smalltalk.assert($29)){
  14538. $30=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14539. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14540. })]);
  14541. if(smalltalk.assert($30)){
  14542. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14543. smalltalk.send(self,"_visit_",[anObject]);
  14544. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14545. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14546. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14547. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14548. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  14549. inlined=true;
  14550. inlined;
  14551. };
  14552. };
  14553. $31=smalltalk.send(aSelector,"__eq",["ifNotNil:ifNil:"]);
  14554. if(smalltalk.assert($31)){
  14555. $32=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  14556. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  14557. })]);
  14558. if(smalltalk.assert($32)){
  14559. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  14560. smalltalk.send(self,"_visit_",[anObject]);
  14561. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  14562. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  14563. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  14564. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  14565. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  14566. inlined=true;
  14567. inlined;
  14568. };
  14569. };
  14570. return inlined;
  14571. },
  14572. args: ["aSelector", "anObject", "aCollection"],
  14573. 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",
  14574. messageSends: ["ifTrue:", "nextPutAll:", "visit:", "first", "and:", "isBlockNode", "=", "isNode:ofClass:", "second"],
  14575. referencedClasses: ["Number"]
  14576. }),
  14577. smalltalk.FunCodeGenerator);
  14578. smalltalk.addMethod(
  14579. "_isNode_ofClass_",
  14580. smalltalk.method({
  14581. selector: "isNode:ofClass:",
  14582. category: 'optimizations',
  14583. fn: function (aNode,aClass){
  14584. var self=this;
  14585. var $1;
  14586. $1=smalltalk.send(smalltalk.send(aNode,"_isValueNode",[]),"_and_",[(function(){
  14587. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"_class",[]),"__eq",[aClass]),"_or_",[(function(){
  14588. return smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"__eq",["self"]),"_and_",[(function(){
  14589. return smalltalk.send(smalltalk.send(self,"_currentClass",[]),"__eq",[aClass]);
  14590. })]);
  14591. })]);
  14592. })]);
  14593. return $1;
  14594. },
  14595. args: ["aNode", "aClass"],
  14596. 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]]]",
  14597. messageSends: ["and:", "or:", "=", "currentClass", "value", "class", "isValueNode"],
  14598. referencedClasses: []
  14599. }),
  14600. smalltalk.FunCodeGenerator);
  14601. smalltalk.addMethod(
  14602. "_knownVariables",
  14603. smalltalk.method({
  14604. selector: "knownVariables",
  14605. category: 'accessing',
  14606. fn: function (){
  14607. var self=this;
  14608. var $2,$3,$1;
  14609. $2=smalltalk.send(self,"_pseudoVariables",[]);
  14610. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_tempVariables",[])]);
  14611. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_argVariables",[])]);
  14612. $3=smalltalk.send($2,"_yourself",[]);
  14613. $1=$3;
  14614. return $1;
  14615. },
  14616. args: [],
  14617. source: "knownVariables\x0a\x09^self pseudoVariables \x0a\x09\x09addAll: self tempVariables;\x0a\x09\x09addAll: self argVariables;\x0a\x09\x09yourself",
  14618. messageSends: ["addAll:", "tempVariables", "pseudoVariables", "argVariables", "yourself"],
  14619. referencedClasses: []
  14620. }),
  14621. smalltalk.FunCodeGenerator);
  14622. smalltalk.addMethod(
  14623. "_performOptimizations",
  14624. smalltalk.method({
  14625. selector: "performOptimizations",
  14626. category: 'testing',
  14627. fn: function (){
  14628. var self=this;
  14629. var $1;
  14630. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_performOptimizations",[]);
  14631. return $1;
  14632. },
  14633. args: [],
  14634. source: "performOptimizations\x0a\x09^self class performOptimizations",
  14635. messageSends: ["performOptimizations", "class"],
  14636. referencedClasses: []
  14637. }),
  14638. smalltalk.FunCodeGenerator);
  14639. smalltalk.addMethod(
  14640. "_send_to_arguments_superSend_",
  14641. smalltalk.method({
  14642. selector: "send:to:arguments:superSend:",
  14643. category: 'visiting',
  14644. fn: function (aSelector,aReceiver,aCollection,aBoolean){
  14645. var self=this;
  14646. var $1;
  14647. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(str){
  14648. var tmp;
  14649. tmp=self["@stream"];
  14650. tmp;
  14651. smalltalk.send(str,"_nextPutAll_",["smalltalk.send("]);
  14652. smalltalk.send(str,"_nextPutAll_",[aReceiver]);
  14653. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", \x22","__comma",[smalltalk.send(aSelector,"_asSelector",[])]),"__comma",["\x22, ["])]);
  14654. self["@stream"]=str;
  14655. self["@stream"];
  14656. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  14657. return smalltalk.send(self,"_visit_",[each]);
  14658. }),(function(){
  14659. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  14660. })]);
  14661. self["@stream"]=tmp;
  14662. self["@stream"];
  14663. smalltalk.send(str,"_nextPutAll_",["]"]);
  14664. if(smalltalk.assert(aBoolean)){
  14665. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(self,"_currentClass",[])])]),"__comma",[".superclass || nil"])]);
  14666. };
  14667. return smalltalk.send(str,"_nextPutAll_",[")"]);
  14668. })]);
  14669. return $1;
  14670. },
  14671. args: ["aSelector", "aReceiver", "aCollection", "aBoolean"],
  14672. 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: ')']",
  14673. messageSends: ["streamContents:", "nextPutAll:", ",", "asSelector", "do:separatedBy:", "visit:", "ifTrue:", "classNameFor:", "currentClass"],
  14674. referencedClasses: ["String"]
  14675. }),
  14676. smalltalk.FunCodeGenerator);
  14677. smalltalk.addMethod(
  14678. "_tempVariables",
  14679. smalltalk.method({
  14680. selector: "tempVariables",
  14681. category: 'accessing',
  14682. fn: function (){
  14683. var self=this;
  14684. var $1;
  14685. $1=smalltalk.send(self["@tempVariables"],"_copy",[]);
  14686. return $1;
  14687. },
  14688. args: [],
  14689. source: "tempVariables\x0a\x09^tempVariables copy",
  14690. messageSends: ["copy"],
  14691. referencedClasses: []
  14692. }),
  14693. smalltalk.FunCodeGenerator);
  14694. smalltalk.addMethod(
  14695. "_unknownVariables",
  14696. smalltalk.method({
  14697. selector: "unknownVariables",
  14698. category: 'accessing',
  14699. fn: function (){
  14700. var self=this;
  14701. var $1;
  14702. $1=smalltalk.send(self["@unknownVariables"],"_copy",[]);
  14703. return $1;
  14704. },
  14705. args: [],
  14706. source: "unknownVariables\x0a\x09^unknownVariables copy",
  14707. messageSends: ["copy"],
  14708. referencedClasses: []
  14709. }),
  14710. smalltalk.FunCodeGenerator);
  14711. smalltalk.addMethod(
  14712. "_visit_",
  14713. smalltalk.method({
  14714. selector: "visit:",
  14715. category: 'visiting',
  14716. fn: function (aNode){
  14717. var self=this;
  14718. smalltalk.send(aNode,"_accept_",[self]);
  14719. return self},
  14720. args: ["aNode"],
  14721. source: "visit: aNode\x0a\x09aNode accept: self",
  14722. messageSends: ["accept:"],
  14723. referencedClasses: []
  14724. }),
  14725. smalltalk.FunCodeGenerator);
  14726. smalltalk.addMethod(
  14727. "_visitAssignmentNode_",
  14728. smalltalk.method({
  14729. selector: "visitAssignmentNode:",
  14730. category: 'visiting',
  14731. fn: function (aNode){
  14732. var self=this;
  14733. smalltalk.send(self["@stream"],"_nextPutAll_",["("]);
  14734. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  14735. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  14736. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  14737. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  14738. return self},
  14739. args: ["aNode"],
  14740. source: "visitAssignmentNode: aNode\x0a\x09stream nextPutAll: '('.\x0a\x09self visit: aNode left.\x0a\x09stream nextPutAll: '='.\x0a\x09self visit: aNode right.\x0a\x09stream nextPutAll: ')'",
  14741. messageSends: ["nextPutAll:", "visit:", "left", "right"],
  14742. referencedClasses: []
  14743. }),
  14744. smalltalk.FunCodeGenerator);
  14745. smalltalk.addMethod(
  14746. "_visitBlockNode_",
  14747. smalltalk.method({
  14748. selector: "visitBlockNode:",
  14749. category: 'visiting',
  14750. fn: function (aNode){
  14751. var self=this;
  14752. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  14753. smalltalk.send(smalltalk.send(aNode,"_parameters",[]),"_do_separatedBy_",[(function(each){
  14754. smalltalk.send(self["@tempVariables"],"_add_",[each]);
  14755. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  14756. }),(function(){
  14757. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  14758. })]);
  14759. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  14760. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  14761. return smalltalk.send(self,"_visit_",[each]);
  14762. })]);
  14763. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  14764. return self},
  14765. args: ["aNode"],
  14766. 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: '})'",
  14767. messageSends: ["nextPutAll:", "do:separatedBy:", "add:", "parameters", "do:", "visit:", "nodes"],
  14768. referencedClasses: []
  14769. }),
  14770. smalltalk.FunCodeGenerator);
  14771. smalltalk.addMethod(
  14772. "_visitBlockSequenceNode_",
  14773. smalltalk.method({
  14774. selector: "visitBlockSequenceNode:",
  14775. category: 'visiting',
  14776. fn: function (aNode){
  14777. var self=this;
  14778. var $1,$2,$3;
  14779. var index;
  14780. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__plus",[(1)]);
  14781. $1=smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_isEmpty",[]);
  14782. if(smalltalk.assert($1)){
  14783. smalltalk.send(self["@stream"],"_nextPutAll_",["return nil;"]);
  14784. } else {
  14785. smalltalk.send(smalltalk.send(aNode,"_temps",[]),"_do_",[(function(each){
  14786. var temp;
  14787. temp=smalltalk.send(self,"_safeVariableNameFor_",[each]);
  14788. temp;
  14789. smalltalk.send(self["@tempVariables"],"_add_",[temp]);
  14790. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[temp]),"__comma",["=nil;"])]);
  14791. $2=smalltalk.send(self["@stream"],"_lf",[]);
  14792. return $2;
  14793. })]);
  14794. index=(0);
  14795. index;
  14796. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  14797. index=smalltalk.send(index,"__plus",[(1)]);
  14798. index;
  14799. $3=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  14800. if(smalltalk.assert($3)){
  14801. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  14802. };
  14803. smalltalk.send(self,"_visit_",[each]);
  14804. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  14805. })]);
  14806. };
  14807. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__minus",[(1)]);
  14808. return self},
  14809. args: ["aNode"],
  14810. 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",
  14811. messageSends: ["+", "ifTrue:ifFalse:", "nextPutAll:", "do:", "safeVariableNameFor:", "add:", ",", "lf", "temps", "ifTrue:", "=", "size", "nodes", "visit:", "isEmpty", "-"],
  14812. referencedClasses: []
  14813. }),
  14814. smalltalk.FunCodeGenerator);
  14815. smalltalk.addMethod(
  14816. "_visitCascadeNode_",
  14817. smalltalk.method({
  14818. selector: "visitCascadeNode:",
  14819. category: 'visiting',
  14820. fn: function (aNode){
  14821. var self=this;
  14822. var $1,$2;
  14823. var index;
  14824. index=(0);
  14825. $1=smalltalk.send(self["@tempVariables"],"_includes_",["$rec"]);
  14826. if(! smalltalk.assert($1)){
  14827. smalltalk.send(self["@tempVariables"],"_add_",["$rec"]);
  14828. };
  14829. smalltalk.send(self["@stream"],"_nextPutAll_",["(function($rec){"]);
  14830. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  14831. index=smalltalk.send(index,"__plus",[(1)]);
  14832. index;
  14833. $2=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  14834. if(smalltalk.assert($2)){
  14835. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  14836. };
  14837. smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_value_",["$rec"])]);
  14838. smalltalk.send(self,"_visit_",[each]);
  14839. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  14840. })]);
  14841. smalltalk.send(self["@stream"],"_nextPutAll_",["})("]);
  14842. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
  14843. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  14844. return self},
  14845. args: ["aNode"],
  14846. 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: ')'",
  14847. messageSends: ["ifFalse:", "add:", "includes:", "nextPutAll:", "do:", "+", "ifTrue:", "=", "size", "nodes", "receiver:", "value:", "new", "visit:", "receiver"],
  14848. referencedClasses: ["VariableNode"]
  14849. }),
  14850. smalltalk.FunCodeGenerator);
  14851. smalltalk.addMethod(
  14852. "_visitClassReferenceNode_",
  14853. smalltalk.method({
  14854. selector: "visitClassReferenceNode:",
  14855. category: 'visiting',
  14856. fn: function (aNode){
  14857. var self=this;
  14858. var $1;
  14859. $1=smalltalk.send(self["@referencedClasses"],"_includes_",[smalltalk.send(aNode,"_value",[])]);
  14860. if(! smalltalk.assert($1)){
  14861. smalltalk.send(self["@referencedClasses"],"_add_",[smalltalk.send(aNode,"_value",[])]);
  14862. };
  14863. 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",[")"])]);
  14864. return self},
  14865. args: ["aNode"],
  14866. source: "visitClassReferenceNode: aNode\x0a\x09(referencedClasses includes: aNode value) ifFalse: [\x0a\x09\x09referencedClasses add: aNode value].\x0a\x09stream nextPutAll: '(smalltalk.', aNode value, ' || ', aNode value, ')'",
  14867. messageSends: ["ifFalse:", "add:", "value", "includes:", "nextPutAll:", ","],
  14868. referencedClasses: []
  14869. }),
  14870. smalltalk.FunCodeGenerator);
  14871. smalltalk.addMethod(
  14872. "_visitDynamicArrayNode_",
  14873. smalltalk.method({
  14874. selector: "visitDynamicArrayNode:",
  14875. category: 'visiting',
  14876. fn: function (aNode){
  14877. var self=this;
  14878. smalltalk.send(self["@stream"],"_nextPutAll_",["["]);
  14879. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  14880. return smalltalk.send(self,"_visit_",[each]);
  14881. }),(function(){
  14882. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  14883. })]);
  14884. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  14885. return self},
  14886. args: ["aNode"],
  14887. source: "visitDynamicArrayNode: aNode\x0a\x09stream nextPutAll: '['.\x0a\x09aNode nodes \x0a\x09\x09do: [:each | self visit: each]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'",
  14888. messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
  14889. referencedClasses: []
  14890. }),
  14891. smalltalk.FunCodeGenerator);
  14892. smalltalk.addMethod(
  14893. "_visitDynamicDictionaryNode_",
  14894. smalltalk.method({
  14895. selector: "visitDynamicDictionaryNode:",
  14896. category: 'visiting',
  14897. fn: function (aNode){
  14898. var self=this;
  14899. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  14900. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  14901. return smalltalk.send(self,"_visit_",[each]);
  14902. }),(function(){
  14903. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  14904. })]);
  14905. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  14906. return self},
  14907. args: ["aNode"],
  14908. 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: '])'",
  14909. messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
  14910. referencedClasses: []
  14911. }),
  14912. smalltalk.FunCodeGenerator);
  14913. smalltalk.addMethod(
  14914. "_visitFailure_",
  14915. smalltalk.method({
  14916. selector: "visitFailure:",
  14917. category: 'visiting',
  14918. fn: function (aFailure){
  14919. var self=this;
  14920. smalltalk.send(self,"_error_",[smalltalk.send(aFailure,"_asString",[])]);
  14921. return self},
  14922. args: ["aFailure"],
  14923. source: "visitFailure: aFailure\x0a\x09self error: aFailure asString",
  14924. messageSends: ["error:", "asString"],
  14925. referencedClasses: []
  14926. }),
  14927. smalltalk.FunCodeGenerator);
  14928. smalltalk.addMethod(
  14929. "_visitJSStatementNode_",
  14930. smalltalk.method({
  14931. selector: "visitJSStatementNode:",
  14932. category: 'visiting',
  14933. fn: function (aNode){
  14934. var self=this;
  14935. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(aNode,"_source",[])]);
  14936. return self},
  14937. args: ["aNode"],
  14938. source: "visitJSStatementNode: aNode\x0a\x09stream nextPutAll: aNode source",
  14939. messageSends: ["nextPutAll:", "source"],
  14940. referencedClasses: []
  14941. }),
  14942. smalltalk.FunCodeGenerator);
  14943. smalltalk.addMethod(
  14944. "_visitMethodNode_",
  14945. smalltalk.method({
  14946. selector: "visitMethodNode:",
  14947. category: 'visiting',
  14948. fn: function (aNode) {
  14949. var self=this;
  14950. var str=nil;
  14951. var currentSelector=nil;
  14952. (self['@currentSelector']=smalltalk.send(smalltalk.send(aNode, "_selector", []), "_asSelector", []));
  14953. (self['@nestedBlocks']=(0));
  14954. (self['@earlyReturn']=false);
  14955. (self['@messageSends']=[]);
  14956. (self['@referencedClasses']=[]);
  14957. (self['@unknownVariables']=[]);
  14958. (self['@tempVariables']=[]);
  14959. (self['@argVariables']=[]);
  14960. (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']);
  14961. (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']);
  14962. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  14963. 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_", [", "]);})]);
  14964. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  14965. (str=self['@stream']);
  14966. (self['@stream']=smalltalk.send("", "_writeStream", []));
  14967. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  14968. ((($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);})]));
  14969. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(self['@stream'], "_contents", [])]);
  14970. (self['@stream']=str);
  14971. (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["return self;"]);})(self['@stream']);
  14972. ((($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']);})]));
  14973. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  14974. (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']);
  14975. 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_", [","]);})]);
  14976. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  14977. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  14978. return self;},
  14979. args: ["aNode"],
  14980. 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: '})'",
  14981. messageSends: ["asSelector", "selector", "nextPutAll:", "lf", ",", "asJavascript", "source", "do:separatedBy:", "arguments", "add:", "writeStream", "do:", "nodes", "visit:", "ifTrue:", "contents", "printString"],
  14982. referencedClasses: ["String"]
  14983. }),
  14984. smalltalk.FunCodeGenerator);
  14985. smalltalk.addMethod(
  14986. "_visitReturnNode_",
  14987. smalltalk.method({
  14988. selector: "visitReturnNode:",
  14989. category: 'visiting',
  14990. fn: function (aNode) {
  14991. var self=this;
  14992. ((($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);})]));
  14993. ((($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 "]);})]));
  14994. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  14995. ((($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_", ["]})()"]);})]));
  14996. return self;},
  14997. args: ["aNode"],
  14998. 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: ']})()']",
  14999. messageSends: ["ifTrue:", ">", "ifTrue:ifFalse:", "nextPutAll:", "do:", "nodes", "visit:"],
  15000. referencedClasses: []
  15001. }),
  15002. smalltalk.FunCodeGenerator);
  15003. smalltalk.addMethod(
  15004. "_visitSendNode_",
  15005. smalltalk.method({
  15006. selector: "visitSendNode:",
  15007. category: 'visiting',
  15008. fn: function (aNode) {
  15009. var self=this;
  15010. var str=nil;
  15011. var receiver=nil;
  15012. var superSend=nil;
  15013. var inlined=nil;
  15014. (str=self['@stream']);
  15015. ((($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", [])]);})]));
  15016. (self['@stream']=smalltalk.send("", "_writeStream", []));
  15017. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
  15018. (superSend=smalltalk.send(smalltalk.send(self['@stream'], "_contents", []), "__eq", ["super"]));
  15019. (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", []);})])));
  15020. (self['@stream']=str);
  15021. ((($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])]);})]));
  15022. return self;},
  15023. args: ["aNode"],
  15024. 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)]",
  15025. messageSends: ["ifFalse:", "includes:", "selector", "add:", "writeStream", "visit:", "receiver", "=", "contents", "ifTrue:ifFalse:", "performOptimizations", "inlineLiteral:receiverNode:argumentNodes:", "arguments", "inline:receiver:argumentNodes:", "nextPutAll:", ",", "send:to:arguments:superSend:"],
  15026. referencedClasses: []
  15027. }),
  15028. smalltalk.FunCodeGenerator);
  15029. smalltalk.addMethod(
  15030. "_visitSequenceNode_",
  15031. smalltalk.method({
  15032. selector: "visitSequenceNode:",
  15033. category: 'visiting',
  15034. fn: function (aNode) {
  15035. var self=this;
  15036. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  15037. (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']);})]);
  15038. 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", []);})]);
  15039. return self;},
  15040. args: ["aNode"],
  15041. 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]",
  15042. messageSends: ["do:", "temps", "safeVariableNameFor:", "add:", "nextPutAll:", ",", "lf", "do:separatedBy:", "nodes", "visit:"],
  15043. referencedClasses: []
  15044. }),
  15045. smalltalk.FunCodeGenerator);
  15046. smalltalk.addMethod(
  15047. "_visitValueNode_",
  15048. smalltalk.method({
  15049. selector: "visitValueNode:",
  15050. category: 'visiting',
  15051. fn: function (aNode) {
  15052. var self=this;
  15053. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_value", []), "_asJavascript", [])]);
  15054. return self;},
  15055. args: ["aNode"],
  15056. source: "visitValueNode: aNode\x0a\x09stream nextPutAll: aNode value asJavascript",
  15057. messageSends: ["nextPutAll:", "asJavascript", "value"],
  15058. referencedClasses: []
  15059. }),
  15060. smalltalk.FunCodeGenerator);
  15061. smalltalk.addMethod(
  15062. "_visitVariableNode_",
  15063. smalltalk.method({
  15064. selector: "visitVariableNode:",
  15065. category: 'visiting',
  15066. fn: function (aNode) {
  15067. var self=this;
  15068. var varName=nil;
  15069. ((($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]);})]));})]));})]));
  15070. return self;},
  15071. args: ["aNode"],
  15072. 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]]]",
  15073. messageSends: ["ifTrue:ifFalse:", "includes:", "allInstanceVariableNames", "currentClass", "value", "nextPutAll:", ",", "safeVariableNameFor:", "ifFalse:ifTrue:", "knownVariables", "add:", "assigned", "="],
  15074. referencedClasses: []
  15075. }),
  15076. smalltalk.FunCodeGenerator);
  15077. smalltalk.FunCodeGenerator.klass.iVarNames = ['performOptimizations'];
  15078. smalltalk.addMethod(
  15079. "_performOptimizations",
  15080. smalltalk.method({
  15081. selector: "performOptimizations",
  15082. category: 'accessing',
  15083. fn: function () {
  15084. var self=this;
  15085. return (($receiver = self['@performOptimizations']) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver;
  15086. return self;},
  15087. args: [],
  15088. source: "performOptimizations\x0a\x09^performOptimizations ifNil: [true]",
  15089. messageSends: ["ifNil:"],
  15090. referencedClasses: []
  15091. }),
  15092. smalltalk.FunCodeGenerator.klass);
  15093. smalltalk.addMethod(
  15094. "_performOptimizations_",
  15095. smalltalk.method({
  15096. selector: "performOptimizations:",
  15097. category: 'accessing',
  15098. fn: function (aBoolean) {
  15099. var self=this;
  15100. (self['@performOptimizations']=aBoolean);
  15101. return self;},
  15102. args: ["aBoolean"],
  15103. source: "performOptimizations: aBoolean\x0a\x09performOptimizations := aBoolean",
  15104. messageSends: [],
  15105. referencedClasses: []
  15106. }),
  15107. smalltalk.FunCodeGenerator.klass);
  15108. smalltalk.addPackage('Compiler-Exceptions', {});
  15109. smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
  15110. smalltalk.CompilerError.comment="I am the common superclass of all compiling errors."
  15111. smalltalk.addClass('ParseError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  15112. smalltalk.ParseError.comment="Instance of ParseError are signaled on any parsing error. \x0aSee `Smalltalk >> #parse:`"
  15113. smalltalk.addClass('SemanticError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  15114. 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"
  15115. smalltalk.addClass('InliningError', smalltalk.SemanticError, [], 'Compiler-Exceptions');
  15116. smalltalk.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`."
  15117. smalltalk.addClass('InvalidAssignmentError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15118. smalltalk.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned."
  15119. smalltalk.addMethod(
  15120. "_messageText",
  15121. smalltalk.method({
  15122. selector: "messageText",
  15123. category: 'accessing',
  15124. fn: function (){
  15125. var self=this;
  15126. var $1;
  15127. $1=smalltalk.send(" Invalid assignment to variable: ","__comma",[smalltalk.send(self,"_variableName",[])]);
  15128. return $1;
  15129. },
  15130. args: [],
  15131. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  15132. messageSends: [",", "variableName"],
  15133. referencedClasses: []
  15134. }),
  15135. smalltalk.InvalidAssignmentError);
  15136. smalltalk.addMethod(
  15137. "_variableName",
  15138. smalltalk.method({
  15139. selector: "variableName",
  15140. category: 'accessing',
  15141. fn: function (){
  15142. var self=this;
  15143. return self["@variableName"];
  15144. },
  15145. args: [],
  15146. source: "variableName\x0a\x09^ variableName",
  15147. messageSends: [],
  15148. referencedClasses: []
  15149. }),
  15150. smalltalk.InvalidAssignmentError);
  15151. smalltalk.addMethod(
  15152. "_variableName_",
  15153. smalltalk.method({
  15154. selector: "variableName:",
  15155. category: 'accessing',
  15156. fn: function (aString){
  15157. var self=this;
  15158. self["@variableName"]=aString;
  15159. return self},
  15160. args: ["aString"],
  15161. source: "variableName: aString\x0a\x09variableName := aString",
  15162. messageSends: [],
  15163. referencedClasses: []
  15164. }),
  15165. smalltalk.InvalidAssignmentError);
  15166. smalltalk.addClass('ShadowingVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15167. 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."
  15168. smalltalk.addMethod(
  15169. "_messageText",
  15170. smalltalk.method({
  15171. selector: "messageText",
  15172. category: 'accessing',
  15173. fn: function (){
  15174. var self=this;
  15175. var $1;
  15176. $1=smalltalk.send(smalltalk.send("Variable shadowing error: ","__comma",[smalltalk.send(self,"_variableName",[])]),"__comma",[" is already defined"]);
  15177. return $1;
  15178. },
  15179. args: [],
  15180. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  15181. messageSends: [",", "variableName"],
  15182. referencedClasses: []
  15183. }),
  15184. smalltalk.ShadowingVariableError);
  15185. smalltalk.addMethod(
  15186. "_variableName",
  15187. smalltalk.method({
  15188. selector: "variableName",
  15189. category: 'accessing',
  15190. fn: function (){
  15191. var self=this;
  15192. return self["@variableName"];
  15193. },
  15194. args: [],
  15195. source: "variableName\x0a\x09^ variableName",
  15196. messageSends: [],
  15197. referencedClasses: []
  15198. }),
  15199. smalltalk.ShadowingVariableError);
  15200. smalltalk.addMethod(
  15201. "_variableName_",
  15202. smalltalk.method({
  15203. selector: "variableName:",
  15204. category: 'accessing',
  15205. fn: function (aString){
  15206. var self=this;
  15207. self["@variableName"]=aString;
  15208. return self},
  15209. args: ["aString"],
  15210. source: "variableName: aString\x0a\x09variableName := aString",
  15211. messageSends: [],
  15212. referencedClasses: []
  15213. }),
  15214. smalltalk.ShadowingVariableError);
  15215. smalltalk.addClass('UnknownVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  15216. 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."
  15217. smalltalk.addMethod(
  15218. "_variableName",
  15219. smalltalk.method({
  15220. selector: "variableName",
  15221. category: 'accessing',
  15222. fn: function (){
  15223. var self=this;
  15224. return self["@variableName"];
  15225. },
  15226. args: [],
  15227. source: "variableName\x0a\x09^ variableName",
  15228. messageSends: [],
  15229. referencedClasses: []
  15230. }),
  15231. smalltalk.UnknownVariableError);
  15232. smalltalk.addMethod(
  15233. "_variableName_",
  15234. smalltalk.method({
  15235. selector: "variableName:",
  15236. category: 'accessing',
  15237. fn: function (aString){
  15238. var self=this;
  15239. self["@variableName"]=aString;
  15240. return self},
  15241. args: ["aString"],
  15242. source: "variableName: aString\x0a\x09variableName := aString",
  15243. messageSends: [],
  15244. referencedClasses: []
  15245. }),
  15246. smalltalk.UnknownVariableError);
  15247. smalltalk.addPackage('Compiler-AST', {});
  15248. smalltalk.addClass('Node', smalltalk.Object, ['nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  15249. smalltalk.Node.comment="I am the abstract root class of the abstract syntax tree."
  15250. smalltalk.addMethod(
  15251. "_accept_",
  15252. smalltalk.method({
  15253. selector: "accept:",
  15254. category: 'visiting',
  15255. fn: function (aVisitor){
  15256. var self=this;
  15257. var $1;
  15258. $1=smalltalk.send(aVisitor,"_visitNode_",[self]);
  15259. return $1;
  15260. },
  15261. args: ["aVisitor"],
  15262. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  15263. messageSends: ["visitNode:"],
  15264. referencedClasses: []
  15265. }),
  15266. smalltalk.Node);
  15267. smalltalk.addMethod(
  15268. "_addNode_",
  15269. smalltalk.method({
  15270. selector: "addNode:",
  15271. category: 'accessing',
  15272. fn: function (aNode){
  15273. var self=this;
  15274. smalltalk.send(smalltalk.send(self,"_nodes",[]),"_add_",[aNode]);
  15275. return self},
  15276. args: ["aNode"],
  15277. source: "addNode: aNode\x0a\x09self nodes add: aNode",
  15278. messageSends: ["add:", "nodes"],
  15279. referencedClasses: []
  15280. }),
  15281. smalltalk.Node);
  15282. smalltalk.addMethod(
  15283. "_isAssignmentNode",
  15284. smalltalk.method({
  15285. selector: "isAssignmentNode",
  15286. category: 'testing',
  15287. fn: function (){
  15288. var self=this;
  15289. return false;
  15290. },
  15291. args: [],
  15292. source: "isAssignmentNode\x0a\x09^ false",
  15293. messageSends: [],
  15294. referencedClasses: []
  15295. }),
  15296. smalltalk.Node);
  15297. smalltalk.addMethod(
  15298. "_isBlockNode",
  15299. smalltalk.method({
  15300. selector: "isBlockNode",
  15301. category: 'testing',
  15302. fn: function (){
  15303. var self=this;
  15304. return false;
  15305. },
  15306. args: [],
  15307. source: "isBlockNode\x0a\x09^false",
  15308. messageSends: [],
  15309. referencedClasses: []
  15310. }),
  15311. smalltalk.Node);
  15312. smalltalk.addMethod(
  15313. "_isBlockSequenceNode",
  15314. smalltalk.method({
  15315. selector: "isBlockSequenceNode",
  15316. category: 'testing',
  15317. fn: function (){
  15318. var self=this;
  15319. return false;
  15320. },
  15321. args: [],
  15322. source: "isBlockSequenceNode\x0a\x09^false",
  15323. messageSends: [],
  15324. referencedClasses: []
  15325. }),
  15326. smalltalk.Node);
  15327. smalltalk.addMethod(
  15328. "_isReturnNode",
  15329. smalltalk.method({
  15330. selector: "isReturnNode",
  15331. category: 'testing',
  15332. fn: function (){
  15333. var self=this;
  15334. return false;
  15335. },
  15336. args: [],
  15337. source: "isReturnNode\x0a\x09^false",
  15338. messageSends: [],
  15339. referencedClasses: []
  15340. }),
  15341. smalltalk.Node);
  15342. smalltalk.addMethod(
  15343. "_isSendNode",
  15344. smalltalk.method({
  15345. selector: "isSendNode",
  15346. category: 'testing',
  15347. fn: function (){
  15348. var self=this;
  15349. return false;
  15350. },
  15351. args: [],
  15352. source: "isSendNode\x0a\x09^false",
  15353. messageSends: [],
  15354. referencedClasses: []
  15355. }),
  15356. smalltalk.Node);
  15357. smalltalk.addMethod(
  15358. "_isValueNode",
  15359. smalltalk.method({
  15360. selector: "isValueNode",
  15361. category: 'testing',
  15362. fn: function (){
  15363. var self=this;
  15364. return false;
  15365. },
  15366. args: [],
  15367. source: "isValueNode\x0a\x09^false",
  15368. messageSends: [],
  15369. referencedClasses: []
  15370. }),
  15371. smalltalk.Node);
  15372. smalltalk.addMethod(
  15373. "_nodes",
  15374. smalltalk.method({
  15375. selector: "nodes",
  15376. category: 'accessing',
  15377. fn: function (){
  15378. var self=this;
  15379. var $1;
  15380. if(($receiver = self["@nodes"]) == nil || $receiver == undefined){
  15381. self["@nodes"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  15382. $1=self["@nodes"];
  15383. } else {
  15384. $1=self["@nodes"];
  15385. };
  15386. return $1;
  15387. },
  15388. args: [],
  15389. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  15390. messageSends: ["ifNil:", "new"],
  15391. referencedClasses: ["Array"]
  15392. }),
  15393. smalltalk.Node);
  15394. smalltalk.addMethod(
  15395. "_nodes_",
  15396. smalltalk.method({
  15397. selector: "nodes:",
  15398. category: 'building',
  15399. fn: function (aCollection){
  15400. var self=this;
  15401. self["@nodes"]=aCollection;
  15402. return self},
  15403. args: ["aCollection"],
  15404. source: "nodes: aCollection\x0a\x09nodes := aCollection",
  15405. messageSends: [],
  15406. referencedClasses: []
  15407. }),
  15408. smalltalk.Node);
  15409. smalltalk.addMethod(
  15410. "_shouldBeAliased",
  15411. smalltalk.method({
  15412. selector: "shouldBeAliased",
  15413. category: 'accessing',
  15414. fn: function (){
  15415. var self=this;
  15416. var $1;
  15417. if(($receiver = self["@shouldBeAliased"]) == nil || $receiver == undefined){
  15418. $1=false;
  15419. } else {
  15420. $1=self["@shouldBeAliased"];
  15421. };
  15422. return $1;
  15423. },
  15424. args: [],
  15425. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  15426. messageSends: ["ifNil:"],
  15427. referencedClasses: []
  15428. }),
  15429. smalltalk.Node);
  15430. smalltalk.addMethod(
  15431. "_shouldBeAliased_",
  15432. smalltalk.method({
  15433. selector: "shouldBeAliased:",
  15434. category: 'accessing',
  15435. fn: function (aBoolean){
  15436. var self=this;
  15437. self["@shouldBeAliased"]=aBoolean;
  15438. return self},
  15439. args: ["aBoolean"],
  15440. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  15441. messageSends: [],
  15442. referencedClasses: []
  15443. }),
  15444. smalltalk.Node);
  15445. smalltalk.addMethod(
  15446. "_shouldBeInlined",
  15447. smalltalk.method({
  15448. selector: "shouldBeInlined",
  15449. category: 'accessing',
  15450. fn: function (){
  15451. var self=this;
  15452. var $1;
  15453. if(($receiver = self["@shouldBeInlined"]) == nil || $receiver == undefined){
  15454. $1=false;
  15455. } else {
  15456. $1=self["@shouldBeInlined"];
  15457. };
  15458. return $1;
  15459. },
  15460. args: [],
  15461. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  15462. messageSends: ["ifNil:"],
  15463. referencedClasses: []
  15464. }),
  15465. smalltalk.Node);
  15466. smalltalk.addMethod(
  15467. "_shouldBeInlined_",
  15468. smalltalk.method({
  15469. selector: "shouldBeInlined:",
  15470. category: 'accessing',
  15471. fn: function (aBoolean){
  15472. var self=this;
  15473. self["@shouldBeInlined"]=aBoolean;
  15474. return self},
  15475. args: ["aBoolean"],
  15476. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  15477. messageSends: [],
  15478. referencedClasses: []
  15479. }),
  15480. smalltalk.Node);
  15481. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler-AST');
  15482. smalltalk.addMethod(
  15483. "_accept_",
  15484. smalltalk.method({
  15485. selector: "accept:",
  15486. category: 'visiting',
  15487. fn: function (aVisitor){
  15488. var self=this;
  15489. var $1;
  15490. $1=smalltalk.send(aVisitor,"_visitAssignmentNode_",[self]);
  15491. return $1;
  15492. },
  15493. args: ["aVisitor"],
  15494. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  15495. messageSends: ["visitAssignmentNode:"],
  15496. referencedClasses: []
  15497. }),
  15498. smalltalk.AssignmentNode);
  15499. smalltalk.addMethod(
  15500. "_isAssignmentNode",
  15501. smalltalk.method({
  15502. selector: "isAssignmentNode",
  15503. category: 'testing',
  15504. fn: function (){
  15505. var self=this;
  15506. return true;
  15507. },
  15508. args: [],
  15509. source: "isAssignmentNode\x0a\x09^ true",
  15510. messageSends: [],
  15511. referencedClasses: []
  15512. }),
  15513. smalltalk.AssignmentNode);
  15514. smalltalk.addMethod(
  15515. "_left",
  15516. smalltalk.method({
  15517. selector: "left",
  15518. category: 'accessing',
  15519. fn: function (){
  15520. var self=this;
  15521. return self["@left"];
  15522. },
  15523. args: [],
  15524. source: "left\x0a\x09^left",
  15525. messageSends: [],
  15526. referencedClasses: []
  15527. }),
  15528. smalltalk.AssignmentNode);
  15529. smalltalk.addMethod(
  15530. "_left_",
  15531. smalltalk.method({
  15532. selector: "left:",
  15533. category: 'accessing',
  15534. fn: function (aNode){
  15535. var self=this;
  15536. self["@left"]=aNode;
  15537. return self},
  15538. args: ["aNode"],
  15539. source: "left: aNode\x0a\x09left := aNode",
  15540. messageSends: [],
  15541. referencedClasses: []
  15542. }),
  15543. smalltalk.AssignmentNode);
  15544. smalltalk.addMethod(
  15545. "_nodes",
  15546. smalltalk.method({
  15547. selector: "nodes",
  15548. category: 'accessing',
  15549. fn: function (){
  15550. var self=this;
  15551. var $1;
  15552. $1=smalltalk.send((smalltalk.Array || Array),"_with_with_",[smalltalk.send(self,"_left",[]),smalltalk.send(self,"_right",[])]);
  15553. return $1;
  15554. },
  15555. args: [],
  15556. source: "nodes\x0a\x09^ Array with: self left with: self right",
  15557. messageSends: ["with:with:", "left", "right"],
  15558. referencedClasses: ["Array"]
  15559. }),
  15560. smalltalk.AssignmentNode);
  15561. smalltalk.addMethod(
  15562. "_right",
  15563. smalltalk.method({
  15564. selector: "right",
  15565. category: 'accessing',
  15566. fn: function (){
  15567. var self=this;
  15568. return self["@right"];
  15569. },
  15570. args: [],
  15571. source: "right\x0a\x09^right",
  15572. messageSends: [],
  15573. referencedClasses: []
  15574. }),
  15575. smalltalk.AssignmentNode);
  15576. smalltalk.addMethod(
  15577. "_right_",
  15578. smalltalk.method({
  15579. selector: "right:",
  15580. category: 'accessing',
  15581. fn: function (aNode){
  15582. var self=this;
  15583. self["@right"]=aNode;
  15584. return self},
  15585. args: ["aNode"],
  15586. source: "right: aNode\x0a\x09right := aNode",
  15587. messageSends: [],
  15588. referencedClasses: []
  15589. }),
  15590. smalltalk.AssignmentNode);
  15591. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'scope'], 'Compiler-AST');
  15592. smalltalk.addMethod(
  15593. "_accept_",
  15594. smalltalk.method({
  15595. selector: "accept:",
  15596. category: 'visiting',
  15597. fn: function (aVisitor){
  15598. var self=this;
  15599. var $1;
  15600. $1=smalltalk.send(aVisitor,"_visitBlockNode_",[self]);
  15601. return $1;
  15602. },
  15603. args: ["aVisitor"],
  15604. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  15605. messageSends: ["visitBlockNode:"],
  15606. referencedClasses: []
  15607. }),
  15608. smalltalk.BlockNode);
  15609. smalltalk.addMethod(
  15610. "_isBlockNode",
  15611. smalltalk.method({
  15612. selector: "isBlockNode",
  15613. category: 'testing',
  15614. fn: function (){
  15615. var self=this;
  15616. return true;
  15617. },
  15618. args: [],
  15619. source: "isBlockNode\x0a\x09^true",
  15620. messageSends: [],
  15621. referencedClasses: []
  15622. }),
  15623. smalltalk.BlockNode);
  15624. smalltalk.addMethod(
  15625. "_parameters",
  15626. smalltalk.method({
  15627. selector: "parameters",
  15628. category: 'accessing',
  15629. fn: function (){
  15630. var self=this;
  15631. var $1;
  15632. if(($receiver = self["@parameters"]) == nil || $receiver == undefined){
  15633. self["@parameters"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  15634. $1=self["@parameters"];
  15635. } else {
  15636. $1=self["@parameters"];
  15637. };
  15638. return $1;
  15639. },
  15640. args: [],
  15641. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  15642. messageSends: ["ifNil:", "new"],
  15643. referencedClasses: ["Array"]
  15644. }),
  15645. smalltalk.BlockNode);
  15646. smalltalk.addMethod(
  15647. "_parameters_",
  15648. smalltalk.method({
  15649. selector: "parameters:",
  15650. category: 'accessing',
  15651. fn: function (aCollection){
  15652. var self=this;
  15653. self["@parameters"]=aCollection;
  15654. return self},
  15655. args: ["aCollection"],
  15656. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  15657. messageSends: [],
  15658. referencedClasses: []
  15659. }),
  15660. smalltalk.BlockNode);
  15661. smalltalk.addMethod(
  15662. "_scope",
  15663. smalltalk.method({
  15664. selector: "scope",
  15665. category: 'accessing',
  15666. fn: function (){
  15667. var self=this;
  15668. return self["@scope"];
  15669. },
  15670. args: [],
  15671. source: "scope\x0a\x09^ scope",
  15672. messageSends: [],
  15673. referencedClasses: []
  15674. }),
  15675. smalltalk.BlockNode);
  15676. smalltalk.addMethod(
  15677. "_scope_",
  15678. smalltalk.method({
  15679. selector: "scope:",
  15680. category: 'accessing',
  15681. fn: function (aLexicalScope){
  15682. var self=this;
  15683. self["@scope"]=aLexicalScope;
  15684. return self},
  15685. args: ["aLexicalScope"],
  15686. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  15687. messageSends: [],
  15688. referencedClasses: []
  15689. }),
  15690. smalltalk.BlockNode);
  15691. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler-AST');
  15692. smalltalk.addMethod(
  15693. "_accept_",
  15694. smalltalk.method({
  15695. selector: "accept:",
  15696. category: 'visiting',
  15697. fn: function (aVisitor){
  15698. var self=this;
  15699. var $1;
  15700. $1=smalltalk.send(aVisitor,"_visitCascadeNode_",[self]);
  15701. return $1;
  15702. },
  15703. args: ["aVisitor"],
  15704. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  15705. messageSends: ["visitCascadeNode:"],
  15706. referencedClasses: []
  15707. }),
  15708. smalltalk.CascadeNode);
  15709. smalltalk.addMethod(
  15710. "_receiver",
  15711. smalltalk.method({
  15712. selector: "receiver",
  15713. category: 'accessing',
  15714. fn: function (){
  15715. var self=this;
  15716. return self["@receiver"];
  15717. },
  15718. args: [],
  15719. source: "receiver\x0a\x09^receiver",
  15720. messageSends: [],
  15721. referencedClasses: []
  15722. }),
  15723. smalltalk.CascadeNode);
  15724. smalltalk.addMethod(
  15725. "_receiver_",
  15726. smalltalk.method({
  15727. selector: "receiver:",
  15728. category: 'accessing',
  15729. fn: function (aNode){
  15730. var self=this;
  15731. self["@receiver"]=aNode;
  15732. return self},
  15733. args: ["aNode"],
  15734. source: "receiver: aNode\x0a\x09receiver := aNode",
  15735. messageSends: [],
  15736. referencedClasses: []
  15737. }),
  15738. smalltalk.CascadeNode);
  15739. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler-AST');
  15740. smalltalk.addMethod(
  15741. "_accept_",
  15742. smalltalk.method({
  15743. selector: "accept:",
  15744. category: 'visiting',
  15745. fn: function (aVisitor){
  15746. var self=this;
  15747. var $1;
  15748. $1=smalltalk.send(aVisitor,"_visitDynamicArrayNode_",[self]);
  15749. return $1;
  15750. },
  15751. args: ["aVisitor"],
  15752. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  15753. messageSends: ["visitDynamicArrayNode:"],
  15754. referencedClasses: []
  15755. }),
  15756. smalltalk.DynamicArrayNode);
  15757. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler-AST');
  15758. smalltalk.addMethod(
  15759. "_accept_",
  15760. smalltalk.method({
  15761. selector: "accept:",
  15762. category: 'visiting',
  15763. fn: function (aVisitor){
  15764. var self=this;
  15765. var $1;
  15766. $1=smalltalk.send(aVisitor,"_visitDynamicDictionaryNode_",[self]);
  15767. return $1;
  15768. },
  15769. args: ["aVisitor"],
  15770. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  15771. messageSends: ["visitDynamicDictionaryNode:"],
  15772. referencedClasses: []
  15773. }),
  15774. smalltalk.DynamicDictionaryNode);
  15775. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler-AST');
  15776. smalltalk.addMethod(
  15777. "_accept_",
  15778. smalltalk.method({
  15779. selector: "accept:",
  15780. category: 'visiting',
  15781. fn: function (aVisitor){
  15782. var self=this;
  15783. var $1;
  15784. $1=smalltalk.send(aVisitor,"_visitJSStatementNode_",[self]);
  15785. return $1;
  15786. },
  15787. args: ["aVisitor"],
  15788. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  15789. messageSends: ["visitJSStatementNode:"],
  15790. referencedClasses: []
  15791. }),
  15792. smalltalk.JSStatementNode);
  15793. smalltalk.addMethod(
  15794. "_source",
  15795. smalltalk.method({
  15796. selector: "source",
  15797. category: 'accessing',
  15798. fn: function (){
  15799. var self=this;
  15800. var $1;
  15801. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  15802. $1="";
  15803. } else {
  15804. $1=self["@source"];
  15805. };
  15806. return $1;
  15807. },
  15808. args: [],
  15809. source: "source\x0a\x09^source ifNil: ['']",
  15810. messageSends: ["ifNil:"],
  15811. referencedClasses: []
  15812. }),
  15813. smalltalk.JSStatementNode);
  15814. smalltalk.addMethod(
  15815. "_source_",
  15816. smalltalk.method({
  15817. selector: "source:",
  15818. category: 'accessing',
  15819. fn: function (aString){
  15820. var self=this;
  15821. self["@source"]=aString;
  15822. return self},
  15823. args: ["aString"],
  15824. source: "source: aString\x0a\x09source := aString",
  15825. messageSends: [],
  15826. referencedClasses: []
  15827. }),
  15828. smalltalk.JSStatementNode);
  15829. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'messageSends'], 'Compiler-AST');
  15830. smalltalk.addMethod(
  15831. "_accept_",
  15832. smalltalk.method({
  15833. selector: "accept:",
  15834. category: 'visiting',
  15835. fn: function (aVisitor){
  15836. var self=this;
  15837. var $1;
  15838. $1=smalltalk.send(aVisitor,"_visitMethodNode_",[self]);
  15839. return $1;
  15840. },
  15841. args: ["aVisitor"],
  15842. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  15843. messageSends: ["visitMethodNode:"],
  15844. referencedClasses: []
  15845. }),
  15846. smalltalk.MethodNode);
  15847. smalltalk.addMethod(
  15848. "_arguments",
  15849. smalltalk.method({
  15850. selector: "arguments",
  15851. category: 'accessing',
  15852. fn: function (){
  15853. var self=this;
  15854. var $1;
  15855. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  15856. $1=[];
  15857. } else {
  15858. $1=self["@arguments"];
  15859. };
  15860. return $1;
  15861. },
  15862. args: [],
  15863. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  15864. messageSends: ["ifNil:"],
  15865. referencedClasses: []
  15866. }),
  15867. smalltalk.MethodNode);
  15868. smalltalk.addMethod(
  15869. "_arguments_",
  15870. smalltalk.method({
  15871. selector: "arguments:",
  15872. category: 'accessing',
  15873. fn: function (aCollection){
  15874. var self=this;
  15875. self["@arguments"]=aCollection;
  15876. return self},
  15877. args: ["aCollection"],
  15878. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  15879. messageSends: [],
  15880. referencedClasses: []
  15881. }),
  15882. smalltalk.MethodNode);
  15883. smalltalk.addMethod(
  15884. "_classReferences",
  15885. smalltalk.method({
  15886. selector: "classReferences",
  15887. category: 'accessing',
  15888. fn: function (){
  15889. var self=this;
  15890. return self["@classReferences"];
  15891. },
  15892. args: [],
  15893. source: "classReferences\x0a\x09^ classReferences",
  15894. messageSends: [],
  15895. referencedClasses: []
  15896. }),
  15897. smalltalk.MethodNode);
  15898. smalltalk.addMethod(
  15899. "_classReferences_",
  15900. smalltalk.method({
  15901. selector: "classReferences:",
  15902. category: 'accessing',
  15903. fn: function (aCollection){
  15904. var self=this;
  15905. self["@classReferences"]=aCollection;
  15906. return self},
  15907. args: ["aCollection"],
  15908. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  15909. messageSends: [],
  15910. referencedClasses: []
  15911. }),
  15912. smalltalk.MethodNode);
  15913. smalltalk.addMethod(
  15914. "_messageSends",
  15915. smalltalk.method({
  15916. selector: "messageSends",
  15917. category: 'accessing',
  15918. fn: function (){
  15919. var self=this;
  15920. return self["@messageSends"];
  15921. },
  15922. args: [],
  15923. source: "messageSends\x0a\x09^ messageSends",
  15924. messageSends: [],
  15925. referencedClasses: []
  15926. }),
  15927. smalltalk.MethodNode);
  15928. smalltalk.addMethod(
  15929. "_messageSends_",
  15930. smalltalk.method({
  15931. selector: "messageSends:",
  15932. category: 'accessing',
  15933. fn: function (aCollection){
  15934. var self=this;
  15935. self["@messageSends"]=aCollection;
  15936. return self},
  15937. args: ["aCollection"],
  15938. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  15939. messageSends: [],
  15940. referencedClasses: []
  15941. }),
  15942. smalltalk.MethodNode);
  15943. smalltalk.addMethod(
  15944. "_scope",
  15945. smalltalk.method({
  15946. selector: "scope",
  15947. category: 'accessing',
  15948. fn: function (){
  15949. var self=this;
  15950. return self["@scope"];
  15951. },
  15952. args: [],
  15953. source: "scope\x0a\x09^ scope",
  15954. messageSends: [],
  15955. referencedClasses: []
  15956. }),
  15957. smalltalk.MethodNode);
  15958. smalltalk.addMethod(
  15959. "_scope_",
  15960. smalltalk.method({
  15961. selector: "scope:",
  15962. category: 'accessing',
  15963. fn: function (aMethodScope){
  15964. var self=this;
  15965. self["@scope"]=aMethodScope;
  15966. return self},
  15967. args: ["aMethodScope"],
  15968. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  15969. messageSends: [],
  15970. referencedClasses: []
  15971. }),
  15972. smalltalk.MethodNode);
  15973. smalltalk.addMethod(
  15974. "_selector",
  15975. smalltalk.method({
  15976. selector: "selector",
  15977. category: 'accessing',
  15978. fn: function (){
  15979. var self=this;
  15980. return self["@selector"];
  15981. },
  15982. args: [],
  15983. source: "selector\x0a\x09^selector",
  15984. messageSends: [],
  15985. referencedClasses: []
  15986. }),
  15987. smalltalk.MethodNode);
  15988. smalltalk.addMethod(
  15989. "_selector_",
  15990. smalltalk.method({
  15991. selector: "selector:",
  15992. category: 'accessing',
  15993. fn: function (aString){
  15994. var self=this;
  15995. self["@selector"]=aString;
  15996. return self},
  15997. args: ["aString"],
  15998. source: "selector: aString\x0a\x09selector := aString",
  15999. messageSends: [],
  16000. referencedClasses: []
  16001. }),
  16002. smalltalk.MethodNode);
  16003. smalltalk.addMethod(
  16004. "_source",
  16005. smalltalk.method({
  16006. selector: "source",
  16007. category: 'accessing',
  16008. fn: function (){
  16009. var self=this;
  16010. return self["@source"];
  16011. },
  16012. args: [],
  16013. source: "source\x0a\x09^source",
  16014. messageSends: [],
  16015. referencedClasses: []
  16016. }),
  16017. smalltalk.MethodNode);
  16018. smalltalk.addMethod(
  16019. "_source_",
  16020. smalltalk.method({
  16021. selector: "source:",
  16022. category: 'accessing',
  16023. fn: function (aString){
  16024. var self=this;
  16025. self["@source"]=aString;
  16026. return self},
  16027. args: ["aString"],
  16028. source: "source: aString\x0a\x09source := aString",
  16029. messageSends: [],
  16030. referencedClasses: []
  16031. }),
  16032. smalltalk.MethodNode);
  16033. smalltalk.addClass('ReturnNode', smalltalk.Node, ['scope'], 'Compiler-AST');
  16034. smalltalk.addMethod(
  16035. "_accept_",
  16036. smalltalk.method({
  16037. selector: "accept:",
  16038. category: 'visiting',
  16039. fn: function (aVisitor){
  16040. var self=this;
  16041. var $1;
  16042. $1=smalltalk.send(aVisitor,"_visitReturnNode_",[self]);
  16043. return $1;
  16044. },
  16045. args: ["aVisitor"],
  16046. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  16047. messageSends: ["visitReturnNode:"],
  16048. referencedClasses: []
  16049. }),
  16050. smalltalk.ReturnNode);
  16051. smalltalk.addMethod(
  16052. "_isReturnNode",
  16053. smalltalk.method({
  16054. selector: "isReturnNode",
  16055. category: 'testing',
  16056. fn: function (){
  16057. var self=this;
  16058. return true;
  16059. },
  16060. args: [],
  16061. source: "isReturnNode\x0a\x09^ true",
  16062. messageSends: [],
  16063. referencedClasses: []
  16064. }),
  16065. smalltalk.ReturnNode);
  16066. smalltalk.addMethod(
  16067. "_nonLocalReturn",
  16068. smalltalk.method({
  16069. selector: "nonLocalReturn",
  16070. category: 'testing',
  16071. fn: function (){
  16072. var self=this;
  16073. var $1;
  16074. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_scope",[]),"_isMethodScope",[]),"_not",[]);
  16075. return $1;
  16076. },
  16077. args: [],
  16078. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  16079. messageSends: ["not", "isMethodScope", "scope"],
  16080. referencedClasses: []
  16081. }),
  16082. smalltalk.ReturnNode);
  16083. smalltalk.addMethod(
  16084. "_scope",
  16085. smalltalk.method({
  16086. selector: "scope",
  16087. category: 'accessing',
  16088. fn: function (){
  16089. var self=this;
  16090. return self["@scope"];
  16091. },
  16092. args: [],
  16093. source: "scope\x0a\x09^ scope",
  16094. messageSends: [],
  16095. referencedClasses: []
  16096. }),
  16097. smalltalk.ReturnNode);
  16098. smalltalk.addMethod(
  16099. "_scope_",
  16100. smalltalk.method({
  16101. selector: "scope:",
  16102. category: 'accessing',
  16103. fn: function (aLexicalScope){
  16104. var self=this;
  16105. self["@scope"]=aLexicalScope;
  16106. return self},
  16107. args: ["aLexicalScope"],
  16108. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  16109. messageSends: [],
  16110. referencedClasses: []
  16111. }),
  16112. smalltalk.ReturnNode);
  16113. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  16114. smalltalk.addMethod(
  16115. "_accept_",
  16116. smalltalk.method({
  16117. selector: "accept:",
  16118. category: 'visiting',
  16119. fn: function (aVisitor){
  16120. var self=this;
  16121. var $1;
  16122. $1=smalltalk.send(aVisitor,"_visitSendNode_",[self]);
  16123. return $1;
  16124. },
  16125. args: ["aVisitor"],
  16126. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  16127. messageSends: ["visitSendNode:"],
  16128. referencedClasses: []
  16129. }),
  16130. smalltalk.SendNode);
  16131. smalltalk.addMethod(
  16132. "_arguments",
  16133. smalltalk.method({
  16134. selector: "arguments",
  16135. category: 'accessing',
  16136. fn: function (){
  16137. var self=this;
  16138. var $1;
  16139. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  16140. self["@arguments"]=[];
  16141. $1=self["@arguments"];
  16142. } else {
  16143. $1=self["@arguments"];
  16144. };
  16145. return $1;
  16146. },
  16147. args: [],
  16148. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  16149. messageSends: ["ifNil:"],
  16150. referencedClasses: []
  16151. }),
  16152. smalltalk.SendNode);
  16153. smalltalk.addMethod(
  16154. "_arguments_",
  16155. smalltalk.method({
  16156. selector: "arguments:",
  16157. category: 'accessing',
  16158. fn: function (aCollection){
  16159. var self=this;
  16160. self["@arguments"]=aCollection;
  16161. return self},
  16162. args: ["aCollection"],
  16163. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  16164. messageSends: [],
  16165. referencedClasses: []
  16166. }),
  16167. smalltalk.SendNode);
  16168. smalltalk.addMethod(
  16169. "_cascadeNodeWithMessages_",
  16170. smalltalk.method({
  16171. selector: "cascadeNodeWithMessages:",
  16172. category: 'accessing',
  16173. fn: function (aCollection){
  16174. var self=this;
  16175. var $1,$2,$4,$5,$3;
  16176. var first;
  16177. $1=smalltalk.send((smalltalk.SendNode || SendNode),"_new",[]);
  16178. smalltalk.send($1,"_selector_",[smalltalk.send(self,"_selector",[])]);
  16179. smalltalk.send($1,"_arguments_",[smalltalk.send(self,"_arguments",[])]);
  16180. $2=smalltalk.send($1,"_yourself",[]);
  16181. first=$2;
  16182. $4=smalltalk.send((smalltalk.CascadeNode || CascadeNode),"_new",[]);
  16183. smalltalk.send($4,"_receiver_",[smalltalk.send(self,"_receiver",[])]);
  16184. smalltalk.send($4,"_nodes_",[smalltalk.send(smalltalk.send((smalltalk.Array || Array),"_with_",[first]),"__comma",[aCollection])]);
  16185. $5=smalltalk.send($4,"_yourself",[]);
  16186. $3=$5;
  16187. return $3;
  16188. },
  16189. args: ["aCollection"],
  16190. 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",
  16191. messageSends: ["selector:", "selector", "new", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  16192. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  16193. }),
  16194. smalltalk.SendNode);
  16195. smalltalk.addMethod(
  16196. "_index",
  16197. smalltalk.method({
  16198. selector: "index",
  16199. category: 'accessing',
  16200. fn: function (){
  16201. var self=this;
  16202. return self["@index"];
  16203. },
  16204. args: [],
  16205. source: "index\x0a\x09^ index",
  16206. messageSends: [],
  16207. referencedClasses: []
  16208. }),
  16209. smalltalk.SendNode);
  16210. smalltalk.addMethod(
  16211. "_index_",
  16212. smalltalk.method({
  16213. selector: "index:",
  16214. category: 'accessing',
  16215. fn: function (anInteger){
  16216. var self=this;
  16217. self["@index"]=anInteger;
  16218. return self},
  16219. args: ["anInteger"],
  16220. source: "index: anInteger\x0a\x09index := anInteger",
  16221. messageSends: [],
  16222. referencedClasses: []
  16223. }),
  16224. smalltalk.SendNode);
  16225. smalltalk.addMethod(
  16226. "_isSendNode",
  16227. smalltalk.method({
  16228. selector: "isSendNode",
  16229. category: 'testing',
  16230. fn: function (){
  16231. var self=this;
  16232. return true;
  16233. },
  16234. args: [],
  16235. source: "isSendNode\x0a\x09^ true",
  16236. messageSends: [],
  16237. referencedClasses: []
  16238. }),
  16239. smalltalk.SendNode);
  16240. smalltalk.addMethod(
  16241. "_nodes",
  16242. smalltalk.method({
  16243. selector: "nodes",
  16244. category: 'accessing',
  16245. fn: function (){
  16246. var self=this;
  16247. var $2,$3,$1;
  16248. $2=smalltalk.send((smalltalk.Array || Array),"_withAll_",[smalltalk.send(self,"_arguments",[])]);
  16249. smalltalk.send($2,"_add_",[smalltalk.send(self,"_receiver",[])]);
  16250. $3=smalltalk.send($2,"_yourself",[]);
  16251. $1=$3;
  16252. return $1;
  16253. },
  16254. args: [],
  16255. source: "nodes\x0a\x09^ (Array withAll: self arguments)\x0a\x09\x09add: self receiver;\x0a\x09\x09yourself",
  16256. messageSends: ["add:", "receiver", "withAll:", "arguments", "yourself"],
  16257. referencedClasses: ["Array"]
  16258. }),
  16259. smalltalk.SendNode);
  16260. smalltalk.addMethod(
  16261. "_receiver",
  16262. smalltalk.method({
  16263. selector: "receiver",
  16264. category: 'accessing',
  16265. fn: function (){
  16266. var self=this;
  16267. return self["@receiver"];
  16268. },
  16269. args: [],
  16270. source: "receiver\x0a\x09^receiver",
  16271. messageSends: [],
  16272. referencedClasses: []
  16273. }),
  16274. smalltalk.SendNode);
  16275. smalltalk.addMethod(
  16276. "_receiver_",
  16277. smalltalk.method({
  16278. selector: "receiver:",
  16279. category: 'accessing',
  16280. fn: function (aNode){
  16281. var self=this;
  16282. self["@receiver"]=aNode;
  16283. return self},
  16284. args: ["aNode"],
  16285. source: "receiver: aNode\x0a\x09receiver := aNode",
  16286. messageSends: [],
  16287. referencedClasses: []
  16288. }),
  16289. smalltalk.SendNode);
  16290. smalltalk.addMethod(
  16291. "_selector",
  16292. smalltalk.method({
  16293. selector: "selector",
  16294. category: 'accessing',
  16295. fn: function (){
  16296. var self=this;
  16297. return self["@selector"];
  16298. },
  16299. args: [],
  16300. source: "selector\x0a\x09^selector",
  16301. messageSends: [],
  16302. referencedClasses: []
  16303. }),
  16304. smalltalk.SendNode);
  16305. smalltalk.addMethod(
  16306. "_selector_",
  16307. smalltalk.method({
  16308. selector: "selector:",
  16309. category: 'accessing',
  16310. fn: function (aString){
  16311. var self=this;
  16312. self["@selector"]=aString;
  16313. return self},
  16314. args: ["aString"],
  16315. source: "selector: aString\x0a\x09selector := aString",
  16316. messageSends: [],
  16317. referencedClasses: []
  16318. }),
  16319. smalltalk.SendNode);
  16320. smalltalk.addMethod(
  16321. "_superSend",
  16322. smalltalk.method({
  16323. selector: "superSend",
  16324. category: 'accessing',
  16325. fn: function (){
  16326. var self=this;
  16327. var $1;
  16328. if(($receiver = self["@superSend"]) == nil || $receiver == undefined){
  16329. $1=false;
  16330. } else {
  16331. $1=self["@superSend"];
  16332. };
  16333. return $1;
  16334. },
  16335. args: [],
  16336. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  16337. messageSends: ["ifNil:"],
  16338. referencedClasses: []
  16339. }),
  16340. smalltalk.SendNode);
  16341. smalltalk.addMethod(
  16342. "_superSend_",
  16343. smalltalk.method({
  16344. selector: "superSend:",
  16345. category: 'accessing',
  16346. fn: function (aBoolean){
  16347. var self=this;
  16348. self["@superSend"]=aBoolean;
  16349. return self},
  16350. args: ["aBoolean"],
  16351. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  16352. messageSends: [],
  16353. referencedClasses: []
  16354. }),
  16355. smalltalk.SendNode);
  16356. smalltalk.addMethod(
  16357. "_valueForReceiver_",
  16358. smalltalk.method({
  16359. selector: "valueForReceiver:",
  16360. category: 'accessing',
  16361. fn: function (anObject){
  16362. var self=this;
  16363. var $2,$4,$3,$5,$1;
  16364. $2=smalltalk.send((smalltalk.SendNode || SendNode),"_new",[]);
  16365. $4=smalltalk.send(self,"_receiver",[]);
  16366. if(($receiver = $4) == nil || $receiver == undefined){
  16367. $3=anObject;
  16368. } else {
  16369. $3=smalltalk.send(smalltalk.send(self,"_receiver",[]),"_valueForReceiver_",[anObject]);
  16370. };
  16371. smalltalk.send($2,"_receiver_",[$3]);
  16372. smalltalk.send($2,"_selector_",[smalltalk.send(self,"_selector",[])]);
  16373. smalltalk.send($2,"_arguments_",[smalltalk.send(self,"_arguments",[])]);
  16374. $5=smalltalk.send($2,"_yourself",[]);
  16375. $1=$5;
  16376. return $1;
  16377. },
  16378. args: ["anObject"],
  16379. 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",
  16380. messageSends: ["receiver:", "ifNil:ifNotNil:", "valueForReceiver:", "receiver", "new", "selector:", "selector", "arguments:", "arguments", "yourself"],
  16381. referencedClasses: ["SendNode"]
  16382. }),
  16383. smalltalk.SendNode);
  16384. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps', 'scope'], 'Compiler-AST');
  16385. smalltalk.addMethod(
  16386. "_accept_",
  16387. smalltalk.method({
  16388. selector: "accept:",
  16389. category: 'visiting',
  16390. fn: function (aVisitor){
  16391. var self=this;
  16392. var $1;
  16393. $1=smalltalk.send(aVisitor,"_visitSequenceNode_",[self]);
  16394. return $1;
  16395. },
  16396. args: ["aVisitor"],
  16397. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  16398. messageSends: ["visitSequenceNode:"],
  16399. referencedClasses: []
  16400. }),
  16401. smalltalk.SequenceNode);
  16402. smalltalk.addMethod(
  16403. "_asBlockSequenceNode",
  16404. smalltalk.method({
  16405. selector: "asBlockSequenceNode",
  16406. category: 'testing',
  16407. fn: function (){
  16408. var self=this;
  16409. var $2,$3,$1;
  16410. $2=smalltalk.send((smalltalk.BlockSequenceNode || BlockSequenceNode),"_new",[]);
  16411. smalltalk.send($2,"_nodes_",[smalltalk.send(self,"_nodes",[])]);
  16412. smalltalk.send($2,"_temps_",[smalltalk.send(self,"_temps",[])]);
  16413. $3=smalltalk.send($2,"_yourself",[]);
  16414. $1=$3;
  16415. return $1;
  16416. },
  16417. args: [],
  16418. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09 nodes: self nodes;\x0a\x09 temps: self temps;\x0a\x09 yourself",
  16419. messageSends: ["nodes:", "nodes", "new", "temps:", "temps", "yourself"],
  16420. referencedClasses: ["BlockSequenceNode"]
  16421. }),
  16422. smalltalk.SequenceNode);
  16423. smalltalk.addMethod(
  16424. "_scope",
  16425. smalltalk.method({
  16426. selector: "scope",
  16427. category: 'accessing',
  16428. fn: function (){
  16429. var self=this;
  16430. return self["@scope"];
  16431. },
  16432. args: [],
  16433. source: "scope\x0a\x09^ scope",
  16434. messageSends: [],
  16435. referencedClasses: []
  16436. }),
  16437. smalltalk.SequenceNode);
  16438. smalltalk.addMethod(
  16439. "_scope_",
  16440. smalltalk.method({
  16441. selector: "scope:",
  16442. category: 'accessing',
  16443. fn: function (aLexicalScope){
  16444. var self=this;
  16445. self["@scope"]=aLexicalScope;
  16446. return self},
  16447. args: ["aLexicalScope"],
  16448. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  16449. messageSends: [],
  16450. referencedClasses: []
  16451. }),
  16452. smalltalk.SequenceNode);
  16453. smalltalk.addMethod(
  16454. "_temps",
  16455. smalltalk.method({
  16456. selector: "temps",
  16457. category: 'accessing',
  16458. fn: function (){
  16459. var self=this;
  16460. var $1;
  16461. if(($receiver = self["@temps"]) == nil || $receiver == undefined){
  16462. $1=[];
  16463. } else {
  16464. $1=self["@temps"];
  16465. };
  16466. return $1;
  16467. },
  16468. args: [],
  16469. source: "temps\x0a\x09^temps ifNil: [#()]",
  16470. messageSends: ["ifNil:"],
  16471. referencedClasses: []
  16472. }),
  16473. smalltalk.SequenceNode);
  16474. smalltalk.addMethod(
  16475. "_temps_",
  16476. smalltalk.method({
  16477. selector: "temps:",
  16478. category: 'accessing',
  16479. fn: function (aCollection){
  16480. var self=this;
  16481. self["@temps"]=aCollection;
  16482. return self},
  16483. args: ["aCollection"],
  16484. source: "temps: aCollection\x0a\x09temps := aCollection",
  16485. messageSends: [],
  16486. referencedClasses: []
  16487. }),
  16488. smalltalk.SequenceNode);
  16489. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler-AST');
  16490. smalltalk.addMethod(
  16491. "_accept_",
  16492. smalltalk.method({
  16493. selector: "accept:",
  16494. category: 'visiting',
  16495. fn: function (aVisitor){
  16496. var self=this;
  16497. var $1;
  16498. $1=smalltalk.send(aVisitor,"_visitBlockSequenceNode_",[self]);
  16499. return $1;
  16500. },
  16501. args: ["aVisitor"],
  16502. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  16503. messageSends: ["visitBlockSequenceNode:"],
  16504. referencedClasses: []
  16505. }),
  16506. smalltalk.BlockSequenceNode);
  16507. smalltalk.addMethod(
  16508. "_isBlockSequenceNode",
  16509. smalltalk.method({
  16510. selector: "isBlockSequenceNode",
  16511. category: 'testing',
  16512. fn: function (){
  16513. var self=this;
  16514. return true;
  16515. },
  16516. args: [],
  16517. source: "isBlockSequenceNode\x0a\x09^true",
  16518. messageSends: [],
  16519. referencedClasses: []
  16520. }),
  16521. smalltalk.BlockSequenceNode);
  16522. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler-AST');
  16523. smalltalk.addMethod(
  16524. "_accept_",
  16525. smalltalk.method({
  16526. selector: "accept:",
  16527. category: 'visiting',
  16528. fn: function (aVisitor){
  16529. var self=this;
  16530. var $1;
  16531. $1=smalltalk.send(aVisitor,"_visitValueNode_",[self]);
  16532. return $1;
  16533. },
  16534. args: ["aVisitor"],
  16535. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  16536. messageSends: ["visitValueNode:"],
  16537. referencedClasses: []
  16538. }),
  16539. smalltalk.ValueNode);
  16540. smalltalk.addMethod(
  16541. "_isValueNode",
  16542. smalltalk.method({
  16543. selector: "isValueNode",
  16544. category: 'testing',
  16545. fn: function (){
  16546. var self=this;
  16547. return true;
  16548. },
  16549. args: [],
  16550. source: "isValueNode\x0a\x09^true",
  16551. messageSends: [],
  16552. referencedClasses: []
  16553. }),
  16554. smalltalk.ValueNode);
  16555. smalltalk.addMethod(
  16556. "_value",
  16557. smalltalk.method({
  16558. selector: "value",
  16559. category: 'accessing',
  16560. fn: function (){
  16561. var self=this;
  16562. return self["@value"];
  16563. },
  16564. args: [],
  16565. source: "value\x0a\x09^value",
  16566. messageSends: [],
  16567. referencedClasses: []
  16568. }),
  16569. smalltalk.ValueNode);
  16570. smalltalk.addMethod(
  16571. "_value_",
  16572. smalltalk.method({
  16573. selector: "value:",
  16574. category: 'accessing',
  16575. fn: function (anObject){
  16576. var self=this;
  16577. self["@value"]=anObject;
  16578. return self},
  16579. args: ["anObject"],
  16580. source: "value: anObject\x0a\x09value := anObject",
  16581. messageSends: [],
  16582. referencedClasses: []
  16583. }),
  16584. smalltalk.ValueNode);
  16585. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  16586. smalltalk.addMethod(
  16587. "_accept_",
  16588. smalltalk.method({
  16589. selector: "accept:",
  16590. category: 'visiting',
  16591. fn: function (aVisitor){
  16592. var self=this;
  16593. var $1;
  16594. $1=smalltalk.send(aVisitor,"_visitVariableNode_",[self]);
  16595. return $1;
  16596. },
  16597. args: ["aVisitor"],
  16598. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  16599. messageSends: ["visitVariableNode:"],
  16600. referencedClasses: []
  16601. }),
  16602. smalltalk.VariableNode);
  16603. smalltalk.addMethod(
  16604. "_alias",
  16605. smalltalk.method({
  16606. selector: "alias",
  16607. category: 'accessing',
  16608. fn: function (){
  16609. var self=this;
  16610. var $1;
  16611. $1=smalltalk.send(smalltalk.send(self,"_binding",[]),"_alias",[]);
  16612. return $1;
  16613. },
  16614. args: [],
  16615. source: "alias\x0a\x09^ self binding alias",
  16616. messageSends: ["alias", "binding"],
  16617. referencedClasses: []
  16618. }),
  16619. smalltalk.VariableNode);
  16620. smalltalk.addMethod(
  16621. "_assigned",
  16622. smalltalk.method({
  16623. selector: "assigned",
  16624. category: 'accessing',
  16625. fn: function (){
  16626. var self=this;
  16627. var $1;
  16628. if(($receiver = self["@assigned"]) == nil || $receiver == undefined){
  16629. $1=false;
  16630. } else {
  16631. $1=self["@assigned"];
  16632. };
  16633. return $1;
  16634. },
  16635. args: [],
  16636. source: "assigned\x0a\x09^assigned ifNil: [false]",
  16637. messageSends: ["ifNil:"],
  16638. referencedClasses: []
  16639. }),
  16640. smalltalk.VariableNode);
  16641. smalltalk.addMethod(
  16642. "_assigned_",
  16643. smalltalk.method({
  16644. selector: "assigned:",
  16645. category: 'accessing',
  16646. fn: function (aBoolean){
  16647. var self=this;
  16648. self["@assigned"]=aBoolean;
  16649. return self},
  16650. args: ["aBoolean"],
  16651. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  16652. messageSends: [],
  16653. referencedClasses: []
  16654. }),
  16655. smalltalk.VariableNode);
  16656. smalltalk.addMethod(
  16657. "_beAssigned",
  16658. smalltalk.method({
  16659. selector: "beAssigned",
  16660. category: 'accessing',
  16661. fn: function (){
  16662. var self=this;
  16663. smalltalk.send(smalltalk.send(self,"_binding",[]),"_validateAssignment",[]);
  16664. self["@assigned"]=true;
  16665. return self},
  16666. args: [],
  16667. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  16668. messageSends: ["validateAssignment", "binding"],
  16669. referencedClasses: []
  16670. }),
  16671. smalltalk.VariableNode);
  16672. smalltalk.addMethod(
  16673. "_binding",
  16674. smalltalk.method({
  16675. selector: "binding",
  16676. category: 'accessing',
  16677. fn: function (){
  16678. var self=this;
  16679. return self["@binding"];
  16680. },
  16681. args: [],
  16682. source: "binding\x0a\x09^ binding",
  16683. messageSends: [],
  16684. referencedClasses: []
  16685. }),
  16686. smalltalk.VariableNode);
  16687. smalltalk.addMethod(
  16688. "_binding_",
  16689. smalltalk.method({
  16690. selector: "binding:",
  16691. category: 'accessing',
  16692. fn: function (aScopeVar){
  16693. var self=this;
  16694. self["@binding"]=aScopeVar;
  16695. return self},
  16696. args: ["aScopeVar"],
  16697. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  16698. messageSends: [],
  16699. referencedClasses: []
  16700. }),
  16701. smalltalk.VariableNode);
  16702. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler-AST');
  16703. smalltalk.addMethod(
  16704. "_accept_",
  16705. smalltalk.method({
  16706. selector: "accept:",
  16707. category: 'visiting',
  16708. fn: function (aVisitor){
  16709. var self=this;
  16710. var $1;
  16711. $1=smalltalk.send(aVisitor,"_visitClassReferenceNode_",[self]);
  16712. return $1;
  16713. },
  16714. args: ["aVisitor"],
  16715. source: "accept: aVisitor\x0a\x09^ aVisitor visitClassReferenceNode: self",
  16716. messageSends: ["visitClassReferenceNode:"],
  16717. referencedClasses: []
  16718. }),
  16719. smalltalk.ClassReferenceNode);
  16720. smalltalk.addPackage('Compiler-IR', {});
  16721. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  16722. 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."
  16723. smalltalk.addMethod(
  16724. "_alias_",
  16725. smalltalk.method({
  16726. selector: "alias:",
  16727. category: 'visiting',
  16728. fn: function (aNode){
  16729. var self=this;
  16730. var $1,$2,$3,$4,$5,$6;
  16731. var variable;
  16732. $1=smalltalk.send(aNode,"_isValueNode",[]);
  16733. if(smalltalk.assert($1)){
  16734. $2=smalltalk.send(self,"_visit_",[aNode]);
  16735. return $2;
  16736. };
  16737. $3=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  16738. smalltalk.send($3,"_variable_",[smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar),"_new",[]),"_name_",[smalltalk.send("$","__comma",[smalltalk.send(self,"_nextAlias",[])])])]);
  16739. $4=smalltalk.send($3,"_yourself",[]);
  16740. variable=$4;
  16741. $5=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  16742. smalltalk.send($5,"_add_",[variable]);
  16743. smalltalk.send($5,"_add_",[smalltalk.send(self,"_visit_",[aNode])]);
  16744. $6=smalltalk.send($5,"_yourself",[]);
  16745. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$6]);
  16746. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_internalVariables",[]),"_add_",[variable]);
  16747. return variable;
  16748. },
  16749. args: ["aNode"],
  16750. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isValueNode 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",
  16751. messageSends: ["ifTrue:", "visit:", "isValueNode", "variable:", "name:", ",", "nextAlias", "new", "yourself", "add:", "sequence", "internalVariables", "method"],
  16752. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  16753. }),
  16754. smalltalk.IRASTTranslator);
  16755. smalltalk.addMethod(
  16756. "_method",
  16757. smalltalk.method({
  16758. selector: "method",
  16759. category: 'accessing',
  16760. fn: function (){
  16761. var self=this;
  16762. return self["@method"];
  16763. },
  16764. args: [],
  16765. source: "method\x0a\x09^ method",
  16766. messageSends: [],
  16767. referencedClasses: []
  16768. }),
  16769. smalltalk.IRASTTranslator);
  16770. smalltalk.addMethod(
  16771. "_method_",
  16772. smalltalk.method({
  16773. selector: "method:",
  16774. category: 'accessing',
  16775. fn: function (anIRMethod){
  16776. var self=this;
  16777. self["@method"]=anIRMethod;
  16778. return self},
  16779. args: ["anIRMethod"],
  16780. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  16781. messageSends: [],
  16782. referencedClasses: []
  16783. }),
  16784. smalltalk.IRASTTranslator);
  16785. smalltalk.addMethod(
  16786. "_nextAlias",
  16787. smalltalk.method({
  16788. selector: "nextAlias",
  16789. category: 'accessing',
  16790. fn: function (){
  16791. var self=this;
  16792. var $1;
  16793. if(($receiver = self["@nextAlias"]) == nil || $receiver == undefined){
  16794. self["@nextAlias"]=(0);
  16795. self["@nextAlias"];
  16796. } else {
  16797. self["@nextAlias"];
  16798. };
  16799. self["@nextAlias"]=smalltalk.send(self["@nextAlias"],"__plus",[(1)]);
  16800. $1=smalltalk.send(self["@nextAlias"],"_asString",[]);
  16801. return $1;
  16802. },
  16803. args: [],
  16804. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  16805. messageSends: ["ifNil:", "+", "asString"],
  16806. referencedClasses: []
  16807. }),
  16808. smalltalk.IRASTTranslator);
  16809. smalltalk.addMethod(
  16810. "_sequence",
  16811. smalltalk.method({
  16812. selector: "sequence",
  16813. category: 'accessing',
  16814. fn: function (){
  16815. var self=this;
  16816. return self["@sequence"];
  16817. },
  16818. args: [],
  16819. source: "sequence\x0a\x09^ sequence",
  16820. messageSends: [],
  16821. referencedClasses: []
  16822. }),
  16823. smalltalk.IRASTTranslator);
  16824. smalltalk.addMethod(
  16825. "_sequence_",
  16826. smalltalk.method({
  16827. selector: "sequence:",
  16828. category: 'accessing',
  16829. fn: function (anIRSequence){
  16830. var self=this;
  16831. self["@sequence"]=anIRSequence;
  16832. return self},
  16833. args: ["anIRSequence"],
  16834. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  16835. messageSends: [],
  16836. referencedClasses: []
  16837. }),
  16838. smalltalk.IRASTTranslator);
  16839. smalltalk.addMethod(
  16840. "_source",
  16841. smalltalk.method({
  16842. selector: "source",
  16843. category: 'accessing',
  16844. fn: function (){
  16845. var self=this;
  16846. return self["@source"];
  16847. },
  16848. args: [],
  16849. source: "source\x0a\x09^ source",
  16850. messageSends: [],
  16851. referencedClasses: []
  16852. }),
  16853. smalltalk.IRASTTranslator);
  16854. smalltalk.addMethod(
  16855. "_source_",
  16856. smalltalk.method({
  16857. selector: "source:",
  16858. category: 'accessing',
  16859. fn: function (aString){
  16860. var self=this;
  16861. self["@source"]=aString;
  16862. return self},
  16863. args: ["aString"],
  16864. source: "source: aString\x0a\x09source := aString",
  16865. messageSends: [],
  16866. referencedClasses: []
  16867. }),
  16868. smalltalk.IRASTTranslator);
  16869. smalltalk.addMethod(
  16870. "_theClass",
  16871. smalltalk.method({
  16872. selector: "theClass",
  16873. category: 'accessing',
  16874. fn: function (){
  16875. var self=this;
  16876. return self["@theClass"];
  16877. },
  16878. args: [],
  16879. source: "theClass\x0a\x09^ theClass",
  16880. messageSends: [],
  16881. referencedClasses: []
  16882. }),
  16883. smalltalk.IRASTTranslator);
  16884. smalltalk.addMethod(
  16885. "_theClass_",
  16886. smalltalk.method({
  16887. selector: "theClass:",
  16888. category: 'accessing',
  16889. fn: function (aClass){
  16890. var self=this;
  16891. self["@theClass"]=aClass;
  16892. return self},
  16893. args: ["aClass"],
  16894. source: "theClass: aClass\x0a\x09theClass := aClass",
  16895. messageSends: [],
  16896. referencedClasses: []
  16897. }),
  16898. smalltalk.IRASTTranslator);
  16899. smalltalk.addMethod(
  16900. "_visitAssignmentNode_",
  16901. smalltalk.method({
  16902. selector: "visitAssignmentNode:",
  16903. category: 'visiting',
  16904. fn: function (aNode){
  16905. var self=this;
  16906. var $1,$2;
  16907. var left;
  16908. var right;
  16909. var assignment;
  16910. right=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  16911. left=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  16912. $1=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  16913. smalltalk.send($1,"_add_",[left]);
  16914. smalltalk.send($1,"_add_",[right]);
  16915. $2=smalltalk.send($1,"_yourself",[]);
  16916. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$2]);
  16917. return left;
  16918. },
  16919. args: ["aNode"],
  16920. 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",
  16921. messageSends: ["visit:", "right", "left", "add:", "new", "yourself", "sequence"],
  16922. referencedClasses: ["IRAssignment"]
  16923. }),
  16924. smalltalk.IRASTTranslator);
  16925. smalltalk.addMethod(
  16926. "_visitBlockNode_",
  16927. smalltalk.method({
  16928. selector: "visitBlockNode:",
  16929. category: 'visiting',
  16930. fn: function (aNode){
  16931. var self=this;
  16932. var $1,$2,$3,$4;
  16933. var closure;
  16934. $1=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  16935. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_parameters",[])]);
  16936. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  16937. $2=smalltalk.send($1,"_yourself",[]);
  16938. closure=$2;
  16939. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  16940. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  16941. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  16942. $4=smalltalk.send($3,"_yourself",[]);
  16943. return smalltalk.send(closure,"_add_",[$4]);
  16944. })]);
  16945. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  16946. return smalltalk.send(closure,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  16947. })]);
  16948. return closure;
  16949. },
  16950. args: ["aNode"],
  16951. 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",
  16952. messageSends: ["arguments:", "parameters", "new", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "temps", "visit:", "nodes"],
  16953. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  16954. }),
  16955. smalltalk.IRASTTranslator);
  16956. smalltalk.addMethod(
  16957. "_visitBlockSequenceNode_",
  16958. smalltalk.method({
  16959. selector: "visitBlockSequenceNode:",
  16960. category: 'visiting',
  16961. fn: function (aNode){
  16962. var self=this;
  16963. var $2,$3,$4,$1;
  16964. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]),(function(){
  16965. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_ifNotEmpty_",[(function(){
  16966. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  16967. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  16968. })]);
  16969. $2=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[]),"_isReturnNode",[]);
  16970. if(smalltalk.assert($2)){
  16971. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  16972. } else {
  16973. $3=smalltalk.send((smalltalk.IRBlockReturn || IRBlockReturn),"_new",[]);
  16974. smalltalk.send($3,"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  16975. $4=smalltalk.send($3,"_yourself",[]);
  16976. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$4]);
  16977. };
  16978. })]);
  16979. })]);
  16980. return $1;
  16981. },
  16982. args: ["aNode"],
  16983. 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) ]]]",
  16984. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "do:", "add:", "visit:", "sequence", "allButLast", "nodes", "ifFalse:ifTrue:", "last", "yourself", "isReturnNode"],
  16985. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  16986. }),
  16987. smalltalk.IRASTTranslator);
  16988. smalltalk.addMethod(
  16989. "_visitCascadeNode_",
  16990. smalltalk.method({
  16991. selector: "visitCascadeNode:",
  16992. category: 'visiting',
  16993. fn: function (aNode){
  16994. var self=this;
  16995. var $1,$2;
  16996. var alias;
  16997. $1=smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_isValueNode",[]);
  16998. if(! smalltalk.assert($1)){
  16999. alias=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  17000. alias;
  17001. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17002. return smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_binding_",[smalltalk.send(alias,"_variable",[])])]);
  17003. })]);
  17004. };
  17005. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  17006. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17007. })]);
  17008. $2=smalltalk.send(self,"_alias_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])]);
  17009. return $2;
  17010. },
  17011. args: ["aNode"],
  17012. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isValueNode 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",
  17013. messageSends: ["ifFalse:", "alias:", "receiver", "do:", "receiver:", "binding:", "variable", "new", "nodes", "isValueNode", "add:", "visit:", "sequence", "allButLast", "last"],
  17014. referencedClasses: ["VariableNode"]
  17015. }),
  17016. smalltalk.IRASTTranslator);
  17017. smalltalk.addMethod(
  17018. "_visitDynamicArrayNode_",
  17019. smalltalk.method({
  17020. selector: "visitDynamicArrayNode:",
  17021. category: 'visiting',
  17022. fn: function (aNode){
  17023. var self=this;
  17024. var array;
  17025. array=smalltalk.send((smalltalk.IRDynamicArray || IRDynamicArray),"_new",[]);
  17026. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17027. return smalltalk.send(array,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17028. })]);
  17029. return array;
  17030. },
  17031. args: ["aNode"],
  17032. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09aNode nodes do: [ :each | array add: (self visit: each) ].\x0a\x09^ array",
  17033. messageSends: ["new", "do:", "add:", "visit:", "nodes"],
  17034. referencedClasses: ["IRDynamicArray"]
  17035. }),
  17036. smalltalk.IRASTTranslator);
  17037. smalltalk.addMethod(
  17038. "_visitDynamicDictionaryNode_",
  17039. smalltalk.method({
  17040. selector: "visitDynamicDictionaryNode:",
  17041. category: 'visiting',
  17042. fn: function (aNode){
  17043. var self=this;
  17044. var dictionary;
  17045. dictionary=smalltalk.send((smalltalk.IRDynamicDictionary || IRDynamicDictionary),"_new",[]);
  17046. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17047. return smalltalk.send(dictionary,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17048. })]);
  17049. return dictionary;
  17050. },
  17051. args: ["aNode"],
  17052. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09aNode nodes do: [ :each | dictionary add: (self visit: each) ].\x0a\x09^ dictionary",
  17053. messageSends: ["new", "do:", "add:", "visit:", "nodes"],
  17054. referencedClasses: ["IRDynamicDictionary"]
  17055. }),
  17056. smalltalk.IRASTTranslator);
  17057. smalltalk.addMethod(
  17058. "_visitJSStatementNode_",
  17059. smalltalk.method({
  17060. selector: "visitJSStatementNode:",
  17061. category: 'visiting',
  17062. fn: function (aNode){
  17063. var self=this;
  17064. var $2,$3,$1;
  17065. $2=smalltalk.send((smalltalk.IRVerbatim || IRVerbatim),"_new",[]);
  17066. smalltalk.send($2,"_source_",[smalltalk.send(aNode,"_source",[])]);
  17067. $3=smalltalk.send($2,"_yourself",[]);
  17068. $1=$3;
  17069. return $1;
  17070. },
  17071. args: ["aNode"],
  17072. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source;\x0a\x09\x09yourself",
  17073. messageSends: ["source:", "source", "new", "yourself"],
  17074. referencedClasses: ["IRVerbatim"]
  17075. }),
  17076. smalltalk.IRASTTranslator);
  17077. smalltalk.addMethod(
  17078. "_visitMethodNode_",
  17079. smalltalk.method({
  17080. selector: "visitMethodNode:",
  17081. category: 'visiting',
  17082. fn: function (aNode){
  17083. var self=this;
  17084. var $1,$2,$3,$4,$5,$6,$7,$8;
  17085. $1=smalltalk.send((smalltalk.IRMethod || IRMethod),"_new",[]);
  17086. smalltalk.send($1,"_source_",[smalltalk.send(self,"_source",[])]);
  17087. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_arguments",[])]);
  17088. smalltalk.send($1,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  17089. smalltalk.send($1,"_messageSends_",[smalltalk.send(aNode,"_messageSends",[])]);
  17090. smalltalk.send($1,"_classReferences_",[smalltalk.send(aNode,"_classReferences",[])]);
  17091. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  17092. $2=smalltalk.send($1,"_yourself",[]);
  17093. smalltalk.send(self,"_method_",[$2]);
  17094. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  17095. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  17096. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  17097. $4=smalltalk.send($3,"_yourself",[]);
  17098. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[$4]);
  17099. })]);
  17100. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17101. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  17102. })]);
  17103. $5=smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_hasLocalReturn",[]);
  17104. if(! smalltalk.assert($5)){
  17105. $6=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17106. smalltalk.send($6,"_variable_",[smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_pseudoVars",[]),"_at_",["self"])]);
  17107. $7=smalltalk.send($6,"_yourself",[]);
  17108. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[])]),"_add_",[$7]);
  17109. };
  17110. $8=smalltalk.send(self,"_method",[]);
  17111. return $8;
  17112. },
  17113. args: ["aNode"],
  17114. 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",
  17115. 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"],
  17116. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRVariable", "IRReturn"]
  17117. }),
  17118. smalltalk.IRASTTranslator);
  17119. smalltalk.addMethod(
  17120. "_visitReturnNode_",
  17121. smalltalk.method({
  17122. selector: "visitReturnNode:",
  17123. category: 'visiting',
  17124. fn: function (aNode){
  17125. var self=this;
  17126. var $1;
  17127. var return_;
  17128. $1=smalltalk.send(aNode,"_nonLocalReturn",[]);
  17129. if(smalltalk.assert($1)){
  17130. return_=smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn),"_new",[]);
  17131. } else {
  17132. return_=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  17133. };
  17134. smalltalk.send(return_,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  17135. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17136. return smalltalk.send(return_,"_add_",[smalltalk.send(self,"_alias_",[each])]);
  17137. })]);
  17138. return return_;
  17139. },
  17140. args: ["aNode"],
  17141. 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",
  17142. messageSends: ["ifTrue:ifFalse:", "new", "nonLocalReturn", "scope:", "scope", "do:", "add:", "alias:", "nodes"],
  17143. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  17144. }),
  17145. smalltalk.IRASTTranslator);
  17146. smalltalk.addMethod(
  17147. "_visitSendNode_",
  17148. smalltalk.method({
  17149. selector: "visitSendNode:",
  17150. category: 'visiting',
  17151. fn: function (aNode){
  17152. var self=this;
  17153. var $1,$2,$3,$4;
  17154. var send;
  17155. var receiver;
  17156. var arguments;
  17157. send=smalltalk.send((smalltalk.IRSend || IRSend),"_new",[]);
  17158. smalltalk.send(send,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  17159. $1=smalltalk.send(send,"_index_",[smalltalk.send(aNode,"_index",[])]);
  17160. $2=smalltalk.send(aNode,"_superSend",[]);
  17161. if(smalltalk.assert($2)){
  17162. smalltalk.send(send,"_classSend_",[smalltalk.send(smalltalk.send(self,"_theClass",[]),"_superclass",[])]);
  17163. };
  17164. $3=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_shouldBeInlined",[]),"_or_",[(function(){
  17165. return smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_shouldBeAliased",[]);
  17166. })]);
  17167. if(smalltalk.assert($3)){
  17168. receiver=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  17169. } else {
  17170. receiver=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
  17171. };
  17172. arguments=smalltalk.send(smalltalk.send(aNode,"_arguments",[]),"_collect_",[(function(each){
  17173. $4=smalltalk.send(each,"_shouldBeInlined",[]);
  17174. if(smalltalk.assert($4)){
  17175. return smalltalk.send(self,"_alias_",[each]);
  17176. } else {
  17177. return smalltalk.send(self,"_visit_",[each]);
  17178. };
  17179. })]);
  17180. smalltalk.send(send,"_add_",[receiver]);
  17181. smalltalk.send(arguments,"_do_",[(function(each){
  17182. return smalltalk.send(send,"_add_",[each]);
  17183. })]);
  17184. return send;
  17185. },
  17186. args: ["aNode"],
  17187. source: "visitSendNode: aNode\x0a\x09| send 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\x09receiver := (aNode receiver shouldBeInlined or: [ aNode receiver shouldBeAliased ])\x0a\x09\x09ifTrue: [ self alias: aNode receiver ]\x0a\x09\x09ifFalse: [ self visit: aNode receiver ].\x0a\x0a\x09arguments := aNode arguments collect: [ :each | \x0a\x09\x09each shouldBeInlined\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]].\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  17188. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "classSend:", "superclass", "theClass", "superSend", "ifTrue:ifFalse:", "alias:", "receiver", "visit:", "or:", "shouldBeAliased", "shouldBeInlined", "collect:", "arguments", "add:", "do:"],
  17189. referencedClasses: ["IRSend"]
  17190. }),
  17191. smalltalk.IRASTTranslator);
  17192. smalltalk.addMethod(
  17193. "_visitSequenceNode_",
  17194. smalltalk.method({
  17195. selector: "visitSequenceNode:",
  17196. category: 'visiting',
  17197. fn: function (aNode){
  17198. var self=this;
  17199. var $2,$1;
  17200. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRSequence || IRSequence),"_new",[]),(function(){
  17201. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  17202. var instruction;
  17203. instruction=smalltalk.send(self,"_visit_",[each]);
  17204. instruction;
  17205. $2=smalltalk.send(instruction,"_isVariable",[]);
  17206. if(! smalltalk.assert($2)){
  17207. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[instruction]);
  17208. };
  17209. })]);
  17210. })]);
  17211. return $1;
  17212. },
  17213. args: ["aNode"],
  17214. 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 ]]]",
  17215. messageSends: ["withSequence:do:", "new", "do:", "visit:", "ifFalse:", "add:", "sequence", "isVariable", "nodes"],
  17216. referencedClasses: ["IRSequence"]
  17217. }),
  17218. smalltalk.IRASTTranslator);
  17219. smalltalk.addMethod(
  17220. "_visitValueNode_",
  17221. smalltalk.method({
  17222. selector: "visitValueNode:",
  17223. category: 'visiting',
  17224. fn: function (aNode){
  17225. var self=this;
  17226. var $2,$3,$1;
  17227. $2=smalltalk.send((smalltalk.IRValue || IRValue),"_new",[]);
  17228. smalltalk.send($2,"_value_",[smalltalk.send(aNode,"_value",[])]);
  17229. $3=smalltalk.send($2,"_yourself",[]);
  17230. $1=$3;
  17231. return $1;
  17232. },
  17233. args: ["aNode"],
  17234. source: "visitValueNode: aNode\x0a\x09^ IRValue new \x0a\x09\x09value: aNode value; \x0a\x09\x09yourself",
  17235. messageSends: ["value:", "value", "new", "yourself"],
  17236. referencedClasses: ["IRValue"]
  17237. }),
  17238. smalltalk.IRASTTranslator);
  17239. smalltalk.addMethod(
  17240. "_visitVariableNode_",
  17241. smalltalk.method({
  17242. selector: "visitVariableNode:",
  17243. category: 'visiting',
  17244. fn: function (aNode){
  17245. var self=this;
  17246. var $2,$3,$1;
  17247. $2=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17248. smalltalk.send($2,"_variable_",[smalltalk.send(aNode,"_binding",[])]);
  17249. $3=smalltalk.send($2,"_yourself",[]);
  17250. $1=$3;
  17251. return $1;
  17252. },
  17253. args: ["aNode"],
  17254. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new \x0a\x09\x09variable: aNode binding; \x0a\x09\x09yourself",
  17255. messageSends: ["variable:", "binding", "new", "yourself"],
  17256. referencedClasses: ["IRVariable"]
  17257. }),
  17258. smalltalk.IRASTTranslator);
  17259. smalltalk.addMethod(
  17260. "_withSequence_do_",
  17261. smalltalk.method({
  17262. selector: "withSequence:do:",
  17263. category: 'accessing',
  17264. fn: function (aSequence,aBlock){
  17265. var self=this;
  17266. var outerSequence;
  17267. outerSequence=smalltalk.send(self,"_sequence",[]);
  17268. smalltalk.send(self,"_sequence_",[aSequence]);
  17269. smalltalk.send(aBlock,"_value",[]);
  17270. smalltalk.send(self,"_sequence_",[outerSequence]);
  17271. return aSequence;
  17272. },
  17273. args: ["aSequence", "aBlock"],
  17274. 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",
  17275. messageSends: ["sequence", "sequence:", "value"],
  17276. referencedClasses: []
  17277. }),
  17278. smalltalk.IRASTTranslator);
  17279. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  17280. 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. "
  17281. smalltalk.addMethod(
  17282. "_accept_",
  17283. smalltalk.method({
  17284. selector: "accept:",
  17285. category: 'visiting',
  17286. fn: function (aVisitor){
  17287. var self=this;
  17288. var $1;
  17289. $1=smalltalk.send(aVisitor,"_visitIRInstruction_",[self]);
  17290. return $1;
  17291. },
  17292. args: ["aVisitor"],
  17293. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  17294. messageSends: ["visitIRInstruction:"],
  17295. referencedClasses: []
  17296. }),
  17297. smalltalk.IRInstruction);
  17298. smalltalk.addMethod(
  17299. "_add_",
  17300. smalltalk.method({
  17301. selector: "add:",
  17302. category: 'building',
  17303. fn: function (anObject){
  17304. var self=this;
  17305. var $1;
  17306. smalltalk.send(anObject,"_parent_",[self]);
  17307. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_add_",[anObject]);
  17308. return $1;
  17309. },
  17310. args: ["anObject"],
  17311. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  17312. messageSends: ["parent:", "add:", "instructions"],
  17313. referencedClasses: []
  17314. }),
  17315. smalltalk.IRInstruction);
  17316. smalltalk.addMethod(
  17317. "_canBeAssigned",
  17318. smalltalk.method({
  17319. selector: "canBeAssigned",
  17320. category: 'testing',
  17321. fn: function (){
  17322. var self=this;
  17323. return true;
  17324. },
  17325. args: [],
  17326. source: "canBeAssigned\x0a\x09^ true",
  17327. messageSends: [],
  17328. referencedClasses: []
  17329. }),
  17330. smalltalk.IRInstruction);
  17331. smalltalk.addMethod(
  17332. "_instructions",
  17333. smalltalk.method({
  17334. selector: "instructions",
  17335. category: 'accessing',
  17336. fn: function (){
  17337. var self=this;
  17338. var $1;
  17339. if(($receiver = self["@instructions"]) == nil || $receiver == undefined){
  17340. self["@instructions"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  17341. $1=self["@instructions"];
  17342. } else {
  17343. $1=self["@instructions"];
  17344. };
  17345. return $1;
  17346. },
  17347. args: [],
  17348. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  17349. messageSends: ["ifNil:", "new"],
  17350. referencedClasses: ["OrderedCollection"]
  17351. }),
  17352. smalltalk.IRInstruction);
  17353. smalltalk.addMethod(
  17354. "_isClosure",
  17355. smalltalk.method({
  17356. selector: "isClosure",
  17357. category: 'testing',
  17358. fn: function (){
  17359. var self=this;
  17360. return false;
  17361. },
  17362. args: [],
  17363. source: "isClosure\x0a\x09^ false",
  17364. messageSends: [],
  17365. referencedClasses: []
  17366. }),
  17367. smalltalk.IRInstruction);
  17368. smalltalk.addMethod(
  17369. "_isInlined",
  17370. smalltalk.method({
  17371. selector: "isInlined",
  17372. category: 'testing',
  17373. fn: function (){
  17374. var self=this;
  17375. return false;
  17376. },
  17377. args: [],
  17378. source: "isInlined\x0a\x09^ false",
  17379. messageSends: [],
  17380. referencedClasses: []
  17381. }),
  17382. smalltalk.IRInstruction);
  17383. smalltalk.addMethod(
  17384. "_isLocalReturn",
  17385. smalltalk.method({
  17386. selector: "isLocalReturn",
  17387. category: 'testing',
  17388. fn: function (){
  17389. var self=this;
  17390. return false;
  17391. },
  17392. args: [],
  17393. source: "isLocalReturn\x0a\x09^ false",
  17394. messageSends: [],
  17395. referencedClasses: []
  17396. }),
  17397. smalltalk.IRInstruction);
  17398. smalltalk.addMethod(
  17399. "_isReturn",
  17400. smalltalk.method({
  17401. selector: "isReturn",
  17402. category: 'testing',
  17403. fn: function (){
  17404. var self=this;
  17405. return false;
  17406. },
  17407. args: [],
  17408. source: "isReturn\x0a\x09^ false",
  17409. messageSends: [],
  17410. referencedClasses: []
  17411. }),
  17412. smalltalk.IRInstruction);
  17413. smalltalk.addMethod(
  17414. "_isSend",
  17415. smalltalk.method({
  17416. selector: "isSend",
  17417. category: 'testing',
  17418. fn: function (){
  17419. var self=this;
  17420. return false;
  17421. },
  17422. args: [],
  17423. source: "isSend\x0a\x09^ false",
  17424. messageSends: [],
  17425. referencedClasses: []
  17426. }),
  17427. smalltalk.IRInstruction);
  17428. smalltalk.addMethod(
  17429. "_isSequence",
  17430. smalltalk.method({
  17431. selector: "isSequence",
  17432. category: 'testing',
  17433. fn: function (){
  17434. var self=this;
  17435. return false;
  17436. },
  17437. args: [],
  17438. source: "isSequence\x0a\x09^ false",
  17439. messageSends: [],
  17440. referencedClasses: []
  17441. }),
  17442. smalltalk.IRInstruction);
  17443. smalltalk.addMethod(
  17444. "_isTempDeclaration",
  17445. smalltalk.method({
  17446. selector: "isTempDeclaration",
  17447. category: 'testing',
  17448. fn: function (){
  17449. var self=this;
  17450. return false;
  17451. },
  17452. args: [],
  17453. source: "isTempDeclaration\x0a\x09^ false",
  17454. messageSends: [],
  17455. referencedClasses: []
  17456. }),
  17457. smalltalk.IRInstruction);
  17458. smalltalk.addMethod(
  17459. "_isVariable",
  17460. smalltalk.method({
  17461. selector: "isVariable",
  17462. category: 'testing',
  17463. fn: function (){
  17464. var self=this;
  17465. return false;
  17466. },
  17467. args: [],
  17468. source: "isVariable\x0a\x09^ false",
  17469. messageSends: [],
  17470. referencedClasses: []
  17471. }),
  17472. smalltalk.IRInstruction);
  17473. smalltalk.addMethod(
  17474. "_parent",
  17475. smalltalk.method({
  17476. selector: "parent",
  17477. category: 'accessing',
  17478. fn: function (){
  17479. var self=this;
  17480. return self["@parent"];
  17481. },
  17482. args: [],
  17483. source: "parent\x0a\x09^ parent",
  17484. messageSends: [],
  17485. referencedClasses: []
  17486. }),
  17487. smalltalk.IRInstruction);
  17488. smalltalk.addMethod(
  17489. "_parent_",
  17490. smalltalk.method({
  17491. selector: "parent:",
  17492. category: 'accessing',
  17493. fn: function (anIRInstruction){
  17494. var self=this;
  17495. self["@parent"]=anIRInstruction;
  17496. return self},
  17497. args: ["anIRInstruction"],
  17498. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  17499. messageSends: [],
  17500. referencedClasses: []
  17501. }),
  17502. smalltalk.IRInstruction);
  17503. smalltalk.addMethod(
  17504. "_remove",
  17505. smalltalk.method({
  17506. selector: "remove",
  17507. category: 'building',
  17508. fn: function (){
  17509. var self=this;
  17510. smalltalk.send(smalltalk.send(self,"_parent",[]),"_remove_",[self]);
  17511. return self},
  17512. args: [],
  17513. source: "remove\x0a\x09self parent remove: self",
  17514. messageSends: ["remove:", "parent"],
  17515. referencedClasses: []
  17516. }),
  17517. smalltalk.IRInstruction);
  17518. smalltalk.addMethod(
  17519. "_remove_",
  17520. smalltalk.method({
  17521. selector: "remove:",
  17522. category: 'building',
  17523. fn: function (anIRInstruction){
  17524. var self=this;
  17525. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_remove_",[anIRInstruction]);
  17526. return self},
  17527. args: ["anIRInstruction"],
  17528. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  17529. messageSends: ["remove:", "instructions"],
  17530. referencedClasses: []
  17531. }),
  17532. smalltalk.IRInstruction);
  17533. smalltalk.addMethod(
  17534. "_replace_with_",
  17535. smalltalk.method({
  17536. selector: "replace:with:",
  17537. category: 'building',
  17538. fn: function (anIRInstruction,anotherIRInstruction){
  17539. var self=this;
  17540. smalltalk.send(anotherIRInstruction,"_parent_",[self]);
  17541. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_at_put_",[smalltalk.send(smalltalk.send(self,"_instructions",[]),"_indexOf_",[anIRInstruction]),anotherIRInstruction]);
  17542. return self},
  17543. args: ["anIRInstruction", "anotherIRInstruction"],
  17544. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions \x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  17545. messageSends: ["parent:", "at:put:", "indexOf:", "instructions"],
  17546. referencedClasses: []
  17547. }),
  17548. smalltalk.IRInstruction);
  17549. smalltalk.addMethod(
  17550. "_replaceWith_",
  17551. smalltalk.method({
  17552. selector: "replaceWith:",
  17553. category: 'building',
  17554. fn: function (anIRInstruction){
  17555. var self=this;
  17556. smalltalk.send(smalltalk.send(self,"_parent",[]),"_replace_with_",[self,anIRInstruction]);
  17557. return self},
  17558. args: ["anIRInstruction"],
  17559. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  17560. messageSends: ["replace:with:", "parent"],
  17561. referencedClasses: []
  17562. }),
  17563. smalltalk.IRInstruction);
  17564. smalltalk.addMethod(
  17565. "_on_",
  17566. smalltalk.method({
  17567. selector: "on:",
  17568. category: 'instance creation',
  17569. fn: function (aBuilder){
  17570. var self=this;
  17571. var $2,$3,$1;
  17572. $2=smalltalk.send(self,"_new",[]);
  17573. smalltalk.send($2,"_builder_",[aBuilder]);
  17574. $3=smalltalk.send($2,"_yourself",[]);
  17575. $1=$3;
  17576. return $1;
  17577. },
  17578. args: ["aBuilder"],
  17579. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  17580. messageSends: ["builder:", "new", "yourself"],
  17581. referencedClasses: []
  17582. }),
  17583. smalltalk.IRInstruction.klass);
  17584. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  17585. smalltalk.addMethod(
  17586. "_accept_",
  17587. smalltalk.method({
  17588. selector: "accept:",
  17589. category: 'visiting',
  17590. fn: function (aVisitor){
  17591. var self=this;
  17592. var $1;
  17593. $1=smalltalk.send(aVisitor,"_visitIRAssignment_",[self]);
  17594. return $1;
  17595. },
  17596. args: ["aVisitor"],
  17597. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  17598. messageSends: ["visitIRAssignment:"],
  17599. referencedClasses: []
  17600. }),
  17601. smalltalk.IRAssignment);
  17602. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  17603. smalltalk.addMethod(
  17604. "_accept_",
  17605. smalltalk.method({
  17606. selector: "accept:",
  17607. category: 'visiting',
  17608. fn: function (aVisitor){
  17609. var self=this;
  17610. var $1;
  17611. $1=smalltalk.send(aVisitor,"_visitIRDynamicArray_",[self]);
  17612. return $1;
  17613. },
  17614. args: ["aVisitor"],
  17615. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  17616. messageSends: ["visitIRDynamicArray:"],
  17617. referencedClasses: []
  17618. }),
  17619. smalltalk.IRDynamicArray);
  17620. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  17621. smalltalk.addMethod(
  17622. "_accept_",
  17623. smalltalk.method({
  17624. selector: "accept:",
  17625. category: 'visiting',
  17626. fn: function (aVisitor){
  17627. var self=this;
  17628. var $1;
  17629. $1=smalltalk.send(aVisitor,"_visitIRDynamicDictionary_",[self]);
  17630. return $1;
  17631. },
  17632. args: ["aVisitor"],
  17633. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  17634. messageSends: ["visitIRDynamicDictionary:"],
  17635. referencedClasses: []
  17636. }),
  17637. smalltalk.IRDynamicDictionary);
  17638. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  17639. smalltalk.addMethod(
  17640. "_scope",
  17641. smalltalk.method({
  17642. selector: "scope",
  17643. category: 'accessing',
  17644. fn: function (){
  17645. var self=this;
  17646. return self["@scope"];
  17647. },
  17648. args: [],
  17649. source: "scope\x0a\x09^ scope",
  17650. messageSends: [],
  17651. referencedClasses: []
  17652. }),
  17653. smalltalk.IRScopedInstruction);
  17654. smalltalk.addMethod(
  17655. "_scope_",
  17656. smalltalk.method({
  17657. selector: "scope:",
  17658. category: 'accessing',
  17659. fn: function (aScope){
  17660. var self=this;
  17661. self["@scope"]=aScope;
  17662. return self},
  17663. args: ["aScope"],
  17664. source: "scope: aScope\x0a\x09scope := aScope",
  17665. messageSends: [],
  17666. referencedClasses: []
  17667. }),
  17668. smalltalk.IRScopedInstruction);
  17669. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  17670. smalltalk.addMethod(
  17671. "_accept_",
  17672. smalltalk.method({
  17673. selector: "accept:",
  17674. category: 'visiting',
  17675. fn: function (aVisitor){
  17676. var self=this;
  17677. var $1;
  17678. $1=smalltalk.send(aVisitor,"_visitIRClosure_",[self]);
  17679. return $1;
  17680. },
  17681. args: ["aVisitor"],
  17682. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  17683. messageSends: ["visitIRClosure:"],
  17684. referencedClasses: []
  17685. }),
  17686. smalltalk.IRClosure);
  17687. smalltalk.addMethod(
  17688. "_arguments",
  17689. smalltalk.method({
  17690. selector: "arguments",
  17691. category: 'accessing',
  17692. fn: function (){
  17693. var self=this;
  17694. var $1;
  17695. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  17696. $1=[];
  17697. } else {
  17698. $1=self["@arguments"];
  17699. };
  17700. return $1;
  17701. },
  17702. args: [],
  17703. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  17704. messageSends: ["ifNil:"],
  17705. referencedClasses: []
  17706. }),
  17707. smalltalk.IRClosure);
  17708. smalltalk.addMethod(
  17709. "_arguments_",
  17710. smalltalk.method({
  17711. selector: "arguments:",
  17712. category: 'accessing',
  17713. fn: function (aCollection){
  17714. var self=this;
  17715. self["@arguments"]=aCollection;
  17716. return self},
  17717. args: ["aCollection"],
  17718. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  17719. messageSends: [],
  17720. referencedClasses: []
  17721. }),
  17722. smalltalk.IRClosure);
  17723. smalltalk.addMethod(
  17724. "_isClosure",
  17725. smalltalk.method({
  17726. selector: "isClosure",
  17727. category: 'testing',
  17728. fn: function (){
  17729. var self=this;
  17730. return true;
  17731. },
  17732. args: [],
  17733. source: "isClosure\x0a\x09^ true",
  17734. messageSends: [],
  17735. referencedClasses: []
  17736. }),
  17737. smalltalk.IRClosure);
  17738. smalltalk.addMethod(
  17739. "_scope_",
  17740. smalltalk.method({
  17741. selector: "scope:",
  17742. category: 'accessing',
  17743. fn: function (aScope){
  17744. var self=this;
  17745. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  17746. smalltalk.send(aScope,"_instruction_",[self]);
  17747. return self},
  17748. args: ["aScope"],
  17749. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  17750. messageSends: ["scope:", "instruction:"],
  17751. referencedClasses: []
  17752. }),
  17753. smalltalk.IRClosure);
  17754. smalltalk.addMethod(
  17755. "_sequence",
  17756. smalltalk.method({
  17757. selector: "sequence",
  17758. category: 'accessing',
  17759. fn: function (){
  17760. var self=this;
  17761. var $1;
  17762. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_last",[]);
  17763. return $1;
  17764. },
  17765. args: [],
  17766. source: "sequence\x0a\x09^ self instructions last",
  17767. messageSends: ["last", "instructions"],
  17768. referencedClasses: []
  17769. }),
  17770. smalltalk.IRClosure);
  17771. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  17772. smalltalk.IRMethod.comment="I am a method instruction"
  17773. smalltalk.addMethod(
  17774. "_accept_",
  17775. smalltalk.method({
  17776. selector: "accept:",
  17777. category: 'visiting',
  17778. fn: function (aVisitor){
  17779. var self=this;
  17780. var $1;
  17781. $1=smalltalk.send(aVisitor,"_visitIRMethod_",[self]);
  17782. return $1;
  17783. },
  17784. args: ["aVisitor"],
  17785. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  17786. messageSends: ["visitIRMethod:"],
  17787. referencedClasses: []
  17788. }),
  17789. smalltalk.IRMethod);
  17790. smalltalk.addMethod(
  17791. "_arguments",
  17792. smalltalk.method({
  17793. selector: "arguments",
  17794. category: 'accessing',
  17795. fn: function (){
  17796. var self=this;
  17797. return self["@arguments"];
  17798. },
  17799. args: [],
  17800. source: "arguments\x0a\x09^ arguments",
  17801. messageSends: [],
  17802. referencedClasses: []
  17803. }),
  17804. smalltalk.IRMethod);
  17805. smalltalk.addMethod(
  17806. "_arguments_",
  17807. smalltalk.method({
  17808. selector: "arguments:",
  17809. category: 'accessing',
  17810. fn: function (aCollection){
  17811. var self=this;
  17812. self["@arguments"]=aCollection;
  17813. return self},
  17814. args: ["aCollection"],
  17815. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  17816. messageSends: [],
  17817. referencedClasses: []
  17818. }),
  17819. smalltalk.IRMethod);
  17820. smalltalk.addMethod(
  17821. "_classReferences",
  17822. smalltalk.method({
  17823. selector: "classReferences",
  17824. category: 'accessing',
  17825. fn: function (){
  17826. var self=this;
  17827. return self["@classReferences"];
  17828. },
  17829. args: [],
  17830. source: "classReferences\x0a\x09^ classReferences",
  17831. messageSends: [],
  17832. referencedClasses: []
  17833. }),
  17834. smalltalk.IRMethod);
  17835. smalltalk.addMethod(
  17836. "_classReferences_",
  17837. smalltalk.method({
  17838. selector: "classReferences:",
  17839. category: 'accessing',
  17840. fn: function (aCollection){
  17841. var self=this;
  17842. self["@classReferences"]=aCollection;
  17843. return self},
  17844. args: ["aCollection"],
  17845. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  17846. messageSends: [],
  17847. referencedClasses: []
  17848. }),
  17849. smalltalk.IRMethod);
  17850. smalltalk.addMethod(
  17851. "_internalVariables",
  17852. smalltalk.method({
  17853. selector: "internalVariables",
  17854. category: 'accessing',
  17855. fn: function (){
  17856. var self=this;
  17857. var $1;
  17858. if(($receiver = self["@internalVariables"]) == nil || $receiver == undefined){
  17859. self["@internalVariables"]=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  17860. $1=self["@internalVariables"];
  17861. } else {
  17862. $1=self["@internalVariables"];
  17863. };
  17864. return $1;
  17865. },
  17866. args: [],
  17867. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  17868. messageSends: ["ifNil:", "new"],
  17869. referencedClasses: ["Set"]
  17870. }),
  17871. smalltalk.IRMethod);
  17872. smalltalk.addMethod(
  17873. "_messageSends",
  17874. smalltalk.method({
  17875. selector: "messageSends",
  17876. category: 'accessing',
  17877. fn: function (){
  17878. var self=this;
  17879. return self["@messageSends"];
  17880. },
  17881. args: [],
  17882. source: "messageSends\x0a\x09^ messageSends",
  17883. messageSends: [],
  17884. referencedClasses: []
  17885. }),
  17886. smalltalk.IRMethod);
  17887. smalltalk.addMethod(
  17888. "_messageSends_",
  17889. smalltalk.method({
  17890. selector: "messageSends:",
  17891. category: 'accessing',
  17892. fn: function (aCollection){
  17893. var self=this;
  17894. self["@messageSends"]=aCollection;
  17895. return self},
  17896. args: ["aCollection"],
  17897. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  17898. messageSends: [],
  17899. referencedClasses: []
  17900. }),
  17901. smalltalk.IRMethod);
  17902. smalltalk.addMethod(
  17903. "_scope_",
  17904. smalltalk.method({
  17905. selector: "scope:",
  17906. category: 'accessing',
  17907. fn: function (aScope){
  17908. var self=this;
  17909. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  17910. smalltalk.send(aScope,"_instruction_",[self]);
  17911. return self},
  17912. args: ["aScope"],
  17913. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  17914. messageSends: ["scope:", "instruction:"],
  17915. referencedClasses: []
  17916. }),
  17917. smalltalk.IRMethod);
  17918. smalltalk.addMethod(
  17919. "_selector",
  17920. smalltalk.method({
  17921. selector: "selector",
  17922. category: 'accessing',
  17923. fn: function (){
  17924. var self=this;
  17925. return self["@selector"];
  17926. },
  17927. args: [],
  17928. source: "selector\x0a\x09^ selector",
  17929. messageSends: [],
  17930. referencedClasses: []
  17931. }),
  17932. smalltalk.IRMethod);
  17933. smalltalk.addMethod(
  17934. "_selector_",
  17935. smalltalk.method({
  17936. selector: "selector:",
  17937. category: 'accessing',
  17938. fn: function (aString){
  17939. var self=this;
  17940. self["@selector"]=aString;
  17941. return self},
  17942. args: ["aString"],
  17943. source: "selector: aString\x0a\x09selector := aString",
  17944. messageSends: [],
  17945. referencedClasses: []
  17946. }),
  17947. smalltalk.IRMethod);
  17948. smalltalk.addMethod(
  17949. "_source",
  17950. smalltalk.method({
  17951. selector: "source",
  17952. category: 'accessing',
  17953. fn: function (){
  17954. var self=this;
  17955. return self["@source"];
  17956. },
  17957. args: [],
  17958. source: "source\x0a\x09^ source",
  17959. messageSends: [],
  17960. referencedClasses: []
  17961. }),
  17962. smalltalk.IRMethod);
  17963. smalltalk.addMethod(
  17964. "_source_",
  17965. smalltalk.method({
  17966. selector: "source:",
  17967. category: 'accessing',
  17968. fn: function (aString){
  17969. var self=this;
  17970. self["@source"]=aString;
  17971. return self},
  17972. args: ["aString"],
  17973. source: "source: aString\x0a\x09source := aString",
  17974. messageSends: [],
  17975. referencedClasses: []
  17976. }),
  17977. smalltalk.IRMethod);
  17978. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  17979. smalltalk.IRReturn.comment="I am a local return instruction."
  17980. smalltalk.addMethod(
  17981. "_accept_",
  17982. smalltalk.method({
  17983. selector: "accept:",
  17984. category: 'visiting',
  17985. fn: function (aVisitor){
  17986. var self=this;
  17987. var $1;
  17988. $1=smalltalk.send(aVisitor,"_visitIRReturn_",[self]);
  17989. return $1;
  17990. },
  17991. args: ["aVisitor"],
  17992. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  17993. messageSends: ["visitIRReturn:"],
  17994. referencedClasses: []
  17995. }),
  17996. smalltalk.IRReturn);
  17997. smalltalk.addMethod(
  17998. "_canBeAssigned",
  17999. smalltalk.method({
  18000. selector: "canBeAssigned",
  18001. category: 'testing',
  18002. fn: function (){
  18003. var self=this;
  18004. return false;
  18005. },
  18006. args: [],
  18007. source: "canBeAssigned\x0a\x09^ false",
  18008. messageSends: [],
  18009. referencedClasses: []
  18010. }),
  18011. smalltalk.IRReturn);
  18012. smalltalk.addMethod(
  18013. "_isBlockReturn",
  18014. smalltalk.method({
  18015. selector: "isBlockReturn",
  18016. category: 'testing',
  18017. fn: function (){
  18018. var self=this;
  18019. return false;
  18020. },
  18021. args: [],
  18022. source: "isBlockReturn\x0a\x09^ false",
  18023. messageSends: [],
  18024. referencedClasses: []
  18025. }),
  18026. smalltalk.IRReturn);
  18027. smalltalk.addMethod(
  18028. "_isLocalReturn",
  18029. smalltalk.method({
  18030. selector: "isLocalReturn",
  18031. category: 'testing',
  18032. fn: function (){
  18033. var self=this;
  18034. return true;
  18035. },
  18036. args: [],
  18037. source: "isLocalReturn\x0a\x09^ true",
  18038. messageSends: [],
  18039. referencedClasses: []
  18040. }),
  18041. smalltalk.IRReturn);
  18042. smalltalk.addMethod(
  18043. "_isNonLocalReturn",
  18044. smalltalk.method({
  18045. selector: "isNonLocalReturn",
  18046. category: 'testing',
  18047. fn: function (){
  18048. var self=this;
  18049. var $1;
  18050. $1=smalltalk.send(smalltalk.send(self,"_isLocalReturn",[]),"_not",[]);
  18051. return $1;
  18052. },
  18053. args: [],
  18054. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  18055. messageSends: ["not", "isLocalReturn"],
  18056. referencedClasses: []
  18057. }),
  18058. smalltalk.IRReturn);
  18059. smalltalk.addMethod(
  18060. "_isReturn",
  18061. smalltalk.method({
  18062. selector: "isReturn",
  18063. category: 'testing',
  18064. fn: function (){
  18065. var self=this;
  18066. return true;
  18067. },
  18068. args: [],
  18069. source: "isReturn\x0a\x09^ true",
  18070. messageSends: [],
  18071. referencedClasses: []
  18072. }),
  18073. smalltalk.IRReturn);
  18074. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  18075. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction."
  18076. smalltalk.addMethod(
  18077. "_accept_",
  18078. smalltalk.method({
  18079. selector: "accept:",
  18080. category: 'visiting',
  18081. fn: function (aVisitor){
  18082. var self=this;
  18083. var $1;
  18084. $1=smalltalk.send(aVisitor,"_visitIRBlockReturn_",[self]);
  18085. return $1;
  18086. },
  18087. args: ["aVisitor"],
  18088. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  18089. messageSends: ["visitIRBlockReturn:"],
  18090. referencedClasses: []
  18091. }),
  18092. smalltalk.IRBlockReturn);
  18093. smalltalk.addMethod(
  18094. "_isBlockReturn",
  18095. smalltalk.method({
  18096. selector: "isBlockReturn",
  18097. category: 'testing',
  18098. fn: function (){
  18099. var self=this;
  18100. return true;
  18101. },
  18102. args: [],
  18103. source: "isBlockReturn\x0a\x09^ true",
  18104. messageSends: [],
  18105. referencedClasses: []
  18106. }),
  18107. smalltalk.IRBlockReturn);
  18108. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  18109. 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"
  18110. smalltalk.addMethod(
  18111. "_accept_",
  18112. smalltalk.method({
  18113. selector: "accept:",
  18114. category: 'visiting',
  18115. fn: function (aVisitor){
  18116. var self=this;
  18117. var $1;
  18118. $1=smalltalk.send(aVisitor,"_visitIRNonLocalReturn_",[self]);
  18119. return $1;
  18120. },
  18121. args: ["aVisitor"],
  18122. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  18123. messageSends: ["visitIRNonLocalReturn:"],
  18124. referencedClasses: []
  18125. }),
  18126. smalltalk.IRNonLocalReturn);
  18127. smalltalk.addMethod(
  18128. "_isLocalReturn",
  18129. smalltalk.method({
  18130. selector: "isLocalReturn",
  18131. category: 'testing',
  18132. fn: function (){
  18133. var self=this;
  18134. return false;
  18135. },
  18136. args: [],
  18137. source: "isLocalReturn\x0a\x09^ false",
  18138. messageSends: [],
  18139. referencedClasses: []
  18140. }),
  18141. smalltalk.IRNonLocalReturn);
  18142. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  18143. smalltalk.IRSend.comment="I am a message send instruction. "
  18144. smalltalk.addMethod(
  18145. "_accept_",
  18146. smalltalk.method({
  18147. selector: "accept:",
  18148. category: 'visiting',
  18149. fn: function (aVisitor){
  18150. var self=this;
  18151. var $1;
  18152. $1=smalltalk.send(aVisitor,"_visitIRSend_",[self]);
  18153. return $1;
  18154. },
  18155. args: ["aVisitor"],
  18156. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  18157. messageSends: ["visitIRSend:"],
  18158. referencedClasses: []
  18159. }),
  18160. smalltalk.IRSend);
  18161. smalltalk.addMethod(
  18162. "_classSend",
  18163. smalltalk.method({
  18164. selector: "classSend",
  18165. category: 'accessing',
  18166. fn: function (){
  18167. var self=this;
  18168. return self["@classSend"];
  18169. },
  18170. args: [],
  18171. source: "classSend\x0a\x09^ classSend",
  18172. messageSends: [],
  18173. referencedClasses: []
  18174. }),
  18175. smalltalk.IRSend);
  18176. smalltalk.addMethod(
  18177. "_classSend_",
  18178. smalltalk.method({
  18179. selector: "classSend:",
  18180. category: 'accessing',
  18181. fn: function (aClass){
  18182. var self=this;
  18183. self["@classSend"]=aClass;
  18184. return self},
  18185. args: ["aClass"],
  18186. source: "classSend: aClass\x0a\x09classSend := aClass",
  18187. messageSends: [],
  18188. referencedClasses: []
  18189. }),
  18190. smalltalk.IRSend);
  18191. smalltalk.addMethod(
  18192. "_index",
  18193. smalltalk.method({
  18194. selector: "index",
  18195. category: 'accessing',
  18196. fn: function (){
  18197. var self=this;
  18198. return self["@index"];
  18199. },
  18200. args: [],
  18201. source: "index\x0a\x09^ index",
  18202. messageSends: [],
  18203. referencedClasses: []
  18204. }),
  18205. smalltalk.IRSend);
  18206. smalltalk.addMethod(
  18207. "_index_",
  18208. smalltalk.method({
  18209. selector: "index:",
  18210. category: 'accessing',
  18211. fn: function (anInteger){
  18212. var self=this;
  18213. self["@index"]=anInteger;
  18214. return self},
  18215. args: ["anInteger"],
  18216. source: "index: anInteger\x0a\x09index := anInteger",
  18217. messageSends: [],
  18218. referencedClasses: []
  18219. }),
  18220. smalltalk.IRSend);
  18221. smalltalk.addMethod(
  18222. "_isSend",
  18223. smalltalk.method({
  18224. selector: "isSend",
  18225. category: 'testing',
  18226. fn: function (){
  18227. var self=this;
  18228. return true;
  18229. },
  18230. args: [],
  18231. source: "isSend\x0a\x09^ true",
  18232. messageSends: [],
  18233. referencedClasses: []
  18234. }),
  18235. smalltalk.IRSend);
  18236. smalltalk.addMethod(
  18237. "_selector",
  18238. smalltalk.method({
  18239. selector: "selector",
  18240. category: 'accessing',
  18241. fn: function (){
  18242. var self=this;
  18243. return self["@selector"];
  18244. },
  18245. args: [],
  18246. source: "selector\x0a\x09^ selector",
  18247. messageSends: [],
  18248. referencedClasses: []
  18249. }),
  18250. smalltalk.IRSend);
  18251. smalltalk.addMethod(
  18252. "_selector_",
  18253. smalltalk.method({
  18254. selector: "selector:",
  18255. category: 'accessing',
  18256. fn: function (aString){
  18257. var self=this;
  18258. self["@selector"]=aString;
  18259. return self},
  18260. args: ["aString"],
  18261. source: "selector: aString\x0a\x09selector := aString",
  18262. messageSends: [],
  18263. referencedClasses: []
  18264. }),
  18265. smalltalk.IRSend);
  18266. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  18267. smalltalk.addMethod(
  18268. "_accept_",
  18269. smalltalk.method({
  18270. selector: "accept:",
  18271. category: 'visiting',
  18272. fn: function (aVisitor){
  18273. var self=this;
  18274. var $1;
  18275. $1=smalltalk.send(aVisitor,"_visitIRSequence_",[self]);
  18276. return $1;
  18277. },
  18278. args: ["aVisitor"],
  18279. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  18280. messageSends: ["visitIRSequence:"],
  18281. referencedClasses: []
  18282. }),
  18283. smalltalk.IRSequence);
  18284. smalltalk.addMethod(
  18285. "_isSequence",
  18286. smalltalk.method({
  18287. selector: "isSequence",
  18288. category: 'testing',
  18289. fn: function (){
  18290. var self=this;
  18291. return true;
  18292. },
  18293. args: [],
  18294. source: "isSequence\x0a\x09^ true",
  18295. messageSends: [],
  18296. referencedClasses: []
  18297. }),
  18298. smalltalk.IRSequence);
  18299. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  18300. smalltalk.addMethod(
  18301. "_accept_",
  18302. smalltalk.method({
  18303. selector: "accept:",
  18304. category: 'visiting',
  18305. fn: function (aVisitor){
  18306. var self=this;
  18307. var $1;
  18308. $1=smalltalk.send(aVisitor,"_visitIRBlockSequence_",[self]);
  18309. return $1;
  18310. },
  18311. args: ["aVisitor"],
  18312. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  18313. messageSends: ["visitIRBlockSequence:"],
  18314. referencedClasses: []
  18315. }),
  18316. smalltalk.IRBlockSequence);
  18317. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  18318. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  18319. smalltalk.addMethod(
  18320. "_accept_",
  18321. smalltalk.method({
  18322. selector: "accept:",
  18323. category: 'visiting',
  18324. fn: function (aVisitor){
  18325. var self=this;
  18326. var $1;
  18327. $1=smalltalk.send(aVisitor,"_visitIRTempDeclaration_",[self]);
  18328. return $1;
  18329. },
  18330. args: ["aVisitor"],
  18331. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  18332. messageSends: ["visitIRTempDeclaration:"],
  18333. referencedClasses: []
  18334. }),
  18335. smalltalk.IRTempDeclaration);
  18336. smalltalk.addMethod(
  18337. "_isTempDeclaration",
  18338. smalltalk.method({
  18339. selector: "isTempDeclaration",
  18340. category: 'visiting',
  18341. fn: function (){
  18342. var self=this;
  18343. return true;
  18344. },
  18345. args: [],
  18346. source: "isTempDeclaration\x0a\x09^ true",
  18347. messageSends: [],
  18348. referencedClasses: []
  18349. }),
  18350. smalltalk.IRTempDeclaration);
  18351. smalltalk.addMethod(
  18352. "_name",
  18353. smalltalk.method({
  18354. selector: "name",
  18355. category: 'accessing',
  18356. fn: function (){
  18357. var self=this;
  18358. return self["@name"];
  18359. },
  18360. args: [],
  18361. source: "name\x0a\x09^ name",
  18362. messageSends: [],
  18363. referencedClasses: []
  18364. }),
  18365. smalltalk.IRTempDeclaration);
  18366. smalltalk.addMethod(
  18367. "_name_",
  18368. smalltalk.method({
  18369. selector: "name:",
  18370. category: 'accessing',
  18371. fn: function (aString){
  18372. var self=this;
  18373. self["@name"]=aString;
  18374. return self},
  18375. args: ["aString"],
  18376. source: "name: aString\x0a\x09name := aString",
  18377. messageSends: [],
  18378. referencedClasses: []
  18379. }),
  18380. smalltalk.IRTempDeclaration);
  18381. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  18382. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  18383. smalltalk.addMethod(
  18384. "_accept_",
  18385. smalltalk.method({
  18386. selector: "accept:",
  18387. category: 'visiting',
  18388. fn: function (aVisitor){
  18389. var self=this;
  18390. var $1;
  18391. $1=smalltalk.send(aVisitor,"_visitIRValue_",[self]);
  18392. return $1;
  18393. },
  18394. args: ["aVisitor"],
  18395. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  18396. messageSends: ["visitIRValue:"],
  18397. referencedClasses: []
  18398. }),
  18399. smalltalk.IRValue);
  18400. smalltalk.addMethod(
  18401. "_value",
  18402. smalltalk.method({
  18403. selector: "value",
  18404. category: 'accessing',
  18405. fn: function (){
  18406. var self=this;
  18407. return self["@value"];
  18408. },
  18409. args: [],
  18410. source: "value\x0a\x09^value",
  18411. messageSends: [],
  18412. referencedClasses: []
  18413. }),
  18414. smalltalk.IRValue);
  18415. smalltalk.addMethod(
  18416. "_value_",
  18417. smalltalk.method({
  18418. selector: "value:",
  18419. category: 'accessing',
  18420. fn: function (aString){
  18421. var self=this;
  18422. self["@value"]=aString;
  18423. return self},
  18424. args: ["aString"],
  18425. source: "value: aString\x0a\x09value := aString",
  18426. messageSends: [],
  18427. referencedClasses: []
  18428. }),
  18429. smalltalk.IRValue);
  18430. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  18431. smalltalk.IRVariable.comment="I am a variable instruction."
  18432. smalltalk.addMethod(
  18433. "_accept_",
  18434. smalltalk.method({
  18435. selector: "accept:",
  18436. category: 'visiting',
  18437. fn: function (aVisitor){
  18438. var self=this;
  18439. var $1;
  18440. $1=smalltalk.send(aVisitor,"_visitIRVariable_",[self]);
  18441. return $1;
  18442. },
  18443. args: ["aVisitor"],
  18444. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  18445. messageSends: ["visitIRVariable:"],
  18446. referencedClasses: []
  18447. }),
  18448. smalltalk.IRVariable);
  18449. smalltalk.addMethod(
  18450. "_isVariable",
  18451. smalltalk.method({
  18452. selector: "isVariable",
  18453. category: 'testing',
  18454. fn: function (){
  18455. var self=this;
  18456. return true;
  18457. },
  18458. args: [],
  18459. source: "isVariable\x0a\x09^ true",
  18460. messageSends: [],
  18461. referencedClasses: []
  18462. }),
  18463. smalltalk.IRVariable);
  18464. smalltalk.addMethod(
  18465. "_variable",
  18466. smalltalk.method({
  18467. selector: "variable",
  18468. category: 'accessing',
  18469. fn: function (){
  18470. var self=this;
  18471. return self["@variable"];
  18472. },
  18473. args: [],
  18474. source: "variable\x0a\x09^ variable",
  18475. messageSends: [],
  18476. referencedClasses: []
  18477. }),
  18478. smalltalk.IRVariable);
  18479. smalltalk.addMethod(
  18480. "_variable_",
  18481. smalltalk.method({
  18482. selector: "variable:",
  18483. category: 'accessing',
  18484. fn: function (aScopeVariable){
  18485. var self=this;
  18486. self["@variable"]=aScopeVariable;
  18487. return self},
  18488. args: ["aScopeVariable"],
  18489. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  18490. messageSends: [],
  18491. referencedClasses: []
  18492. }),
  18493. smalltalk.IRVariable);
  18494. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  18495. smalltalk.addMethod(
  18496. "_accept_",
  18497. smalltalk.method({
  18498. selector: "accept:",
  18499. category: 'visiting',
  18500. fn: function (aVisitor){
  18501. var self=this;
  18502. var $1;
  18503. $1=smalltalk.send(aVisitor,"_visitIRVerbatim_",[self]);
  18504. return $1;
  18505. },
  18506. args: ["aVisitor"],
  18507. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  18508. messageSends: ["visitIRVerbatim:"],
  18509. referencedClasses: []
  18510. }),
  18511. smalltalk.IRVerbatim);
  18512. smalltalk.addMethod(
  18513. "_source",
  18514. smalltalk.method({
  18515. selector: "source",
  18516. category: 'accessing',
  18517. fn: function (){
  18518. var self=this;
  18519. return self["@source"];
  18520. },
  18521. args: [],
  18522. source: "source\x0a\x09^ source",
  18523. messageSends: [],
  18524. referencedClasses: []
  18525. }),
  18526. smalltalk.IRVerbatim);
  18527. smalltalk.addMethod(
  18528. "_source_",
  18529. smalltalk.method({
  18530. selector: "source:",
  18531. category: 'accessing',
  18532. fn: function (aString){
  18533. var self=this;
  18534. self["@source"]=aString;
  18535. return self},
  18536. args: ["aString"],
  18537. source: "source: aString\x0a\x09source := aString",
  18538. messageSends: [],
  18539. referencedClasses: []
  18540. }),
  18541. smalltalk.IRVerbatim);
  18542. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  18543. smalltalk.addMethod(
  18544. "_visit_",
  18545. smalltalk.method({
  18546. selector: "visit:",
  18547. category: 'visiting',
  18548. fn: function (anIRInstruction){
  18549. var self=this;
  18550. var $1;
  18551. $1=smalltalk.send(anIRInstruction,"_accept_",[self]);
  18552. return $1;
  18553. },
  18554. args: ["anIRInstruction"],
  18555. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  18556. messageSends: ["accept:"],
  18557. referencedClasses: []
  18558. }),
  18559. smalltalk.IRVisitor);
  18560. smalltalk.addMethod(
  18561. "_visitIRAssignment_",
  18562. smalltalk.method({
  18563. selector: "visitIRAssignment:",
  18564. category: 'visiting',
  18565. fn: function (anIRAssignment){
  18566. var self=this;
  18567. var $1;
  18568. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRAssignment]);
  18569. return $1;
  18570. },
  18571. args: ["anIRAssignment"],
  18572. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  18573. messageSends: ["visitIRInstruction:"],
  18574. referencedClasses: []
  18575. }),
  18576. smalltalk.IRVisitor);
  18577. smalltalk.addMethod(
  18578. "_visitIRBlockReturn_",
  18579. smalltalk.method({
  18580. selector: "visitIRBlockReturn:",
  18581. category: 'visiting',
  18582. fn: function (anIRBlockReturn){
  18583. var self=this;
  18584. var $1;
  18585. $1=smalltalk.send(self,"_visitIRReturn_",[anIRBlockReturn]);
  18586. return $1;
  18587. },
  18588. args: ["anIRBlockReturn"],
  18589. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  18590. messageSends: ["visitIRReturn:"],
  18591. referencedClasses: []
  18592. }),
  18593. smalltalk.IRVisitor);
  18594. smalltalk.addMethod(
  18595. "_visitIRBlockSequence_",
  18596. smalltalk.method({
  18597. selector: "visitIRBlockSequence:",
  18598. category: 'visiting',
  18599. fn: function (anIRBlockSequence){
  18600. var self=this;
  18601. var $1;
  18602. $1=smalltalk.send(self,"_visitIRSequence_",[anIRBlockSequence]);
  18603. return $1;
  18604. },
  18605. args: ["anIRBlockSequence"],
  18606. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  18607. messageSends: ["visitIRSequence:"],
  18608. referencedClasses: []
  18609. }),
  18610. smalltalk.IRVisitor);
  18611. smalltalk.addMethod(
  18612. "_visitIRClosure_",
  18613. smalltalk.method({
  18614. selector: "visitIRClosure:",
  18615. category: 'visiting',
  18616. fn: function (anIRClosure){
  18617. var self=this;
  18618. var $1;
  18619. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRClosure]);
  18620. return $1;
  18621. },
  18622. args: ["anIRClosure"],
  18623. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  18624. messageSends: ["visitIRInstruction:"],
  18625. referencedClasses: []
  18626. }),
  18627. smalltalk.IRVisitor);
  18628. smalltalk.addMethod(
  18629. "_visitIRDynamicArray_",
  18630. smalltalk.method({
  18631. selector: "visitIRDynamicArray:",
  18632. category: 'visiting',
  18633. fn: function (anIRDynamicArray){
  18634. var self=this;
  18635. var $1;
  18636. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicArray]);
  18637. return $1;
  18638. },
  18639. args: ["anIRDynamicArray"],
  18640. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  18641. messageSends: ["visitIRInstruction:"],
  18642. referencedClasses: []
  18643. }),
  18644. smalltalk.IRVisitor);
  18645. smalltalk.addMethod(
  18646. "_visitIRDynamicDictionary_",
  18647. smalltalk.method({
  18648. selector: "visitIRDynamicDictionary:",
  18649. category: 'visiting',
  18650. fn: function (anIRDynamicDictionary){
  18651. var self=this;
  18652. var $1;
  18653. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicDictionary]);
  18654. return $1;
  18655. },
  18656. args: ["anIRDynamicDictionary"],
  18657. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  18658. messageSends: ["visitIRInstruction:"],
  18659. referencedClasses: []
  18660. }),
  18661. smalltalk.IRVisitor);
  18662. smalltalk.addMethod(
  18663. "_visitIRInlinedClosure_",
  18664. smalltalk.method({
  18665. selector: "visitIRInlinedClosure:",
  18666. category: 'visiting',
  18667. fn: function (anIRInlinedClosure){
  18668. var self=this;
  18669. var $1;
  18670. $1=smalltalk.send(self,"_visitIRClosure_",[anIRInlinedClosure]);
  18671. return $1;
  18672. },
  18673. args: ["anIRInlinedClosure"],
  18674. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  18675. messageSends: ["visitIRClosure:"],
  18676. referencedClasses: []
  18677. }),
  18678. smalltalk.IRVisitor);
  18679. smalltalk.addMethod(
  18680. "_visitIRInlinedSequence_",
  18681. smalltalk.method({
  18682. selector: "visitIRInlinedSequence:",
  18683. category: 'visiting',
  18684. fn: function (anIRInlinedSequence){
  18685. var self=this;
  18686. var $1;
  18687. $1=smalltalk.send(self,"_visitIRSequence_",[anIRInlinedSequence]);
  18688. return $1;
  18689. },
  18690. args: ["anIRInlinedSequence"],
  18691. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  18692. messageSends: ["visitIRSequence:"],
  18693. referencedClasses: []
  18694. }),
  18695. smalltalk.IRVisitor);
  18696. smalltalk.addMethod(
  18697. "_visitIRInstruction_",
  18698. smalltalk.method({
  18699. selector: "visitIRInstruction:",
  18700. category: 'visiting',
  18701. fn: function (anIRInstruction){
  18702. var self=this;
  18703. smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_do_",[(function(each){
  18704. return smalltalk.send(self,"_visit_",[each]);
  18705. })]);
  18706. return anIRInstruction;
  18707. },
  18708. args: ["anIRInstruction"],
  18709. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  18710. messageSends: ["do:", "visit:", "instructions"],
  18711. referencedClasses: []
  18712. }),
  18713. smalltalk.IRVisitor);
  18714. smalltalk.addMethod(
  18715. "_visitIRMethod_",
  18716. smalltalk.method({
  18717. selector: "visitIRMethod:",
  18718. category: 'visiting',
  18719. fn: function (anIRMethod){
  18720. var self=this;
  18721. var $1;
  18722. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRMethod]);
  18723. return $1;
  18724. },
  18725. args: ["anIRMethod"],
  18726. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  18727. messageSends: ["visitIRInstruction:"],
  18728. referencedClasses: []
  18729. }),
  18730. smalltalk.IRVisitor);
  18731. smalltalk.addMethod(
  18732. "_visitIRNonLocalReturn_",
  18733. smalltalk.method({
  18734. selector: "visitIRNonLocalReturn:",
  18735. category: 'visiting',
  18736. fn: function (anIRNonLocalReturn){
  18737. var self=this;
  18738. var $1;
  18739. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturn]);
  18740. return $1;
  18741. },
  18742. args: ["anIRNonLocalReturn"],
  18743. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  18744. messageSends: ["visitIRInstruction:"],
  18745. referencedClasses: []
  18746. }),
  18747. smalltalk.IRVisitor);
  18748. smalltalk.addMethod(
  18749. "_visitIRNonLocalReturnHandling_",
  18750. smalltalk.method({
  18751. selector: "visitIRNonLocalReturnHandling:",
  18752. category: 'visiting',
  18753. fn: function (anIRNonLocalReturnHandling){
  18754. var self=this;
  18755. var $1;
  18756. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturnHandling]);
  18757. return $1;
  18758. },
  18759. args: ["anIRNonLocalReturnHandling"],
  18760. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  18761. messageSends: ["visitIRInstruction:"],
  18762. referencedClasses: []
  18763. }),
  18764. smalltalk.IRVisitor);
  18765. smalltalk.addMethod(
  18766. "_visitIRReturn_",
  18767. smalltalk.method({
  18768. selector: "visitIRReturn:",
  18769. category: 'visiting',
  18770. fn: function (anIRReturn){
  18771. var self=this;
  18772. var $1;
  18773. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRReturn]);
  18774. return $1;
  18775. },
  18776. args: ["anIRReturn"],
  18777. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  18778. messageSends: ["visitIRInstruction:"],
  18779. referencedClasses: []
  18780. }),
  18781. smalltalk.IRVisitor);
  18782. smalltalk.addMethod(
  18783. "_visitIRSend_",
  18784. smalltalk.method({
  18785. selector: "visitIRSend:",
  18786. category: 'visiting',
  18787. fn: function (anIRSend){
  18788. var self=this;
  18789. var $1;
  18790. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSend]);
  18791. return $1;
  18792. },
  18793. args: ["anIRSend"],
  18794. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  18795. messageSends: ["visitIRInstruction:"],
  18796. referencedClasses: []
  18797. }),
  18798. smalltalk.IRVisitor);
  18799. smalltalk.addMethod(
  18800. "_visitIRSequence_",
  18801. smalltalk.method({
  18802. selector: "visitIRSequence:",
  18803. category: 'visiting',
  18804. fn: function (anIRSequence){
  18805. var self=this;
  18806. var $1;
  18807. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSequence]);
  18808. return $1;
  18809. },
  18810. args: ["anIRSequence"],
  18811. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  18812. messageSends: ["visitIRInstruction:"],
  18813. referencedClasses: []
  18814. }),
  18815. smalltalk.IRVisitor);
  18816. smalltalk.addMethod(
  18817. "_visitIRTempDeclaration_",
  18818. smalltalk.method({
  18819. selector: "visitIRTempDeclaration:",
  18820. category: 'visiting',
  18821. fn: function (anIRTempDeclaration){
  18822. var self=this;
  18823. var $1;
  18824. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRTempDeclaration]);
  18825. return $1;
  18826. },
  18827. args: ["anIRTempDeclaration"],
  18828. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  18829. messageSends: ["visitIRInstruction:"],
  18830. referencedClasses: []
  18831. }),
  18832. smalltalk.IRVisitor);
  18833. smalltalk.addMethod(
  18834. "_visitIRValue_",
  18835. smalltalk.method({
  18836. selector: "visitIRValue:",
  18837. category: 'visiting',
  18838. fn: function (anIRValue){
  18839. var self=this;
  18840. var $1;
  18841. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRValue]);
  18842. return $1;
  18843. },
  18844. args: ["anIRValue"],
  18845. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  18846. messageSends: ["visitIRInstruction:"],
  18847. referencedClasses: []
  18848. }),
  18849. smalltalk.IRVisitor);
  18850. smalltalk.addMethod(
  18851. "_visitIRVariable_",
  18852. smalltalk.method({
  18853. selector: "visitIRVariable:",
  18854. category: 'visiting',
  18855. fn: function (anIRVariable){
  18856. var self=this;
  18857. var $1;
  18858. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVariable]);
  18859. return $1;
  18860. },
  18861. args: ["anIRVariable"],
  18862. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  18863. messageSends: ["visitIRInstruction:"],
  18864. referencedClasses: []
  18865. }),
  18866. smalltalk.IRVisitor);
  18867. smalltalk.addMethod(
  18868. "_visitIRVerbatim_",
  18869. smalltalk.method({
  18870. selector: "visitIRVerbatim:",
  18871. category: 'visiting',
  18872. fn: function (anIRVerbatim){
  18873. var self=this;
  18874. var $1;
  18875. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVerbatim]);
  18876. return $1;
  18877. },
  18878. args: ["anIRVerbatim"],
  18879. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  18880. messageSends: ["visitIRInstruction:"],
  18881. referencedClasses: []
  18882. }),
  18883. smalltalk.IRVisitor);
  18884. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  18885. smalltalk.addMethod(
  18886. "_contents",
  18887. smalltalk.method({
  18888. selector: "contents",
  18889. category: 'accessing',
  18890. fn: function (){
  18891. var self=this;
  18892. var $1;
  18893. $1=smalltalk.send(smalltalk.send(self,"_stream",[]),"_contents",[]);
  18894. return $1;
  18895. },
  18896. args: [],
  18897. source: "contents\x0a\x09^ self stream contents",
  18898. messageSends: ["contents", "stream"],
  18899. referencedClasses: []
  18900. }),
  18901. smalltalk.IRJSTranslator);
  18902. smalltalk.addMethod(
  18903. "_initialize",
  18904. smalltalk.method({
  18905. selector: "initialize",
  18906. category: 'initialization',
  18907. fn: function (){
  18908. var self=this;
  18909. smalltalk.send(self,"_initialize",[],smalltalk.IRVisitor);
  18910. self["@stream"]=smalltalk.send((smalltalk.JSStream || JSStream),"_new",[]);
  18911. return self},
  18912. args: [],
  18913. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  18914. messageSends: ["initialize", "new"],
  18915. referencedClasses: ["JSStream"]
  18916. }),
  18917. smalltalk.IRJSTranslator);
  18918. smalltalk.addMethod(
  18919. "_stream",
  18920. smalltalk.method({
  18921. selector: "stream",
  18922. category: 'accessing',
  18923. fn: function (){
  18924. var self=this;
  18925. return self["@stream"];
  18926. },
  18927. args: [],
  18928. source: "stream\x0a\x09^ stream",
  18929. messageSends: [],
  18930. referencedClasses: []
  18931. }),
  18932. smalltalk.IRJSTranslator);
  18933. smalltalk.addMethod(
  18934. "_stream_",
  18935. smalltalk.method({
  18936. selector: "stream:",
  18937. category: 'accessing',
  18938. fn: function (aStream){
  18939. var self=this;
  18940. self["@stream"]=aStream;
  18941. return self},
  18942. args: ["aStream"],
  18943. source: "stream: aStream\x0a\x09stream := aStream",
  18944. messageSends: [],
  18945. referencedClasses: []
  18946. }),
  18947. smalltalk.IRJSTranslator);
  18948. smalltalk.addMethod(
  18949. "_visitIRAssignment_",
  18950. smalltalk.method({
  18951. selector: "visitIRAssignment:",
  18952. category: 'visiting',
  18953. fn: function (anIRAssignment){
  18954. var self=this;
  18955. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_first",[])]);
  18956. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAssignment",[]);
  18957. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  18958. return self},
  18959. args: ["anIRAssignment"],
  18960. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  18961. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  18962. referencedClasses: []
  18963. }),
  18964. smalltalk.IRJSTranslator);
  18965. smalltalk.addMethod(
  18966. "_visitIRClosure_",
  18967. smalltalk.method({
  18968. selector: "visitIRClosure:",
  18969. category: 'visiting',
  18970. fn: function (anIRClosure){
  18971. var self=this;
  18972. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutClosureWith_arguments_",[(function(){
  18973. return smalltalk.send(self,"_visitIRClosure_",[anIRClosure],smalltalk.IRVisitor);
  18974. }),smalltalk.send(anIRClosure,"_arguments",[])]);
  18975. return self},
  18976. args: ["anIRClosure"],
  18977. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  18978. messageSends: ["nextPutClosureWith:arguments:", "visitIRClosure:", "arguments", "stream"],
  18979. referencedClasses: []
  18980. }),
  18981. smalltalk.IRJSTranslator);
  18982. smalltalk.addMethod(
  18983. "_visitIRDynamicArray_",
  18984. smalltalk.method({
  18985. selector: "visitIRDynamicArray:",
  18986. category: 'visiting',
  18987. fn: function (anIRDynamicArray){
  18988. var self=this;
  18989. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["["]);
  18990. smalltalk.send(smalltalk.send(anIRDynamicArray,"_instructions",[]),"_do_separatedBy_",[(function(each){
  18991. return smalltalk.send(self,"_visit_",[each]);
  18992. }),(function(){
  18993. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  18994. })]);
  18995. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  18996. return self},
  18997. args: ["anIRDynamicArray"],
  18998. 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: ']'",
  18999. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  19000. referencedClasses: []
  19001. }),
  19002. smalltalk.IRJSTranslator);
  19003. smalltalk.addMethod(
  19004. "_visitIRDynamicDictionary_",
  19005. smalltalk.method({
  19006. selector: "visitIRDynamicDictionary:",
  19007. category: 'visiting',
  19008. fn: function (anIRDynamicDictionary){
  19009. var self=this;
  19010. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  19011. smalltalk.send(smalltalk.send(anIRDynamicDictionary,"_instructions",[]),"_do_separatedBy_",[(function(each){
  19012. return smalltalk.send(self,"_visit_",[each]);
  19013. }),(function(){
  19014. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  19015. })]);
  19016. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["])"]);
  19017. return self},
  19018. args: ["anIRDynamicDictionary"],
  19019. 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: '])'",
  19020. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  19021. referencedClasses: []
  19022. }),
  19023. smalltalk.IRJSTranslator);
  19024. smalltalk.addMethod(
  19025. "_visitIRMethod_",
  19026. smalltalk.method({
  19027. selector: "visitIRMethod:",
  19028. category: 'visiting',
  19029. fn: function (anIRMethod){
  19030. var self=this;
  19031. var $1,$2;
  19032. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutMethodDeclaration_with_",[anIRMethod,(function(){
  19033. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutFunctionWith_arguments_",[(function(){
  19034. $1=smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_notEmpty",[]);
  19035. if(smalltalk.assert($1)){
  19036. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVars_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_asArray",[]),"_collect_",[(function(each){
  19037. return smalltalk.send(smalltalk.send(each,"_variable",[]),"_alias",[]);
  19038. })])]);
  19039. };
  19040. $2=smalltalk.send(smalltalk.send(anIRMethod,"_scope",[]),"_hasNonLocalReturn",[]);
  19041. if(smalltalk.assert($2)){
  19042. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnHandlingWith_",[(function(){
  19043. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  19044. })]);
  19045. } else {
  19046. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  19047. };
  19048. }),smalltalk.send(anIRMethod,"_arguments",[])]);
  19049. })]);
  19050. return self},
  19051. args: ["anIRMethod"],
  19052. 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 ]",
  19053. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "ifTrue:", "nextPutVars:", "collect:", "alias", "variable", "asArray", "internalVariables", "stream", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  19054. referencedClasses: []
  19055. }),
  19056. smalltalk.IRJSTranslator);
  19057. smalltalk.addMethod(
  19058. "_visitIRNonLocalReturn_",
  19059. smalltalk.method({
  19060. selector: "visitIRNonLocalReturn:",
  19061. category: 'visiting',
  19062. fn: function (anIRNonLocalReturn){
  19063. var self=this;
  19064. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  19065. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  19066. })]);
  19067. return self},
  19068. args: ["anIRNonLocalReturn"],
  19069. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  19070. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  19071. referencedClasses: []
  19072. }),
  19073. smalltalk.IRJSTranslator);
  19074. smalltalk.addMethod(
  19075. "_visitIRReturn_",
  19076. smalltalk.method({
  19077. selector: "visitIRReturn:",
  19078. category: 'visiting',
  19079. fn: function (anIRReturn){
  19080. var self=this;
  19081. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturnWith_",[(function(){
  19082. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  19083. })]);
  19084. return self},
  19085. args: ["anIRReturn"],
  19086. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  19087. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  19088. referencedClasses: []
  19089. }),
  19090. smalltalk.IRJSTranslator);
  19091. smalltalk.addMethod(
  19092. "_visitIRSend_",
  19093. smalltalk.method({
  19094. selector: "visitIRSend:",
  19095. category: 'visiting',
  19096. fn: function (anIRSend){
  19097. var self=this;
  19098. var $1;
  19099. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
  19100. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
  19101. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_selector",[]),"_asSelector",[])]),"__comma",["\x22,["])]);
  19102. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_allButFirst",[]),"_do_separatedBy_",[(function(each){
  19103. return smalltalk.send(self,"_visit_",[each]);
  19104. }),(function(){
  19105. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  19106. })]);
  19107. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["]"]);
  19108. $1=smalltalk.send(anIRSend,"_classSend",[]);
  19109. if(($receiver = $1) == nil || $receiver == undefined){
  19110. $1;
  19111. } else {
  19112. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(",","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_classSend",[]),"_asJavascript",[])])]);
  19113. };
  19114. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  19115. return self},
  19116. args: ["anIRSend"],
  19117. 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: ')'",
  19118. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "asJavascript", "classSend"],
  19119. referencedClasses: []
  19120. }),
  19121. smalltalk.IRJSTranslator);
  19122. smalltalk.addMethod(
  19123. "_visitIRSequence_",
  19124. smalltalk.method({
  19125. selector: "visitIRSequence:",
  19126. category: 'visiting',
  19127. fn: function (anIRSequence){
  19128. var self=this;
  19129. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutSequenceWith_",[(function(){
  19130. return smalltalk.send(smalltalk.send(anIRSequence,"_instructions",[]),"_do_",[(function(each){
  19131. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[smalltalk.send(self,"_visit_",[each])]);
  19132. })]);
  19133. })]);
  19134. return self},
  19135. args: ["anIRSequence"],
  19136. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  19137. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  19138. referencedClasses: []
  19139. }),
  19140. smalltalk.IRJSTranslator);
  19141. smalltalk.addMethod(
  19142. "_visitIRTempDeclaration_",
  19143. smalltalk.method({
  19144. selector: "visitIRTempDeclaration:",
  19145. category: 'visiting',
  19146. fn: function (anIRTempDeclaration){
  19147. var self=this;
  19148. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVar_",[smalltalk.send(smalltalk.send(anIRTempDeclaration,"_name",[]),"_asVariableName",[])]);
  19149. return self},
  19150. args: ["anIRTempDeclaration"],
  19151. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  19152. messageSends: ["nextPutVar:", "asVariableName", "name", "stream"],
  19153. referencedClasses: []
  19154. }),
  19155. smalltalk.IRJSTranslator);
  19156. smalltalk.addMethod(
  19157. "_visitIRValue_",
  19158. smalltalk.method({
  19159. selector: "visitIRValue:",
  19160. category: 'visiting',
  19161. fn: function (anIRValue){
  19162. var self=this;
  19163. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRValue,"_value",[]),"_asJavascript",[])]);
  19164. return self},
  19165. args: ["anIRValue"],
  19166. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  19167. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  19168. referencedClasses: []
  19169. }),
  19170. smalltalk.IRJSTranslator);
  19171. smalltalk.addMethod(
  19172. "_visitIRVariable_",
  19173. smalltalk.method({
  19174. selector: "visitIRVariable:",
  19175. category: 'visiting',
  19176. fn: function (anIRVariable){
  19177. var self=this;
  19178. var $1;
  19179. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_name",[]),"__eq",["thisContext"]);
  19180. if(smalltalk.assert($1)){
  19181. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.getThisContext()"]);
  19182. } else {
  19183. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_alias",[])]);
  19184. };
  19185. return self},
  19186. args: ["anIRVariable"],
  19187. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a \x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a \x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  19188. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  19189. referencedClasses: []
  19190. }),
  19191. smalltalk.IRJSTranslator);
  19192. smalltalk.addMethod(
  19193. "_visitIRVerbatim_",
  19194. smalltalk.method({
  19195. selector: "visitIRVerbatim:",
  19196. category: 'visiting',
  19197. fn: function (anIRVerbatim){
  19198. var self=this;
  19199. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  19200. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(anIRVerbatim,"_source",[])]);
  19201. })]);
  19202. return self},
  19203. args: ["anIRVerbatim"],
  19204. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  19205. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  19206. referencedClasses: []
  19207. }),
  19208. smalltalk.IRJSTranslator);
  19209. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  19210. smalltalk.addMethod(
  19211. "_contents",
  19212. smalltalk.method({
  19213. selector: "contents",
  19214. category: 'accessing',
  19215. fn: function (){
  19216. var self=this;
  19217. var $1;
  19218. $1=smalltalk.send(self["@stream"],"_contents",[]);
  19219. return $1;
  19220. },
  19221. args: [],
  19222. source: "contents\x0a\x09^ stream contents",
  19223. messageSends: ["contents"],
  19224. referencedClasses: []
  19225. }),
  19226. smalltalk.JSStream);
  19227. smalltalk.addMethod(
  19228. "_initialize",
  19229. smalltalk.method({
  19230. selector: "initialize",
  19231. category: 'initialization',
  19232. fn: function (){
  19233. var self=this;
  19234. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  19235. self["@stream"]=smalltalk.send("","_writeStream",[]);
  19236. return self},
  19237. args: [],
  19238. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  19239. messageSends: ["initialize", "writeStream"],
  19240. referencedClasses: []
  19241. }),
  19242. smalltalk.JSStream);
  19243. smalltalk.addMethod(
  19244. "_lf",
  19245. smalltalk.method({
  19246. selector: "lf",
  19247. category: 'streaming',
  19248. fn: function (){
  19249. var self=this;
  19250. smalltalk.send(self["@stream"],"_lf",[]);
  19251. return self},
  19252. args: [],
  19253. source: "lf\x0a\x09stream lf",
  19254. messageSends: ["lf"],
  19255. referencedClasses: []
  19256. }),
  19257. smalltalk.JSStream);
  19258. smalltalk.addMethod(
  19259. "_nextPut_",
  19260. smalltalk.method({
  19261. selector: "nextPut:",
  19262. category: 'streaming',
  19263. fn: function (aString){
  19264. var self=this;
  19265. smalltalk.send(self["@stream"],"_nextPut_",[aString]);
  19266. return self},
  19267. args: ["aString"],
  19268. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  19269. messageSends: ["nextPut:"],
  19270. referencedClasses: []
  19271. }),
  19272. smalltalk.JSStream);
  19273. smalltalk.addMethod(
  19274. "_nextPutAll_",
  19275. smalltalk.method({
  19276. selector: "nextPutAll:",
  19277. category: 'streaming',
  19278. fn: function (aString){
  19279. var self=this;
  19280. smalltalk.send(self["@stream"],"_nextPutAll_",[aString]);
  19281. return self},
  19282. args: ["aString"],
  19283. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  19284. messageSends: ["nextPutAll:"],
  19285. referencedClasses: []
  19286. }),
  19287. smalltalk.JSStream);
  19288. smalltalk.addMethod(
  19289. "_nextPutAssignment",
  19290. smalltalk.method({
  19291. selector: "nextPutAssignment",
  19292. category: 'streaming',
  19293. fn: function (){
  19294. var self=this;
  19295. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  19296. return self},
  19297. args: [],
  19298. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  19299. messageSends: ["nextPutAll:"],
  19300. referencedClasses: []
  19301. }),
  19302. smalltalk.JSStream);
  19303. smalltalk.addMethod(
  19304. "_nextPutClosureWith_arguments_",
  19305. smalltalk.method({
  19306. selector: "nextPutClosureWith:arguments:",
  19307. category: 'streaming',
  19308. fn: function (aBlock,anArray){
  19309. var self=this;
  19310. var $1;
  19311. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  19312. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  19313. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  19314. }),(function(){
  19315. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  19316. })]);
  19317. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19318. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19319. smalltalk.send(aBlock,"_value",[]);
  19320. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  19321. return self},
  19322. args: ["aBlock", "anArray"],
  19323. 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: '})'",
  19324. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  19325. referencedClasses: []
  19326. }),
  19327. smalltalk.JSStream);
  19328. smalltalk.addMethod(
  19329. "_nextPutFunctionWith_arguments_",
  19330. smalltalk.method({
  19331. selector: "nextPutFunctionWith:arguments:",
  19332. category: 'streaming',
  19333. fn: function (aBlock,anArray){
  19334. var self=this;
  19335. var $1,$2;
  19336. smalltalk.send(self["@stream"],"_nextPutAll_",["fn: function("]);
  19337. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  19338. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  19339. }),(function(){
  19340. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  19341. })]);
  19342. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19343. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19344. smalltalk.send(self["@stream"],"_nextPutAll_",["var self=this;"]);
  19345. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19346. smalltalk.send(aBlock,"_value",[]);
  19347. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19348. return self},
  19349. args: ["aBlock", "anArray"],
  19350. 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: '}'",
  19351. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  19352. referencedClasses: []
  19353. }),
  19354. smalltalk.JSStream);
  19355. smalltalk.addMethod(
  19356. "_nextPutIf_with_",
  19357. smalltalk.method({
  19358. selector: "nextPutIf:with:",
  19359. category: 'streaming',
  19360. fn: function (aBlock,anotherBlock){
  19361. var self=this;
  19362. var $1;
  19363. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  19364. smalltalk.send(aBlock,"_value",[]);
  19365. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19366. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19367. smalltalk.send(anotherBlock,"_value",[]);
  19368. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19369. return self},
  19370. args: ["aBlock", "anotherBlock"],
  19371. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  19372. messageSends: ["nextPutAll:", "value", "lf"],
  19373. referencedClasses: []
  19374. }),
  19375. smalltalk.JSStream);
  19376. smalltalk.addMethod(
  19377. "_nextPutIfElse_with_with_",
  19378. smalltalk.method({
  19379. selector: "nextPutIfElse:with:with:",
  19380. category: 'streaming',
  19381. fn: function (aBlock,ifBlock,elseBlock){
  19382. var self=this;
  19383. var $1,$2;
  19384. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  19385. smalltalk.send(aBlock,"_value",[]);
  19386. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  19387. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19388. smalltalk.send(ifBlock,"_value",[]);
  19389. smalltalk.send(self["@stream"],"_nextPutAll_",["} else {"]);
  19390. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19391. smalltalk.send(elseBlock,"_value",[]);
  19392. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19393. return self},
  19394. args: ["aBlock", "ifBlock", "elseBlock"],
  19395. 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: '}'",
  19396. messageSends: ["nextPutAll:", "value", "lf"],
  19397. referencedClasses: []
  19398. }),
  19399. smalltalk.JSStream);
  19400. smalltalk.addMethod(
  19401. "_nextPutMethodDeclaration_with_",
  19402. smalltalk.method({
  19403. selector: "nextPutMethodDeclaration:with:",
  19404. category: 'streaming',
  19405. fn: function (aMethod,aBlock){
  19406. var self=this;
  19407. var $1,$2,$3;
  19408. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
  19409. smalltalk.send(self["@stream"],"_lf",[]);
  19410. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
  19411. smalltalk.send(self["@stream"],"_lf",[]);
  19412. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
  19413. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19414. smalltalk.send(aBlock,"_value",[]);
  19415. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
  19416. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
  19417. smalltalk.send(self["@stream"],"_lf",[]);
  19418. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
  19419. return smalltalk.send(each,"_value",[]);
  19420. })]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
  19421. smalltalk.send(self["@stream"],"_lf",[]);
  19422. $2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
  19423. smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
  19424. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
  19425. }),(function(){
  19426. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19427. })]);
  19428. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  19429. $3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  19430. return self},
  19431. args: ["aMethod", "aBlock"],
  19432. 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: '})'",
  19433. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  19434. referencedClasses: ["String"]
  19435. }),
  19436. smalltalk.JSStream);
  19437. smalltalk.addMethod(
  19438. "_nextPutNonLocalReturnHandlingWith_",
  19439. smalltalk.method({
  19440. selector: "nextPutNonLocalReturnHandlingWith:",
  19441. category: 'streaming',
  19442. fn: function (aBlock){
  19443. var self=this;
  19444. var $1,$2;
  19445. smalltalk.send(self["@stream"],"_nextPutAll_",["var $early={};"]);
  19446. smalltalk.send(self["@stream"],"_lf",[]);
  19447. smalltalk.send(self["@stream"],"_nextPutAll_",["try {"]);
  19448. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19449. smalltalk.send(aBlock,"_value",[]);
  19450. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  19451. smalltalk.send(self["@stream"],"_lf",[]);
  19452. smalltalk.send(self["@stream"],"_nextPutAll_",["catch(e) {if(e===$early)return e[0]; throw e}"]);
  19453. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19454. return self},
  19455. args: ["aBlock"],
  19456. 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",
  19457. messageSends: ["nextPutAll:", "lf", "value"],
  19458. referencedClasses: []
  19459. }),
  19460. smalltalk.JSStream);
  19461. smalltalk.addMethod(
  19462. "_nextPutNonLocalReturnWith_",
  19463. smalltalk.method({
  19464. selector: "nextPutNonLocalReturnWith:",
  19465. category: 'streaming',
  19466. fn: function (aBlock){
  19467. var self=this;
  19468. smalltalk.send(self["@stream"],"_nextPutAll_",["throw $early=["]);
  19469. smalltalk.send(aBlock,"_value",[]);
  19470. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  19471. return self},
  19472. args: ["aBlock"],
  19473. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  19474. messageSends: ["nextPutAll:", "value"],
  19475. referencedClasses: []
  19476. }),
  19477. smalltalk.JSStream);
  19478. smalltalk.addMethod(
  19479. "_nextPutReturn",
  19480. smalltalk.method({
  19481. selector: "nextPutReturn",
  19482. category: 'streaming',
  19483. fn: function (){
  19484. var self=this;
  19485. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  19486. return self},
  19487. args: [],
  19488. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  19489. messageSends: ["nextPutAll:"],
  19490. referencedClasses: []
  19491. }),
  19492. smalltalk.JSStream);
  19493. smalltalk.addMethod(
  19494. "_nextPutReturnWith_",
  19495. smalltalk.method({
  19496. selector: "nextPutReturnWith:",
  19497. category: 'streaming',
  19498. fn: function (aBlock){
  19499. var self=this;
  19500. smalltalk.send(self,"_nextPutReturn",[]);
  19501. smalltalk.send(aBlock,"_value",[]);
  19502. return self},
  19503. args: ["aBlock"],
  19504. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  19505. messageSends: ["nextPutReturn", "value"],
  19506. referencedClasses: []
  19507. }),
  19508. smalltalk.JSStream);
  19509. smalltalk.addMethod(
  19510. "_nextPutSendTo_selector_arguments_",
  19511. smalltalk.method({
  19512. selector: "nextPutSendTo:selector:arguments:",
  19513. category: 'streaming',
  19514. fn: function (receiver,selector,arguments){
  19515. var self=this;
  19516. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.send("]);
  19517. smalltalk.send(receiver,"_emitOn_",[self]);
  19518. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(selector,"_asSelector",[])]),"__comma",["\x22,["])]);
  19519. smalltalk.send(arguments,"_do_separatedBy_",[(function(each){
  19520. return smalltalk.send(each,"_emitOn_",[self]);
  19521. }),(function(){
  19522. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19523. })]);
  19524. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  19525. return self},
  19526. args: ["receiver", "selector", "arguments"],
  19527. 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: '])'",
  19528. messageSends: ["nextPutAll:", "emitOn:", ",", "asSelector", "do:separatedBy:"],
  19529. referencedClasses: []
  19530. }),
  19531. smalltalk.JSStream);
  19532. smalltalk.addMethod(
  19533. "_nextPutSequenceWith_",
  19534. smalltalk.method({
  19535. selector: "nextPutSequenceWith:",
  19536. category: 'streaming',
  19537. fn: function (aBlock){
  19538. var self=this;
  19539. smalltalk.send(aBlock,"_value",[]);
  19540. return self},
  19541. args: ["aBlock"],
  19542. 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",
  19543. messageSends: ["value"],
  19544. referencedClasses: []
  19545. }),
  19546. smalltalk.JSStream);
  19547. smalltalk.addMethod(
  19548. "_nextPutStatement_with_",
  19549. smalltalk.method({
  19550. selector: "nextPutStatement:with:",
  19551. category: 'streaming',
  19552. fn: function (anInteger,aBlock){
  19553. var self=this;
  19554. var $1,$2;
  19555. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("case ","__comma",[smalltalk.send(anInteger,"_asString",[])]),"__comma",[":"])]);
  19556. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19557. smalltalk.send(self,"_nextPutStatementWith_",[aBlock]);
  19558. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=","__comma",[smalltalk.send(smalltalk.send(anInteger,"__plus",[(1)]),"_asString",[])]),"__comma",[";"])]);
  19559. $2=smalltalk.send(self["@stream"],"_lf",[]);
  19560. return self},
  19561. args: ["anInteger", "aBlock"],
  19562. 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",
  19563. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  19564. referencedClasses: []
  19565. }),
  19566. smalltalk.JSStream);
  19567. smalltalk.addMethod(
  19568. "_nextPutStatementWith_",
  19569. smalltalk.method({
  19570. selector: "nextPutStatementWith:",
  19571. category: 'streaming',
  19572. fn: function (aBlock){
  19573. var self=this;
  19574. var $1;
  19575. smalltalk.send(aBlock,"_value",[]);
  19576. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  19577. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19578. return self},
  19579. args: ["aBlock"],
  19580. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  19581. messageSends: ["value", "nextPutAll:", "lf"],
  19582. referencedClasses: []
  19583. }),
  19584. smalltalk.JSStream);
  19585. smalltalk.addMethod(
  19586. "_nextPutVar_",
  19587. smalltalk.method({
  19588. selector: "nextPutVar:",
  19589. category: 'streaming',
  19590. fn: function (aString){
  19591. var self=this;
  19592. var $1;
  19593. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[aString]),"__comma",[";"])]);
  19594. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19595. return self},
  19596. args: ["aString"],
  19597. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  19598. messageSends: ["nextPutAll:", ",", "lf"],
  19599. referencedClasses: []
  19600. }),
  19601. smalltalk.JSStream);
  19602. smalltalk.addMethod(
  19603. "_nextPutVars_",
  19604. smalltalk.method({
  19605. selector: "nextPutVars:",
  19606. category: 'streaming',
  19607. fn: function (aCollection){
  19608. var self=this;
  19609. var $1;
  19610. smalltalk.send(self["@stream"],"_nextPutAll_",["var "]);
  19611. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  19612. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  19613. }),(function(){
  19614. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  19615. })]);
  19616. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  19617. $1=smalltalk.send(self["@stream"],"_lf",[]);
  19618. return self},
  19619. args: ["aCollection"],
  19620. 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",
  19621. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  19622. referencedClasses: []
  19623. }),
  19624. smalltalk.JSStream);
  19625. smalltalk.addMethod(
  19626. "_appendToInstruction_",
  19627. smalltalk.method({
  19628. selector: "appendToInstruction:",
  19629. category: '*Compiler-IR',
  19630. fn: function (anIRInstruction){
  19631. var self=this;
  19632. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  19633. return self},
  19634. args: ["anIRInstruction"],
  19635. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  19636. messageSends: ["appendBlock:"],
  19637. referencedClasses: []
  19638. }),
  19639. smalltalk.BlockClosure);
  19640. smalltalk.addMethod(
  19641. "_asVariableName",
  19642. smalltalk.method({
  19643. selector: "asVariableName",
  19644. category: '*Compiler-IR',
  19645. fn: function (){
  19646. var self=this;
  19647. var $2,$1;
  19648. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[self]);
  19649. if(smalltalk.assert($2)){
  19650. $1=smalltalk.send(self,"__comma",["_"]);
  19651. } else {
  19652. $1=self;
  19653. };
  19654. return $1;
  19655. },
  19656. args: [],
  19657. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  19658. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  19659. referencedClasses: ["Smalltalk"]
  19660. }),
  19661. smalltalk.String);
  19662. smalltalk.addPackage('Compiler-Inlining', {});
  19663. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  19664. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction."
  19665. smalltalk.addMethod(
  19666. "_accept_",
  19667. smalltalk.method({
  19668. selector: "accept:",
  19669. category: 'visiting',
  19670. fn: function (aVisitor){
  19671. var self=this;
  19672. var $1;
  19673. $1=smalltalk.send(aVisitor,"_visitIRInlinedAssignment_",[self]);
  19674. return $1;
  19675. },
  19676. args: ["aVisitor"],
  19677. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  19678. messageSends: ["visitIRInlinedAssignment:"],
  19679. referencedClasses: []
  19680. }),
  19681. smalltalk.IRInlinedAssignment);
  19682. smalltalk.addMethod(
  19683. "_isInlined",
  19684. smalltalk.method({
  19685. selector: "isInlined",
  19686. category: 'testing',
  19687. fn: function (){
  19688. var self=this;
  19689. return true;
  19690. },
  19691. args: [],
  19692. source: "isInlined\x0a\x09^ true",
  19693. messageSends: [],
  19694. referencedClasses: []
  19695. }),
  19696. smalltalk.IRInlinedAssignment);
  19697. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  19698. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction."
  19699. smalltalk.addMethod(
  19700. "_accept_",
  19701. smalltalk.method({
  19702. selector: "accept:",
  19703. category: 'visiting',
  19704. fn: function (aVisitor){
  19705. var self=this;
  19706. smalltalk.send(aVisitor,"_visitIRInlinedClosure_",[self]);
  19707. return self},
  19708. args: ["aVisitor"],
  19709. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  19710. messageSends: ["visitIRInlinedClosure:"],
  19711. referencedClasses: []
  19712. }),
  19713. smalltalk.IRInlinedClosure);
  19714. smalltalk.addMethod(
  19715. "_isInlined",
  19716. smalltalk.method({
  19717. selector: "isInlined",
  19718. category: 'testing',
  19719. fn: function (){
  19720. var self=this;
  19721. return true;
  19722. },
  19723. args: [],
  19724. source: "isInlined\x0a\x09^ true",
  19725. messageSends: [],
  19726. referencedClasses: []
  19727. }),
  19728. smalltalk.IRInlinedClosure);
  19729. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  19730. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction."
  19731. smalltalk.addMethod(
  19732. "_accept_",
  19733. smalltalk.method({
  19734. selector: "accept:",
  19735. category: 'visiting',
  19736. fn: function (aVisitor){
  19737. var self=this;
  19738. var $1;
  19739. $1=smalltalk.send(aVisitor,"_visitIRInlinedReturn_",[self]);
  19740. return $1;
  19741. },
  19742. args: ["aVisitor"],
  19743. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  19744. messageSends: ["visitIRInlinedReturn:"],
  19745. referencedClasses: []
  19746. }),
  19747. smalltalk.IRInlinedReturn);
  19748. smalltalk.addMethod(
  19749. "_isInlined",
  19750. smalltalk.method({
  19751. selector: "isInlined",
  19752. category: 'testing',
  19753. fn: function (){
  19754. var self=this;
  19755. return true;
  19756. },
  19757. args: [],
  19758. source: "isInlined\x0a\x09^ true",
  19759. messageSends: [],
  19760. referencedClasses: []
  19761. }),
  19762. smalltalk.IRInlinedReturn);
  19763. smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRInlinedReturn, [], 'Compiler-Inlining');
  19764. smalltalk.IRInlinedNonLocalReturn.comment="I represent an inlined non local return instruction."
  19765. smalltalk.addMethod(
  19766. "_accept_",
  19767. smalltalk.method({
  19768. selector: "accept:",
  19769. category: 'visiting',
  19770. fn: function (aVisitor){
  19771. var self=this;
  19772. var $1;
  19773. $1=smalltalk.send(aVisitor,"_visitIRInlinedNonLocalReturn_",[self]);
  19774. return $1;
  19775. },
  19776. args: ["aVisitor"],
  19777. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedNonLocalReturn: self",
  19778. messageSends: ["visitIRInlinedNonLocalReturn:"],
  19779. referencedClasses: []
  19780. }),
  19781. smalltalk.IRInlinedNonLocalReturn);
  19782. smalltalk.addMethod(
  19783. "_isInlined",
  19784. smalltalk.method({
  19785. selector: "isInlined",
  19786. category: 'testing',
  19787. fn: function (){
  19788. var self=this;
  19789. return true;
  19790. },
  19791. args: [],
  19792. source: "isInlined\x0a\x09^ true",
  19793. messageSends: [],
  19794. referencedClasses: []
  19795. }),
  19796. smalltalk.IRInlinedNonLocalReturn);
  19797. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  19798. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."
  19799. smalltalk.addMethod(
  19800. "_accept_",
  19801. smalltalk.method({
  19802. selector: "accept:",
  19803. category: 'visiting',
  19804. fn: function (aVisitor){
  19805. var self=this;
  19806. smalltalk.send(aVisitor,"_visitInlinedSend_",[self]);
  19807. return self},
  19808. args: ["aVisitor"],
  19809. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  19810. messageSends: ["visitInlinedSend:"],
  19811. referencedClasses: []
  19812. }),
  19813. smalltalk.IRInlinedSend);
  19814. smalltalk.addMethod(
  19815. "_isInlined",
  19816. smalltalk.method({
  19817. selector: "isInlined",
  19818. category: 'testing',
  19819. fn: function (){
  19820. var self=this;
  19821. return true;
  19822. },
  19823. args: [],
  19824. source: "isInlined\x0a\x09^ true",
  19825. messageSends: [],
  19826. referencedClasses: []
  19827. }),
  19828. smalltalk.IRInlinedSend);
  19829. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  19830. smalltalk.addMethod(
  19831. "_accept_",
  19832. smalltalk.method({
  19833. selector: "accept:",
  19834. category: 'visiting',
  19835. fn: function (aVisitor){
  19836. var self=this;
  19837. smalltalk.send(aVisitor,"_visitIRInlinedIfFalse_",[self]);
  19838. return self},
  19839. args: ["aVisitor"],
  19840. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  19841. messageSends: ["visitIRInlinedIfFalse:"],
  19842. referencedClasses: []
  19843. }),
  19844. smalltalk.IRInlinedIfFalse);
  19845. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  19846. smalltalk.addMethod(
  19847. "_accept_",
  19848. smalltalk.method({
  19849. selector: "accept:",
  19850. category: 'visiting',
  19851. fn: function (aVisitor){
  19852. var self=this;
  19853. smalltalk.send(aVisitor,"_visitIRInlinedIfNilIfNotNil_",[self]);
  19854. return self},
  19855. args: ["aVisitor"],
  19856. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  19857. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  19858. referencedClasses: []
  19859. }),
  19860. smalltalk.IRInlinedIfNilIfNotNil);
  19861. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  19862. smalltalk.addMethod(
  19863. "_accept_",
  19864. smalltalk.method({
  19865. selector: "accept:",
  19866. category: 'visiting',
  19867. fn: function (aVisitor){
  19868. var self=this;
  19869. smalltalk.send(aVisitor,"_visitIRInlinedIfTrue_",[self]);
  19870. return self},
  19871. args: ["aVisitor"],
  19872. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  19873. messageSends: ["visitIRInlinedIfTrue:"],
  19874. referencedClasses: []
  19875. }),
  19876. smalltalk.IRInlinedIfTrue);
  19877. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  19878. smalltalk.addMethod(
  19879. "_accept_",
  19880. smalltalk.method({
  19881. selector: "accept:",
  19882. category: 'visiting',
  19883. fn: function (aVisitor){
  19884. var self=this;
  19885. smalltalk.send(aVisitor,"_visitIRInlinedIfTrueIfFalse_",[self]);
  19886. return self},
  19887. args: ["aVisitor"],
  19888. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  19889. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  19890. referencedClasses: []
  19891. }),
  19892. smalltalk.IRInlinedIfTrueIfFalse);
  19893. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  19894. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."
  19895. smalltalk.addMethod(
  19896. "_accept_",
  19897. smalltalk.method({
  19898. selector: "accept:",
  19899. category: 'visiting',
  19900. fn: function (aVisitor){
  19901. var self=this;
  19902. smalltalk.send(aVisitor,"_visitIRInlinedSequence_",[self]);
  19903. return self},
  19904. args: ["aVisitor"],
  19905. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  19906. messageSends: ["visitIRInlinedSequence:"],
  19907. referencedClasses: []
  19908. }),
  19909. smalltalk.IRInlinedSequence);
  19910. smalltalk.addMethod(
  19911. "_isInlined",
  19912. smalltalk.method({
  19913. selector: "isInlined",
  19914. category: 'testing',
  19915. fn: function (){
  19916. var self=this;
  19917. return true;
  19918. },
  19919. args: [],
  19920. source: "isInlined\x0a\x09^ true",
  19921. messageSends: [],
  19922. referencedClasses: []
  19923. }),
  19924. smalltalk.IRInlinedSequence);
  19925. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  19926. 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`"
  19927. smalltalk.addMethod(
  19928. "_assignmentInliner",
  19929. smalltalk.method({
  19930. selector: "assignmentInliner",
  19931. category: 'factory',
  19932. fn: function (){
  19933. var self=this;
  19934. var $2,$3,$1;
  19935. $2=smalltalk.send((smalltalk.IRAssignmentInliner || IRAssignmentInliner),"_new",[]);
  19936. smalltalk.send($2,"_translator_",[self]);
  19937. $3=smalltalk.send($2,"_yourself",[]);
  19938. $1=$3;
  19939. return $1;
  19940. },
  19941. args: [],
  19942. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  19943. messageSends: ["translator:", "new", "yourself"],
  19944. referencedClasses: ["IRAssignmentInliner"]
  19945. }),
  19946. smalltalk.IRInliner);
  19947. smalltalk.addMethod(
  19948. "_nonLocalReturnInliner",
  19949. smalltalk.method({
  19950. selector: "nonLocalReturnInliner",
  19951. category: 'factory',
  19952. fn: function (){
  19953. var self=this;
  19954. var $2,$3,$1;
  19955. $2=smalltalk.send((smalltalk.IRNonLocalReturnInliner || IRNonLocalReturnInliner),"_new",[]);
  19956. smalltalk.send($2,"_translator_",[self]);
  19957. $3=smalltalk.send($2,"_yourself",[]);
  19958. $1=$3;
  19959. return $1;
  19960. },
  19961. args: [],
  19962. source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  19963. messageSends: ["translator:", "new", "yourself"],
  19964. referencedClasses: ["IRNonLocalReturnInliner"]
  19965. }),
  19966. smalltalk.IRInliner);
  19967. smalltalk.addMethod(
  19968. "_returnInliner",
  19969. smalltalk.method({
  19970. selector: "returnInliner",
  19971. category: 'factory',
  19972. fn: function (){
  19973. var self=this;
  19974. var $2,$3,$1;
  19975. $2=smalltalk.send((smalltalk.IRReturnInliner || IRReturnInliner),"_new",[]);
  19976. smalltalk.send($2,"_translator_",[self]);
  19977. $3=smalltalk.send($2,"_yourself",[]);
  19978. $1=$3;
  19979. return $1;
  19980. },
  19981. args: [],
  19982. source: "returnInliner\x0a\x09^ IRReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  19983. messageSends: ["translator:", "new", "yourself"],
  19984. referencedClasses: ["IRReturnInliner"]
  19985. }),
  19986. smalltalk.IRInliner);
  19987. smalltalk.addMethod(
  19988. "_sendInliner",
  19989. smalltalk.method({
  19990. selector: "sendInliner",
  19991. category: 'factory',
  19992. fn: function (){
  19993. var self=this;
  19994. var $2,$3,$1;
  19995. $2=smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_new",[]);
  19996. smalltalk.send($2,"_translator_",[self]);
  19997. $3=smalltalk.send($2,"_yourself",[]);
  19998. $1=$3;
  19999. return $1;
  20000. },
  20001. args: [],
  20002. source: "sendInliner\x0a\x09^ IRSendInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  20003. messageSends: ["translator:", "new", "yourself"],
  20004. referencedClasses: ["IRSendInliner"]
  20005. }),
  20006. smalltalk.IRInliner);
  20007. smalltalk.addMethod(
  20008. "_shouldInlineAssignment_",
  20009. smalltalk.method({
  20010. selector: "shouldInlineAssignment:",
  20011. category: 'testing',
  20012. fn: function (anIRAssignment){
  20013. var self=this;
  20014. var $1;
  20015. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20016. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[]),"_isSend",[]),"_and_",[(function(){
  20017. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  20018. })]);
  20019. })]);
  20020. return $1;
  20021. },
  20022. args: ["anIRAssignment"],
  20023. 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) ]]",
  20024. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
  20025. referencedClasses: []
  20026. }),
  20027. smalltalk.IRInliner);
  20028. smalltalk.addMethod(
  20029. "_shouldInlineReturn_",
  20030. smalltalk.method({
  20031. selector: "shouldInlineReturn:",
  20032. category: 'testing',
  20033. fn: function (anIRReturn){
  20034. var self=this;
  20035. var $1;
  20036. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20037. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[]),"_isSend",[]),"_and_",[(function(){
  20038. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[])]);
  20039. })]);
  20040. })]);
  20041. return $1;
  20042. },
  20043. args: ["anIRReturn"],
  20044. 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) ]]",
  20045. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
  20046. referencedClasses: []
  20047. }),
  20048. smalltalk.IRInliner);
  20049. smalltalk.addMethod(
  20050. "_shouldInlineSend_",
  20051. smalltalk.method({
  20052. selector: "shouldInlineSend:",
  20053. category: 'testing',
  20054. fn: function (anIRSend){
  20055. var self=this;
  20056. var $1;
  20057. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  20058. return smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_shouldInline_",[anIRSend]);
  20059. })]);
  20060. return $1;
  20061. },
  20062. args: ["anIRSend"],
  20063. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  20064. messageSends: ["and:", "shouldInline:", "not", "isInlined"],
  20065. referencedClasses: ["IRSendInliner"]
  20066. }),
  20067. smalltalk.IRInliner);
  20068. smalltalk.addMethod(
  20069. "_transformNonLocalReturn_",
  20070. smalltalk.method({
  20071. selector: "transformNonLocalReturn:",
  20072. category: 'visiting',
  20073. fn: function (anIRNonLocalReturn){
  20074. var self=this;
  20075. var $1,$2,$3,$4;
  20076. var localReturn;
  20077. $1=smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_canInlineNonLocalReturns",[]);
  20078. if(smalltalk.assert($1)){
  20079. smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_methodScope",[]),"_removeNonLocalReturn_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  20080. $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  20081. smalltalk.send($2,"_scope_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  20082. $3=smalltalk.send($2,"_yourself",[]);
  20083. localReturn=$3;
  20084. localReturn;
  20085. smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_instructions",[]),"_do_",[(function(each){
  20086. return smalltalk.send(localReturn,"_add_",[each]);
  20087. })]);
  20088. smalltalk.send(anIRNonLocalReturn,"_replaceWith_",[localReturn]);
  20089. return localReturn;
  20090. };
  20091. $4=smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  20092. return $4;
  20093. },
  20094. args: ["anIRNonLocalReturn"],
  20095. 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",
  20096. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
  20097. referencedClasses: ["IRReturn"]
  20098. }),
  20099. smalltalk.IRInliner);
  20100. smalltalk.addMethod(
  20101. "_visitIRAssignment_",
  20102. smalltalk.method({
  20103. selector: "visitIRAssignment:",
  20104. category: 'visiting',
  20105. fn: function (anIRAssignment){
  20106. var self=this;
  20107. var $2,$1;
  20108. $2=smalltalk.send(self,"_shouldInlineAssignment_",[anIRAssignment]);
  20109. if(smalltalk.assert($2)){
  20110. $1=smalltalk.send(smalltalk.send(self,"_assignmentInliner",[]),"_inlineAssignment_",[anIRAssignment]);
  20111. } else {
  20112. $1=smalltalk.send(self,"_visitIRAssignment_",[anIRAssignment],smalltalk.IRVisitor);
  20113. };
  20114. return $1;
  20115. },
  20116. args: ["anIRAssignment"],
  20117. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment) \x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  20118. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
  20119. referencedClasses: []
  20120. }),
  20121. smalltalk.IRInliner);
  20122. smalltalk.addMethod(
  20123. "_visitIRNonLocalReturn_",
  20124. smalltalk.method({
  20125. selector: "visitIRNonLocalReturn:",
  20126. category: 'visiting',
  20127. fn: function (anIRNonLocalReturn){
  20128. var self=this;
  20129. var $2,$1;
  20130. $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRNonLocalReturn]);
  20131. if(smalltalk.assert($2)){
  20132. $1=smalltalk.send(smalltalk.send(self,"_nonLocalReturnInliner",[]),"_inlineReturn_",[anIRNonLocalReturn]);
  20133. } else {
  20134. $1=smalltalk.send(self,"_transformNonLocalReturn_",[anIRNonLocalReturn]);
  20135. };
  20136. return $1;
  20137. },
  20138. args: ["anIRNonLocalReturn"],
  20139. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn) \x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ self transformNonLocalReturn: anIRNonLocalReturn ]",
  20140. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "nonLocalReturnInliner", "transformNonLocalReturn:", "shouldInlineReturn:"],
  20141. referencedClasses: []
  20142. }),
  20143. smalltalk.IRInliner);
  20144. smalltalk.addMethod(
  20145. "_visitIRReturn_",
  20146. smalltalk.method({
  20147. selector: "visitIRReturn:",
  20148. category: 'visiting',
  20149. fn: function (anIRReturn){
  20150. var self=this;
  20151. var $2,$1;
  20152. $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRReturn]);
  20153. if(smalltalk.assert($2)){
  20154. $1=smalltalk.send(smalltalk.send(self,"_returnInliner",[]),"_inlineReturn_",[anIRReturn]);
  20155. } else {
  20156. $1=smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  20157. };
  20158. return $1;
  20159. },
  20160. args: ["anIRReturn"],
  20161. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn) \x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  20162. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
  20163. referencedClasses: []
  20164. }),
  20165. smalltalk.IRInliner);
  20166. smalltalk.addMethod(
  20167. "_visitIRSend_",
  20168. smalltalk.method({
  20169. selector: "visitIRSend:",
  20170. category: 'visiting',
  20171. fn: function (anIRSend){
  20172. var self=this;
  20173. var $2,$1;
  20174. $2=smalltalk.send(self,"_shouldInlineSend_",[anIRSend]);
  20175. if(smalltalk.assert($2)){
  20176. $1=smalltalk.send(smalltalk.send(self,"_sendInliner",[]),"_inlineSend_",[anIRSend]);
  20177. } else {
  20178. $1=smalltalk.send(self,"_visitIRSend_",[anIRSend],smalltalk.IRVisitor);
  20179. };
  20180. return $1;
  20181. },
  20182. args: ["anIRSend"],
  20183. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  20184. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
  20185. referencedClasses: []
  20186. }),
  20187. smalltalk.IRInliner);
  20188. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  20189. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."
  20190. smalltalk.addMethod(
  20191. "_visitIRInlinedAssignment_",
  20192. smalltalk.method({
  20193. selector: "visitIRInlinedAssignment:",
  20194. category: 'visiting',
  20195. fn: function (anIRInlinedAssignment){
  20196. var self=this;
  20197. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedAssignment,"_instructions",[]),"_last",[])]);
  20198. return self},
  20199. args: ["anIRInlinedAssignment"],
  20200. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  20201. messageSends: ["visit:", "last", "instructions"],
  20202. referencedClasses: []
  20203. }),
  20204. smalltalk.IRInliningJSTranslator);
  20205. smalltalk.addMethod(
  20206. "_visitIRInlinedClosure_",
  20207. smalltalk.method({
  20208. selector: "visitIRInlinedClosure:",
  20209. category: 'visiting',
  20210. fn: function (anIRInlinedClosure){
  20211. var self=this;
  20212. smalltalk.send(smalltalk.send(anIRInlinedClosure,"_instructions",[]),"_do_",[(function(each){
  20213. return smalltalk.send(self,"_visit_",[each]);
  20214. })]);
  20215. return self},
  20216. args: ["anIRInlinedClosure"],
  20217. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  20218. messageSends: ["do:", "visit:", "instructions"],
  20219. referencedClasses: []
  20220. }),
  20221. smalltalk.IRInliningJSTranslator);
  20222. smalltalk.addMethod(
  20223. "_visitIRInlinedIfFalse_",
  20224. smalltalk.method({
  20225. selector: "visitIRInlinedIfFalse:",
  20226. category: 'visiting',
  20227. fn: function (anIRInlinedIfFalse){
  20228. var self=this;
  20229. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20230. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["! smalltalk.assert("]);
  20231. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_first",[])]);
  20232. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20233. }),(function(){
  20234. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_last",[])]);
  20235. })]);
  20236. return self},
  20237. args: ["anIRInlinedIfFalse"],
  20238. 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 ]",
  20239. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20240. referencedClasses: []
  20241. }),
  20242. smalltalk.IRInliningJSTranslator);
  20243. smalltalk.addMethod(
  20244. "_visitIRInlinedIfNil_",
  20245. smalltalk.method({
  20246. selector: "visitIRInlinedIfNil:",
  20247. category: 'visiting',
  20248. fn: function (anIRInlinedIfNil){
  20249. var self=this;
  20250. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20251. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
  20252. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_first",[])]);
  20253. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
  20254. }),(function(){
  20255. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_last",[])]);
  20256. })]);
  20257. return self},
  20258. args: ["anIRInlinedIfNil"],
  20259. 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 ]",
  20260. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20261. referencedClasses: []
  20262. }),
  20263. smalltalk.IRInliningJSTranslator);
  20264. smalltalk.addMethod(
  20265. "_visitIRInlinedIfNilIfNotNil_",
  20266. smalltalk.method({
  20267. selector: "visitIRInlinedIfNilIfNotNil:",
  20268. category: 'visiting',
  20269. fn: function (anIRInlinedIfNilIfNotNil){
  20270. var self=this;
  20271. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
  20272. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
  20273. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_first",[])]);
  20274. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
  20275. }),(function(){
  20276. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_second",[])]);
  20277. }),(function(){
  20278. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_third",[])]);
  20279. })]);
  20280. return self},
  20281. args: ["anIRInlinedIfNilIfNotNil"],
  20282. 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 ]",
  20283. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  20284. referencedClasses: []
  20285. }),
  20286. smalltalk.IRInliningJSTranslator);
  20287. smalltalk.addMethod(
  20288. "_visitIRInlinedIfTrue_",
  20289. smalltalk.method({
  20290. selector: "visitIRInlinedIfTrue:",
  20291. category: 'visiting',
  20292. fn: function (anIRInlinedIfTrue){
  20293. var self=this;
  20294. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  20295. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
  20296. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_first",[])]);
  20297. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20298. }),(function(){
  20299. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_last",[])]);
  20300. })]);
  20301. return self},
  20302. args: ["anIRInlinedIfTrue"],
  20303. 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 ]",
  20304. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  20305. referencedClasses: []
  20306. }),
  20307. smalltalk.IRInliningJSTranslator);
  20308. smalltalk.addMethod(
  20309. "_visitIRInlinedIfTrueIfFalse_",
  20310. smalltalk.method({
  20311. selector: "visitIRInlinedIfTrueIfFalse:",
  20312. category: 'visiting',
  20313. fn: function (anIRInlinedIfTrueIfFalse){
  20314. var self=this;
  20315. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
  20316. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
  20317. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_first",[])]);
  20318. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  20319. }),(function(){
  20320. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_second",[])]);
  20321. }),(function(){
  20322. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_third",[])]);
  20323. })]);
  20324. return self},
  20325. args: ["anIRInlinedIfTrueIfFalse"],
  20326. 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 ]",
  20327. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
  20328. referencedClasses: []
  20329. }),
  20330. smalltalk.IRInliningJSTranslator);
  20331. smalltalk.addMethod(
  20332. "_visitIRInlinedNonLocalReturn_",
  20333. smalltalk.method({
  20334. selector: "visitIRInlinedNonLocalReturn:",
  20335. category: 'visiting',
  20336. fn: function (anIRInlinedReturn){
  20337. var self=this;
  20338. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  20339. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  20340. })]);
  20341. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  20342. })]);
  20343. return self},
  20344. args: ["anIRInlinedReturn"],
  20345. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  20346. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
  20347. referencedClasses: []
  20348. }),
  20349. smalltalk.IRInliningJSTranslator);
  20350. smalltalk.addMethod(
  20351. "_visitIRInlinedReturn_",
  20352. smalltalk.method({
  20353. selector: "visitIRInlinedReturn:",
  20354. category: 'visiting',
  20355. fn: function (anIRInlinedReturn){
  20356. var self=this;
  20357. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  20358. return self},
  20359. args: ["anIRInlinedReturn"],
  20360. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  20361. messageSends: ["visit:", "last", "instructions"],
  20362. referencedClasses: []
  20363. }),
  20364. smalltalk.IRInliningJSTranslator);
  20365. smalltalk.addMethod(
  20366. "_visitIRInlinedSequence_",
  20367. smalltalk.method({
  20368. selector: "visitIRInlinedSequence:",
  20369. category: 'visiting',
  20370. fn: function (anIRInlinedSequence){
  20371. var self=this;
  20372. smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_do_",[(function(each){
  20373. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  20374. return smalltalk.send(self,"_visit_",[each]);
  20375. })]);
  20376. })]);
  20377. return self},
  20378. args: ["anIRInlinedSequence"],
  20379. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  20380. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  20381. referencedClasses: []
  20382. }),
  20383. smalltalk.IRInliningJSTranslator);
  20384. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  20385. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."
  20386. smalltalk.addMethod(
  20387. "_ifFalse_",
  20388. smalltalk.method({
  20389. selector: "ifFalse:",
  20390. category: 'inlining',
  20391. fn: function (anIRInstruction){
  20392. var self=this;
  20393. var $1;
  20394. $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse),"_new",[]),anIRInstruction]);
  20395. return $1;
  20396. },
  20397. args: ["anIRInstruction"],
  20398. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  20399. messageSends: ["inlinedSend:with:", "new"],
  20400. referencedClasses: ["IRInlinedIfFalse"]
  20401. }),
  20402. smalltalk.IRSendInliner);
  20403. smalltalk.addMethod(
  20404. "_ifFalse_ifTrue_",
  20405. smalltalk.method({
  20406. selector: "ifFalse:ifTrue:",
  20407. category: 'inlining',
  20408. fn: function (anIRInstruction,anotherIRInstruction){
  20409. var self=this;
  20410. var $1;
  20411. $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.symbolFor("ifTrue:ifFalse:"),[anotherIRInstruction,anIRInstruction]]);
  20412. return $1;
  20413. },
  20414. args: ["anIRInstruction", "anotherIRInstruction"],
  20415. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  20416. messageSends: ["perform:withArguments:"],
  20417. referencedClasses: []
  20418. }),
  20419. smalltalk.IRSendInliner);
  20420. smalltalk.addMethod(
  20421. "_ifNil_",
  20422. smalltalk.method({
  20423. selector: "ifNil:",
  20424. category: 'inlining',
  20425. fn: function (anIRInstruction){
  20426. var self=this;
  20427. var $2,$3,$4,$5,$1;
  20428. $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  20429. smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
  20430. $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
  20431. smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20432. $4=smalltalk.send($3,"_yourself",[]);
  20433. smalltalk.send($2,"_add_",[$4]);
  20434. $5=smalltalk.send($2,"_yourself",[]);
  20435. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,$5]);
  20436. return $1;
  20437. },
  20438. args: ["anIRInstruction"],
  20439. 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)",
  20440. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  20441. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  20442. }),
  20443. smalltalk.IRSendInliner);
  20444. smalltalk.addMethod(
  20445. "_ifNil_ifNotNil_",
  20446. smalltalk.method({
  20447. selector: "ifNil:ifNotNil:",
  20448. category: 'inlining',
  20449. fn: function (anIRInstruction,anotherIRInstruction){
  20450. var self=this;
  20451. var $1;
  20452. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,anotherIRInstruction]);
  20453. return $1;
  20454. },
  20455. args: ["anIRInstruction", "anotherIRInstruction"],
  20456. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  20457. messageSends: ["inlinedSend:with:with:", "new"],
  20458. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  20459. }),
  20460. smalltalk.IRSendInliner);
  20461. smalltalk.addMethod(
  20462. "_ifNotNil_",
  20463. smalltalk.method({
  20464. selector: "ifNotNil:",
  20465. category: 'inlining',
  20466. fn: function (anIRInstruction){
  20467. var self=this;
  20468. var $2,$3,$4,$5,$1;
  20469. $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  20470. smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
  20471. $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
  20472. smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20473. $4=smalltalk.send($3,"_yourself",[]);
  20474. smalltalk.send($2,"_add_",[$4]);
  20475. $5=smalltalk.send($2,"_yourself",[]);
  20476. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),$5,anIRInstruction]);
  20477. return $1;
  20478. },
  20479. args: ["anIRInstruction"],
  20480. 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",
  20481. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  20482. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  20483. }),
  20484. smalltalk.IRSendInliner);
  20485. smalltalk.addMethod(
  20486. "_ifNotNil_ifNil_",
  20487. smalltalk.method({
  20488. selector: "ifNotNil:ifNil:",
  20489. category: 'inlining',
  20490. fn: function (anIRInstruction,anotherIRInstruction){
  20491. var self=this;
  20492. var $1;
  20493. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anotherIRInstruction,anIRInstruction]);
  20494. return $1;
  20495. },
  20496. args: ["anIRInstruction", "anotherIRInstruction"],
  20497. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  20498. messageSends: ["inlinedSend:with:with:", "new"],
  20499. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  20500. }),
  20501. smalltalk.IRSendInliner);
  20502. smalltalk.addMethod(
  20503. "_ifTrue_",
  20504. smalltalk.method({
  20505. selector: "ifTrue:",
  20506. category: 'inlining',
  20507. fn: function (anIRInstruction){
  20508. var self=this;
  20509. var $1;
  20510. $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue),"_new",[]),anIRInstruction]);
  20511. return $1;
  20512. },
  20513. args: ["anIRInstruction"],
  20514. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  20515. messageSends: ["inlinedSend:with:", "new"],
  20516. referencedClasses: ["IRInlinedIfTrue"]
  20517. }),
  20518. smalltalk.IRSendInliner);
  20519. smalltalk.addMethod(
  20520. "_ifTrue_ifFalse_",
  20521. smalltalk.method({
  20522. selector: "ifTrue:ifFalse:",
  20523. category: 'inlining',
  20524. fn: function (anIRInstruction,anotherIRInstruction){
  20525. var self=this;
  20526. var $1;
  20527. $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfTrueIfFalse || IRInlinedIfTrueIfFalse),"_new",[]),anIRInstruction,anotherIRInstruction]);
  20528. return $1;
  20529. },
  20530. args: ["anIRInstruction", "anotherIRInstruction"],
  20531. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  20532. messageSends: ["inlinedSend:with:with:", "new"],
  20533. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  20534. }),
  20535. smalltalk.IRSendInliner);
  20536. smalltalk.addMethod(
  20537. "_inlineClosure_",
  20538. smalltalk.method({
  20539. selector: "inlineClosure:",
  20540. category: 'inlining',
  20541. fn: function (anIRClosure){
  20542. var self=this;
  20543. var $1,$2;
  20544. var inlinedClosure;
  20545. var sequence;
  20546. var statements;
  20547. inlinedClosure=smalltalk.send(self,"_inlinedClosure",[]);
  20548. smalltalk.send(inlinedClosure,"_scope_",[smalltalk.send(anIRClosure,"_scope",[])]);
  20549. smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_do_",[(function(each){
  20550. $1=smalltalk.send(each,"_isSequence",[]);
  20551. if(! smalltalk.assert($1)){
  20552. return smalltalk.send(inlinedClosure,"_add_",[each]);
  20553. };
  20554. })]);
  20555. sequence=smalltalk.send(self,"_inlinedSequence",[]);
  20556. smalltalk.send(inlinedClosure,"_add_",[sequence]);
  20557. statements=smalltalk.send(smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
  20558. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  20559. smalltalk.send(smalltalk.send(statements,"_allButLast",[]),"_do_",[(function(each){
  20560. return smalltalk.send(sequence,"_add_",[each]);
  20561. })]);
  20562. $2=smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]),"_and_",[(function(){
  20563. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_isBlockReturn",[]);
  20564. })]);
  20565. if(smalltalk.assert($2)){
  20566. return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_instructions",[]),"_first",[])]);
  20567. } else {
  20568. return smalltalk.send(sequence,"_add_",[smalltalk.send(statements,"_last",[])]);
  20569. };
  20570. })]);
  20571. return inlinedClosure;
  20572. },
  20573. args: ["anIRClosure"],
  20574. 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",
  20575. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "ifFalse:", "add:", "isSequence", "instructions", "inlinedSequence", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"],
  20576. referencedClasses: []
  20577. }),
  20578. smalltalk.IRSendInliner);
  20579. smalltalk.addMethod(
  20580. "_inlineSend_",
  20581. smalltalk.method({
  20582. selector: "inlineSend:",
  20583. category: 'inlining',
  20584. fn: function (anIRSend){
  20585. var self=this;
  20586. var $1;
  20587. smalltalk.send(self,"_send_",[anIRSend]);
  20588. $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"_send",[]),"_selector",[]),smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_allButFirst",[])]);
  20589. return $1;
  20590. },
  20591. args: ["anIRSend"],
  20592. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self \x0a\x09\x09perform: self send selector \x0a\x09\x09withArguments: self send instructions allButFirst",
  20593. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  20594. referencedClasses: []
  20595. }),
  20596. smalltalk.IRSendInliner);
  20597. smalltalk.addMethod(
  20598. "_inlinedClosure",
  20599. smalltalk.method({
  20600. selector: "inlinedClosure",
  20601. category: 'factory',
  20602. fn: function (){
  20603. var self=this;
  20604. var $1;
  20605. $1=smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure),"_new",[]);
  20606. return $1;
  20607. },
  20608. args: [],
  20609. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  20610. messageSends: ["new"],
  20611. referencedClasses: ["IRInlinedClosure"]
  20612. }),
  20613. smalltalk.IRSendInliner);
  20614. smalltalk.addMethod(
  20615. "_inlinedSend_with_",
  20616. smalltalk.method({
  20617. selector: "inlinedSend:with:",
  20618. category: 'inlining',
  20619. fn: function (inlinedSend,anIRInstruction){
  20620. var self=this;
  20621. var $1,$2,$3;
  20622. var inlinedClosure;
  20623. $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
  20624. if(! smalltalk.assert($1)){
  20625. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20626. };
  20627. $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20628. if(! smalltalk.assert($2)){
  20629. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20630. };
  20631. inlinedClosure=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
  20632. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20633. $3=smalltalk.send(inlinedSend,"_add_",[inlinedClosure]);
  20634. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  20635. return inlinedSend;
  20636. },
  20637. args: ["inlinedSend", "anIRInstruction"],
  20638. 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",
  20639. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  20640. referencedClasses: []
  20641. }),
  20642. smalltalk.IRSendInliner);
  20643. smalltalk.addMethod(
  20644. "_inlinedSend_with_with_",
  20645. smalltalk.method({
  20646. selector: "inlinedSend:with:with:",
  20647. category: 'inlining',
  20648. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  20649. var self=this;
  20650. var $1,$2,$3,$4,$5;
  20651. var inlinedClosure1;
  20652. var inlinedClosure2;
  20653. $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
  20654. if(! smalltalk.assert($1)){
  20655. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20656. };
  20657. $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20658. if(! smalltalk.assert($2)){
  20659. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20660. };
  20661. $3=smalltalk.send(anotherIRInstruction,"_isClosure",[]);
  20662. if(! smalltalk.assert($3)){
  20663. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  20664. };
  20665. $4=smalltalk.send(smalltalk.send(smalltalk.send(anotherIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
  20666. if(! smalltalk.assert($4)){
  20667. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  20668. };
  20669. inlinedClosure1=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
  20670. inlinedClosure2=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anotherIRInstruction])]);
  20671. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  20672. smalltalk.send(inlinedSend,"_add_",[inlinedClosure1]);
  20673. $5=smalltalk.send(inlinedSend,"_add_",[inlinedClosure2]);
  20674. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  20675. return inlinedSend;
  20676. },
  20677. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  20678. 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",
  20679. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
  20680. referencedClasses: []
  20681. }),
  20682. smalltalk.IRSendInliner);
  20683. smalltalk.addMethod(
  20684. "_inlinedSequence",
  20685. smalltalk.method({
  20686. selector: "inlinedSequence",
  20687. category: 'factory',
  20688. fn: function (){
  20689. var self=this;
  20690. var $1;
  20691. $1=smalltalk.send((smalltalk.IRInlinedSequence || IRInlinedSequence),"_new",[]);
  20692. return $1;
  20693. },
  20694. args: [],
  20695. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  20696. messageSends: ["new"],
  20697. referencedClasses: ["IRInlinedSequence"]
  20698. }),
  20699. smalltalk.IRSendInliner);
  20700. smalltalk.addMethod(
  20701. "_inliningError_",
  20702. smalltalk.method({
  20703. selector: "inliningError:",
  20704. category: 'error handling',
  20705. fn: function (aString){
  20706. var self=this;
  20707. smalltalk.send((smalltalk.InliningError || InliningError),"_signal_",[aString]);
  20708. return self},
  20709. args: ["aString"],
  20710. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  20711. messageSends: ["signal:"],
  20712. referencedClasses: ["InliningError"]
  20713. }),
  20714. smalltalk.IRSendInliner);
  20715. smalltalk.addMethod(
  20716. "_send",
  20717. smalltalk.method({
  20718. selector: "send",
  20719. category: 'accessing',
  20720. fn: function (){
  20721. var self=this;
  20722. return self["@send"];
  20723. },
  20724. args: [],
  20725. source: "send\x0a\x09^ send",
  20726. messageSends: [],
  20727. referencedClasses: []
  20728. }),
  20729. smalltalk.IRSendInliner);
  20730. smalltalk.addMethod(
  20731. "_send_",
  20732. smalltalk.method({
  20733. selector: "send:",
  20734. category: 'accessing',
  20735. fn: function (anIRSend){
  20736. var self=this;
  20737. self["@send"]=anIRSend;
  20738. return self},
  20739. args: ["anIRSend"],
  20740. source: "send: anIRSend\x0a\x09send := anIRSend",
  20741. messageSends: [],
  20742. referencedClasses: []
  20743. }),
  20744. smalltalk.IRSendInliner);
  20745. smalltalk.addMethod(
  20746. "_translator",
  20747. smalltalk.method({
  20748. selector: "translator",
  20749. category: 'accessing',
  20750. fn: function (){
  20751. var self=this;
  20752. return self["@translator"];
  20753. },
  20754. args: [],
  20755. source: "translator\x0a\x09^ translator",
  20756. messageSends: [],
  20757. referencedClasses: []
  20758. }),
  20759. smalltalk.IRSendInliner);
  20760. smalltalk.addMethod(
  20761. "_translator_",
  20762. smalltalk.method({
  20763. selector: "translator:",
  20764. category: 'accessing',
  20765. fn: function (anASTTranslator){
  20766. var self=this;
  20767. self["@translator"]=anASTTranslator;
  20768. return self},
  20769. args: ["anASTTranslator"],
  20770. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  20771. messageSends: [],
  20772. referencedClasses: []
  20773. }),
  20774. smalltalk.IRSendInliner);
  20775. smalltalk.addMethod(
  20776. "_inlinedSelectors",
  20777. smalltalk.method({
  20778. selector: "inlinedSelectors",
  20779. category: 'accessing',
  20780. fn: function (){
  20781. var self=this;
  20782. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil"];
  20783. },
  20784. args: [],
  20785. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil')",
  20786. messageSends: [],
  20787. referencedClasses: []
  20788. }),
  20789. smalltalk.IRSendInliner.klass);
  20790. smalltalk.addMethod(
  20791. "_shouldInline_",
  20792. smalltalk.method({
  20793. selector: "shouldInline:",
  20794. category: 'accessing',
  20795. fn: function (anIRInstruction){
  20796. var self=this;
  20797. var $1,$2;
  20798. var $early={};
  20799. try {
  20800. $1=smalltalk.send(smalltalk.send(self,"_inlinedSelectors",[]),"_includes_",[smalltalk.send(anIRInstruction,"_selector",[])]);
  20801. if(! smalltalk.assert($1)){
  20802. return false;
  20803. };
  20804. smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_allButFirst",[]),"_do_",[(function(each){
  20805. $2=smalltalk.send(each,"_isClosure",[]);
  20806. if(! smalltalk.assert($2)){
  20807. throw $early=[false];
  20808. };
  20809. })]);
  20810. return true;
  20811. }
  20812. catch(e) {if(e===$early)return e[0]; throw e}
  20813. },
  20814. args: ["anIRInstruction"],
  20815. 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",
  20816. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
  20817. referencedClasses: []
  20818. }),
  20819. smalltalk.IRSendInliner.klass);
  20820. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  20821. 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};"
  20822. smalltalk.addMethod(
  20823. "_assignment",
  20824. smalltalk.method({
  20825. selector: "assignment",
  20826. category: 'accessing',
  20827. fn: function (){
  20828. var self=this;
  20829. return self["@assignment"];
  20830. },
  20831. args: [],
  20832. source: "assignment\x0a\x09^ assignment",
  20833. messageSends: [],
  20834. referencedClasses: []
  20835. }),
  20836. smalltalk.IRAssignmentInliner);
  20837. smalltalk.addMethod(
  20838. "_assignment_",
  20839. smalltalk.method({
  20840. selector: "assignment:",
  20841. category: 'accessing',
  20842. fn: function (aNode){
  20843. var self=this;
  20844. self["@assignment"]=aNode;
  20845. return self},
  20846. args: ["aNode"],
  20847. source: "assignment: aNode\x0a\x09assignment := aNode",
  20848. messageSends: [],
  20849. referencedClasses: []
  20850. }),
  20851. smalltalk.IRAssignmentInliner);
  20852. smalltalk.addMethod(
  20853. "_inlineAssignment_",
  20854. smalltalk.method({
  20855. selector: "inlineAssignment:",
  20856. category: 'inlining',
  20857. fn: function (anIRAssignment){
  20858. var self=this;
  20859. var inlinedAssignment;
  20860. smalltalk.send(self,"_assignment_",[anIRAssignment]);
  20861. inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment),"_new",[]);
  20862. smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_do_",[(function(each){
  20863. return smalltalk.send(inlinedAssignment,"_add_",[each]);
  20864. })]);
  20865. smalltalk.send(anIRAssignment,"_replaceWith_",[inlinedAssignment]);
  20866. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(inlinedAssignment,"_instructions",[]),"_last",[])]);
  20867. return inlinedAssignment;
  20868. },
  20869. args: ["anIRAssignment"],
  20870. 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",
  20871. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  20872. referencedClasses: ["IRInlinedAssignment"]
  20873. }),
  20874. smalltalk.IRAssignmentInliner);
  20875. smalltalk.addMethod(
  20876. "_inlineClosure_",
  20877. smalltalk.method({
  20878. selector: "inlineClosure:",
  20879. category: 'inlining',
  20880. fn: function (anIRClosure){
  20881. var self=this;
  20882. var $1,$2,$3;
  20883. var inlinedClosure;
  20884. var statements;
  20885. inlinedClosure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
  20886. statements=smalltalk.send(smalltalk.send(smalltalk.send(inlinedClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
  20887. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  20888. $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_canBeAssigned",[]);
  20889. if(smalltalk.assert($1)){
  20890. $2=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  20891. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_assignment",[]),"_instructions",[]),"_first",[])]);
  20892. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
  20893. $3=smalltalk.send($2,"_yourself",[]);
  20894. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
  20895. };
  20896. })]);
  20897. return inlinedClosure;
  20898. },
  20899. args: ["anIRClosure"],
  20900. 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",
  20901. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"],
  20902. referencedClasses: ["IRAssignment"]
  20903. }),
  20904. smalltalk.IRAssignmentInliner);
  20905. smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  20906. smalltalk.addMethod(
  20907. "_inlineClosure_",
  20908. smalltalk.method({
  20909. selector: "inlineClosure:",
  20910. category: 'inlining',
  20911. fn: function (anIRClosure){
  20912. var self=this;
  20913. var $1;
  20914. $1=smalltalk.send(self,"_inlineCLosure_",[anIRClosure],smalltalk.IRSendInliner);
  20915. return $1;
  20916. },
  20917. args: ["anIRClosure"],
  20918. 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",
  20919. messageSends: ["inlineCLosure:"],
  20920. referencedClasses: []
  20921. }),
  20922. smalltalk.IRNonLocalReturnInliner);
  20923. smalltalk.addMethod(
  20924. "_inlinedReturn",
  20925. smalltalk.method({
  20926. selector: "inlinedReturn",
  20927. category: 'factory',
  20928. fn: function (){
  20929. var self=this;
  20930. var $1;
  20931. $1=smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn),"_new",[]);
  20932. return $1;
  20933. },
  20934. args: [],
  20935. source: "inlinedReturn\x0a\x09^ IRInlinedNonLocalReturn new",
  20936. messageSends: ["new"],
  20937. referencedClasses: ["IRInlinedNonLocalReturn"]
  20938. }),
  20939. smalltalk.IRNonLocalReturnInliner);
  20940. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  20941. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."
  20942. smalltalk.addMethod(
  20943. "_inlineClosure_",
  20944. smalltalk.method({
  20945. selector: "inlineClosure:",
  20946. category: 'inlining',
  20947. fn: function (anIRClosure){
  20948. var self=this;
  20949. var $1,$2,$3;
  20950. var closure;
  20951. var statements;
  20952. closure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
  20953. statements=smalltalk.send(smalltalk.send(smalltalk.send(closure,"_instructions",[]),"_last",[]),"_instructions",[]);
  20954. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  20955. $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]);
  20956. if(! smalltalk.assert($1)){
  20957. $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  20958. smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
  20959. $3=smalltalk.send($2,"_yourself",[]);
  20960. return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
  20961. };
  20962. })]);
  20963. return closure;
  20964. },
  20965. args: ["anIRClosure"],
  20966. 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",
  20967. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"],
  20968. referencedClasses: ["IRReturn"]
  20969. }),
  20970. smalltalk.IRReturnInliner);
  20971. smalltalk.addMethod(
  20972. "_inlineReturn_",
  20973. smalltalk.method({
  20974. selector: "inlineReturn:",
  20975. category: 'inlining',
  20976. fn: function (anIRReturn){
  20977. var self=this;
  20978. var return_;
  20979. return_=smalltalk.send(self,"_inlinedReturn",[]);
  20980. smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_do_",[(function(each){
  20981. return smalltalk.send(return_,"_add_",[each]);
  20982. })]);
  20983. smalltalk.send(anIRReturn,"_replaceWith_",[return_]);
  20984. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(return_,"_instructions",[]),"_last",[])]);
  20985. return return_;
  20986. },
  20987. args: ["anIRReturn"],
  20988. 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",
  20989. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  20990. referencedClasses: []
  20991. }),
  20992. smalltalk.IRReturnInliner);
  20993. smalltalk.addMethod(
  20994. "_inlinedReturn",
  20995. smalltalk.method({
  20996. selector: "inlinedReturn",
  20997. category: 'factory',
  20998. fn: function (){
  20999. var self=this;
  21000. var $1;
  21001. $1=smalltalk.send((smalltalk.IRInlinedReturn || IRInlinedReturn),"_new",[]);
  21002. return $1;
  21003. },
  21004. args: [],
  21005. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  21006. messageSends: ["new"],
  21007. referencedClasses: ["IRInlinedReturn"]
  21008. }),
  21009. smalltalk.IRReturnInliner);
  21010. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  21011. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"
  21012. smalltalk.addMethod(
  21013. "_compileNode_",
  21014. smalltalk.method({
  21015. selector: "compileNode:",
  21016. category: 'compiling',
  21017. fn: function (aNode){
  21018. var self=this;
  21019. var $2,$3,$1;
  21020. var ir;
  21021. var stream;
  21022. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  21023. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  21024. smalltalk.send(smalltalk.send(self,"_inliner",[]),"_visit_",[ir]);
  21025. $2=smalltalk.send(self,"_irTranslator",[]);
  21026. smalltalk.send($2,"_visit_",[ir]);
  21027. $3=smalltalk.send($2,"_contents",[]);
  21028. $1=$3;
  21029. return $1;
  21030. },
  21031. args: ["aNode"],
  21032. 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",
  21033. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
  21034. referencedClasses: []
  21035. }),
  21036. smalltalk.InliningCodeGenerator);
  21037. smalltalk.addMethod(
  21038. "_inliner",
  21039. smalltalk.method({
  21040. selector: "inliner",
  21041. category: 'compiling',
  21042. fn: function (){
  21043. var self=this;
  21044. var $1;
  21045. $1=smalltalk.send((smalltalk.IRInliner || IRInliner),"_new",[]);
  21046. return $1;
  21047. },
  21048. args: [],
  21049. source: "inliner\x0a\x09^ IRInliner new",
  21050. messageSends: ["new"],
  21051. referencedClasses: ["IRInliner"]
  21052. }),
  21053. smalltalk.InliningCodeGenerator);
  21054. smalltalk.addMethod(
  21055. "_irTranslator",
  21056. smalltalk.method({
  21057. selector: "irTranslator",
  21058. category: 'compiling',
  21059. fn: function (){
  21060. var self=this;
  21061. var $1;
  21062. $1=smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator),"_new",[]);
  21063. return $1;
  21064. },
  21065. args: [],
  21066. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  21067. messageSends: ["new"],
  21068. referencedClasses: ["IRInliningJSTranslator"]
  21069. }),
  21070. smalltalk.InliningCodeGenerator);
  21071. smalltalk.addPackage('Compiler-Semantic', {});
  21072. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
  21073. 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."
  21074. smalltalk.addMethod(
  21075. "_addArg_",
  21076. smalltalk.method({
  21077. selector: "addArg:",
  21078. category: 'adding',
  21079. fn: function (aString) {
  21080. var self = this;
  21081. smalltalk.send(smalltalk.send(self, "_args", []), "_at_put_", [aString, smalltalk.send(smalltalk.ArgVar || ArgVar, "_on_", [aString])]);
  21082. smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_at_", [aString]), "_scope_", [self]);
  21083. return self;
  21084. },
  21085. args: ["aString"],
  21086. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  21087. messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
  21088. referencedClasses: ["ArgVar"]
  21089. }),
  21090. smalltalk.LexicalScope);
  21091. smalltalk.addMethod(
  21092. "_addTemp_",
  21093. smalltalk.method({
  21094. selector: "addTemp:",
  21095. category: 'adding',
  21096. fn: function (aString) {
  21097. var self = this;
  21098. smalltalk.send(smalltalk.send(self, "_temps", []), "_at_put_", [aString, smalltalk.send(smalltalk.TempVar || TempVar, "_on_", [aString])]);
  21099. smalltalk.send(smalltalk.send(smalltalk.send(self, "_temps", []), "_at_", [aString]), "_scope_", [self]);
  21100. return self;
  21101. },
  21102. args: ["aString"],
  21103. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  21104. messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
  21105. referencedClasses: ["TempVar"]
  21106. }),
  21107. smalltalk.LexicalScope);
  21108. smalltalk.addMethod(
  21109. "_allVariableNames",
  21110. smalltalk.method({
  21111. selector: "allVariableNames",
  21112. category: 'accessing',
  21113. fn: function () {
  21114. var self = this;
  21115. var $1;
  21116. $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_keys", []), "__comma", [smalltalk.send(smalltalk.send(self, "_temps", []), "_keys", [])]);
  21117. return $1;
  21118. },
  21119. args: [],
  21120. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  21121. messageSends: [",", "keys", "temps", "args"],
  21122. referencedClasses: []
  21123. }),
  21124. smalltalk.LexicalScope);
  21125. smalltalk.addMethod(
  21126. "_args",
  21127. smalltalk.method({
  21128. selector: "args",
  21129. category: 'accessing',
  21130. fn: function () {
  21131. var self = this;
  21132. var $1;
  21133. if (($receiver = self['@args']) == nil || $receiver == undefined) {
  21134. self['@args'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21135. $1 = self['@args'];
  21136. } else {
  21137. $1 = self['@args'];
  21138. }
  21139. return $1;
  21140. },
  21141. args: [],
  21142. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  21143. messageSends: ["ifNil:", "new"],
  21144. referencedClasses: ["Dictionary"]
  21145. }),
  21146. smalltalk.LexicalScope);
  21147. smalltalk.addMethod(
  21148. "_bindingFor_",
  21149. smalltalk.method({
  21150. selector: "bindingFor:",
  21151. category: 'accessing',
  21152. fn: function (aStringOrNode) {
  21153. var self = this;
  21154. var $1;
  21155. $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;}]);}]);}]);
  21156. return $1;
  21157. },
  21158. args: ["aStringOrNode"],
  21159. 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 ]]]",
  21160. messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
  21161. referencedClasses: []
  21162. }),
  21163. smalltalk.LexicalScope);
  21164. smalltalk.addMethod(
  21165. "_canInlineNonLocalReturns",
  21166. smalltalk.method({
  21167. selector: "canInlineNonLocalReturns",
  21168. category: 'testing',
  21169. fn: function () {
  21170. var self = this;
  21171. var $1;
  21172. $1 = smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [function () {return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);}]);
  21173. return $1;
  21174. },
  21175. args: [],
  21176. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  21177. messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
  21178. referencedClasses: []
  21179. }),
  21180. smalltalk.LexicalScope);
  21181. smalltalk.addMethod(
  21182. "_instruction",
  21183. smalltalk.method({
  21184. selector: "instruction",
  21185. category: 'accessing',
  21186. fn: function () {
  21187. var self = this;
  21188. return self['@instruction'];
  21189. },
  21190. args: [],
  21191. source: "instruction\x0a\x09^ instruction",
  21192. messageSends: [],
  21193. referencedClasses: []
  21194. }),
  21195. smalltalk.LexicalScope);
  21196. smalltalk.addMethod(
  21197. "_instruction_",
  21198. smalltalk.method({
  21199. selector: "instruction:",
  21200. category: 'accessing',
  21201. fn: function (anIRInstruction) {
  21202. var self = this;
  21203. self['@instruction'] = anIRInstruction;
  21204. return self;
  21205. },
  21206. args: ["anIRInstruction"],
  21207. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  21208. messageSends: [],
  21209. referencedClasses: []
  21210. }),
  21211. smalltalk.LexicalScope);
  21212. smalltalk.addMethod(
  21213. "_isBlockScope",
  21214. smalltalk.method({
  21215. selector: "isBlockScope",
  21216. category: 'testing',
  21217. fn: function () {
  21218. var self = this;
  21219. var $1;
  21220. $1 = smalltalk.send(smalltalk.send(self, "_isMethodScope", []), "_not", []);
  21221. return $1;
  21222. },
  21223. args: [],
  21224. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  21225. messageSends: ["not", "isMethodScope"],
  21226. referencedClasses: []
  21227. }),
  21228. smalltalk.LexicalScope);
  21229. smalltalk.addMethod(
  21230. "_isInlined",
  21231. smalltalk.method({
  21232. selector: "isInlined",
  21233. category: 'testing',
  21234. fn: function () {
  21235. var self = this;
  21236. var $1;
  21237. $1 = smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
  21238. return $1;
  21239. },
  21240. args: [],
  21241. source: "isInlined\x0a\x09^ self instruction isInlined",
  21242. messageSends: ["isInlined", "instruction"],
  21243. referencedClasses: []
  21244. }),
  21245. smalltalk.LexicalScope);
  21246. smalltalk.addMethod(
  21247. "_isMethodScope",
  21248. smalltalk.method({
  21249. selector: "isMethodScope",
  21250. category: 'testing',
  21251. fn: function () {
  21252. var self = this;
  21253. return false;
  21254. },
  21255. args: [],
  21256. source: "isMethodScope\x0a\x09^ false",
  21257. messageSends: [],
  21258. referencedClasses: []
  21259. }),
  21260. smalltalk.LexicalScope);
  21261. smalltalk.addMethod(
  21262. "_lookupVariable_",
  21263. smalltalk.method({
  21264. selector: "lookupVariable:",
  21265. category: 'accessing',
  21266. fn: function (aNode) {
  21267. var self = this;
  21268. var $1;
  21269. var lookup;
  21270. lookup = smalltalk.send(self, "_bindingFor_", [aNode]);
  21271. if (($receiver = lookup) == nil || $receiver == undefined) {
  21272. $1 = smalltalk.send(self, "_outerScope", []);
  21273. if (($receiver = $1) == nil || $receiver == undefined) {
  21274. lookup = $1;
  21275. } else {
  21276. lookup = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_lookupVariable_", [aNode]);
  21277. }
  21278. } else {
  21279. }
  21280. return lookup;
  21281. },
  21282. args: ["aNode"],
  21283. 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",
  21284. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
  21285. referencedClasses: []
  21286. }),
  21287. smalltalk.LexicalScope);
  21288. smalltalk.addMethod(
  21289. "_methodScope",
  21290. smalltalk.method({
  21291. selector: "methodScope",
  21292. category: 'accessing',
  21293. fn: function () {
  21294. var self = this;
  21295. var $2, $1;
  21296. $2 = smalltalk.send(self, "_outerScope", []);
  21297. if (($receiver = $2) == nil || $receiver == undefined) {
  21298. $1 = $2;
  21299. } else {
  21300. $1 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_methodScope", []);
  21301. }
  21302. return $1;
  21303. },
  21304. args: [],
  21305. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  21306. messageSends: ["ifNotNil:", "methodScope", "outerScope"],
  21307. referencedClasses: []
  21308. }),
  21309. smalltalk.LexicalScope);
  21310. smalltalk.addMethod(
  21311. "_node",
  21312. smalltalk.method({
  21313. selector: "node",
  21314. category: 'accessing',
  21315. fn: function () {
  21316. var self = this;
  21317. return self['@node'];
  21318. },
  21319. args: [],
  21320. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  21321. messageSends: [],
  21322. referencedClasses: []
  21323. }),
  21324. smalltalk.LexicalScope);
  21325. smalltalk.addMethod(
  21326. "_node_",
  21327. smalltalk.method({
  21328. selector: "node:",
  21329. category: 'accessing',
  21330. fn: function (aNode) {
  21331. var self = this;
  21332. self['@node'] = aNode;
  21333. return self;
  21334. },
  21335. args: ["aNode"],
  21336. source: "node: aNode\x0a\x09node := aNode",
  21337. messageSends: [],
  21338. referencedClasses: []
  21339. }),
  21340. smalltalk.LexicalScope);
  21341. smalltalk.addMethod(
  21342. "_outerScope",
  21343. smalltalk.method({
  21344. selector: "outerScope",
  21345. category: 'accessing',
  21346. fn: function () {
  21347. var self = this;
  21348. return self['@outerScope'];
  21349. },
  21350. args: [],
  21351. source: "outerScope\x0a\x09^ outerScope",
  21352. messageSends: [],
  21353. referencedClasses: []
  21354. }),
  21355. smalltalk.LexicalScope);
  21356. smalltalk.addMethod(
  21357. "_outerScope_",
  21358. smalltalk.method({
  21359. selector: "outerScope:",
  21360. category: 'accessing',
  21361. fn: function (aLexicalScope) {
  21362. var self = this;
  21363. self['@outerScope'] = aLexicalScope;
  21364. return self;
  21365. },
  21366. args: ["aLexicalScope"],
  21367. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  21368. messageSends: [],
  21369. referencedClasses: []
  21370. }),
  21371. smalltalk.LexicalScope);
  21372. smalltalk.addMethod(
  21373. "_pseudoVars",
  21374. smalltalk.method({
  21375. selector: "pseudoVars",
  21376. category: 'accessing',
  21377. fn: function () {
  21378. var self = this;
  21379. var $1;
  21380. $1 = smalltalk.send(smalltalk.send(self, "_methodScope", []), "_pseudoVars", []);
  21381. return $1;
  21382. },
  21383. args: [],
  21384. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  21385. messageSends: ["pseudoVars", "methodScope"],
  21386. referencedClasses: []
  21387. }),
  21388. smalltalk.LexicalScope);
  21389. smalltalk.addMethod(
  21390. "_scopeLevel",
  21391. smalltalk.method({
  21392. selector: "scopeLevel",
  21393. category: 'accessing',
  21394. fn: function () {
  21395. var self = this;
  21396. var $3, $2, $1;
  21397. $3 = smalltalk.send(self, "_outerScope", []);
  21398. if (($receiver = $3) == nil || $receiver == undefined) {
  21399. $2 = 0;
  21400. } else {
  21401. $2 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_scopeLevel", []);
  21402. }
  21403. $1 = smalltalk.send($2, "__plus", [1]);
  21404. return $1;
  21405. },
  21406. args: [],
  21407. source: "scopeLevel\x0a\x09^ (self outerScope \x0a\x09\x09ifNil: [ 0 ]\x0a\x09\x09ifNotNil: [ self outerScope scopeLevel ]) + 1",
  21408. messageSends: ["+", "ifNil:ifNotNil:", "scopeLevel", "outerScope"],
  21409. referencedClasses: []
  21410. }),
  21411. smalltalk.LexicalScope);
  21412. smalltalk.addMethod(
  21413. "_temps",
  21414. smalltalk.method({
  21415. selector: "temps",
  21416. category: 'accessing',
  21417. fn: function () {
  21418. var self = this;
  21419. var $1;
  21420. if (($receiver = self['@temps']) == nil || $receiver == undefined) {
  21421. self['@temps'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21422. $1 = self['@temps'];
  21423. } else {
  21424. $1 = self['@temps'];
  21425. }
  21426. return $1;
  21427. },
  21428. args: [],
  21429. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  21430. messageSends: ["ifNil:", "new"],
  21431. referencedClasses: ["Dictionary"]
  21432. }),
  21433. smalltalk.LexicalScope);
  21434. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  21435. smalltalk.MethodLexicalScope.comment="I represent a method scope."
  21436. smalltalk.addMethod(
  21437. "_addIVar_",
  21438. smalltalk.method({
  21439. selector: "addIVar:",
  21440. category: 'adding',
  21441. fn: function (aString) {
  21442. var self = this;
  21443. smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_put_", [aString, smalltalk.send(smalltalk.InstanceVar || InstanceVar, "_on_", [aString])]);
  21444. smalltalk.send(smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_", [aString]), "_scope_", [self]);
  21445. return self;
  21446. },
  21447. args: ["aString"],
  21448. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  21449. messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
  21450. referencedClasses: ["InstanceVar"]
  21451. }),
  21452. smalltalk.MethodLexicalScope);
  21453. smalltalk.addMethod(
  21454. "_addNonLocalReturn_",
  21455. smalltalk.method({
  21456. selector: "addNonLocalReturn:",
  21457. category: 'adding',
  21458. fn: function (aScope) {
  21459. var self = this;
  21460. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
  21461. return self;
  21462. },
  21463. args: ["aScope"],
  21464. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  21465. messageSends: ["add:", "nonLocalReturns"],
  21466. referencedClasses: []
  21467. }),
  21468. smalltalk.MethodLexicalScope);
  21469. smalltalk.addMethod(
  21470. "_allVariableNames",
  21471. smalltalk.method({
  21472. selector: "allVariableNames",
  21473. category: 'accessing',
  21474. fn: function () {
  21475. var self = this;
  21476. var $1;
  21477. $1 = smalltalk.send(smalltalk.send(self, "_allVariableNames", [], smalltalk.LexicalScope), "__comma", [smalltalk.send(smalltalk.send(self, "_iVars", []), "_keys", [])]);
  21478. return $1;
  21479. },
  21480. args: [],
  21481. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  21482. messageSends: [",", "keys", "iVars", "allVariableNames"],
  21483. referencedClasses: []
  21484. }),
  21485. smalltalk.MethodLexicalScope);
  21486. smalltalk.addMethod(
  21487. "_bindingFor_",
  21488. smalltalk.method({
  21489. selector: "bindingFor:",
  21490. category: 'accessing',
  21491. fn: function (aNode) {
  21492. var self = this;
  21493. var $2, $1;
  21494. $2 = smalltalk.send(self, "_bindingFor_", [aNode], smalltalk.LexicalScope);
  21495. if (($receiver = $2) == nil || $receiver == undefined) {
  21496. $1 = smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_ifAbsent_", [smalltalk.send(aNode, "_value", []), function () {return nil;}]);
  21497. } else {
  21498. $1 = $2;
  21499. }
  21500. return $1;
  21501. },
  21502. args: ["aNode"],
  21503. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  21504. messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
  21505. referencedClasses: []
  21506. }),
  21507. smalltalk.MethodLexicalScope);
  21508. smalltalk.addMethod(
  21509. "_canInlineNonLocalReturns",
  21510. smalltalk.method({
  21511. selector: "canInlineNonLocalReturns",
  21512. category: 'testing',
  21513. fn: function () {
  21514. var self = this;
  21515. return true;
  21516. },
  21517. args: [],
  21518. source: "canInlineNonLocalReturns\x0a\x09^ true",
  21519. messageSends: [],
  21520. referencedClasses: []
  21521. }),
  21522. smalltalk.MethodLexicalScope);
  21523. smalltalk.addMethod(
  21524. "_hasLocalReturn",
  21525. smalltalk.method({
  21526. selector: "hasLocalReturn",
  21527. category: 'testing',
  21528. fn: function () {
  21529. var self = this;
  21530. var $1;
  21531. $1 = smalltalk.send(self, "_localReturn", []);
  21532. return $1;
  21533. },
  21534. args: [],
  21535. source: "hasLocalReturn\x0a\x09^ self localReturn",
  21536. messageSends: ["localReturn"],
  21537. referencedClasses: []
  21538. }),
  21539. smalltalk.MethodLexicalScope);
  21540. smalltalk.addMethod(
  21541. "_hasNonLocalReturn",
  21542. smalltalk.method({
  21543. selector: "hasNonLocalReturn",
  21544. category: 'testing',
  21545. fn: function () {
  21546. var self = this;
  21547. var $1;
  21548. $1 = smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_notEmpty", []);
  21549. return $1;
  21550. },
  21551. args: [],
  21552. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  21553. messageSends: ["notEmpty", "nonLocalReturns"],
  21554. referencedClasses: []
  21555. }),
  21556. smalltalk.MethodLexicalScope);
  21557. smalltalk.addMethod(
  21558. "_iVars",
  21559. smalltalk.method({
  21560. selector: "iVars",
  21561. category: 'accessing',
  21562. fn: function () {
  21563. var self = this;
  21564. var $1;
  21565. if (($receiver = self['@iVars']) == nil || $receiver == undefined) {
  21566. self['@iVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21567. $1 = self['@iVars'];
  21568. } else {
  21569. $1 = self['@iVars'];
  21570. }
  21571. return $1;
  21572. },
  21573. args: [],
  21574. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  21575. messageSends: ["ifNil:", "new"],
  21576. referencedClasses: ["Dictionary"]
  21577. }),
  21578. smalltalk.MethodLexicalScope);
  21579. smalltalk.addMethod(
  21580. "_isMethodScope",
  21581. smalltalk.method({
  21582. selector: "isMethodScope",
  21583. category: 'testing',
  21584. fn: function () {
  21585. var self = this;
  21586. return true;
  21587. },
  21588. args: [],
  21589. source: "isMethodScope\x0a\x09^ true",
  21590. messageSends: [],
  21591. referencedClasses: []
  21592. }),
  21593. smalltalk.MethodLexicalScope);
  21594. smalltalk.addMethod(
  21595. "_localReturn",
  21596. smalltalk.method({
  21597. selector: "localReturn",
  21598. category: 'accessing',
  21599. fn: function () {
  21600. var self = this;
  21601. var $1;
  21602. if (($receiver = self['@localReturn']) == nil || $receiver == undefined) {
  21603. $1 = false;
  21604. } else {
  21605. $1 = self['@localReturn'];
  21606. }
  21607. return $1;
  21608. },
  21609. args: [],
  21610. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  21611. messageSends: ["ifNil:"],
  21612. referencedClasses: []
  21613. }),
  21614. smalltalk.MethodLexicalScope);
  21615. smalltalk.addMethod(
  21616. "_localReturn_",
  21617. smalltalk.method({
  21618. selector: "localReturn:",
  21619. category: 'accessing',
  21620. fn: function (aBoolean) {
  21621. var self = this;
  21622. self['@localReturn'] = aBoolean;
  21623. return self;
  21624. },
  21625. args: ["aBoolean"],
  21626. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  21627. messageSends: [],
  21628. referencedClasses: []
  21629. }),
  21630. smalltalk.MethodLexicalScope);
  21631. smalltalk.addMethod(
  21632. "_methodScope",
  21633. smalltalk.method({
  21634. selector: "methodScope",
  21635. category: 'accessing',
  21636. fn: function () {
  21637. var self = this;
  21638. return self;
  21639. },
  21640. args: [],
  21641. source: "methodScope\x0a\x09^ self",
  21642. messageSends: [],
  21643. referencedClasses: []
  21644. }),
  21645. smalltalk.MethodLexicalScope);
  21646. smalltalk.addMethod(
  21647. "_nonLocalReturns",
  21648. smalltalk.method({
  21649. selector: "nonLocalReturns",
  21650. category: 'accessing',
  21651. fn: function () {
  21652. var self = this;
  21653. var $1;
  21654. if (($receiver = self['@nonLocalReturns']) == nil ||
  21655. $receiver == undefined) {
  21656. self['@nonLocalReturns'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  21657. $1 = self['@nonLocalReturns'];
  21658. } else {
  21659. $1 = self['@nonLocalReturns'];
  21660. }
  21661. return $1;
  21662. },
  21663. args: [],
  21664. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  21665. messageSends: ["ifNil:", "new"],
  21666. referencedClasses: ["OrderedCollection"]
  21667. }),
  21668. smalltalk.MethodLexicalScope);
  21669. smalltalk.addMethod(
  21670. "_pseudoVars",
  21671. smalltalk.method({
  21672. selector: "pseudoVars",
  21673. category: 'accessing',
  21674. fn: function () {
  21675. var self = this;
  21676. var $1, $2;
  21677. if (($receiver = self['@pseudoVars']) == nil || $receiver == undefined) {
  21678. self['@pseudoVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  21679. self['@pseudoVars'];
  21680. 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]);}]);
  21681. } else {
  21682. self['@pseudoVars'];
  21683. }
  21684. return self['@pseudoVars'];
  21685. },
  21686. args: [],
  21687. 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",
  21688. messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
  21689. referencedClasses: ["Dictionary", "PseudoVar", "Smalltalk"]
  21690. }),
  21691. smalltalk.MethodLexicalScope);
  21692. smalltalk.addMethod(
  21693. "_removeNonLocalReturn_",
  21694. smalltalk.method({
  21695. selector: "removeNonLocalReturn:",
  21696. category: 'adding',
  21697. fn: function (aScope) {
  21698. var self = this;
  21699. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, function () {}]);
  21700. return self;
  21701. },
  21702. args: ["aScope"],
  21703. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  21704. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  21705. referencedClasses: []
  21706. }),
  21707. smalltalk.MethodLexicalScope);
  21708. smalltalk.addMethod(
  21709. "_unknownVariables",
  21710. smalltalk.method({
  21711. selector: "unknownVariables",
  21712. category: 'accessing',
  21713. fn: function () {
  21714. var self = this;
  21715. var $1;
  21716. if (($receiver = self['@unknownVariables']) == nil ||
  21717. $receiver == undefined) {
  21718. self['@unknownVariables'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
  21719. $1 = self['@unknownVariables'];
  21720. } else {
  21721. $1 = self['@unknownVariables'];
  21722. }
  21723. return $1;
  21724. },
  21725. args: [],
  21726. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  21727. messageSends: ["ifNil:", "new"],
  21728. referencedClasses: ["OrderedCollection"]
  21729. }),
  21730. smalltalk.MethodLexicalScope);
  21731. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  21732. 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."
  21733. smalltalk.addMethod(
  21734. "_alias",
  21735. smalltalk.method({
  21736. selector: "alias",
  21737. category: 'accessing',
  21738. fn: function () {
  21739. var self = this;
  21740. var $1;
  21741. $1 = smalltalk.send(smalltalk.send(self, "_name", []), "_asVariableName", []);
  21742. return $1;
  21743. },
  21744. args: [],
  21745. source: "alias\x0a\x09^ self name asVariableName",
  21746. messageSends: ["asVariableName", "name"],
  21747. referencedClasses: []
  21748. }),
  21749. smalltalk.ScopeVar);
  21750. smalltalk.addMethod(
  21751. "_isArgVar",
  21752. smalltalk.method({
  21753. selector: "isArgVar",
  21754. category: 'testing',
  21755. fn: function () {
  21756. var self = this;
  21757. return false;
  21758. },
  21759. args: [],
  21760. source: "isArgVar\x0a\x09^ false",
  21761. messageSends: [],
  21762. referencedClasses: []
  21763. }),
  21764. smalltalk.ScopeVar);
  21765. smalltalk.addMethod(
  21766. "_isClassRefVar",
  21767. smalltalk.method({
  21768. selector: "isClassRefVar",
  21769. category: 'testing',
  21770. fn: function () {
  21771. var self = this;
  21772. return false;
  21773. },
  21774. args: [],
  21775. source: "isClassRefVar\x0a\x09^ false",
  21776. messageSends: [],
  21777. referencedClasses: []
  21778. }),
  21779. smalltalk.ScopeVar);
  21780. smalltalk.addMethod(
  21781. "_isInstanceVar",
  21782. smalltalk.method({
  21783. selector: "isInstanceVar",
  21784. category: 'testing',
  21785. fn: function () {
  21786. var self = this;
  21787. return false;
  21788. },
  21789. args: [],
  21790. source: "isInstanceVar\x0a\x09^ false",
  21791. messageSends: [],
  21792. referencedClasses: []
  21793. }),
  21794. smalltalk.ScopeVar);
  21795. smalltalk.addMethod(
  21796. "_isPseudoVar",
  21797. smalltalk.method({
  21798. selector: "isPseudoVar",
  21799. category: 'testing',
  21800. fn: function () {
  21801. var self = this;
  21802. return false;
  21803. },
  21804. args: [],
  21805. source: "isPseudoVar\x0a\x09^ false",
  21806. messageSends: [],
  21807. referencedClasses: []
  21808. }),
  21809. smalltalk.ScopeVar);
  21810. smalltalk.addMethod(
  21811. "_isTempVar",
  21812. smalltalk.method({
  21813. selector: "isTempVar",
  21814. category: 'testing',
  21815. fn: function () {
  21816. var self = this;
  21817. return false;
  21818. },
  21819. args: [],
  21820. source: "isTempVar\x0a\x09^ false",
  21821. messageSends: [],
  21822. referencedClasses: []
  21823. }),
  21824. smalltalk.ScopeVar);
  21825. smalltalk.addMethod(
  21826. "_isUnknownVar",
  21827. smalltalk.method({
  21828. selector: "isUnknownVar",
  21829. category: 'testing',
  21830. fn: function () {
  21831. var self = this;
  21832. return false;
  21833. },
  21834. args: [],
  21835. source: "isUnknownVar\x0a\x09^ false",
  21836. messageSends: [],
  21837. referencedClasses: []
  21838. }),
  21839. smalltalk.ScopeVar);
  21840. smalltalk.addMethod(
  21841. "_name",
  21842. smalltalk.method({
  21843. selector: "name",
  21844. category: 'accessing',
  21845. fn: function () {
  21846. var self = this;
  21847. return self['@name'];
  21848. },
  21849. args: [],
  21850. source: "name\x0a\x09^ name",
  21851. messageSends: [],
  21852. referencedClasses: []
  21853. }),
  21854. smalltalk.ScopeVar);
  21855. smalltalk.addMethod(
  21856. "_name_",
  21857. smalltalk.method({
  21858. selector: "name:",
  21859. category: 'accessing',
  21860. fn: function (aString) {
  21861. var self = this;
  21862. self['@name'] = aString;
  21863. return self;
  21864. },
  21865. args: ["aString"],
  21866. source: "name: aString\x0a\x09name := aString",
  21867. messageSends: [],
  21868. referencedClasses: []
  21869. }),
  21870. smalltalk.ScopeVar);
  21871. smalltalk.addMethod(
  21872. "_scope",
  21873. smalltalk.method({
  21874. selector: "scope",
  21875. category: 'accessing',
  21876. fn: function () {
  21877. var self = this;
  21878. return self['@scope'];
  21879. },
  21880. args: [],
  21881. source: "scope\x0a\x09^ scope",
  21882. messageSends: [],
  21883. referencedClasses: []
  21884. }),
  21885. smalltalk.ScopeVar);
  21886. smalltalk.addMethod(
  21887. "_scope_",
  21888. smalltalk.method({
  21889. selector: "scope:",
  21890. category: 'accessing',
  21891. fn: function (aScope) {
  21892. var self = this;
  21893. self['@scope'] = aScope;
  21894. return self;
  21895. },
  21896. args: ["aScope"],
  21897. source: "scope: aScope\x0a\x09scope := aScope",
  21898. messageSends: [],
  21899. referencedClasses: []
  21900. }),
  21901. smalltalk.ScopeVar);
  21902. smalltalk.addMethod(
  21903. "_validateAssignment",
  21904. smalltalk.method({
  21905. selector: "validateAssignment",
  21906. category: 'testing',
  21907. fn: function () {
  21908. var self = this;
  21909. var $1, $2, $3;
  21910. $1 = smalltalk.send(smalltalk.send(self, "_isArgVar", []), "_or_", [function () {return smalltalk.send(self, "_isPseudoVar", []);}]);
  21911. if (smalltalk.assert($1)) {
  21912. $2 = smalltalk.send(smalltalk.InvalidAssignmentError || InvalidAssignmentError, "_new", []);
  21913. smalltalk.send($2, "_variableName_", [smalltalk.send(self, "_name", [])]);
  21914. $3 = smalltalk.send($2, "_signal", []);
  21915. }
  21916. return self;
  21917. },
  21918. args: [],
  21919. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  21920. messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
  21921. referencedClasses: ["InvalidAssignmentError"]
  21922. }),
  21923. smalltalk.ScopeVar);
  21924. smalltalk.addMethod(
  21925. "_on_",
  21926. smalltalk.method({
  21927. selector: "on:",
  21928. category: 'instance creation',
  21929. fn: function (aString) {
  21930. var self = this;
  21931. var $2, $3, $1;
  21932. $2 = smalltalk.send(self, "_new", []);
  21933. smalltalk.send($2, "_name_", [aString]);
  21934. $3 = smalltalk.send($2, "_yourself", []);
  21935. $1 = $3;
  21936. return $1;
  21937. },
  21938. args: ["aString"],
  21939. source: "on: aString\x0a\x09^ self new \x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  21940. messageSends: ["name:", "new", "yourself"],
  21941. referencedClasses: []
  21942. }),
  21943. smalltalk.ScopeVar.klass);
  21944. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  21945. smalltalk.AliasVar.comment="I am an internally defined variable by the compiler"
  21946. smalltalk.addMethod(
  21947. "_node",
  21948. smalltalk.method({
  21949. selector: "node",
  21950. category: 'accessing',
  21951. fn: function () {
  21952. var self = this;
  21953. return self['@node'];
  21954. },
  21955. args: [],
  21956. source: "node\x0a\x09^ node",
  21957. messageSends: [],
  21958. referencedClasses: []
  21959. }),
  21960. smalltalk.AliasVar);
  21961. smalltalk.addMethod(
  21962. "_node_",
  21963. smalltalk.method({
  21964. selector: "node:",
  21965. category: 'accessing',
  21966. fn: function (aNode) {
  21967. var self = this;
  21968. self['@node'] = aNode;
  21969. return self;
  21970. },
  21971. args: ["aNode"],
  21972. source: "node: aNode\x0a\x09node := aNode",
  21973. messageSends: [],
  21974. referencedClasses: []
  21975. }),
  21976. smalltalk.AliasVar);
  21977. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  21978. smalltalk.ArgVar.comment="I am an argument of a method or block."
  21979. smalltalk.addMethod(
  21980. "_isArgVar",
  21981. smalltalk.method({
  21982. selector: "isArgVar",
  21983. category: 'testing',
  21984. fn: function () {
  21985. var self = this;
  21986. return true;
  21987. },
  21988. args: [],
  21989. source: "isArgVar\x0a\x09^ true",
  21990. messageSends: [],
  21991. referencedClasses: []
  21992. }),
  21993. smalltalk.ArgVar);
  21994. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  21995. smalltalk.ClassRefVar.comment="I am an class reference variable"
  21996. smalltalk.addMethod(
  21997. "_alias",
  21998. smalltalk.method({
  21999. selector: "alias",
  22000. category: 'accessing',
  22001. fn: function () {
  22002. var self = this;
  22003. var $1;
  22004. $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [")"]);
  22005. return $1;
  22006. },
  22007. args: [],
  22008. source: "alias\x0a\x09^ '(smalltalk.', self name, ' || ', self name, ')'",
  22009. messageSends: [",", "name"],
  22010. referencedClasses: []
  22011. }),
  22012. smalltalk.ClassRefVar);
  22013. smalltalk.addMethod(
  22014. "_isClassRefVar",
  22015. smalltalk.method({
  22016. selector: "isClassRefVar",
  22017. category: 'testing',
  22018. fn: function () {
  22019. var self = this;
  22020. return true;
  22021. },
  22022. args: [],
  22023. source: "isClassRefVar\x0a\x09^ true",
  22024. messageSends: [],
  22025. referencedClasses: []
  22026. }),
  22027. smalltalk.ClassRefVar);
  22028. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22029. smalltalk.InstanceVar.comment="I am an instance variable of a method or block."
  22030. smalltalk.addMethod(
  22031. "_alias",
  22032. smalltalk.method({
  22033. selector: "alias",
  22034. category: 'testing',
  22035. fn: function () {
  22036. var self = this;
  22037. var $1;
  22038. $1 = smalltalk.send(smalltalk.send("self[\"@", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", ["\"]"]);
  22039. return $1;
  22040. },
  22041. args: [],
  22042. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  22043. messageSends: [",", "name"],
  22044. referencedClasses: []
  22045. }),
  22046. smalltalk.InstanceVar);
  22047. smalltalk.addMethod(
  22048. "_isInstanceVar",
  22049. smalltalk.method({
  22050. selector: "isInstanceVar",
  22051. category: 'testing',
  22052. fn: function () {
  22053. var self = this;
  22054. return true;
  22055. },
  22056. args: [],
  22057. source: "isInstanceVar\x0a\x09^ true",
  22058. messageSends: [],
  22059. referencedClasses: []
  22060. }),
  22061. smalltalk.InstanceVar);
  22062. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22063. smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"
  22064. smalltalk.addMethod(
  22065. "_alias",
  22066. smalltalk.method({
  22067. selector: "alias",
  22068. category: 'accessing',
  22069. fn: function () {
  22070. var self = this;
  22071. var $1;
  22072. $1 = smalltalk.send(self, "_name", []);
  22073. return $1;
  22074. },
  22075. args: [],
  22076. source: "alias\x0a\x09^ self name",
  22077. messageSends: ["name"],
  22078. referencedClasses: []
  22079. }),
  22080. smalltalk.PseudoVar);
  22081. smalltalk.addMethod(
  22082. "_isPseudoVar",
  22083. smalltalk.method({
  22084. selector: "isPseudoVar",
  22085. category: 'testing',
  22086. fn: function () {
  22087. var self = this;
  22088. return true;
  22089. },
  22090. args: [],
  22091. source: "isPseudoVar\x0a\x09^ true",
  22092. messageSends: [],
  22093. referencedClasses: []
  22094. }),
  22095. smalltalk.PseudoVar);
  22096. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22097. smalltalk.TempVar.comment="I am an temporary variable of a method or block."
  22098. smalltalk.addMethod(
  22099. "_isTempVar",
  22100. smalltalk.method({
  22101. selector: "isTempVar",
  22102. category: 'testing',
  22103. fn: function () {
  22104. var self = this;
  22105. return true;
  22106. },
  22107. args: [],
  22108. source: "isTempVar\x0a\x09^ true",
  22109. messageSends: [],
  22110. referencedClasses: []
  22111. }),
  22112. smalltalk.TempVar);
  22113. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  22114. smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"
  22115. smalltalk.addMethod(
  22116. "_isUnknownVar",
  22117. smalltalk.method({
  22118. selector: "isUnknownVar",
  22119. category: 'testing',
  22120. fn: function () {
  22121. var self = this;
  22122. return true;
  22123. },
  22124. args: [],
  22125. source: "isUnknownVar\x0a\x09^ true",
  22126. messageSends: [],
  22127. referencedClasses: []
  22128. }),
  22129. smalltalk.UnknownVar);
  22130. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  22131. smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."
  22132. smalltalk.addMethod(
  22133. "_classReferences",
  22134. smalltalk.method({
  22135. selector: "classReferences",
  22136. category: 'accessing',
  22137. fn: function () {
  22138. var self = this;
  22139. var $1;
  22140. if (($receiver = self['@classReferences']) == nil ||
  22141. $receiver == undefined) {
  22142. self['@classReferences'] = smalltalk.send(smalltalk.Set || Set, "_new", []);
  22143. $1 = self['@classReferences'];
  22144. } else {
  22145. $1 = self['@classReferences'];
  22146. }
  22147. return $1;
  22148. },
  22149. args: [],
  22150. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  22151. messageSends: ["ifNil:", "new"],
  22152. referencedClasses: ["Set"]
  22153. }),
  22154. smalltalk.SemanticAnalyzer);
  22155. smalltalk.addMethod(
  22156. "_errorShadowingVariable_",
  22157. smalltalk.method({
  22158. selector: "errorShadowingVariable:",
  22159. category: 'error handling',
  22160. fn: function (aString) {
  22161. var self = this;
  22162. var $1, $2;
  22163. $1 = smalltalk.send(smalltalk.ShadowingVariableError || ShadowingVariableError, "_new", []);
  22164. smalltalk.send($1, "_variableName_", [aString]);
  22165. $2 = smalltalk.send($1, "_signal", []);
  22166. return self;
  22167. },
  22168. args: ["aString"],
  22169. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  22170. messageSends: ["variableName:", "new", "signal"],
  22171. referencedClasses: ["ShadowingVariableError"]
  22172. }),
  22173. smalltalk.SemanticAnalyzer);
  22174. smalltalk.addMethod(
  22175. "_errorUnknownVariable_",
  22176. smalltalk.method({
  22177. selector: "errorUnknownVariable:",
  22178. category: 'error handling',
  22179. fn: function (aNode) {
  22180. var self = this;
  22181. var $1, $2;
  22182. var notDefined;
  22183. notDefined = eval("typeof " + aNode._value() + " == \"undefined\"");
  22184. if (smalltalk.assert(notDefined)) {
  22185. $1 = smalltalk.send(smalltalk.UnknownVariableError || UnknownVariableError, "_new", []);
  22186. smalltalk.send($1, "_variableName_", [smalltalk.send(aNode, "_value", [])]);
  22187. $2 = smalltalk.send($1, "_signal", []);
  22188. } else {
  22189. smalltalk.send(smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_unknownVariables", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  22190. }
  22191. return self;
  22192. },
  22193. args: ["aNode"],
  22194. 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. ]",
  22195. messageSends: ["ifTrue:ifFalse:", "variableName:", "value", "new", "signal", "add:", "unknownVariables", "methodScope"],
  22196. referencedClasses: ["UnknownVariableError"]
  22197. }),
  22198. smalltalk.SemanticAnalyzer);
  22199. smalltalk.addMethod(
  22200. "_messageSends",
  22201. smalltalk.method({
  22202. selector: "messageSends",
  22203. category: 'accessing',
  22204. fn: function () {
  22205. var self = this;
  22206. var $1;
  22207. if (($receiver = self['@messageSends']) == nil ||
  22208. $receiver == undefined) {
  22209. self['@messageSends'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
  22210. $1 = self['@messageSends'];
  22211. } else {
  22212. $1 = self['@messageSends'];
  22213. }
  22214. return $1;
  22215. },
  22216. args: [],
  22217. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  22218. messageSends: ["ifNil:", "new"],
  22219. referencedClasses: ["Dictionary"]
  22220. }),
  22221. smalltalk.SemanticAnalyzer);
  22222. smalltalk.addMethod(
  22223. "_newBlockScope",
  22224. smalltalk.method({
  22225. selector: "newBlockScope",
  22226. category: 'factory',
  22227. fn: function () {
  22228. var self = this;
  22229. var $1;
  22230. $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.LexicalScope || LexicalScope]);
  22231. return $1;
  22232. },
  22233. args: [],
  22234. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  22235. messageSends: ["newScopeOfClass:"],
  22236. referencedClasses: ["LexicalScope"]
  22237. }),
  22238. smalltalk.SemanticAnalyzer);
  22239. smalltalk.addMethod(
  22240. "_newMethodScope",
  22241. smalltalk.method({
  22242. selector: "newMethodScope",
  22243. category: 'factory',
  22244. fn: function () {
  22245. var self = this;
  22246. var $1;
  22247. $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.MethodLexicalScope || MethodLexicalScope]);
  22248. return $1;
  22249. },
  22250. args: [],
  22251. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  22252. messageSends: ["newScopeOfClass:"],
  22253. referencedClasses: ["MethodLexicalScope"]
  22254. }),
  22255. smalltalk.SemanticAnalyzer);
  22256. smalltalk.addMethod(
  22257. "_newScopeOfClass_",
  22258. smalltalk.method({
  22259. selector: "newScopeOfClass:",
  22260. category: 'factory',
  22261. fn: function (aLexicalScopeClass) {
  22262. var self = this;
  22263. var $2, $3, $1;
  22264. $2 = smalltalk.send(aLexicalScopeClass, "_new", []);
  22265. smalltalk.send($2, "_outerScope_", [self['@currentScope']]);
  22266. $3 = smalltalk.send($2, "_yourself", []);
  22267. $1 = $3;
  22268. return $1;
  22269. },
  22270. args: ["aLexicalScopeClass"],
  22271. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new \x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  22272. messageSends: ["outerScope:", "new", "yourself"],
  22273. referencedClasses: []
  22274. }),
  22275. smalltalk.SemanticAnalyzer);
  22276. smalltalk.addMethod(
  22277. "_popScope",
  22278. smalltalk.method({
  22279. selector: "popScope",
  22280. category: 'scope',
  22281. fn: function () {
  22282. var self = this;
  22283. if (($receiver = self['@currentScope']) == nil ||
  22284. $receiver == undefined) {
  22285. self['@currentScope'];
  22286. } else {
  22287. self['@currentScope'] = smalltalk.send(self['@currentScope'], "_outerScope", []);
  22288. self['@currentScope'];
  22289. }
  22290. return self;
  22291. },
  22292. args: [],
  22293. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  22294. messageSends: ["ifNotNil:", "outerScope"],
  22295. referencedClasses: []
  22296. }),
  22297. smalltalk.SemanticAnalyzer);
  22298. smalltalk.addMethod(
  22299. "_pushScope_",
  22300. smalltalk.method({
  22301. selector: "pushScope:",
  22302. category: 'scope',
  22303. fn: function (aScope) {
  22304. var self = this;
  22305. smalltalk.send(aScope, "_outerScope_", [self['@currentScope']]);
  22306. self['@currentScope'] = aScope;
  22307. return self;
  22308. },
  22309. args: ["aScope"],
  22310. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  22311. messageSends: ["outerScope:"],
  22312. referencedClasses: []
  22313. }),
  22314. smalltalk.SemanticAnalyzer);
  22315. smalltalk.addMethod(
  22316. "_theClass",
  22317. smalltalk.method({
  22318. selector: "theClass",
  22319. category: 'accessing',
  22320. fn: function () {
  22321. var self = this;
  22322. return self['@theClass'];
  22323. },
  22324. args: [],
  22325. source: "theClass\x0a\x09^ theClass",
  22326. messageSends: [],
  22327. referencedClasses: []
  22328. }),
  22329. smalltalk.SemanticAnalyzer);
  22330. smalltalk.addMethod(
  22331. "_theClass_",
  22332. smalltalk.method({
  22333. selector: "theClass:",
  22334. category: 'accessing',
  22335. fn: function (aClass) {
  22336. var self = this;
  22337. self['@theClass'] = aClass;
  22338. return self;
  22339. },
  22340. args: ["aClass"],
  22341. source: "theClass: aClass\x0a\x09theClass := aClass",
  22342. messageSends: [],
  22343. referencedClasses: []
  22344. }),
  22345. smalltalk.SemanticAnalyzer);
  22346. smalltalk.addMethod(
  22347. "_validateVariableScope_",
  22348. smalltalk.method({
  22349. selector: "validateVariableScope:",
  22350. category: 'scope',
  22351. fn: function (aString) {
  22352. var self = this;
  22353. var $1;
  22354. $1 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aString]);
  22355. if (($receiver = $1) == nil || $receiver == undefined) {
  22356. } else {
  22357. smalltalk.send(self, "_errorShadowingVariable_", [aString]);
  22358. }
  22359. return self;
  22360. },
  22361. args: ["aString"],
  22362. 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 ]",
  22363. messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
  22364. referencedClasses: []
  22365. }),
  22366. smalltalk.SemanticAnalyzer);
  22367. smalltalk.addMethod(
  22368. "_visitAssignmentNode_",
  22369. smalltalk.method({
  22370. selector: "visitAssignmentNode:",
  22371. category: 'visiting',
  22372. fn: function (aNode) {
  22373. var self = this;
  22374. smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.NodeVisitor);
  22375. smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
  22376. return self;
  22377. },
  22378. args: ["aNode"],
  22379. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  22380. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  22381. referencedClasses: []
  22382. }),
  22383. smalltalk.SemanticAnalyzer);
  22384. smalltalk.addMethod(
  22385. "_visitBlockNode_",
  22386. smalltalk.method({
  22387. selector: "visitBlockNode:",
  22388. category: 'visiting',
  22389. fn: function (aNode) {
  22390. var self = this;
  22391. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newBlockScope", [])]);
  22392. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22393. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  22394. smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
  22395. smalltalk.send(self, "_visitBlockNode_", [aNode], smalltalk.NodeVisitor);
  22396. smalltalk.send(self, "_popScope", []);
  22397. return self;
  22398. },
  22399. args: ["aNode"],
  22400. 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",
  22401. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
  22402. referencedClasses: []
  22403. }),
  22404. smalltalk.SemanticAnalyzer);
  22405. smalltalk.addMethod(
  22406. "_visitCascadeNode_",
  22407. smalltalk.method({
  22408. selector: "visitCascadeNode:",
  22409. category: 'visiting',
  22410. fn: function (aNode) {
  22411. var self = this;
  22412. var $1;
  22413. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_receiver_", [smalltalk.send(aNode, "_receiver", [])]);}]);
  22414. smalltalk.send(self, "_visitCascadeNode_", [aNode], smalltalk.NodeVisitor);
  22415. $1 = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_first", []), "_superSend", []);
  22416. if (smalltalk.assert($1)) {
  22417. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_superSend_", [true]);}]);
  22418. }
  22419. return self;
  22420. },
  22421. args: ["aNode"],
  22422. 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 ]]",
  22423. messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
  22424. referencedClasses: []
  22425. }),
  22426. smalltalk.SemanticAnalyzer);
  22427. smalltalk.addMethod(
  22428. "_visitClassReferenceNode_",
  22429. smalltalk.method({
  22430. selector: "visitClassReferenceNode:",
  22431. category: 'visiting',
  22432. fn: function (aNode) {
  22433. var self = this;
  22434. var $1, $2;
  22435. smalltalk.send(smalltalk.send(self, "_classReferences", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  22436. $1 = smalltalk.send(smalltalk.ClassRefVar || ClassRefVar, "_new", []);
  22437. smalltalk.send($1, "_name_", [smalltalk.send(aNode, "_value", [])]);
  22438. $2 = smalltalk.send($1, "_yourself", []);
  22439. smalltalk.send(aNode, "_binding_", [$2]);
  22440. return self;
  22441. },
  22442. args: ["aNode"],
  22443. source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
  22444. messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
  22445. referencedClasses: ["ClassRefVar"]
  22446. }),
  22447. smalltalk.SemanticAnalyzer);
  22448. smalltalk.addMethod(
  22449. "_visitMethodNode_",
  22450. smalltalk.method({
  22451. selector: "visitMethodNode:",
  22452. category: 'visiting',
  22453. fn: function (aNode) {
  22454. var self = this;
  22455. var $1;
  22456. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newMethodScope", [])]);
  22457. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22458. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  22459. smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);}]);
  22460. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
  22461. smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.NodeVisitor);
  22462. smalltalk.send(aNode, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);
  22463. $1 = smalltalk.send(aNode, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);
  22464. smalltalk.send(self, "_popScope", []);
  22465. return self;
  22466. },
  22467. args: ["aNode"],
  22468. 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",
  22469. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "popScope"],
  22470. referencedClasses: []
  22471. }),
  22472. smalltalk.SemanticAnalyzer);
  22473. smalltalk.addMethod(
  22474. "_visitReturnNode_",
  22475. smalltalk.method({
  22476. selector: "visitReturnNode:",
  22477. category: 'visiting',
  22478. fn: function (aNode) {
  22479. var self = this;
  22480. var $1;
  22481. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  22482. $1 = smalltalk.send(self['@currentScope'], "_isMethodScope", []);
  22483. if (smalltalk.assert($1)) {
  22484. smalltalk.send(self['@currentScope'], "_localReturn_", [true]);
  22485. } else {
  22486. smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);
  22487. }
  22488. smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.NodeVisitor);
  22489. return self;
  22490. },
  22491. args: ["aNode"],
  22492. 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",
  22493. messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
  22494. referencedClasses: []
  22495. }),
  22496. smalltalk.SemanticAnalyzer);
  22497. smalltalk.addMethod(
  22498. "_visitSendNode_",
  22499. smalltalk.method({
  22500. selector: "visitSendNode:",
  22501. category: 'visiting',
  22502. fn: function (aNode) {
  22503. var self = this;
  22504. var $1, $2, $3;
  22505. $1 = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value", []), "__eq", ["super"]);
  22506. if (smalltalk.assert($1)) {
  22507. smalltalk.send(aNode, "_superSend_", [true]);
  22508. smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);
  22509. } else {
  22510. $2 = smalltalk.send(smalltalk.send(smalltalk.IRSendInliner || IRSendInliner, "_inlinedSelectors", []), "_includes_", [smalltalk.send(aNode, "_selector", [])]);
  22511. if (smalltalk.assert($2)) {
  22512. smalltalk.send(aNode, "_shouldBeInlined_", [true]);
  22513. $3 = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", []);
  22514. if (!smalltalk.assert($3)) {
  22515. smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);
  22516. }
  22517. }
  22518. }
  22519. smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_ifAbsentPut_", [smalltalk.send(aNode, "_selector", []), function () {return smalltalk.send(smalltalk.Set || Set, "_new", []);}]);
  22520. smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_add_", [aNode]);
  22521. smalltalk.send(aNode, "_index_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_size", [])]);
  22522. smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.NodeVisitor);
  22523. return self;
  22524. },
  22525. args: ["aNode"],
  22526. 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 isValueNode ifFalse: [ aNode 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",
  22527. messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "ifTrue:", "shouldBeInlined:", "ifFalse:", "shouldBeAliased:", "isValueNode", "includes:", "selector", "inlinedSelectors", "=", "value", "at:ifAbsentPut:", "new", "messageSends", "add:", "at:", "index:", "size", "visitSendNode:"],
  22528. referencedClasses: ["IRSendInliner", "Set"]
  22529. }),
  22530. smalltalk.SemanticAnalyzer);
  22531. smalltalk.addMethod(
  22532. "_visitSequenceNode_",
  22533. smalltalk.method({
  22534. selector: "visitSequenceNode:",
  22535. category: 'visiting',
  22536. fn: function (aNode) {
  22537. var self = this;
  22538. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addTemp_", [each]);}]);
  22539. smalltalk.send(self, "_visitSequenceNode_", [aNode], smalltalk.NodeVisitor);
  22540. return self;
  22541. },
  22542. args: ["aNode"],
  22543. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  22544. messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
  22545. referencedClasses: []
  22546. }),
  22547. smalltalk.SemanticAnalyzer);
  22548. smalltalk.addMethod(
  22549. "_visitVariableNode_",
  22550. smalltalk.method({
  22551. selector: "visitVariableNode:",
  22552. category: 'visiting',
  22553. fn: function (aNode) {
  22554. var self = this;
  22555. var $2, $3, $4, $1;
  22556. $2 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aNode]);
  22557. if (($receiver = $2) == nil || $receiver == undefined) {
  22558. smalltalk.send(self, "_errorUnknownVariable_", [aNode]);
  22559. $3 = smalltalk.send(smalltalk.UnknownVar || UnknownVar, "_new", []);
  22560. smalltalk.send($3, "_name_", [smalltalk.send(aNode, "_value", [])]);
  22561. $4 = smalltalk.send($3, "_yourself", []);
  22562. $1 = $4;
  22563. } else {
  22564. $1 = $2;
  22565. }
  22566. smalltalk.send(aNode, "_binding_", [$1]);
  22567. return self;
  22568. },
  22569. args: ["aNode"],
  22570. 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 ])",
  22571. messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
  22572. referencedClasses: ["UnknownVar"]
  22573. }),
  22574. smalltalk.SemanticAnalyzer);
  22575. smalltalk.addMethod(
  22576. "_on_",
  22577. smalltalk.method({
  22578. selector: "on:",
  22579. category: 'instance creation',
  22580. fn: function (aClass) {
  22581. var self = this;
  22582. var $2, $3, $1;
  22583. $2 = smalltalk.send(self, "_new", []);
  22584. smalltalk.send($2, "_theClass_", [aClass]);
  22585. $3 = smalltalk.send($2, "_yourself", []);
  22586. $1 = $3;
  22587. return $1;
  22588. },
  22589. args: ["aClass"],
  22590. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22591. messageSends: ["theClass:", "new", "yourself"],
  22592. referencedClasses: []
  22593. }),
  22594. smalltalk.SemanticAnalyzer.klass);
  22595. smalltalk.parser = (function(){
  22596. /*
  22597. * Generated by PEG.js 0.7.0.
  22598. *
  22599. * http://pegjs.majda.cz/
  22600. */
  22601. function quote(s) {
  22602. /*
  22603. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  22604. * string literal except for the closing quote character, backslash,
  22605. * carriage return, line separator, paragraph separator, and line feed.
  22606. * Any character may appear in the form of an escape sequence.
  22607. *
  22608. * For portability, we also escape escape all control and non-ASCII
  22609. * characters. Note that "\0" and "\v" escape sequences are not used
  22610. * because JSHint does not like the first and IE the second.
  22611. */
  22612. return '"' + s
  22613. .replace(/\\/g, '\\\\') // backslash
  22614. .replace(/"/g, '\\"') // closing quote character
  22615. .replace(/\x08/g, '\\b') // backspace
  22616. .replace(/\t/g, '\\t') // horizontal tab
  22617. .replace(/\n/g, '\\n') // line feed
  22618. .replace(/\f/g, '\\f') // form feed
  22619. .replace(/\r/g, '\\r') // carriage return
  22620. .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
  22621. + '"';
  22622. }
  22623. var result = {
  22624. /*
  22625. * Parses the input with a generated parser. If the parsing is successfull,
  22626. * returns a value explicitly or implicitly specified by the grammar from
  22627. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  22628. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  22629. */
  22630. parse: function(input, startRule) {
  22631. var parseFunctions = {
  22632. "separator": parse_separator,
  22633. "comments": parse_comments,
  22634. "ws": parse_ws,
  22635. "identifier": parse_identifier,
  22636. "varIdentifier": parse_varIdentifier,
  22637. "keyword": parse_keyword,
  22638. "className": parse_className,
  22639. "string": parse_string,
  22640. "symbol": parse_symbol,
  22641. "number": parse_number,
  22642. "hex": parse_hex,
  22643. "float": parse_float,
  22644. "integer": parse_integer,
  22645. "literalArray": parse_literalArray,
  22646. "dynamicArray": parse_dynamicArray,
  22647. "dynamicDictionary": parse_dynamicDictionary,
  22648. "pseudoVariable": parse_pseudoVariable,
  22649. "literal": parse_literal,
  22650. "variable": parse_variable,
  22651. "classReference": parse_classReference,
  22652. "reference": parse_reference,
  22653. "keywordPair": parse_keywordPair,
  22654. "binarySelector": parse_binarySelector,
  22655. "keywordPattern": parse_keywordPattern,
  22656. "binaryPattern": parse_binaryPattern,
  22657. "unaryPattern": parse_unaryPattern,
  22658. "expression": parse_expression,
  22659. "expressionList": parse_expressionList,
  22660. "expressions": parse_expressions,
  22661. "assignment": parse_assignment,
  22662. "ret": parse_ret,
  22663. "temps": parse_temps,
  22664. "blockParamList": parse_blockParamList,
  22665. "subexpression": parse_subexpression,
  22666. "statements": parse_statements,
  22667. "sequence": parse_sequence,
  22668. "block": parse_block,
  22669. "operand": parse_operand,
  22670. "unaryMessage": parse_unaryMessage,
  22671. "unaryTail": parse_unaryTail,
  22672. "unarySend": parse_unarySend,
  22673. "binaryMessage": parse_binaryMessage,
  22674. "binaryTail": parse_binaryTail,
  22675. "binarySend": parse_binarySend,
  22676. "keywordMessage": parse_keywordMessage,
  22677. "keywordSend": parse_keywordSend,
  22678. "message": parse_message,
  22679. "cascade": parse_cascade,
  22680. "jsStatement": parse_jsStatement,
  22681. "method": parse_method
  22682. };
  22683. if (startRule !== undefined) {
  22684. if (parseFunctions[startRule] === undefined) {
  22685. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  22686. }
  22687. } else {
  22688. startRule = "method";
  22689. }
  22690. var pos = 0;
  22691. var reportFailures = 0;
  22692. var rightmostFailuresPos = 0;
  22693. var rightmostFailuresExpected = [];
  22694. function padLeft(input, padding, length) {
  22695. var result = input;
  22696. var padLength = length - input.length;
  22697. for (var i = 0; i < padLength; i++) {
  22698. result = padding + result;
  22699. }
  22700. return result;
  22701. }
  22702. function escape(ch) {
  22703. var charCode = ch.charCodeAt(0);
  22704. var escapeChar;
  22705. var length;
  22706. if (charCode <= 0xFF) {
  22707. escapeChar = 'x';
  22708. length = 2;
  22709. } else {
  22710. escapeChar = 'u';
  22711. length = 4;
  22712. }
  22713. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  22714. }
  22715. function matchFailed(failure) {
  22716. if (pos < rightmostFailuresPos) {
  22717. return;
  22718. }
  22719. if (pos > rightmostFailuresPos) {
  22720. rightmostFailuresPos = pos;
  22721. rightmostFailuresExpected = [];
  22722. }
  22723. rightmostFailuresExpected.push(failure);
  22724. }
  22725. function parse_separator() {
  22726. var result0, result1;
  22727. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos))) {
  22728. result1 = input.charAt(pos);
  22729. pos++;
  22730. } else {
  22731. result1 = null;
  22732. if (reportFailures === 0) {
  22733. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  22734. }
  22735. }
  22736. if (result1 !== null) {
  22737. result0 = [];
  22738. while (result1 !== null) {
  22739. result0.push(result1);
  22740. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos))) {
  22741. result1 = input.charAt(pos);
  22742. pos++;
  22743. } else {
  22744. result1 = null;
  22745. if (reportFailures === 0) {
  22746. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  22747. }
  22748. }
  22749. }
  22750. } else {
  22751. result0 = null;
  22752. }
  22753. return result0;
  22754. }
  22755. function parse_comments() {
  22756. var result0, result1, result2, result3;
  22757. var pos0;
  22758. pos0 = pos;
  22759. if (/^["]/.test(input.charAt(pos))) {
  22760. result1 = input.charAt(pos);
  22761. pos++;
  22762. } else {
  22763. result1 = null;
  22764. if (reportFailures === 0) {
  22765. matchFailed("[\"]");
  22766. }
  22767. }
  22768. if (result1 !== null) {
  22769. result2 = [];
  22770. if (/^[^"]/.test(input.charAt(pos))) {
  22771. result3 = input.charAt(pos);
  22772. pos++;
  22773. } else {
  22774. result3 = null;
  22775. if (reportFailures === 0) {
  22776. matchFailed("[^\"]");
  22777. }
  22778. }
  22779. while (result3 !== null) {
  22780. result2.push(result3);
  22781. if (/^[^"]/.test(input.charAt(pos))) {
  22782. result3 = input.charAt(pos);
  22783. pos++;
  22784. } else {
  22785. result3 = null;
  22786. if (reportFailures === 0) {
  22787. matchFailed("[^\"]");
  22788. }
  22789. }
  22790. }
  22791. if (result2 !== null) {
  22792. if (/^["]/.test(input.charAt(pos))) {
  22793. result3 = input.charAt(pos);
  22794. pos++;
  22795. } else {
  22796. result3 = null;
  22797. if (reportFailures === 0) {
  22798. matchFailed("[\"]");
  22799. }
  22800. }
  22801. if (result3 !== null) {
  22802. result1 = [result1, result2, result3];
  22803. } else {
  22804. result1 = null;
  22805. pos = pos0;
  22806. }
  22807. } else {
  22808. result1 = null;
  22809. pos = pos0;
  22810. }
  22811. } else {
  22812. result1 = null;
  22813. pos = pos0;
  22814. }
  22815. if (result1 !== null) {
  22816. result0 = [];
  22817. while (result1 !== null) {
  22818. result0.push(result1);
  22819. pos0 = pos;
  22820. if (/^["]/.test(input.charAt(pos))) {
  22821. result1 = input.charAt(pos);
  22822. pos++;
  22823. } else {
  22824. result1 = null;
  22825. if (reportFailures === 0) {
  22826. matchFailed("[\"]");
  22827. }
  22828. }
  22829. if (result1 !== null) {
  22830. result2 = [];
  22831. if (/^[^"]/.test(input.charAt(pos))) {
  22832. result3 = input.charAt(pos);
  22833. pos++;
  22834. } else {
  22835. result3 = null;
  22836. if (reportFailures === 0) {
  22837. matchFailed("[^\"]");
  22838. }
  22839. }
  22840. while (result3 !== null) {
  22841. result2.push(result3);
  22842. if (/^[^"]/.test(input.charAt(pos))) {
  22843. result3 = input.charAt(pos);
  22844. pos++;
  22845. } else {
  22846. result3 = null;
  22847. if (reportFailures === 0) {
  22848. matchFailed("[^\"]");
  22849. }
  22850. }
  22851. }
  22852. if (result2 !== null) {
  22853. if (/^["]/.test(input.charAt(pos))) {
  22854. result3 = input.charAt(pos);
  22855. pos++;
  22856. } else {
  22857. result3 = null;
  22858. if (reportFailures === 0) {
  22859. matchFailed("[\"]");
  22860. }
  22861. }
  22862. if (result3 !== null) {
  22863. result1 = [result1, result2, result3];
  22864. } else {
  22865. result1 = null;
  22866. pos = pos0;
  22867. }
  22868. } else {
  22869. result1 = null;
  22870. pos = pos0;
  22871. }
  22872. } else {
  22873. result1 = null;
  22874. pos = pos0;
  22875. }
  22876. }
  22877. } else {
  22878. result0 = null;
  22879. }
  22880. return result0;
  22881. }
  22882. function parse_ws() {
  22883. var result0, result1;
  22884. result0 = [];
  22885. result1 = parse_separator();
  22886. if (result1 === null) {
  22887. result1 = parse_comments();
  22888. }
  22889. while (result1 !== null) {
  22890. result0.push(result1);
  22891. result1 = parse_separator();
  22892. if (result1 === null) {
  22893. result1 = parse_comments();
  22894. }
  22895. }
  22896. return result0;
  22897. }
  22898. function parse_identifier() {
  22899. var result0, result1, result2;
  22900. var pos0, pos1;
  22901. pos0 = pos;
  22902. pos1 = pos;
  22903. if (/^[a-zA-Z]/.test(input.charAt(pos))) {
  22904. result0 = input.charAt(pos);
  22905. pos++;
  22906. } else {
  22907. result0 = null;
  22908. if (reportFailures === 0) {
  22909. matchFailed("[a-zA-Z]");
  22910. }
  22911. }
  22912. if (result0 !== null) {
  22913. result1 = [];
  22914. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  22915. result2 = input.charAt(pos);
  22916. pos++;
  22917. } else {
  22918. result2 = null;
  22919. if (reportFailures === 0) {
  22920. matchFailed("[a-zA-Z0-9]");
  22921. }
  22922. }
  22923. while (result2 !== null) {
  22924. result1.push(result2);
  22925. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  22926. result2 = input.charAt(pos);
  22927. pos++;
  22928. } else {
  22929. result2 = null;
  22930. if (reportFailures === 0) {
  22931. matchFailed("[a-zA-Z0-9]");
  22932. }
  22933. }
  22934. }
  22935. if (result1 !== null) {
  22936. result0 = [result0, result1];
  22937. } else {
  22938. result0 = null;
  22939. pos = pos1;
  22940. }
  22941. } else {
  22942. result0 = null;
  22943. pos = pos1;
  22944. }
  22945. if (result0 !== null) {
  22946. result0 = (function(offset, first, others) {return first + others.join("")})(pos0, result0[0], result0[1]);
  22947. }
  22948. if (result0 === null) {
  22949. pos = pos0;
  22950. }
  22951. return result0;
  22952. }
  22953. function parse_varIdentifier() {
  22954. var result0, result1, result2;
  22955. var pos0, pos1;
  22956. pos0 = pos;
  22957. pos1 = pos;
  22958. if (/^[a-z]/.test(input.charAt(pos))) {
  22959. result0 = input.charAt(pos);
  22960. pos++;
  22961. } else {
  22962. result0 = null;
  22963. if (reportFailures === 0) {
  22964. matchFailed("[a-z]");
  22965. }
  22966. }
  22967. if (result0 !== null) {
  22968. result1 = [];
  22969. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  22970. result2 = input.charAt(pos);
  22971. pos++;
  22972. } else {
  22973. result2 = null;
  22974. if (reportFailures === 0) {
  22975. matchFailed("[a-zA-Z0-9]");
  22976. }
  22977. }
  22978. while (result2 !== null) {
  22979. result1.push(result2);
  22980. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  22981. result2 = input.charAt(pos);
  22982. pos++;
  22983. } else {
  22984. result2 = null;
  22985. if (reportFailures === 0) {
  22986. matchFailed("[a-zA-Z0-9]");
  22987. }
  22988. }
  22989. }
  22990. if (result1 !== null) {
  22991. result0 = [result0, result1];
  22992. } else {
  22993. result0 = null;
  22994. pos = pos1;
  22995. }
  22996. } else {
  22997. result0 = null;
  22998. pos = pos1;
  22999. }
  23000. if (result0 !== null) {
  23001. result0 = (function(offset, first, others) {return first + others.join("")})(pos0, result0[0], result0[1]);
  23002. }
  23003. if (result0 === null) {
  23004. pos = pos0;
  23005. }
  23006. return result0;
  23007. }
  23008. function parse_keyword() {
  23009. var result0, result1;
  23010. var pos0, pos1;
  23011. pos0 = pos;
  23012. pos1 = pos;
  23013. result0 = parse_identifier();
  23014. if (result0 !== null) {
  23015. if (/^[:]/.test(input.charAt(pos))) {
  23016. result1 = input.charAt(pos);
  23017. pos++;
  23018. } else {
  23019. result1 = null;
  23020. if (reportFailures === 0) {
  23021. matchFailed("[:]");
  23022. }
  23023. }
  23024. if (result1 !== null) {
  23025. result0 = [result0, result1];
  23026. } else {
  23027. result0 = null;
  23028. pos = pos1;
  23029. }
  23030. } else {
  23031. result0 = null;
  23032. pos = pos1;
  23033. }
  23034. if (result0 !== null) {
  23035. result0 = (function(offset, first, last) {return first + last})(pos0, result0[0], result0[1]);
  23036. }
  23037. if (result0 === null) {
  23038. pos = pos0;
  23039. }
  23040. return result0;
  23041. }
  23042. function parse_className() {
  23043. var result0, result1, result2;
  23044. var pos0, pos1;
  23045. pos0 = pos;
  23046. pos1 = pos;
  23047. if (/^[A-Z]/.test(input.charAt(pos))) {
  23048. result0 = input.charAt(pos);
  23049. pos++;
  23050. } else {
  23051. result0 = null;
  23052. if (reportFailures === 0) {
  23053. matchFailed("[A-Z]");
  23054. }
  23055. }
  23056. if (result0 !== null) {
  23057. result1 = [];
  23058. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  23059. result2 = input.charAt(pos);
  23060. pos++;
  23061. } else {
  23062. result2 = null;
  23063. if (reportFailures === 0) {
  23064. matchFailed("[a-zA-Z0-9]");
  23065. }
  23066. }
  23067. while (result2 !== null) {
  23068. result1.push(result2);
  23069. if (/^[a-zA-Z0-9]/.test(input.charAt(pos))) {
  23070. result2 = input.charAt(pos);
  23071. pos++;
  23072. } else {
  23073. result2 = null;
  23074. if (reportFailures === 0) {
  23075. matchFailed("[a-zA-Z0-9]");
  23076. }
  23077. }
  23078. }
  23079. if (result1 !== null) {
  23080. result0 = [result0, result1];
  23081. } else {
  23082. result0 = null;
  23083. pos = pos1;
  23084. }
  23085. } else {
  23086. result0 = null;
  23087. pos = pos1;
  23088. }
  23089. if (result0 !== null) {
  23090. result0 = (function(offset, first, others) {return first + others.join("")})(pos0, result0[0], result0[1]);
  23091. }
  23092. if (result0 === null) {
  23093. pos = pos0;
  23094. }
  23095. return result0;
  23096. }
  23097. function parse_string() {
  23098. var result0, result1, result2;
  23099. var pos0, pos1, pos2;
  23100. pos0 = pos;
  23101. pos1 = pos;
  23102. if (/^[']/.test(input.charAt(pos))) {
  23103. result0 = input.charAt(pos);
  23104. pos++;
  23105. } else {
  23106. result0 = null;
  23107. if (reportFailures === 0) {
  23108. matchFailed("[']");
  23109. }
  23110. }
  23111. if (result0 !== null) {
  23112. result1 = [];
  23113. pos2 = pos;
  23114. if (input.substr(pos, 2) === "''") {
  23115. result2 = "''";
  23116. pos += 2;
  23117. } else {
  23118. result2 = null;
  23119. if (reportFailures === 0) {
  23120. matchFailed("\"''\"");
  23121. }
  23122. }
  23123. if (result2 !== null) {
  23124. result2 = (function(offset) {return "'"})(pos2);
  23125. }
  23126. if (result2 === null) {
  23127. pos = pos2;
  23128. }
  23129. if (result2 === null) {
  23130. if (/^[^']/.test(input.charAt(pos))) {
  23131. result2 = input.charAt(pos);
  23132. pos++;
  23133. } else {
  23134. result2 = null;
  23135. if (reportFailures === 0) {
  23136. matchFailed("[^']");
  23137. }
  23138. }
  23139. }
  23140. while (result2 !== null) {
  23141. result1.push(result2);
  23142. pos2 = pos;
  23143. if (input.substr(pos, 2) === "''") {
  23144. result2 = "''";
  23145. pos += 2;
  23146. } else {
  23147. result2 = null;
  23148. if (reportFailures === 0) {
  23149. matchFailed("\"''\"");
  23150. }
  23151. }
  23152. if (result2 !== null) {
  23153. result2 = (function(offset) {return "'"})(pos2);
  23154. }
  23155. if (result2 === null) {
  23156. pos = pos2;
  23157. }
  23158. if (result2 === null) {
  23159. if (/^[^']/.test(input.charAt(pos))) {
  23160. result2 = input.charAt(pos);
  23161. pos++;
  23162. } else {
  23163. result2 = null;
  23164. if (reportFailures === 0) {
  23165. matchFailed("[^']");
  23166. }
  23167. }
  23168. }
  23169. }
  23170. if (result1 !== null) {
  23171. if (/^[']/.test(input.charAt(pos))) {
  23172. result2 = input.charAt(pos);
  23173. pos++;
  23174. } else {
  23175. result2 = null;
  23176. if (reportFailures === 0) {
  23177. matchFailed("[']");
  23178. }
  23179. }
  23180. if (result2 !== null) {
  23181. result0 = [result0, result1, result2];
  23182. } else {
  23183. result0 = null;
  23184. pos = pos1;
  23185. }
  23186. } else {
  23187. result0 = null;
  23188. pos = pos1;
  23189. }
  23190. } else {
  23191. result0 = null;
  23192. pos = pos1;
  23193. }
  23194. if (result0 !== null) {
  23195. result0 = (function(offset, val) {
  23196. return smalltalk.ValueNode._new()
  23197. ._value_(val.join("").replace(/\"/ig, '"'))
  23198. })(pos0, result0[1]);
  23199. }
  23200. if (result0 === null) {
  23201. pos = pos0;
  23202. }
  23203. return result0;
  23204. }
  23205. function parse_symbol() {
  23206. var result0, result1, result2, result3;
  23207. var pos0, pos1, pos2;
  23208. pos0 = pos;
  23209. pos1 = pos;
  23210. if (input.charCodeAt(pos) === 35) {
  23211. result0 = "#";
  23212. pos++;
  23213. } else {
  23214. result0 = null;
  23215. if (reportFailures === 0) {
  23216. matchFailed("\"#\"");
  23217. }
  23218. }
  23219. if (result0 !== null) {
  23220. result1 = [];
  23221. pos2 = pos;
  23222. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos))) {
  23223. result3 = input.charAt(pos);
  23224. pos++;
  23225. } else {
  23226. result3 = null;
  23227. if (reportFailures === 0) {
  23228. matchFailed("[a-zA-Z0-9:]");
  23229. }
  23230. }
  23231. if (result3 !== null) {
  23232. result2 = [];
  23233. while (result3 !== null) {
  23234. result2.push(result3);
  23235. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos))) {
  23236. result3 = input.charAt(pos);
  23237. pos++;
  23238. } else {
  23239. result3 = null;
  23240. if (reportFailures === 0) {
  23241. matchFailed("[a-zA-Z0-9:]");
  23242. }
  23243. }
  23244. }
  23245. } else {
  23246. result2 = null;
  23247. }
  23248. if (result2 !== null) {
  23249. result2 = (function(offset, digits) {return digits.join("")})(pos2, result2);
  23250. }
  23251. if (result2 === null) {
  23252. pos = pos2;
  23253. }
  23254. if (result2 === null) {
  23255. pos2 = pos;
  23256. result2 = parse_string();
  23257. if (result2 !== null) {
  23258. result2 = (function(offset, node) {return node._value()})(pos2, result2);
  23259. }
  23260. if (result2 === null) {
  23261. pos = pos2;
  23262. }
  23263. }
  23264. while (result2 !== null) {
  23265. result1.push(result2);
  23266. pos2 = pos;
  23267. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos))) {
  23268. result3 = input.charAt(pos);
  23269. pos++;
  23270. } else {
  23271. result3 = null;
  23272. if (reportFailures === 0) {
  23273. matchFailed("[a-zA-Z0-9:]");
  23274. }
  23275. }
  23276. if (result3 !== null) {
  23277. result2 = [];
  23278. while (result3 !== null) {
  23279. result2.push(result3);
  23280. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos))) {
  23281. result3 = input.charAt(pos);
  23282. pos++;
  23283. } else {
  23284. result3 = null;
  23285. if (reportFailures === 0) {
  23286. matchFailed("[a-zA-Z0-9:]");
  23287. }
  23288. }
  23289. }
  23290. } else {
  23291. result2 = null;
  23292. }
  23293. if (result2 !== null) {
  23294. result2 = (function(offset, digits) {return digits.join("")})(pos2, result2);
  23295. }
  23296. if (result2 === null) {
  23297. pos = pos2;
  23298. }
  23299. if (result2 === null) {
  23300. pos2 = pos;
  23301. result2 = parse_string();
  23302. if (result2 !== null) {
  23303. result2 = (function(offset, node) {return node._value()})(pos2, result2);
  23304. }
  23305. if (result2 === null) {
  23306. pos = pos2;
  23307. }
  23308. }
  23309. }
  23310. if (result1 !== null) {
  23311. result0 = [result0, result1];
  23312. } else {
  23313. result0 = null;
  23314. pos = pos1;
  23315. }
  23316. } else {
  23317. result0 = null;
  23318. pos = pos1;
  23319. }
  23320. if (result0 !== null) {
  23321. result0 = (function(offset, val) {
  23322. return smalltalk.ValueNode._new()
  23323. ._value_(smalltalk.symbolFor(val.join("").replace(/\"/ig, '"')))
  23324. })(pos0, result0[1]);
  23325. }
  23326. if (result0 === null) {
  23327. pos = pos0;
  23328. }
  23329. return result0;
  23330. }
  23331. function parse_number() {
  23332. var result0;
  23333. var pos0;
  23334. pos0 = pos;
  23335. result0 = parse_hex();
  23336. if (result0 === null) {
  23337. result0 = parse_float();
  23338. if (result0 === null) {
  23339. result0 = parse_integer();
  23340. }
  23341. }
  23342. if (result0 !== null) {
  23343. result0 = (function(offset, n) {
  23344. return smalltalk.ValueNode._new()
  23345. ._value_(n)
  23346. })(pos0, result0);
  23347. }
  23348. if (result0 === null) {
  23349. pos = pos0;
  23350. }
  23351. return result0;
  23352. }
  23353. function parse_hex() {
  23354. var result0, result1, result2, result3;
  23355. var pos0, pos1;
  23356. pos0 = pos;
  23357. pos1 = pos;
  23358. if (/^[\-]/.test(input.charAt(pos))) {
  23359. result0 = input.charAt(pos);
  23360. pos++;
  23361. } else {
  23362. result0 = null;
  23363. if (reportFailures === 0) {
  23364. matchFailed("[\\-]");
  23365. }
  23366. }
  23367. result0 = result0 !== null ? result0 : "";
  23368. if (result0 !== null) {
  23369. if (input.substr(pos, 3) === "16r") {
  23370. result1 = "16r";
  23371. pos += 3;
  23372. } else {
  23373. result1 = null;
  23374. if (reportFailures === 0) {
  23375. matchFailed("\"16r\"");
  23376. }
  23377. }
  23378. if (result1 !== null) {
  23379. if (/^[0-9a-zA-Z]/.test(input.charAt(pos))) {
  23380. result3 = input.charAt(pos);
  23381. pos++;
  23382. } else {
  23383. result3 = null;
  23384. if (reportFailures === 0) {
  23385. matchFailed("[0-9a-zA-Z]");
  23386. }
  23387. }
  23388. if (result3 !== null) {
  23389. result2 = [];
  23390. while (result3 !== null) {
  23391. result2.push(result3);
  23392. if (/^[0-9a-zA-Z]/.test(input.charAt(pos))) {
  23393. result3 = input.charAt(pos);
  23394. pos++;
  23395. } else {
  23396. result3 = null;
  23397. if (reportFailures === 0) {
  23398. matchFailed("[0-9a-zA-Z]");
  23399. }
  23400. }
  23401. }
  23402. } else {
  23403. result2 = null;
  23404. }
  23405. if (result2 !== null) {
  23406. result0 = [result0, result1, result2];
  23407. } else {
  23408. result0 = null;
  23409. pos = pos1;
  23410. }
  23411. } else {
  23412. result0 = null;
  23413. pos = pos1;
  23414. }
  23415. } else {
  23416. result0 = null;
  23417. pos = pos1;
  23418. }
  23419. if (result0 !== null) {
  23420. result0 = (function(offset, neg, num) {return parseInt((neg + num.join("")), 16)})(pos0, result0[0], result0[2]);
  23421. }
  23422. if (result0 === null) {
  23423. pos = pos0;
  23424. }
  23425. return result0;
  23426. }
  23427. function parse_float() {
  23428. var result0, result1, result2, result3, result4;
  23429. var pos0, pos1;
  23430. pos0 = pos;
  23431. pos1 = pos;
  23432. if (/^[\-]/.test(input.charAt(pos))) {
  23433. result0 = input.charAt(pos);
  23434. pos++;
  23435. } else {
  23436. result0 = null;
  23437. if (reportFailures === 0) {
  23438. matchFailed("[\\-]");
  23439. }
  23440. }
  23441. result0 = result0 !== null ? result0 : "";
  23442. if (result0 !== null) {
  23443. if (/^[0-9]/.test(input.charAt(pos))) {
  23444. result2 = input.charAt(pos);
  23445. pos++;
  23446. } else {
  23447. result2 = null;
  23448. if (reportFailures === 0) {
  23449. matchFailed("[0-9]");
  23450. }
  23451. }
  23452. if (result2 !== null) {
  23453. result1 = [];
  23454. while (result2 !== null) {
  23455. result1.push(result2);
  23456. if (/^[0-9]/.test(input.charAt(pos))) {
  23457. result2 = input.charAt(pos);
  23458. pos++;
  23459. } else {
  23460. result2 = null;
  23461. if (reportFailures === 0) {
  23462. matchFailed("[0-9]");
  23463. }
  23464. }
  23465. }
  23466. } else {
  23467. result1 = null;
  23468. }
  23469. if (result1 !== null) {
  23470. if (input.charCodeAt(pos) === 46) {
  23471. result2 = ".";
  23472. pos++;
  23473. } else {
  23474. result2 = null;
  23475. if (reportFailures === 0) {
  23476. matchFailed("\".\"");
  23477. }
  23478. }
  23479. if (result2 !== null) {
  23480. if (/^[0-9]/.test(input.charAt(pos))) {
  23481. result4 = input.charAt(pos);
  23482. pos++;
  23483. } else {
  23484. result4 = null;
  23485. if (reportFailures === 0) {
  23486. matchFailed("[0-9]");
  23487. }
  23488. }
  23489. if (result4 !== null) {
  23490. result3 = [];
  23491. while (result4 !== null) {
  23492. result3.push(result4);
  23493. if (/^[0-9]/.test(input.charAt(pos))) {
  23494. result4 = input.charAt(pos);
  23495. pos++;
  23496. } else {
  23497. result4 = null;
  23498. if (reportFailures === 0) {
  23499. matchFailed("[0-9]");
  23500. }
  23501. }
  23502. }
  23503. } else {
  23504. result3 = null;
  23505. }
  23506. if (result3 !== null) {
  23507. result0 = [result0, result1, result2, result3];
  23508. } else {
  23509. result0 = null;
  23510. pos = pos1;
  23511. }
  23512. } else {
  23513. result0 = null;
  23514. pos = pos1;
  23515. }
  23516. } else {
  23517. result0 = null;
  23518. pos = pos1;
  23519. }
  23520. } else {
  23521. result0 = null;
  23522. pos = pos1;
  23523. }
  23524. if (result0 !== null) {
  23525. result0 = (function(offset, neg, int, dec) {return parseFloat((neg + int.join("") + "." + dec.join("")), 10)})(pos0, result0[0], result0[1], result0[3]);
  23526. }
  23527. if (result0 === null) {
  23528. pos = pos0;
  23529. }
  23530. return result0;
  23531. }
  23532. function parse_integer() {
  23533. var result0, result1, result2;
  23534. var pos0, pos1;
  23535. pos0 = pos;
  23536. pos1 = pos;
  23537. if (/^[\-]/.test(input.charAt(pos))) {
  23538. result0 = input.charAt(pos);
  23539. pos++;
  23540. } else {
  23541. result0 = null;
  23542. if (reportFailures === 0) {
  23543. matchFailed("[\\-]");
  23544. }
  23545. }
  23546. result0 = result0 !== null ? result0 : "";
  23547. if (result0 !== null) {
  23548. if (/^[0-9]/.test(input.charAt(pos))) {
  23549. result2 = input.charAt(pos);
  23550. pos++;
  23551. } else {
  23552. result2 = null;
  23553. if (reportFailures === 0) {
  23554. matchFailed("[0-9]");
  23555. }
  23556. }
  23557. if (result2 !== null) {
  23558. result1 = [];
  23559. while (result2 !== null) {
  23560. result1.push(result2);
  23561. if (/^[0-9]/.test(input.charAt(pos))) {
  23562. result2 = input.charAt(pos);
  23563. pos++;
  23564. } else {
  23565. result2 = null;
  23566. if (reportFailures === 0) {
  23567. matchFailed("[0-9]");
  23568. }
  23569. }
  23570. }
  23571. } else {
  23572. result1 = null;
  23573. }
  23574. if (result1 !== null) {
  23575. result0 = [result0, result1];
  23576. } else {
  23577. result0 = null;
  23578. pos = pos1;
  23579. }
  23580. } else {
  23581. result0 = null;
  23582. pos = pos1;
  23583. }
  23584. if (result0 !== null) {
  23585. result0 = (function(offset, neg, digits) {return (parseInt(neg+digits.join(""), 10))})(pos0, result0[0], result0[1]);
  23586. }
  23587. if (result0 === null) {
  23588. pos = pos0;
  23589. }
  23590. return result0;
  23591. }
  23592. function parse_literalArray() {
  23593. var result0, result1, result2, result3, result4;
  23594. var pos0, pos1, pos2, pos3;
  23595. pos0 = pos;
  23596. pos1 = pos;
  23597. if (input.substr(pos, 2) === "#(") {
  23598. result0 = "#(";
  23599. pos += 2;
  23600. } else {
  23601. result0 = null;
  23602. if (reportFailures === 0) {
  23603. matchFailed("\"#(\"");
  23604. }
  23605. }
  23606. if (result0 !== null) {
  23607. result1 = parse_ws();
  23608. if (result1 !== null) {
  23609. result2 = [];
  23610. pos2 = pos;
  23611. pos3 = pos;
  23612. result3 = parse_literal();
  23613. if (result3 !== null) {
  23614. result4 = parse_ws();
  23615. if (result4 !== null) {
  23616. result3 = [result3, result4];
  23617. } else {
  23618. result3 = null;
  23619. pos = pos3;
  23620. }
  23621. } else {
  23622. result3 = null;
  23623. pos = pos3;
  23624. }
  23625. if (result3 !== null) {
  23626. result3 = (function(offset, lit) {return lit._value()})(pos2, result3[0]);
  23627. }
  23628. if (result3 === null) {
  23629. pos = pos2;
  23630. }
  23631. while (result3 !== null) {
  23632. result2.push(result3);
  23633. pos2 = pos;
  23634. pos3 = pos;
  23635. result3 = parse_literal();
  23636. if (result3 !== null) {
  23637. result4 = parse_ws();
  23638. if (result4 !== null) {
  23639. result3 = [result3, result4];
  23640. } else {
  23641. result3 = null;
  23642. pos = pos3;
  23643. }
  23644. } else {
  23645. result3 = null;
  23646. pos = pos3;
  23647. }
  23648. if (result3 !== null) {
  23649. result3 = (function(offset, lit) {return lit._value()})(pos2, result3[0]);
  23650. }
  23651. if (result3 === null) {
  23652. pos = pos2;
  23653. }
  23654. }
  23655. if (result2 !== null) {
  23656. result3 = parse_ws();
  23657. if (result3 !== null) {
  23658. if (input.charCodeAt(pos) === 41) {
  23659. result4 = ")";
  23660. pos++;
  23661. } else {
  23662. result4 = null;
  23663. if (reportFailures === 0) {
  23664. matchFailed("\")\"");
  23665. }
  23666. }
  23667. if (result4 !== null) {
  23668. result0 = [result0, result1, result2, result3, result4];
  23669. } else {
  23670. result0 = null;
  23671. pos = pos1;
  23672. }
  23673. } else {
  23674. result0 = null;
  23675. pos = pos1;
  23676. }
  23677. } else {
  23678. result0 = null;
  23679. pos = pos1;
  23680. }
  23681. } else {
  23682. result0 = null;
  23683. pos = pos1;
  23684. }
  23685. } else {
  23686. result0 = null;
  23687. pos = pos1;
  23688. }
  23689. if (result0 !== null) {
  23690. result0 = (function(offset, lits) {
  23691. return smalltalk.ValueNode._new()
  23692. ._value_(lits)
  23693. })(pos0, result0[2]);
  23694. }
  23695. if (result0 === null) {
  23696. pos = pos0;
  23697. }
  23698. return result0;
  23699. }
  23700. function parse_dynamicArray() {
  23701. var result0, result1, result2, result3, result4, result5;
  23702. var pos0, pos1;
  23703. pos0 = pos;
  23704. pos1 = pos;
  23705. if (input.charCodeAt(pos) === 123) {
  23706. result0 = "{";
  23707. pos++;
  23708. } else {
  23709. result0 = null;
  23710. if (reportFailures === 0) {
  23711. matchFailed("\"{\"");
  23712. }
  23713. }
  23714. if (result0 !== null) {
  23715. result1 = parse_ws();
  23716. if (result1 !== null) {
  23717. result2 = parse_expressions();
  23718. result2 = result2 !== null ? result2 : "";
  23719. if (result2 !== null) {
  23720. result3 = parse_ws();
  23721. if (result3 !== null) {
  23722. if (input.charCodeAt(pos) === 46) {
  23723. result4 = ".";
  23724. pos++;
  23725. } else {
  23726. result4 = null;
  23727. if (reportFailures === 0) {
  23728. matchFailed("\".\"");
  23729. }
  23730. }
  23731. result4 = result4 !== null ? result4 : "";
  23732. if (result4 !== null) {
  23733. if (input.charCodeAt(pos) === 125) {
  23734. result5 = "}";
  23735. pos++;
  23736. } else {
  23737. result5 = null;
  23738. if (reportFailures === 0) {
  23739. matchFailed("\"}\"");
  23740. }
  23741. }
  23742. if (result5 !== null) {
  23743. result0 = [result0, result1, result2, result3, result4, result5];
  23744. } else {
  23745. result0 = null;
  23746. pos = pos1;
  23747. }
  23748. } else {
  23749. result0 = null;
  23750. pos = pos1;
  23751. }
  23752. } else {
  23753. result0 = null;
  23754. pos = pos1;
  23755. }
  23756. } else {
  23757. result0 = null;
  23758. pos = pos1;
  23759. }
  23760. } else {
  23761. result0 = null;
  23762. pos = pos1;
  23763. }
  23764. } else {
  23765. result0 = null;
  23766. pos = pos1;
  23767. }
  23768. if (result0 !== null) {
  23769. result0 = (function(offset, expressions) {
  23770. return smalltalk.DynamicArrayNode._new()
  23771. ._nodes_(expressions)
  23772. })(pos0, result0[2]);
  23773. }
  23774. if (result0 === null) {
  23775. pos = pos0;
  23776. }
  23777. return result0;
  23778. }
  23779. function parse_dynamicDictionary() {
  23780. var result0, result1, result2, result3, result4;
  23781. var pos0, pos1;
  23782. pos0 = pos;
  23783. pos1 = pos;
  23784. if (input.substr(pos, 2) === "#{") {
  23785. result0 = "#{";
  23786. pos += 2;
  23787. } else {
  23788. result0 = null;
  23789. if (reportFailures === 0) {
  23790. matchFailed("\"#{\"");
  23791. }
  23792. }
  23793. if (result0 !== null) {
  23794. result1 = parse_ws();
  23795. if (result1 !== null) {
  23796. result2 = parse_expressions();
  23797. result2 = result2 !== null ? result2 : "";
  23798. if (result2 !== null) {
  23799. result3 = parse_ws();
  23800. if (result3 !== null) {
  23801. if (input.charCodeAt(pos) === 125) {
  23802. result4 = "}";
  23803. pos++;
  23804. } else {
  23805. result4 = null;
  23806. if (reportFailures === 0) {
  23807. matchFailed("\"}\"");
  23808. }
  23809. }
  23810. if (result4 !== null) {
  23811. result0 = [result0, result1, result2, result3, result4];
  23812. } else {
  23813. result0 = null;
  23814. pos = pos1;
  23815. }
  23816. } else {
  23817. result0 = null;
  23818. pos = pos1;
  23819. }
  23820. } else {
  23821. result0 = null;
  23822. pos = pos1;
  23823. }
  23824. } else {
  23825. result0 = null;
  23826. pos = pos1;
  23827. }
  23828. } else {
  23829. result0 = null;
  23830. pos = pos1;
  23831. }
  23832. if (result0 !== null) {
  23833. result0 = (function(offset, expressions) {
  23834. return smalltalk.DynamicDictionaryNode._new()
  23835. ._nodes_(expressions)
  23836. })(pos0, result0[2]);
  23837. }
  23838. if (result0 === null) {
  23839. pos = pos0;
  23840. }
  23841. return result0;
  23842. }
  23843. function parse_pseudoVariable() {
  23844. var result0;
  23845. var pos0, pos1;
  23846. pos0 = pos;
  23847. pos1 = pos;
  23848. if (input.substr(pos, 4) === "true") {
  23849. result0 = "true";
  23850. pos += 4;
  23851. } else {
  23852. result0 = null;
  23853. if (reportFailures === 0) {
  23854. matchFailed("\"true\"");
  23855. }
  23856. }
  23857. if (result0 !== null) {
  23858. result0 = (function(offset) {return true})(pos1);
  23859. }
  23860. if (result0 === null) {
  23861. pos = pos1;
  23862. }
  23863. if (result0 === null) {
  23864. pos1 = pos;
  23865. if (input.substr(pos, 5) === "false") {
  23866. result0 = "false";
  23867. pos += 5;
  23868. } else {
  23869. result0 = null;
  23870. if (reportFailures === 0) {
  23871. matchFailed("\"false\"");
  23872. }
  23873. }
  23874. if (result0 !== null) {
  23875. result0 = (function(offset) {return false})(pos1);
  23876. }
  23877. if (result0 === null) {
  23878. pos = pos1;
  23879. }
  23880. if (result0 === null) {
  23881. pos1 = pos;
  23882. if (input.substr(pos, 3) === "nil") {
  23883. result0 = "nil";
  23884. pos += 3;
  23885. } else {
  23886. result0 = null;
  23887. if (reportFailures === 0) {
  23888. matchFailed("\"nil\"");
  23889. }
  23890. }
  23891. if (result0 !== null) {
  23892. result0 = (function(offset) {return nil})(pos1);
  23893. }
  23894. if (result0 === null) {
  23895. pos = pos1;
  23896. }
  23897. }
  23898. }
  23899. if (result0 !== null) {
  23900. result0 = (function(offset, val) {
  23901. return smalltalk.ValueNode._new()
  23902. ._value_(val)
  23903. })(pos0, result0);
  23904. }
  23905. if (result0 === null) {
  23906. pos = pos0;
  23907. }
  23908. return result0;
  23909. }
  23910. function parse_literal() {
  23911. var result0;
  23912. result0 = parse_pseudoVariable();
  23913. if (result0 === null) {
  23914. result0 = parse_number();
  23915. if (result0 === null) {
  23916. result0 = parse_literalArray();
  23917. if (result0 === null) {
  23918. result0 = parse_dynamicDictionary();
  23919. if (result0 === null) {
  23920. result0 = parse_dynamicArray();
  23921. if (result0 === null) {
  23922. result0 = parse_string();
  23923. if (result0 === null) {
  23924. result0 = parse_symbol();
  23925. if (result0 === null) {
  23926. result0 = parse_block();
  23927. }
  23928. }
  23929. }
  23930. }
  23931. }
  23932. }
  23933. }
  23934. return result0;
  23935. }
  23936. function parse_variable() {
  23937. var result0;
  23938. var pos0;
  23939. pos0 = pos;
  23940. result0 = parse_varIdentifier();
  23941. if (result0 !== null) {
  23942. result0 = (function(offset, identifier) {
  23943. return smalltalk.VariableNode._new()
  23944. ._value_(identifier)
  23945. })(pos0, result0);
  23946. }
  23947. if (result0 === null) {
  23948. pos = pos0;
  23949. }
  23950. return result0;
  23951. }
  23952. function parse_classReference() {
  23953. var result0;
  23954. var pos0;
  23955. pos0 = pos;
  23956. result0 = parse_className();
  23957. if (result0 !== null) {
  23958. result0 = (function(offset, className) {
  23959. return smalltalk.ClassReferenceNode._new()
  23960. ._value_(className)
  23961. })(pos0, result0);
  23962. }
  23963. if (result0 === null) {
  23964. pos = pos0;
  23965. }
  23966. return result0;
  23967. }
  23968. function parse_reference() {
  23969. var result0;
  23970. result0 = parse_variable();
  23971. if (result0 === null) {
  23972. result0 = parse_classReference();
  23973. }
  23974. return result0;
  23975. }
  23976. function parse_keywordPair() {
  23977. var result0, result1, result2, result3;
  23978. var pos0, pos1;
  23979. pos0 = pos;
  23980. pos1 = pos;
  23981. result0 = parse_keyword();
  23982. if (result0 !== null) {
  23983. result1 = parse_ws();
  23984. if (result1 !== null) {
  23985. result2 = parse_binarySend();
  23986. if (result2 !== null) {
  23987. result3 = parse_ws();
  23988. if (result3 !== null) {
  23989. result0 = [result0, result1, result2, result3];
  23990. } else {
  23991. result0 = null;
  23992. pos = pos1;
  23993. }
  23994. } else {
  23995. result0 = null;
  23996. pos = pos1;
  23997. }
  23998. } else {
  23999. result0 = null;
  24000. pos = pos1;
  24001. }
  24002. } else {
  24003. result0 = null;
  24004. pos = pos1;
  24005. }
  24006. if (result0 !== null) {
  24007. result0 = (function(offset, key, arg) {return {key:key, arg: arg}})(pos0, result0[0], result0[2]);
  24008. }
  24009. if (result0 === null) {
  24010. pos = pos0;
  24011. }
  24012. return result0;
  24013. }
  24014. function parse_binarySelector() {
  24015. var result0, result1;
  24016. var pos0;
  24017. pos0 = pos;
  24018. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos))) {
  24019. result1 = input.charAt(pos);
  24020. pos++;
  24021. } else {
  24022. result1 = null;
  24023. if (reportFailures === 0) {
  24024. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  24025. }
  24026. }
  24027. if (result1 !== null) {
  24028. result0 = [];
  24029. while (result1 !== null) {
  24030. result0.push(result1);
  24031. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos))) {
  24032. result1 = input.charAt(pos);
  24033. pos++;
  24034. } else {
  24035. result1 = null;
  24036. if (reportFailures === 0) {
  24037. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  24038. }
  24039. }
  24040. }
  24041. } else {
  24042. result0 = null;
  24043. }
  24044. if (result0 !== null) {
  24045. result0 = (function(offset, bin) {return bin.join("").replace(/\\/g, '\\\\')})(pos0, result0);
  24046. }
  24047. if (result0 === null) {
  24048. pos = pos0;
  24049. }
  24050. return result0;
  24051. }
  24052. function parse_keywordPattern() {
  24053. var result0, result1, result2, result3, result4;
  24054. var pos0, pos1, pos2;
  24055. pos0 = pos;
  24056. pos1 = pos;
  24057. pos2 = pos;
  24058. result1 = parse_ws();
  24059. if (result1 !== null) {
  24060. result2 = parse_keyword();
  24061. if (result2 !== null) {
  24062. result3 = parse_ws();
  24063. if (result3 !== null) {
  24064. result4 = parse_identifier();
  24065. if (result4 !== null) {
  24066. result1 = [result1, result2, result3, result4];
  24067. } else {
  24068. result1 = null;
  24069. pos = pos2;
  24070. }
  24071. } else {
  24072. result1 = null;
  24073. pos = pos2;
  24074. }
  24075. } else {
  24076. result1 = null;
  24077. pos = pos2;
  24078. }
  24079. } else {
  24080. result1 = null;
  24081. pos = pos2;
  24082. }
  24083. if (result1 !== null) {
  24084. result1 = (function(offset, key, arg) {return {key:key, arg: arg}})(pos1, result1[1], result1[3]);
  24085. }
  24086. if (result1 === null) {
  24087. pos = pos1;
  24088. }
  24089. if (result1 !== null) {
  24090. result0 = [];
  24091. while (result1 !== null) {
  24092. result0.push(result1);
  24093. pos1 = pos;
  24094. pos2 = pos;
  24095. result1 = parse_ws();
  24096. if (result1 !== null) {
  24097. result2 = parse_keyword();
  24098. if (result2 !== null) {
  24099. result3 = parse_ws();
  24100. if (result3 !== null) {
  24101. result4 = parse_identifier();
  24102. if (result4 !== null) {
  24103. result1 = [result1, result2, result3, result4];
  24104. } else {
  24105. result1 = null;
  24106. pos = pos2;
  24107. }
  24108. } else {
  24109. result1 = null;
  24110. pos = pos2;
  24111. }
  24112. } else {
  24113. result1 = null;
  24114. pos = pos2;
  24115. }
  24116. } else {
  24117. result1 = null;
  24118. pos = pos2;
  24119. }
  24120. if (result1 !== null) {
  24121. result1 = (function(offset, key, arg) {return {key:key, arg: arg}})(pos1, result1[1], result1[3]);
  24122. }
  24123. if (result1 === null) {
  24124. pos = pos1;
  24125. }
  24126. }
  24127. } else {
  24128. result0 = null;
  24129. }
  24130. if (result0 !== null) {
  24131. result0 = (function(offset, pairs) {
  24132. var keywords = [];
  24133. var params = [];
  24134. for(var i=0;i<pairs.length;i++){
  24135. keywords.push(pairs[i].key);
  24136. }
  24137. for(var i=0;i<pairs.length;i++){
  24138. params.push(pairs[i].arg);
  24139. }
  24140. return [keywords.join(""), params]
  24141. })(pos0, result0);
  24142. }
  24143. if (result0 === null) {
  24144. pos = pos0;
  24145. }
  24146. return result0;
  24147. }
  24148. function parse_binaryPattern() {
  24149. var result0, result1, result2, result3;
  24150. var pos0, pos1;
  24151. pos0 = pos;
  24152. pos1 = pos;
  24153. result0 = parse_ws();
  24154. if (result0 !== null) {
  24155. result1 = parse_binarySelector();
  24156. if (result1 !== null) {
  24157. result2 = parse_ws();
  24158. if (result2 !== null) {
  24159. result3 = parse_identifier();
  24160. if (result3 !== null) {
  24161. result0 = [result0, result1, result2, result3];
  24162. } else {
  24163. result0 = null;
  24164. pos = pos1;
  24165. }
  24166. } else {
  24167. result0 = null;
  24168. pos = pos1;
  24169. }
  24170. } else {
  24171. result0 = null;
  24172. pos = pos1;
  24173. }
  24174. } else {
  24175. result0 = null;
  24176. pos = pos1;
  24177. }
  24178. if (result0 !== null) {
  24179. result0 = (function(offset, selector, arg) {return [selector, [arg]]})(pos0, result0[1], result0[3]);
  24180. }
  24181. if (result0 === null) {
  24182. pos = pos0;
  24183. }
  24184. return result0;
  24185. }
  24186. function parse_unaryPattern() {
  24187. var result0, result1;
  24188. var pos0, pos1;
  24189. pos0 = pos;
  24190. pos1 = pos;
  24191. result0 = parse_ws();
  24192. if (result0 !== null) {
  24193. result1 = parse_identifier();
  24194. if (result1 !== null) {
  24195. result0 = [result0, result1];
  24196. } else {
  24197. result0 = null;
  24198. pos = pos1;
  24199. }
  24200. } else {
  24201. result0 = null;
  24202. pos = pos1;
  24203. }
  24204. if (result0 !== null) {
  24205. result0 = (function(offset, selector) {return [selector, []]})(pos0, result0[1]);
  24206. }
  24207. if (result0 === null) {
  24208. pos = pos0;
  24209. }
  24210. return result0;
  24211. }
  24212. function parse_expression() {
  24213. var result0;
  24214. result0 = parse_assignment();
  24215. if (result0 === null) {
  24216. result0 = parse_cascade();
  24217. if (result0 === null) {
  24218. result0 = parse_keywordSend();
  24219. if (result0 === null) {
  24220. result0 = parse_binarySend();
  24221. if (result0 === null) {
  24222. result0 = parse_jsStatement();
  24223. }
  24224. }
  24225. }
  24226. }
  24227. return result0;
  24228. }
  24229. function parse_expressionList() {
  24230. var result0, result1, result2, result3;
  24231. var pos0, pos1;
  24232. pos0 = pos;
  24233. pos1 = pos;
  24234. result0 = parse_ws();
  24235. if (result0 !== null) {
  24236. if (input.charCodeAt(pos) === 46) {
  24237. result1 = ".";
  24238. pos++;
  24239. } else {
  24240. result1 = null;
  24241. if (reportFailures === 0) {
  24242. matchFailed("\".\"");
  24243. }
  24244. }
  24245. if (result1 !== null) {
  24246. result2 = parse_ws();
  24247. if (result2 !== null) {
  24248. result3 = parse_expression();
  24249. if (result3 !== null) {
  24250. result0 = [result0, result1, result2, result3];
  24251. } else {
  24252. result0 = null;
  24253. pos = pos1;
  24254. }
  24255. } else {
  24256. result0 = null;
  24257. pos = pos1;
  24258. }
  24259. } else {
  24260. result0 = null;
  24261. pos = pos1;
  24262. }
  24263. } else {
  24264. result0 = null;
  24265. pos = pos1;
  24266. }
  24267. if (result0 !== null) {
  24268. result0 = (function(offset, expression) {return expression})(pos0, result0[3]);
  24269. }
  24270. if (result0 === null) {
  24271. pos = pos0;
  24272. }
  24273. return result0;
  24274. }
  24275. function parse_expressions() {
  24276. var result0, result1, result2;
  24277. var pos0, pos1;
  24278. pos0 = pos;
  24279. pos1 = pos;
  24280. result0 = parse_expression();
  24281. if (result0 !== null) {
  24282. result1 = [];
  24283. result2 = parse_expressionList();
  24284. while (result2 !== null) {
  24285. result1.push(result2);
  24286. result2 = parse_expressionList();
  24287. }
  24288. if (result1 !== null) {
  24289. result0 = [result0, result1];
  24290. } else {
  24291. result0 = null;
  24292. pos = pos1;
  24293. }
  24294. } else {
  24295. result0 = null;
  24296. pos = pos1;
  24297. }
  24298. if (result0 !== null) {
  24299. result0 = (function(offset, first, others) {
  24300. var result = [first];
  24301. for(var i=0;i<others.length;i++) {
  24302. result.push(others[i]);
  24303. }
  24304. return result;
  24305. })(pos0, result0[0], result0[1]);
  24306. }
  24307. if (result0 === null) {
  24308. pos = pos0;
  24309. }
  24310. return result0;
  24311. }
  24312. function parse_assignment() {
  24313. var result0, result1, result2, result3, result4;
  24314. var pos0, pos1;
  24315. pos0 = pos;
  24316. pos1 = pos;
  24317. result0 = parse_variable();
  24318. if (result0 !== null) {
  24319. result1 = parse_ws();
  24320. if (result1 !== null) {
  24321. if (input.substr(pos, 2) === ":=") {
  24322. result2 = ":=";
  24323. pos += 2;
  24324. } else {
  24325. result2 = null;
  24326. if (reportFailures === 0) {
  24327. matchFailed("\":=\"");
  24328. }
  24329. }
  24330. if (result2 !== null) {
  24331. result3 = parse_ws();
  24332. if (result3 !== null) {
  24333. result4 = parse_expression();
  24334. if (result4 !== null) {
  24335. result0 = [result0, result1, result2, result3, result4];
  24336. } else {
  24337. result0 = null;
  24338. pos = pos1;
  24339. }
  24340. } else {
  24341. result0 = null;
  24342. pos = pos1;
  24343. }
  24344. } else {
  24345. result0 = null;
  24346. pos = pos1;
  24347. }
  24348. } else {
  24349. result0 = null;
  24350. pos = pos1;
  24351. }
  24352. } else {
  24353. result0 = null;
  24354. pos = pos1;
  24355. }
  24356. if (result0 !== null) {
  24357. result0 = (function(offset, variable, expression) {
  24358. return smalltalk.AssignmentNode._new()
  24359. ._left_(variable)
  24360. ._right_(expression)
  24361. })(pos0, result0[0], result0[4]);
  24362. }
  24363. if (result0 === null) {
  24364. pos = pos0;
  24365. }
  24366. return result0;
  24367. }
  24368. function parse_ret() {
  24369. var result0, result1, result2, result3, result4;
  24370. var pos0, pos1;
  24371. pos0 = pos;
  24372. pos1 = pos;
  24373. if (input.charCodeAt(pos) === 94) {
  24374. result0 = "^";
  24375. pos++;
  24376. } else {
  24377. result0 = null;
  24378. if (reportFailures === 0) {
  24379. matchFailed("\"^\"");
  24380. }
  24381. }
  24382. if (result0 !== null) {
  24383. result1 = parse_ws();
  24384. if (result1 !== null) {
  24385. result2 = parse_expression();
  24386. if (result2 !== null) {
  24387. result3 = parse_ws();
  24388. if (result3 !== null) {
  24389. if (input.charCodeAt(pos) === 46) {
  24390. result4 = ".";
  24391. pos++;
  24392. } else {
  24393. result4 = null;
  24394. if (reportFailures === 0) {
  24395. matchFailed("\".\"");
  24396. }
  24397. }
  24398. result4 = result4 !== null ? result4 : "";
  24399. if (result4 !== null) {
  24400. result0 = [result0, result1, result2, result3, result4];
  24401. } else {
  24402. result0 = null;
  24403. pos = pos1;
  24404. }
  24405. } else {
  24406. result0 = null;
  24407. pos = pos1;
  24408. }
  24409. } else {
  24410. result0 = null;
  24411. pos = pos1;
  24412. }
  24413. } else {
  24414. result0 = null;
  24415. pos = pos1;
  24416. }
  24417. } else {
  24418. result0 = null;
  24419. pos = pos1;
  24420. }
  24421. if (result0 !== null) {
  24422. result0 = (function(offset, expression) {
  24423. return smalltalk.ReturnNode._new()
  24424. ._nodes_([expression])
  24425. })(pos0, result0[2]);
  24426. }
  24427. if (result0 === null) {
  24428. pos = pos0;
  24429. }
  24430. return result0;
  24431. }
  24432. function parse_temps() {
  24433. var result0, result1, result2, result3, result4;
  24434. var pos0, pos1, pos2, pos3;
  24435. pos0 = pos;
  24436. pos1 = pos;
  24437. if (input.charCodeAt(pos) === 124) {
  24438. result0 = "|";
  24439. pos++;
  24440. } else {
  24441. result0 = null;
  24442. if (reportFailures === 0) {
  24443. matchFailed("\"|\"");
  24444. }
  24445. }
  24446. if (result0 !== null) {
  24447. result1 = [];
  24448. pos2 = pos;
  24449. pos3 = pos;
  24450. result2 = parse_ws();
  24451. if (result2 !== null) {
  24452. result3 = parse_identifier();
  24453. if (result3 !== null) {
  24454. result4 = parse_ws();
  24455. if (result4 !== null) {
  24456. result2 = [result2, result3, result4];
  24457. } else {
  24458. result2 = null;
  24459. pos = pos3;
  24460. }
  24461. } else {
  24462. result2 = null;
  24463. pos = pos3;
  24464. }
  24465. } else {
  24466. result2 = null;
  24467. pos = pos3;
  24468. }
  24469. if (result2 !== null) {
  24470. result2 = (function(offset, variable) {return variable})(pos2, result2[1]);
  24471. }
  24472. if (result2 === null) {
  24473. pos = pos2;
  24474. }
  24475. while (result2 !== null) {
  24476. result1.push(result2);
  24477. pos2 = pos;
  24478. pos3 = pos;
  24479. result2 = parse_ws();
  24480. if (result2 !== null) {
  24481. result3 = parse_identifier();
  24482. if (result3 !== null) {
  24483. result4 = parse_ws();
  24484. if (result4 !== null) {
  24485. result2 = [result2, result3, result4];
  24486. } else {
  24487. result2 = null;
  24488. pos = pos3;
  24489. }
  24490. } else {
  24491. result2 = null;
  24492. pos = pos3;
  24493. }
  24494. } else {
  24495. result2 = null;
  24496. pos = pos3;
  24497. }
  24498. if (result2 !== null) {
  24499. result2 = (function(offset, variable) {return variable})(pos2, result2[1]);
  24500. }
  24501. if (result2 === null) {
  24502. pos = pos2;
  24503. }
  24504. }
  24505. if (result1 !== null) {
  24506. if (input.charCodeAt(pos) === 124) {
  24507. result2 = "|";
  24508. pos++;
  24509. } else {
  24510. result2 = null;
  24511. if (reportFailures === 0) {
  24512. matchFailed("\"|\"");
  24513. }
  24514. }
  24515. if (result2 !== null) {
  24516. result0 = [result0, result1, result2];
  24517. } else {
  24518. result0 = null;
  24519. pos = pos1;
  24520. }
  24521. } else {
  24522. result0 = null;
  24523. pos = pos1;
  24524. }
  24525. } else {
  24526. result0 = null;
  24527. pos = pos1;
  24528. }
  24529. if (result0 !== null) {
  24530. result0 = (function(offset, vars) {return vars})(pos0, result0[1]);
  24531. }
  24532. if (result0 === null) {
  24533. pos = pos0;
  24534. }
  24535. return result0;
  24536. }
  24537. function parse_blockParamList() {
  24538. var result0, result1, result2, result3, result4;
  24539. var pos0, pos1, pos2, pos3;
  24540. pos0 = pos;
  24541. pos1 = pos;
  24542. pos2 = pos;
  24543. pos3 = pos;
  24544. result1 = parse_ws();
  24545. if (result1 !== null) {
  24546. if (input.charCodeAt(pos) === 58) {
  24547. result2 = ":";
  24548. pos++;
  24549. } else {
  24550. result2 = null;
  24551. if (reportFailures === 0) {
  24552. matchFailed("\":\"");
  24553. }
  24554. }
  24555. if (result2 !== null) {
  24556. result3 = parse_ws();
  24557. if (result3 !== null) {
  24558. result4 = parse_identifier();
  24559. if (result4 !== null) {
  24560. result1 = [result1, result2, result3, result4];
  24561. } else {
  24562. result1 = null;
  24563. pos = pos3;
  24564. }
  24565. } else {
  24566. result1 = null;
  24567. pos = pos3;
  24568. }
  24569. } else {
  24570. result1 = null;
  24571. pos = pos3;
  24572. }
  24573. } else {
  24574. result1 = null;
  24575. pos = pos3;
  24576. }
  24577. if (result1 !== null) {
  24578. result1 = (function(offset, param) {return param})(pos2, result1[3]);
  24579. }
  24580. if (result1 === null) {
  24581. pos = pos2;
  24582. }
  24583. if (result1 !== null) {
  24584. result0 = [];
  24585. while (result1 !== null) {
  24586. result0.push(result1);
  24587. pos2 = pos;
  24588. pos3 = pos;
  24589. result1 = parse_ws();
  24590. if (result1 !== null) {
  24591. if (input.charCodeAt(pos) === 58) {
  24592. result2 = ":";
  24593. pos++;
  24594. } else {
  24595. result2 = null;
  24596. if (reportFailures === 0) {
  24597. matchFailed("\":\"");
  24598. }
  24599. }
  24600. if (result2 !== null) {
  24601. result3 = parse_ws();
  24602. if (result3 !== null) {
  24603. result4 = parse_identifier();
  24604. if (result4 !== null) {
  24605. result1 = [result1, result2, result3, result4];
  24606. } else {
  24607. result1 = null;
  24608. pos = pos3;
  24609. }
  24610. } else {
  24611. result1 = null;
  24612. pos = pos3;
  24613. }
  24614. } else {
  24615. result1 = null;
  24616. pos = pos3;
  24617. }
  24618. } else {
  24619. result1 = null;
  24620. pos = pos3;
  24621. }
  24622. if (result1 !== null) {
  24623. result1 = (function(offset, param) {return param})(pos2, result1[3]);
  24624. }
  24625. if (result1 === null) {
  24626. pos = pos2;
  24627. }
  24628. }
  24629. } else {
  24630. result0 = null;
  24631. }
  24632. if (result0 !== null) {
  24633. result1 = parse_ws();
  24634. if (result1 !== null) {
  24635. if (input.charCodeAt(pos) === 124) {
  24636. result2 = "|";
  24637. pos++;
  24638. } else {
  24639. result2 = null;
  24640. if (reportFailures === 0) {
  24641. matchFailed("\"|\"");
  24642. }
  24643. }
  24644. if (result2 !== null) {
  24645. result0 = [result0, result1, result2];
  24646. } else {
  24647. result0 = null;
  24648. pos = pos1;
  24649. }
  24650. } else {
  24651. result0 = null;
  24652. pos = pos1;
  24653. }
  24654. } else {
  24655. result0 = null;
  24656. pos = pos1;
  24657. }
  24658. if (result0 !== null) {
  24659. result0 = (function(offset, params) {return params})(pos0, result0[0]);
  24660. }
  24661. if (result0 === null) {
  24662. pos = pos0;
  24663. }
  24664. return result0;
  24665. }
  24666. function parse_subexpression() {
  24667. var result0, result1, result2, result3, result4;
  24668. var pos0, pos1;
  24669. pos0 = pos;
  24670. pos1 = pos;
  24671. if (input.charCodeAt(pos) === 40) {
  24672. result0 = "(";
  24673. pos++;
  24674. } else {
  24675. result0 = null;
  24676. if (reportFailures === 0) {
  24677. matchFailed("\"(\"");
  24678. }
  24679. }
  24680. if (result0 !== null) {
  24681. result1 = parse_ws();
  24682. if (result1 !== null) {
  24683. result2 = parse_expression();
  24684. if (result2 !== null) {
  24685. result3 = parse_ws();
  24686. if (result3 !== null) {
  24687. if (input.charCodeAt(pos) === 41) {
  24688. result4 = ")";
  24689. pos++;
  24690. } else {
  24691. result4 = null;
  24692. if (reportFailures === 0) {
  24693. matchFailed("\")\"");
  24694. }
  24695. }
  24696. if (result4 !== null) {
  24697. result0 = [result0, result1, result2, result3, result4];
  24698. } else {
  24699. result0 = null;
  24700. pos = pos1;
  24701. }
  24702. } else {
  24703. result0 = null;
  24704. pos = pos1;
  24705. }
  24706. } else {
  24707. result0 = null;
  24708. pos = pos1;
  24709. }
  24710. } else {
  24711. result0 = null;
  24712. pos = pos1;
  24713. }
  24714. } else {
  24715. result0 = null;
  24716. pos = pos1;
  24717. }
  24718. if (result0 !== null) {
  24719. result0 = (function(offset, expression) {return expression})(pos0, result0[2]);
  24720. }
  24721. if (result0 === null) {
  24722. pos = pos0;
  24723. }
  24724. return result0;
  24725. }
  24726. function parse_statements() {
  24727. var result0, result1, result2, result3, result4, result5, result6;
  24728. var pos0, pos1;
  24729. pos0 = pos;
  24730. pos1 = pos;
  24731. result0 = parse_ret();
  24732. if (result0 !== null) {
  24733. result1 = [];
  24734. if (/^[.]/.test(input.charAt(pos))) {
  24735. result2 = input.charAt(pos);
  24736. pos++;
  24737. } else {
  24738. result2 = null;
  24739. if (reportFailures === 0) {
  24740. matchFailed("[.]");
  24741. }
  24742. }
  24743. while (result2 !== null) {
  24744. result1.push(result2);
  24745. if (/^[.]/.test(input.charAt(pos))) {
  24746. result2 = input.charAt(pos);
  24747. pos++;
  24748. } else {
  24749. result2 = null;
  24750. if (reportFailures === 0) {
  24751. matchFailed("[.]");
  24752. }
  24753. }
  24754. }
  24755. if (result1 !== null) {
  24756. result0 = [result0, result1];
  24757. } else {
  24758. result0 = null;
  24759. pos = pos1;
  24760. }
  24761. } else {
  24762. result0 = null;
  24763. pos = pos1;
  24764. }
  24765. if (result0 !== null) {
  24766. result0 = (function(offset, ret) {return [ret]})(pos0, result0[0]);
  24767. }
  24768. if (result0 === null) {
  24769. pos = pos0;
  24770. }
  24771. if (result0 === null) {
  24772. pos0 = pos;
  24773. pos1 = pos;
  24774. result0 = parse_expressions();
  24775. if (result0 !== null) {
  24776. result1 = parse_ws();
  24777. if (result1 !== null) {
  24778. if (/^[.]/.test(input.charAt(pos))) {
  24779. result3 = input.charAt(pos);
  24780. pos++;
  24781. } else {
  24782. result3 = null;
  24783. if (reportFailures === 0) {
  24784. matchFailed("[.]");
  24785. }
  24786. }
  24787. if (result3 !== null) {
  24788. result2 = [];
  24789. while (result3 !== null) {
  24790. result2.push(result3);
  24791. if (/^[.]/.test(input.charAt(pos))) {
  24792. result3 = input.charAt(pos);
  24793. pos++;
  24794. } else {
  24795. result3 = null;
  24796. if (reportFailures === 0) {
  24797. matchFailed("[.]");
  24798. }
  24799. }
  24800. }
  24801. } else {
  24802. result2 = null;
  24803. }
  24804. if (result2 !== null) {
  24805. result3 = parse_ws();
  24806. if (result3 !== null) {
  24807. result4 = parse_ret();
  24808. if (result4 !== null) {
  24809. result5 = [];
  24810. if (/^[.]/.test(input.charAt(pos))) {
  24811. result6 = input.charAt(pos);
  24812. pos++;
  24813. } else {
  24814. result6 = null;
  24815. if (reportFailures === 0) {
  24816. matchFailed("[.]");
  24817. }
  24818. }
  24819. while (result6 !== null) {
  24820. result5.push(result6);
  24821. if (/^[.]/.test(input.charAt(pos))) {
  24822. result6 = input.charAt(pos);
  24823. pos++;
  24824. } else {
  24825. result6 = null;
  24826. if (reportFailures === 0) {
  24827. matchFailed("[.]");
  24828. }
  24829. }
  24830. }
  24831. if (result5 !== null) {
  24832. result0 = [result0, result1, result2, result3, result4, result5];
  24833. } else {
  24834. result0 = null;
  24835. pos = pos1;
  24836. }
  24837. } else {
  24838. result0 = null;
  24839. pos = pos1;
  24840. }
  24841. } else {
  24842. result0 = null;
  24843. pos = pos1;
  24844. }
  24845. } else {
  24846. result0 = null;
  24847. pos = pos1;
  24848. }
  24849. } else {
  24850. result0 = null;
  24851. pos = pos1;
  24852. }
  24853. } else {
  24854. result0 = null;
  24855. pos = pos1;
  24856. }
  24857. if (result0 !== null) {
  24858. result0 = (function(offset, exps, ret) {
  24859. var expressions = exps;
  24860. expressions.push(ret);
  24861. return expressions
  24862. })(pos0, result0[0], result0[4]);
  24863. }
  24864. if (result0 === null) {
  24865. pos = pos0;
  24866. }
  24867. if (result0 === null) {
  24868. pos0 = pos;
  24869. pos1 = pos;
  24870. result0 = parse_expressions();
  24871. result0 = result0 !== null ? result0 : "";
  24872. if (result0 !== null) {
  24873. result1 = [];
  24874. if (/^[.]/.test(input.charAt(pos))) {
  24875. result2 = input.charAt(pos);
  24876. pos++;
  24877. } else {
  24878. result2 = null;
  24879. if (reportFailures === 0) {
  24880. matchFailed("[.]");
  24881. }
  24882. }
  24883. while (result2 !== null) {
  24884. result1.push(result2);
  24885. if (/^[.]/.test(input.charAt(pos))) {
  24886. result2 = input.charAt(pos);
  24887. pos++;
  24888. } else {
  24889. result2 = null;
  24890. if (reportFailures === 0) {
  24891. matchFailed("[.]");
  24892. }
  24893. }
  24894. }
  24895. if (result1 !== null) {
  24896. result0 = [result0, result1];
  24897. } else {
  24898. result0 = null;
  24899. pos = pos1;
  24900. }
  24901. } else {
  24902. result0 = null;
  24903. pos = pos1;
  24904. }
  24905. if (result0 !== null) {
  24906. result0 = (function(offset, expressions) {
  24907. return expressions || []
  24908. })(pos0, result0[0]);
  24909. }
  24910. if (result0 === null) {
  24911. pos = pos0;
  24912. }
  24913. }
  24914. }
  24915. return result0;
  24916. }
  24917. function parse_sequence() {
  24918. var result0, result1, result2, result3;
  24919. var pos0, pos1;
  24920. pos0 = pos;
  24921. pos1 = pos;
  24922. result0 = parse_temps();
  24923. result0 = result0 !== null ? result0 : "";
  24924. if (result0 !== null) {
  24925. result1 = parse_ws();
  24926. if (result1 !== null) {
  24927. result2 = parse_statements();
  24928. result2 = result2 !== null ? result2 : "";
  24929. if (result2 !== null) {
  24930. result3 = parse_ws();
  24931. if (result3 !== null) {
  24932. result0 = [result0, result1, result2, result3];
  24933. } else {
  24934. result0 = null;
  24935. pos = pos1;
  24936. }
  24937. } else {
  24938. result0 = null;
  24939. pos = pos1;
  24940. }
  24941. } else {
  24942. result0 = null;
  24943. pos = pos1;
  24944. }
  24945. } else {
  24946. result0 = null;
  24947. pos = pos1;
  24948. }
  24949. if (result0 !== null) {
  24950. result0 = (function(offset, temps, statements) {
  24951. return smalltalk.SequenceNode._new()
  24952. ._temps_(temps || [])
  24953. ._nodes_(statements || [])
  24954. })(pos0, result0[0], result0[2]);
  24955. }
  24956. if (result0 === null) {
  24957. pos = pos0;
  24958. }
  24959. return result0;
  24960. }
  24961. function parse_block() {
  24962. var result0, result1, result2, result3, result4, result5, result6;
  24963. var pos0, pos1;
  24964. pos0 = pos;
  24965. pos1 = pos;
  24966. if (input.charCodeAt(pos) === 91) {
  24967. result0 = "[";
  24968. pos++;
  24969. } else {
  24970. result0 = null;
  24971. if (reportFailures === 0) {
  24972. matchFailed("\"[\"");
  24973. }
  24974. }
  24975. if (result0 !== null) {
  24976. result1 = parse_ws();
  24977. if (result1 !== null) {
  24978. result2 = parse_blockParamList();
  24979. result2 = result2 !== null ? result2 : "";
  24980. if (result2 !== null) {
  24981. result3 = parse_ws();
  24982. if (result3 !== null) {
  24983. result4 = parse_sequence();
  24984. result4 = result4 !== null ? result4 : "";
  24985. if (result4 !== null) {
  24986. result5 = parse_ws();
  24987. if (result5 !== null) {
  24988. if (input.charCodeAt(pos) === 93) {
  24989. result6 = "]";
  24990. pos++;
  24991. } else {
  24992. result6 = null;
  24993. if (reportFailures === 0) {
  24994. matchFailed("\"]\"");
  24995. }
  24996. }
  24997. if (result6 !== null) {
  24998. result0 = [result0, result1, result2, result3, result4, result5, result6];
  24999. } else {
  25000. result0 = null;
  25001. pos = pos1;
  25002. }
  25003. } else {
  25004. result0 = null;
  25005. pos = pos1;
  25006. }
  25007. } else {
  25008. result0 = null;
  25009. pos = pos1;
  25010. }
  25011. } else {
  25012. result0 = null;
  25013. pos = pos1;
  25014. }
  25015. } else {
  25016. result0 = null;
  25017. pos = pos1;
  25018. }
  25019. } else {
  25020. result0 = null;
  25021. pos = pos1;
  25022. }
  25023. } else {
  25024. result0 = null;
  25025. pos = pos1;
  25026. }
  25027. if (result0 !== null) {
  25028. result0 = (function(offset, params, sequence) {
  25029. return smalltalk.BlockNode._new()
  25030. ._parameters_(params || [])
  25031. ._nodes_([sequence._asBlockSequenceNode()])
  25032. })(pos0, result0[2], result0[4]);
  25033. }
  25034. if (result0 === null) {
  25035. pos = pos0;
  25036. }
  25037. return result0;
  25038. }
  25039. function parse_operand() {
  25040. var result0;
  25041. result0 = parse_literal();
  25042. if (result0 === null) {
  25043. result0 = parse_reference();
  25044. if (result0 === null) {
  25045. result0 = parse_subexpression();
  25046. }
  25047. }
  25048. return result0;
  25049. }
  25050. function parse_unaryMessage() {
  25051. var result0, result1, result2;
  25052. var pos0, pos1, pos2;
  25053. pos0 = pos;
  25054. pos1 = pos;
  25055. result0 = parse_ws();
  25056. if (result0 !== null) {
  25057. result1 = parse_identifier();
  25058. if (result1 !== null) {
  25059. pos2 = pos;
  25060. reportFailures++;
  25061. if (/^[:]/.test(input.charAt(pos))) {
  25062. result2 = input.charAt(pos);
  25063. pos++;
  25064. } else {
  25065. result2 = null;
  25066. if (reportFailures === 0) {
  25067. matchFailed("[:]");
  25068. }
  25069. }
  25070. reportFailures--;
  25071. if (result2 === null) {
  25072. result2 = "";
  25073. } else {
  25074. result2 = null;
  25075. pos = pos2;
  25076. }
  25077. if (result2 !== null) {
  25078. result0 = [result0, result1, result2];
  25079. } else {
  25080. result0 = null;
  25081. pos = pos1;
  25082. }
  25083. } else {
  25084. result0 = null;
  25085. pos = pos1;
  25086. }
  25087. } else {
  25088. result0 = null;
  25089. pos = pos1;
  25090. }
  25091. if (result0 !== null) {
  25092. result0 = (function(offset, selector) {
  25093. return smalltalk.SendNode._new()
  25094. ._selector_(selector)
  25095. })(pos0, result0[1]);
  25096. }
  25097. if (result0 === null) {
  25098. pos = pos0;
  25099. }
  25100. return result0;
  25101. }
  25102. function parse_unaryTail() {
  25103. var result0, result1, result2, result3;
  25104. var pos0, pos1;
  25105. pos0 = pos;
  25106. pos1 = pos;
  25107. result0 = parse_unaryMessage();
  25108. if (result0 !== null) {
  25109. result1 = parse_ws();
  25110. if (result1 !== null) {
  25111. result2 = parse_unaryTail();
  25112. result2 = result2 !== null ? result2 : "";
  25113. if (result2 !== null) {
  25114. result3 = parse_ws();
  25115. if (result3 !== null) {
  25116. result0 = [result0, result1, result2, result3];
  25117. } else {
  25118. result0 = null;
  25119. pos = pos1;
  25120. }
  25121. } else {
  25122. result0 = null;
  25123. pos = pos1;
  25124. }
  25125. } else {
  25126. result0 = null;
  25127. pos = pos1;
  25128. }
  25129. } else {
  25130. result0 = null;
  25131. pos = pos1;
  25132. }
  25133. if (result0 !== null) {
  25134. result0 = (function(offset, message, tail) {
  25135. if(tail) {
  25136. return tail._valueForReceiver_(message);
  25137. }
  25138. else {
  25139. return message;
  25140. }
  25141. })(pos0, result0[0], result0[2]);
  25142. }
  25143. if (result0 === null) {
  25144. pos = pos0;
  25145. }
  25146. return result0;
  25147. }
  25148. function parse_unarySend() {
  25149. var result0, result1, result2;
  25150. var pos0, pos1;
  25151. pos0 = pos;
  25152. pos1 = pos;
  25153. result0 = parse_operand();
  25154. if (result0 !== null) {
  25155. result1 = parse_ws();
  25156. if (result1 !== null) {
  25157. result2 = parse_unaryTail();
  25158. result2 = result2 !== null ? result2 : "";
  25159. if (result2 !== null) {
  25160. result0 = [result0, result1, result2];
  25161. } else {
  25162. result0 = null;
  25163. pos = pos1;
  25164. }
  25165. } else {
  25166. result0 = null;
  25167. pos = pos1;
  25168. }
  25169. } else {
  25170. result0 = null;
  25171. pos = pos1;
  25172. }
  25173. if (result0 !== null) {
  25174. result0 = (function(offset, receiver, tail) {
  25175. if(tail) {
  25176. return tail._valueForReceiver_(receiver);
  25177. }
  25178. else {
  25179. return receiver;
  25180. }
  25181. })(pos0, result0[0], result0[2]);
  25182. }
  25183. if (result0 === null) {
  25184. pos = pos0;
  25185. }
  25186. return result0;
  25187. }
  25188. function parse_binaryMessage() {
  25189. var result0, result1, result2, result3;
  25190. var pos0, pos1;
  25191. pos0 = pos;
  25192. pos1 = pos;
  25193. result0 = parse_ws();
  25194. if (result0 !== null) {
  25195. result1 = parse_binarySelector();
  25196. if (result1 !== null) {
  25197. result2 = parse_ws();
  25198. if (result2 !== null) {
  25199. result3 = parse_unarySend();
  25200. if (result3 === null) {
  25201. result3 = parse_operand();
  25202. }
  25203. if (result3 !== null) {
  25204. result0 = [result0, result1, result2, result3];
  25205. } else {
  25206. result0 = null;
  25207. pos = pos1;
  25208. }
  25209. } else {
  25210. result0 = null;
  25211. pos = pos1;
  25212. }
  25213. } else {
  25214. result0 = null;
  25215. pos = pos1;
  25216. }
  25217. } else {
  25218. result0 = null;
  25219. pos = pos1;
  25220. }
  25221. if (result0 !== null) {
  25222. result0 = (function(offset, selector, arg) {
  25223. return smalltalk.SendNode._new()
  25224. ._selector_(selector)
  25225. ._arguments_([arg])
  25226. })(pos0, result0[1], result0[3]);
  25227. }
  25228. if (result0 === null) {
  25229. pos = pos0;
  25230. }
  25231. return result0;
  25232. }
  25233. function parse_binaryTail() {
  25234. var result0, result1;
  25235. var pos0, pos1;
  25236. pos0 = pos;
  25237. pos1 = pos;
  25238. result0 = parse_binaryMessage();
  25239. if (result0 !== null) {
  25240. result1 = parse_binaryTail();
  25241. result1 = result1 !== null ? result1 : "";
  25242. if (result1 !== null) {
  25243. result0 = [result0, result1];
  25244. } else {
  25245. result0 = null;
  25246. pos = pos1;
  25247. }
  25248. } else {
  25249. result0 = null;
  25250. pos = pos1;
  25251. }
  25252. if (result0 !== null) {
  25253. result0 = (function(offset, message, tail) {
  25254. if(tail) {
  25255. return tail._valueForReceiver_(message);
  25256. }
  25257. else {
  25258. return message;
  25259. }
  25260. })(pos0, result0[0], result0[1]);
  25261. }
  25262. if (result0 === null) {
  25263. pos = pos0;
  25264. }
  25265. return result0;
  25266. }
  25267. function parse_binarySend() {
  25268. var result0, result1;
  25269. var pos0, pos1;
  25270. pos0 = pos;
  25271. pos1 = pos;
  25272. result0 = parse_unarySend();
  25273. if (result0 !== null) {
  25274. result1 = parse_binaryTail();
  25275. result1 = result1 !== null ? result1 : "";
  25276. if (result1 !== null) {
  25277. result0 = [result0, result1];
  25278. } else {
  25279. result0 = null;
  25280. pos = pos1;
  25281. }
  25282. } else {
  25283. result0 = null;
  25284. pos = pos1;
  25285. }
  25286. if (result0 !== null) {
  25287. result0 = (function(offset, receiver, tail) {
  25288. if(tail) {
  25289. return tail._valueForReceiver_(receiver);
  25290. }
  25291. else {
  25292. return receiver;
  25293. }
  25294. })(pos0, result0[0], result0[1]);
  25295. }
  25296. if (result0 === null) {
  25297. pos = pos0;
  25298. }
  25299. return result0;
  25300. }
  25301. function parse_keywordMessage() {
  25302. var result0, result1, result2, result3;
  25303. var pos0, pos1, pos2, pos3;
  25304. pos0 = pos;
  25305. pos1 = pos;
  25306. result0 = parse_ws();
  25307. if (result0 !== null) {
  25308. pos2 = pos;
  25309. pos3 = pos;
  25310. result2 = parse_keywordPair();
  25311. if (result2 !== null) {
  25312. result3 = parse_ws();
  25313. if (result3 !== null) {
  25314. result2 = [result2, result3];
  25315. } else {
  25316. result2 = null;
  25317. pos = pos3;
  25318. }
  25319. } else {
  25320. result2 = null;
  25321. pos = pos3;
  25322. }
  25323. if (result2 !== null) {
  25324. result2 = (function(offset, pair) {return pair})(pos2, result2[0]);
  25325. }
  25326. if (result2 === null) {
  25327. pos = pos2;
  25328. }
  25329. if (result2 !== null) {
  25330. result1 = [];
  25331. while (result2 !== null) {
  25332. result1.push(result2);
  25333. pos2 = pos;
  25334. pos3 = pos;
  25335. result2 = parse_keywordPair();
  25336. if (result2 !== null) {
  25337. result3 = parse_ws();
  25338. if (result3 !== null) {
  25339. result2 = [result2, result3];
  25340. } else {
  25341. result2 = null;
  25342. pos = pos3;
  25343. }
  25344. } else {
  25345. result2 = null;
  25346. pos = pos3;
  25347. }
  25348. if (result2 !== null) {
  25349. result2 = (function(offset, pair) {return pair})(pos2, result2[0]);
  25350. }
  25351. if (result2 === null) {
  25352. pos = pos2;
  25353. }
  25354. }
  25355. } else {
  25356. result1 = null;
  25357. }
  25358. if (result1 !== null) {
  25359. result0 = [result0, result1];
  25360. } else {
  25361. result0 = null;
  25362. pos = pos1;
  25363. }
  25364. } else {
  25365. result0 = null;
  25366. pos = pos1;
  25367. }
  25368. if (result0 !== null) {
  25369. result0 = (function(offset, pairs) {
  25370. var selector = [];
  25371. var args = [];
  25372. for(var i=0;i<pairs.length;i++) {
  25373. selector.push(pairs[i].key);
  25374. args.push(pairs[i].arg);
  25375. }
  25376. return smalltalk.SendNode._new()
  25377. ._selector_(selector.join(""))
  25378. ._arguments_(args)
  25379. })(pos0, result0[1]);
  25380. }
  25381. if (result0 === null) {
  25382. pos = pos0;
  25383. }
  25384. return result0;
  25385. }
  25386. function parse_keywordSend() {
  25387. var result0, result1;
  25388. var pos0, pos1;
  25389. pos0 = pos;
  25390. pos1 = pos;
  25391. result0 = parse_binarySend();
  25392. if (result0 !== null) {
  25393. result1 = parse_keywordMessage();
  25394. if (result1 !== null) {
  25395. result0 = [result0, result1];
  25396. } else {
  25397. result0 = null;
  25398. pos = pos1;
  25399. }
  25400. } else {
  25401. result0 = null;
  25402. pos = pos1;
  25403. }
  25404. if (result0 !== null) {
  25405. result0 = (function(offset, receiver, tail) {
  25406. return tail._valueForReceiver_(receiver);
  25407. })(pos0, result0[0], result0[1]);
  25408. }
  25409. if (result0 === null) {
  25410. pos = pos0;
  25411. }
  25412. return result0;
  25413. }
  25414. function parse_message() {
  25415. var result0;
  25416. result0 = parse_binaryMessage();
  25417. if (result0 === null) {
  25418. result0 = parse_unaryMessage();
  25419. if (result0 === null) {
  25420. result0 = parse_keywordMessage();
  25421. }
  25422. }
  25423. return result0;
  25424. }
  25425. function parse_cascade() {
  25426. var result0, result1, result2, result3, result4, result5, result6, result7;
  25427. var pos0, pos1, pos2, pos3;
  25428. pos0 = pos;
  25429. pos1 = pos;
  25430. result0 = parse_ws();
  25431. if (result0 !== null) {
  25432. result1 = parse_keywordSend();
  25433. if (result1 === null) {
  25434. result1 = parse_binarySend();
  25435. }
  25436. if (result1 !== null) {
  25437. pos2 = pos;
  25438. pos3 = pos;
  25439. result3 = parse_ws();
  25440. if (result3 !== null) {
  25441. if (input.charCodeAt(pos) === 59) {
  25442. result4 = ";";
  25443. pos++;
  25444. } else {
  25445. result4 = null;
  25446. if (reportFailures === 0) {
  25447. matchFailed("\";\"");
  25448. }
  25449. }
  25450. if (result4 !== null) {
  25451. result5 = parse_ws();
  25452. if (result5 !== null) {
  25453. result6 = parse_message();
  25454. if (result6 !== null) {
  25455. result7 = parse_ws();
  25456. if (result7 !== null) {
  25457. result3 = [result3, result4, result5, result6, result7];
  25458. } else {
  25459. result3 = null;
  25460. pos = pos3;
  25461. }
  25462. } else {
  25463. result3 = null;
  25464. pos = pos3;
  25465. }
  25466. } else {
  25467. result3 = null;
  25468. pos = pos3;
  25469. }
  25470. } else {
  25471. result3 = null;
  25472. pos = pos3;
  25473. }
  25474. } else {
  25475. result3 = null;
  25476. pos = pos3;
  25477. }
  25478. if (result3 !== null) {
  25479. result3 = (function(offset, mess) {return mess})(pos2, result3[3]);
  25480. }
  25481. if (result3 === null) {
  25482. pos = pos2;
  25483. }
  25484. if (result3 !== null) {
  25485. result2 = [];
  25486. while (result3 !== null) {
  25487. result2.push(result3);
  25488. pos2 = pos;
  25489. pos3 = pos;
  25490. result3 = parse_ws();
  25491. if (result3 !== null) {
  25492. if (input.charCodeAt(pos) === 59) {
  25493. result4 = ";";
  25494. pos++;
  25495. } else {
  25496. result4 = null;
  25497. if (reportFailures === 0) {
  25498. matchFailed("\";\"");
  25499. }
  25500. }
  25501. if (result4 !== null) {
  25502. result5 = parse_ws();
  25503. if (result5 !== null) {
  25504. result6 = parse_message();
  25505. if (result6 !== null) {
  25506. result7 = parse_ws();
  25507. if (result7 !== null) {
  25508. result3 = [result3, result4, result5, result6, result7];
  25509. } else {
  25510. result3 = null;
  25511. pos = pos3;
  25512. }
  25513. } else {
  25514. result3 = null;
  25515. pos = pos3;
  25516. }
  25517. } else {
  25518. result3 = null;
  25519. pos = pos3;
  25520. }
  25521. } else {
  25522. result3 = null;
  25523. pos = pos3;
  25524. }
  25525. } else {
  25526. result3 = null;
  25527. pos = pos3;
  25528. }
  25529. if (result3 !== null) {
  25530. result3 = (function(offset, mess) {return mess})(pos2, result3[3]);
  25531. }
  25532. if (result3 === null) {
  25533. pos = pos2;
  25534. }
  25535. }
  25536. } else {
  25537. result2 = null;
  25538. }
  25539. if (result2 !== null) {
  25540. result0 = [result0, result1, result2];
  25541. } else {
  25542. result0 = null;
  25543. pos = pos1;
  25544. }
  25545. } else {
  25546. result0 = null;
  25547. pos = pos1;
  25548. }
  25549. } else {
  25550. result0 = null;
  25551. pos = pos1;
  25552. }
  25553. if (result0 !== null) {
  25554. result0 = (function(offset, send, messages) {
  25555. var cascade = [];
  25556. cascade.push(send);
  25557. for(var i=0;i<messages.length;i++) {
  25558. cascade.push(messages[i]);
  25559. }
  25560. return smalltalk.CascadeNode._new()
  25561. ._receiver_(send._receiver())
  25562. ._nodes_(cascade)
  25563. })(pos0, result0[1], result0[2]);
  25564. }
  25565. if (result0 === null) {
  25566. pos = pos0;
  25567. }
  25568. return result0;
  25569. }
  25570. function parse_jsStatement() {
  25571. var result0, result1, result2;
  25572. var pos0, pos1, pos2;
  25573. pos0 = pos;
  25574. pos1 = pos;
  25575. if (input.charCodeAt(pos) === 60) {
  25576. result0 = "<";
  25577. pos++;
  25578. } else {
  25579. result0 = null;
  25580. if (reportFailures === 0) {
  25581. matchFailed("\"<\"");
  25582. }
  25583. }
  25584. if (result0 !== null) {
  25585. result1 = [];
  25586. pos2 = pos;
  25587. if (input.substr(pos, 2) === ">>") {
  25588. result2 = ">>";
  25589. pos += 2;
  25590. } else {
  25591. result2 = null;
  25592. if (reportFailures === 0) {
  25593. matchFailed("\">>\"");
  25594. }
  25595. }
  25596. if (result2 !== null) {
  25597. result2 = (function(offset) {return ">"})(pos2);
  25598. }
  25599. if (result2 === null) {
  25600. pos = pos2;
  25601. }
  25602. if (result2 === null) {
  25603. if (/^[^>]/.test(input.charAt(pos))) {
  25604. result2 = input.charAt(pos);
  25605. pos++;
  25606. } else {
  25607. result2 = null;
  25608. if (reportFailures === 0) {
  25609. matchFailed("[^>]");
  25610. }
  25611. }
  25612. }
  25613. while (result2 !== null) {
  25614. result1.push(result2);
  25615. pos2 = pos;
  25616. if (input.substr(pos, 2) === ">>") {
  25617. result2 = ">>";
  25618. pos += 2;
  25619. } else {
  25620. result2 = null;
  25621. if (reportFailures === 0) {
  25622. matchFailed("\">>\"");
  25623. }
  25624. }
  25625. if (result2 !== null) {
  25626. result2 = (function(offset) {return ">"})(pos2);
  25627. }
  25628. if (result2 === null) {
  25629. pos = pos2;
  25630. }
  25631. if (result2 === null) {
  25632. if (/^[^>]/.test(input.charAt(pos))) {
  25633. result2 = input.charAt(pos);
  25634. pos++;
  25635. } else {
  25636. result2 = null;
  25637. if (reportFailures === 0) {
  25638. matchFailed("[^>]");
  25639. }
  25640. }
  25641. }
  25642. }
  25643. if (result1 !== null) {
  25644. if (input.charCodeAt(pos) === 62) {
  25645. result2 = ">";
  25646. pos++;
  25647. } else {
  25648. result2 = null;
  25649. if (reportFailures === 0) {
  25650. matchFailed("\">\"");
  25651. }
  25652. }
  25653. if (result2 !== null) {
  25654. result0 = [result0, result1, result2];
  25655. } else {
  25656. result0 = null;
  25657. pos = pos1;
  25658. }
  25659. } else {
  25660. result0 = null;
  25661. pos = pos1;
  25662. }
  25663. } else {
  25664. result0 = null;
  25665. pos = pos1;
  25666. }
  25667. if (result0 !== null) {
  25668. result0 = (function(offset, val) {
  25669. return smalltalk.JSStatementNode._new()
  25670. ._source_(val.join(""))
  25671. })(pos0, result0[1]);
  25672. }
  25673. if (result0 === null) {
  25674. pos = pos0;
  25675. }
  25676. return result0;
  25677. }
  25678. function parse_method() {
  25679. var result0, result1, result2, result3, result4;
  25680. var pos0, pos1;
  25681. pos0 = pos;
  25682. pos1 = pos;
  25683. result0 = parse_ws();
  25684. if (result0 !== null) {
  25685. result1 = parse_keywordPattern();
  25686. if (result1 === null) {
  25687. result1 = parse_binaryPattern();
  25688. if (result1 === null) {
  25689. result1 = parse_unaryPattern();
  25690. }
  25691. }
  25692. if (result1 !== null) {
  25693. result2 = parse_ws();
  25694. if (result2 !== null) {
  25695. result3 = parse_sequence();
  25696. result3 = result3 !== null ? result3 : "";
  25697. if (result3 !== null) {
  25698. result4 = parse_ws();
  25699. if (result4 !== null) {
  25700. result0 = [result0, result1, result2, result3, result4];
  25701. } else {
  25702. result0 = null;
  25703. pos = pos1;
  25704. }
  25705. } else {
  25706. result0 = null;
  25707. pos = pos1;
  25708. }
  25709. } else {
  25710. result0 = null;
  25711. pos = pos1;
  25712. }
  25713. } else {
  25714. result0 = null;
  25715. pos = pos1;
  25716. }
  25717. } else {
  25718. result0 = null;
  25719. pos = pos1;
  25720. }
  25721. if (result0 !== null) {
  25722. result0 = (function(offset, pattern, sequence) {
  25723. return smalltalk.MethodNode._new()
  25724. ._selector_(pattern[0])
  25725. ._arguments_(pattern[1])
  25726. ._nodes_([sequence])
  25727. })(pos0, result0[1], result0[3]);
  25728. }
  25729. if (result0 === null) {
  25730. pos = pos0;
  25731. }
  25732. return result0;
  25733. }
  25734. function cleanupExpected(expected) {
  25735. expected.sort();
  25736. var lastExpected = null;
  25737. var cleanExpected = [];
  25738. for (var i = 0; i < expected.length; i++) {
  25739. if (expected[i] !== lastExpected) {
  25740. cleanExpected.push(expected[i]);
  25741. lastExpected = expected[i];
  25742. }
  25743. }
  25744. return cleanExpected;
  25745. }
  25746. function computeErrorPosition() {
  25747. /*
  25748. * The first idea was to use |String.split| to break the input up to the
  25749. * error position along newlines and derive the line and column from
  25750. * there. However IE's |split| implementation is so broken that it was
  25751. * enough to prevent it.
  25752. */
  25753. var line = 1;
  25754. var column = 1;
  25755. var seenCR = false;
  25756. for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) {
  25757. var ch = input.charAt(i);
  25758. if (ch === "\n") {
  25759. if (!seenCR) { line++; }
  25760. column = 1;
  25761. seenCR = false;
  25762. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  25763. line++;
  25764. column = 1;
  25765. seenCR = true;
  25766. } else {
  25767. column++;
  25768. seenCR = false;
  25769. }
  25770. }
  25771. return { line: line, column: column };
  25772. }
  25773. var result = parseFunctions[startRule]();
  25774. /*
  25775. * The parser is now in one of the following three states:
  25776. *
  25777. * 1. The parser successfully parsed the whole input.
  25778. *
  25779. * - |result !== null|
  25780. * - |pos === input.length|
  25781. * - |rightmostFailuresExpected| may or may not contain something
  25782. *
  25783. * 2. The parser successfully parsed only a part of the input.
  25784. *
  25785. * - |result !== null|
  25786. * - |pos < input.length|
  25787. * - |rightmostFailuresExpected| may or may not contain something
  25788. *
  25789. * 3. The parser did not successfully parse any part of the input.
  25790. *
  25791. * - |result === null|
  25792. * - |pos === 0|
  25793. * - |rightmostFailuresExpected| contains at least one failure
  25794. *
  25795. * All code following this comment (including called functions) must
  25796. * handle these states.
  25797. */
  25798. if (result === null || pos !== input.length) {
  25799. var offset = Math.max(pos, rightmostFailuresPos);
  25800. var found = offset < input.length ? input.charAt(offset) : null;
  25801. var errorPosition = computeErrorPosition();
  25802. throw new this.SyntaxError(
  25803. cleanupExpected(rightmostFailuresExpected),
  25804. found,
  25805. offset,
  25806. errorPosition.line,
  25807. errorPosition.column
  25808. );
  25809. }
  25810. return result;
  25811. },
  25812. /* Returns the parser source code. */
  25813. toSource: function() { return this._source; }
  25814. };
  25815. /* Thrown when a parser encounters a syntax error. */
  25816. result.SyntaxError = function(expected, found, offset, line, column) {
  25817. function buildMessage(expected, found) {
  25818. var expectedHumanized, foundHumanized;
  25819. switch (expected.length) {
  25820. case 0:
  25821. expectedHumanized = "end of input";
  25822. break;
  25823. case 1:
  25824. expectedHumanized = expected[0];
  25825. break;
  25826. default:
  25827. expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
  25828. + " or "
  25829. + expected[expected.length - 1];
  25830. }
  25831. foundHumanized = found ? quote(found) : "end of input";
  25832. return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
  25833. }
  25834. this.name = "SyntaxError";
  25835. this.expected = expected;
  25836. this.found = found;
  25837. this.message = buildMessage(expected, found);
  25838. this.offset = offset;
  25839. this.line = line;
  25840. this.column = column;
  25841. };
  25842. result.SyntaxError.prototype = Error.prototype;
  25843. return result;
  25844. })();
  25845. smalltalk.addPackage('REPL', {});
  25846. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util'], 'REPL');
  25847. smalltalk.addMethod(
  25848. "_close",
  25849. smalltalk.method({
  25850. selector: "close",
  25851. category: 'actions',
  25852. fn: function (){
  25853. var self=this;
  25854. smalltalk.send(smalltalk.send(process,"_stdin",[]),"_destroy",[]);
  25855. return self},
  25856. args: [],
  25857. source: "close\x0a\x09process stdin destroy",
  25858. messageSends: ["destroy", "stdin"],
  25859. referencedClasses: []
  25860. }),
  25861. smalltalk.Repl);
  25862. smalltalk.addMethod(
  25863. "_createInterface",
  25864. smalltalk.method({
  25865. selector: "createInterface",
  25866. category: 'actions',
  25867. fn: function (){
  25868. var self=this;
  25869. self["@interface"]=smalltalk.send(self["@readline"],"_createInterface_stdout_",[smalltalk.send(process,"_stdin",[]),smalltalk.send(process,"_stdout",[])]);
  25870. smalltalk.send(self["@interface"],"_on_do_",["line",(function(buffer){
  25871. return smalltalk.send(self,"_eval_",[buffer]);
  25872. })]);
  25873. smalltalk.send(self["@interface"],"_on_do_",["close",(function(){
  25874. return smalltalk.send(self,"_close",[]);
  25875. })]);
  25876. smalltalk.send(self,"_setPrompt",[]);
  25877. smalltalk.send(self["@interface"],"_prompt",[]);
  25878. return self},
  25879. args: [],
  25880. 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",
  25881. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "eval:", "close", "setPrompt", "prompt"],
  25882. referencedClasses: []
  25883. }),
  25884. smalltalk.Repl);
  25885. smalltalk.addMethod(
  25886. "_eval_",
  25887. smalltalk.method({
  25888. selector: "eval:",
  25889. category: 'actions',
  25890. fn: function (buffer){
  25891. var self=this;
  25892. var $1,$2;
  25893. var result;
  25894. $1=smalltalk.send(buffer,"_isEmpty",[]);
  25895. if(! smalltalk.assert($1)){
  25896. smalltalk.send(self,"_try_catch_",[(function(){
  25897. result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_evaluateExpression_",[buffer]);
  25898. result;
  25899. return smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[result]);
  25900. }),(function(e){
  25901. $2=smalltalk.send(e,"_isSmalltalkError",[]);
  25902. if(smalltalk.assert($2)){
  25903. return smalltalk.send(smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_new",[]),"_handleError_",[e]);
  25904. } else {
  25905. return smalltalk.send(smalltalk.send(process,"_stdout",[]),"_write_",[smalltalk.send(e,"_jsStack",[])]);
  25906. };
  25907. })]);
  25908. };
  25909. smalltalk.send(self["@interface"],"_prompt",[]);
  25910. return self},
  25911. args: ["buffer"],
  25912. 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",
  25913. messageSends: ["ifFalse:", "try:catch:", "evaluateExpression:", "new", "show:", "ifTrue:ifFalse:", "handleError:", "write:", "jsStack", "stdout", "isSmalltalkError", "isEmpty", "prompt"],
  25914. referencedClasses: ["Compiler", "Transcript", "ErrorHandler"]
  25915. }),
  25916. smalltalk.Repl);
  25917. smalltalk.addMethod(
  25918. "_initialize",
  25919. smalltalk.method({
  25920. selector: "initialize",
  25921. category: 'initialization',
  25922. fn: function (){
  25923. var self=this;
  25924. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  25925. self["@readline"]=smalltalk.send(require,"_value_",["readline"]);
  25926. self["@util"]=smalltalk.send(require,"_value_",["util"]);
  25927. return self},
  25928. args: [],
  25929. source: "initialize\x0a\x09super initialize.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'",
  25930. messageSends: ["initialize", "value:"],
  25931. referencedClasses: []
  25932. }),
  25933. smalltalk.Repl);
  25934. smalltalk.addMethod(
  25935. "_prompt",
  25936. smalltalk.method({
  25937. selector: "prompt",
  25938. category: 'accessing',
  25939. fn: function (){
  25940. var self=this;
  25941. return "amber >> ";
  25942. },
  25943. args: [],
  25944. source: "prompt\x0a\x09^'amber >> '",
  25945. messageSends: [],
  25946. referencedClasses: []
  25947. }),
  25948. smalltalk.Repl);
  25949. smalltalk.addMethod(
  25950. "_setPrompt",
  25951. smalltalk.method({
  25952. selector: "setPrompt",
  25953. category: 'actions',
  25954. fn: function (){
  25955. var self=this;
  25956. smalltalk.send(self["@interface"],"_setPrompt_",[smalltalk.send(self,"_prompt",[])]);
  25957. return self},
  25958. args: [],
  25959. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  25960. messageSends: ["setPrompt:", "prompt"],
  25961. referencedClasses: []
  25962. }),
  25963. smalltalk.Repl);
  25964. smalltalk.addMethod(
  25965. "_main",
  25966. smalltalk.method({
  25967. selector: "main",
  25968. category: 'not yet classified',
  25969. fn: function (){
  25970. var self=this;
  25971. smalltalk.send(smalltalk.send(self,"_new",[]),"_createInterface",[]);
  25972. return self},
  25973. args: [],
  25974. source: "main\x0a\x09self new createInterface",
  25975. messageSends: ["createInterface", "new"],
  25976. referencedClasses: []
  25977. }),
  25978. smalltalk.Repl.klass);
  25979. smalltalk.init(smalltalk.Object); //metaclasses are in through Class
  25980. smalltalk.classes()._do_(function(each) {
  25981. each._initialize()});
  25982. /* Similar to jQuery(document).ready() */
  25983. if(this.smalltalkReady) {
  25984. this.smalltalkReady();
  25985. }
  25986. smalltalk.Repl._main()