amber-cli.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889
  1. #!/usr/bin/env node
  2. var define = (function amdefine(module, requireFn) {
  3. 'use strict';
  4. var defineCache = {},
  5. loaderCache = {},
  6. alreadyCalled = false,
  7. path = require('path'),
  8. makeRequire, stringRequire;
  9. /**
  10. * Trims the . and .. from an array of path segments.
  11. * It will keep a leading path segment if a .. will become
  12. * the first path segment, to help with module name lookups,
  13. * which act like paths, but can be remapped. But the end result,
  14. * all paths that use this function should look normalized.
  15. * NOTE: this method MODIFIES the input array.
  16. * @param {Array} ary the array of path segments.
  17. */
  18. function trimDots(ary) {
  19. var i, part;
  20. for (i = 0; ary[i]; i+= 1) {
  21. part = ary[i];
  22. if (part === '.') {
  23. ary.splice(i, 1);
  24. i -= 1;
  25. } else if (part === '..') {
  26. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  27. //End of the line. Keep at least one non-dot
  28. //path segment at the front so it can be mapped
  29. //correctly to disk. Otherwise, there is likely
  30. //no path mapping for a path starting with '..'.
  31. //This can still fail, but catches the most reasonable
  32. //uses of ..
  33. break;
  34. } else if (i > 0) {
  35. ary.splice(i - 1, 2);
  36. i -= 2;
  37. }
  38. }
  39. }
  40. }
  41. function normalize(name, baseName) {
  42. var baseParts;
  43. //Adjust any relative paths.
  44. if (name && name.charAt(0) === '.') {
  45. //If have a base name, try to normalize against it,
  46. //otherwise, assume it is a top-level require that will
  47. //be relative to baseUrl in the end.
  48. if (baseName) {
  49. baseParts = baseName.split('/');
  50. baseParts = baseParts.slice(0, baseParts.length - 1);
  51. baseParts = baseParts.concat(name.split('/'));
  52. trimDots(baseParts);
  53. name = baseParts.join('/');
  54. }
  55. }
  56. return name;
  57. }
  58. /**
  59. * Create the normalize() function passed to a loader plugin's
  60. * normalize method.
  61. */
  62. function makeNormalize(relName) {
  63. return function (name) {
  64. return normalize(name, relName);
  65. };
  66. }
  67. function makeLoad(id) {
  68. function load(value) {
  69. loaderCache[id] = value;
  70. }
  71. load.fromText = function (id, text) {
  72. //This one is difficult because the text can/probably uses
  73. //define, and any relative paths and requires should be relative
  74. //to that id was it would be found on disk. But this would require
  75. //bootstrapping a module/require fairly deeply from node core.
  76. //Not sure how best to go about that yet.
  77. throw new Error('amdefine does not implement load.fromText');
  78. };
  79. return load;
  80. }
  81. makeRequire = function (systemRequire, exports, module, relId) {
  82. function amdRequire(deps, callback) {
  83. if (typeof deps === 'string') {
  84. //Synchronous, single module require('')
  85. return stringRequire(systemRequire, exports, module, deps, relId);
  86. } else {
  87. //Array of dependencies with a callback.
  88. //Convert the dependencies to modules.
  89. deps = deps.map(function (depName) {
  90. return stringRequire(systemRequire, exports, module, depName, relId);
  91. });
  92. //Wait for next tick to call back the require call.
  93. process.nextTick(function () {
  94. callback.apply(null, deps);
  95. });
  96. }
  97. }
  98. amdRequire.toUrl = function (filePath) {
  99. if (filePath.indexOf('.') === 0) {
  100. return normalize(filePath, path.dirname(module.filename));
  101. } else {
  102. return filePath;
  103. }
  104. };
  105. return amdRequire;
  106. };
  107. //Favor explicit value, passed in if the module wants to support Node 0.4.
  108. requireFn = requireFn || function req() {
  109. return module.require.apply(module, arguments);
  110. };
  111. function runFactory(id, deps, factory) {
  112. var r, e, m, result;
  113. if (id) {
  114. e = loaderCache[id] = {};
  115. m = {
  116. id: id,
  117. uri: __filename,
  118. exports: e
  119. };
  120. r = makeRequire(requireFn, e, m, id);
  121. } else {
  122. //Only support one define call per file
  123. if (alreadyCalled) {
  124. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  125. }
  126. alreadyCalled = true;
  127. //Use the real variables from node
  128. //Use module.exports for exports, since
  129. //the exports in here is amdefine exports.
  130. e = module.exports;
  131. m = module;
  132. r = makeRequire(requireFn, e, m, module.id);
  133. }
  134. //If there are dependencies, they are strings, so need
  135. //to convert them to dependency values.
  136. if (deps) {
  137. deps = deps.map(function (depName) {
  138. return r(depName);
  139. });
  140. }
  141. //Call the factory with the right dependencies.
  142. if (typeof factory === 'function') {
  143. result = factory.apply(m.exports, deps);
  144. } else {
  145. result = factory;
  146. }
  147. if (result !== undefined) {
  148. m.exports = result;
  149. if (id) {
  150. loaderCache[id] = m.exports;
  151. }
  152. }
  153. }
  154. stringRequire = function (systemRequire, exports, module, id, relId) {
  155. //Split the ID by a ! so that
  156. var index = id.indexOf('!'),
  157. originalId = id,
  158. prefix, plugin;
  159. if (index === -1) {
  160. id = normalize(id, relId);
  161. //Straight module lookup. If it is one of the special dependencies,
  162. //deal with it, otherwise, delegate to node.
  163. if (id === 'require') {
  164. return makeRequire(systemRequire, exports, module, relId);
  165. } else if (id === 'exports') {
  166. return exports;
  167. } else if (id === 'module') {
  168. return module;
  169. } else if (loaderCache.hasOwnProperty(id)) {
  170. return loaderCache[id];
  171. } else if (defineCache[id]) {
  172. runFactory.apply(null, defineCache[id]);
  173. return loaderCache[id];
  174. } else {
  175. if(systemRequire) {
  176. return systemRequire(originalId);
  177. } else {
  178. throw new Error('No module with ID: ' + id);
  179. }
  180. }
  181. } else {
  182. //There is a plugin in play.
  183. prefix = id.substring(0, index);
  184. id = id.substring(index + 1, id.length);
  185. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  186. if (plugin.normalize) {
  187. id = plugin.normalize(id, makeNormalize(relId));
  188. } else {
  189. //Normalize the ID normally.
  190. id = normalize(id, relId);
  191. }
  192. if (loaderCache[id]) {
  193. return loaderCache[id];
  194. } else {
  195. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  196. return loaderCache[id];
  197. }
  198. }
  199. };
  200. //Create a define function specific to the module asking for amdefine.
  201. function define(id, deps, factory) {
  202. if (Array.isArray(id)) {
  203. factory = deps;
  204. deps = id;
  205. id = undefined;
  206. } else if (typeof id !== 'string') {
  207. factory = id;
  208. id = deps = undefined;
  209. }
  210. if (deps && !Array.isArray(deps)) {
  211. factory = deps;
  212. deps = undefined;
  213. }
  214. if (!deps) {
  215. deps = ['require', 'exports', 'module'];
  216. }
  217. //Set up properties for this module. If an ID, then use
  218. //internal cache. If no ID, then use the external variables
  219. //for this node module.
  220. if (id) {
  221. //Put the module in deep freeze until there is a
  222. //require call for it.
  223. defineCache[id] = [id, deps, factory];
  224. } else {
  225. runFactory(id, deps, factory);
  226. }
  227. }
  228. //define.require, which has access to all the values in the
  229. //cache. Useful for AMD modules that all have IDs in the file,
  230. //but need to finally export a value to node based on one of those
  231. //IDs.
  232. define.require = function (id) {
  233. if (loaderCache[id]) {
  234. return loaderCache[id];
  235. }
  236. if (defineCache[id]) {
  237. runFactory.apply(null, defineCache[id]);
  238. return loaderCache[id];
  239. }
  240. };
  241. define.amd = {};
  242. return define;
  243. })(), requirejs = define.require;
  244. define("amber_vm/browser-compatibility", [], {});
  245. /* ====================================================================
  246. |
  247. | Amber Smalltalk
  248. | http://amber-lang.net
  249. |
  250. ======================================================================
  251. ======================================================================
  252. |
  253. | Copyright (c) 2010-2011
  254. | Nicolas Petton <petton.nicolas@gmail.com>
  255. |
  256. | Amber is released under the MIT license
  257. |
  258. | Permission is hereby granted, free of charge, to any person obtaining
  259. | a copy of this software and associated documentation files (the
  260. | 'Software'), to deal in the Software without restriction, including
  261. | without limitation the rights to use, copy, modify, merge, publish,
  262. | distribute, sublicense, and/or sell copies of the Software, and to
  263. | permit persons to whom the Software is furnished to do so, subject to
  264. | the following conditions:
  265. |
  266. | The above copyright notice and this permission notice shall be
  267. | included in all copies or substantial portions of the Software.
  268. |
  269. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  270. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  271. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  272. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  273. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  274. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  275. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  276. |
  277. ==================================================================== */
  278. define("amber_vm/boot", [ './browser-compatibility' ], function () {
  279. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  280. function Brikz(api, apiKey, initKey) {
  281. var brikz = this, backup = {};
  282. apiKey = apiKey || 'exports';
  283. initKey = initKey || '__init__';
  284. function mixin(src, target, what) {
  285. for (var keys = Object.keys(what||src), l=keys.length, i=0; i<l; ++i) {
  286. var value = src[keys[i]];
  287. if (typeof value !== "undefined") { target[keys[i]] = value; }
  288. }
  289. return target;
  290. }
  291. var d={value: null, enumerable: false, configurable: true, writable: true};
  292. Object.defineProperties(this, { ensure: d, rebuild: d });
  293. this.rebuild = function () {
  294. Object.keys(backup).forEach(function (key) {
  295. mixin({}, api, (backup[key]||0)[apiKey]);
  296. });
  297. var oapi = mixin(api, {}), order = [], chk = {};
  298. brikz.ensure = function(key) {
  299. var b = brikz[key], bak = backup[key];
  300. mixin({}, api, api);
  301. while (typeof b === "function") { b = new b(brikz, api, bak); }
  302. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  303. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  304. return brikz[key] = b;
  305. };
  306. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  307. brikz.ensure = null;
  308. mixin(oapi, mixin({}, api, api));
  309. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  310. order.forEach(function(brik) { brik[initKey] && brik[initKey](); });
  311. backup = mixin(brikz, {});
  312. };
  313. }
  314. /* Brikz end */
  315. function inherits(child, parent) {
  316. child.prototype = Object.create(parent.prototype, {
  317. constructor: { value: child,
  318. enumerable: false, configurable: true, writable: true }
  319. });
  320. return child;
  321. }
  322. /* Smalltalk foundational objects */
  323. function SmalltalkObject() {}
  324. function Smalltalk() {}
  325. inherits(Smalltalk, SmalltalkObject);
  326. var api = new Smalltalk();
  327. var brikz = new Brikz(api);
  328. function RootBrik(brikz, st) {
  329. function SmalltalkNil() {}
  330. inherits(SmalltalkNil, SmalltalkObject);
  331. this.nil = new SmalltalkNil();
  332. this.__init__ = function () {
  333. st.addPackage("Kernel-Objects");
  334. st.addPackage("Kernel-Infrastructure");
  335. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
  336. st.wrapClassName("Smalltalk", "Kernel-Infrastructure", Smalltalk, st.Object, false);
  337. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, st.Object, false);
  338. };
  339. }
  340. function OrganizeBrik(brikz, st) {
  341. brikz.ensure("augments");
  342. brikz.ensure("root");
  343. function SmalltalkOrganizer () {}
  344. function SmalltalkPackageOrganizer () {
  345. this.elements = [];
  346. }
  347. function SmalltalkClassOrganizer () {
  348. this.elements = [];
  349. }
  350. inherits(SmalltalkOrganizer, SmalltalkObject);
  351. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  352. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  353. this.__init__ = function () {
  354. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, st.Object, false);
  355. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, st.Organizer, false);
  356. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, st.Organizer, false);
  357. };
  358. this.setupClassOrganization = function (klass) {
  359. klass.organization = new SmalltalkClassOrganizer();
  360. klass.organization.theClass = klass;
  361. };
  362. this.setupPackageOrganization = function (pkg) {
  363. pkg.organization = new SmalltalkPackageOrganizer();
  364. };
  365. this.addOrganizationElement = function (owner, element) {
  366. owner.organization.elements.addElement(element);
  367. };
  368. this.removeOrganizationElement = function (owner, element) {
  369. owner.organization.elements.removeElement(element);
  370. };
  371. }
  372. function DNUBrik(brikz, st) {
  373. brikz.ensure("selectorConversion");
  374. brikz.ensure("messageSend");
  375. var manip = brikz.ensure("manipulation");
  376. /* Method not implemented handlers */
  377. var methods = [], checker = Object.create(null);
  378. this.selectors = [];
  379. this.get = function (string) {
  380. var index = this.selectors.indexOf(string);
  381. if(index !== -1) {
  382. return methods[index];
  383. }
  384. this.selectors.push(string);
  385. var selector = st.selector(string);
  386. checker[selector] = true;
  387. var method = {jsSelector: selector, fn: createHandler(selector)};
  388. methods.push(method);
  389. return method;
  390. };
  391. this.isSelector = function (selector) {
  392. return checker[selector];
  393. };
  394. /* Dnu handler method */
  395. function createHandler(selector) {
  396. return function() {
  397. var args = Array.prototype.slice.call(arguments);
  398. return brikz.messageSend.messageNotUnderstood(this, selector, args);
  399. };
  400. }
  401. this.installHandlers = function (klass) {
  402. for(var i=0; i<methods.length; i++) {
  403. manip.installMethodIfAbsent(methods[i], klass);
  404. }
  405. };
  406. }
  407. function ClassInitBrik(brikz, st) {
  408. var dnu = brikz.ensure("dnu");
  409. var manip = brikz.ensure("manipulation");
  410. var nil = brikz.ensure("root").nil;
  411. /* Initialize a class in its class hierarchy. Handle both classes and
  412. metaclasses. */
  413. st.init = function(klass) {
  414. st.initClass(klass);
  415. if(klass.klass && !klass.meta) {
  416. st.initClass(klass.klass);
  417. }
  418. };
  419. st.initClass = function(klass) {
  420. if(klass.wrapped) {
  421. copySuperclass(klass);
  422. }
  423. if(klass === st.Object || klass.wrapped) {
  424. dnu.installHandlers(klass);
  425. }
  426. };
  427. function copySuperclass(klass, superclass) {
  428. var inheritedMethods = Object.create(null);
  429. deinstallAllMethods(klass);
  430. for (superclass = superclass || klass.superclass;
  431. superclass && superclass !== nil;
  432. superclass = superclass.superclass) {
  433. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  434. inheritMethodIfAbsent(superclass.methods[keys[i]]);
  435. }
  436. }
  437. manip.reinstallMethods(klass);
  438. function inheritMethodIfAbsent(method) {
  439. var selector = method.selector;
  440. //TODO: prepare klass methods into inheritedMethods to only test once
  441. if(klass.methods[selector] || inheritedMethods[selector]) {
  442. return;
  443. }
  444. manip.installMethod(method, klass);
  445. inheritedMethods[method.selector] = true;
  446. }
  447. }
  448. function deinstallAllMethods(klass) {
  449. var proto = klass.fn.prototype;
  450. for(var keys = Object.getOwnPropertyNames(proto), i=0; i<keys.length; i++) {
  451. var key = keys[i];
  452. if (dnu.isSelector(key)) {
  453. proto[key] = null;
  454. }
  455. }
  456. }
  457. }
  458. function ManipulationBrik(brikz, st) {
  459. this.installMethodIfAbsent = function (handler, klass) {
  460. if(!klass.fn.prototype[handler.jsSelector]) {
  461. installMethod(handler, klass);
  462. }
  463. };
  464. function installMethod (method, klass) {
  465. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  466. value: method.fn,
  467. enumerable: false, configurable: true, writable: true
  468. });
  469. }
  470. this.installMethod = installMethod;
  471. this.reinstallMethods = function (klass) {
  472. var methods = klass.methods;
  473. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  474. installMethod(methods[keys[i]], klass);
  475. }
  476. };
  477. }
  478. function ClassesBrik(brikz, st) {
  479. var org = brikz.ensure("organize");
  480. var nil = brikz.ensure("root").nil;
  481. function SmalltalkPackage() {}
  482. function SmalltalkBehavior() {}
  483. function SmalltalkClass() {}
  484. function SmalltalkMetaclass() {}
  485. inherits(SmalltalkPackage, SmalltalkObject);
  486. inherits(SmalltalkBehavior, SmalltalkObject);
  487. inherits(SmalltalkClass, SmalltalkBehavior);
  488. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  489. SmalltalkMetaclass.prototype.meta = true;
  490. this.__init__ = function () {
  491. st.addPackage("Kernel-Classes");
  492. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, st.Object, false);
  493. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, st.Behavior, false);
  494. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, st.Behavior, false);
  495. st.Object.klass.superclass = st.Class;
  496. addSubclass(st.Object.klass);
  497. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, st.Object, false);
  498. };
  499. /* Smalltalk classes */
  500. var classes = [];
  501. var wrappedClasses = [];
  502. /* We hold all Packages in a separate Object */
  503. st.packages = {};
  504. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  505. function pkg(spec) {
  506. var that = new SmalltalkPackage();
  507. that.pkgName = spec.pkgName;
  508. org.setupPackageOrganization(that);
  509. that.properties = spec.properties || {};
  510. return that;
  511. }
  512. /* Smalltalk class creation. A class is an instance of an automatically
  513. created metaclass object. Newly created classes (not their metaclass)
  514. should be added to the smalltalk object, see smalltalk.addClass().
  515. Superclass linking is *not* handled here, see smalltalk.init() */
  516. function klass(spec) {
  517. spec = spec || {};
  518. var meta = metaclass(spec);
  519. var that = meta.instanceClass;
  520. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  521. that.subclasses = [];
  522. setupClass(that, spec);
  523. that.className = spec.className;
  524. that.wrapped = spec.wrapped || false;
  525. meta.className = spec.className + ' class';
  526. if(spec.superclass) {
  527. that.superclass = spec.superclass;
  528. meta.superclass = spec.superclass.klass;
  529. }
  530. return that;
  531. }
  532. function metaclass(spec) {
  533. spec = spec || {};
  534. var that = new SmalltalkMetaclass();
  535. that.fn = inherits(function () {}, spec.superclass ? spec.superclass.klass.fn : SmalltalkClass);
  536. that.instanceClass = new that.fn();
  537. setupClass(that);
  538. return that;
  539. }
  540. SmalltalkBehavior.prototype.toString = function () {
  541. return 'Smalltalk ' + this.className;
  542. };
  543. function setupClass(klass, spec) {
  544. spec = spec || {};
  545. klass.iVarNames = spec.iVarNames || [];
  546. klass.pkg = spec.pkg;
  547. org.setupClassOrganization(klass);
  548. Object.defineProperty(klass, "methods", {
  549. value: Object.create(null),
  550. enumerable: false, configurable: true, writable: true
  551. });
  552. Object.defineProperty(klass.fn.prototype, "klass", {
  553. value: klass,
  554. enumerable: false, configurable: true, writable: true
  555. });
  556. }
  557. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  558. If pkgName is null or empty we return nil, which is an allowed package for a class.
  559. If package already exists we still update the properties of it. */
  560. st.addPackage = function(pkgName, properties) {
  561. if(!pkgName) {return nil;}
  562. if(!(st.packages[pkgName])) {
  563. st.packages[pkgName] = pkg({
  564. pkgName: pkgName,
  565. properties: properties
  566. });
  567. } else {
  568. if(properties) {
  569. st.packages[pkgName].properties = properties;
  570. }
  571. }
  572. return st.packages[pkgName];
  573. };
  574. SmalltalkPackage.prototype.withDefaultTransport = function () {
  575. var defaultTransportType = st.getDefaultTransportType();
  576. if (this.transport) {
  577. throw new Error("Cannot set default transport; transport already set");
  578. }
  579. if (defaultTransportType) {
  580. this.transport = { type: defaultTransportType };
  581. }
  582. return this;
  583. };
  584. /* Add a class to the smalltalk object, creating a new one if needed.
  585. A Package is lazily created if it does not exist with given name. */
  586. st.addClass = function(className, superclass, iVarNames, pkgName) {
  587. if (superclass == nil) { superclass = null; }
  588. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  589. };
  590. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  591. var pkg = st.packages[pkgName];
  592. if (!pkg) {
  593. throw new Error("Missing package "+pkgName);
  594. }
  595. if(st[className] && st[className].superclass == superclass) {
  596. // st[className].superclass = superclass;
  597. st[className].iVarNames = iVarNames || [];
  598. if (pkg) st[className].pkg = pkg;
  599. if (fn) {
  600. fn.prototype = st[className].fn.prototype;
  601. st[className].fn = fn;
  602. fn.prototype.constructor = fn;
  603. }
  604. } else {
  605. if(st[className]) {
  606. st.removeClass(st[className]);
  607. }
  608. st[className] = klass({
  609. className: className,
  610. superclass: superclass,
  611. pkg: pkg,
  612. iVarNames: iVarNames,
  613. fn: fn,
  614. wrapped: wrapped
  615. });
  616. addSubclass(st[className]);
  617. }
  618. classes.addElement(st[className]);
  619. org.addOrganizationElement(pkg, st[className]);
  620. }
  621. st.removeClass = function(klass) {
  622. org.removeOrganizationElement(klass.pkg, klass);
  623. classes.removeElement(klass);
  624. removeSubclass(klass);
  625. delete st[klass.className];
  626. };
  627. function addSubclass(klass) {
  628. if(klass.superclass) {
  629. klass.superclass.subclasses.addElement(klass);
  630. }
  631. }
  632. function removeSubclass(klass) {
  633. if(klass.superclass) {
  634. klass.superclass.subclasses.removeElement(klass);
  635. }
  636. }
  637. /* Create a new class wrapping a JavaScript constructor, and add it to the
  638. global smalltalk object. Package is lazily created if it does not exist with given name. */
  639. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  640. wrapped = wrapped !== false;
  641. rawAddClass(pkgName, className, superclass, st[className] && st[className].iVarNames, wrapped, fn);
  642. if(wrapped) {
  643. wrappedClasses.addElement(st[className]);
  644. }
  645. };
  646. /* Create an alias for an existing class */
  647. st.alias = function(klass, alias) {
  648. st[alias] = klass;
  649. };
  650. /* Answer all registered Smalltalk classes */
  651. //TODO: remove the function and make smalltalk.classes an array
  652. st.classes = function() {
  653. return classes;
  654. };
  655. st.wrappedClasses = function() {
  656. return wrappedClasses;
  657. };
  658. /* Answer all registered Packages as Array */
  659. // TODO: Remove this hack
  660. st.packages.all = function() {
  661. var packages = [];
  662. for(var i in st.packages) {
  663. if(!st.packages.hasOwnProperty(i) || typeof(st.packages[i]) === "function") continue;
  664. packages.push(st.packages[i]);
  665. }
  666. return packages;
  667. };
  668. // Still used, but could go away now that subclasses are stored
  669. // into classes directly.
  670. st.allSubclasses = function(klass) {
  671. return klass._allSubclasses();
  672. };
  673. }
  674. function MethodsBrik(brikz, st) {
  675. var manip = brikz.ensure("manipulation");
  676. var org = brikz.ensure("organize");
  677. var stInit = brikz.ensure("stInit");
  678. var dnu = brikz.ensure("dnu");
  679. brikz.ensure("selectorConversion");
  680. brikz.ensure("classes");
  681. brikz.ensure("classInit");
  682. function SmalltalkMethod() {}
  683. inherits(SmalltalkMethod, SmalltalkObject);
  684. this.__init__ = function () {
  685. st.addPackage("Kernel-Methods");
  686. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, st.Object, false);
  687. };
  688. /* Smalltalk method object. To add a method to a class,
  689. use smalltalk.addMethod() */
  690. st.method = function(spec) {
  691. var that = new SmalltalkMethod();
  692. that.selector = spec.selector;
  693. that.jsSelector = spec.jsSelector;
  694. that.args = spec.args || {};
  695. that.category = spec.category;
  696. that.source = spec.source;
  697. that.messageSends = spec.messageSends || [];
  698. that.referencedClasses = spec.referencedClasses || [];
  699. that.fn = spec.fn;
  700. return that;
  701. };
  702. function installNewDnuHandler(newHandler) {
  703. manip.installMethodIfAbsent(newHandler, st.Object);
  704. var wrappedClasses = st.wrappedClasses();
  705. for(var i = 0; i < wrappedClasses.length; i++) {
  706. manip.installMethodIfAbsent(newHandler, wrappedClasses[i]);
  707. }
  708. }
  709. /* Add/remove a method to/from a class */
  710. st.addMethod = function (method, klass) {
  711. if (!(method.jsSelector)) {
  712. method.jsSelector = st.selector(method.selector);
  713. }
  714. manip.installMethod(method, klass);
  715. klass.methods[method.selector] = method;
  716. method.methodClass = klass;
  717. // During the bootstrap, #addCompiledMethod is not used.
  718. // Therefore we populate the organizer here too
  719. org.addOrganizationElement(klass, method.category);
  720. propagateMethodChange(klass);
  721. for(var i=0; i<method.messageSends.length; i++) {
  722. var dnuHandler = dnu.get(method.messageSends[i]);
  723. if(stInit.initialized()) {
  724. installNewDnuHandler(dnuHandler);
  725. }
  726. }
  727. };
  728. function propagateMethodChange(klass) {
  729. // If already initialized (else it will be done later anyway),
  730. // re-initialize all subclasses to ensure the method change
  731. // propagation (for wrapped classes, not using the prototype
  732. // chain).
  733. //TODO: optimize, only one method need to be updated, not all of them
  734. if (stInit.initialized()) {
  735. st.allSubclasses(klass).forEach(function (subclass) {
  736. st.initClass(subclass);
  737. });
  738. }
  739. }
  740. st.removeMethod = function(method, klass) {
  741. if (klass !== method.methodClass) {
  742. throw new Error(
  743. "Refusing to remove method "
  744. + method.methodClass.className+">>"+method.selector
  745. + " from different class "
  746. + klass.className);
  747. }
  748. delete klass.fn.prototype[st.selector(method.selector)];
  749. delete klass.methods[method.selector];
  750. st.initClass(klass);
  751. propagateMethodChange(klass);
  752. // Do *not* delete protocols from here.
  753. // This is handled by #removeCompiledMethod
  754. };
  755. /* Answer all method selectors based on dnu handlers */
  756. st.allSelectors = function() {
  757. return dnu.selectors;
  758. };
  759. }
  760. function AugmentsBrik(brikz, st) {
  761. /* Make sure that console is defined */
  762. if(typeof console === "undefined") {
  763. this.console = {
  764. log: function() {},
  765. warn: function() {},
  766. info: function() {},
  767. debug: function() {},
  768. error: function() {}
  769. };
  770. }
  771. /* Array extensions */
  772. Array.prototype.addElement = function(el) {
  773. if(typeof el === 'undefined') { return; }
  774. if(this.indexOf(el) == -1) {
  775. this.push(el);
  776. }
  777. };
  778. Array.prototype.removeElement = function(el) {
  779. var i = this.indexOf(el);
  780. if (i !== -1) { this.splice(i, 1); }
  781. };
  782. }
  783. function SmalltalkInitBrik(brikz, st) {
  784. brikz.ensure("classInit");
  785. brikz.ensure("classes");
  786. var nil = brikz.ensure("root").nil;
  787. var initialized = false;
  788. /* Smalltalk initialization. Called on page load */
  789. st.initialize = function() {
  790. if(initialized) { return; }
  791. st.classes().forEach(function(klass) {
  792. st.init(klass);
  793. });
  794. runnable();
  795. st.classes().forEach(function(klass) {
  796. klass._initialize();
  797. });
  798. initialized = true;
  799. };
  800. this.initialized = function () {
  801. return initialized;
  802. };
  803. this.__init__ = function () {
  804. st.addPackage("Kernel-Methods");
  805. st.wrapClassName("Number", "Kernel-Objects", Number, st.Object);
  806. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, st.Object);
  807. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, st.Object);
  808. st.wrapClassName("Date", "Kernel-Objects", Date, st.Object);
  809. st.addPackage("Kernel-Collections");
  810. st.addClass("Collection", st.Object, null, "Kernel-Collections");
  811. st.addClass("IndexableCollection", st.Collection, null, "Kernel-Collections");
  812. st.addClass("SequenceableCollection", st.IndexableCollection, null, "Kernel-Collections");
  813. st.addClass("CharacterArray", st.SequenceableCollection, null, "Kernel-Collections");
  814. st.wrapClassName("String", "Kernel-Collections", String, st.CharacterArray);
  815. st.wrapClassName("Array", "Kernel-Collections", Array, st.SequenceableCollection);
  816. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, st.Object);
  817. st.addPackage("Kernel-Exceptions");
  818. st.wrapClassName("Error", "Kernel-Exceptions", Error, st.Object);
  819. /* Alias definitions */
  820. st.alias(st.Array, "OrderedCollection");
  821. st.alias(st.Date, "Time");
  822. };
  823. }
  824. function PrimitivesBrik(brikz, st) {
  825. /* Unique ID number generator */
  826. var oid = 0;
  827. st.nextId = function() {
  828. oid += 1;
  829. return oid;
  830. };
  831. /* Converts a JavaScript object to valid Smalltalk Object */
  832. st.readJSObject = function(js) {
  833. var object = js;
  834. var readObject = (js.constructor === Object);
  835. var readArray = (js.constructor === Array);
  836. if(readObject) {
  837. object = st.Dictionary._new();
  838. }
  839. for(var i in js) {
  840. if(readObject) {
  841. object._at_put_(i, st.readJSObject(js[i]));
  842. }
  843. if(readArray) {
  844. object[i] = st.readJSObject(js[i]);
  845. }
  846. }
  847. return object;
  848. };
  849. /* Boolean assertion */
  850. st.assert = function(shouldBeBoolean) {
  851. if (undefined !== shouldBeBoolean && shouldBeBoolean.klass === st.Boolean) {
  852. return shouldBeBoolean == true;
  853. } else {
  854. st.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  855. }
  856. };
  857. /* List of all reserved words in JavaScript. They may not be used as variables
  858. in Smalltalk. */
  859. // list of reserved JavaScript keywords as of
  860. // http://es5.github.com/#x7.6.1.1
  861. // and
  862. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  863. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  864. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  865. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  866. 'try', 'typeof', 'var', 'void', 'while', 'with',
  867. // ES5: future use: http://es5.github.com/#x7.6.1.2
  868. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  869. // ES5: future use in strict mode
  870. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  871. 'public', 'static', 'yield'];
  872. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  873. }
  874. function RuntimeBrik(brikz, st) {
  875. brikz.ensure("selectorConversion");
  876. var nil = brikz.ensure("root").nil;
  877. function SmalltalkMethodContext(home, setup) {
  878. this.homeContext = home;
  879. this.setup = setup || function() {};
  880. this.pc = 0;
  881. }
  882. inherits(SmalltalkMethodContext, SmalltalkObject);
  883. this.__init__ = function () {
  884. st.addPackage("Kernel-Methods");
  885. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, st.Object, false);
  886. // Fallbacks
  887. SmalltalkMethodContext.prototype.locals = {};
  888. SmalltalkMethodContext.prototype.receiver = null;
  889. SmalltalkMethodContext.prototype.selector = null;
  890. SmalltalkMethodContext.prototype.lookupClass = null;
  891. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  892. this.receiver = receiver;
  893. this.selector = selector;
  894. this.locals = locals || {};
  895. this.lookupClass = lookupClass;
  896. };
  897. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  898. this.locals = locals || {};
  899. this.outerContext = ctx;
  900. this.index = index || 0;
  901. };
  902. SmalltalkMethodContext.prototype.init = function() {
  903. var home = this.homeContext;
  904. if(home) {
  905. home.init();
  906. }
  907. this.setup(this);
  908. };
  909. SmalltalkMethodContext.prototype.method = function() {
  910. var method;
  911. var lookup = this.lookupClass || this.receiver.klass;
  912. while(!method && lookup) {
  913. method = lookup.methods[st.convertSelector(this.selector)];
  914. lookup = lookup.superclass;
  915. }
  916. return method;
  917. };
  918. };
  919. /* This is the current call context object. While it is publicly available,
  920. Use smalltalk.getThisContext() instead which will answer a safe copy of
  921. the current context */
  922. st.thisContext = undefined;
  923. st.withContext = function(worker, setup) {
  924. if(st.thisContext) {
  925. st.thisContext.pc++;
  926. return inContext(worker, setup);
  927. } else {
  928. try {
  929. return inContext(worker, setup);
  930. } catch(error) {
  931. handleError(error);
  932. st.thisContext = null;
  933. }
  934. }
  935. };
  936. function inContext(worker, setup) {
  937. var context = pushContext(setup);
  938. var result = worker(context);
  939. popContext(context);
  940. return result;
  941. }
  942. function wrappedError(error) {
  943. var errorWrapper = st.JavaScriptException._on_(error);
  944. try { errorWrapper._signal(); } catch (ex) {}
  945. errorWrapper._context_(st.getThisContext());
  946. return errorWrapper;
  947. }
  948. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  949. (See the Smalltalk class ErrorHandler and its subclasses */
  950. function handleError(error) {
  951. if (!error.smalltalkError) {
  952. error = wrappedError(error);
  953. }
  954. st.ErrorHandler._current()._handleError_(error);
  955. // Throw the exception anyway, as we want to stop
  956. // the execution to avoid infinite loops
  957. // Update: do not throw the exception. It's really annoying.
  958. // throw error;
  959. }
  960. /* Handle thisContext pseudo variable */
  961. st.getThisContext = function() {
  962. if(st.thisContext) {
  963. st.thisContext.init();
  964. return st.thisContext;
  965. } else {
  966. return nil;
  967. }
  968. };
  969. function pushContext(setup) {
  970. return st.thisContext = new SmalltalkMethodContext(st.thisContext, setup);
  971. }
  972. function popContext(context) {
  973. st.thisContext = context.homeContext;
  974. }
  975. }
  976. function MessageSendBrik(brikz, st) {
  977. brikz.ensure("selectorConversion");
  978. var nil = brikz.ensure("root").nil;
  979. /* Handles unhandled errors during message sends */
  980. // simply send the message and handle #dnu:
  981. st.send = function(receiver, selector, args, klass) {
  982. var method;
  983. if(receiver === null) {
  984. receiver = nil;
  985. }
  986. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  987. if(method) {
  988. return method.apply(receiver, args);
  989. } else {
  990. return messageNotUnderstood(receiver, selector, args);
  991. }
  992. };
  993. /* Handles #dnu: *and* JavaScript method calls.
  994. if the receiver has no klass, we consider it a JS object (outside of the
  995. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  996. function messageNotUnderstood(receiver, selector, args) {
  997. /* Handles JS method calls. */
  998. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  999. return callJavaScriptMethod(receiver, selector, args);
  1000. }
  1001. /* Handles not understood messages. Also see the Amber counter-part
  1002. Object>>doesNotUnderstand: */
  1003. return receiver._doesNotUnderstand_(
  1004. st.Message._new()
  1005. ._selector_(st.convertSelector(selector))
  1006. ._arguments_(args)
  1007. );
  1008. }
  1009. /* Call a method of a JS object, or answer a property if it exists.
  1010. Else try wrapping a JSObjectProxy around the receiver.
  1011. If the object property is a function, then call it, except if it starts with
  1012. an uppercase character (we probably want to answer the function itself in this
  1013. case and send it #new from Amber).
  1014. Converts keyword-based selectors by using the first
  1015. keyword only, but keeping all message arguments.
  1016. Example:
  1017. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1018. function callJavaScriptMethod(receiver, selector, args) {
  1019. var jsSelector = selector._asJavaScriptSelector();
  1020. var jsProperty = receiver[jsSelector];
  1021. if(typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  1022. return jsProperty.apply(receiver, args);
  1023. } else if(jsProperty !== undefined) {
  1024. if(args[0]) {
  1025. receiver[jsSelector] = args[0];
  1026. return nil;
  1027. } else {
  1028. return jsProperty;
  1029. }
  1030. }
  1031. return st.send(st.JSObjectProxy._on_(receiver), selector, args);
  1032. }
  1033. if(typeof jQuery !== "undefined") {
  1034. jQuery.allowJavaScriptCalls = true;
  1035. }
  1036. this.messageNotUnderstood = messageNotUnderstood;
  1037. }
  1038. function SelectorConversionBrik(brikz, st) {
  1039. /* Convert a Smalltalk selector into a JS selector */
  1040. st.selector = function(string) {
  1041. var selector = '_' + string;
  1042. selector = selector.replace(/:/g, '_');
  1043. selector = selector.replace(/[\&]/g, '_and');
  1044. selector = selector.replace(/[\|]/g, '_or');
  1045. selector = selector.replace(/[+]/g, '_plus');
  1046. selector = selector.replace(/-/g, '_minus');
  1047. selector = selector.replace(/[*]/g ,'_star');
  1048. selector = selector.replace(/[\/]/g ,'_slash');
  1049. selector = selector.replace(/[\\]/g ,'_backslash');
  1050. selector = selector.replace(/[\~]/g ,'_tild');
  1051. selector = selector.replace(/>/g ,'_gt');
  1052. selector = selector.replace(/</g ,'_lt');
  1053. selector = selector.replace(/=/g ,'_eq');
  1054. selector = selector.replace(/,/g ,'_comma');
  1055. selector = selector.replace(/[@]/g ,'_at');
  1056. return selector;
  1057. };
  1058. /* Convert a string to a valid smalltalk selector.
  1059. if you modify the following functions, also change String>>asSelector
  1060. accordingly */
  1061. st.convertSelector = function(selector) {
  1062. if(selector.match(/__/)) {
  1063. return convertBinarySelector(selector);
  1064. } else {
  1065. return convertKeywordSelector(selector);
  1066. }
  1067. };
  1068. function convertKeywordSelector(selector) {
  1069. return selector.replace(/^_/, '').replace(/_/g, ':');
  1070. }
  1071. function convertBinarySelector(selector) {
  1072. return selector
  1073. .replace(/^_/, '')
  1074. .replace(/_and/g, '&')
  1075. .replace(/_or/g, '|')
  1076. .replace(/_plus/g, '+')
  1077. .replace(/_minus/g, '-')
  1078. .replace(/_star/g, '*')
  1079. .replace(/_slash/g, '/')
  1080. .replace(/_backslash/g, '\\')
  1081. .replace(/_tild/g, '~')
  1082. .replace(/_gt/g, '>')
  1083. .replace(/_lt/g, '<')
  1084. .replace(/_eq/g, '=')
  1085. .replace(/_comma/g, ',')
  1086. .replace(/_at/g, '@');
  1087. }
  1088. }
  1089. /* Adds AMD and requirejs related methods to the smalltalk object */
  1090. function AMDBrik(brikz, st) {
  1091. this.__init__ = function () {
  1092. st.amdRequire = st.amdRequire || null;
  1093. st.defaultTransportType = st.defaultTransportType || "amd";
  1094. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1095. };
  1096. }
  1097. /* Making smalltalk that can load */
  1098. brikz.root = RootBrik;
  1099. brikz.dnu = DNUBrik;
  1100. brikz.organize = OrganizeBrik;
  1101. brikz.selectorConversion = SelectorConversionBrik;
  1102. brikz.classInit = ClassInitBrik;
  1103. brikz.manipulation = ManipulationBrik;
  1104. brikz.classes = ClassesBrik;
  1105. brikz.methods = MethodsBrik;
  1106. brikz.stInit = SmalltalkInitBrik;
  1107. brikz.augments = AugmentsBrik;
  1108. brikz.amdBrik = AMDBrik;
  1109. brikz.rebuild();
  1110. /* Making smalltalk that can run */
  1111. function runnable () {
  1112. brikz.messageSend = MessageSendBrik;
  1113. brikz.runtime = RuntimeBrik;
  1114. brikz.primitives = PrimitivesBrik;
  1115. brikz.rebuild();
  1116. };
  1117. return { smalltalk: api, nil: brikz.root.nil };
  1118. });
  1119. define("amber_vm/smalltalk", ["require", "module", "./boot"], function (require, module, boot) {
  1120. var smalltalk = boot.smalltalk;
  1121. smalltalk.amdRequire = require;
  1122. // var config = module.config && module.config();
  1123. // if (config) {
  1124. // smalltalk.defaultAmdNamespace = config.defaultNamespace;
  1125. // }
  1126. return smalltalk;
  1127. });
  1128. define("amber_vm/nil", ["./boot"], function (boot) {
  1129. return boot.nil;
  1130. });
  1131. /**
  1132. * _st is a function used all over the compiled amber code that
  1133. * takes any value (JavaScript or Smalltalk)
  1134. * and returns a proper Amber Smalltalk receiver.
  1135. *
  1136. * null or undefined -> nil,
  1137. * plain JS object -> wrapped JS object,
  1138. * otherwise unchanged
  1139. */
  1140. define("amber_vm/_st", ["./smalltalk", "./nil"], function (smalltalk, nil) {
  1141. return function (o) {
  1142. if (o == null) { return nil; }
  1143. if (o.klass) { return o; }
  1144. return smalltalk.JSObjectProxy._on_(o);
  1145. };
  1146. });
  1147. define("amber_core/Kernel-Objects", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"], function(smalltalk,nil,_st){
  1148. smalltalk.addPackage('Kernel-Objects');
  1149. smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1150. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
  1151. smalltalk.Object.comment="**I am the root of the Smalltalk class system**. All classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects, such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "->",
  1155. category: 'converting',
  1156. fn: function (anObject){
  1157. var self=this;
  1158. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  1159. return smalltalk.withContext(function($ctx1) {
  1160. var $1;
  1161. $1=_st($Association())._key_value_(self,anObject);
  1162. return $1;
  1163. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},smalltalk.Object)})},
  1164. args: ["anObject"],
  1165. source: "-> anObject\x0a\x09^Association key: self value: anObject",
  1166. messageSends: ["key:value:"],
  1167. referencedClasses: ["Association"]
  1168. }),
  1169. smalltalk.Object);
  1170. smalltalk.addMethod(
  1171. smalltalk.method({
  1172. selector: "=",
  1173. category: 'comparing',
  1174. fn: function (anObject){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. var $1;
  1178. $1=self.__eq_eq(anObject);
  1179. return $1;
  1180. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},smalltalk.Object)})},
  1181. args: ["anObject"],
  1182. source: "= anObject\x0a\x09^self == anObject",
  1183. messageSends: ["=="],
  1184. referencedClasses: []
  1185. }),
  1186. smalltalk.Object);
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "==",
  1190. category: 'comparing',
  1191. fn: function (anObject){
  1192. var self=this;
  1193. return smalltalk.withContext(function($ctx1) {
  1194. var $1;
  1195. $1=_st(self._identityHash()).__eq(_st(anObject)._identityHash());
  1196. return $1;
  1197. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},smalltalk.Object)})},
  1198. args: ["anObject"],
  1199. source: "== anObject\x0a\x09^self identityHash = anObject identityHash",
  1200. messageSends: ["=", "identityHash"],
  1201. referencedClasses: []
  1202. }),
  1203. smalltalk.Object);
  1204. smalltalk.addMethod(
  1205. smalltalk.method({
  1206. selector: "asJSON",
  1207. category: 'converting',
  1208. fn: function (){
  1209. var self=this;
  1210. var variables;
  1211. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1212. return smalltalk.withContext(function($ctx1) {
  1213. var $1;
  1214. variables=_st($HashedCollection())._new();
  1215. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1216. return smalltalk.withContext(function($ctx2) {
  1217. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  1218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1219. $1=variables;
  1220. return $1;
  1221. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},smalltalk.Object)})},
  1222. args: [],
  1223. 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",
  1224. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
  1225. referencedClasses: ["HashedCollection"]
  1226. }),
  1227. smalltalk.Object);
  1228. smalltalk.addMethod(
  1229. smalltalk.method({
  1230. selector: "asJSONString",
  1231. category: 'converting',
  1232. fn: function (){
  1233. var self=this;
  1234. function $JSON(){return smalltalk.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1235. return smalltalk.withContext(function($ctx1) {
  1236. var $1;
  1237. $1=_st($JSON())._stringify_(self._asJSON());
  1238. return $1;
  1239. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},smalltalk.Object)})},
  1240. args: [],
  1241. source: "asJSONString\x0a\x09^JSON stringify: self asJSON",
  1242. messageSends: ["stringify:", "asJSON"],
  1243. referencedClasses: ["JSON"]
  1244. }),
  1245. smalltalk.Object);
  1246. smalltalk.addMethod(
  1247. smalltalk.method({
  1248. selector: "asJavascript",
  1249. category: 'converting',
  1250. fn: function (){
  1251. var self=this;
  1252. return smalltalk.withContext(function($ctx1) {
  1253. var $1;
  1254. $1=self._asString();
  1255. return $1;
  1256. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Object)})},
  1257. args: [],
  1258. source: "asJavascript\x0a\x09^self asString",
  1259. messageSends: ["asString"],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.Object);
  1263. smalltalk.addMethod(
  1264. smalltalk.method({
  1265. selector: "asString",
  1266. category: 'converting',
  1267. fn: function (){
  1268. var self=this;
  1269. return smalltalk.withContext(function($ctx1) {
  1270. var $1;
  1271. $1=self._printString();
  1272. return $1;
  1273. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Object)})},
  1274. args: [],
  1275. source: "asString\x0a\x09^self printString",
  1276. messageSends: ["printString"],
  1277. referencedClasses: []
  1278. }),
  1279. smalltalk.Object);
  1280. smalltalk.addMethod(
  1281. smalltalk.method({
  1282. selector: "basicAt:",
  1283. category: 'accessing',
  1284. fn: function (aString){
  1285. var self=this;
  1286. return smalltalk.withContext(function($ctx1) {
  1287. return self[aString];
  1288. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},smalltalk.Object)})},
  1289. args: ["aString"],
  1290. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1291. messageSends: [],
  1292. referencedClasses: []
  1293. }),
  1294. smalltalk.Object);
  1295. smalltalk.addMethod(
  1296. smalltalk.method({
  1297. selector: "basicAt:put:",
  1298. category: 'accessing',
  1299. fn: function (aString,anObject){
  1300. var self=this;
  1301. return smalltalk.withContext(function($ctx1) {
  1302. return self[aString] = anObject;
  1303. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  1304. args: ["aString", "anObject"],
  1305. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1306. messageSends: [],
  1307. referencedClasses: []
  1308. }),
  1309. smalltalk.Object);
  1310. smalltalk.addMethod(
  1311. smalltalk.method({
  1312. selector: "basicDelete:",
  1313. category: 'accessing',
  1314. fn: function (aString){
  1315. var self=this;
  1316. return smalltalk.withContext(function($ctx1) {
  1317. delete self[aString]; return aString;
  1318. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},smalltalk.Object)})},
  1319. args: ["aString"],
  1320. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1321. messageSends: [],
  1322. referencedClasses: []
  1323. }),
  1324. smalltalk.Object);
  1325. smalltalk.addMethod(
  1326. smalltalk.method({
  1327. selector: "basicPerform:",
  1328. category: 'message handling',
  1329. fn: function (aString){
  1330. var self=this;
  1331. return smalltalk.withContext(function($ctx1) {
  1332. var $1;
  1333. $1=self._basicPerform_withArguments_(aString,[]);
  1334. return $1;
  1335. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},smalltalk.Object)})},
  1336. args: ["aString"],
  1337. source: "basicPerform: aString\x0a\x09^self basicPerform: aString withArguments: #()",
  1338. messageSends: ["basicPerform:withArguments:"],
  1339. referencedClasses: []
  1340. }),
  1341. smalltalk.Object);
  1342. smalltalk.addMethod(
  1343. smalltalk.method({
  1344. selector: "basicPerform:withArguments:",
  1345. category: 'message handling',
  1346. fn: function (aString,aCollection){
  1347. var self=this;
  1348. return smalltalk.withContext(function($ctx1) {
  1349. return self[aString].apply(self, aCollection);;
  1350. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  1351. args: ["aString", "aCollection"],
  1352. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1353. messageSends: [],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.Object);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "class",
  1360. category: 'accessing',
  1361. fn: function (){
  1362. var self=this;
  1363. return smalltalk.withContext(function($ctx1) {
  1364. return self.klass;
  1365. return self}, function($ctx1) {$ctx1.fill(self,"class",{},smalltalk.Object)})},
  1366. args: [],
  1367. source: "class\x0a\x09<return self.klass>",
  1368. messageSends: [],
  1369. referencedClasses: []
  1370. }),
  1371. smalltalk.Object);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "copy",
  1375. category: 'copying',
  1376. fn: function (){
  1377. var self=this;
  1378. return smalltalk.withContext(function($ctx1) {
  1379. var $1;
  1380. $1=_st(self._shallowCopy())._postCopy();
  1381. return $1;
  1382. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Object)})},
  1383. args: [],
  1384. source: "copy\x0a\x09^self shallowCopy postCopy",
  1385. messageSends: ["postCopy", "shallowCopy"],
  1386. referencedClasses: []
  1387. }),
  1388. smalltalk.Object);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "deepCopy",
  1392. category: 'copying',
  1393. fn: function (){
  1394. var self=this;
  1395. return smalltalk.withContext(function($ctx1) {
  1396. var copy = self.klass._new();
  1397. for(var i in self) {
  1398. if(/^@.+/.test(i)) {
  1399. copy[i] = self[i]._deepCopy();
  1400. }
  1401. }
  1402. return copy;
  1403. ;
  1404. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Object)})},
  1405. args: [],
  1406. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  1407. messageSends: [],
  1408. referencedClasses: []
  1409. }),
  1410. smalltalk.Object);
  1411. smalltalk.addMethod(
  1412. smalltalk.method({
  1413. selector: "deprecatedAPI",
  1414. category: 'error handling',
  1415. fn: function (){
  1416. var self=this;
  1417. return smalltalk.withContext(function($ctx1) {
  1418. _st(console)._warn_(_st(_st(_st(_st(smalltalk.getThisContext()._home())._asString()).__comma(" is deprecated! (in ")).__comma(_st(_st(smalltalk.getThisContext()._home())._home())._asString())).__comma(")"));
  1419. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},smalltalk.Object)})},
  1420. args: [],
  1421. 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, ')'",
  1422. messageSends: ["warn:", ",", "asString", "home"],
  1423. referencedClasses: []
  1424. }),
  1425. smalltalk.Object);
  1426. smalltalk.addMethod(
  1427. smalltalk.method({
  1428. selector: "doesNotUnderstand:",
  1429. category: 'error handling',
  1430. fn: function (aMessage){
  1431. var self=this;
  1432. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1433. return smalltalk.withContext(function($ctx1) {
  1434. var $1,$2;
  1435. $1=_st($MessageNotUnderstood())._new();
  1436. _st($1)._receiver_(self);
  1437. _st($1)._message_(aMessage);
  1438. $2=_st($1)._signal();
  1439. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.Object)})},
  1440. args: ["aMessage"],
  1441. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1442. messageSends: ["receiver:", "new", "message:", "signal"],
  1443. referencedClasses: ["MessageNotUnderstood"]
  1444. }),
  1445. smalltalk.Object);
  1446. smalltalk.addMethod(
  1447. smalltalk.method({
  1448. selector: "error:",
  1449. category: 'error handling',
  1450. fn: function (aString){
  1451. var self=this;
  1452. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1453. return smalltalk.withContext(function($ctx1) {
  1454. _st($Error())._signal_(aString);
  1455. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},smalltalk.Object)})},
  1456. args: ["aString"],
  1457. source: "error: aString\x0a\x09Error signal: aString",
  1458. messageSends: ["signal:"],
  1459. referencedClasses: ["Error"]
  1460. }),
  1461. smalltalk.Object);
  1462. smalltalk.addMethod(
  1463. smalltalk.method({
  1464. selector: "halt",
  1465. category: 'error handling',
  1466. fn: function (){
  1467. var self=this;
  1468. return smalltalk.withContext(function($ctx1) {
  1469. self._error_("Halt encountered");
  1470. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},smalltalk.Object)})},
  1471. args: [],
  1472. source: "halt\x0a\x09self error: 'Halt encountered'",
  1473. messageSends: ["error:"],
  1474. referencedClasses: []
  1475. }),
  1476. smalltalk.Object);
  1477. smalltalk.addMethod(
  1478. smalltalk.method({
  1479. selector: "identityHash",
  1480. category: 'accessing',
  1481. fn: function (){
  1482. var self=this;
  1483. return smalltalk.withContext(function($ctx1) {
  1484. var hash=self.identityHash;
  1485. if (hash) return hash;
  1486. hash=smalltalk.nextId();
  1487. Object.defineProperty(self, 'identityHash', {value:hash});
  1488. return hash;
  1489. ;
  1490. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Object)})},
  1491. args: [],
  1492. 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>",
  1493. messageSends: [],
  1494. referencedClasses: []
  1495. }),
  1496. smalltalk.Object);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "ifNil:",
  1500. category: 'testing',
  1501. fn: function (aBlock){
  1502. var self=this;
  1503. return smalltalk.withContext(function($ctx1) {
  1504. var $1;
  1505. $1=self;
  1506. return $1;
  1507. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.Object)})},
  1508. args: ["aBlock"],
  1509. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  1510. messageSends: [],
  1511. referencedClasses: []
  1512. }),
  1513. smalltalk.Object);
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "ifNil:ifNotNil:",
  1517. category: 'testing',
  1518. fn: function (aBlock,anotherBlock){
  1519. var self=this;
  1520. return smalltalk.withContext(function($ctx1) {
  1521. var $1;
  1522. $1=_st(anotherBlock)._value_(self);
  1523. return $1;
  1524. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1525. args: ["aBlock", "anotherBlock"],
  1526. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value: self",
  1527. messageSends: ["value:"],
  1528. referencedClasses: []
  1529. }),
  1530. smalltalk.Object);
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "ifNotNil:",
  1534. category: 'testing',
  1535. fn: function (aBlock){
  1536. var self=this;
  1537. return smalltalk.withContext(function($ctx1) {
  1538. var $1;
  1539. $1=_st(aBlock)._value_(self);
  1540. return $1;
  1541. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.Object)})},
  1542. args: ["aBlock"],
  1543. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1544. messageSends: ["value:"],
  1545. referencedClasses: []
  1546. }),
  1547. smalltalk.Object);
  1548. smalltalk.addMethod(
  1549. smalltalk.method({
  1550. selector: "ifNotNil:ifNil:",
  1551. category: 'testing',
  1552. fn: function (aBlock,anotherBlock){
  1553. var self=this;
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=_st(aBlock)._value_(self);
  1557. return $1;
  1558. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  1559. args: ["aBlock", "anotherBlock"],
  1560. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value: self",
  1561. messageSends: ["value:"],
  1562. referencedClasses: []
  1563. }),
  1564. smalltalk.Object);
  1565. smalltalk.addMethod(
  1566. smalltalk.method({
  1567. selector: "initialize",
  1568. category: 'initialization',
  1569. fn: function (){
  1570. var self=this;
  1571. return smalltalk.withContext(function($ctx1) {
  1572. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object)})},
  1573. args: [],
  1574. source: "initialize",
  1575. messageSends: [],
  1576. referencedClasses: []
  1577. }),
  1578. smalltalk.Object);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "inspect",
  1582. category: 'inspecting',
  1583. fn: function (){
  1584. var self=this;
  1585. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  1586. return smalltalk.withContext(function($ctx1) {
  1587. _st($InspectorHandler())._inspect_(self);
  1588. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},smalltalk.Object)})},
  1589. args: [],
  1590. source: "inspect\x0a\x09InspectorHandler inspect: self",
  1591. messageSends: ["inspect:"],
  1592. referencedClasses: ["InspectorHandler"]
  1593. }),
  1594. smalltalk.Object);
  1595. smalltalk.addMethod(
  1596. smalltalk.method({
  1597. selector: "inspectOn:",
  1598. category: 'inspecting',
  1599. fn: function (anInspector){
  1600. var self=this;
  1601. var variables;
  1602. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1603. return smalltalk.withContext(function($ctx1) {
  1604. var $1,$2;
  1605. variables=_st($Dictionary())._new();
  1606. _st(variables)._at_put_("#self",self);
  1607. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1608. return smalltalk.withContext(function($ctx2) {
  1609. return _st(variables)._at_put_(each,self._instVarAt_(each));
  1610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1611. $1=anInspector;
  1612. _st($1)._setLabel_(self._printString());
  1613. $2=_st($1)._setVariables_(variables);
  1614. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.Object)})},
  1615. args: ["anInspector"],
  1616. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [:each |\x0a\x09\x09variables at: each put: (self instVarAt: each)].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  1617. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"],
  1618. referencedClasses: ["Dictionary"]
  1619. }),
  1620. smalltalk.Object);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "instVarAt:",
  1624. category: 'accessing',
  1625. fn: function (aString){
  1626. var self=this;
  1627. return smalltalk.withContext(function($ctx1) {
  1628. return self['@'+aString] ;
  1629. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},smalltalk.Object)})},
  1630. args: ["aString"],
  1631. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1632. messageSends: [],
  1633. referencedClasses: []
  1634. }),
  1635. smalltalk.Object);
  1636. smalltalk.addMethod(
  1637. smalltalk.method({
  1638. selector: "instVarAt:put:",
  1639. category: 'accessing',
  1640. fn: function (aString,anObject){
  1641. var self=this;
  1642. return smalltalk.withContext(function($ctx1) {
  1643. self['@' + aString] = anObject ;
  1644. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},smalltalk.Object)})},
  1645. args: ["aString", "anObject"],
  1646. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1647. messageSends: [],
  1648. referencedClasses: []
  1649. }),
  1650. smalltalk.Object);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "isBehavior",
  1654. category: 'testing',
  1655. fn: function (){
  1656. var self=this;
  1657. return smalltalk.withContext(function($ctx1) {
  1658. return false;
  1659. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Object)})},
  1660. args: [],
  1661. source: "isBehavior\x0a\x09^ false",
  1662. messageSends: [],
  1663. referencedClasses: []
  1664. }),
  1665. smalltalk.Object);
  1666. smalltalk.addMethod(
  1667. smalltalk.method({
  1668. selector: "isBoolean",
  1669. category: 'testing',
  1670. fn: function (){
  1671. var self=this;
  1672. return smalltalk.withContext(function($ctx1) {
  1673. return false;
  1674. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Object)})},
  1675. args: [],
  1676. source: "isBoolean\x0a\x09^ false",
  1677. messageSends: [],
  1678. referencedClasses: []
  1679. }),
  1680. smalltalk.Object);
  1681. smalltalk.addMethod(
  1682. smalltalk.method({
  1683. selector: "isClass",
  1684. category: 'testing',
  1685. fn: function (){
  1686. var self=this;
  1687. return smalltalk.withContext(function($ctx1) {
  1688. return false;
  1689. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Object)})},
  1690. args: [],
  1691. source: "isClass\x0a\x09^false",
  1692. messageSends: [],
  1693. referencedClasses: []
  1694. }),
  1695. smalltalk.Object);
  1696. smalltalk.addMethod(
  1697. smalltalk.method({
  1698. selector: "isCompiledMethod",
  1699. category: 'testing',
  1700. fn: function (){
  1701. var self=this;
  1702. return smalltalk.withContext(function($ctx1) {
  1703. return false;
  1704. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.Object)})},
  1705. args: [],
  1706. source: "isCompiledMethod\x0a\x09^ false",
  1707. messageSends: [],
  1708. referencedClasses: []
  1709. }),
  1710. smalltalk.Object);
  1711. smalltalk.addMethod(
  1712. smalltalk.method({
  1713. selector: "isImmutable",
  1714. category: 'testing',
  1715. fn: function (){
  1716. var self=this;
  1717. return smalltalk.withContext(function($ctx1) {
  1718. return false;
  1719. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Object)})},
  1720. args: [],
  1721. source: "isImmutable\x0a\x09^ false",
  1722. messageSends: [],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.Object);
  1726. smalltalk.addMethod(
  1727. smalltalk.method({
  1728. selector: "isKindOf:",
  1729. category: 'testing',
  1730. fn: function (aClass){
  1731. var self=this;
  1732. return smalltalk.withContext(function($ctx1) {
  1733. var $2,$1;
  1734. $2=self._isMemberOf_(aClass);
  1735. if(smalltalk.assert($2)){
  1736. $1=true;
  1737. } else {
  1738. $1=_st(self._class())._inheritsFrom_(aClass);
  1739. };
  1740. return $1;
  1741. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},smalltalk.Object)})},
  1742. args: ["aClass"],
  1743. source: "isKindOf: aClass\x0a\x09^(self isMemberOf: aClass)\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: [self class inheritsFrom: aClass]",
  1744. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
  1745. referencedClasses: []
  1746. }),
  1747. smalltalk.Object);
  1748. smalltalk.addMethod(
  1749. smalltalk.method({
  1750. selector: "isMemberOf:",
  1751. category: 'testing',
  1752. fn: function (aClass){
  1753. var self=this;
  1754. return smalltalk.withContext(function($ctx1) {
  1755. var $1;
  1756. $1=_st(self._class()).__eq(aClass);
  1757. return $1;
  1758. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},smalltalk.Object)})},
  1759. args: ["aClass"],
  1760. source: "isMemberOf: aClass\x0a\x09^self class = aClass",
  1761. messageSends: ["=", "class"],
  1762. referencedClasses: []
  1763. }),
  1764. smalltalk.Object);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "isMetaclass",
  1768. category: 'testing',
  1769. fn: function (){
  1770. var self=this;
  1771. return smalltalk.withContext(function($ctx1) {
  1772. return false;
  1773. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Object)})},
  1774. args: [],
  1775. source: "isMetaclass\x0a\x09^false",
  1776. messageSends: [],
  1777. referencedClasses: []
  1778. }),
  1779. smalltalk.Object);
  1780. smalltalk.addMethod(
  1781. smalltalk.method({
  1782. selector: "isNil",
  1783. category: 'testing',
  1784. fn: function (){
  1785. var self=this;
  1786. return smalltalk.withContext(function($ctx1) {
  1787. return false;
  1788. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.Object)})},
  1789. args: [],
  1790. source: "isNil\x0a\x09^false",
  1791. messageSends: [],
  1792. referencedClasses: []
  1793. }),
  1794. smalltalk.Object);
  1795. smalltalk.addMethod(
  1796. smalltalk.method({
  1797. selector: "isNumber",
  1798. category: 'testing',
  1799. fn: function (){
  1800. var self=this;
  1801. return smalltalk.withContext(function($ctx1) {
  1802. return false;
  1803. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Object)})},
  1804. args: [],
  1805. source: "isNumber\x0a\x09^false",
  1806. messageSends: [],
  1807. referencedClasses: []
  1808. }),
  1809. smalltalk.Object);
  1810. smalltalk.addMethod(
  1811. smalltalk.method({
  1812. selector: "isPackage",
  1813. category: 'testing',
  1814. fn: function (){
  1815. var self=this;
  1816. return smalltalk.withContext(function($ctx1) {
  1817. return false;
  1818. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Object)})},
  1819. args: [],
  1820. source: "isPackage\x0a\x09^ false",
  1821. messageSends: [],
  1822. referencedClasses: []
  1823. }),
  1824. smalltalk.Object);
  1825. smalltalk.addMethod(
  1826. smalltalk.method({
  1827. selector: "isParseFailure",
  1828. category: 'testing',
  1829. fn: function (){
  1830. var self=this;
  1831. return smalltalk.withContext(function($ctx1) {
  1832. return false;
  1833. }, function($ctx1) {$ctx1.fill(self,"isParseFailure",{},smalltalk.Object)})},
  1834. args: [],
  1835. source: "isParseFailure\x0a\x09^false",
  1836. messageSends: [],
  1837. referencedClasses: []
  1838. }),
  1839. smalltalk.Object);
  1840. smalltalk.addMethod(
  1841. smalltalk.method({
  1842. selector: "isString",
  1843. category: 'testing',
  1844. fn: function (){
  1845. var self=this;
  1846. return smalltalk.withContext(function($ctx1) {
  1847. return false;
  1848. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.Object)})},
  1849. args: [],
  1850. source: "isString\x0a\x09^false",
  1851. messageSends: [],
  1852. referencedClasses: []
  1853. }),
  1854. smalltalk.Object);
  1855. smalltalk.addMethod(
  1856. smalltalk.method({
  1857. selector: "isSymbol",
  1858. category: 'testing',
  1859. fn: function (){
  1860. var self=this;
  1861. return smalltalk.withContext(function($ctx1) {
  1862. return false;
  1863. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{},smalltalk.Object)})},
  1864. args: [],
  1865. source: "isSymbol\x0a\x09^false",
  1866. messageSends: [],
  1867. referencedClasses: []
  1868. }),
  1869. smalltalk.Object);
  1870. smalltalk.addMethod(
  1871. smalltalk.method({
  1872. selector: "notNil",
  1873. category: 'testing',
  1874. fn: function (){
  1875. var self=this;
  1876. return smalltalk.withContext(function($ctx1) {
  1877. var $1;
  1878. $1=_st(self._isNil())._not();
  1879. return $1;
  1880. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.Object)})},
  1881. args: [],
  1882. source: "notNil\x0a\x09^self isNil not",
  1883. messageSends: ["not", "isNil"],
  1884. referencedClasses: []
  1885. }),
  1886. smalltalk.Object);
  1887. smalltalk.addMethod(
  1888. smalltalk.method({
  1889. selector: "perform:",
  1890. category: 'message handling',
  1891. fn: function (aString){
  1892. var self=this;
  1893. return smalltalk.withContext(function($ctx1) {
  1894. var $1;
  1895. $1=self._perform_withArguments_(aString,[]);
  1896. return $1;
  1897. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},smalltalk.Object)})},
  1898. args: ["aString"],
  1899. source: "perform: aString\x0a\x09^self perform: aString withArguments: #()",
  1900. messageSends: ["perform:withArguments:"],
  1901. referencedClasses: []
  1902. }),
  1903. smalltalk.Object);
  1904. smalltalk.addMethod(
  1905. smalltalk.method({
  1906. selector: "perform:withArguments:",
  1907. category: 'message handling',
  1908. fn: function (aString,aCollection){
  1909. var self=this;
  1910. return smalltalk.withContext(function($ctx1) {
  1911. return smalltalk.send(self, aString._asSelector(), aCollection);
  1912. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},smalltalk.Object)})},
  1913. args: ["aString", "aCollection"],
  1914. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1915. messageSends: [],
  1916. referencedClasses: []
  1917. }),
  1918. smalltalk.Object);
  1919. smalltalk.addMethod(
  1920. smalltalk.method({
  1921. selector: "postCopy",
  1922. category: 'copying',
  1923. fn: function (){
  1924. var self=this;
  1925. return smalltalk.withContext(function($ctx1) {
  1926. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Object)})},
  1927. args: [],
  1928. source: "postCopy",
  1929. messageSends: [],
  1930. referencedClasses: []
  1931. }),
  1932. smalltalk.Object);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "printOn:",
  1936. category: 'printing',
  1937. fn: function (aStream){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $1,$3,$2;
  1941. $1=aStream;
  1942. $3=_st(_st(_st(self._class())._name())._first())._isVowel();
  1943. if(smalltalk.assert($3)){
  1944. $2="an ";
  1945. } else {
  1946. $2="a ";
  1947. };
  1948. _st($1)._nextPutAll_($2);
  1949. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1950. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Object)})},
  1951. args: ["aStream"],
  1952. source: "printOn: aStream\x0a\x09\x22Append to the aStream, a string representing the receiver.\x22\x0a\x09\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1953. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1954. referencedClasses: []
  1955. }),
  1956. smalltalk.Object);
  1957. smalltalk.addMethod(
  1958. smalltalk.method({
  1959. selector: "printString",
  1960. category: 'printing',
  1961. fn: function (){
  1962. var self=this;
  1963. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1964. return smalltalk.withContext(function($ctx1) {
  1965. var $1;
  1966. $1=_st($String())._streamContents_((function(stream){
  1967. return smalltalk.withContext(function($ctx2) {
  1968. return self._printOn_(stream);
  1969. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1970. return $1;
  1971. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Object)})},
  1972. args: [],
  1973. source: "printString\x0a\x09\x22Answer a String representation of the receiver.\x22\x0a\x0a\x09^ String streamContents: [ :stream | self printOn: stream ]",
  1974. messageSends: ["streamContents:", "printOn:"],
  1975. referencedClasses: ["String"]
  1976. }),
  1977. smalltalk.Object);
  1978. smalltalk.addMethod(
  1979. smalltalk.method({
  1980. selector: "putOn:",
  1981. category: 'streaming',
  1982. fn: function (aStream){
  1983. var self=this;
  1984. return smalltalk.withContext(function($ctx1) {
  1985. _st(aStream)._nextPut_(self);
  1986. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Object)})},
  1987. args: ["aStream"],
  1988. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  1989. messageSends: ["nextPut:"],
  1990. referencedClasses: []
  1991. }),
  1992. smalltalk.Object);
  1993. smalltalk.addMethod(
  1994. smalltalk.method({
  1995. selector: "respondsTo:",
  1996. category: 'testing',
  1997. fn: function (aSelector){
  1998. var self=this;
  1999. return smalltalk.withContext(function($ctx1) {
  2000. var $1;
  2001. $1=_st(self._class())._canUnderstand_(aSelector);
  2002. return $1;
  2003. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},smalltalk.Object)})},
  2004. args: ["aSelector"],
  2005. source: "respondsTo: aSelector\x0a\x09^self class canUnderstand: aSelector",
  2006. messageSends: ["canUnderstand:", "class"],
  2007. referencedClasses: []
  2008. }),
  2009. smalltalk.Object);
  2010. smalltalk.addMethod(
  2011. smalltalk.method({
  2012. selector: "shallowCopy",
  2013. category: 'copying',
  2014. fn: function (){
  2015. var self=this;
  2016. return smalltalk.withContext(function($ctx1) {
  2017. var copy = self.klass._new();
  2018. for(var i in self) {
  2019. if(/^@.+/.test(i)) {
  2020. copy[i] = self[i];
  2021. }
  2022. }
  2023. return copy;
  2024. ;
  2025. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Object)})},
  2026. args: [],
  2027. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09for(var i in self) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09}\x0a\x09\x09return copy;\x0a\x09>",
  2028. messageSends: [],
  2029. referencedClasses: []
  2030. }),
  2031. smalltalk.Object);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "shouldNotImplement",
  2035. category: 'error handling',
  2036. fn: function (){
  2037. var self=this;
  2038. return smalltalk.withContext(function($ctx1) {
  2039. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  2040. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},smalltalk.Object)})},
  2041. args: [],
  2042. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2043. messageSends: ["error:", ",", "name", "class"],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.Object);
  2047. smalltalk.addMethod(
  2048. smalltalk.method({
  2049. selector: "size",
  2050. category: 'accessing',
  2051. fn: function (){
  2052. var self=this;
  2053. return smalltalk.withContext(function($ctx1) {
  2054. self._error_("Object not indexable");
  2055. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Object)})},
  2056. args: [],
  2057. source: "size\x0a\x09self error: 'Object not indexable'",
  2058. messageSends: ["error:"],
  2059. referencedClasses: []
  2060. }),
  2061. smalltalk.Object);
  2062. smalltalk.addMethod(
  2063. smalltalk.method({
  2064. selector: "subclassResponsibility",
  2065. category: 'error handling',
  2066. fn: function (){
  2067. var self=this;
  2068. return smalltalk.withContext(function($ctx1) {
  2069. self._error_("This method is a responsibility of a subclass");
  2070. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},smalltalk.Object)})},
  2071. args: [],
  2072. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2073. messageSends: ["error:"],
  2074. referencedClasses: []
  2075. }),
  2076. smalltalk.Object);
  2077. smalltalk.addMethod(
  2078. smalltalk.method({
  2079. selector: "test",
  2080. category: 'converting',
  2081. fn: function (){
  2082. var self=this;
  2083. var a;
  2084. return smalltalk.withContext(function($ctx1) {
  2085. a=(1);
  2086. self._halt();
  2087. return self}, function($ctx1) {$ctx1.fill(self,"test",{a:a},smalltalk.Object)})},
  2088. args: [],
  2089. source: "test\x0a\x09| a |\x0a\x09a := 1.\x0a\x09self halt",
  2090. messageSends: ["halt"],
  2091. referencedClasses: []
  2092. }),
  2093. smalltalk.Object);
  2094. smalltalk.addMethod(
  2095. smalltalk.method({
  2096. selector: "throw:",
  2097. category: 'error handling',
  2098. fn: function (anObject){
  2099. var self=this;
  2100. return smalltalk.withContext(function($ctx1) {
  2101. throw anObject ;
  2102. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},smalltalk.Object)})},
  2103. args: ["anObject"],
  2104. source: "throw: anObject\x0a\x09< throw anObject >",
  2105. messageSends: [],
  2106. referencedClasses: []
  2107. }),
  2108. smalltalk.Object);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "try:catch:",
  2112. category: 'error handling',
  2113. fn: function (aBlock,anotherBlock){
  2114. var self=this;
  2115. return smalltalk.withContext(function($ctx1) {
  2116. try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)};
  2117. return self}, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Object)})},
  2118. args: ["aBlock", "anotherBlock"],
  2119. source: "try: aBlock catch: anotherBlock\x0a\x09<try{return aBlock._value()} catch(e) {return anotherBlock._value_(e)}>",
  2120. messageSends: [],
  2121. referencedClasses: []
  2122. }),
  2123. smalltalk.Object);
  2124. smalltalk.addMethod(
  2125. smalltalk.method({
  2126. selector: "value",
  2127. category: 'accessing',
  2128. fn: function (){
  2129. var self=this;
  2130. return smalltalk.withContext(function($ctx1) {
  2131. return self.valueOf();
  2132. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Object)})},
  2133. args: [],
  2134. source: "value\x0a\x09<return self.valueOf()>",
  2135. messageSends: [],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.Object);
  2139. smalltalk.addMethod(
  2140. smalltalk.method({
  2141. selector: "yourself",
  2142. category: 'accessing',
  2143. fn: function (){
  2144. var self=this;
  2145. return smalltalk.withContext(function($ctx1) {
  2146. var $1;
  2147. $1=self;
  2148. return $1;
  2149. }, function($ctx1) {$ctx1.fill(self,"yourself",{},smalltalk.Object)})},
  2150. args: [],
  2151. source: "yourself\x0a\x09^self",
  2152. messageSends: [],
  2153. referencedClasses: []
  2154. }),
  2155. smalltalk.Object);
  2156. smalltalk.addMethod(
  2157. smalltalk.method({
  2158. selector: "~=",
  2159. category: 'comparing',
  2160. fn: function (anObject){
  2161. var self=this;
  2162. return smalltalk.withContext(function($ctx1) {
  2163. var $1;
  2164. $1=_st(self.__eq(anObject)).__eq(false);
  2165. return $1;
  2166. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},smalltalk.Object)})},
  2167. args: ["anObject"],
  2168. source: "~= anObject\x0a\x09^(self = anObject) = false",
  2169. messageSends: ["="],
  2170. referencedClasses: []
  2171. }),
  2172. smalltalk.Object);
  2173. smalltalk.addMethod(
  2174. smalltalk.method({
  2175. selector: "~~",
  2176. category: 'comparing',
  2177. fn: function (anObject){
  2178. var self=this;
  2179. return smalltalk.withContext(function($ctx1) {
  2180. var $1;
  2181. $1=_st(self.__eq_eq(anObject)).__eq(false);
  2182. return $1;
  2183. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},smalltalk.Object)})},
  2184. args: ["anObject"],
  2185. source: "~~ anObject\x0a\x09^(self == anObject) = false",
  2186. messageSends: ["=", "=="],
  2187. referencedClasses: []
  2188. }),
  2189. smalltalk.Object);
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "heliosClass",
  2193. category: 'helios',
  2194. fn: function (){
  2195. var self=this;
  2196. return smalltalk.withContext(function($ctx1) {
  2197. return "class";
  2198. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Object.klass)})},
  2199. args: [],
  2200. source: "heliosClass\x0a\x09\x22Should be an Helios extension. Unfortunately, since helios can browse remote\x0a\x09environments, we can't extend base classes\x22\x0a\x09\x0a\x09^ 'class'",
  2201. messageSends: [],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.Object.klass);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "initialize",
  2208. category: 'initialization',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Object.klass)})},
  2213. args: [],
  2214. source: "initialize\x0a\x09\x22no op\x22",
  2215. messageSends: [],
  2216. referencedClasses: []
  2217. }),
  2218. smalltalk.Object.klass);
  2219. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel-Objects');
  2220. smalltalk.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  2221. smalltalk.addMethod(
  2222. smalltalk.method({
  2223. selector: "&",
  2224. category: 'controlling',
  2225. fn: function (aBoolean){
  2226. var self=this;
  2227. return smalltalk.withContext(function($ctx1) {
  2228. if(self == true) {
  2229. return aBoolean;
  2230. } else {
  2231. return false;
  2232. }
  2233. ;
  2234. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2235. args: ["aBoolean"],
  2236. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2237. messageSends: [],
  2238. referencedClasses: []
  2239. }),
  2240. smalltalk.Boolean);
  2241. smalltalk.addMethod(
  2242. smalltalk.method({
  2243. selector: "=",
  2244. category: 'comparing',
  2245. fn: function (aBoolean){
  2246. var self=this;
  2247. return smalltalk.withContext(function($ctx1) {
  2248. if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {
  2249. return false;
  2250. }
  2251. return Boolean(self == true) == aBoolean
  2252. ;
  2253. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2254. args: ["aBoolean"],
  2255. source: "= aBoolean\x0a\x09<\x0a\x09\x09if(! aBoolean._isBoolean || ! aBoolean._isBoolean()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Boolean(self == true) == aBoolean\x0a\x09>",
  2256. messageSends: [],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.Boolean);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "==",
  2263. category: 'comparing',
  2264. fn: function (aBoolean){
  2265. var self=this;
  2266. return smalltalk.withContext(function($ctx1) {
  2267. var $1;
  2268. $1=self.__eq(aBoolean);
  2269. return $1;
  2270. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2271. args: ["aBoolean"],
  2272. source: "== aBoolean\x0a\x09^self = aBoolean",
  2273. messageSends: ["="],
  2274. referencedClasses: []
  2275. }),
  2276. smalltalk.Boolean);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "and:",
  2280. category: 'controlling',
  2281. fn: function (aBlock){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. var $2,$1;
  2285. $2=self.__eq(true);
  2286. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2287. return smalltalk.withContext(function($ctx2) {
  2288. return false;
  2289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2290. return $1;
  2291. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},smalltalk.Boolean)})},
  2292. args: ["aBlock"],
  2293. source: "and: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [false]",
  2294. messageSends: ["ifTrue:ifFalse:", "="],
  2295. referencedClasses: []
  2296. }),
  2297. smalltalk.Boolean);
  2298. smalltalk.addMethod(
  2299. smalltalk.method({
  2300. selector: "asBit",
  2301. category: 'converting',
  2302. fn: function (){
  2303. var self=this;
  2304. return smalltalk.withContext(function($ctx1) {
  2305. var $2,$1;
  2306. $2=self;
  2307. if(smalltalk.assert($2)){
  2308. $1=(1);
  2309. } else {
  2310. $1=(0);
  2311. };
  2312. return $1;
  2313. }, function($ctx1) {$ctx1.fill(self,"asBit",{},smalltalk.Boolean)})},
  2314. args: [],
  2315. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2316. messageSends: ["ifTrue:ifFalse:"],
  2317. referencedClasses: []
  2318. }),
  2319. smalltalk.Boolean);
  2320. smalltalk.addMethod(
  2321. smalltalk.method({
  2322. selector: "asJSON",
  2323. category: 'converting',
  2324. fn: function (){
  2325. var self=this;
  2326. return smalltalk.withContext(function($ctx1) {
  2327. var $1;
  2328. $1=self;
  2329. return $1;
  2330. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Boolean)})},
  2331. args: [],
  2332. source: "asJSON\x0a\x09^self",
  2333. messageSends: [],
  2334. referencedClasses: []
  2335. }),
  2336. smalltalk.Boolean);
  2337. smalltalk.addMethod(
  2338. smalltalk.method({
  2339. selector: "asString",
  2340. category: 'converting',
  2341. fn: function (){
  2342. var self=this;
  2343. return smalltalk.withContext(function($ctx1) {
  2344. return self.toString() ;
  2345. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Boolean)})},
  2346. args: [],
  2347. source: "asString\x0a\x09< return self.toString() >",
  2348. messageSends: [],
  2349. referencedClasses: []
  2350. }),
  2351. smalltalk.Boolean);
  2352. smalltalk.addMethod(
  2353. smalltalk.method({
  2354. selector: "deepCopy",
  2355. category: 'copying',
  2356. fn: function (){
  2357. var self=this;
  2358. return smalltalk.withContext(function($ctx1) {
  2359. var $1;
  2360. $1=self;
  2361. return $1;
  2362. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Boolean)})},
  2363. args: [],
  2364. source: "deepCopy\x0a\x09^self",
  2365. messageSends: [],
  2366. referencedClasses: []
  2367. }),
  2368. smalltalk.Boolean);
  2369. smalltalk.addMethod(
  2370. smalltalk.method({
  2371. selector: "ifFalse:",
  2372. category: 'controlling',
  2373. fn: function (aBlock){
  2374. var self=this;
  2375. return smalltalk.withContext(function($ctx1) {
  2376. var $2,$1;
  2377. $2=self;
  2378. $1=_st($2)._ifTrue_ifFalse_((function(){
  2379. return smalltalk.withContext(function($ctx2) {
  2380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),aBlock);
  2381. return $1;
  2382. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},smalltalk.Boolean)})},
  2383. args: ["aBlock"],
  2384. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: [] ifFalse: aBlock",
  2385. messageSends: ["ifTrue:ifFalse:"],
  2386. referencedClasses: []
  2387. }),
  2388. smalltalk.Boolean);
  2389. smalltalk.addMethod(
  2390. smalltalk.method({
  2391. selector: "ifFalse:ifTrue:",
  2392. category: 'controlling',
  2393. fn: function (aBlock,anotherBlock){
  2394. var self=this;
  2395. return smalltalk.withContext(function($ctx1) {
  2396. var $2,$1;
  2397. $2=self;
  2398. $1=_st($2)._ifTrue_ifFalse_(anotherBlock,aBlock);
  2399. return $1;
  2400. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  2401. args: ["aBlock", "anotherBlock"],
  2402. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: anotherBlock ifFalse: aBlock",
  2403. messageSends: ["ifTrue:ifFalse:"],
  2404. referencedClasses: []
  2405. }),
  2406. smalltalk.Boolean);
  2407. smalltalk.addMethod(
  2408. smalltalk.method({
  2409. selector: "ifTrue:",
  2410. category: 'controlling',
  2411. fn: function (aBlock){
  2412. var self=this;
  2413. return smalltalk.withContext(function($ctx1) {
  2414. var $2,$1;
  2415. $2=self;
  2416. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2417. return smalltalk.withContext(function($ctx2) {
  2418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2419. return $1;
  2420. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},smalltalk.Boolean)})},
  2421. args: ["aBlock"],
  2422. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifTrue: aBlock ifFalse: []",
  2423. messageSends: ["ifTrue:ifFalse:"],
  2424. referencedClasses: []
  2425. }),
  2426. smalltalk.Boolean);
  2427. smalltalk.addMethod(
  2428. smalltalk.method({
  2429. selector: "ifTrue:ifFalse:",
  2430. category: 'controlling',
  2431. fn: function (aBlock,anotherBlock){
  2432. var self=this;
  2433. return smalltalk.withContext(function($ctx1) {
  2434. if(self == true) {
  2435. return aBlock._value();
  2436. } else {
  2437. return anotherBlock._value();
  2438. }
  2439. ;
  2440. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Boolean)})},
  2441. args: ["aBlock", "anotherBlock"],
  2442. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  2443. messageSends: [],
  2444. referencedClasses: []
  2445. }),
  2446. smalltalk.Boolean);
  2447. smalltalk.addMethod(
  2448. smalltalk.method({
  2449. selector: "isBoolean",
  2450. category: 'testing',
  2451. fn: function (){
  2452. var self=this;
  2453. return smalltalk.withContext(function($ctx1) {
  2454. return true;
  2455. }, function($ctx1) {$ctx1.fill(self,"isBoolean",{},smalltalk.Boolean)})},
  2456. args: [],
  2457. source: "isBoolean\x0a\x09^ true",
  2458. messageSends: [],
  2459. referencedClasses: []
  2460. }),
  2461. smalltalk.Boolean);
  2462. smalltalk.addMethod(
  2463. smalltalk.method({
  2464. selector: "isImmutable",
  2465. category: 'testing',
  2466. fn: function (){
  2467. var self=this;
  2468. return smalltalk.withContext(function($ctx1) {
  2469. return true;
  2470. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Boolean)})},
  2471. args: [],
  2472. source: "isImmutable\x0a\x09^ true",
  2473. messageSends: [],
  2474. referencedClasses: []
  2475. }),
  2476. smalltalk.Boolean);
  2477. smalltalk.addMethod(
  2478. smalltalk.method({
  2479. selector: "not",
  2480. category: 'controlling',
  2481. fn: function (){
  2482. var self=this;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. var $1;
  2485. $1=self.__eq(false);
  2486. return $1;
  2487. }, function($ctx1) {$ctx1.fill(self,"not",{},smalltalk.Boolean)})},
  2488. args: [],
  2489. source: "not\x0a\x09^self = false",
  2490. messageSends: ["="],
  2491. referencedClasses: []
  2492. }),
  2493. smalltalk.Boolean);
  2494. smalltalk.addMethod(
  2495. smalltalk.method({
  2496. selector: "or:",
  2497. category: 'controlling',
  2498. fn: function (aBlock){
  2499. var self=this;
  2500. return smalltalk.withContext(function($ctx1) {
  2501. var $2,$1;
  2502. $2=self.__eq(true);
  2503. $1=_st($2)._ifTrue_ifFalse_((function(){
  2504. return smalltalk.withContext(function($ctx2) {
  2505. return true;
  2506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),aBlock);
  2507. return $1;
  2508. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},smalltalk.Boolean)})},
  2509. args: ["aBlock"],
  2510. source: "or: aBlock\x0a\x09^self = true\x0a\x09\x09ifTrue: [true]\x0a\x09\x09ifFalse: aBlock",
  2511. messageSends: ["ifTrue:ifFalse:", "="],
  2512. referencedClasses: []
  2513. }),
  2514. smalltalk.Boolean);
  2515. smalltalk.addMethod(
  2516. smalltalk.method({
  2517. selector: "printOn:",
  2518. category: 'printing',
  2519. fn: function (aStream){
  2520. var self=this;
  2521. return smalltalk.withContext(function($ctx1) {
  2522. _st(aStream)._nextPutAll_(self._asString());
  2523. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Boolean)})},
  2524. args: ["aStream"],
  2525. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2526. messageSends: ["nextPutAll:", "asString"],
  2527. referencedClasses: []
  2528. }),
  2529. smalltalk.Boolean);
  2530. smalltalk.addMethod(
  2531. smalltalk.method({
  2532. selector: "shallowCopy",
  2533. category: 'copying',
  2534. fn: function (){
  2535. var self=this;
  2536. return smalltalk.withContext(function($ctx1) {
  2537. var $1;
  2538. $1=self;
  2539. return $1;
  2540. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.Boolean)})},
  2541. args: [],
  2542. source: "shallowCopy\x0a\x09^self",
  2543. messageSends: [],
  2544. referencedClasses: []
  2545. }),
  2546. smalltalk.Boolean);
  2547. smalltalk.addMethod(
  2548. smalltalk.method({
  2549. selector: "|",
  2550. category: 'controlling',
  2551. fn: function (aBoolean){
  2552. var self=this;
  2553. return smalltalk.withContext(function($ctx1) {
  2554. if(self == true) {
  2555. return true;
  2556. } else {
  2557. return aBoolean;
  2558. }
  2559. ;
  2560. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},smalltalk.Boolean)})},
  2561. args: ["aBoolean"],
  2562. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  2563. messageSends: [],
  2564. referencedClasses: []
  2565. }),
  2566. smalltalk.Boolean);
  2567. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel-Objects');
  2568. smalltalk.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  2569. smalltalk.addMethod(
  2570. smalltalk.method({
  2571. selector: "+",
  2572. category: 'arithmetic',
  2573. fn: function (aDate){
  2574. var self=this;
  2575. return smalltalk.withContext(function($ctx1) {
  2576. return self + aDate;
  2577. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},smalltalk.Date)})},
  2578. args: ["aDate"],
  2579. source: "+ aDate\x0a\x09<return self + aDate>",
  2580. messageSends: [],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.Date);
  2584. smalltalk.addMethod(
  2585. smalltalk.method({
  2586. selector: "-",
  2587. category: 'arithmetic',
  2588. fn: function (aDate){
  2589. var self=this;
  2590. return smalltalk.withContext(function($ctx1) {
  2591. return self - aDate;
  2592. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},smalltalk.Date)})},
  2593. args: ["aDate"],
  2594. source: "- aDate\x0a\x09<return self - aDate>",
  2595. messageSends: [],
  2596. referencedClasses: []
  2597. }),
  2598. smalltalk.Date);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "<",
  2602. category: 'comparing',
  2603. fn: function (aDate){
  2604. var self=this;
  2605. return smalltalk.withContext(function($ctx1) {
  2606. return self < aDate;
  2607. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},smalltalk.Date)})},
  2608. args: ["aDate"],
  2609. source: "< aDate\x0a\x09<return self < aDate>",
  2610. messageSends: [],
  2611. referencedClasses: []
  2612. }),
  2613. smalltalk.Date);
  2614. smalltalk.addMethod(
  2615. smalltalk.method({
  2616. selector: "<=",
  2617. category: 'comparing',
  2618. fn: function (aDate){
  2619. var self=this;
  2620. return smalltalk.withContext(function($ctx1) {
  2621. return self <= aDate;
  2622. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},smalltalk.Date)})},
  2623. args: ["aDate"],
  2624. source: "<= aDate\x0a\x09<return self <= aDate>",
  2625. messageSends: [],
  2626. referencedClasses: []
  2627. }),
  2628. smalltalk.Date);
  2629. smalltalk.addMethod(
  2630. smalltalk.method({
  2631. selector: ">",
  2632. category: 'comparing',
  2633. fn: function (aDate){
  2634. var self=this;
  2635. return smalltalk.withContext(function($ctx1) {
  2636. return self > aDate;
  2637. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},smalltalk.Date)})},
  2638. args: ["aDate"],
  2639. source: "> aDate\x0a\x09<return self >> aDate>",
  2640. messageSends: [],
  2641. referencedClasses: []
  2642. }),
  2643. smalltalk.Date);
  2644. smalltalk.addMethod(
  2645. smalltalk.method({
  2646. selector: ">=",
  2647. category: 'comparing',
  2648. fn: function (aDate){
  2649. var self=this;
  2650. return smalltalk.withContext(function($ctx1) {
  2651. return self >= aDate;
  2652. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},smalltalk.Date)})},
  2653. args: ["aDate"],
  2654. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2655. messageSends: [],
  2656. referencedClasses: []
  2657. }),
  2658. smalltalk.Date);
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "asDateString",
  2662. category: 'converting',
  2663. fn: function (){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) {
  2666. return self.toDateString();
  2667. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},smalltalk.Date)})},
  2668. args: [],
  2669. source: "asDateString\x0a\x09<return self.toDateString()>",
  2670. messageSends: [],
  2671. referencedClasses: []
  2672. }),
  2673. smalltalk.Date);
  2674. smalltalk.addMethod(
  2675. smalltalk.method({
  2676. selector: "asLocaleString",
  2677. category: 'converting',
  2678. fn: function (){
  2679. var self=this;
  2680. return smalltalk.withContext(function($ctx1) {
  2681. return self.toLocaleString();
  2682. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},smalltalk.Date)})},
  2683. args: [],
  2684. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2685. messageSends: [],
  2686. referencedClasses: []
  2687. }),
  2688. smalltalk.Date);
  2689. smalltalk.addMethod(
  2690. smalltalk.method({
  2691. selector: "asMilliseconds",
  2692. category: 'converting',
  2693. fn: function (){
  2694. var self=this;
  2695. return smalltalk.withContext(function($ctx1) {
  2696. var $1;
  2697. $1=self._time();
  2698. return $1;
  2699. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},smalltalk.Date)})},
  2700. args: [],
  2701. source: "asMilliseconds\x0a\x09^self time",
  2702. messageSends: ["time"],
  2703. referencedClasses: []
  2704. }),
  2705. smalltalk.Date);
  2706. smalltalk.addMethod(
  2707. smalltalk.method({
  2708. selector: "asNumber",
  2709. category: 'converting',
  2710. fn: function (){
  2711. var self=this;
  2712. return smalltalk.withContext(function($ctx1) {
  2713. var $1;
  2714. $1=self._asMilliseconds();
  2715. return $1;
  2716. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Date)})},
  2717. args: [],
  2718. source: "asNumber\x0a\x09^self asMilliseconds",
  2719. messageSends: ["asMilliseconds"],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.Date);
  2723. smalltalk.addMethod(
  2724. smalltalk.method({
  2725. selector: "asString",
  2726. category: 'converting',
  2727. fn: function (){
  2728. var self=this;
  2729. return smalltalk.withContext(function($ctx1) {
  2730. return self.toString();
  2731. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Date)})},
  2732. args: [],
  2733. source: "asString\x0a\x09<return self.toString()>",
  2734. messageSends: [],
  2735. referencedClasses: []
  2736. }),
  2737. smalltalk.Date);
  2738. smalltalk.addMethod(
  2739. smalltalk.method({
  2740. selector: "asTimeString",
  2741. category: 'converting',
  2742. fn: function (){
  2743. var self=this;
  2744. return smalltalk.withContext(function($ctx1) {
  2745. return self.toTimeString();
  2746. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},smalltalk.Date)})},
  2747. args: [],
  2748. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2749. messageSends: [],
  2750. referencedClasses: []
  2751. }),
  2752. smalltalk.Date);
  2753. smalltalk.addMethod(
  2754. smalltalk.method({
  2755. selector: "day",
  2756. category: 'accessing',
  2757. fn: function (){
  2758. var self=this;
  2759. return smalltalk.withContext(function($ctx1) {
  2760. var $1;
  2761. $1=self._dayOfWeek();
  2762. return $1;
  2763. }, function($ctx1) {$ctx1.fill(self,"day",{},smalltalk.Date)})},
  2764. args: [],
  2765. source: "day\x0a\x09^self dayOfWeek",
  2766. messageSends: ["dayOfWeek"],
  2767. referencedClasses: []
  2768. }),
  2769. smalltalk.Date);
  2770. smalltalk.addMethod(
  2771. smalltalk.method({
  2772. selector: "day:",
  2773. category: 'accessing',
  2774. fn: function (aNumber){
  2775. var self=this;
  2776. return smalltalk.withContext(function($ctx1) {
  2777. self._dayOfWeek_(aNumber);
  2778. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},smalltalk.Date)})},
  2779. args: ["aNumber"],
  2780. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2781. messageSends: ["dayOfWeek:"],
  2782. referencedClasses: []
  2783. }),
  2784. smalltalk.Date);
  2785. smalltalk.addMethod(
  2786. smalltalk.method({
  2787. selector: "dayOfMonth",
  2788. category: 'accessing',
  2789. fn: function (){
  2790. var self=this;
  2791. return smalltalk.withContext(function($ctx1) {
  2792. return self.getDate();
  2793. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},smalltalk.Date)})},
  2794. args: [],
  2795. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2796. messageSends: [],
  2797. referencedClasses: []
  2798. }),
  2799. smalltalk.Date);
  2800. smalltalk.addMethod(
  2801. smalltalk.method({
  2802. selector: "dayOfMonth:",
  2803. category: 'accessing',
  2804. fn: function (aNumber){
  2805. var self=this;
  2806. return smalltalk.withContext(function($ctx1) {
  2807. self.setDate(aNumber);
  2808. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},smalltalk.Date)})},
  2809. args: ["aNumber"],
  2810. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2811. messageSends: [],
  2812. referencedClasses: []
  2813. }),
  2814. smalltalk.Date);
  2815. smalltalk.addMethod(
  2816. smalltalk.method({
  2817. selector: "dayOfWeek",
  2818. category: 'accessing',
  2819. fn: function (){
  2820. var self=this;
  2821. return smalltalk.withContext(function($ctx1) {
  2822. return self.getDay() + 1;
  2823. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},smalltalk.Date)})},
  2824. args: [],
  2825. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2826. messageSends: [],
  2827. referencedClasses: []
  2828. }),
  2829. smalltalk.Date);
  2830. smalltalk.addMethod(
  2831. smalltalk.method({
  2832. selector: "dayOfWeek:",
  2833. category: 'accessing',
  2834. fn: function (aNumber){
  2835. var self=this;
  2836. return smalltalk.withContext(function($ctx1) {
  2837. return self.setDay(aNumber - 1);
  2838. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},smalltalk.Date)})},
  2839. args: ["aNumber"],
  2840. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2841. messageSends: [],
  2842. referencedClasses: []
  2843. }),
  2844. smalltalk.Date);
  2845. smalltalk.addMethod(
  2846. smalltalk.method({
  2847. selector: "hours",
  2848. category: 'accessing',
  2849. fn: function (){
  2850. var self=this;
  2851. return smalltalk.withContext(function($ctx1) {
  2852. return self.getHours();
  2853. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},smalltalk.Date)})},
  2854. args: [],
  2855. source: "hours\x0a\x09<return self.getHours()>",
  2856. messageSends: [],
  2857. referencedClasses: []
  2858. }),
  2859. smalltalk.Date);
  2860. smalltalk.addMethod(
  2861. smalltalk.method({
  2862. selector: "hours:",
  2863. category: 'accessing',
  2864. fn: function (aNumber){
  2865. var self=this;
  2866. return smalltalk.withContext(function($ctx1) {
  2867. self.setHours(aNumber);
  2868. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},smalltalk.Date)})},
  2869. args: ["aNumber"],
  2870. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2871. messageSends: [],
  2872. referencedClasses: []
  2873. }),
  2874. smalltalk.Date);
  2875. smalltalk.addMethod(
  2876. smalltalk.method({
  2877. selector: "milliseconds",
  2878. category: 'accessing',
  2879. fn: function (){
  2880. var self=this;
  2881. return smalltalk.withContext(function($ctx1) {
  2882. return self.getMilliseconds();
  2883. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},smalltalk.Date)})},
  2884. args: [],
  2885. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2886. messageSends: [],
  2887. referencedClasses: []
  2888. }),
  2889. smalltalk.Date);
  2890. smalltalk.addMethod(
  2891. smalltalk.method({
  2892. selector: "milliseconds:",
  2893. category: 'accessing',
  2894. fn: function (aNumber){
  2895. var self=this;
  2896. return smalltalk.withContext(function($ctx1) {
  2897. self.setMilliseconds(aNumber);
  2898. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},smalltalk.Date)})},
  2899. args: ["aNumber"],
  2900. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2901. messageSends: [],
  2902. referencedClasses: []
  2903. }),
  2904. smalltalk.Date);
  2905. smalltalk.addMethod(
  2906. smalltalk.method({
  2907. selector: "minutes",
  2908. category: 'accessing',
  2909. fn: function (){
  2910. var self=this;
  2911. return smalltalk.withContext(function($ctx1) {
  2912. return self.getMinutes();
  2913. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},smalltalk.Date)})},
  2914. args: [],
  2915. source: "minutes\x0a\x09<return self.getMinutes()>",
  2916. messageSends: [],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.Date);
  2920. smalltalk.addMethod(
  2921. smalltalk.method({
  2922. selector: "minutes:",
  2923. category: 'accessing',
  2924. fn: function (aNumber){
  2925. var self=this;
  2926. return smalltalk.withContext(function($ctx1) {
  2927. self.setMinutes(aNumber);
  2928. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},smalltalk.Date)})},
  2929. args: ["aNumber"],
  2930. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  2931. messageSends: [],
  2932. referencedClasses: []
  2933. }),
  2934. smalltalk.Date);
  2935. smalltalk.addMethod(
  2936. smalltalk.method({
  2937. selector: "month",
  2938. category: 'accessing',
  2939. fn: function (){
  2940. var self=this;
  2941. return smalltalk.withContext(function($ctx1) {
  2942. return self.getMonth() + 1;
  2943. return self}, function($ctx1) {$ctx1.fill(self,"month",{},smalltalk.Date)})},
  2944. args: [],
  2945. source: "month\x0a\x09<return self.getMonth() + 1>",
  2946. messageSends: [],
  2947. referencedClasses: []
  2948. }),
  2949. smalltalk.Date);
  2950. smalltalk.addMethod(
  2951. smalltalk.method({
  2952. selector: "month:",
  2953. category: 'accessing',
  2954. fn: function (aNumber){
  2955. var self=this;
  2956. return smalltalk.withContext(function($ctx1) {
  2957. self.setMonth(aNumber - 1);
  2958. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},smalltalk.Date)})},
  2959. args: ["aNumber"],
  2960. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  2961. messageSends: [],
  2962. referencedClasses: []
  2963. }),
  2964. smalltalk.Date);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "printOn:",
  2968. category: 'printing',
  2969. fn: function (aStream){
  2970. var self=this;
  2971. return smalltalk.withContext(function($ctx1) {
  2972. _st(aStream)._nextPutAll_(self._asString());
  2973. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Date)})},
  2974. args: ["aStream"],
  2975. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2976. messageSends: ["nextPutAll:", "asString"],
  2977. referencedClasses: []
  2978. }),
  2979. smalltalk.Date);
  2980. smalltalk.addMethod(
  2981. smalltalk.method({
  2982. selector: "seconds",
  2983. category: 'accessing',
  2984. fn: function (){
  2985. var self=this;
  2986. return smalltalk.withContext(function($ctx1) {
  2987. return self.getSeconds();
  2988. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},smalltalk.Date)})},
  2989. args: [],
  2990. source: "seconds\x0a\x09<return self.getSeconds()>",
  2991. messageSends: [],
  2992. referencedClasses: []
  2993. }),
  2994. smalltalk.Date);
  2995. smalltalk.addMethod(
  2996. smalltalk.method({
  2997. selector: "seconds:",
  2998. category: 'accessing',
  2999. fn: function (aNumber){
  3000. var self=this;
  3001. return smalltalk.withContext(function($ctx1) {
  3002. self.setSeconds(aNumber);
  3003. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},smalltalk.Date)})},
  3004. args: ["aNumber"],
  3005. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3006. messageSends: [],
  3007. referencedClasses: []
  3008. }),
  3009. smalltalk.Date);
  3010. smalltalk.addMethod(
  3011. smalltalk.method({
  3012. selector: "time",
  3013. category: 'accessing',
  3014. fn: function (){
  3015. var self=this;
  3016. return smalltalk.withContext(function($ctx1) {
  3017. return self.getTime();
  3018. return self}, function($ctx1) {$ctx1.fill(self,"time",{},smalltalk.Date)})},
  3019. args: [],
  3020. source: "time\x0a\x09<return self.getTime()>",
  3021. messageSends: [],
  3022. referencedClasses: []
  3023. }),
  3024. smalltalk.Date);
  3025. smalltalk.addMethod(
  3026. smalltalk.method({
  3027. selector: "time:",
  3028. category: 'accessing',
  3029. fn: function (aNumber){
  3030. var self=this;
  3031. return smalltalk.withContext(function($ctx1) {
  3032. self.setTime(aNumber);
  3033. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},smalltalk.Date)})},
  3034. args: ["aNumber"],
  3035. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3036. messageSends: [],
  3037. referencedClasses: []
  3038. }),
  3039. smalltalk.Date);
  3040. smalltalk.addMethod(
  3041. smalltalk.method({
  3042. selector: "year",
  3043. category: 'accessing',
  3044. fn: function (){
  3045. var self=this;
  3046. return smalltalk.withContext(function($ctx1) {
  3047. return self.getFullYear();
  3048. return self}, function($ctx1) {$ctx1.fill(self,"year",{},smalltalk.Date)})},
  3049. args: [],
  3050. source: "year\x0a\x09<return self.getFullYear()>",
  3051. messageSends: [],
  3052. referencedClasses: []
  3053. }),
  3054. smalltalk.Date);
  3055. smalltalk.addMethod(
  3056. smalltalk.method({
  3057. selector: "year:",
  3058. category: 'accessing',
  3059. fn: function (aNumber){
  3060. var self=this;
  3061. return smalltalk.withContext(function($ctx1) {
  3062. self.setFullYear(aNumber);
  3063. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},smalltalk.Date)})},
  3064. args: ["aNumber"],
  3065. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3066. messageSends: [],
  3067. referencedClasses: []
  3068. }),
  3069. smalltalk.Date);
  3070. smalltalk.addMethod(
  3071. smalltalk.method({
  3072. selector: "fromMilliseconds:",
  3073. category: 'instance creation',
  3074. fn: function (aNumber){
  3075. var self=this;
  3076. return smalltalk.withContext(function($ctx1) {
  3077. var $1;
  3078. $1=self._new_(aNumber);
  3079. return $1;
  3080. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  3081. args: ["aNumber"],
  3082. source: "fromMilliseconds: aNumber\x0a\x09^self new: aNumber",
  3083. messageSends: ["new:"],
  3084. referencedClasses: []
  3085. }),
  3086. smalltalk.Date.klass);
  3087. smalltalk.addMethod(
  3088. smalltalk.method({
  3089. selector: "fromSeconds:",
  3090. category: 'instance creation',
  3091. fn: function (aNumber){
  3092. var self=this;
  3093. return smalltalk.withContext(function($ctx1) {
  3094. var $1;
  3095. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  3096. return $1;
  3097. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},smalltalk.Date.klass)})},
  3098. args: ["aNumber"],
  3099. source: "fromSeconds: aNumber\x0a\x09^self fromMilliseconds: aNumber * 1000",
  3100. messageSends: ["fromMilliseconds:", "*"],
  3101. referencedClasses: []
  3102. }),
  3103. smalltalk.Date.klass);
  3104. smalltalk.addMethod(
  3105. smalltalk.method({
  3106. selector: "fromString:",
  3107. category: 'instance creation',
  3108. fn: function (aString){
  3109. var self=this;
  3110. return smalltalk.withContext(function($ctx1) {
  3111. var $1;
  3112. $1=self._new_(aString);
  3113. return $1;
  3114. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.Date.klass)})},
  3115. args: ["aString"],
  3116. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^self new: aString",
  3117. messageSends: ["new:"],
  3118. referencedClasses: []
  3119. }),
  3120. smalltalk.Date.klass);
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "heliosClass",
  3124. category: 'helios',
  3125. fn: function (){
  3126. var self=this;
  3127. return smalltalk.withContext(function($ctx1) {
  3128. return "magnitude";
  3129. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Date.klass)})},
  3130. args: [],
  3131. source: "heliosClass\x0a\x09^ 'magnitude'",
  3132. messageSends: [],
  3133. referencedClasses: []
  3134. }),
  3135. smalltalk.Date.klass);
  3136. smalltalk.addMethod(
  3137. smalltalk.method({
  3138. selector: "millisecondsToRun:",
  3139. category: 'instance creation',
  3140. fn: function (aBlock){
  3141. var self=this;
  3142. var t;
  3143. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  3144. return smalltalk.withContext(function($ctx1) {
  3145. var $1;
  3146. t=_st($Date())._now();
  3147. _st(aBlock)._value();
  3148. $1=_st(_st($Date())._now()).__minus(t);
  3149. return $1;
  3150. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},smalltalk.Date.klass)})},
  3151. args: ["aBlock"],
  3152. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^Date now - t",
  3153. messageSends: ["now", "value", "-"],
  3154. referencedClasses: ["Date"]
  3155. }),
  3156. smalltalk.Date.klass);
  3157. smalltalk.addMethod(
  3158. smalltalk.method({
  3159. selector: "new:",
  3160. category: 'instance creation',
  3161. fn: function (anObject){
  3162. var self=this;
  3163. return smalltalk.withContext(function($ctx1) {
  3164. return new Date(anObject);
  3165. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},smalltalk.Date.klass)})},
  3166. args: ["anObject"],
  3167. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3168. messageSends: [],
  3169. referencedClasses: []
  3170. }),
  3171. smalltalk.Date.klass);
  3172. smalltalk.addMethod(
  3173. smalltalk.method({
  3174. selector: "now",
  3175. category: 'instance creation',
  3176. fn: function (){
  3177. var self=this;
  3178. return smalltalk.withContext(function($ctx1) {
  3179. var $1;
  3180. $1=self._today();
  3181. return $1;
  3182. }, function($ctx1) {$ctx1.fill(self,"now",{},smalltalk.Date.klass)})},
  3183. args: [],
  3184. source: "now\x0a\x09^self today",
  3185. messageSends: ["today"],
  3186. referencedClasses: []
  3187. }),
  3188. smalltalk.Date.klass);
  3189. smalltalk.addMethod(
  3190. smalltalk.method({
  3191. selector: "today",
  3192. category: 'instance creation',
  3193. fn: function (){
  3194. var self=this;
  3195. return smalltalk.withContext(function($ctx1) {
  3196. var $1;
  3197. $1=self._new();
  3198. return $1;
  3199. }, function($ctx1) {$ctx1.fill(self,"today",{},smalltalk.Date.klass)})},
  3200. args: [],
  3201. source: "today\x0a\x09^self new",
  3202. messageSends: ["new"],
  3203. referencedClasses: []
  3204. }),
  3205. smalltalk.Date.klass);
  3206. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel-Objects');
  3207. smalltalk.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [Transcript show: 'This will be printed 5 times'; cr].\x0a\x09\x0a\x091 to: 5 do: [:aNumber| Transcript show: aNumber asString; cr].\x0a\x09\x0a\x091 to: 10 by: 2 do: [:aNumber| Transcript show: aNumber asString; cr].";
  3208. smalltalk.addMethod(
  3209. smalltalk.method({
  3210. selector: "&",
  3211. category: 'converting',
  3212. fn: function (aNumber){
  3213. var self=this;
  3214. return smalltalk.withContext(function($ctx1) {
  3215. return self & aNumber;
  3216. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},smalltalk.Number)})},
  3217. args: ["aNumber"],
  3218. source: "& aNumber\x0a\x09<return self & aNumber>",
  3219. messageSends: [],
  3220. referencedClasses: []
  3221. }),
  3222. smalltalk.Number);
  3223. smalltalk.addMethod(
  3224. smalltalk.method({
  3225. selector: "*",
  3226. category: 'arithmetic',
  3227. fn: function (aNumber){
  3228. var self=this;
  3229. return smalltalk.withContext(function($ctx1) {
  3230. return self * aNumber;
  3231. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},smalltalk.Number)})},
  3232. args: ["aNumber"],
  3233. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3234. messageSends: [],
  3235. referencedClasses: []
  3236. }),
  3237. smalltalk.Number);
  3238. smalltalk.addMethod(
  3239. smalltalk.method({
  3240. selector: "+",
  3241. category: 'arithmetic',
  3242. fn: function (aNumber){
  3243. var self=this;
  3244. return smalltalk.withContext(function($ctx1) {
  3245. return self + aNumber;
  3246. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},smalltalk.Number)})},
  3247. args: ["aNumber"],
  3248. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3249. messageSends: [],
  3250. referencedClasses: []
  3251. }),
  3252. smalltalk.Number);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "-",
  3256. category: 'arithmetic',
  3257. fn: function (aNumber){
  3258. var self=this;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. return self - aNumber;
  3261. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},smalltalk.Number)})},
  3262. args: ["aNumber"],
  3263. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3264. messageSends: [],
  3265. referencedClasses: []
  3266. }),
  3267. smalltalk.Number);
  3268. smalltalk.addMethod(
  3269. smalltalk.method({
  3270. selector: "/",
  3271. category: 'arithmetic',
  3272. fn: function (aNumber){
  3273. var self=this;
  3274. return smalltalk.withContext(function($ctx1) {
  3275. return self / aNumber;
  3276. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},smalltalk.Number)})},
  3277. args: ["aNumber"],
  3278. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3279. messageSends: [],
  3280. referencedClasses: []
  3281. }),
  3282. smalltalk.Number);
  3283. smalltalk.addMethod(
  3284. smalltalk.method({
  3285. selector: "<",
  3286. category: 'comparing',
  3287. fn: function (aNumber){
  3288. var self=this;
  3289. return smalltalk.withContext(function($ctx1) {
  3290. return self < aNumber;
  3291. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},smalltalk.Number)})},
  3292. args: ["aNumber"],
  3293. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3294. messageSends: [],
  3295. referencedClasses: []
  3296. }),
  3297. smalltalk.Number);
  3298. smalltalk.addMethod(
  3299. smalltalk.method({
  3300. selector: "<=",
  3301. category: 'comparing',
  3302. fn: function (aNumber){
  3303. var self=this;
  3304. return smalltalk.withContext(function($ctx1) {
  3305. return self <= aNumber;
  3306. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},smalltalk.Number)})},
  3307. args: ["aNumber"],
  3308. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3309. messageSends: [],
  3310. referencedClasses: []
  3311. }),
  3312. smalltalk.Number);
  3313. smalltalk.addMethod(
  3314. smalltalk.method({
  3315. selector: "=",
  3316. category: 'comparing',
  3317. fn: function (aNumber){
  3318. var self=this;
  3319. return smalltalk.withContext(function($ctx1) {
  3320. if(! aNumber._isNumber || ! aNumber._isNumber()) {
  3321. return false;
  3322. }
  3323. return Number(self) == aNumber
  3324. ;
  3325. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},smalltalk.Number)})},
  3326. args: ["aNumber"],
  3327. source: "= aNumber\x0a\x09<\x0a\x09\x09if(! aNumber._isNumber || ! aNumber._isNumber()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return Number(self) == aNumber\x0a\x09>",
  3328. messageSends: [],
  3329. referencedClasses: []
  3330. }),
  3331. smalltalk.Number);
  3332. smalltalk.addMethod(
  3333. smalltalk.method({
  3334. selector: ">",
  3335. category: 'comparing',
  3336. fn: function (aNumber){
  3337. var self=this;
  3338. return smalltalk.withContext(function($ctx1) {
  3339. return self > aNumber;
  3340. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},smalltalk.Number)})},
  3341. args: ["aNumber"],
  3342. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3343. messageSends: [],
  3344. referencedClasses: []
  3345. }),
  3346. smalltalk.Number);
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: ">=",
  3350. category: 'comparing',
  3351. fn: function (aNumber){
  3352. var self=this;
  3353. return smalltalk.withContext(function($ctx1) {
  3354. return self >= aNumber;
  3355. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},smalltalk.Number)})},
  3356. args: ["aNumber"],
  3357. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3358. messageSends: [],
  3359. referencedClasses: []
  3360. }),
  3361. smalltalk.Number);
  3362. smalltalk.addMethod(
  3363. smalltalk.method({
  3364. selector: "@",
  3365. category: 'converting',
  3366. fn: function (aNumber){
  3367. var self=this;
  3368. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3369. return smalltalk.withContext(function($ctx1) {
  3370. var $1;
  3371. $1=_st($Point())._x_y_(self,aNumber);
  3372. return $1;
  3373. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},smalltalk.Number)})},
  3374. args: ["aNumber"],
  3375. source: "@ aNumber\x0a\x09^Point x: self y: aNumber",
  3376. messageSends: ["x:y:"],
  3377. referencedClasses: ["Point"]
  3378. }),
  3379. smalltalk.Number);
  3380. smalltalk.addMethod(
  3381. smalltalk.method({
  3382. selector: "\x5c\x5c",
  3383. category: 'arithmetic',
  3384. fn: function (aNumber){
  3385. var self=this;
  3386. return smalltalk.withContext(function($ctx1) {
  3387. return self % aNumber;
  3388. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},smalltalk.Number)})},
  3389. args: ["aNumber"],
  3390. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3391. messageSends: [],
  3392. referencedClasses: []
  3393. }),
  3394. smalltalk.Number);
  3395. smalltalk.addMethod(
  3396. smalltalk.method({
  3397. selector: "abs",
  3398. category: 'arithmetic',
  3399. fn: function (){
  3400. var self=this;
  3401. return smalltalk.withContext(function($ctx1) {
  3402. return Math.abs(self);;
  3403. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},smalltalk.Number)})},
  3404. args: [],
  3405. source: "abs\x0a\x09<return Math.abs(self);>",
  3406. messageSends: [],
  3407. referencedClasses: []
  3408. }),
  3409. smalltalk.Number);
  3410. smalltalk.addMethod(
  3411. smalltalk.method({
  3412. selector: "asJSON",
  3413. category: 'converting',
  3414. fn: function (){
  3415. var self=this;
  3416. return smalltalk.withContext(function($ctx1) {
  3417. var $1;
  3418. $1=self;
  3419. return $1;
  3420. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Number)})},
  3421. args: [],
  3422. source: "asJSON\x0a\x09^self",
  3423. messageSends: [],
  3424. referencedClasses: []
  3425. }),
  3426. smalltalk.Number);
  3427. smalltalk.addMethod(
  3428. smalltalk.method({
  3429. selector: "asJavascript",
  3430. category: 'converting',
  3431. fn: function (){
  3432. var self=this;
  3433. return smalltalk.withContext(function($ctx1) {
  3434. var $1;
  3435. $1=_st("(".__comma(self._printString())).__comma(")");
  3436. return $1;
  3437. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Number)})},
  3438. args: [],
  3439. source: "asJavascript\x0a\x09^'(', self printString, ')'",
  3440. messageSends: [",", "printString"],
  3441. referencedClasses: []
  3442. }),
  3443. smalltalk.Number);
  3444. smalltalk.addMethod(
  3445. smalltalk.method({
  3446. selector: "asNumber",
  3447. category: 'converting',
  3448. fn: function (){
  3449. var self=this;
  3450. return smalltalk.withContext(function($ctx1) {
  3451. var $1;
  3452. $1=self;
  3453. return $1;
  3454. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.Number)})},
  3455. args: [],
  3456. source: "asNumber\x0a\x09^ self",
  3457. messageSends: [],
  3458. referencedClasses: []
  3459. }),
  3460. smalltalk.Number);
  3461. smalltalk.addMethod(
  3462. smalltalk.method({
  3463. selector: "asPoint",
  3464. category: 'converting',
  3465. fn: function (){
  3466. var self=this;
  3467. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  3468. return smalltalk.withContext(function($ctx1) {
  3469. var $1;
  3470. $1=_st($Point())._x_y_(self,self);
  3471. return $1;
  3472. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Number)})},
  3473. args: [],
  3474. source: "asPoint\x0a\x09^Point x: self y: self",
  3475. messageSends: ["x:y:"],
  3476. referencedClasses: ["Point"]
  3477. }),
  3478. smalltalk.Number);
  3479. smalltalk.addMethod(
  3480. smalltalk.method({
  3481. selector: "asString",
  3482. category: 'converting',
  3483. fn: function (){
  3484. var self=this;
  3485. return smalltalk.withContext(function($ctx1) {
  3486. return String(self) ;
  3487. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.Number)})},
  3488. args: [],
  3489. source: "asString\x0a\x09< return String(self) >",
  3490. messageSends: [],
  3491. referencedClasses: []
  3492. }),
  3493. smalltalk.Number);
  3494. smalltalk.addMethod(
  3495. smalltalk.method({
  3496. selector: "atRandom",
  3497. category: 'converting',
  3498. fn: function (){
  3499. var self=this;
  3500. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $1;
  3503. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3504. return $1;
  3505. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.Number)})},
  3506. args: [],
  3507. source: "atRandom\x0a\x09^(Random new next * self) truncated + 1",
  3508. messageSends: ["+", "truncated", "*", "next", "new"],
  3509. referencedClasses: ["Random"]
  3510. }),
  3511. smalltalk.Number);
  3512. smalltalk.addMethod(
  3513. smalltalk.method({
  3514. selector: "ceiling",
  3515. category: 'converting',
  3516. fn: function (){
  3517. var self=this;
  3518. return smalltalk.withContext(function($ctx1) {
  3519. return Math.ceil(self);;
  3520. return self}, function($ctx1) {$ctx1.fill(self,"ceiling",{},smalltalk.Number)})},
  3521. args: [],
  3522. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3523. messageSends: [],
  3524. referencedClasses: []
  3525. }),
  3526. smalltalk.Number);
  3527. smalltalk.addMethod(
  3528. smalltalk.method({
  3529. selector: "copy",
  3530. category: 'copying',
  3531. fn: function (){
  3532. var self=this;
  3533. return smalltalk.withContext(function($ctx1) {
  3534. var $1;
  3535. $1=self;
  3536. return $1;
  3537. }, function($ctx1) {$ctx1.fill(self,"copy",{},smalltalk.Number)})},
  3538. args: [],
  3539. source: "copy\x0a\x09^self",
  3540. messageSends: [],
  3541. referencedClasses: []
  3542. }),
  3543. smalltalk.Number);
  3544. smalltalk.addMethod(
  3545. smalltalk.method({
  3546. selector: "deepCopy",
  3547. category: 'copying',
  3548. fn: function (){
  3549. var self=this;
  3550. return smalltalk.withContext(function($ctx1) {
  3551. var $1;
  3552. $1=self._copy();
  3553. return $1;
  3554. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.Number)})},
  3555. args: [],
  3556. source: "deepCopy\x0a\x09^self copy",
  3557. messageSends: ["copy"],
  3558. referencedClasses: []
  3559. }),
  3560. smalltalk.Number);
  3561. smalltalk.addMethod(
  3562. smalltalk.method({
  3563. selector: "even",
  3564. category: 'testing',
  3565. fn: function (){
  3566. var self=this;
  3567. return smalltalk.withContext(function($ctx1) {
  3568. var $1;
  3569. $1=(0).__eq(self.__backslash_backslash((2)));
  3570. return $1;
  3571. }, function($ctx1) {$ctx1.fill(self,"even",{},smalltalk.Number)})},
  3572. args: [],
  3573. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3574. messageSends: ["=", "\x5c\x5c"],
  3575. referencedClasses: []
  3576. }),
  3577. smalltalk.Number);
  3578. smalltalk.addMethod(
  3579. smalltalk.method({
  3580. selector: "floor",
  3581. category: 'converting',
  3582. fn: function (){
  3583. var self=this;
  3584. return smalltalk.withContext(function($ctx1) {
  3585. return Math.floor(self);;
  3586. return self}, function($ctx1) {$ctx1.fill(self,"floor",{},smalltalk.Number)})},
  3587. args: [],
  3588. source: "floor\x0a\x09<return Math.floor(self);>",
  3589. messageSends: [],
  3590. referencedClasses: []
  3591. }),
  3592. smalltalk.Number);
  3593. smalltalk.addMethod(
  3594. smalltalk.method({
  3595. selector: "identityHash",
  3596. category: 'accessing',
  3597. fn: function (){
  3598. var self=this;
  3599. return smalltalk.withContext(function($ctx1) {
  3600. var $1;
  3601. $1=_st(self._asString()).__comma("n");
  3602. return $1;
  3603. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},smalltalk.Number)})},
  3604. args: [],
  3605. source: "identityHash\x0a\x09^self asString, 'n'",
  3606. messageSends: [",", "asString"],
  3607. referencedClasses: []
  3608. }),
  3609. smalltalk.Number);
  3610. smalltalk.addMethod(
  3611. smalltalk.method({
  3612. selector: "isImmutable",
  3613. category: 'testing',
  3614. fn: function (){
  3615. var self=this;
  3616. return smalltalk.withContext(function($ctx1) {
  3617. return true;
  3618. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Number)})},
  3619. args: [],
  3620. source: "isImmutable\x0a\x09^ true",
  3621. messageSends: [],
  3622. referencedClasses: []
  3623. }),
  3624. smalltalk.Number);
  3625. smalltalk.addMethod(
  3626. smalltalk.method({
  3627. selector: "isNumber",
  3628. category: 'testing',
  3629. fn: function (){
  3630. var self=this;
  3631. return smalltalk.withContext(function($ctx1) {
  3632. return true;
  3633. }, function($ctx1) {$ctx1.fill(self,"isNumber",{},smalltalk.Number)})},
  3634. args: [],
  3635. source: "isNumber\x0a\x09^true",
  3636. messageSends: [],
  3637. referencedClasses: []
  3638. }),
  3639. smalltalk.Number);
  3640. smalltalk.addMethod(
  3641. smalltalk.method({
  3642. selector: "isZero",
  3643. category: 'testing',
  3644. fn: function (){
  3645. var self=this;
  3646. return smalltalk.withContext(function($ctx1) {
  3647. var $1;
  3648. $1=self.__eq((0));
  3649. return $1;
  3650. }, function($ctx1) {$ctx1.fill(self,"isZero",{},smalltalk.Number)})},
  3651. args: [],
  3652. source: "isZero\x0a\x09^self = 0",
  3653. messageSends: ["="],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.Number);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "max:",
  3660. category: 'arithmetic',
  3661. fn: function (aNumber){
  3662. var self=this;
  3663. return smalltalk.withContext(function($ctx1) {
  3664. return Math.max(self, aNumber);;
  3665. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},smalltalk.Number)})},
  3666. args: ["aNumber"],
  3667. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3668. messageSends: [],
  3669. referencedClasses: []
  3670. }),
  3671. smalltalk.Number);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "min:",
  3675. category: 'arithmetic',
  3676. fn: function (aNumber){
  3677. var self=this;
  3678. return smalltalk.withContext(function($ctx1) {
  3679. return Math.min(self, aNumber);;
  3680. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},smalltalk.Number)})},
  3681. args: ["aNumber"],
  3682. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3683. messageSends: [],
  3684. referencedClasses: []
  3685. }),
  3686. smalltalk.Number);
  3687. smalltalk.addMethod(
  3688. smalltalk.method({
  3689. selector: "negated",
  3690. category: 'arithmetic',
  3691. fn: function (){
  3692. var self=this;
  3693. return smalltalk.withContext(function($ctx1) {
  3694. var $1;
  3695. $1=(0).__minus(self);
  3696. return $1;
  3697. }, function($ctx1) {$ctx1.fill(self,"negated",{},smalltalk.Number)})},
  3698. args: [],
  3699. source: "negated\x0a\x09^0 - self",
  3700. messageSends: ["-"],
  3701. referencedClasses: []
  3702. }),
  3703. smalltalk.Number);
  3704. smalltalk.addMethod(
  3705. smalltalk.method({
  3706. selector: "negative",
  3707. category: 'testing',
  3708. fn: function (){
  3709. var self=this;
  3710. return smalltalk.withContext(function($ctx1) {
  3711. var $1;
  3712. $1=self.__lt((0));
  3713. return $1;
  3714. }, function($ctx1) {$ctx1.fill(self,"negative",{},smalltalk.Number)})},
  3715. args: [],
  3716. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3717. messageSends: ["<"],
  3718. referencedClasses: []
  3719. }),
  3720. smalltalk.Number);
  3721. smalltalk.addMethod(
  3722. smalltalk.method({
  3723. selector: "odd",
  3724. category: 'testing',
  3725. fn: function (){
  3726. var self=this;
  3727. return smalltalk.withContext(function($ctx1) {
  3728. var $1;
  3729. $1=_st(self._even())._not();
  3730. return $1;
  3731. }, function($ctx1) {$ctx1.fill(self,"odd",{},smalltalk.Number)})},
  3732. args: [],
  3733. source: "odd\x0a\x09^ self even not",
  3734. messageSends: ["not", "even"],
  3735. referencedClasses: []
  3736. }),
  3737. smalltalk.Number);
  3738. smalltalk.addMethod(
  3739. smalltalk.method({
  3740. selector: "positive",
  3741. category: 'testing',
  3742. fn: function (){
  3743. var self=this;
  3744. return smalltalk.withContext(function($ctx1) {
  3745. var $1;
  3746. $1=self.__gt_eq((0));
  3747. return $1;
  3748. }, function($ctx1) {$ctx1.fill(self,"positive",{},smalltalk.Number)})},
  3749. args: [],
  3750. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  3751. messageSends: [">="],
  3752. referencedClasses: []
  3753. }),
  3754. smalltalk.Number);
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "printOn:",
  3758. category: 'printing',
  3759. fn: function (aStream){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. _st(aStream)._nextPutAll_(self._asString());
  3763. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Number)})},
  3764. args: ["aStream"],
  3765. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3766. messageSends: ["nextPutAll:", "asString"],
  3767. referencedClasses: []
  3768. }),
  3769. smalltalk.Number);
  3770. smalltalk.addMethod(
  3771. smalltalk.method({
  3772. selector: "printShowingDecimalPlaces:",
  3773. category: 'printing',
  3774. fn: function (placesDesired){
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. return self.toFixed(placesDesired);
  3778. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},smalltalk.Number)})},
  3779. args: ["placesDesired"],
  3780. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  3781. messageSends: [],
  3782. referencedClasses: []
  3783. }),
  3784. smalltalk.Number);
  3785. smalltalk.addMethod(
  3786. smalltalk.method({
  3787. selector: "rounded",
  3788. category: 'converting',
  3789. fn: function (){
  3790. var self=this;
  3791. return smalltalk.withContext(function($ctx1) {
  3792. return Math.round(self);;
  3793. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},smalltalk.Number)})},
  3794. args: [],
  3795. source: "rounded\x0a\x09<return Math.round(self);>",
  3796. messageSends: [],
  3797. referencedClasses: []
  3798. }),
  3799. smalltalk.Number);
  3800. smalltalk.addMethod(
  3801. smalltalk.method({
  3802. selector: "sqrt",
  3803. category: 'arithmetic',
  3804. fn: function (){
  3805. var self=this;
  3806. return smalltalk.withContext(function($ctx1) {
  3807. return Math.sqrt(self);
  3808. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},smalltalk.Number)})},
  3809. args: [],
  3810. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  3811. messageSends: [],
  3812. referencedClasses: []
  3813. }),
  3814. smalltalk.Number);
  3815. smalltalk.addMethod(
  3816. smalltalk.method({
  3817. selector: "squared",
  3818. category: 'arithmetic',
  3819. fn: function (){
  3820. var self=this;
  3821. return smalltalk.withContext(function($ctx1) {
  3822. var $1;
  3823. $1=self.__star(self);
  3824. return $1;
  3825. }, function($ctx1) {$ctx1.fill(self,"squared",{},smalltalk.Number)})},
  3826. args: [],
  3827. source: "squared\x0a\x09^self * self",
  3828. messageSends: ["*"],
  3829. referencedClasses: []
  3830. }),
  3831. smalltalk.Number);
  3832. smalltalk.addMethod(
  3833. smalltalk.method({
  3834. selector: "timesRepeat:",
  3835. category: 'enumerating',
  3836. fn: function (aBlock){
  3837. var self=this;
  3838. var count;
  3839. return smalltalk.withContext(function($ctx1) {
  3840. count=(1);
  3841. _st((function(){
  3842. return smalltalk.withContext(function($ctx2) {
  3843. return _st(count).__gt(self);
  3844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  3845. return smalltalk.withContext(function($ctx2) {
  3846. _st(aBlock)._value();
  3847. count=_st(count).__plus((1));
  3848. return count;
  3849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3850. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},smalltalk.Number)})},
  3851. args: ["aBlock"],
  3852. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1]",
  3853. messageSends: ["whileFalse:", ">", "value", "+"],
  3854. referencedClasses: []
  3855. }),
  3856. smalltalk.Number);
  3857. smalltalk.addMethod(
  3858. smalltalk.method({
  3859. selector: "to:",
  3860. category: 'converting',
  3861. fn: function (aNumber){
  3862. var self=this;
  3863. var array,first,last,count;
  3864. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3865. return smalltalk.withContext(function($ctx1) {
  3866. var $1;
  3867. first=self._truncated();
  3868. last=_st(_st(aNumber)._truncated()).__plus((1));
  3869. count=(1);
  3870. array=_st($Array())._new();
  3871. _st(_st(last).__minus(first))._timesRepeat_((function(){
  3872. return smalltalk.withContext(function($ctx2) {
  3873. _st(array)._at_put_(count,first);
  3874. count=_st(count).__plus((1));
  3875. count;
  3876. first=_st(first).__plus((1));
  3877. return first;
  3878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3879. $1=array;
  3880. return $1;
  3881. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},smalltalk.Number)})},
  3882. args: ["aNumber"],
  3883. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1].\x0a\x09^array",
  3884. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
  3885. referencedClasses: ["Array"]
  3886. }),
  3887. smalltalk.Number);
  3888. smalltalk.addMethod(
  3889. smalltalk.method({
  3890. selector: "to:by:",
  3891. category: 'converting',
  3892. fn: function (stop,step){
  3893. var self=this;
  3894. var array,value,pos;
  3895. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3896. return smalltalk.withContext(function($ctx1) {
  3897. var $1,$2,$3;
  3898. value=self;
  3899. array=_st($Array())._new();
  3900. pos=(1);
  3901. $1=_st(step).__eq((0));
  3902. if(smalltalk.assert($1)){
  3903. self._error_("step must be non-zero");
  3904. };
  3905. $2=_st(step).__lt((0));
  3906. if(smalltalk.assert($2)){
  3907. _st((function(){
  3908. return smalltalk.withContext(function($ctx2) {
  3909. return _st(value).__gt_eq(stop);
  3910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  3911. return smalltalk.withContext(function($ctx2) {
  3912. _st(array)._at_put_(pos,value);
  3913. pos=_st(pos).__plus((1));
  3914. pos;
  3915. value=_st(value).__plus(step);
  3916. return value;
  3917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3918. } else {
  3919. _st((function(){
  3920. return smalltalk.withContext(function($ctx2) {
  3921. return _st(value).__lt_eq(stop);
  3922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  3923. return smalltalk.withContext(function($ctx2) {
  3924. _st(array)._at_put_(pos,value);
  3925. pos=_st(pos).__plus((1));
  3926. pos;
  3927. value=_st(value).__plus(step);
  3928. return value;
  3929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  3930. };
  3931. $3=array;
  3932. return $3;
  3933. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},smalltalk.Number)})},
  3934. args: ["stop", "step"],
  3935. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step]].\x0a\x09^array",
  3936. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
  3937. referencedClasses: ["Array"]
  3938. }),
  3939. smalltalk.Number);
  3940. smalltalk.addMethod(
  3941. smalltalk.method({
  3942. selector: "to:by:do:",
  3943. category: 'enumerating',
  3944. fn: function (stop,step,aBlock){
  3945. var self=this;
  3946. var value;
  3947. return smalltalk.withContext(function($ctx1) {
  3948. var $1,$2;
  3949. value=self;
  3950. $1=_st(step).__eq((0));
  3951. if(smalltalk.assert($1)){
  3952. self._error_("step must be non-zero");
  3953. };
  3954. $2=_st(step).__lt((0));
  3955. if(smalltalk.assert($2)){
  3956. _st((function(){
  3957. return smalltalk.withContext(function($ctx2) {
  3958. return _st(value).__gt_eq(stop);
  3959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  3960. return smalltalk.withContext(function($ctx2) {
  3961. _st(aBlock)._value_(value);
  3962. value=_st(value).__plus(step);
  3963. return value;
  3964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  3965. } else {
  3966. _st((function(){
  3967. return smalltalk.withContext(function($ctx2) {
  3968. return _st(value).__lt_eq(stop);
  3969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  3970. return smalltalk.withContext(function($ctx2) {
  3971. _st(aBlock)._value_(value);
  3972. value=_st(value).__plus(step);
  3973. return value;
  3974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  3975. };
  3976. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},smalltalk.Number)})},
  3977. args: ["stop", "step", "aBlock"],
  3978. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [self error: 'step must be non-zero'].\x0a\x09step < 0\x0a\x09\x09ifTrue: [[ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]\x0a\x09\x09ifFalse: [[ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step]]",
  3979. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
  3980. referencedClasses: []
  3981. }),
  3982. smalltalk.Number);
  3983. smalltalk.addMethod(
  3984. smalltalk.method({
  3985. selector: "to:do:",
  3986. category: 'enumerating',
  3987. fn: function (stop,aBlock){
  3988. var self=this;
  3989. var nextValue;
  3990. return smalltalk.withContext(function($ctx1) {
  3991. nextValue=self;
  3992. _st((function(){
  3993. return smalltalk.withContext(function($ctx2) {
  3994. return _st(nextValue).__lt_eq(stop);
  3995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  3996. return smalltalk.withContext(function($ctx2) {
  3997. _st(aBlock)._value_(nextValue);
  3998. nextValue=_st(nextValue).__plus((1));
  3999. return nextValue;
  4000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4001. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},smalltalk.Number)})},
  4002. args: ["stop", "aBlock"],
  4003. 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]",
  4004. messageSends: ["whileTrue:", "<=", "value:", "+"],
  4005. referencedClasses: []
  4006. }),
  4007. smalltalk.Number);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "truncated",
  4011. category: 'converting',
  4012. fn: function (){
  4013. var self=this;
  4014. return smalltalk.withContext(function($ctx1) {
  4015. if(self >= 0) {
  4016. return Math.floor(self);
  4017. } else {
  4018. return Math.floor(self * (-1)) * (-1);
  4019. };
  4020. ;
  4021. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},smalltalk.Number)})},
  4022. args: [],
  4023. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  4024. messageSends: [],
  4025. referencedClasses: []
  4026. }),
  4027. smalltalk.Number);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "|",
  4031. category: 'converting',
  4032. fn: function (aNumber){
  4033. var self=this;
  4034. return smalltalk.withContext(function($ctx1) {
  4035. return self | aNumber;
  4036. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},smalltalk.Number)})},
  4037. args: ["aNumber"],
  4038. source: "| aNumber\x0a\x09<return self | aNumber>",
  4039. messageSends: [],
  4040. referencedClasses: []
  4041. }),
  4042. smalltalk.Number);
  4043. smalltalk.addMethod(
  4044. smalltalk.method({
  4045. selector: "heliosClass",
  4046. category: 'helios',
  4047. fn: function (){
  4048. var self=this;
  4049. return smalltalk.withContext(function($ctx1) {
  4050. return "magnitude";
  4051. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Number.klass)})},
  4052. args: [],
  4053. source: "heliosClass\x0a\x09^ 'magnitude'",
  4054. messageSends: [],
  4055. referencedClasses: []
  4056. }),
  4057. smalltalk.Number.klass);
  4058. smalltalk.addMethod(
  4059. smalltalk.method({
  4060. selector: "pi",
  4061. category: 'instance creation',
  4062. fn: function (){
  4063. var self=this;
  4064. return smalltalk.withContext(function($ctx1) {
  4065. return Math.PI;
  4066. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},smalltalk.Number.klass)})},
  4067. args: [],
  4068. source: "pi\x0a\x09<return Math.PI>",
  4069. messageSends: [],
  4070. referencedClasses: []
  4071. }),
  4072. smalltalk.Number.klass);
  4073. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  4074. smalltalk.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  4075. smalltalk.addMethod(
  4076. smalltalk.method({
  4077. selector: "*",
  4078. category: 'arithmetic',
  4079. fn: function (aPoint){
  4080. var self=this;
  4081. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4082. return smalltalk.withContext(function($ctx1) {
  4083. var $1;
  4084. $1=_st($Point())._x_y_(_st(self._x()).__star(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__star(_st(_st(aPoint)._asPoint())._y()));
  4085. return $1;
  4086. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},smalltalk.Point)})},
  4087. args: ["aPoint"],
  4088. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4089. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4090. referencedClasses: ["Point"]
  4091. }),
  4092. smalltalk.Point);
  4093. smalltalk.addMethod(
  4094. smalltalk.method({
  4095. selector: "+",
  4096. category: 'arithmetic',
  4097. fn: function (aPoint){
  4098. var self=this;
  4099. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4100. return smalltalk.withContext(function($ctx1) {
  4101. var $1;
  4102. $1=_st($Point())._x_y_(_st(self._x()).__plus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__plus(_st(_st(aPoint)._asPoint())._y()));
  4103. return $1;
  4104. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},smalltalk.Point)})},
  4105. args: ["aPoint"],
  4106. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4107. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4108. referencedClasses: ["Point"]
  4109. }),
  4110. smalltalk.Point);
  4111. smalltalk.addMethod(
  4112. smalltalk.method({
  4113. selector: "-",
  4114. category: 'arithmetic',
  4115. fn: function (aPoint){
  4116. var self=this;
  4117. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4118. return smalltalk.withContext(function($ctx1) {
  4119. var $1;
  4120. $1=_st($Point())._x_y_(_st(self._x()).__minus(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__minus(_st(_st(aPoint)._asPoint())._y()));
  4121. return $1;
  4122. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},smalltalk.Point)})},
  4123. args: ["aPoint"],
  4124. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4125. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4126. referencedClasses: ["Point"]
  4127. }),
  4128. smalltalk.Point);
  4129. smalltalk.addMethod(
  4130. smalltalk.method({
  4131. selector: "/",
  4132. category: 'arithmetic',
  4133. fn: function (aPoint){
  4134. var self=this;
  4135. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  4136. return smalltalk.withContext(function($ctx1) {
  4137. var $1;
  4138. $1=_st($Point())._x_y_(_st(self._x()).__slash(_st(_st(aPoint)._asPoint())._x()),_st(self._y()).__slash(_st(_st(aPoint)._asPoint())._y()));
  4139. return $1;
  4140. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},smalltalk.Point)})},
  4141. args: ["aPoint"],
  4142. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4143. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4144. referencedClasses: ["Point"]
  4145. }),
  4146. smalltalk.Point);
  4147. smalltalk.addMethod(
  4148. smalltalk.method({
  4149. selector: "=",
  4150. category: 'arithmetic',
  4151. fn: function (aPoint){
  4152. var self=this;
  4153. return smalltalk.withContext(function($ctx1) {
  4154. var $1;
  4155. $1=_st(_st(_st(aPoint)._class()).__eq(self._class()))._and_((function(){
  4156. return smalltalk.withContext(function($ctx2) {
  4157. return _st(_st(_st(aPoint)._x()).__eq(self._x())).__and(_st(_st(aPoint)._y()).__eq(self._y()));
  4158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4159. return $1;
  4160. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},smalltalk.Point)})},
  4161. args: ["aPoint"],
  4162. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  4163. messageSends: ["and:", "=", "class", "&", "x", "y"],
  4164. referencedClasses: []
  4165. }),
  4166. smalltalk.Point);
  4167. smalltalk.addMethod(
  4168. smalltalk.method({
  4169. selector: "asPoint",
  4170. category: 'converting',
  4171. fn: function (){
  4172. var self=this;
  4173. return smalltalk.withContext(function($ctx1) {
  4174. var $1;
  4175. $1=self;
  4176. return $1;
  4177. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},smalltalk.Point)})},
  4178. args: [],
  4179. source: "asPoint\x0a\x09^self",
  4180. messageSends: [],
  4181. referencedClasses: []
  4182. }),
  4183. smalltalk.Point);
  4184. smalltalk.addMethod(
  4185. smalltalk.method({
  4186. selector: "printOn:",
  4187. category: 'printing',
  4188. fn: function (aStream){
  4189. var self=this;
  4190. return smalltalk.withContext(function($ctx1) {
  4191. var $1;
  4192. _st(self["@x"])._printOn_(aStream);
  4193. _st(aStream)._nextPutAll_("@");
  4194. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  4195. return smalltalk.withContext(function($ctx2) {
  4196. return _st(self["@y"])._negative();
  4197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4198. if(smalltalk.assert($1)){
  4199. _st(aStream)._space();
  4200. };
  4201. _st(self["@y"])._printOn_(aStream);
  4202. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Point)})},
  4203. args: ["aStream"],
  4204. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [y negative]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  4205. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"],
  4206. referencedClasses: []
  4207. }),
  4208. smalltalk.Point);
  4209. smalltalk.addMethod(
  4210. smalltalk.method({
  4211. selector: "translateBy:",
  4212. category: 'transforming',
  4213. fn: function (delta){
  4214. var self=this;
  4215. return smalltalk.withContext(function($ctx1) {
  4216. var $1;
  4217. $1=_st(_st(_st(delta)._x()).__plus(self["@x"])).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4218. return $1;
  4219. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},smalltalk.Point)})},
  4220. args: ["delta"],
  4221. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  4222. messageSends: ["@", "+", "x", "y"],
  4223. referencedClasses: []
  4224. }),
  4225. smalltalk.Point);
  4226. smalltalk.addMethod(
  4227. smalltalk.method({
  4228. selector: "x",
  4229. category: 'accessing',
  4230. fn: function (){
  4231. var self=this;
  4232. return smalltalk.withContext(function($ctx1) {
  4233. var $1;
  4234. $1=self["@x"];
  4235. return $1;
  4236. }, function($ctx1) {$ctx1.fill(self,"x",{},smalltalk.Point)})},
  4237. args: [],
  4238. source: "x\x0a\x09^x",
  4239. messageSends: [],
  4240. referencedClasses: []
  4241. }),
  4242. smalltalk.Point);
  4243. smalltalk.addMethod(
  4244. smalltalk.method({
  4245. selector: "x:",
  4246. category: 'accessing',
  4247. fn: function (aNumber){
  4248. var self=this;
  4249. return smalltalk.withContext(function($ctx1) {
  4250. self["@x"]=aNumber;
  4251. return self}, function($ctx1) {$ctx1.fill(self,"x:",{aNumber:aNumber},smalltalk.Point)})},
  4252. args: ["aNumber"],
  4253. source: "x: aNumber\x0a\x09x := aNumber",
  4254. messageSends: [],
  4255. referencedClasses: []
  4256. }),
  4257. smalltalk.Point);
  4258. smalltalk.addMethod(
  4259. smalltalk.method({
  4260. selector: "y",
  4261. category: 'accessing',
  4262. fn: function (){
  4263. var self=this;
  4264. return smalltalk.withContext(function($ctx1) {
  4265. var $1;
  4266. $1=self["@y"];
  4267. return $1;
  4268. }, function($ctx1) {$ctx1.fill(self,"y",{},smalltalk.Point)})},
  4269. args: [],
  4270. source: "y\x0a\x09^y",
  4271. messageSends: [],
  4272. referencedClasses: []
  4273. }),
  4274. smalltalk.Point);
  4275. smalltalk.addMethod(
  4276. smalltalk.method({
  4277. selector: "y:",
  4278. category: 'accessing',
  4279. fn: function (aNumber){
  4280. var self=this;
  4281. return smalltalk.withContext(function($ctx1) {
  4282. self["@y"]=aNumber;
  4283. return self}, function($ctx1) {$ctx1.fill(self,"y:",{aNumber:aNumber},smalltalk.Point)})},
  4284. args: ["aNumber"],
  4285. source: "y: aNumber\x0a\x09y := aNumber",
  4286. messageSends: [],
  4287. referencedClasses: []
  4288. }),
  4289. smalltalk.Point);
  4290. smalltalk.addMethod(
  4291. smalltalk.method({
  4292. selector: "heliosClass",
  4293. category: 'helios',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.withContext(function($ctx1) {
  4297. return "magnitude";
  4298. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Point.klass)})},
  4299. args: [],
  4300. source: "heliosClass\x0a\x09^ 'magnitude'",
  4301. messageSends: [],
  4302. referencedClasses: []
  4303. }),
  4304. smalltalk.Point.klass);
  4305. smalltalk.addMethod(
  4306. smalltalk.method({
  4307. selector: "x:y:",
  4308. category: 'instance creation',
  4309. fn: function (aNumber,anotherNumber){
  4310. var self=this;
  4311. return smalltalk.withContext(function($ctx1) {
  4312. var $2,$3,$1;
  4313. $2=self._new();
  4314. _st($2)._x_(aNumber);
  4315. _st($2)._y_(anotherNumber);
  4316. $3=_st($2)._yourself();
  4317. $1=$3;
  4318. return $1;
  4319. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Point.klass)})},
  4320. args: ["aNumber", "anotherNumber"],
  4321. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4322. messageSends: ["x:", "new", "y:", "yourself"],
  4323. referencedClasses: []
  4324. }),
  4325. smalltalk.Point.klass);
  4326. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  4327. smalltalk.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  4328. smalltalk.addMethod(
  4329. smalltalk.method({
  4330. selector: "next",
  4331. category: 'accessing',
  4332. fn: function (){
  4333. var self=this;
  4334. return smalltalk.withContext(function($ctx1) {
  4335. return Math.random();
  4336. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Random)})},
  4337. args: [],
  4338. source: "next\x0a\x09<return Math.random()>",
  4339. messageSends: [],
  4340. referencedClasses: []
  4341. }),
  4342. smalltalk.Random);
  4343. smalltalk.addMethod(
  4344. smalltalk.method({
  4345. selector: "next:",
  4346. category: 'accessing',
  4347. fn: function (anInteger){
  4348. var self=this;
  4349. return smalltalk.withContext(function($ctx1) {
  4350. var $1;
  4351. $1=_st((1)._to_(anInteger))._collect_((function(each){
  4352. return smalltalk.withContext(function($ctx2) {
  4353. return self._next();
  4354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4355. return $1;
  4356. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},smalltalk.Random)})},
  4357. args: ["anInteger"],
  4358. source: "next: anInteger\x0a\x09^(1 to: anInteger) collect: [:each | self next]",
  4359. messageSends: ["collect:", "to:", "next"],
  4360. referencedClasses: []
  4361. }),
  4362. smalltalk.Random);
  4363. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4364. smalltalk.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "asJSON",
  4368. category: 'converting',
  4369. fn: function (){
  4370. var self=this;
  4371. return smalltalk.withContext(function($ctx1) {
  4372. var $1;
  4373. $1=null;
  4374. return $1;
  4375. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.UndefinedObject)})},
  4376. args: [],
  4377. source: "asJSON\x0a\x09^null",
  4378. messageSends: [],
  4379. referencedClasses: []
  4380. }),
  4381. smalltalk.UndefinedObject);
  4382. smalltalk.addMethod(
  4383. smalltalk.method({
  4384. selector: "deepCopy",
  4385. category: 'copying',
  4386. fn: function (){
  4387. var self=this;
  4388. return smalltalk.withContext(function($ctx1) {
  4389. var $1;
  4390. $1=self;
  4391. return $1;
  4392. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.UndefinedObject)})},
  4393. args: [],
  4394. source: "deepCopy\x0a\x09^self",
  4395. messageSends: [],
  4396. referencedClasses: []
  4397. }),
  4398. smalltalk.UndefinedObject);
  4399. smalltalk.addMethod(
  4400. smalltalk.method({
  4401. selector: "ifNil:",
  4402. category: 'testing',
  4403. fn: function (aBlock){
  4404. var self=this;
  4405. return smalltalk.withContext(function($ctx1) {
  4406. var $2,$1;
  4407. $2=self;
  4408. $1=_st($2)._ifNil_ifNotNil_(aBlock,(function(){
  4409. return smalltalk.withContext(function($ctx2) {
  4410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4411. return $1;
  4412. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  4413. args: ["aBlock"],
  4414. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4415. messageSends: ["ifNil:ifNotNil:"],
  4416. referencedClasses: []
  4417. }),
  4418. smalltalk.UndefinedObject);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "ifNil:ifNotNil:",
  4422. category: 'testing',
  4423. fn: function (aBlock,anotherBlock){
  4424. var self=this;
  4425. return smalltalk.withContext(function($ctx1) {
  4426. var $1;
  4427. $1=_st(aBlock)._value();
  4428. return $1;
  4429. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  4430. args: ["aBlock", "anotherBlock"],
  4431. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4432. messageSends: ["value"],
  4433. referencedClasses: []
  4434. }),
  4435. smalltalk.UndefinedObject);
  4436. smalltalk.addMethod(
  4437. smalltalk.method({
  4438. selector: "ifNotNil:",
  4439. category: 'testing',
  4440. fn: function (aBlock){
  4441. var self=this;
  4442. return smalltalk.withContext(function($ctx1) {
  4443. var $1;
  4444. $1=self;
  4445. return $1;
  4446. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},smalltalk.UndefinedObject)})},
  4447. args: ["aBlock"],
  4448. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4449. messageSends: [],
  4450. referencedClasses: []
  4451. }),
  4452. smalltalk.UndefinedObject);
  4453. smalltalk.addMethod(
  4454. smalltalk.method({
  4455. selector: "ifNotNil:ifNil:",
  4456. category: 'testing',
  4457. fn: function (aBlock,anotherBlock){
  4458. var self=this;
  4459. return smalltalk.withContext(function($ctx1) {
  4460. var $1;
  4461. $1=_st(anotherBlock)._value();
  4462. return $1;
  4463. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.UndefinedObject)})},
  4464. args: ["aBlock", "anotherBlock"],
  4465. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4466. messageSends: ["value"],
  4467. referencedClasses: []
  4468. }),
  4469. smalltalk.UndefinedObject);
  4470. smalltalk.addMethod(
  4471. smalltalk.method({
  4472. selector: "isImmutable",
  4473. category: 'testing',
  4474. fn: function (){
  4475. var self=this;
  4476. return smalltalk.withContext(function($ctx1) {
  4477. return true;
  4478. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.UndefinedObject)})},
  4479. args: [],
  4480. source: "isImmutable\x0a\x09^ true",
  4481. messageSends: [],
  4482. referencedClasses: []
  4483. }),
  4484. smalltalk.UndefinedObject);
  4485. smalltalk.addMethod(
  4486. smalltalk.method({
  4487. selector: "isNil",
  4488. category: 'testing',
  4489. fn: function (){
  4490. var self=this;
  4491. return smalltalk.withContext(function($ctx1) {
  4492. return true;
  4493. }, function($ctx1) {$ctx1.fill(self,"isNil",{},smalltalk.UndefinedObject)})},
  4494. args: [],
  4495. source: "isNil\x0a\x09^true",
  4496. messageSends: [],
  4497. referencedClasses: []
  4498. }),
  4499. smalltalk.UndefinedObject);
  4500. smalltalk.addMethod(
  4501. smalltalk.method({
  4502. selector: "notNil",
  4503. category: 'testing',
  4504. fn: function (){
  4505. var self=this;
  4506. return smalltalk.withContext(function($ctx1) {
  4507. return false;
  4508. }, function($ctx1) {$ctx1.fill(self,"notNil",{},smalltalk.UndefinedObject)})},
  4509. args: [],
  4510. source: "notNil\x0a\x09^false",
  4511. messageSends: [],
  4512. referencedClasses: []
  4513. }),
  4514. smalltalk.UndefinedObject);
  4515. smalltalk.addMethod(
  4516. smalltalk.method({
  4517. selector: "printOn:",
  4518. category: 'printing',
  4519. fn: function (aStream){
  4520. var self=this;
  4521. return smalltalk.withContext(function($ctx1) {
  4522. _st(aStream)._nextPutAll_("nil");
  4523. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.UndefinedObject)})},
  4524. args: ["aStream"],
  4525. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  4526. messageSends: ["nextPutAll:"],
  4527. referencedClasses: []
  4528. }),
  4529. smalltalk.UndefinedObject);
  4530. smalltalk.addMethod(
  4531. smalltalk.method({
  4532. selector: "shallowCopy",
  4533. category: 'copying',
  4534. fn: function (){
  4535. var self=this;
  4536. return smalltalk.withContext(function($ctx1) {
  4537. var $1;
  4538. $1=self;
  4539. return $1;
  4540. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.UndefinedObject)})},
  4541. args: [],
  4542. source: "shallowCopy\x0a\x09^self",
  4543. messageSends: [],
  4544. referencedClasses: []
  4545. }),
  4546. smalltalk.UndefinedObject);
  4547. smalltalk.addMethod(
  4548. smalltalk.method({
  4549. selector: "subclass:instanceVariableNames:",
  4550. category: 'class creation',
  4551. fn: function (aString,anotherString){
  4552. var self=this;
  4553. return smalltalk.withContext(function($ctx1) {
  4554. var $1;
  4555. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  4556. return $1;
  4557. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.UndefinedObject)})},
  4558. args: ["aString", "anotherString"],
  4559. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4560. messageSends: ["subclass:instanceVariableNames:package:"],
  4561. referencedClasses: []
  4562. }),
  4563. smalltalk.UndefinedObject);
  4564. smalltalk.addMethod(
  4565. smalltalk.method({
  4566. selector: "subclass:instanceVariableNames:category:",
  4567. category: 'class creation',
  4568. fn: function (aString,aString2,aString3){
  4569. var self=this;
  4570. return smalltalk.withContext(function($ctx1) {
  4571. var $1;
  4572. self._deprecatedAPI();
  4573. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  4574. return $1;
  4575. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  4576. args: ["aString", "aString2", "aString3"],
  4577. 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",
  4578. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4579. referencedClasses: []
  4580. }),
  4581. smalltalk.UndefinedObject);
  4582. smalltalk.addMethod(
  4583. smalltalk.method({
  4584. selector: "subclass:instanceVariableNames:package:",
  4585. category: 'class creation',
  4586. fn: function (aString,aString2,aString3){
  4587. var self=this;
  4588. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  4589. return smalltalk.withContext(function($ctx1) {
  4590. var $1;
  4591. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  4592. return $1;
  4593. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.UndefinedObject)})},
  4594. args: ["aString", "aString2", "aString3"],
  4595. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4596. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  4597. referencedClasses: ["ClassBuilder"]
  4598. }),
  4599. smalltalk.UndefinedObject);
  4600. smalltalk.addMethod(
  4601. smalltalk.method({
  4602. selector: "new",
  4603. category: 'instance creation',
  4604. fn: function (){
  4605. var self=this;
  4606. return smalltalk.withContext(function($ctx1) {
  4607. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  4608. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObject.klass)})},
  4609. args: [],
  4610. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4611. messageSends: ["error:"],
  4612. referencedClasses: []
  4613. }),
  4614. smalltalk.UndefinedObject.klass);
  4615. });
  4616. define("amber_core/Kernel-Classes", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  4617. smalltalk.addPackage('Kernel-Classes');
  4618. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4619. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  4620. smalltalk.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  4621. smalltalk.addMethod(
  4622. smalltalk.method({
  4623. selector: ">>",
  4624. category: 'accessing',
  4625. fn: function (aString){
  4626. var self=this;
  4627. return smalltalk.withContext(function($ctx1) {
  4628. var $1;
  4629. $1=self._methodAt_(aString);
  4630. return $1;
  4631. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},smalltalk.Behavior)})},
  4632. args: ["aString"],
  4633. source: ">> aString\x0a\x09^ self methodAt: aString",
  4634. messageSends: ["methodAt:"],
  4635. referencedClasses: []
  4636. }),
  4637. smalltalk.Behavior);
  4638. smalltalk.addMethod(
  4639. smalltalk.method({
  4640. selector: "addCompiledMethod:",
  4641. category: 'compiling',
  4642. fn: function (aMethod){
  4643. var self=this;
  4644. var oldMethod,announcement;
  4645. function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  4646. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  4647. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4648. return smalltalk.withContext(function($ctx1) {
  4649. var $1,$2,$3,$4,$5,$6;
  4650. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  4651. return smalltalk.withContext(function($ctx2) {
  4652. return nil;
  4653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4654. $1=_st(self._protocols())._includes_(_st(aMethod)._protocol());
  4655. if(! smalltalk.assert($1)){
  4656. _st(self._organization())._addElement_(_st(aMethod)._protocol());
  4657. };
  4658. self._basicAddCompiledMethod_(aMethod);
  4659. $2=oldMethod;
  4660. if(($receiver = $2) == nil || $receiver == null){
  4661. $3=_st($MethodAdded())._new();
  4662. _st($3)._method_(aMethod);
  4663. $4=_st($3)._yourself();
  4664. announcement=$4;
  4665. } else {
  4666. $5=_st($MethodModified())._new();
  4667. _st($5)._oldMethod_(oldMethod);
  4668. _st($5)._method_(aMethod);
  4669. $6=_st($5)._yourself();
  4670. announcement=$6;
  4671. };
  4672. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  4673. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})},
  4674. args: ["aMethod"],
  4675. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  4676. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  4677. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  4678. }),
  4679. smalltalk.Behavior);
  4680. smalltalk.addMethod(
  4681. smalltalk.method({
  4682. selector: "allInstanceVariableNames",
  4683. category: 'accessing',
  4684. fn: function (){
  4685. var self=this;
  4686. var result;
  4687. return smalltalk.withContext(function($ctx1) {
  4688. var $1,$2;
  4689. result=_st(self._instanceVariableNames())._copy();
  4690. $1=self._superclass();
  4691. if(($receiver = $1) == nil || $receiver == null){
  4692. $1;
  4693. } else {
  4694. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  4695. };
  4696. $2=result;
  4697. return $2;
  4698. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})},
  4699. args: [],
  4700. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  4701. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
  4702. referencedClasses: []
  4703. }),
  4704. smalltalk.Behavior);
  4705. smalltalk.addMethod(
  4706. smalltalk.method({
  4707. selector: "allSelectors",
  4708. category: 'accessing',
  4709. fn: function (){
  4710. var self=this;
  4711. return smalltalk.withContext(function($ctx1) {
  4712. var $2,$3,$1;
  4713. $1=_st(self._allSuperclasses())._inject_into_(self._selectors(),(function(acc,each){
  4714. return smalltalk.withContext(function($ctx2) {
  4715. $2=acc;
  4716. _st($2)._addAll_(_st(each)._selectors());
  4717. $3=_st($2)._yourself();
  4718. return $3;
  4719. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})}));
  4720. return $1;
  4721. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
  4722. args: [],
  4723. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  4724. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"],
  4725. referencedClasses: []
  4726. }),
  4727. smalltalk.Behavior);
  4728. smalltalk.addMethod(
  4729. smalltalk.method({
  4730. selector: "allSubclasses",
  4731. category: 'accessing',
  4732. fn: function (){
  4733. var self=this;
  4734. var subclasses,index;
  4735. return smalltalk.withContext(function($ctx1) {
  4736. var $1;
  4737. subclasses=self._subclasses();
  4738. index=(1);
  4739. _st((function(){
  4740. return smalltalk.withContext(function($ctx2) {
  4741. return _st(index).__gt(_st(subclasses)._size());
  4742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  4743. return smalltalk.withContext(function($ctx2) {
  4744. _st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
  4745. index=_st(index).__plus((1));
  4746. return index;
  4747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4748. $1=subclasses;
  4749. return $1;
  4750. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},smalltalk.Behavior)})},
  4751. args: [],
  4752. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  4753. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"],
  4754. referencedClasses: []
  4755. }),
  4756. smalltalk.Behavior);
  4757. smalltalk.addMethod(
  4758. smalltalk.method({
  4759. selector: "allSubclassesDo:",
  4760. category: 'enumerating',
  4761. fn: function (aBlock){
  4762. var self=this;
  4763. return smalltalk.withContext(function($ctx1) {
  4764. _st(self._allSubclasses())._do_((function(each){
  4765. return smalltalk.withContext(function($ctx2) {
  4766. return _st(aBlock)._value_(each);
  4767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4768. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
  4769. args: ["aBlock"],
  4770. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  4771. messageSends: ["do:", "allSubclasses", "value:"],
  4772. referencedClasses: []
  4773. }),
  4774. smalltalk.Behavior);
  4775. smalltalk.addMethod(
  4776. smalltalk.method({
  4777. selector: "allSuperclasses",
  4778. category: 'accessing',
  4779. fn: function (){
  4780. var self=this;
  4781. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  4782. return smalltalk.withContext(function($ctx1) {
  4783. var $1,$2,$4,$5,$3;
  4784. $1=self._superclass();
  4785. if(($receiver = $1) == nil || $receiver == null){
  4786. $2=[];
  4787. return $2;
  4788. } else {
  4789. $1;
  4790. };
  4791. $4=_st($OrderedCollection())._with_(self._superclass());
  4792. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  4793. $5=_st($4)._yourself();
  4794. $3=$5;
  4795. return $3;
  4796. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})},
  4797. args: [],
  4798. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  4799. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"],
  4800. referencedClasses: ["OrderedCollection"]
  4801. }),
  4802. smalltalk.Behavior);
  4803. smalltalk.addMethod(
  4804. smalltalk.method({
  4805. selector: "basicAddCompiledMethod:",
  4806. category: 'private',
  4807. fn: function (aMethod){
  4808. var self=this;
  4809. return smalltalk.withContext(function($ctx1) {
  4810. smalltalk.addMethod(aMethod, self);
  4811. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  4812. args: ["aMethod"],
  4813. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  4814. messageSends: [],
  4815. referencedClasses: []
  4816. }),
  4817. smalltalk.Behavior);
  4818. smalltalk.addMethod(
  4819. smalltalk.method({
  4820. selector: "basicNew",
  4821. category: 'instance creation',
  4822. fn: function (){
  4823. var self=this;
  4824. return smalltalk.withContext(function($ctx1) {
  4825. return new self.fn();
  4826. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
  4827. args: [],
  4828. source: "basicNew\x0a\x09<return new self.fn()>",
  4829. messageSends: [],
  4830. referencedClasses: []
  4831. }),
  4832. smalltalk.Behavior);
  4833. smalltalk.addMethod(
  4834. smalltalk.method({
  4835. selector: "basicRemoveCompiledMethod:",
  4836. category: 'private',
  4837. fn: function (aMethod){
  4838. var self=this;
  4839. return smalltalk.withContext(function($ctx1) {
  4840. smalltalk.removeMethod(aMethod,self);
  4841. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  4842. args: ["aMethod"],
  4843. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  4844. messageSends: [],
  4845. referencedClasses: []
  4846. }),
  4847. smalltalk.Behavior);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "canUnderstand:",
  4851. category: 'testing',
  4852. fn: function (aSelector){
  4853. var self=this;
  4854. return smalltalk.withContext(function($ctx1) {
  4855. var $1;
  4856. $1=_st(_st(_st(self._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  4857. return smalltalk.withContext(function($ctx2) {
  4858. return _st(_st(self._superclass())._notNil())._and_((function(){
  4859. return smalltalk.withContext(function($ctx3) {
  4860. return _st(self._superclass())._canUnderstand_(aSelector);
  4861. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  4862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4863. return $1;
  4864. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
  4865. args: ["aSelector"],
  4866. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  4867. messageSends: ["or:", "includes:", "keys", "methodDictionary", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
  4868. referencedClasses: []
  4869. }),
  4870. smalltalk.Behavior);
  4871. smalltalk.addMethod(
  4872. smalltalk.method({
  4873. selector: "comment",
  4874. category: 'accessing',
  4875. fn: function (){
  4876. var self=this;
  4877. return smalltalk.withContext(function($ctx1) {
  4878. var $2,$1;
  4879. $2=self._basicAt_("comment");
  4880. if(($receiver = $2) == nil || $receiver == null){
  4881. $1="";
  4882. } else {
  4883. $1=$2;
  4884. };
  4885. return $1;
  4886. }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
  4887. args: [],
  4888. source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
  4889. messageSends: ["ifNil:", "basicAt:"],
  4890. referencedClasses: []
  4891. }),
  4892. smalltalk.Behavior);
  4893. smalltalk.addMethod(
  4894. smalltalk.method({
  4895. selector: "comment:",
  4896. category: 'accessing',
  4897. fn: function (aString){
  4898. var self=this;
  4899. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  4900. function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  4901. return smalltalk.withContext(function($ctx1) {
  4902. var $1,$2;
  4903. self._basicAt_put_("comment",aString);
  4904. $1=_st($ClassCommentChanged())._new();
  4905. _st($1)._theClass_(self);
  4906. $2=_st($1)._yourself();
  4907. _st(_st($SystemAnnouncer())._current())._announce_($2);
  4908. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})},
  4909. args: ["aString"],
  4910. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  4911. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"],
  4912. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"]
  4913. }),
  4914. smalltalk.Behavior);
  4915. smalltalk.addMethod(
  4916. smalltalk.method({
  4917. selector: "commentStamp",
  4918. category: 'accessing',
  4919. fn: function (){
  4920. var self=this;
  4921. function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  4922. return smalltalk.withContext(function($ctx1) {
  4923. var $2,$3,$1;
  4924. $2=_st($ClassCommentReader())._new();
  4925. _st($2)._class_(self);
  4926. $3=_st($2)._yourself();
  4927. $1=$3;
  4928. return $1;
  4929. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
  4930. args: [],
  4931. source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  4932. messageSends: ["class:", "new", "yourself"],
  4933. referencedClasses: ["ClassCommentReader"]
  4934. }),
  4935. smalltalk.Behavior);
  4936. smalltalk.addMethod(
  4937. smalltalk.method({
  4938. selector: "commentStamp:prior:",
  4939. category: 'accessing',
  4940. fn: function (aStamp,prior){
  4941. var self=this;
  4942. return smalltalk.withContext(function($ctx1) {
  4943. var $1;
  4944. $1=self._commentStamp();
  4945. return $1;
  4946. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
  4947. args: ["aStamp", "prior"],
  4948. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
  4949. messageSends: ["commentStamp"],
  4950. referencedClasses: []
  4951. }),
  4952. smalltalk.Behavior);
  4953. smalltalk.addMethod(
  4954. smalltalk.method({
  4955. selector: "compile:",
  4956. category: 'compiling',
  4957. fn: function (aString){
  4958. var self=this;
  4959. return smalltalk.withContext(function($ctx1) {
  4960. var $1;
  4961. $1=self._compile_category_(aString,"");
  4962. return $1;
  4963. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
  4964. args: ["aString"],
  4965. source: "compile: aString\x0a\x09^ self compile: aString category: ''",
  4966. messageSends: ["compile:category:"],
  4967. referencedClasses: []
  4968. }),
  4969. smalltalk.Behavior);
  4970. smalltalk.addMethod(
  4971. smalltalk.method({
  4972. selector: "compile:category:",
  4973. category: 'compiling',
  4974. fn: function (aString,anotherString){
  4975. var self=this;
  4976. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  4977. return smalltalk.withContext(function($ctx1) {
  4978. var $1;
  4979. $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
  4980. return $1;
  4981. }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
  4982. args: ["aString", "anotherString"],
  4983. source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
  4984. messageSends: ["install:forClass:category:", "new"],
  4985. referencedClasses: ["Compiler"]
  4986. }),
  4987. smalltalk.Behavior);
  4988. smalltalk.addMethod(
  4989. smalltalk.method({
  4990. selector: "definition",
  4991. category: 'accessing',
  4992. fn: function (){
  4993. var self=this;
  4994. return smalltalk.withContext(function($ctx1) {
  4995. return "";
  4996. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
  4997. args: [],
  4998. source: "definition\x0a\x09^ ''",
  4999. messageSends: [],
  5000. referencedClasses: []
  5001. }),
  5002. smalltalk.Behavior);
  5003. smalltalk.addMethod(
  5004. smalltalk.method({
  5005. selector: "includesBehavior:",
  5006. category: 'testing',
  5007. fn: function (aClass){
  5008. var self=this;
  5009. return smalltalk.withContext(function($ctx1) {
  5010. var $1;
  5011. $1=_st(self.__eq_eq(aClass))._or_((function(){
  5012. return smalltalk.withContext(function($ctx2) {
  5013. return self._inheritsFrom_(aClass);
  5014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5015. return $1;
  5016. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
  5017. args: ["aClass"],
  5018. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5019. messageSends: ["or:", "==", "inheritsFrom:"],
  5020. referencedClasses: []
  5021. }),
  5022. smalltalk.Behavior);
  5023. smalltalk.addMethod(
  5024. smalltalk.method({
  5025. selector: "includesSelector:",
  5026. category: 'testing',
  5027. fn: function (aString){
  5028. var self=this;
  5029. return smalltalk.withContext(function($ctx1) {
  5030. var $1;
  5031. $1=_st(self._methodDictionary())._includesKey_(aString);
  5032. return $1;
  5033. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
  5034. args: ["aString"],
  5035. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5036. messageSends: ["includesKey:", "methodDictionary"],
  5037. referencedClasses: []
  5038. }),
  5039. smalltalk.Behavior);
  5040. smalltalk.addMethod(
  5041. smalltalk.method({
  5042. selector: "inheritsFrom:",
  5043. category: 'testing',
  5044. fn: function (aClass){
  5045. var self=this;
  5046. return smalltalk.withContext(function($ctx1) {
  5047. var $1,$2;
  5048. $1=self._superclass();
  5049. if(($receiver = $1) == nil || $receiver == null){
  5050. return false;
  5051. } else {
  5052. $1;
  5053. };
  5054. $2=_st(_st(aClass).__eq_eq(self._superclass()))._or_((function(){
  5055. return smalltalk.withContext(function($ctx2) {
  5056. return _st(self._superclass())._inheritsFrom_(aClass);
  5057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5058. return $2;
  5059. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
  5060. args: ["aClass"],
  5061. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5062. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"],
  5063. referencedClasses: []
  5064. }),
  5065. smalltalk.Behavior);
  5066. smalltalk.addMethod(
  5067. smalltalk.method({
  5068. selector: "instanceVariableNames",
  5069. category: 'accessing',
  5070. fn: function (){
  5071. var self=this;
  5072. return smalltalk.withContext(function($ctx1) {
  5073. return self.iVarNames;
  5074. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
  5075. args: [],
  5076. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5077. messageSends: [],
  5078. referencedClasses: []
  5079. }),
  5080. smalltalk.Behavior);
  5081. smalltalk.addMethod(
  5082. smalltalk.method({
  5083. selector: "isBehavior",
  5084. category: 'testing',
  5085. fn: function (){
  5086. var self=this;
  5087. return smalltalk.withContext(function($ctx1) {
  5088. return true;
  5089. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
  5090. args: [],
  5091. source: "isBehavior\x0a\x09^ true",
  5092. messageSends: [],
  5093. referencedClasses: []
  5094. }),
  5095. smalltalk.Behavior);
  5096. smalltalk.addMethod(
  5097. smalltalk.method({
  5098. selector: "lookupSelector:",
  5099. category: 'accessing',
  5100. fn: function (selector){
  5101. var self=this;
  5102. var lookupClass;
  5103. return smalltalk.withContext(function($ctx1) {
  5104. var $1,$2;
  5105. var $early={};
  5106. try {
  5107. lookupClass=self;
  5108. _st((function(){
  5109. return smalltalk.withContext(function($ctx2) {
  5110. return _st(lookupClass).__eq(nil);
  5111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5112. return smalltalk.withContext(function($ctx2) {
  5113. $1=_st(lookupClass)._includesSelector_(selector);
  5114. if(smalltalk.assert($1)){
  5115. $2=_st(lookupClass)._methodAt_(selector);
  5116. throw $early=[$2];
  5117. };
  5118. lookupClass=_st(lookupClass)._superclass();
  5119. return lookupClass;
  5120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5121. return nil;
  5122. }
  5123. catch(e) {if(e===$early)return e[0]; throw e}
  5124. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})},
  5125. args: ["selector"],
  5126. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  5127. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"],
  5128. referencedClasses: []
  5129. }),
  5130. smalltalk.Behavior);
  5131. smalltalk.addMethod(
  5132. smalltalk.method({
  5133. selector: "methodAt:",
  5134. category: 'accessing',
  5135. fn: function (aString){
  5136. var self=this;
  5137. return smalltalk.withContext(function($ctx1) {
  5138. var $1;
  5139. $1=_st(self._methodDictionary())._at_(aString);
  5140. return $1;
  5141. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
  5142. args: ["aString"],
  5143. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5144. messageSends: ["at:", "methodDictionary"],
  5145. referencedClasses: []
  5146. }),
  5147. smalltalk.Behavior);
  5148. smalltalk.addMethod(
  5149. smalltalk.method({
  5150. selector: "methodDictionary",
  5151. category: 'accessing',
  5152. fn: function (){
  5153. var self=this;
  5154. return smalltalk.withContext(function($ctx1) {
  5155. var dict = smalltalk.HashedCollection._new();
  5156. var methods = self.methods;
  5157. for(var i in methods) {
  5158. if(methods[i].selector) {
  5159. dict._at_put_(methods[i].selector, methods[i]);
  5160. }
  5161. };
  5162. return dict;
  5163. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
  5164. args: [],
  5165. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09for(var i in methods) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09};\x0a\x09return dict>",
  5166. messageSends: [],
  5167. referencedClasses: []
  5168. }),
  5169. smalltalk.Behavior);
  5170. smalltalk.addMethod(
  5171. smalltalk.method({
  5172. selector: "methods",
  5173. category: 'accessing',
  5174. fn: function (){
  5175. var self=this;
  5176. return smalltalk.withContext(function($ctx1) {
  5177. var $1;
  5178. $1=_st(self._methodDictionary())._values();
  5179. return $1;
  5180. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
  5181. args: [],
  5182. source: "methods\x0a\x09^ self methodDictionary values",
  5183. messageSends: ["values", "methodDictionary"],
  5184. referencedClasses: []
  5185. }),
  5186. smalltalk.Behavior);
  5187. smalltalk.addMethod(
  5188. smalltalk.method({
  5189. selector: "methodsFor:",
  5190. category: 'accessing',
  5191. fn: function (aString){
  5192. var self=this;
  5193. function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  5194. return smalltalk.withContext(function($ctx1) {
  5195. var $2,$3,$1;
  5196. $2=_st($ClassCategoryReader())._new();
  5197. _st($2)._class_category_(self,aString);
  5198. $3=_st($2)._yourself();
  5199. $1=$3;
  5200. return $1;
  5201. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
  5202. args: ["aString"],
  5203. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  5204. messageSends: ["class:category:", "new", "yourself"],
  5205. referencedClasses: ["ClassCategoryReader"]
  5206. }),
  5207. smalltalk.Behavior);
  5208. smalltalk.addMethod(
  5209. smalltalk.method({
  5210. selector: "methodsFor:stamp:",
  5211. category: 'accessing',
  5212. fn: function (aString,aStamp){
  5213. var self=this;
  5214. return smalltalk.withContext(function($ctx1) {
  5215. var $1;
  5216. $1=self._methodsFor_(aString);
  5217. return $1;
  5218. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
  5219. args: ["aString", "aStamp"],
  5220. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  5221. messageSends: ["methodsFor:"],
  5222. referencedClasses: []
  5223. }),
  5224. smalltalk.Behavior);
  5225. smalltalk.addMethod(
  5226. smalltalk.method({
  5227. selector: "methodsInProtocol:",
  5228. category: 'accessing',
  5229. fn: function (aString){
  5230. var self=this;
  5231. return smalltalk.withContext(function($ctx1) {
  5232. var $1;
  5233. $1=_st(_st(self._methodDictionary())._values())._select_((function(each){
  5234. return smalltalk.withContext(function($ctx2) {
  5235. return _st(_st(each)._protocol()).__eq(aString);
  5236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5237. return $1;
  5238. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
  5239. args: ["aString"],
  5240. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  5241. messageSends: ["select:", "values", "methodDictionary", "=", "protocol"],
  5242. referencedClasses: []
  5243. }),
  5244. smalltalk.Behavior);
  5245. smalltalk.addMethod(
  5246. smalltalk.method({
  5247. selector: "name",
  5248. category: 'accessing',
  5249. fn: function (){
  5250. var self=this;
  5251. return smalltalk.withContext(function($ctx1) {
  5252. return self.className || nil;
  5253. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
  5254. args: [],
  5255. source: "name\x0a\x09<return self.className || nil>",
  5256. messageSends: [],
  5257. referencedClasses: []
  5258. }),
  5259. smalltalk.Behavior);
  5260. smalltalk.addMethod(
  5261. smalltalk.method({
  5262. selector: "new",
  5263. category: 'instance creation',
  5264. fn: function (){
  5265. var self=this;
  5266. return smalltalk.withContext(function($ctx1) {
  5267. var $1;
  5268. $1=_st(self._basicNew())._initialize();
  5269. return $1;
  5270. }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
  5271. args: [],
  5272. source: "new\x0a\x09^self basicNew initialize",
  5273. messageSends: ["initialize", "basicNew"],
  5274. referencedClasses: []
  5275. }),
  5276. smalltalk.Behavior);
  5277. smalltalk.addMethod(
  5278. smalltalk.method({
  5279. selector: "organization",
  5280. category: 'accessing',
  5281. fn: function (){
  5282. var self=this;
  5283. return smalltalk.withContext(function($ctx1) {
  5284. var $1;
  5285. $1=self._basicAt_("organization");
  5286. return $1;
  5287. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
  5288. args: [],
  5289. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5290. messageSends: ["basicAt:"],
  5291. referencedClasses: []
  5292. }),
  5293. smalltalk.Behavior);
  5294. smalltalk.addMethod(
  5295. smalltalk.method({
  5296. selector: "ownMethods",
  5297. category: 'accessing',
  5298. fn: function (){
  5299. var self=this;
  5300. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5301. return smalltalk.withContext(function($ctx1) {
  5302. var $1;
  5303. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  5304. return smalltalk.withContext(function($ctx2) {
  5305. return _st(acc).__comma(self._methodsInProtocol_(each));
  5306. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})})))._sorted_((function(a,b){
  5307. return smalltalk.withContext(function($ctx2) {
  5308. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  5309. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}));
  5310. return $1;
  5311. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},smalltalk.Behavior)})},
  5312. args: [],
  5313. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  5314. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"],
  5315. referencedClasses: ["OrderedCollection"]
  5316. }),
  5317. smalltalk.Behavior);
  5318. smalltalk.addMethod(
  5319. smalltalk.method({
  5320. selector: "ownProtocols",
  5321. category: 'accessing',
  5322. fn: function (){
  5323. var self=this;
  5324. return smalltalk.withContext(function($ctx1) {
  5325. var $1;
  5326. $1=_st(self._protocols())._reject_((function(each){
  5327. return smalltalk.withContext(function($ctx2) {
  5328. return _st(each)._match_("^\x5c*");
  5329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5330. return $1;
  5331. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},smalltalk.Behavior)})},
  5332. args: [],
  5333. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  5334. messageSends: ["reject:", "protocols", "match:"],
  5335. referencedClasses: []
  5336. }),
  5337. smalltalk.Behavior);
  5338. smalltalk.addMethod(
  5339. smalltalk.method({
  5340. selector: "protocols",
  5341. category: 'accessing',
  5342. fn: function (){
  5343. var self=this;
  5344. return smalltalk.withContext(function($ctx1) {
  5345. var $1;
  5346. $1=_st(_st(self._organization())._elements())._sorted();
  5347. return $1;
  5348. }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
  5349. args: [],
  5350. source: "protocols\x0a\x09^ self organization elements sorted",
  5351. messageSends: ["sorted", "elements", "organization"],
  5352. referencedClasses: []
  5353. }),
  5354. smalltalk.Behavior);
  5355. smalltalk.addMethod(
  5356. smalltalk.method({
  5357. selector: "protocolsDo:",
  5358. category: 'enumerating',
  5359. fn: function (aBlock){
  5360. var self=this;
  5361. var methodsByCategory;
  5362. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  5363. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  5364. return smalltalk.withContext(function($ctx1) {
  5365. methodsByCategory=_st($HashedCollection())._new();
  5366. _st(_st(self._methodDictionary())._values())._do_((function(m){
  5367. return smalltalk.withContext(function($ctx2) {
  5368. return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  5369. return smalltalk.withContext(function($ctx3) {
  5370. return _st($Array())._new();
  5371. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._add_(m);
  5372. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
  5373. _st(self._protocols())._do_((function(category){
  5374. return smalltalk.withContext(function($ctx2) {
  5375. return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  5376. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1,3)})}));
  5377. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
  5378. args: ["aBlock"],
  5379. 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)]",
  5380. messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
  5381. referencedClasses: ["HashedCollection", "Array"]
  5382. }),
  5383. smalltalk.Behavior);
  5384. smalltalk.addMethod(
  5385. smalltalk.method({
  5386. selector: "prototype",
  5387. category: 'accessing',
  5388. fn: function (){
  5389. var self=this;
  5390. return smalltalk.withContext(function($ctx1) {
  5391. return self.fn.prototype;
  5392. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
  5393. args: [],
  5394. source: "prototype\x0a\x09<return self.fn.prototype>",
  5395. messageSends: [],
  5396. referencedClasses: []
  5397. }),
  5398. smalltalk.Behavior);
  5399. smalltalk.addMethod(
  5400. smalltalk.method({
  5401. selector: "recompile",
  5402. category: 'compiling',
  5403. fn: function (){
  5404. var self=this;
  5405. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5406. return smalltalk.withContext(function($ctx1) {
  5407. var $1;
  5408. $1=_st(_st($Compiler())._new())._recompile_(self);
  5409. return $1;
  5410. }, function($ctx1) {$ctx1.fill(self,"recompile",{},smalltalk.Behavior)})},
  5411. args: [],
  5412. source: "recompile\x0a\x09^ Compiler new recompile: self",
  5413. messageSends: ["recompile:", "new"],
  5414. referencedClasses: ["Compiler"]
  5415. }),
  5416. smalltalk.Behavior);
  5417. smalltalk.addMethod(
  5418. smalltalk.method({
  5419. selector: "removeCompiledMethod:",
  5420. category: 'compiling',
  5421. fn: function (aMethod){
  5422. var self=this;
  5423. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5424. function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  5425. return smalltalk.withContext(function($ctx1) {
  5426. var $1,$2;
  5427. self._basicRemoveCompiledMethod_(aMethod);
  5428. _st(self._methods())._detect_ifNone_((function(each){
  5429. return smalltalk.withContext(function($ctx2) {
  5430. return _st(_st(each)._protocol()).__eq(_st(aMethod)._protocol());
  5431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  5432. return smalltalk.withContext(function($ctx2) {
  5433. return _st(self._organization())._removeElement_(_st(aMethod)._protocol());
  5434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5435. $1=_st($MethodRemoved())._new();
  5436. _st($1)._method_(aMethod);
  5437. $2=_st($1)._yourself();
  5438. _st(_st($SystemAnnouncer())._current())._announce_($2);
  5439. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  5440. args: ["aMethod"],
  5441. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  5442. messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization", "announce:", "current", "method:", "new", "yourself"],
  5443. referencedClasses: ["SystemAnnouncer", "MethodRemoved"]
  5444. }),
  5445. smalltalk.Behavior);
  5446. smalltalk.addMethod(
  5447. smalltalk.method({
  5448. selector: "selectors",
  5449. category: 'accessing',
  5450. fn: function (){
  5451. var self=this;
  5452. return smalltalk.withContext(function($ctx1) {
  5453. var $1;
  5454. $1=_st(self._methodDictionary())._keys();
  5455. return $1;
  5456. }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
  5457. args: [],
  5458. source: "selectors\x0a\x09^ self methodDictionary keys",
  5459. messageSends: ["keys", "methodDictionary"],
  5460. referencedClasses: []
  5461. }),
  5462. smalltalk.Behavior);
  5463. smalltalk.addMethod(
  5464. smalltalk.method({
  5465. selector: "subclasses",
  5466. category: 'accessing',
  5467. fn: function (){
  5468. var self=this;
  5469. return smalltalk.withContext(function($ctx1) {
  5470. self._subclassResponsibility();
  5471. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
  5472. args: [],
  5473. source: "subclasses\x0a\x09self subclassResponsibility",
  5474. messageSends: ["subclassResponsibility"],
  5475. referencedClasses: []
  5476. }),
  5477. smalltalk.Behavior);
  5478. smalltalk.addMethod(
  5479. smalltalk.method({
  5480. selector: "superclass",
  5481. category: 'accessing',
  5482. fn: function (){
  5483. var self=this;
  5484. return smalltalk.withContext(function($ctx1) {
  5485. return self.superclass || nil;
  5486. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
  5487. args: [],
  5488. source: "superclass\x0a\x09<return self.superclass || nil>",
  5489. messageSends: [],
  5490. referencedClasses: []
  5491. }),
  5492. smalltalk.Behavior);
  5493. smalltalk.addMethod(
  5494. smalltalk.method({
  5495. selector: "theMetaClass",
  5496. category: 'accessing',
  5497. fn: function (){
  5498. var self=this;
  5499. return smalltalk.withContext(function($ctx1) {
  5500. var $1;
  5501. $1=self._class();
  5502. return $1;
  5503. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
  5504. args: [],
  5505. source: "theMetaClass\x0a\x09^ self class",
  5506. messageSends: ["class"],
  5507. referencedClasses: []
  5508. }),
  5509. smalltalk.Behavior);
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "theNonMetaClass",
  5513. category: 'accessing',
  5514. fn: function (){
  5515. var self=this;
  5516. return smalltalk.withContext(function($ctx1) {
  5517. var $1;
  5518. $1=self;
  5519. return $1;
  5520. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
  5521. args: [],
  5522. source: "theNonMetaClass\x0a\x09^ self",
  5523. messageSends: [],
  5524. referencedClasses: []
  5525. }),
  5526. smalltalk.Behavior);
  5527. smalltalk.addMethod(
  5528. smalltalk.method({
  5529. selector: "withAllSubclasses",
  5530. category: 'accessing',
  5531. fn: function (){
  5532. var self=this;
  5533. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  5534. return smalltalk.withContext(function($ctx1) {
  5535. var $2,$3,$1;
  5536. $2=_st($Array())._with_(self);
  5537. _st($2)._addAll_(self._allSubclasses());
  5538. $3=_st($2)._yourself();
  5539. $1=$3;
  5540. return $1;
  5541. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
  5542. args: [],
  5543. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  5544. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"],
  5545. referencedClasses: ["Array"]
  5546. }),
  5547. smalltalk.Behavior);
  5548. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  5549. smalltalk.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  5550. smalltalk.addMethod(
  5551. smalltalk.method({
  5552. selector: "asJavascript",
  5553. category: 'converting',
  5554. fn: function (){
  5555. var self=this;
  5556. return smalltalk.withContext(function($ctx1) {
  5557. var $1;
  5558. $1="smalltalk.".__comma(self._name());
  5559. return $1;
  5560. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
  5561. args: [],
  5562. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  5563. messageSends: [",", "name"],
  5564. referencedClasses: []
  5565. }),
  5566. smalltalk.Class);
  5567. smalltalk.addMethod(
  5568. smalltalk.method({
  5569. selector: "category",
  5570. category: 'accessing',
  5571. fn: function (){
  5572. var self=this;
  5573. return smalltalk.withContext(function($ctx1) {
  5574. var $2,$1;
  5575. $2=self._package();
  5576. if(($receiver = $2) == nil || $receiver == null){
  5577. $1="Unclassified";
  5578. } else {
  5579. $1=_st(self._package())._name();
  5580. };
  5581. return $1;
  5582. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
  5583. args: [],
  5584. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  5585. messageSends: ["ifNil:ifNotNil:", "package", "name"],
  5586. referencedClasses: []
  5587. }),
  5588. smalltalk.Class);
  5589. smalltalk.addMethod(
  5590. smalltalk.method({
  5591. selector: "definition",
  5592. category: 'accessing',
  5593. fn: function (){
  5594. var self=this;
  5595. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5596. return smalltalk.withContext(function($ctx1) {
  5597. var $2,$3,$4,$5,$1;
  5598. $1=_st($String())._streamContents_((function(stream){
  5599. return smalltalk.withContext(function($ctx2) {
  5600. $2=stream;
  5601. _st($2)._nextPutAll_(_st(self._superclass())._asString());
  5602. _st($2)._nextPutAll_(" subclass: #");
  5603. _st($2)._nextPutAll_(self._name());
  5604. _st($2)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  5605. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  5606. $3;
  5607. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  5608. return smalltalk.withContext(function($ctx3) {
  5609. return _st(stream)._nextPutAll_(each);
  5610. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  5611. return smalltalk.withContext(function($ctx3) {
  5612. return _st(stream)._nextPutAll_(" ");
  5613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  5614. $4=stream;
  5615. _st($4)._nextPutAll_(_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab()));
  5616. _st($4)._nextPutAll_("package: '");
  5617. _st($4)._nextPutAll_(self._category());
  5618. $5=_st($4)._nextPutAll_("'");
  5619. return $5;
  5620. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  5621. return $1;
  5622. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})},
  5623. args: [],
  5624. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  5625. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"],
  5626. referencedClasses: ["String"]
  5627. }),
  5628. smalltalk.Class);
  5629. smalltalk.addMethod(
  5630. smalltalk.method({
  5631. selector: "isClass",
  5632. category: 'testing',
  5633. fn: function (){
  5634. var self=this;
  5635. return smalltalk.withContext(function($ctx1) {
  5636. return true;
  5637. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
  5638. args: [],
  5639. source: "isClass\x0a\x09^true",
  5640. messageSends: [],
  5641. referencedClasses: []
  5642. }),
  5643. smalltalk.Class);
  5644. smalltalk.addMethod(
  5645. smalltalk.method({
  5646. selector: "package",
  5647. category: 'accessing',
  5648. fn: function (){
  5649. var self=this;
  5650. return smalltalk.withContext(function($ctx1) {
  5651. var $1;
  5652. $1=self._basicAt_("pkg");
  5653. return $1;
  5654. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
  5655. args: [],
  5656. source: "package\x0a\x09^ self basicAt: 'pkg'",
  5657. messageSends: ["basicAt:"],
  5658. referencedClasses: []
  5659. }),
  5660. smalltalk.Class);
  5661. smalltalk.addMethod(
  5662. smalltalk.method({
  5663. selector: "package:",
  5664. category: 'accessing',
  5665. fn: function (aPackage){
  5666. var self=this;
  5667. var oldPackage;
  5668. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5669. function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  5670. return smalltalk.withContext(function($ctx1) {
  5671. var $1,$2,$3,$4;
  5672. $1=_st(self._package()).__eq(aPackage);
  5673. if(smalltalk.assert($1)){
  5674. $2=self;
  5675. return $2;
  5676. };
  5677. oldPackage=self._package();
  5678. self._basicAt_put_("pkg",aPackage);
  5679. _st(_st(oldPackage)._organization())._removeElement_(self);
  5680. _st(_st(aPackage)._organization())._addElement_(self);
  5681. $3=_st($ClassMoved())._new();
  5682. _st($3)._theClass_(self);
  5683. _st($3)._oldPackage_(oldPackage);
  5684. $4=_st($3)._yourself();
  5685. _st(_st($SystemAnnouncer())._current())._announce_($4);
  5686. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
  5687. args: ["aPackage"],
  5688. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  5689. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"],
  5690. referencedClasses: ["SystemAnnouncer", "ClassMoved"]
  5691. }),
  5692. smalltalk.Class);
  5693. smalltalk.addMethod(
  5694. smalltalk.method({
  5695. selector: "printOn:",
  5696. category: 'printing',
  5697. fn: function (aStream){
  5698. var self=this;
  5699. return smalltalk.withContext(function($ctx1) {
  5700. _st(aStream)._nextPutAll_(self._name());
  5701. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
  5702. args: ["aStream"],
  5703. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  5704. messageSends: ["nextPutAll:", "name"],
  5705. referencedClasses: []
  5706. }),
  5707. smalltalk.Class);
  5708. smalltalk.addMethod(
  5709. smalltalk.method({
  5710. selector: "rename:",
  5711. category: 'accessing',
  5712. fn: function (aString){
  5713. var self=this;
  5714. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5715. return smalltalk.withContext(function($ctx1) {
  5716. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  5717. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
  5718. args: ["aString"],
  5719. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  5720. messageSends: ["renameClass:to:", "new"],
  5721. referencedClasses: ["ClassBuilder"]
  5722. }),
  5723. smalltalk.Class);
  5724. smalltalk.addMethod(
  5725. smalltalk.method({
  5726. selector: "subclass:instanceVariableNames:",
  5727. category: 'class creation',
  5728. fn: function (aString,anotherString){
  5729. var self=this;
  5730. return smalltalk.withContext(function($ctx1) {
  5731. var $1;
  5732. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5733. return $1;
  5734. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
  5735. args: ["aString", "anotherString"],
  5736. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  5737. messageSends: ["subclass:instanceVariableNames:package:"],
  5738. referencedClasses: []
  5739. }),
  5740. smalltalk.Class);
  5741. smalltalk.addMethod(
  5742. smalltalk.method({
  5743. selector: "subclass:instanceVariableNames:category:",
  5744. category: 'class creation',
  5745. fn: function (aString,aString2,aString3){
  5746. var self=this;
  5747. return smalltalk.withContext(function($ctx1) {
  5748. var $1;
  5749. self._deprecatedAPI();
  5750. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5751. return $1;
  5752. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  5753. args: ["aString", "aString2", "aString3"],
  5754. 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",
  5755. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5756. referencedClasses: []
  5757. }),
  5758. smalltalk.Class);
  5759. smalltalk.addMethod(
  5760. smalltalk.method({
  5761. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5762. category: 'class creation',
  5763. fn: function (aString,aString2,classVars,pools,aString3){
  5764. var self=this;
  5765. return smalltalk.withContext(function($ctx1) {
  5766. var $1;
  5767. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5768. return $1;
  5769. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})},
  5770. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5771. 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",
  5772. messageSends: ["subclass:instanceVariableNames:package:"],
  5773. referencedClasses: []
  5774. }),
  5775. smalltalk.Class);
  5776. smalltalk.addMethod(
  5777. smalltalk.method({
  5778. selector: "subclass:instanceVariableNames:package:",
  5779. category: 'class creation',
  5780. fn: function (aString,aString2,aString3){
  5781. var self=this;
  5782. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5783. return smalltalk.withContext(function($ctx1) {
  5784. var $1;
  5785. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  5786. return $1;
  5787. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  5788. args: ["aString", "aString2", "aString3"],
  5789. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5790. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  5791. referencedClasses: ["ClassBuilder"]
  5792. }),
  5793. smalltalk.Class);
  5794. smalltalk.addMethod(
  5795. smalltalk.method({
  5796. selector: "subclasses",
  5797. category: 'accessing',
  5798. fn: function (){
  5799. var self=this;
  5800. return smalltalk.withContext(function($ctx1) {
  5801. return self.subclasses._copy();
  5802. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Class)})},
  5803. args: [],
  5804. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  5805. messageSends: [],
  5806. referencedClasses: []
  5807. }),
  5808. smalltalk.Class);
  5809. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  5810. smalltalk.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  5811. smalltalk.addMethod(
  5812. smalltalk.method({
  5813. selector: "asJavascript",
  5814. category: 'converting',
  5815. fn: function (){
  5816. var self=this;
  5817. return smalltalk.withContext(function($ctx1) {
  5818. var $1;
  5819. $1=_st("smalltalk.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  5820. return $1;
  5821. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
  5822. args: [],
  5823. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  5824. messageSends: [",", "name", "instanceClass"],
  5825. referencedClasses: []
  5826. }),
  5827. smalltalk.Metaclass);
  5828. smalltalk.addMethod(
  5829. smalltalk.method({
  5830. selector: "definition",
  5831. category: 'accessing',
  5832. fn: function (){
  5833. var self=this;
  5834. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  5835. return smalltalk.withContext(function($ctx1) {
  5836. var $2,$3,$1;
  5837. $1=_st($String())._streamContents_((function(stream){
  5838. return smalltalk.withContext(function($ctx2) {
  5839. $2=stream;
  5840. _st($2)._nextPutAll_(self._asString());
  5841. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  5842. $3;
  5843. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  5844. return smalltalk.withContext(function($ctx3) {
  5845. return _st(stream)._nextPutAll_(each);
  5846. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  5847. return smalltalk.withContext(function($ctx3) {
  5848. return _st(stream)._nextPutAll_(" ");
  5849. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  5850. return _st(stream)._nextPutAll_("'");
  5851. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  5852. return $1;
  5853. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})},
  5854. args: [],
  5855. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  5856. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  5857. referencedClasses: ["String"]
  5858. }),
  5859. smalltalk.Metaclass);
  5860. smalltalk.addMethod(
  5861. smalltalk.method({
  5862. selector: "instanceClass",
  5863. category: 'accessing',
  5864. fn: function (){
  5865. var self=this;
  5866. return smalltalk.withContext(function($ctx1) {
  5867. return self.instanceClass;
  5868. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
  5869. args: [],
  5870. source: "instanceClass\x0a\x09<return self.instanceClass>",
  5871. messageSends: [],
  5872. referencedClasses: []
  5873. }),
  5874. smalltalk.Metaclass);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "instanceVariableNames:",
  5878. category: 'accessing',
  5879. fn: function (aCollection){
  5880. var self=this;
  5881. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5882. return smalltalk.withContext(function($ctx1) {
  5883. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  5884. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
  5885. args: ["aCollection"],
  5886. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  5887. messageSends: ["class:instanceVariableNames:", "new"],
  5888. referencedClasses: ["ClassBuilder"]
  5889. }),
  5890. smalltalk.Metaclass);
  5891. smalltalk.addMethod(
  5892. smalltalk.method({
  5893. selector: "isMetaclass",
  5894. category: 'testing',
  5895. fn: function (){
  5896. var self=this;
  5897. return smalltalk.withContext(function($ctx1) {
  5898. return true;
  5899. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
  5900. args: [],
  5901. source: "isMetaclass\x0a\x09^true",
  5902. messageSends: [],
  5903. referencedClasses: []
  5904. }),
  5905. smalltalk.Metaclass);
  5906. smalltalk.addMethod(
  5907. smalltalk.method({
  5908. selector: "printOn:",
  5909. category: 'printing',
  5910. fn: function (aStream){
  5911. var self=this;
  5912. return smalltalk.withContext(function($ctx1) {
  5913. var $1,$2;
  5914. $1=aStream;
  5915. _st($1)._nextPutAll_(_st(self._instanceClass())._name());
  5916. $2=_st($1)._nextPutAll_(" class");
  5917. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
  5918. args: ["aStream"],
  5919. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  5920. messageSends: ["nextPutAll:", "name", "instanceClass"],
  5921. referencedClasses: []
  5922. }),
  5923. smalltalk.Metaclass);
  5924. smalltalk.addMethod(
  5925. smalltalk.method({
  5926. selector: "subclasses",
  5927. category: 'accessing',
  5928. fn: function (){
  5929. var self=this;
  5930. return smalltalk.withContext(function($ctx1) {
  5931. var $1;
  5932. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  5933. return smalltalk.withContext(function($ctx2) {
  5934. return _st(_st(each)._isMetaclass())._not();
  5935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  5936. return smalltalk.withContext(function($ctx2) {
  5937. return _st(each)._theMetaClass();
  5938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  5939. return $1;
  5940. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Metaclass)})},
  5941. args: [],
  5942. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  5943. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"],
  5944. referencedClasses: []
  5945. }),
  5946. smalltalk.Metaclass);
  5947. smalltalk.addMethod(
  5948. smalltalk.method({
  5949. selector: "theMetaClass",
  5950. category: 'accessing',
  5951. fn: function (){
  5952. var self=this;
  5953. return smalltalk.withContext(function($ctx1) {
  5954. var $1;
  5955. $1=self;
  5956. return $1;
  5957. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
  5958. args: [],
  5959. source: "theMetaClass\x0a\x09^ self",
  5960. messageSends: [],
  5961. referencedClasses: []
  5962. }),
  5963. smalltalk.Metaclass);
  5964. smalltalk.addMethod(
  5965. smalltalk.method({
  5966. selector: "theNonMetaClass",
  5967. category: 'accessing',
  5968. fn: function (){
  5969. var self=this;
  5970. return smalltalk.withContext(function($ctx1) {
  5971. var $1;
  5972. $1=self._instanceClass();
  5973. return $1;
  5974. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
  5975. args: [],
  5976. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  5977. messageSends: ["instanceClass"],
  5978. referencedClasses: []
  5979. }),
  5980. smalltalk.Metaclass);
  5981. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  5982. smalltalk.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  5983. smalltalk.addMethod(
  5984. smalltalk.method({
  5985. selector: "addSubclassOf:named:instanceVariableNames:package:",
  5986. category: 'class definition',
  5987. fn: function (aClass,className,aCollection,packageName){
  5988. var self=this;
  5989. var theClass,thePackage;
  5990. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5991. return smalltalk.withContext(function($ctx1) {
  5992. var $1,$2,$3,$4;
  5993. theClass=_st(_st($Smalltalk())._current())._at_(className);
  5994. thePackage=self._createPackageNamed_(packageName);
  5995. $1=theClass;
  5996. if(($receiver = $1) == nil || $receiver == null){
  5997. $1;
  5998. } else {
  5999. _st(theClass)._package_(thePackage);
  6000. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  6001. if(! smalltalk.assert($2)){
  6002. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6003. return $3;
  6004. };
  6005. };
  6006. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6007. return $4;
  6008. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},smalltalk.ClassBuilder)})},
  6009. args: ["aClass", "className", "aCollection", "packageName"],
  6010. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09thePackage := self createPackageNamed: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  6011. messageSends: ["at:", "current", "createPackageNamed:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  6012. referencedClasses: ["Smalltalk"]
  6013. }),
  6014. smalltalk.ClassBuilder);
  6015. smalltalk.addMethod(
  6016. smalltalk.method({
  6017. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6018. category: 'private',
  6019. fn: function (aClass,aString,aCollection,packageName){
  6020. var self=this;
  6021. return smalltalk.withContext(function($ctx1) {
  6022. smalltalk.addClass(aString, aClass, aCollection, packageName);
  6023. return smalltalk[aString]
  6024. ;
  6025. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
  6026. args: ["aClass", "aString", "aCollection", "packageName"],
  6027. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>",
  6028. messageSends: [],
  6029. referencedClasses: []
  6030. }),
  6031. smalltalk.ClassBuilder);
  6032. smalltalk.addMethod(
  6033. smalltalk.method({
  6034. selector: "basicClass:instanceVariableNames:",
  6035. category: 'private',
  6036. fn: function (aClass,aString){
  6037. var self=this;
  6038. return smalltalk.withContext(function($ctx1) {
  6039. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  6040. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  6041. args: ["aClass", "aString"],
  6042. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6043. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  6044. referencedClasses: []
  6045. }),
  6046. smalltalk.ClassBuilder);
  6047. smalltalk.addMethod(
  6048. smalltalk.method({
  6049. selector: "basicClass:instanceVariables:",
  6050. category: 'private',
  6051. fn: function (aClass,aCollection){
  6052. var self=this;
  6053. return smalltalk.withContext(function($ctx1) {
  6054. var $1;
  6055. $1=_st(aClass)._isMetaclass();
  6056. if(! smalltalk.assert($1)){
  6057. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  6058. };
  6059. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  6060. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})},
  6061. args: ["aClass", "aCollection"],
  6062. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6063. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"],
  6064. referencedClasses: []
  6065. }),
  6066. smalltalk.ClassBuilder);
  6067. smalltalk.addMethod(
  6068. smalltalk.method({
  6069. selector: "basicRemoveClass:",
  6070. category: 'private',
  6071. fn: function (aClass){
  6072. var self=this;
  6073. return smalltalk.withContext(function($ctx1) {
  6074. smalltalk.removeClass(aClass);
  6075. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  6076. args: ["aClass"],
  6077. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  6078. messageSends: [],
  6079. referencedClasses: []
  6080. }),
  6081. smalltalk.ClassBuilder);
  6082. smalltalk.addMethod(
  6083. smalltalk.method({
  6084. selector: "basicRenameClass:to:",
  6085. category: 'private',
  6086. fn: function (aClass,aString){
  6087. var self=this;
  6088. return smalltalk.withContext(function($ctx1) {
  6089. smalltalk[aString] = aClass;
  6090. delete smalltalk[aClass.className];
  6091. aClass.className = aString;
  6092. ;
  6093. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  6094. args: ["aClass", "aString"],
  6095. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  6096. messageSends: [],
  6097. referencedClasses: []
  6098. }),
  6099. smalltalk.ClassBuilder);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "basicSwapClassNames:with:",
  6103. category: 'private',
  6104. fn: function (aClass,anotherClass){
  6105. var self=this;
  6106. return smalltalk.withContext(function($ctx1) {
  6107. var tmp = aClass.className;
  6108. aClass.className = anotherClass.className;
  6109. anotherClass.className = tmp;
  6110. ;
  6111. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  6112. args: ["aClass", "anotherClass"],
  6113. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  6114. messageSends: [],
  6115. referencedClasses: []
  6116. }),
  6117. smalltalk.ClassBuilder);
  6118. smalltalk.addMethod(
  6119. smalltalk.method({
  6120. selector: "class:instanceVariableNames:",
  6121. category: 'class definition',
  6122. fn: function (aClass,ivarNames){
  6123. var self=this;
  6124. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6125. function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  6126. return smalltalk.withContext(function($ctx1) {
  6127. var $1,$2;
  6128. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  6129. self._setupClass_(aClass);
  6130. $1=_st($ClassDefinitionChanged())._new();
  6131. _st($1)._theClass_(aClass);
  6132. $2=_st($1)._yourself();
  6133. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6134. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},smalltalk.ClassBuilder)})},
  6135. args: ["aClass", "ivarNames"],
  6136. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  6137. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  6138. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"]
  6139. }),
  6140. smalltalk.ClassBuilder);
  6141. smalltalk.addMethod(
  6142. smalltalk.method({
  6143. selector: "copyClass:named:",
  6144. category: 'copying',
  6145. fn: function (aClass,className){
  6146. var self=this;
  6147. var newClass;
  6148. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6149. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6150. return smalltalk.withContext(function($ctx1) {
  6151. var $1,$2,$3;
  6152. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6153. self._copyClass_to_(aClass,newClass);
  6154. $1=_st($ClassAdded())._new();
  6155. _st($1)._theClass_(newClass);
  6156. $2=_st($1)._yourself();
  6157. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6158. $3=newClass;
  6159. return $3;
  6160. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},smalltalk.ClassBuilder)})},
  6161. args: ["aClass", "className"],
  6162. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  6163. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"],
  6164. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  6165. }),
  6166. smalltalk.ClassBuilder);
  6167. smalltalk.addMethod(
  6168. smalltalk.method({
  6169. selector: "copyClass:to:",
  6170. category: 'copying',
  6171. fn: function (aClass,anotherClass){
  6172. var self=this;
  6173. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6174. return smalltalk.withContext(function($ctx1) {
  6175. _st(anotherClass)._comment_(_st(aClass)._comment());
  6176. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  6177. return smalltalk.withContext(function($ctx2) {
  6178. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  6179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6180. self._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  6181. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  6182. return smalltalk.withContext(function($ctx2) {
  6183. return _st(_st($Compiler())._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  6184. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  6185. self._setupClass_(anotherClass);
  6186. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  6187. args: ["aClass", "anotherClass"],
  6188. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass",
  6189. messageSends: ["comment:", "comment", "do:", "values", "methodDictionary", "install:forClass:category:", "new", "source", "category", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  6190. referencedClasses: ["Compiler"]
  6191. }),
  6192. smalltalk.ClassBuilder);
  6193. smalltalk.addMethod(
  6194. smalltalk.method({
  6195. selector: "createPackageNamed:",
  6196. category: 'private',
  6197. fn: function (aString){
  6198. var self=this;
  6199. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  6200. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6201. return smalltalk.withContext(function($ctx1) {
  6202. var $1;
  6203. $1=_st($Package())._named_ifAbsent_(aString,(function(){
  6204. return smalltalk.withContext(function($ctx2) {
  6205. return _st(_st($Smalltalk())._current())._createPackage_(aString);
  6206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6207. return $1;
  6208. }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
  6209. args: ["aString"],
  6210. source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
  6211. messageSends: ["named:ifAbsent:", "createPackage:", "current"],
  6212. referencedClasses: ["Package", "Smalltalk"]
  6213. }),
  6214. smalltalk.ClassBuilder);
  6215. smalltalk.addMethod(
  6216. smalltalk.method({
  6217. selector: "installMethod:forClass:category:",
  6218. category: 'method definition',
  6219. fn: function (aCompiledMethod,aBehavior,aString){
  6220. var self=this;
  6221. return smalltalk.withContext(function($ctx1) {
  6222. var $1;
  6223. _st(aCompiledMethod)._category_(aString);
  6224. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  6225. self._setupClass_(aBehavior);
  6226. $1=aCompiledMethod;
  6227. return $1;
  6228. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
  6229. args: ["aCompiledMethod", "aBehavior", "aString"],
  6230. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  6231. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  6232. referencedClasses: []
  6233. }),
  6234. smalltalk.ClassBuilder);
  6235. smalltalk.addMethod(
  6236. smalltalk.method({
  6237. selector: "instanceVariableNamesFor:",
  6238. category: 'accessing',
  6239. fn: function (aString){
  6240. var self=this;
  6241. return smalltalk.withContext(function($ctx1) {
  6242. var $1;
  6243. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  6244. return smalltalk.withContext(function($ctx2) {
  6245. return _st(each)._isEmpty();
  6246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6247. return $1;
  6248. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
  6249. args: ["aString"],
  6250. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  6251. messageSends: ["reject:", "tokenize:", "isEmpty"],
  6252. referencedClasses: []
  6253. }),
  6254. smalltalk.ClassBuilder);
  6255. smalltalk.addMethod(
  6256. smalltalk.method({
  6257. selector: "migrateClass:superclass:",
  6258. category: 'class migration',
  6259. fn: function (aClass,anotherClass){
  6260. var self=this;
  6261. return smalltalk.withContext(function($ctx1) {
  6262. var $1;
  6263. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6264. return $1;
  6265. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  6266. args: ["aClass", "anotherClass"],
  6267. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  6268. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  6269. referencedClasses: []
  6270. }),
  6271. smalltalk.ClassBuilder);
  6272. smalltalk.addMethod(
  6273. smalltalk.method({
  6274. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  6275. category: 'class migration',
  6276. fn: function (className,aClass,aCollection,packageName){
  6277. var self=this;
  6278. var oldClass,newClass,tmp;
  6279. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6280. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6281. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6282. function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  6283. return smalltalk.withContext(function($ctx1) {
  6284. var $1,$2,$3,$4,$5,$6,$7;
  6285. tmp="new*".__comma(className);
  6286. oldClass=_st(_st($Smalltalk())._current())._at_(className);
  6287. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  6288. self._basicSwapClassNames_with_(oldClass,newClass);
  6289. _st((function(){
  6290. return smalltalk.withContext(function($ctx2) {
  6291. return self._copyClass_to_(oldClass,newClass);
  6292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
  6293. return smalltalk.withContext(function($ctx2) {
  6294. $1=self;
  6295. _st($1)._basicSwapClassNames_with_(oldClass,newClass);
  6296. $2=_st($1)._basicRemoveClass_(newClass);
  6297. $2;
  6298. return _st(exception)._signal();
  6299. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
  6300. $3=self;
  6301. _st($3)._rawRenameClass_to_(oldClass,tmp);
  6302. $4=_st($3)._rawRenameClass_to_(newClass,className);
  6303. _st(_st(oldClass)._subclasses())._do_displayingProgress_((function(each){
  6304. return smalltalk.withContext(function($ctx2) {
  6305. return self._migrateClass_superclass_(each,newClass);
  6306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}),_st("Recompiling ".__comma(_st(newClass)._name())).__comma("..."));
  6307. self._basicRemoveClass_(oldClass);
  6308. $5=_st($ClassMigrated())._new();
  6309. _st($5)._theClass_(newClass);
  6310. _st($5)._oldClass_(oldClass);
  6311. $6=_st($5)._yourself();
  6312. _st(_st($SystemAnnouncer())._current())._announce_($6);
  6313. $7=newClass;
  6314. return $7;
  6315. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
  6316. args: ["className", "aClass", "aCollection", "packageName"],
  6317. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk current at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ]\x0a\x09\x09displayingProgress: 'Recompiling ', newClass name, '...'.\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  6318. messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:displayingProgress:", "subclasses", "migrateClass:superclass:", "name", "announce:", "theClass:", "new", "oldClass:", "yourself"],
  6319. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
  6320. }),
  6321. smalltalk.ClassBuilder);
  6322. smalltalk.addMethod(
  6323. smalltalk.method({
  6324. selector: "rawRenameClass:to:",
  6325. category: 'private',
  6326. fn: function (aClass,aString){
  6327. var self=this;
  6328. return smalltalk.withContext(function($ctx1) {
  6329. smalltalk[aString] = aClass;
  6330. ;
  6331. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  6332. args: ["aClass", "aString"],
  6333. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
  6334. messageSends: [],
  6335. referencedClasses: []
  6336. }),
  6337. smalltalk.ClassBuilder);
  6338. smalltalk.addMethod(
  6339. smalltalk.method({
  6340. selector: "renameClass:to:",
  6341. category: 'class migration',
  6342. fn: function (aClass,className){
  6343. var self=this;
  6344. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6345. function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  6346. return smalltalk.withContext(function($ctx1) {
  6347. var $1,$2;
  6348. self._basicRenameClass_to_(aClass,className);
  6349. _st(aClass)._recompile();
  6350. $1=_st($ClassRenamed())._new();
  6351. _st($1)._theClass_(aClass);
  6352. $2=_st($1)._yourself();
  6353. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6354. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  6355. args: ["aClass", "className"],
  6356. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  6357. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"],
  6358. referencedClasses: ["SystemAnnouncer", "ClassRenamed"]
  6359. }),
  6360. smalltalk.ClassBuilder);
  6361. smalltalk.addMethod(
  6362. smalltalk.method({
  6363. selector: "setupClass:",
  6364. category: 'public',
  6365. fn: function (aClass){
  6366. var self=this;
  6367. return smalltalk.withContext(function($ctx1) {
  6368. smalltalk.init(aClass);;
  6369. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  6370. args: ["aClass"],
  6371. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  6372. messageSends: [],
  6373. referencedClasses: []
  6374. }),
  6375. smalltalk.ClassBuilder);
  6376. smalltalk.addMethod(
  6377. smalltalk.method({
  6378. selector: "superclass:subclass:",
  6379. category: 'class definition',
  6380. fn: function (aClass,className){
  6381. var self=this;
  6382. return smalltalk.withContext(function($ctx1) {
  6383. var $1;
  6384. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  6385. return $1;
  6386. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  6387. args: ["aClass", "className"],
  6388. source: "superclass: aClass subclass: className\x0a\x09^self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  6389. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  6390. referencedClasses: []
  6391. }),
  6392. smalltalk.ClassBuilder);
  6393. smalltalk.addMethod(
  6394. smalltalk.method({
  6395. selector: "superclass:subclass:instanceVariableNames:package:",
  6396. category: 'class definition',
  6397. fn: function (aClass,className,ivarNames,packageName){
  6398. var self=this;
  6399. var newClass;
  6400. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6401. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6402. return smalltalk.withContext(function($ctx1) {
  6403. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  6404. $1=self;
  6405. $2=aClass;
  6406. $3=className;
  6407. $4=self._instanceVariableNamesFor_(ivarNames);
  6408. $6=packageName;
  6409. if(($receiver = $6) == nil || $receiver == null){
  6410. $5="unclassified";
  6411. } else {
  6412. $5=$6;
  6413. };
  6414. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  6415. self._setupClass_(newClass);
  6416. $7=_st($ClassAdded())._new();
  6417. _st($7)._theClass_(newClass);
  6418. $8=_st($7)._yourself();
  6419. _st(_st($SystemAnnouncer())._current())._announce_($8);
  6420. $9=newClass;
  6421. return $9;
  6422. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},smalltalk.ClassBuilder)})},
  6423. args: ["aClass", "className", "ivarNames", "packageName"],
  6424. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  6425. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  6426. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  6427. }),
  6428. smalltalk.ClassBuilder);
  6429. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  6430. smalltalk.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  6431. smalltalk.addMethod(
  6432. smalltalk.method({
  6433. selector: "class:category:",
  6434. category: 'accessing',
  6435. fn: function (aClass,aString){
  6436. var self=this;
  6437. return smalltalk.withContext(function($ctx1) {
  6438. self["@class"]=aClass;
  6439. self["@category"]=aString;
  6440. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
  6441. args: ["aClass", "aString"],
  6442. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  6443. messageSends: [],
  6444. referencedClasses: []
  6445. }),
  6446. smalltalk.ClassCategoryReader);
  6447. smalltalk.addMethod(
  6448. smalltalk.method({
  6449. selector: "compileMethod:",
  6450. category: 'private',
  6451. fn: function (aString){
  6452. var self=this;
  6453. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6454. return smalltalk.withContext(function($ctx1) {
  6455. _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  6456. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
  6457. args: ["aString"],
  6458. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  6459. messageSends: ["install:forClass:category:", "new"],
  6460. referencedClasses: ["Compiler"]
  6461. }),
  6462. smalltalk.ClassCategoryReader);
  6463. smalltalk.addMethod(
  6464. smalltalk.method({
  6465. selector: "initialize",
  6466. category: 'initialization',
  6467. fn: function (){
  6468. var self=this;
  6469. return smalltalk.withContext(function($ctx1) {
  6470. smalltalk.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  6471. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
  6472. args: [],
  6473. source: "initialize\x0a\x09super initialize.",
  6474. messageSends: ["initialize"],
  6475. referencedClasses: []
  6476. }),
  6477. smalltalk.ClassCategoryReader);
  6478. smalltalk.addMethod(
  6479. smalltalk.method({
  6480. selector: "scanFrom:",
  6481. category: 'fileIn',
  6482. fn: function (aChunkParser){
  6483. var self=this;
  6484. var chunk;
  6485. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6486. return smalltalk.withContext(function($ctx1) {
  6487. _st((function(){
  6488. return smalltalk.withContext(function($ctx2) {
  6489. chunk=_st(aChunkParser)._nextChunk();
  6490. chunk;
  6491. return _st(chunk)._isEmpty();
  6492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  6493. return smalltalk.withContext(function($ctx2) {
  6494. return self._compileMethod_(chunk);
  6495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6496. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  6497. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
  6498. args: ["aChunkParser"],
  6499. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09\x09self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
  6500. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
  6501. referencedClasses: ["ClassBuilder"]
  6502. }),
  6503. smalltalk.ClassCategoryReader);
  6504. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  6505. smalltalk.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  6506. smalltalk.addMethod(
  6507. smalltalk.method({
  6508. selector: "class:",
  6509. category: 'accessing',
  6510. fn: function (aClass){
  6511. var self=this;
  6512. return smalltalk.withContext(function($ctx1) {
  6513. self["@class"]=aClass;
  6514. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
  6515. args: ["aClass"],
  6516. source: "class: aClass\x0a\x09class := aClass",
  6517. messageSends: [],
  6518. referencedClasses: []
  6519. }),
  6520. smalltalk.ClassCommentReader);
  6521. smalltalk.addMethod(
  6522. smalltalk.method({
  6523. selector: "initialize",
  6524. category: 'initialization',
  6525. fn: function (){
  6526. var self=this;
  6527. return smalltalk.withContext(function($ctx1) {
  6528. smalltalk.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  6529. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
  6530. args: [],
  6531. source: "initialize\x0a\x09super initialize.",
  6532. messageSends: ["initialize"],
  6533. referencedClasses: []
  6534. }),
  6535. smalltalk.ClassCommentReader);
  6536. smalltalk.addMethod(
  6537. smalltalk.method({
  6538. selector: "scanFrom:",
  6539. category: 'fileIn',
  6540. fn: function (aChunkParser){
  6541. var self=this;
  6542. var chunk;
  6543. return smalltalk.withContext(function($ctx1) {
  6544. var $1;
  6545. chunk=_st(aChunkParser)._nextChunk();
  6546. $1=_st(chunk)._isEmpty();
  6547. if(! smalltalk.assert($1)){
  6548. self._setComment_(chunk);
  6549. };
  6550. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
  6551. args: ["aChunkParser"],
  6552. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
  6553. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
  6554. referencedClasses: []
  6555. }),
  6556. smalltalk.ClassCommentReader);
  6557. smalltalk.addMethod(
  6558. smalltalk.method({
  6559. selector: "setComment:",
  6560. category: 'private',
  6561. fn: function (aString){
  6562. var self=this;
  6563. return smalltalk.withContext(function($ctx1) {
  6564. _st(self["@class"])._comment_(aString);
  6565. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
  6566. args: ["aString"],
  6567. source: "setComment: aString\x0a\x09class comment: aString",
  6568. messageSends: ["comment:"],
  6569. referencedClasses: []
  6570. }),
  6571. smalltalk.ClassCommentReader);
  6572. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  6573. smalltalk.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  6574. smalltalk.addMethod(
  6575. smalltalk.method({
  6576. selector: "getNodesFrom:",
  6577. category: 'accessing',
  6578. fn: function (aCollection){
  6579. var self=this;
  6580. var children,others;
  6581. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  6582. return smalltalk.withContext(function($ctx1) {
  6583. var $1;
  6584. children=[];
  6585. others=[];
  6586. _st(aCollection)._do_((function(each){
  6587. return smalltalk.withContext(function($ctx2) {
  6588. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  6589. if(smalltalk.assert($1)){
  6590. return _st(children)._add_(each);
  6591. } else {
  6592. return _st(others)._add_(each);
  6593. };
  6594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6595. self["@nodes"]=_st(children)._collect_((function(each){
  6596. return smalltalk.withContext(function($ctx2) {
  6597. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  6598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  6599. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})},
  6600. args: ["aCollection"],
  6601. 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]",
  6602. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
  6603. referencedClasses: ["ClassSorterNode"]
  6604. }),
  6605. smalltalk.ClassSorterNode);
  6606. smalltalk.addMethod(
  6607. smalltalk.method({
  6608. selector: "level",
  6609. category: 'accessing',
  6610. fn: function (){
  6611. var self=this;
  6612. return smalltalk.withContext(function($ctx1) {
  6613. var $1;
  6614. $1=self["@level"];
  6615. return $1;
  6616. }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
  6617. args: [],
  6618. source: "level\x0a\x09^level",
  6619. messageSends: [],
  6620. referencedClasses: []
  6621. }),
  6622. smalltalk.ClassSorterNode);
  6623. smalltalk.addMethod(
  6624. smalltalk.method({
  6625. selector: "level:",
  6626. category: 'accessing',
  6627. fn: function (anInteger){
  6628. var self=this;
  6629. return smalltalk.withContext(function($ctx1) {
  6630. self["@level"]=anInteger;
  6631. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
  6632. args: ["anInteger"],
  6633. source: "level: anInteger\x0a\x09level := anInteger",
  6634. messageSends: [],
  6635. referencedClasses: []
  6636. }),
  6637. smalltalk.ClassSorterNode);
  6638. smalltalk.addMethod(
  6639. smalltalk.method({
  6640. selector: "nodes",
  6641. category: 'accessing',
  6642. fn: function (){
  6643. var self=this;
  6644. return smalltalk.withContext(function($ctx1) {
  6645. var $1;
  6646. $1=self["@nodes"];
  6647. return $1;
  6648. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
  6649. args: [],
  6650. source: "nodes\x0a\x09^nodes",
  6651. messageSends: [],
  6652. referencedClasses: []
  6653. }),
  6654. smalltalk.ClassSorterNode);
  6655. smalltalk.addMethod(
  6656. smalltalk.method({
  6657. selector: "theClass",
  6658. category: 'accessing',
  6659. fn: function (){
  6660. var self=this;
  6661. return smalltalk.withContext(function($ctx1) {
  6662. var $1;
  6663. $1=self["@theClass"];
  6664. return $1;
  6665. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
  6666. args: [],
  6667. source: "theClass\x0a\x09^theClass",
  6668. messageSends: [],
  6669. referencedClasses: []
  6670. }),
  6671. smalltalk.ClassSorterNode);
  6672. smalltalk.addMethod(
  6673. smalltalk.method({
  6674. selector: "theClass:",
  6675. category: 'accessing',
  6676. fn: function (aClass){
  6677. var self=this;
  6678. return smalltalk.withContext(function($ctx1) {
  6679. self["@theClass"]=aClass;
  6680. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
  6681. args: ["aClass"],
  6682. source: "theClass: aClass\x0a\x09theClass := aClass",
  6683. messageSends: [],
  6684. referencedClasses: []
  6685. }),
  6686. smalltalk.ClassSorterNode);
  6687. smalltalk.addMethod(
  6688. smalltalk.method({
  6689. selector: "traverseClassesWith:",
  6690. category: 'visiting',
  6691. fn: function (aCollection){
  6692. var self=this;
  6693. return smalltalk.withContext(function($ctx1) {
  6694. _st(aCollection)._add_(self._theClass());
  6695. _st(_st(self._nodes())._sorted_((function(a,b){
  6696. return smalltalk.withContext(function($ctx2) {
  6697. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  6698. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(aNode){
  6699. return smalltalk.withContext(function($ctx2) {
  6700. return _st(aNode)._traverseClassesWith_(aCollection);
  6701. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)})}));
  6702. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})},
  6703. args: ["aCollection"],
  6704. 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 ].",
  6705. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
  6706. referencedClasses: []
  6707. }),
  6708. smalltalk.ClassSorterNode);
  6709. smalltalk.addMethod(
  6710. smalltalk.method({
  6711. selector: "on:classes:level:",
  6712. category: 'instance creation',
  6713. fn: function (aClass,aCollection,anInteger){
  6714. var self=this;
  6715. return smalltalk.withContext(function($ctx1) {
  6716. var $2,$3,$1;
  6717. $2=self._new();
  6718. _st($2)._theClass_(aClass);
  6719. _st($2)._level_(anInteger);
  6720. _st($2)._getNodesFrom_(aCollection);
  6721. $3=_st($2)._yourself();
  6722. $1=$3;
  6723. return $1;
  6724. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})},
  6725. args: ["aClass", "aCollection", "anInteger"],
  6726. 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",
  6727. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  6728. referencedClasses: []
  6729. }),
  6730. smalltalk.ClassSorterNode.klass);
  6731. });
  6732. define("amber_core/Kernel-Methods", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  6733. smalltalk.addPackage('Kernel-Methods');
  6734. smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6735. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  6736. smalltalk.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  6737. smalltalk.addMethod(
  6738. smalltalk.method({
  6739. selector: "applyTo:arguments:",
  6740. category: 'evaluating',
  6741. fn: function (anObject,aCollection){
  6742. var self=this;
  6743. return smalltalk.withContext(function($ctx1) {
  6744. return self.apply(anObject, aCollection);
  6745. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  6746. args: ["anObject", "aCollection"],
  6747. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  6748. messageSends: [],
  6749. referencedClasses: []
  6750. }),
  6751. smalltalk.BlockClosure);
  6752. smalltalk.addMethod(
  6753. smalltalk.method({
  6754. selector: "asCompiledMethod:",
  6755. category: 'converting',
  6756. fn: function (aString){
  6757. var self=this;
  6758. return smalltalk.withContext(function($ctx1) {
  6759. return smalltalk.method({selector:aString, fn:self});;
  6760. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  6761. args: ["aString"],
  6762. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  6763. messageSends: [],
  6764. referencedClasses: []
  6765. }),
  6766. smalltalk.BlockClosure);
  6767. smalltalk.addMethod(
  6768. smalltalk.method({
  6769. selector: "compiledSource",
  6770. category: 'accessing',
  6771. fn: function (){
  6772. var self=this;
  6773. return smalltalk.withContext(function($ctx1) {
  6774. return self.toString();
  6775. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  6776. args: [],
  6777. source: "compiledSource\x0a\x09<return self.toString()>",
  6778. messageSends: [],
  6779. referencedClasses: []
  6780. }),
  6781. smalltalk.BlockClosure);
  6782. smalltalk.addMethod(
  6783. smalltalk.method({
  6784. selector: "currySelf",
  6785. category: 'converting',
  6786. fn: function (){
  6787. var self=this;
  6788. return smalltalk.withContext(function($ctx1) {
  6789. return function () {
  6790. var args = [ this ];
  6791. args.push.apply(args, arguments);
  6792. return self.apply(null, args);
  6793. }
  6794. ;
  6795. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  6796. args: [],
  6797. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  6798. messageSends: [],
  6799. referencedClasses: []
  6800. }),
  6801. smalltalk.BlockClosure);
  6802. smalltalk.addMethod(
  6803. smalltalk.method({
  6804. selector: "ensure:",
  6805. category: 'evaluating',
  6806. fn: function (aBlock){
  6807. var self=this;
  6808. return smalltalk.withContext(function($ctx1) {
  6809. try{return self._value()}finally{aBlock._value()};
  6810. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  6811. args: ["aBlock"],
  6812. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  6813. messageSends: [],
  6814. referencedClasses: []
  6815. }),
  6816. smalltalk.BlockClosure);
  6817. smalltalk.addMethod(
  6818. smalltalk.method({
  6819. selector: "fork",
  6820. category: 'timeout/interval',
  6821. fn: function (){
  6822. var self=this;
  6823. function $ForkPool(){return smalltalk.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  6824. return smalltalk.withContext(function($ctx1) {
  6825. _st(_st($ForkPool())._default())._fork_(self);
  6826. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  6827. args: [],
  6828. source: "fork\x0a\x09ForkPool default fork: self",
  6829. messageSends: ["fork:", "default"],
  6830. referencedClasses: ["ForkPool"]
  6831. }),
  6832. smalltalk.BlockClosure);
  6833. smalltalk.addMethod(
  6834. smalltalk.method({
  6835. selector: "new",
  6836. category: 'evaluating',
  6837. fn: function (){
  6838. var self=this;
  6839. return smalltalk.withContext(function($ctx1) {
  6840. return new self();
  6841. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  6842. args: [],
  6843. 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()>",
  6844. messageSends: [],
  6845. referencedClasses: []
  6846. }),
  6847. smalltalk.BlockClosure);
  6848. smalltalk.addMethod(
  6849. smalltalk.method({
  6850. selector: "newValue:",
  6851. category: 'evaluating',
  6852. fn: function (anObject){
  6853. var self=this;
  6854. return smalltalk.withContext(function($ctx1) {
  6855. var $1;
  6856. $1=self._newWithValues_([anObject]);
  6857. return $1;
  6858. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  6859. args: ["anObject"],
  6860. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  6861. messageSends: ["newWithValues:"],
  6862. referencedClasses: []
  6863. }),
  6864. smalltalk.BlockClosure);
  6865. smalltalk.addMethod(
  6866. smalltalk.method({
  6867. selector: "newValue:value:",
  6868. category: 'evaluating',
  6869. fn: function (anObject,anObject2){
  6870. var self=this;
  6871. return smalltalk.withContext(function($ctx1) {
  6872. var $1;
  6873. $1=self._newWithValues_([anObject,anObject2]);
  6874. return $1;
  6875. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  6876. args: ["anObject", "anObject2"],
  6877. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  6878. messageSends: ["newWithValues:"],
  6879. referencedClasses: []
  6880. }),
  6881. smalltalk.BlockClosure);
  6882. smalltalk.addMethod(
  6883. smalltalk.method({
  6884. selector: "newValue:value:value:",
  6885. category: 'evaluating',
  6886. fn: function (anObject,anObject2,anObject3){
  6887. var self=this;
  6888. return smalltalk.withContext(function($ctx1) {
  6889. var $1;
  6890. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  6891. return $1;
  6892. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  6893. args: ["anObject", "anObject2", "anObject3"],
  6894. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  6895. messageSends: ["newWithValues:"],
  6896. referencedClasses: []
  6897. }),
  6898. smalltalk.BlockClosure);
  6899. smalltalk.addMethod(
  6900. smalltalk.method({
  6901. selector: "newWithValues:",
  6902. category: 'evaluating',
  6903. fn: function (aCollection){
  6904. var self=this;
  6905. return smalltalk.withContext(function($ctx1) {
  6906. var constructor = function() {};
  6907. constructor.prototype = self.prototype;
  6908. var object = new constructor;
  6909. var result = self.apply(object, aCollection);
  6910. return typeof result === "object" ? result : object;
  6911. ;
  6912. return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  6913. args: ["aCollection"],
  6914. source: "newWithValues: aCollection\x0a\x09\x22Use the receiver as a JavaScript constructor with a variable number of arguments.\x0a\x09Answer the object created using the operator `new`.\x0a\x0a\x09This algorithm was inspired by http://stackoverflow.com/a/6069331.\x0a\x0a\x09Here's a general breakdown of what's going on:\x0a\x091) Create a new, empty constructor function.\x0a\x092) Set it's prototype to the receiver's prototype. Because the receiver is a `BlockClosure`, it is also a JavaScript function.\x0a\x093) Instantiate a new object using the constructor function just created. \x0a\x09\x09This forces the interpreter to set the internal [[prototype]] property to what was set on the function before. \x0a \x09\x09This has to be done, as we have no access to the [[prototype]] property externally.\x0a\x094) Apply `self` to the object I just instantiated.\x22\x0a\x0a\x09<\x0a\x09\x09var constructor = function() {};\x0a\x09\x09constructor.prototype = self.prototype;\x0a\x09\x09var object = new constructor;\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  6915. messageSends: [],
  6916. referencedClasses: []
  6917. }),
  6918. smalltalk.BlockClosure);
  6919. smalltalk.addMethod(
  6920. smalltalk.method({
  6921. selector: "numArgs",
  6922. category: 'accessing',
  6923. fn: function (){
  6924. var self=this;
  6925. return smalltalk.withContext(function($ctx1) {
  6926. return self.length;
  6927. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  6928. args: [],
  6929. source: "numArgs\x0a\x09<return self.length>",
  6930. messageSends: [],
  6931. referencedClasses: []
  6932. }),
  6933. smalltalk.BlockClosure);
  6934. smalltalk.addMethod(
  6935. smalltalk.method({
  6936. selector: "on:do:",
  6937. category: 'error handling',
  6938. fn: function (anErrorClass,aBlock){
  6939. var self=this;
  6940. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6941. return smalltalk.withContext(function($ctx1) {
  6942. var $2,$1;
  6943. $1=self._try_catch_(self,(function(error){
  6944. var smalltalkError;
  6945. return smalltalk.withContext(function($ctx2) {
  6946. smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
  6947. smalltalkError;
  6948. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  6949. if(smalltalk.assert($2)){
  6950. return _st(aBlock)._value_(smalltalkError);
  6951. } else {
  6952. return _st(smalltalkError)._resignal();
  6953. };
  6954. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)})}));
  6955. return $1;
  6956. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  6957. args: ["anErrorClass", "aBlock"],
  6958. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^self try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  6959. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
  6960. referencedClasses: ["Smalltalk"]
  6961. }),
  6962. smalltalk.BlockClosure);
  6963. smalltalk.addMethod(
  6964. smalltalk.method({
  6965. selector: "receiver",
  6966. category: 'accessing',
  6967. fn: function (){
  6968. var self=this;
  6969. return smalltalk.withContext(function($ctx1) {
  6970. return nil;
  6971. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.BlockClosure)})},
  6972. args: [],
  6973. source: "receiver\x0a\x09^ nil",
  6974. messageSends: [],
  6975. referencedClasses: []
  6976. }),
  6977. smalltalk.BlockClosure);
  6978. smalltalk.addMethod(
  6979. smalltalk.method({
  6980. selector: "timeToRun",
  6981. category: 'evaluating',
  6982. fn: function (){
  6983. var self=this;
  6984. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  6985. return smalltalk.withContext(function($ctx1) {
  6986. var $1;
  6987. $1=_st($Date())._millisecondsToRun_(self);
  6988. return $1;
  6989. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  6990. args: [],
  6991. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  6992. messageSends: ["millisecondsToRun:"],
  6993. referencedClasses: ["Date"]
  6994. }),
  6995. smalltalk.BlockClosure);
  6996. smalltalk.addMethod(
  6997. smalltalk.method({
  6998. selector: "value",
  6999. category: 'evaluating',
  7000. fn: function (){
  7001. var self=this;
  7002. return smalltalk.withContext(function($ctx1) {
  7003. return self();;
  7004. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  7005. args: [],
  7006. source: "value\x0a\x09<return self();>",
  7007. messageSends: [],
  7008. referencedClasses: []
  7009. }),
  7010. smalltalk.BlockClosure);
  7011. smalltalk.addMethod(
  7012. smalltalk.method({
  7013. selector: "value:",
  7014. category: 'evaluating',
  7015. fn: function (anArg){
  7016. var self=this;
  7017. return smalltalk.withContext(function($ctx1) {
  7018. return self(anArg);;
  7019. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  7020. args: ["anArg"],
  7021. source: "value: anArg\x0a\x09<return self(anArg);>",
  7022. messageSends: [],
  7023. referencedClasses: []
  7024. }),
  7025. smalltalk.BlockClosure);
  7026. smalltalk.addMethod(
  7027. smalltalk.method({
  7028. selector: "value:value:",
  7029. category: 'evaluating',
  7030. fn: function (firstArg,secondArg){
  7031. var self=this;
  7032. return smalltalk.withContext(function($ctx1) {
  7033. return self(firstArg, secondArg);;
  7034. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  7035. args: ["firstArg", "secondArg"],
  7036. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7037. messageSends: [],
  7038. referencedClasses: []
  7039. }),
  7040. smalltalk.BlockClosure);
  7041. smalltalk.addMethod(
  7042. smalltalk.method({
  7043. selector: "value:value:value:",
  7044. category: 'evaluating',
  7045. fn: function (firstArg,secondArg,thirdArg){
  7046. var self=this;
  7047. return smalltalk.withContext(function($ctx1) {
  7048. return self(firstArg, secondArg, thirdArg);;
  7049. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  7050. args: ["firstArg", "secondArg", "thirdArg"],
  7051. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7052. messageSends: [],
  7053. referencedClasses: []
  7054. }),
  7055. smalltalk.BlockClosure);
  7056. smalltalk.addMethod(
  7057. smalltalk.method({
  7058. selector: "valueWithInterval:",
  7059. category: 'timeout/interval',
  7060. fn: function (aNumber){
  7061. var self=this;
  7062. return smalltalk.withContext(function($ctx1) {
  7063. var interval = setInterval(self, aNumber);
  7064. return smalltalk.Timeout._on_(interval);
  7065. ;
  7066. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  7067. args: ["aNumber"],
  7068. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
  7069. messageSends: [],
  7070. referencedClasses: []
  7071. }),
  7072. smalltalk.BlockClosure);
  7073. smalltalk.addMethod(
  7074. smalltalk.method({
  7075. selector: "valueWithPossibleArguments:",
  7076. category: 'evaluating',
  7077. fn: function (aCollection){
  7078. var self=this;
  7079. return smalltalk.withContext(function($ctx1) {
  7080. return self.apply(null, aCollection);;
  7081. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  7082. args: ["aCollection"],
  7083. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7084. messageSends: [],
  7085. referencedClasses: []
  7086. }),
  7087. smalltalk.BlockClosure);
  7088. smalltalk.addMethod(
  7089. smalltalk.method({
  7090. selector: "valueWithTimeout:",
  7091. category: 'timeout/interval',
  7092. fn: function (aNumber){
  7093. var self=this;
  7094. return smalltalk.withContext(function($ctx1) {
  7095. var timeout = setTimeout(self, aNumber);
  7096. return smalltalk.Timeout._on_(timeout);
  7097. ;
  7098. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  7099. args: ["aNumber"],
  7100. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
  7101. messageSends: [],
  7102. referencedClasses: []
  7103. }),
  7104. smalltalk.BlockClosure);
  7105. smalltalk.addMethod(
  7106. smalltalk.method({
  7107. selector: "whileFalse",
  7108. category: 'controlling',
  7109. fn: function (){
  7110. var self=this;
  7111. return smalltalk.withContext(function($ctx1) {
  7112. self._whileFalse_((function(){
  7113. return smalltalk.withContext(function($ctx2) {
  7114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7115. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  7116. args: [],
  7117. source: "whileFalse\x0a\x09self whileFalse: []",
  7118. messageSends: ["whileFalse:"],
  7119. referencedClasses: []
  7120. }),
  7121. smalltalk.BlockClosure);
  7122. smalltalk.addMethod(
  7123. smalltalk.method({
  7124. selector: "whileFalse:",
  7125. category: 'controlling',
  7126. fn: function (aBlock){
  7127. var self=this;
  7128. return smalltalk.withContext(function($ctx1) {
  7129. while(!smalltalk.assert(self._value())) {aBlock._value()};
  7130. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  7131. args: ["aBlock"],
  7132. source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  7133. messageSends: [],
  7134. referencedClasses: []
  7135. }),
  7136. smalltalk.BlockClosure);
  7137. smalltalk.addMethod(
  7138. smalltalk.method({
  7139. selector: "whileTrue",
  7140. category: 'controlling',
  7141. fn: function (){
  7142. var self=this;
  7143. return smalltalk.withContext(function($ctx1) {
  7144. self._whileTrue_((function(){
  7145. return smalltalk.withContext(function($ctx2) {
  7146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7147. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  7148. args: [],
  7149. source: "whileTrue\x0a\x09self whileTrue: []",
  7150. messageSends: ["whileTrue:"],
  7151. referencedClasses: []
  7152. }),
  7153. smalltalk.BlockClosure);
  7154. smalltalk.addMethod(
  7155. smalltalk.method({
  7156. selector: "whileTrue:",
  7157. category: 'controlling',
  7158. fn: function (aBlock){
  7159. var self=this;
  7160. return smalltalk.withContext(function($ctx1) {
  7161. while(smalltalk.assert(self._value())) {aBlock._value()};
  7162. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  7163. args: ["aBlock"],
  7164. source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  7165. messageSends: [],
  7166. referencedClasses: []
  7167. }),
  7168. smalltalk.BlockClosure);
  7169. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  7170. smalltalk.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  7171. smalltalk.addMethod(
  7172. smalltalk.method({
  7173. selector: "arguments",
  7174. category: 'accessing',
  7175. fn: function (){
  7176. var self=this;
  7177. return smalltalk.withContext(function($ctx1) {
  7178. return self.args || [];
  7179. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  7180. args: [],
  7181. source: "arguments\x0a\x09<return self.args || []>",
  7182. messageSends: [],
  7183. referencedClasses: []
  7184. }),
  7185. smalltalk.CompiledMethod);
  7186. smalltalk.addMethod(
  7187. smalltalk.method({
  7188. selector: "category",
  7189. category: 'accessing',
  7190. fn: function (){
  7191. var self=this;
  7192. return smalltalk.withContext(function($ctx1) {
  7193. var $2,$1;
  7194. $2=self._basicAt_("category");
  7195. if(($receiver = $2) == nil || $receiver == null){
  7196. $1=self._defaultCategory();
  7197. } else {
  7198. $1=$2;
  7199. };
  7200. return $1;
  7201. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  7202. args: [],
  7203. source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
  7204. messageSends: ["ifNil:", "basicAt:", "defaultCategory"],
  7205. referencedClasses: []
  7206. }),
  7207. smalltalk.CompiledMethod);
  7208. smalltalk.addMethod(
  7209. smalltalk.method({
  7210. selector: "category:",
  7211. category: 'accessing',
  7212. fn: function (aString){
  7213. var self=this;
  7214. var oldProtocol;
  7215. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7216. function $MethodMoved(){return smalltalk.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  7217. return smalltalk.withContext(function($ctx1) {
  7218. var $1,$2,$3;
  7219. oldProtocol=self._protocol();
  7220. self._basicAt_put_("category",aString);
  7221. $1=_st($MethodMoved())._new();
  7222. _st($1)._method_(self);
  7223. _st($1)._oldProtocol_(oldProtocol);
  7224. $2=_st($1)._yourself();
  7225. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7226. $3=self._methodClass();
  7227. if(($receiver = $3) == nil || $receiver == null){
  7228. $3;
  7229. } else {
  7230. _st(_st(self._methodClass())._organization())._addElement_(aString);
  7231. _st(_st(_st(self._methodClass())._methods())._select_((function(each){
  7232. return smalltalk.withContext(function($ctx2) {
  7233. return _st(_st(each)._protocol()).__eq(oldProtocol);
  7234. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})))._ifEmpty_((function(){
  7235. return smalltalk.withContext(function($ctx2) {
  7236. return _st(_st(self._methodClass())._organization())._removeElement_(oldProtocol);
  7237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  7238. };
  7239. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldProtocol:oldProtocol},smalltalk.CompiledMethod)})},
  7240. args: ["aString"],
  7241. source: "category: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'category' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each protocol = oldProtocol ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldProtocol ] ]",
  7242. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "ifEmpty:", "select:", "methods", "=", "removeElement:"],
  7243. referencedClasses: ["SystemAnnouncer", "MethodMoved"]
  7244. }),
  7245. smalltalk.CompiledMethod);
  7246. smalltalk.addMethod(
  7247. smalltalk.method({
  7248. selector: "defaultCategory",
  7249. category: 'defaults',
  7250. fn: function (){
  7251. var self=this;
  7252. return smalltalk.withContext(function($ctx1) {
  7253. return "as yet unclassified";
  7254. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  7255. args: [],
  7256. source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
  7257. messageSends: [],
  7258. referencedClasses: []
  7259. }),
  7260. smalltalk.CompiledMethod);
  7261. smalltalk.addMethod(
  7262. smalltalk.method({
  7263. selector: "fn",
  7264. category: 'accessing',
  7265. fn: function (){
  7266. var self=this;
  7267. return smalltalk.withContext(function($ctx1) {
  7268. var $1;
  7269. $1=self._basicAt_("fn");
  7270. return $1;
  7271. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  7272. args: [],
  7273. source: "fn\x0a\x09^self basicAt: 'fn'",
  7274. messageSends: ["basicAt:"],
  7275. referencedClasses: []
  7276. }),
  7277. smalltalk.CompiledMethod);
  7278. smalltalk.addMethod(
  7279. smalltalk.method({
  7280. selector: "fn:",
  7281. category: 'accessing',
  7282. fn: function (aBlock){
  7283. var self=this;
  7284. return smalltalk.withContext(function($ctx1) {
  7285. self._basicAt_put_("fn",aBlock);
  7286. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  7287. args: ["aBlock"],
  7288. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  7289. messageSends: ["basicAt:put:"],
  7290. referencedClasses: []
  7291. }),
  7292. smalltalk.CompiledMethod);
  7293. smalltalk.addMethod(
  7294. smalltalk.method({
  7295. selector: "isCompiledMethod",
  7296. category: 'testing',
  7297. fn: function (){
  7298. var self=this;
  7299. return smalltalk.withContext(function($ctx1) {
  7300. return true;
  7301. }, function($ctx1) {$ctx1.fill(self,"isCompiledMethod",{},smalltalk.CompiledMethod)})},
  7302. args: [],
  7303. source: "isCompiledMethod\x0a\x09^ true",
  7304. messageSends: [],
  7305. referencedClasses: []
  7306. }),
  7307. smalltalk.CompiledMethod);
  7308. smalltalk.addMethod(
  7309. smalltalk.method({
  7310. selector: "isOverridden",
  7311. category: 'testing',
  7312. fn: function (){
  7313. var self=this;
  7314. var selector;
  7315. return smalltalk.withContext(function($ctx1) {
  7316. var $1;
  7317. var $early={};
  7318. try {
  7319. selector=self._selector();
  7320. _st(self._methodClass())._allSubclassesDo_((function(each){
  7321. return smalltalk.withContext(function($ctx2) {
  7322. $1=_st(each)._includesSelector_(selector);
  7323. if(smalltalk.assert($1)){
  7324. throw $early=[true];
  7325. };
  7326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7327. return false;
  7328. }
  7329. catch(e) {if(e===$early)return e[0]; throw e}
  7330. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},smalltalk.CompiledMethod)})},
  7331. args: [],
  7332. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  7333. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"],
  7334. referencedClasses: []
  7335. }),
  7336. smalltalk.CompiledMethod);
  7337. smalltalk.addMethod(
  7338. smalltalk.method({
  7339. selector: "isOverride",
  7340. category: 'testing',
  7341. fn: function (){
  7342. var self=this;
  7343. var superclass;
  7344. return smalltalk.withContext(function($ctx1) {
  7345. var $1,$2;
  7346. superclass=_st(self._methodClass())._superclass();
  7347. $1=superclass;
  7348. if(($receiver = $1) == nil || $receiver == null){
  7349. return false;
  7350. } else {
  7351. $1;
  7352. };
  7353. $2=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  7354. return $2;
  7355. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},smalltalk.CompiledMethod)})},
  7356. args: [],
  7357. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  7358. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  7359. referencedClasses: []
  7360. }),
  7361. smalltalk.CompiledMethod);
  7362. smalltalk.addMethod(
  7363. smalltalk.method({
  7364. selector: "messageSends",
  7365. category: 'accessing',
  7366. fn: function (){
  7367. var self=this;
  7368. return smalltalk.withContext(function($ctx1) {
  7369. var $1;
  7370. $1=self._basicAt_("messageSends");
  7371. return $1;
  7372. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  7373. args: [],
  7374. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  7375. messageSends: ["basicAt:"],
  7376. referencedClasses: []
  7377. }),
  7378. smalltalk.CompiledMethod);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "methodClass",
  7382. category: 'accessing',
  7383. fn: function (){
  7384. var self=this;
  7385. return smalltalk.withContext(function($ctx1) {
  7386. var $1;
  7387. $1=self._basicAt_("methodClass");
  7388. return $1;
  7389. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  7390. args: [],
  7391. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  7392. messageSends: ["basicAt:"],
  7393. referencedClasses: []
  7394. }),
  7395. smalltalk.CompiledMethod);
  7396. smalltalk.addMethod(
  7397. smalltalk.method({
  7398. selector: "protocol",
  7399. category: 'accessing',
  7400. fn: function (){
  7401. var self=this;
  7402. return smalltalk.withContext(function($ctx1) {
  7403. var $1;
  7404. $1=self._category();
  7405. return $1;
  7406. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  7407. args: [],
  7408. source: "protocol\x0a\x09^ self category",
  7409. messageSends: ["category"],
  7410. referencedClasses: []
  7411. }),
  7412. smalltalk.CompiledMethod);
  7413. smalltalk.addMethod(
  7414. smalltalk.method({
  7415. selector: "protocol:",
  7416. category: 'accessing',
  7417. fn: function (aString){
  7418. var self=this;
  7419. return smalltalk.withContext(function($ctx1) {
  7420. self._category_(aString);
  7421. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.CompiledMethod)})},
  7422. args: ["aString"],
  7423. source: "protocol: aString\x0a\x09self category: aString",
  7424. messageSends: ["category:"],
  7425. referencedClasses: []
  7426. }),
  7427. smalltalk.CompiledMethod);
  7428. smalltalk.addMethod(
  7429. smalltalk.method({
  7430. selector: "referencedClasses",
  7431. category: 'accessing',
  7432. fn: function (){
  7433. var self=this;
  7434. return smalltalk.withContext(function($ctx1) {
  7435. var $1;
  7436. $1=self._basicAt_("referencedClasses");
  7437. return $1;
  7438. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  7439. args: [],
  7440. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  7441. messageSends: ["basicAt:"],
  7442. referencedClasses: []
  7443. }),
  7444. smalltalk.CompiledMethod);
  7445. smalltalk.addMethod(
  7446. smalltalk.method({
  7447. selector: "selector",
  7448. category: 'accessing',
  7449. fn: function (){
  7450. var self=this;
  7451. return smalltalk.withContext(function($ctx1) {
  7452. var $1;
  7453. $1=self._basicAt_("selector");
  7454. return $1;
  7455. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  7456. args: [],
  7457. source: "selector\x0a\x09^self basicAt: 'selector'",
  7458. messageSends: ["basicAt:"],
  7459. referencedClasses: []
  7460. }),
  7461. smalltalk.CompiledMethod);
  7462. smalltalk.addMethod(
  7463. smalltalk.method({
  7464. selector: "selector:",
  7465. category: 'accessing',
  7466. fn: function (aString){
  7467. var self=this;
  7468. return smalltalk.withContext(function($ctx1) {
  7469. self._basicAt_put_("selector",aString);
  7470. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  7471. args: ["aString"],
  7472. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  7473. messageSends: ["basicAt:put:"],
  7474. referencedClasses: []
  7475. }),
  7476. smalltalk.CompiledMethod);
  7477. smalltalk.addMethod(
  7478. smalltalk.method({
  7479. selector: "sendTo:arguments:",
  7480. category: 'evaluating',
  7481. fn: function (anObject,aCollection){
  7482. var self=this;
  7483. return smalltalk.withContext(function($ctx1) {
  7484. var $1;
  7485. $1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
  7486. return $1;
  7487. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.CompiledMethod)})},
  7488. args: ["anObject", "aCollection"],
  7489. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  7490. messageSends: ["applyTo:arguments:", "fn"],
  7491. referencedClasses: []
  7492. }),
  7493. smalltalk.CompiledMethod);
  7494. smalltalk.addMethod(
  7495. smalltalk.method({
  7496. selector: "source",
  7497. category: 'accessing',
  7498. fn: function (){
  7499. var self=this;
  7500. return smalltalk.withContext(function($ctx1) {
  7501. var $2,$1;
  7502. $2=self._basicAt_("source");
  7503. if(($receiver = $2) == nil || $receiver == null){
  7504. $1="";
  7505. } else {
  7506. $1=$2;
  7507. };
  7508. return $1;
  7509. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  7510. args: [],
  7511. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  7512. messageSends: ["ifNil:", "basicAt:"],
  7513. referencedClasses: []
  7514. }),
  7515. smalltalk.CompiledMethod);
  7516. smalltalk.addMethod(
  7517. smalltalk.method({
  7518. selector: "source:",
  7519. category: 'accessing',
  7520. fn: function (aString){
  7521. var self=this;
  7522. return smalltalk.withContext(function($ctx1) {
  7523. self._basicAt_put_("source",aString);
  7524. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  7525. args: ["aString"],
  7526. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  7527. messageSends: ["basicAt:put:"],
  7528. referencedClasses: []
  7529. }),
  7530. smalltalk.CompiledMethod);
  7531. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  7532. smalltalk.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  7533. smalltalk.addMethod(
  7534. smalltalk.method({
  7535. selector: "addWorker",
  7536. category: 'private',
  7537. fn: function (){
  7538. var self=this;
  7539. return smalltalk.withContext(function($ctx1) {
  7540. _st(self["@worker"])._valueWithTimeout_((0));
  7541. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  7542. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  7543. args: [],
  7544. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  7545. messageSends: ["valueWithTimeout:", "+"],
  7546. referencedClasses: []
  7547. }),
  7548. smalltalk.ForkPool);
  7549. smalltalk.addMethod(
  7550. smalltalk.method({
  7551. selector: "defaultMaxPoolSize",
  7552. category: 'defaults',
  7553. fn: function (){
  7554. var self=this;
  7555. return smalltalk.withContext(function($ctx1) {
  7556. var $1;
  7557. $1=_st(self._class())._defaultMaxPoolSize();
  7558. return $1;
  7559. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  7560. args: [],
  7561. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  7562. messageSends: ["defaultMaxPoolSize", "class"],
  7563. referencedClasses: []
  7564. }),
  7565. smalltalk.ForkPool);
  7566. smalltalk.addMethod(
  7567. smalltalk.method({
  7568. selector: "fork:",
  7569. category: 'actions',
  7570. fn: function (aBlock){
  7571. var self=this;
  7572. return smalltalk.withContext(function($ctx1) {
  7573. var $1;
  7574. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  7575. if(smalltalk.assert($1)){
  7576. self._addWorker();
  7577. };
  7578. _st(self["@queue"])._nextPut_(aBlock);
  7579. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  7580. args: ["aBlock"],
  7581. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  7582. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"],
  7583. referencedClasses: []
  7584. }),
  7585. smalltalk.ForkPool);
  7586. smalltalk.addMethod(
  7587. smalltalk.method({
  7588. selector: "initialize",
  7589. category: 'initialization',
  7590. fn: function (){
  7591. var self=this;
  7592. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7593. return smalltalk.withContext(function($ctx1) {
  7594. smalltalk.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []);
  7595. self["@poolSize"]=(0);
  7596. self["@queue"]=_st($Queue())._new();
  7597. self["@worker"]=self._makeWorker();
  7598. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  7599. args: [],
  7600. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  7601. messageSends: ["initialize", "new", "makeWorker"],
  7602. referencedClasses: ["Queue"]
  7603. }),
  7604. smalltalk.ForkPool);
  7605. smalltalk.addMethod(
  7606. smalltalk.method({
  7607. selector: "makeWorker",
  7608. category: 'initialization',
  7609. fn: function (){
  7610. var self=this;
  7611. var sentinel;
  7612. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  7613. return smalltalk.withContext(function($ctx1) {
  7614. var $2,$1;
  7615. sentinel=_st($Object())._new();
  7616. $1=(function(){
  7617. var block;
  7618. return smalltalk.withContext(function($ctx2) {
  7619. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  7620. self["@poolSize"];
  7621. block=_st(self["@queue"])._nextIfAbsent_((function(){
  7622. return smalltalk.withContext(function($ctx3) {
  7623. return sentinel;
  7624. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  7625. block;
  7626. $2=_st(block).__eq_eq(sentinel);
  7627. if(! smalltalk.assert($2)){
  7628. return _st((function(){
  7629. return smalltalk.withContext(function($ctx3) {
  7630. return _st(block)._value();
  7631. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))._ensure_((function(){
  7632. return smalltalk.withContext(function($ctx3) {
  7633. return self._addWorker();
  7634. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  7635. };
  7636. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)})});
  7637. return $1;
  7638. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  7639. args: [],
  7640. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^[ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ]]]",
  7641. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"],
  7642. referencedClasses: ["Object"]
  7643. }),
  7644. smalltalk.ForkPool);
  7645. smalltalk.addMethod(
  7646. smalltalk.method({
  7647. selector: "maxPoolSize",
  7648. category: 'accessing',
  7649. fn: function (){
  7650. var self=this;
  7651. return smalltalk.withContext(function($ctx1) {
  7652. var $2,$1;
  7653. $2=self["@maxPoolSize"];
  7654. if(($receiver = $2) == nil || $receiver == null){
  7655. $1=self._defaultMaxPoolSize();
  7656. } else {
  7657. $1=$2;
  7658. };
  7659. return $1;
  7660. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  7661. args: [],
  7662. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  7663. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  7664. referencedClasses: []
  7665. }),
  7666. smalltalk.ForkPool);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "maxPoolSize:",
  7670. category: 'accessing',
  7671. fn: function (anInteger){
  7672. var self=this;
  7673. return smalltalk.withContext(function($ctx1) {
  7674. self["@maxPoolSize"]=anInteger;
  7675. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  7676. args: ["anInteger"],
  7677. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  7678. messageSends: [],
  7679. referencedClasses: []
  7680. }),
  7681. smalltalk.ForkPool);
  7682. smalltalk.ForkPool.klass.iVarNames = ['default'];
  7683. smalltalk.addMethod(
  7684. smalltalk.method({
  7685. selector: "default",
  7686. category: 'accessing',
  7687. fn: function (){
  7688. var self=this;
  7689. return smalltalk.withContext(function($ctx1) {
  7690. var $2,$1;
  7691. $2=self["@default"];
  7692. if(($receiver = $2) == nil || $receiver == null){
  7693. self["@default"]=self._new();
  7694. $1=self["@default"];
  7695. } else {
  7696. $1=$2;
  7697. };
  7698. return $1;
  7699. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  7700. args: [],
  7701. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  7702. messageSends: ["ifNil:", "new"],
  7703. referencedClasses: []
  7704. }),
  7705. smalltalk.ForkPool.klass);
  7706. smalltalk.addMethod(
  7707. smalltalk.method({
  7708. selector: "defaultMaxPoolSize",
  7709. category: 'accessing',
  7710. fn: function (){
  7711. var self=this;
  7712. return smalltalk.withContext(function($ctx1) {
  7713. return (100);
  7714. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  7715. args: [],
  7716. source: "defaultMaxPoolSize\x0a\x09^100",
  7717. messageSends: [],
  7718. referencedClasses: []
  7719. }),
  7720. smalltalk.ForkPool.klass);
  7721. smalltalk.addMethod(
  7722. smalltalk.method({
  7723. selector: "resetDefault",
  7724. category: 'accessing',
  7725. fn: function (){
  7726. var self=this;
  7727. return smalltalk.withContext(function($ctx1) {
  7728. self["@default"]=nil;
  7729. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  7730. args: [],
  7731. source: "resetDefault\x0a\x09default := nil",
  7732. messageSends: [],
  7733. referencedClasses: []
  7734. }),
  7735. smalltalk.ForkPool.klass);
  7736. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  7737. smalltalk.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  7738. smalltalk.addMethod(
  7739. smalltalk.method({
  7740. selector: "arguments",
  7741. category: 'accessing',
  7742. fn: function (){
  7743. var self=this;
  7744. return smalltalk.withContext(function($ctx1) {
  7745. var $1;
  7746. $1=self["@arguments"];
  7747. return $1;
  7748. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  7749. args: [],
  7750. source: "arguments\x0a\x09^arguments",
  7751. messageSends: [],
  7752. referencedClasses: []
  7753. }),
  7754. smalltalk.Message);
  7755. smalltalk.addMethod(
  7756. smalltalk.method({
  7757. selector: "arguments:",
  7758. category: 'accessing',
  7759. fn: function (anArray){
  7760. var self=this;
  7761. return smalltalk.withContext(function($ctx1) {
  7762. self["@arguments"]=anArray;
  7763. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  7764. args: ["anArray"],
  7765. source: "arguments: anArray\x0a\x09arguments := anArray",
  7766. messageSends: [],
  7767. referencedClasses: []
  7768. }),
  7769. smalltalk.Message);
  7770. smalltalk.addMethod(
  7771. smalltalk.method({
  7772. selector: "printOn:",
  7773. category: 'printing',
  7774. fn: function (aStream){
  7775. var self=this;
  7776. return smalltalk.withContext(function($ctx1) {
  7777. var $1,$2;
  7778. smalltalk.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  7779. $1=aStream;
  7780. _st($1)._nextPutAll_("(");
  7781. _st($1)._nextPutAll_(self._selector());
  7782. $2=_st($1)._nextPutAll_(")");
  7783. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Message)})},
  7784. args: ["aStream"],
  7785. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  7786. messageSends: ["printOn:", "nextPutAll:", "selector"],
  7787. referencedClasses: []
  7788. }),
  7789. smalltalk.Message);
  7790. smalltalk.addMethod(
  7791. smalltalk.method({
  7792. selector: "selector",
  7793. category: 'accessing',
  7794. fn: function (){
  7795. var self=this;
  7796. return smalltalk.withContext(function($ctx1) {
  7797. var $1;
  7798. $1=self["@selector"];
  7799. return $1;
  7800. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  7801. args: [],
  7802. source: "selector\x0a\x09^selector",
  7803. messageSends: [],
  7804. referencedClasses: []
  7805. }),
  7806. smalltalk.Message);
  7807. smalltalk.addMethod(
  7808. smalltalk.method({
  7809. selector: "selector:",
  7810. category: 'accessing',
  7811. fn: function (aString){
  7812. var self=this;
  7813. return smalltalk.withContext(function($ctx1) {
  7814. self["@selector"]=aString;
  7815. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  7816. args: ["aString"],
  7817. source: "selector: aString\x0a\x09selector := aString",
  7818. messageSends: [],
  7819. referencedClasses: []
  7820. }),
  7821. smalltalk.Message);
  7822. smalltalk.addMethod(
  7823. smalltalk.method({
  7824. selector: "sendTo:",
  7825. category: 'actions',
  7826. fn: function (anObject){
  7827. var self=this;
  7828. return smalltalk.withContext(function($ctx1) {
  7829. var $1;
  7830. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  7831. return $1;
  7832. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  7833. args: ["anObject"],
  7834. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  7835. messageSends: ["perform:withArguments:", "selector", "arguments"],
  7836. referencedClasses: []
  7837. }),
  7838. smalltalk.Message);
  7839. smalltalk.addMethod(
  7840. smalltalk.method({
  7841. selector: "selector:arguments:",
  7842. category: 'instance creation',
  7843. fn: function (aString,anArray){
  7844. var self=this;
  7845. return smalltalk.withContext(function($ctx1) {
  7846. var $2,$3,$1;
  7847. $2=self._new();
  7848. _st($2)._selector_(aString);
  7849. _st($2)._arguments_(anArray);
  7850. $3=_st($2)._yourself();
  7851. $1=$3;
  7852. return $1;
  7853. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  7854. args: ["aString", "anArray"],
  7855. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  7856. messageSends: ["selector:", "new", "arguments:", "yourself"],
  7857. referencedClasses: []
  7858. }),
  7859. smalltalk.Message.klass);
  7860. smalltalk.addClass('MessageSend', smalltalk.Object, ['receiver', 'message'], 'Kernel-Methods');
  7861. smalltalk.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  7862. smalltalk.addMethod(
  7863. smalltalk.method({
  7864. selector: "arguments",
  7865. category: 'accessing',
  7866. fn: function (){
  7867. var self=this;
  7868. return smalltalk.withContext(function($ctx1) {
  7869. var $1;
  7870. $1=_st(self["@message"])._arguments();
  7871. return $1;
  7872. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MessageSend)})},
  7873. args: [],
  7874. source: "arguments\x0a\x09^ message arguments",
  7875. messageSends: ["arguments"],
  7876. referencedClasses: []
  7877. }),
  7878. smalltalk.MessageSend);
  7879. smalltalk.addMethod(
  7880. smalltalk.method({
  7881. selector: "arguments:",
  7882. category: 'accessing',
  7883. fn: function (aCollection){
  7884. var self=this;
  7885. return smalltalk.withContext(function($ctx1) {
  7886. _st(self["@message"])._arguments_(aCollection);
  7887. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  7888. args: ["aCollection"],
  7889. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  7890. messageSends: ["arguments:"],
  7891. referencedClasses: []
  7892. }),
  7893. smalltalk.MessageSend);
  7894. smalltalk.addMethod(
  7895. smalltalk.method({
  7896. selector: "initialize",
  7897. category: 'initialization',
  7898. fn: function (){
  7899. var self=this;
  7900. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  7901. return smalltalk.withContext(function($ctx1) {
  7902. smalltalk.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []);
  7903. self["@message"]=_st($Message())._new();
  7904. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MessageSend)})},
  7905. args: [],
  7906. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  7907. messageSends: ["initialize", "new"],
  7908. referencedClasses: ["Message"]
  7909. }),
  7910. smalltalk.MessageSend);
  7911. smalltalk.addMethod(
  7912. smalltalk.method({
  7913. selector: "printOn:",
  7914. category: 'printing',
  7915. fn: function (aStream){
  7916. var self=this;
  7917. return smalltalk.withContext(function($ctx1) {
  7918. var $1,$2;
  7919. smalltalk.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  7920. $1=aStream;
  7921. _st($1)._nextPutAll_("(");
  7922. _st($1)._nextPutAll_(self._receiver());
  7923. _st($1)._nextPutAll_(" >> ");
  7924. _st($1)._nextPutAll_(self._selector());
  7925. $2=_st($1)._nextPutAll_(")");
  7926. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MessageSend)})},
  7927. args: ["aStream"],
  7928. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  7929. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
  7930. referencedClasses: []
  7931. }),
  7932. smalltalk.MessageSend);
  7933. smalltalk.addMethod(
  7934. smalltalk.method({
  7935. selector: "receiver",
  7936. category: 'accessing',
  7937. fn: function (){
  7938. var self=this;
  7939. return smalltalk.withContext(function($ctx1) {
  7940. var $1;
  7941. $1=self["@receiver"];
  7942. return $1;
  7943. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageSend)})},
  7944. args: [],
  7945. source: "receiver\x0a\x09^ receiver",
  7946. messageSends: [],
  7947. referencedClasses: []
  7948. }),
  7949. smalltalk.MessageSend);
  7950. smalltalk.addMethod(
  7951. smalltalk.method({
  7952. selector: "receiver:",
  7953. category: 'accessing',
  7954. fn: function (anObject){
  7955. var self=this;
  7956. return smalltalk.withContext(function($ctx1) {
  7957. self["@receiver"]=anObject;
  7958. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageSend)})},
  7959. args: ["anObject"],
  7960. source: "receiver: anObject\x0a\x09receiver := anObject",
  7961. messageSends: [],
  7962. referencedClasses: []
  7963. }),
  7964. smalltalk.MessageSend);
  7965. smalltalk.addMethod(
  7966. smalltalk.method({
  7967. selector: "selector",
  7968. category: 'accessing',
  7969. fn: function (){
  7970. var self=this;
  7971. return smalltalk.withContext(function($ctx1) {
  7972. var $1;
  7973. $1=_st(self["@message"])._selector();
  7974. return $1;
  7975. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MessageSend)})},
  7976. args: [],
  7977. source: "selector\x0a\x09^ message selector",
  7978. messageSends: ["selector"],
  7979. referencedClasses: []
  7980. }),
  7981. smalltalk.MessageSend);
  7982. smalltalk.addMethod(
  7983. smalltalk.method({
  7984. selector: "selector:",
  7985. category: 'accessing',
  7986. fn: function (aString){
  7987. var self=this;
  7988. return smalltalk.withContext(function($ctx1) {
  7989. _st(self["@message"])._selector_(aString);
  7990. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MessageSend)})},
  7991. args: ["aString"],
  7992. source: "selector: aString\x0a\x09message selector: aString",
  7993. messageSends: ["selector:"],
  7994. referencedClasses: []
  7995. }),
  7996. smalltalk.MessageSend);
  7997. smalltalk.addMethod(
  7998. smalltalk.method({
  7999. selector: "value",
  8000. category: 'evaluating',
  8001. fn: function (){
  8002. var self=this;
  8003. return smalltalk.withContext(function($ctx1) {
  8004. var $1;
  8005. $1=_st(self["@message"])._sendTo_(self._receiver());
  8006. return $1;
  8007. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MessageSend)})},
  8008. args: [],
  8009. source: "value\x0a\x09^ message sendTo: self receiver",
  8010. messageSends: ["sendTo:", "receiver"],
  8011. referencedClasses: []
  8012. }),
  8013. smalltalk.MessageSend);
  8014. smalltalk.addMethod(
  8015. smalltalk.method({
  8016. selector: "value:",
  8017. category: 'evaluating',
  8018. fn: function (anObject){
  8019. var self=this;
  8020. return smalltalk.withContext(function($ctx1) {
  8021. var $2,$3,$1;
  8022. $2=self["@message"];
  8023. _st($2)._arguments_([anObject]);
  8024. $3=_st($2)._sendTo_(self._receiver());
  8025. $1=$3;
  8026. return $1;
  8027. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.MessageSend)})},
  8028. args: ["anObject"],
  8029. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  8030. messageSends: ["arguments:", "sendTo:", "receiver"],
  8031. referencedClasses: []
  8032. }),
  8033. smalltalk.MessageSend);
  8034. smalltalk.addMethod(
  8035. smalltalk.method({
  8036. selector: "value:value:",
  8037. category: 'evaluating',
  8038. fn: function (firstArgument,secondArgument){
  8039. var self=this;
  8040. return smalltalk.withContext(function($ctx1) {
  8041. var $2,$3,$1;
  8042. $2=self["@message"];
  8043. _st($2)._arguments_([firstArgument,secondArgument]);
  8044. $3=_st($2)._sendTo_(self._receiver());
  8045. $1=$3;
  8046. return $1;
  8047. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.MessageSend)})},
  8048. args: ["firstArgument", "secondArgument"],
  8049. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  8050. messageSends: ["arguments:", "sendTo:", "receiver"],
  8051. referencedClasses: []
  8052. }),
  8053. smalltalk.MessageSend);
  8054. smalltalk.addMethod(
  8055. smalltalk.method({
  8056. selector: "value:value:value:",
  8057. category: 'evaluating',
  8058. fn: function (firstArgument,secondArgument,thirdArgument){
  8059. var self=this;
  8060. return smalltalk.withContext(function($ctx1) {
  8061. var $2,$3,$1;
  8062. $2=self["@message"];
  8063. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  8064. $3=_st($2)._sendTo_(self._receiver());
  8065. $1=$3;
  8066. return $1;
  8067. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.MessageSend)})},
  8068. args: ["firstArgument", "secondArgument", "thirdArgument"],
  8069. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  8070. messageSends: ["arguments:", "sendTo:", "receiver"],
  8071. referencedClasses: []
  8072. }),
  8073. smalltalk.MessageSend);
  8074. smalltalk.addMethod(
  8075. smalltalk.method({
  8076. selector: "valueWithPossibleArguments:",
  8077. category: 'evaluating',
  8078. fn: function (aCollection){
  8079. var self=this;
  8080. return smalltalk.withContext(function($ctx1) {
  8081. var $1;
  8082. self._arguments_(aCollection);
  8083. $1=self._value();
  8084. return $1;
  8085. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.MessageSend)})},
  8086. args: ["aCollection"],
  8087. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  8088. messageSends: ["arguments:", "value"],
  8089. referencedClasses: []
  8090. }),
  8091. smalltalk.MessageSend);
  8092. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  8093. smalltalk.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  8094. smalltalk.addMethod(
  8095. smalltalk.method({
  8096. selector: "asString",
  8097. category: 'converting',
  8098. fn: function (){
  8099. var self=this;
  8100. return smalltalk.withContext(function($ctx1) {
  8101. var $2,$1;
  8102. $2=self._isBlockContext();
  8103. if(smalltalk.assert($2)){
  8104. $1=_st("a block (in ".__comma(_st(self._methodContext())._asString())).__comma(")");
  8105. } else {
  8106. $1=_st(_st(_st(_st(self._receiver())._class())._name()).__comma(" >> ")).__comma(self._selector());
  8107. };
  8108. return $1;
  8109. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  8110. args: [],
  8111. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
  8112. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "name", "class", "receiver", "selector"],
  8113. referencedClasses: []
  8114. }),
  8115. smalltalk.MethodContext);
  8116. smalltalk.addMethod(
  8117. smalltalk.method({
  8118. selector: "home",
  8119. category: 'accessing',
  8120. fn: function (){
  8121. var self=this;
  8122. return smalltalk.withContext(function($ctx1) {
  8123. return self.homeContext;
  8124. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  8125. args: [],
  8126. source: "home\x0a\x09<return self.homeContext>",
  8127. messageSends: [],
  8128. referencedClasses: []
  8129. }),
  8130. smalltalk.MethodContext);
  8131. smalltalk.addMethod(
  8132. smalltalk.method({
  8133. selector: "index",
  8134. category: 'accessing',
  8135. fn: function (){
  8136. var self=this;
  8137. return smalltalk.withContext(function($ctx1) {
  8138. return self.index || 0;
  8139. return self}, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.MethodContext)})},
  8140. args: [],
  8141. source: "index\x0a\x09<return self.index || 0>",
  8142. messageSends: [],
  8143. referencedClasses: []
  8144. }),
  8145. smalltalk.MethodContext);
  8146. smalltalk.addMethod(
  8147. smalltalk.method({
  8148. selector: "isBlockContext",
  8149. category: 'testing',
  8150. fn: function (){
  8151. var self=this;
  8152. return smalltalk.withContext(function($ctx1) {
  8153. var $1;
  8154. $1=_st(self._selector())._isNil();
  8155. return $1;
  8156. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  8157. args: [],
  8158. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  8159. messageSends: ["isNil", "selector"],
  8160. referencedClasses: []
  8161. }),
  8162. smalltalk.MethodContext);
  8163. smalltalk.addMethod(
  8164. smalltalk.method({
  8165. selector: "locals",
  8166. category: 'accessing',
  8167. fn: function (){
  8168. var self=this;
  8169. return smalltalk.withContext(function($ctx1) {
  8170. return self.locals || {};
  8171. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  8172. args: [],
  8173. source: "locals\x0a\x09<return self.locals || {}>",
  8174. messageSends: [],
  8175. referencedClasses: []
  8176. }),
  8177. smalltalk.MethodContext);
  8178. smalltalk.addMethod(
  8179. smalltalk.method({
  8180. selector: "method",
  8181. category: 'accessing',
  8182. fn: function (){
  8183. var self=this;
  8184. return smalltalk.withContext(function($ctx1) {
  8185. var $2,$1;
  8186. $2=self._methodContext();
  8187. if(($receiver = $2) == nil || $receiver == null){
  8188. $1=$2;
  8189. } else {
  8190. $1=_st(_st(_st(self._methodContext())._receiver())._class())._lookupSelector_(_st(self._methodContext())._selector());
  8191. };
  8192. return $1;
  8193. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  8194. args: [],
  8195. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  8196. messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
  8197. referencedClasses: []
  8198. }),
  8199. smalltalk.MethodContext);
  8200. smalltalk.addMethod(
  8201. smalltalk.method({
  8202. selector: "methodContext",
  8203. category: 'accessing',
  8204. fn: function (){
  8205. var self=this;
  8206. return smalltalk.withContext(function($ctx1) {
  8207. var $1,$2,$4,$3;
  8208. $1=self._isBlockContext();
  8209. if(! smalltalk.assert($1)){
  8210. $2=self;
  8211. return $2;
  8212. };
  8213. $4=self._outerContext();
  8214. if(($receiver = $4) == nil || $receiver == null){
  8215. $3=$4;
  8216. } else {
  8217. var outer;
  8218. outer=$receiver;
  8219. $3=_st(outer)._methodContext();
  8220. };
  8221. return $3;
  8222. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  8223. args: [],
  8224. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  8225. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"],
  8226. referencedClasses: []
  8227. }),
  8228. smalltalk.MethodContext);
  8229. smalltalk.addMethod(
  8230. smalltalk.method({
  8231. selector: "outerContext",
  8232. category: 'accessing',
  8233. fn: function (){
  8234. var self=this;
  8235. return smalltalk.withContext(function($ctx1) {
  8236. return self.outerContext || self.homeContext;
  8237. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  8238. args: [],
  8239. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  8240. messageSends: [],
  8241. referencedClasses: []
  8242. }),
  8243. smalltalk.MethodContext);
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "pc",
  8247. category: 'accessing',
  8248. fn: function (){
  8249. var self=this;
  8250. return smalltalk.withContext(function($ctx1) {
  8251. return self.pc;
  8252. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  8253. args: [],
  8254. source: "pc\x0a\x09<return self.pc>",
  8255. messageSends: [],
  8256. referencedClasses: []
  8257. }),
  8258. smalltalk.MethodContext);
  8259. smalltalk.addMethod(
  8260. smalltalk.method({
  8261. selector: "printOn:",
  8262. category: 'printing',
  8263. fn: function (aStream){
  8264. var self=this;
  8265. return smalltalk.withContext(function($ctx1) {
  8266. var $1,$2;
  8267. smalltalk.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  8268. $1=aStream;
  8269. _st($1)._nextPutAll_("(");
  8270. _st($1)._nextPutAll_(self._asString());
  8271. $2=_st($1)._nextPutAll_(")");
  8272. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.MethodContext)})},
  8273. args: ["aStream"],
  8274. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  8275. messageSends: ["printOn:", "nextPutAll:", "asString"],
  8276. referencedClasses: []
  8277. }),
  8278. smalltalk.MethodContext);
  8279. smalltalk.addMethod(
  8280. smalltalk.method({
  8281. selector: "receiver",
  8282. category: 'accessing',
  8283. fn: function (){
  8284. var self=this;
  8285. return smalltalk.withContext(function($ctx1) {
  8286. return self.receiver;
  8287. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  8288. args: [],
  8289. source: "receiver\x0a\x09<return self.receiver>",
  8290. messageSends: [],
  8291. referencedClasses: []
  8292. }),
  8293. smalltalk.MethodContext);
  8294. smalltalk.addMethod(
  8295. smalltalk.method({
  8296. selector: "selector",
  8297. category: 'accessing',
  8298. fn: function (){
  8299. var self=this;
  8300. return smalltalk.withContext(function($ctx1) {
  8301. if(self.selector) {
  8302. return smalltalk.convertSelector(self.selector);
  8303. } else {
  8304. return nil;
  8305. }
  8306. ;
  8307. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  8308. args: [],
  8309. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  8310. messageSends: [],
  8311. referencedClasses: []
  8312. }),
  8313. smalltalk.MethodContext);
  8314. smalltalk.addMethod(
  8315. smalltalk.method({
  8316. selector: "temps",
  8317. category: 'accessing',
  8318. fn: function (){
  8319. var self=this;
  8320. return smalltalk.withContext(function($ctx1) {
  8321. var $1;
  8322. self._deprecatedAPI();
  8323. $1=self._locals();
  8324. return $1;
  8325. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  8326. args: [],
  8327. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  8328. messageSends: ["deprecatedAPI", "locals"],
  8329. referencedClasses: []
  8330. }),
  8331. smalltalk.MethodContext);
  8332. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  8333. smalltalk.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  8334. smalltalk.addMethod(
  8335. smalltalk.method({
  8336. selector: "constructor:",
  8337. category: 'instance creation',
  8338. fn: function (aString){
  8339. var self=this;
  8340. return smalltalk.withContext(function($ctx1) {
  8341. var native=eval(aString);
  8342. return new native();
  8343. ;
  8344. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  8345. args: ["aString"],
  8346. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  8347. messageSends: [],
  8348. referencedClasses: []
  8349. }),
  8350. smalltalk.NativeFunction.klass);
  8351. smalltalk.addMethod(
  8352. smalltalk.method({
  8353. selector: "constructor:value:",
  8354. category: 'instance creation',
  8355. fn: function (aString,anObject){
  8356. var self=this;
  8357. return smalltalk.withContext(function($ctx1) {
  8358. var native=eval(aString);
  8359. return new native(anObject);
  8360. ;
  8361. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  8362. args: ["aString", "anObject"],
  8363. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  8364. messageSends: [],
  8365. referencedClasses: []
  8366. }),
  8367. smalltalk.NativeFunction.klass);
  8368. smalltalk.addMethod(
  8369. smalltalk.method({
  8370. selector: "constructor:value:value:",
  8371. category: 'instance creation',
  8372. fn: function (aString,anObject,anObject2){
  8373. var self=this;
  8374. return smalltalk.withContext(function($ctx1) {
  8375. var native=eval(aString);
  8376. return new native(anObject,anObject2);
  8377. ;
  8378. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  8379. args: ["aString", "anObject", "anObject2"],
  8380. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  8381. messageSends: [],
  8382. referencedClasses: []
  8383. }),
  8384. smalltalk.NativeFunction.klass);
  8385. smalltalk.addMethod(
  8386. smalltalk.method({
  8387. selector: "constructor:value:value:value:",
  8388. category: 'instance creation',
  8389. fn: function (aString,anObject,anObject2,anObject3){
  8390. var self=this;
  8391. return smalltalk.withContext(function($ctx1) {
  8392. var native=eval(aString);
  8393. return new native(anObject,anObject2, anObject3);
  8394. ;
  8395. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  8396. args: ["aString", "anObject", "anObject2", "anObject3"],
  8397. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>",
  8398. messageSends: [],
  8399. referencedClasses: []
  8400. }),
  8401. smalltalk.NativeFunction.klass);
  8402. smalltalk.addMethod(
  8403. smalltalk.method({
  8404. selector: "exists:",
  8405. category: 'testing',
  8406. fn: function (aString){
  8407. var self=this;
  8408. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  8409. return smalltalk.withContext(function($ctx1) {
  8410. var $1;
  8411. $1=_st($PlatformInterface())._existsGlobal_(aString);
  8412. return $1;
  8413. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  8414. args: ["aString"],
  8415. source: "exists: aString\x0a\x09^PlatformInterface existsGlobal: aString",
  8416. messageSends: ["existsGlobal:"],
  8417. referencedClasses: ["PlatformInterface"]
  8418. }),
  8419. smalltalk.NativeFunction.klass);
  8420. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Methods');
  8421. smalltalk.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  8422. smalltalk.addMethod(
  8423. smalltalk.method({
  8424. selector: "clearInterval",
  8425. category: 'timeout/interval',
  8426. fn: function (){
  8427. var self=this;
  8428. return smalltalk.withContext(function($ctx1) {
  8429. var interval = self["@rawTimeout"];
  8430. clearInterval(interval);
  8431. ;
  8432. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},smalltalk.Timeout)})},
  8433. args: [],
  8434. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  8435. messageSends: [],
  8436. referencedClasses: []
  8437. }),
  8438. smalltalk.Timeout);
  8439. smalltalk.addMethod(
  8440. smalltalk.method({
  8441. selector: "clearTimeout",
  8442. category: 'timeout/interval',
  8443. fn: function (){
  8444. var self=this;
  8445. return smalltalk.withContext(function($ctx1) {
  8446. var timeout = self["@rawTimeout"];
  8447. clearTimeout(timeout);
  8448. ;
  8449. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},smalltalk.Timeout)})},
  8450. args: [],
  8451. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  8452. messageSends: [],
  8453. referencedClasses: []
  8454. }),
  8455. smalltalk.Timeout);
  8456. smalltalk.addMethod(
  8457. smalltalk.method({
  8458. selector: "rawTimeout:",
  8459. category: 'accessing',
  8460. fn: function (anObject){
  8461. var self=this;
  8462. return smalltalk.withContext(function($ctx1) {
  8463. self["@rawTimeout"]=anObject;
  8464. return self}, function($ctx1) {$ctx1.fill(self,"rawTimeout:",{anObject:anObject},smalltalk.Timeout)})},
  8465. args: ["anObject"],
  8466. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  8467. messageSends: [],
  8468. referencedClasses: []
  8469. }),
  8470. smalltalk.Timeout);
  8471. smalltalk.addMethod(
  8472. smalltalk.method({
  8473. selector: "on:",
  8474. category: 'instance creation',
  8475. fn: function (anObject){
  8476. var self=this;
  8477. return smalltalk.withContext(function($ctx1) {
  8478. var $2,$3,$1;
  8479. $2=self._new();
  8480. _st($2)._rawTimeout_(anObject);
  8481. $3=_st($2)._yourself();
  8482. $1=$3;
  8483. return $1;
  8484. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},smalltalk.Timeout.klass)})},
  8485. args: ["anObject"],
  8486. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  8487. messageSends: ["rawTimeout:", "new", "yourself"],
  8488. referencedClasses: []
  8489. }),
  8490. smalltalk.Timeout.klass);
  8491. });
  8492. define("amber_core/Kernel-Collections", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  8493. smalltalk.addPackage('Kernel-Collections');
  8494. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8495. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  8496. smalltalk.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  8497. smalltalk.addMethod(
  8498. smalltalk.method({
  8499. selector: "=",
  8500. category: 'comparing',
  8501. fn: function (anAssociation){
  8502. var self=this;
  8503. return smalltalk.withContext(function($ctx1) {
  8504. var $1;
  8505. $1=_st(_st(self._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  8506. return smalltalk.withContext(function($ctx2) {
  8507. return _st(_st(self._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  8508. return smalltalk.withContext(function($ctx3) {
  8509. return _st(self._value()).__eq(_st(anAssociation)._value());
  8510. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  8511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8512. return $1;
  8513. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},smalltalk.Association)})},
  8514. args: ["anAssociation"],
  8515. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  8516. messageSends: ["and:", "=", "class", "key", "value"],
  8517. referencedClasses: []
  8518. }),
  8519. smalltalk.Association);
  8520. smalltalk.addMethod(
  8521. smalltalk.method({
  8522. selector: "key",
  8523. category: 'accessing',
  8524. fn: function (){
  8525. var self=this;
  8526. return smalltalk.withContext(function($ctx1) {
  8527. var $1;
  8528. $1=self["@key"];
  8529. return $1;
  8530. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.Association)})},
  8531. args: [],
  8532. source: "key\x0a\x09^key",
  8533. messageSends: [],
  8534. referencedClasses: []
  8535. }),
  8536. smalltalk.Association);
  8537. smalltalk.addMethod(
  8538. smalltalk.method({
  8539. selector: "key:",
  8540. category: 'accessing',
  8541. fn: function (aKey){
  8542. var self=this;
  8543. return smalltalk.withContext(function($ctx1) {
  8544. self["@key"]=aKey;
  8545. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey},smalltalk.Association)})},
  8546. args: ["aKey"],
  8547. source: "key: aKey\x0a\x09key := aKey",
  8548. messageSends: [],
  8549. referencedClasses: []
  8550. }),
  8551. smalltalk.Association);
  8552. smalltalk.addMethod(
  8553. smalltalk.method({
  8554. selector: "printOn:",
  8555. category: 'printing',
  8556. fn: function (aStream){
  8557. var self=this;
  8558. return smalltalk.withContext(function($ctx1) {
  8559. _st(self._key())._printOn_(aStream);
  8560. _st(aStream)._nextPutAll_(" -> ");
  8561. _st(self._value())._printOn_(aStream);
  8562. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Association)})},
  8563. args: ["aStream"],
  8564. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  8565. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  8566. referencedClasses: []
  8567. }),
  8568. smalltalk.Association);
  8569. smalltalk.addMethod(
  8570. smalltalk.method({
  8571. selector: "value",
  8572. category: 'accessing',
  8573. fn: function (){
  8574. var self=this;
  8575. return smalltalk.withContext(function($ctx1) {
  8576. var $1;
  8577. $1=self["@value"];
  8578. return $1;
  8579. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.Association)})},
  8580. args: [],
  8581. source: "value\x0a\x09^value",
  8582. messageSends: [],
  8583. referencedClasses: []
  8584. }),
  8585. smalltalk.Association);
  8586. smalltalk.addMethod(
  8587. smalltalk.method({
  8588. selector: "value:",
  8589. category: 'accessing',
  8590. fn: function (aValue){
  8591. var self=this;
  8592. return smalltalk.withContext(function($ctx1) {
  8593. self["@value"]=aValue;
  8594. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.Association)})},
  8595. args: ["aValue"],
  8596. source: "value: aValue\x0a\x09value := aValue",
  8597. messageSends: [],
  8598. referencedClasses: []
  8599. }),
  8600. smalltalk.Association);
  8601. smalltalk.addMethod(
  8602. smalltalk.method({
  8603. selector: "key:value:",
  8604. category: 'instance creation',
  8605. fn: function (aKey,aValue){
  8606. var self=this;
  8607. return smalltalk.withContext(function($ctx1) {
  8608. var $2,$3,$1;
  8609. $2=self._new();
  8610. _st($2)._key_(aKey);
  8611. _st($2)._value_(aValue);
  8612. $3=_st($2)._yourself();
  8613. $1=$3;
  8614. return $1;
  8615. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},smalltalk.Association.klass)})},
  8616. args: ["aKey", "aValue"],
  8617. source: "key: aKey value: aValue\x0a\x09\x09^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  8618. messageSends: ["key:", "new", "value:", "yourself"],
  8619. referencedClasses: []
  8620. }),
  8621. smalltalk.Association.klass);
  8622. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  8623. smalltalk.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  8624. smalltalk.addMethod(
  8625. smalltalk.method({
  8626. selector: ",",
  8627. category: 'copying',
  8628. fn: function (aCollection){
  8629. var self=this;
  8630. return smalltalk.withContext(function($ctx1) {
  8631. var $2,$3,$1;
  8632. $2=self._copy();
  8633. _st($2)._addAll_(aCollection);
  8634. $3=_st($2)._yourself();
  8635. $1=$3;
  8636. return $1;
  8637. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.Collection)})},
  8638. args: ["aCollection"],
  8639. source: ", aCollection\x0a\x09^self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8640. messageSends: ["addAll:", "copy", "yourself"],
  8641. referencedClasses: []
  8642. }),
  8643. smalltalk.Collection);
  8644. smalltalk.addMethod(
  8645. smalltalk.method({
  8646. selector: "add:",
  8647. category: 'adding/removing',
  8648. fn: function (anObject){
  8649. var self=this;
  8650. return smalltalk.withContext(function($ctx1) {
  8651. self._subclassResponsibility();
  8652. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Collection)})},
  8653. args: ["anObject"],
  8654. source: "add: anObject\x0a\x09self subclassResponsibility",
  8655. messageSends: ["subclassResponsibility"],
  8656. referencedClasses: []
  8657. }),
  8658. smalltalk.Collection);
  8659. smalltalk.addMethod(
  8660. smalltalk.method({
  8661. selector: "addAll:",
  8662. category: 'adding/removing',
  8663. fn: function (aCollection){
  8664. var self=this;
  8665. return smalltalk.withContext(function($ctx1) {
  8666. var $1;
  8667. _st(aCollection)._do_((function(each){
  8668. return smalltalk.withContext(function($ctx2) {
  8669. return self._add_(each);
  8670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8671. $1=aCollection;
  8672. return $1;
  8673. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},smalltalk.Collection)})},
  8674. args: ["aCollection"],
  8675. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self add: each].\x0a\x09^aCollection",
  8676. messageSends: ["do:", "add:"],
  8677. referencedClasses: []
  8678. }),
  8679. smalltalk.Collection);
  8680. smalltalk.addMethod(
  8681. smalltalk.method({
  8682. selector: "asArray",
  8683. category: 'converting',
  8684. fn: function (){
  8685. var self=this;
  8686. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  8687. return smalltalk.withContext(function($ctx1) {
  8688. var $1;
  8689. $1=_st($Array())._withAll_(self);
  8690. return $1;
  8691. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Collection)})},
  8692. args: [],
  8693. source: "asArray\x0a\x09^Array withAll: self",
  8694. messageSends: ["withAll:"],
  8695. referencedClasses: ["Array"]
  8696. }),
  8697. smalltalk.Collection);
  8698. smalltalk.addMethod(
  8699. smalltalk.method({
  8700. selector: "asJSON",
  8701. category: 'converting',
  8702. fn: function (){
  8703. var self=this;
  8704. return smalltalk.withContext(function($ctx1) {
  8705. var $1;
  8706. $1=_st(self._asArray())._collect_((function(each){
  8707. return smalltalk.withContext(function($ctx2) {
  8708. return _st(each)._asJSON();
  8709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8710. return $1;
  8711. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Collection)})},
  8712. args: [],
  8713. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  8714. messageSends: ["collect:", "asArray", "asJSON"],
  8715. referencedClasses: []
  8716. }),
  8717. smalltalk.Collection);
  8718. smalltalk.addMethod(
  8719. smalltalk.method({
  8720. selector: "asOrderedCollection",
  8721. category: 'converting',
  8722. fn: function (){
  8723. var self=this;
  8724. return smalltalk.withContext(function($ctx1) {
  8725. var $1;
  8726. $1=self._asArray();
  8727. return $1;
  8728. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},smalltalk.Collection)})},
  8729. args: [],
  8730. source: "asOrderedCollection\x0a\x09^self asArray",
  8731. messageSends: ["asArray"],
  8732. referencedClasses: []
  8733. }),
  8734. smalltalk.Collection);
  8735. smalltalk.addMethod(
  8736. smalltalk.method({
  8737. selector: "asSet",
  8738. category: 'converting',
  8739. fn: function (){
  8740. var self=this;
  8741. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  8742. return smalltalk.withContext(function($ctx1) {
  8743. var $1;
  8744. $1=_st($Set())._withAll_(self);
  8745. return $1;
  8746. }, function($ctx1) {$ctx1.fill(self,"asSet",{},smalltalk.Collection)})},
  8747. args: [],
  8748. source: "asSet\x0a\x09^Set withAll: self",
  8749. messageSends: ["withAll:"],
  8750. referencedClasses: ["Set"]
  8751. }),
  8752. smalltalk.Collection);
  8753. smalltalk.addMethod(
  8754. smalltalk.method({
  8755. selector: "collect:",
  8756. category: 'enumerating',
  8757. fn: function (aBlock){
  8758. var self=this;
  8759. var stream;
  8760. return smalltalk.withContext(function($ctx1) {
  8761. var $1;
  8762. stream=_st(_st(self._class())._new())._writeStream();
  8763. self._do_((function(each){
  8764. return smalltalk.withContext(function($ctx2) {
  8765. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  8766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8767. $1=_st(stream)._contents();
  8768. return $1;
  8769. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  8770. args: ["aBlock"],
  8771. 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",
  8772. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  8773. referencedClasses: []
  8774. }),
  8775. smalltalk.Collection);
  8776. smalltalk.addMethod(
  8777. smalltalk.method({
  8778. selector: "contains:",
  8779. category: 'testing',
  8780. fn: function (aBlock){
  8781. var self=this;
  8782. return smalltalk.withContext(function($ctx1) {
  8783. var $1;
  8784. var $early={};
  8785. try {
  8786. self._do_((function(each){
  8787. return smalltalk.withContext(function($ctx2) {
  8788. $1=_st(aBlock)._value_(each);
  8789. if(smalltalk.assert($1)){
  8790. throw $early=[true];
  8791. };
  8792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8793. return false;
  8794. }
  8795. catch(e) {if(e===$early)return e[0]; throw e}
  8796. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},smalltalk.Collection)})},
  8797. args: ["aBlock"],
  8798. source: "contains: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8799. messageSends: ["do:", "ifTrue:", "value:"],
  8800. referencedClasses: []
  8801. }),
  8802. smalltalk.Collection);
  8803. smalltalk.addMethod(
  8804. smalltalk.method({
  8805. selector: "copyWith:",
  8806. category: 'copying',
  8807. fn: function (anObject){
  8808. var self=this;
  8809. return smalltalk.withContext(function($ctx1) {
  8810. var $2,$3,$1;
  8811. $2=self._copy();
  8812. _st($2)._add_(anObject);
  8813. $3=_st($2)._yourself();
  8814. $1=$3;
  8815. return $1;
  8816. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},smalltalk.Collection)})},
  8817. args: ["anObject"],
  8818. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  8819. messageSends: ["add:", "copy", "yourself"],
  8820. referencedClasses: []
  8821. }),
  8822. smalltalk.Collection);
  8823. smalltalk.addMethod(
  8824. smalltalk.method({
  8825. selector: "copyWithAll:",
  8826. category: 'copying',
  8827. fn: function (aCollection){
  8828. var self=this;
  8829. return smalltalk.withContext(function($ctx1) {
  8830. var $2,$3,$1;
  8831. $2=self._copy();
  8832. _st($2)._addAll_(aCollection);
  8833. $3=_st($2)._yourself();
  8834. $1=$3;
  8835. return $1;
  8836. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},smalltalk.Collection)})},
  8837. args: ["aCollection"],
  8838. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  8839. messageSends: ["addAll:", "copy", "yourself"],
  8840. referencedClasses: []
  8841. }),
  8842. smalltalk.Collection);
  8843. smalltalk.addMethod(
  8844. smalltalk.method({
  8845. selector: "copyWithoutAll:",
  8846. category: 'copying',
  8847. fn: function (aCollection){
  8848. var self=this;
  8849. return smalltalk.withContext(function($ctx1) {
  8850. var $1;
  8851. $1=self._reject_((function(each){
  8852. return smalltalk.withContext(function($ctx2) {
  8853. return _st(aCollection)._includes_(each);
  8854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8855. return $1;
  8856. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},smalltalk.Collection)})},
  8857. args: ["aCollection"],
  8858. 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]",
  8859. messageSends: ["reject:", "includes:"],
  8860. referencedClasses: []
  8861. }),
  8862. smalltalk.Collection);
  8863. smalltalk.addMethod(
  8864. smalltalk.method({
  8865. selector: "detect:",
  8866. category: 'enumerating',
  8867. fn: function (aBlock){
  8868. var self=this;
  8869. return smalltalk.withContext(function($ctx1) {
  8870. var $1;
  8871. $1=self._detect_ifNone_(aBlock,(function(){
  8872. return smalltalk.withContext(function($ctx2) {
  8873. return self._errorNotFound();
  8874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8875. return $1;
  8876. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},smalltalk.Collection)})},
  8877. args: ["aBlock"],
  8878. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  8879. messageSends: ["detect:ifNone:", "errorNotFound"],
  8880. referencedClasses: []
  8881. }),
  8882. smalltalk.Collection);
  8883. smalltalk.addMethod(
  8884. smalltalk.method({
  8885. selector: "detect:ifNone:",
  8886. category: 'enumerating',
  8887. fn: function (aBlock,anotherBlock){
  8888. var self=this;
  8889. return smalltalk.withContext(function($ctx1) {
  8890. self._subclassResponsibility();
  8891. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Collection)})},
  8892. args: ["aBlock", "anotherBlock"],
  8893. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  8894. messageSends: ["subclassResponsibility"],
  8895. referencedClasses: []
  8896. }),
  8897. smalltalk.Collection);
  8898. smalltalk.addMethod(
  8899. smalltalk.method({
  8900. selector: "do:",
  8901. category: 'enumerating',
  8902. fn: function (aBlock){
  8903. var self=this;
  8904. return smalltalk.withContext(function($ctx1) {
  8905. self._subclassResponsibility();
  8906. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Collection)})},
  8907. args: ["aBlock"],
  8908. source: "do: aBlock\x0a\x09self subclassResponsibility",
  8909. messageSends: ["subclassResponsibility"],
  8910. referencedClasses: []
  8911. }),
  8912. smalltalk.Collection);
  8913. smalltalk.addMethod(
  8914. smalltalk.method({
  8915. selector: "do:separatedBy:",
  8916. category: 'enumerating',
  8917. fn: function (aBlock,anotherBlock){
  8918. var self=this;
  8919. var actionBeforeElement;
  8920. return smalltalk.withContext(function($ctx1) {
  8921. actionBeforeElement=(function(){
  8922. return smalltalk.withContext(function($ctx2) {
  8923. actionBeforeElement=anotherBlock;
  8924. return actionBeforeElement;
  8925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  8926. self._do_((function(each){
  8927. return smalltalk.withContext(function($ctx2) {
  8928. _st(actionBeforeElement)._value();
  8929. return _st(aBlock)._value_(each);
  8930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  8931. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},smalltalk.Collection)})},
  8932. args: ["aBlock", "anotherBlock"],
  8933. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [actionBeforeElement := anotherBlock].\x0a\x09self do: [:each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each]",
  8934. messageSends: ["do:", "value", "value:"],
  8935. referencedClasses: []
  8936. }),
  8937. smalltalk.Collection);
  8938. smalltalk.addMethod(
  8939. smalltalk.method({
  8940. selector: "errorNotFound",
  8941. category: 'error handling',
  8942. fn: function (){
  8943. var self=this;
  8944. return smalltalk.withContext(function($ctx1) {
  8945. self._error_("Object is not in the collection");
  8946. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},smalltalk.Collection)})},
  8947. args: [],
  8948. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8949. messageSends: ["error:"],
  8950. referencedClasses: []
  8951. }),
  8952. smalltalk.Collection);
  8953. smalltalk.addMethod(
  8954. smalltalk.method({
  8955. selector: "ifEmpty:",
  8956. category: 'testing',
  8957. fn: function (aBlock){
  8958. var self=this;
  8959. return smalltalk.withContext(function($ctx1) {
  8960. var $2,$1;
  8961. $2=self._isEmpty();
  8962. if(smalltalk.assert($2)){
  8963. $1=_st(aBlock)._value();
  8964. } else {
  8965. $1=self;
  8966. };
  8967. return $1;
  8968. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  8969. args: ["aBlock"],
  8970. 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 ]",
  8971. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"],
  8972. referencedClasses: []
  8973. }),
  8974. smalltalk.Collection);
  8975. smalltalk.addMethod(
  8976. smalltalk.method({
  8977. selector: "ifNotEmpty:",
  8978. category: 'testing',
  8979. fn: function (aBlock){
  8980. var self=this;
  8981. return smalltalk.withContext(function($ctx1) {
  8982. var $1;
  8983. $1=self._notEmpty();
  8984. _st($1)._ifTrue_(aBlock);
  8985. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},smalltalk.Collection)})},
  8986. args: ["aBlock"],
  8987. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  8988. messageSends: ["ifTrue:", "notEmpty"],
  8989. referencedClasses: []
  8990. }),
  8991. smalltalk.Collection);
  8992. smalltalk.addMethod(
  8993. smalltalk.method({
  8994. selector: "includes:",
  8995. category: 'testing',
  8996. fn: function (anObject){
  8997. var self=this;
  8998. var sentinel;
  8999. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  9000. return smalltalk.withContext(function($ctx1) {
  9001. var $1;
  9002. sentinel=_st($Object())._new();
  9003. $1=_st(self._detect_ifNone_((function(each){
  9004. return smalltalk.withContext(function($ctx2) {
  9005. return _st(each).__eq(anObject);
  9006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  9007. return smalltalk.withContext(function($ctx2) {
  9008. return sentinel;
  9009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__tild_eq(sentinel);
  9010. return $1;
  9011. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel},smalltalk.Collection)})},
  9012. args: ["anObject"],
  9013. source: "includes: anObject\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  9014. messageSends: ["new", "~=", "detect:ifNone:", "="],
  9015. referencedClasses: ["Object"]
  9016. }),
  9017. smalltalk.Collection);
  9018. smalltalk.addMethod(
  9019. smalltalk.method({
  9020. selector: "inject:into:",
  9021. category: 'enumerating',
  9022. fn: function (anObject,aBlock){
  9023. var self=this;
  9024. var result;
  9025. return smalltalk.withContext(function($ctx1) {
  9026. var $1;
  9027. result=anObject;
  9028. self._do_((function(each){
  9029. return smalltalk.withContext(function($ctx2) {
  9030. result=_st(aBlock)._value_value_(result,each);
  9031. return result;
  9032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9033. $1=result;
  9034. return $1;
  9035. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},smalltalk.Collection)})},
  9036. args: ["anObject", "aBlock"],
  9037. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each |\x0a\x09\x09result := aBlock value: result value: each].\x0a\x09^result",
  9038. messageSends: ["do:", "value:value:"],
  9039. referencedClasses: []
  9040. }),
  9041. smalltalk.Collection);
  9042. smalltalk.addMethod(
  9043. smalltalk.method({
  9044. selector: "intersection:",
  9045. category: 'enumerating',
  9046. fn: function (aCollection){
  9047. var self=this;
  9048. var set,outputSet;
  9049. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  9050. return smalltalk.withContext(function($ctx1) {
  9051. var $1,$2;
  9052. set=self._asSet();
  9053. outputSet=_st($Set())._new();
  9054. _st(aCollection)._do_((function(each){
  9055. return smalltalk.withContext(function($ctx2) {
  9056. $1=_st(_st(set)._includes_(each))._and_((function(){
  9057. return smalltalk.withContext(function($ctx3) {
  9058. return _st(_st(outputSet)._includes_(each))._not();
  9059. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  9060. if(smalltalk.assert($1)){
  9061. return _st(outputSet)._add_(each);
  9062. };
  9063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9064. $2=_st(self._class())._withAll_(_st(outputSet)._asArray());
  9065. return $2;
  9066. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},smalltalk.Collection)})},
  9067. args: ["aCollection"],
  9068. 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",
  9069. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"],
  9070. referencedClasses: ["Set"]
  9071. }),
  9072. smalltalk.Collection);
  9073. smalltalk.addMethod(
  9074. smalltalk.method({
  9075. selector: "isEmpty",
  9076. category: 'testing',
  9077. fn: function (){
  9078. var self=this;
  9079. return smalltalk.withContext(function($ctx1) {
  9080. var $1;
  9081. $1=_st(self._size()).__eq((0));
  9082. return $1;
  9083. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Collection)})},
  9084. args: [],
  9085. source: "isEmpty\x0a\x09^self size = 0",
  9086. messageSends: ["=", "size"],
  9087. referencedClasses: []
  9088. }),
  9089. smalltalk.Collection);
  9090. smalltalk.addMethod(
  9091. smalltalk.method({
  9092. selector: "notEmpty",
  9093. category: 'testing',
  9094. fn: function (){
  9095. var self=this;
  9096. return smalltalk.withContext(function($ctx1) {
  9097. var $1;
  9098. $1=_st(self._isEmpty())._not();
  9099. return $1;
  9100. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},smalltalk.Collection)})},
  9101. args: [],
  9102. source: "notEmpty\x0a\x09^self isEmpty not",
  9103. messageSends: ["not", "isEmpty"],
  9104. referencedClasses: []
  9105. }),
  9106. smalltalk.Collection);
  9107. smalltalk.addMethod(
  9108. smalltalk.method({
  9109. selector: "occurrencesOf:",
  9110. category: 'accessing',
  9111. fn: function (anObject){
  9112. var self=this;
  9113. var tally;
  9114. return smalltalk.withContext(function($ctx1) {
  9115. var $1,$2;
  9116. tally=(0);
  9117. self._do_((function(each){
  9118. return smalltalk.withContext(function($ctx2) {
  9119. $1=_st(anObject).__eq(each);
  9120. if(smalltalk.assert($1)){
  9121. tally=_st(tally).__plus((1));
  9122. return tally;
  9123. };
  9124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9125. $2=tally;
  9126. return $2;
  9127. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},smalltalk.Collection)})},
  9128. args: ["anObject"],
  9129. 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",
  9130. messageSends: ["do:", "ifTrue:", "=", "+"],
  9131. referencedClasses: []
  9132. }),
  9133. smalltalk.Collection);
  9134. smalltalk.addMethod(
  9135. smalltalk.method({
  9136. selector: "putOn:",
  9137. category: 'streaming',
  9138. fn: function (aStream){
  9139. var self=this;
  9140. return smalltalk.withContext(function($ctx1) {
  9141. self._do_((function(each){
  9142. return smalltalk.withContext(function($ctx2) {
  9143. return _st(each)._putOn_(aStream);
  9144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9145. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.Collection)})},
  9146. args: ["aStream"],
  9147. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  9148. messageSends: ["do:", "putOn:"],
  9149. referencedClasses: []
  9150. }),
  9151. smalltalk.Collection);
  9152. smalltalk.addMethod(
  9153. smalltalk.method({
  9154. selector: "reject:",
  9155. category: 'enumerating',
  9156. fn: function (aBlock){
  9157. var self=this;
  9158. return smalltalk.withContext(function($ctx1) {
  9159. var $1;
  9160. $1=self._select_((function(each){
  9161. return smalltalk.withContext(function($ctx2) {
  9162. return _st(_st(aBlock)._value_(each)).__eq(false);
  9163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9164. return $1;
  9165. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},smalltalk.Collection)})},
  9166. args: ["aBlock"],
  9167. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  9168. messageSends: ["select:", "=", "value:"],
  9169. referencedClasses: []
  9170. }),
  9171. smalltalk.Collection);
  9172. smalltalk.addMethod(
  9173. smalltalk.method({
  9174. selector: "remove:",
  9175. category: 'adding/removing',
  9176. fn: function (anObject){
  9177. var self=this;
  9178. return smalltalk.withContext(function($ctx1) {
  9179. var $1;
  9180. $1=self._remove_ifAbsent_(anObject,(function(){
  9181. return smalltalk.withContext(function($ctx2) {
  9182. return self._errorNotFound();
  9183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9184. return $1;
  9185. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Collection)})},
  9186. args: ["anObject"],
  9187. source: "remove: anObject\x0a\x09^self remove: anObject ifAbsent: [self errorNotFound]",
  9188. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  9189. referencedClasses: []
  9190. }),
  9191. smalltalk.Collection);
  9192. smalltalk.addMethod(
  9193. smalltalk.method({
  9194. selector: "remove:ifAbsent:",
  9195. category: 'adding/removing',
  9196. fn: function (anObject,aBlock){
  9197. var self=this;
  9198. return smalltalk.withContext(function($ctx1) {
  9199. self._subclassResponsibility();
  9200. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Collection)})},
  9201. args: ["anObject", "aBlock"],
  9202. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9203. messageSends: ["subclassResponsibility"],
  9204. referencedClasses: []
  9205. }),
  9206. smalltalk.Collection);
  9207. smalltalk.addMethod(
  9208. smalltalk.method({
  9209. selector: "select:",
  9210. category: 'enumerating',
  9211. fn: function (aBlock){
  9212. var self=this;
  9213. var stream;
  9214. return smalltalk.withContext(function($ctx1) {
  9215. var $1,$2;
  9216. stream=_st(_st(self._class())._new())._writeStream();
  9217. self._do_((function(each){
  9218. return smalltalk.withContext(function($ctx2) {
  9219. $1=_st(aBlock)._value_(each);
  9220. if(smalltalk.assert($1)){
  9221. return _st(stream)._nextPut_(each);
  9222. };
  9223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9224. $2=_st(stream)._contents();
  9225. return $2;
  9226. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},smalltalk.Collection)})},
  9227. args: ["aBlock"],
  9228. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  9229. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  9230. referencedClasses: []
  9231. }),
  9232. smalltalk.Collection);
  9233. smalltalk.addMethod(
  9234. smalltalk.method({
  9235. selector: "select:thenCollect:",
  9236. category: 'enumerating',
  9237. fn: function (selectBlock,collectBlock){
  9238. var self=this;
  9239. var stream;
  9240. return smalltalk.withContext(function($ctx1) {
  9241. var $1,$2;
  9242. stream=_st(_st(self._class())._new())._writeStream();
  9243. self._do_((function(each){
  9244. return smalltalk.withContext(function($ctx2) {
  9245. $1=_st(selectBlock)._value_(each);
  9246. if(smalltalk.assert($1)){
  9247. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  9248. };
  9249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9250. $2=_st(stream)._contents();
  9251. return $2;
  9252. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},smalltalk.Collection)})},
  9253. args: ["selectBlock", "collectBlock"],
  9254. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each)]].\x0a\x09^stream contents",
  9255. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  9256. referencedClasses: []
  9257. }),
  9258. smalltalk.Collection);
  9259. smalltalk.addMethod(
  9260. smalltalk.method({
  9261. selector: "size",
  9262. category: 'accessing',
  9263. fn: function (){
  9264. var self=this;
  9265. return smalltalk.withContext(function($ctx1) {
  9266. self._subclassResponsibility();
  9267. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Collection)})},
  9268. args: [],
  9269. source: "size\x0a\x09self subclassResponsibility",
  9270. messageSends: ["subclassResponsibility"],
  9271. referencedClasses: []
  9272. }),
  9273. smalltalk.Collection);
  9274. smalltalk.addMethod(
  9275. smalltalk.method({
  9276. selector: "heliosClass",
  9277. category: 'helios',
  9278. fn: function (){
  9279. var self=this;
  9280. return smalltalk.withContext(function($ctx1) {
  9281. return "collection";
  9282. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Collection.klass)})},
  9283. args: [],
  9284. source: "heliosClass\x0a\x09^ 'collection'",
  9285. messageSends: [],
  9286. referencedClasses: []
  9287. }),
  9288. smalltalk.Collection.klass);
  9289. smalltalk.addMethod(
  9290. smalltalk.method({
  9291. selector: "new:",
  9292. category: 'instance creation',
  9293. fn: function (anInteger){
  9294. var self=this;
  9295. return smalltalk.withContext(function($ctx1) {
  9296. var $1;
  9297. $1=self._new();
  9298. return $1;
  9299. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Collection.klass)})},
  9300. args: ["anInteger"],
  9301. source: "new: anInteger\x0a\x09^self new",
  9302. messageSends: ["new"],
  9303. referencedClasses: []
  9304. }),
  9305. smalltalk.Collection.klass);
  9306. smalltalk.addMethod(
  9307. smalltalk.method({
  9308. selector: "with:",
  9309. category: 'instance creation',
  9310. fn: function (anObject){
  9311. var self=this;
  9312. return smalltalk.withContext(function($ctx1) {
  9313. var $2,$3,$1;
  9314. $2=self._new();
  9315. _st($2)._add_(anObject);
  9316. $3=_st($2)._yourself();
  9317. $1=$3;
  9318. return $1;
  9319. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Collection.klass)})},
  9320. args: ["anObject"],
  9321. source: "with: anObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  9322. messageSends: ["add:", "new", "yourself"],
  9323. referencedClasses: []
  9324. }),
  9325. smalltalk.Collection.klass);
  9326. smalltalk.addMethod(
  9327. smalltalk.method({
  9328. selector: "with:with:",
  9329. category: 'instance creation',
  9330. fn: function (anObject,anotherObject){
  9331. var self=this;
  9332. return smalltalk.withContext(function($ctx1) {
  9333. var $2,$3,$1;
  9334. $2=self._new();
  9335. _st($2)._add_(anObject);
  9336. _st($2)._add_(anotherObject);
  9337. $3=_st($2)._yourself();
  9338. $1=$3;
  9339. return $1;
  9340. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},smalltalk.Collection.klass)})},
  9341. args: ["anObject", "anotherObject"],
  9342. source: "with: anObject with: anotherObject\x0a\x09\x09^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  9343. messageSends: ["add:", "new", "yourself"],
  9344. referencedClasses: []
  9345. }),
  9346. smalltalk.Collection.klass);
  9347. smalltalk.addMethod(
  9348. smalltalk.method({
  9349. selector: "with:with:with:",
  9350. category: 'instance creation',
  9351. fn: function (firstObject,secondObject,thirdObject){
  9352. var self=this;
  9353. return smalltalk.withContext(function($ctx1) {
  9354. var $2,$3,$1;
  9355. $2=self._new();
  9356. _st($2)._add_(firstObject);
  9357. _st($2)._add_(secondObject);
  9358. _st($2)._add_(thirdObject);
  9359. $3=_st($2)._yourself();
  9360. $1=$3;
  9361. return $1;
  9362. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},smalltalk.Collection.klass)})},
  9363. args: ["firstObject", "secondObject", "thirdObject"],
  9364. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  9365. messageSends: ["add:", "new", "yourself"],
  9366. referencedClasses: []
  9367. }),
  9368. smalltalk.Collection.klass);
  9369. smalltalk.addMethod(
  9370. smalltalk.method({
  9371. selector: "withAll:",
  9372. category: 'instance creation',
  9373. fn: function (aCollection){
  9374. var self=this;
  9375. return smalltalk.withContext(function($ctx1) {
  9376. var $2,$3,$1;
  9377. $2=self._new();
  9378. _st($2)._addAll_(aCollection);
  9379. $3=_st($2)._yourself();
  9380. $1=$3;
  9381. return $1;
  9382. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},smalltalk.Collection.klass)})},
  9383. args: ["aCollection"],
  9384. source: "withAll: aCollection\x0a\x09\x09^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9385. messageSends: ["addAll:", "new", "yourself"],
  9386. referencedClasses: []
  9387. }),
  9388. smalltalk.Collection.klass);
  9389. smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  9390. smalltalk.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  9391. smalltalk.addMethod(
  9392. smalltalk.method({
  9393. selector: "at:",
  9394. category: 'accessing',
  9395. fn: function (anIndex){
  9396. var self=this;
  9397. return smalltalk.withContext(function($ctx1) {
  9398. var $1;
  9399. $1=self._at_ifAbsent_(anIndex,(function(){
  9400. return smalltalk.withContext(function($ctx2) {
  9401. return self._errorNotFound();
  9402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9403. return $1;
  9404. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},smalltalk.IndexableCollection)})},
  9405. args: ["anIndex"],
  9406. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^self at: anIndex ifAbsent: [ self errorNotFound ]",
  9407. messageSends: ["at:ifAbsent:", "errorNotFound"],
  9408. referencedClasses: []
  9409. }),
  9410. smalltalk.IndexableCollection);
  9411. smalltalk.addMethod(
  9412. smalltalk.method({
  9413. selector: "at:ifAbsent:",
  9414. category: 'accessing',
  9415. fn: function (anIndex,aBlock){
  9416. var self=this;
  9417. return smalltalk.withContext(function($ctx1) {
  9418. self._subclassReponsibility();
  9419. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  9420. args: ["anIndex", "aBlock"],
  9421. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassReponsibility",
  9422. messageSends: ["subclassReponsibility"],
  9423. referencedClasses: []
  9424. }),
  9425. smalltalk.IndexableCollection);
  9426. smalltalk.addMethod(
  9427. smalltalk.method({
  9428. selector: "at:ifPresent:",
  9429. category: 'accessing',
  9430. fn: function (anIndex,aBlock){
  9431. var self=this;
  9432. return smalltalk.withContext(function($ctx1) {
  9433. var $1;
  9434. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9435. return smalltalk.withContext(function($ctx2) {
  9436. return nil;
  9437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9438. return $1;
  9439. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.IndexableCollection)})},
  9440. args: ["anIndex", "aBlock"],
  9441. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  9442. messageSends: ["at:ifPresent:ifAbsent:"],
  9443. referencedClasses: []
  9444. }),
  9445. smalltalk.IndexableCollection);
  9446. smalltalk.addMethod(
  9447. smalltalk.method({
  9448. selector: "at:ifPresent:ifAbsent:",
  9449. category: 'accessing',
  9450. fn: function (anIndex,aBlock,anotherBlock){
  9451. var self=this;
  9452. return smalltalk.withContext(function($ctx1) {
  9453. self._subclassResponsibility();
  9454. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.IndexableCollection)})},
  9455. args: ["anIndex", "aBlock", "anotherBlock"],
  9456. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  9457. messageSends: ["subclassResponsibility"],
  9458. referencedClasses: []
  9459. }),
  9460. smalltalk.IndexableCollection);
  9461. smalltalk.addMethod(
  9462. smalltalk.method({
  9463. selector: "at:put:",
  9464. category: 'accessing',
  9465. fn: function (anIndex,anObject){
  9466. var self=this;
  9467. return smalltalk.withContext(function($ctx1) {
  9468. self._subclassReponsibility();
  9469. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.IndexableCollection)})},
  9470. args: ["anIndex", "anObject"],
  9471. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassReponsibility",
  9472. messageSends: ["subclassReponsibility"],
  9473. referencedClasses: []
  9474. }),
  9475. smalltalk.IndexableCollection);
  9476. smalltalk.addMethod(
  9477. smalltalk.method({
  9478. selector: "indexOf:",
  9479. category: 'accessing',
  9480. fn: function (anObject){
  9481. var self=this;
  9482. return smalltalk.withContext(function($ctx1) {
  9483. var $1;
  9484. $1=self._indexOf_ifAbsent_(anObject,(function(){
  9485. return smalltalk.withContext(function($ctx2) {
  9486. return self._errorNotFound();
  9487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9488. return $1;
  9489. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},smalltalk.IndexableCollection)})},
  9490. args: ["anObject"],
  9491. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  9492. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  9493. referencedClasses: []
  9494. }),
  9495. smalltalk.IndexableCollection);
  9496. smalltalk.addMethod(
  9497. smalltalk.method({
  9498. selector: "indexOf:ifAbsent:",
  9499. category: 'accessing',
  9500. fn: function (anObject,aBlock){
  9501. var self=this;
  9502. return smalltalk.withContext(function($ctx1) {
  9503. self._subclassResponsibility();
  9504. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.IndexableCollection)})},
  9505. args: ["anObject", "aBlock"],
  9506. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  9507. messageSends: ["subclassResponsibility"],
  9508. referencedClasses: []
  9509. }),
  9510. smalltalk.IndexableCollection);
  9511. smalltalk.addMethod(
  9512. smalltalk.method({
  9513. selector: "with:do:",
  9514. category: 'enumarating',
  9515. fn: function (anotherCollection,aBlock){
  9516. var self=this;
  9517. return smalltalk.withContext(function($ctx1) {
  9518. self._withIndexDo_((function(each,index){
  9519. return smalltalk.withContext(function($ctx2) {
  9520. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  9521. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  9522. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.IndexableCollection)})},
  9523. args: ["anotherCollection", "aBlock"],
  9524. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  9525. messageSends: ["withIndexDo:", "value:value:", "at:"],
  9526. referencedClasses: []
  9527. }),
  9528. smalltalk.IndexableCollection);
  9529. smalltalk.addMethod(
  9530. smalltalk.method({
  9531. selector: "withIndexDo:",
  9532. category: 'enumarating',
  9533. fn: function (aBlock){
  9534. var self=this;
  9535. return smalltalk.withContext(function($ctx1) {
  9536. self._subclassReponsibility();
  9537. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.IndexableCollection)})},
  9538. args: ["aBlock"],
  9539. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassReponsibility",
  9540. messageSends: ["subclassReponsibility"],
  9541. referencedClasses: []
  9542. }),
  9543. smalltalk.IndexableCollection);
  9544. smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  9545. smalltalk.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9546. smalltalk.addMethod(
  9547. smalltalk.method({
  9548. selector: ",",
  9549. category: 'copying',
  9550. fn: function (aCollection){
  9551. var self=this;
  9552. return smalltalk.withContext(function($ctx1) {
  9553. self._shouldNotImplement();
  9554. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},smalltalk.HashedCollection)})},
  9555. args: ["aCollection"],
  9556. source: ", aCollection\x0a\x09self shouldNotImplement",
  9557. messageSends: ["shouldNotImplement"],
  9558. referencedClasses: []
  9559. }),
  9560. smalltalk.HashedCollection);
  9561. smalltalk.addMethod(
  9562. smalltalk.method({
  9563. selector: "=",
  9564. category: 'comparing',
  9565. fn: function (aHashedCollection){
  9566. var self=this;
  9567. return smalltalk.withContext(function($ctx1) {
  9568. var $1,$2,$3;
  9569. $1=_st(self._class()).__eq(_st(aHashedCollection)._class());
  9570. if(! smalltalk.assert($1)){
  9571. return false;
  9572. };
  9573. $2=_st(self._size()).__eq(_st(aHashedCollection)._size());
  9574. if(! smalltalk.assert($2)){
  9575. return false;
  9576. };
  9577. $3=_st(self._associations()).__eq(_st(aHashedCollection)._associations());
  9578. return $3;
  9579. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  9580. args: ["aHashedCollection"],
  9581. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  9582. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  9583. referencedClasses: []
  9584. }),
  9585. smalltalk.HashedCollection);
  9586. smalltalk.addMethod(
  9587. smalltalk.method({
  9588. selector: "add:",
  9589. category: 'adding/removing',
  9590. fn: function (anAssociation){
  9591. var self=this;
  9592. return smalltalk.withContext(function($ctx1) {
  9593. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  9594. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},smalltalk.HashedCollection)})},
  9595. args: ["anAssociation"],
  9596. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  9597. messageSends: ["at:put:", "key", "value"],
  9598. referencedClasses: []
  9599. }),
  9600. smalltalk.HashedCollection);
  9601. smalltalk.addMethod(
  9602. smalltalk.method({
  9603. selector: "addAll:",
  9604. category: 'adding/removing',
  9605. fn: function (aHashedCollection){
  9606. var self=this;
  9607. return smalltalk.withContext(function($ctx1) {
  9608. var $1;
  9609. smalltalk.HashedCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  9610. $1=aHashedCollection;
  9611. return $1;
  9612. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection},smalltalk.HashedCollection)})},
  9613. args: ["aHashedCollection"],
  9614. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  9615. messageSends: ["addAll:", "associations"],
  9616. referencedClasses: []
  9617. }),
  9618. smalltalk.HashedCollection);
  9619. smalltalk.addMethod(
  9620. smalltalk.method({
  9621. selector: "asDictionary",
  9622. category: 'converting',
  9623. fn: function (){
  9624. var self=this;
  9625. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  9626. return smalltalk.withContext(function($ctx1) {
  9627. var $1;
  9628. $1=_st($Dictionary())._from_(self._associations());
  9629. return $1;
  9630. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},smalltalk.HashedCollection)})},
  9631. args: [],
  9632. source: "asDictionary\x0a\x09^Dictionary from: self associations",
  9633. messageSends: ["from:", "associations"],
  9634. referencedClasses: ["Dictionary"]
  9635. }),
  9636. smalltalk.HashedCollection);
  9637. smalltalk.addMethod(
  9638. smalltalk.method({
  9639. selector: "asJSON",
  9640. category: 'converting',
  9641. fn: function (){
  9642. var self=this;
  9643. var c;
  9644. return smalltalk.withContext(function($ctx1) {
  9645. var $1;
  9646. c=_st(self._class())._new();
  9647. self._keysAndValuesDo_((function(key,value){
  9648. return smalltalk.withContext(function($ctx2) {
  9649. return _st(c)._at_put_(key,_st(value)._asJSON());
  9650. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  9651. $1=c;
  9652. return $1;
  9653. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c},smalltalk.HashedCollection)})},
  9654. args: [],
  9655. 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",
  9656. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  9657. referencedClasses: []
  9658. }),
  9659. smalltalk.HashedCollection);
  9660. smalltalk.addMethod(
  9661. smalltalk.method({
  9662. selector: "associations",
  9663. category: 'accessing',
  9664. fn: function (){
  9665. var self=this;
  9666. var associations;
  9667. return smalltalk.withContext(function($ctx1) {
  9668. var $1;
  9669. associations=[];
  9670. self._associationsDo_((function(each){
  9671. return smalltalk.withContext(function($ctx2) {
  9672. return _st(associations)._add_(each);
  9673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9674. $1=associations;
  9675. return $1;
  9676. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},smalltalk.HashedCollection)})},
  9677. args: [],
  9678. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
  9679. messageSends: ["associationsDo:", "add:"],
  9680. referencedClasses: []
  9681. }),
  9682. smalltalk.HashedCollection);
  9683. smalltalk.addMethod(
  9684. smalltalk.method({
  9685. selector: "associationsDo:",
  9686. category: 'enumerating',
  9687. fn: function (aBlock){
  9688. var self=this;
  9689. function $Association(){return smalltalk.Association||(typeof Association=="undefined"?nil:Association)}
  9690. return smalltalk.withContext(function($ctx1) {
  9691. self._keysAndValuesDo_((function(key,value){
  9692. return smalltalk.withContext(function($ctx2) {
  9693. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  9694. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  9695. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  9696. args: ["aBlock"],
  9697. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09aBlock value: (Association key: key value: value)]",
  9698. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  9699. referencedClasses: ["Association"]
  9700. }),
  9701. smalltalk.HashedCollection);
  9702. smalltalk.addMethod(
  9703. smalltalk.method({
  9704. selector: "at:ifAbsent:",
  9705. category: 'accessing',
  9706. fn: function (aKey,aBlock){
  9707. var self=this;
  9708. return smalltalk.withContext(function($ctx1) {
  9709. var $2,$1;
  9710. $2=self._includesKey_(aKey);
  9711. $1=_st($2)._ifTrue_ifFalse_((function(){
  9712. return smalltalk.withContext(function($ctx2) {
  9713. return self._basicAt_(aKey);
  9714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),aBlock);
  9715. return $1;
  9716. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  9717. args: ["aKey", "aBlock"],
  9718. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  9719. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:"],
  9720. referencedClasses: []
  9721. }),
  9722. smalltalk.HashedCollection);
  9723. smalltalk.addMethod(
  9724. smalltalk.method({
  9725. selector: "at:ifAbsentPut:",
  9726. category: 'accessing',
  9727. fn: function (aKey,aBlock){
  9728. var self=this;
  9729. return smalltalk.withContext(function($ctx1) {
  9730. var $1;
  9731. $1=self._at_ifAbsent_(aKey,(function(){
  9732. return smalltalk.withContext(function($ctx2) {
  9733. return self._at_put_(aKey,_st(aBlock)._value());
  9734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9735. return $1;
  9736. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  9737. args: ["aKey", "aBlock"],
  9738. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value]",
  9739. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  9740. referencedClasses: []
  9741. }),
  9742. smalltalk.HashedCollection);
  9743. smalltalk.addMethod(
  9744. smalltalk.method({
  9745. selector: "at:ifPresent:ifAbsent:",
  9746. category: 'accessing',
  9747. fn: function (aKey,aBlock,anotherBlock){
  9748. var self=this;
  9749. return smalltalk.withContext(function($ctx1) {
  9750. var $2,$1;
  9751. $2=self._includesKey_(aKey);
  9752. $1=_st($2)._ifTrue_ifFalse_((function(){
  9753. return smalltalk.withContext(function($ctx2) {
  9754. return _st(aBlock)._value_(self._at_(aKey));
  9755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),anotherBlock);
  9756. return $1;
  9757. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  9758. args: ["aKey", "aBlock", "anotherBlock"],
  9759. 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",
  9760. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:"],
  9761. referencedClasses: []
  9762. }),
  9763. smalltalk.HashedCollection);
  9764. smalltalk.addMethod(
  9765. smalltalk.method({
  9766. selector: "at:put:",
  9767. category: 'accessing',
  9768. fn: function (aKey,aValue){
  9769. var self=this;
  9770. return smalltalk.withContext(function($ctx1) {
  9771. var $1;
  9772. $1=self._basicAt_put_(aKey,aValue);
  9773. return $1;
  9774. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.HashedCollection)})},
  9775. args: ["aKey", "aValue"],
  9776. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  9777. messageSends: ["basicAt:put:"],
  9778. referencedClasses: []
  9779. }),
  9780. smalltalk.HashedCollection);
  9781. smalltalk.addMethod(
  9782. smalltalk.method({
  9783. selector: "collect:",
  9784. category: 'enumerating',
  9785. fn: function (aBlock){
  9786. var self=this;
  9787. var newDict;
  9788. return smalltalk.withContext(function($ctx1) {
  9789. var $1;
  9790. newDict=_st(self._class())._new();
  9791. self._keysAndValuesDo_((function(key,value){
  9792. return smalltalk.withContext(function($ctx2) {
  9793. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  9794. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  9795. $1=newDict;
  9796. return $1;
  9797. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  9798. args: ["aBlock"],
  9799. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  9800. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  9801. referencedClasses: []
  9802. }),
  9803. smalltalk.HashedCollection);
  9804. smalltalk.addMethod(
  9805. smalltalk.method({
  9806. selector: "deepCopy",
  9807. category: 'copying',
  9808. fn: function (){
  9809. var self=this;
  9810. var copy;
  9811. return smalltalk.withContext(function($ctx1) {
  9812. var $1;
  9813. copy=_st(self._class())._new();
  9814. self._keysAndValuesDo_((function(key,value){
  9815. return smalltalk.withContext(function($ctx2) {
  9816. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  9817. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  9818. $1=copy;
  9819. return $1;
  9820. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},smalltalk.HashedCollection)})},
  9821. args: [],
  9822. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value deepCopy].\x0a\x09^copy",
  9823. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  9824. referencedClasses: []
  9825. }),
  9826. smalltalk.HashedCollection);
  9827. smalltalk.addMethod(
  9828. smalltalk.method({
  9829. selector: "detect:ifNone:",
  9830. category: 'enumerating',
  9831. fn: function (aBlock,anotherBlock){
  9832. var self=this;
  9833. return smalltalk.withContext(function($ctx1) {
  9834. var $1;
  9835. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  9836. return $1;
  9837. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.HashedCollection)})},
  9838. args: ["aBlock", "anotherBlock"],
  9839. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  9840. messageSends: ["detect:ifNone:", "values"],
  9841. referencedClasses: []
  9842. }),
  9843. smalltalk.HashedCollection);
  9844. smalltalk.addMethod(
  9845. smalltalk.method({
  9846. selector: "do:",
  9847. category: 'enumerating',
  9848. fn: function (aBlock){
  9849. var self=this;
  9850. return smalltalk.withContext(function($ctx1) {
  9851. self._valuesDo_(aBlock);
  9852. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  9853. args: ["aBlock"],
  9854. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  9855. messageSends: ["valuesDo:"],
  9856. referencedClasses: []
  9857. }),
  9858. smalltalk.HashedCollection);
  9859. smalltalk.addMethod(
  9860. smalltalk.method({
  9861. selector: "includes:",
  9862. category: 'enumerating',
  9863. fn: function (anObject){
  9864. var self=this;
  9865. return smalltalk.withContext(function($ctx1) {
  9866. var $1;
  9867. $1=_st(self._values())._includes_(anObject);
  9868. return $1;
  9869. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.HashedCollection)})},
  9870. args: ["anObject"],
  9871. source: "includes: anObject\x0a\x09^self values includes: anObject",
  9872. messageSends: ["includes:", "values"],
  9873. referencedClasses: []
  9874. }),
  9875. smalltalk.HashedCollection);
  9876. smalltalk.addMethod(
  9877. smalltalk.method({
  9878. selector: "includesKey:",
  9879. category: 'testing',
  9880. fn: function (aKey){
  9881. var self=this;
  9882. return smalltalk.withContext(function($ctx1) {
  9883. return self.hasOwnProperty(aKey);
  9884. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  9885. args: ["aKey"],
  9886. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  9887. messageSends: [],
  9888. referencedClasses: []
  9889. }),
  9890. smalltalk.HashedCollection);
  9891. smalltalk.addMethod(
  9892. smalltalk.method({
  9893. selector: "indexOf:ifAbsent:",
  9894. category: 'accessing',
  9895. fn: function (anObject,aBlock){
  9896. var self=this;
  9897. return smalltalk.withContext(function($ctx1) {
  9898. var $1;
  9899. $1=_st(self._keys())._detect_ifNone_((function(each){
  9900. return smalltalk.withContext(function($ctx2) {
  9901. return _st(self._at_(each)).__eq(anObject);
  9902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),aBlock);
  9903. return $1;
  9904. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
  9905. args: ["anObject", "aBlock"],
  9906. source: "indexOf: anObject ifAbsent: aBlock\x0a\x0a\x09^ self keys detect: [ :each | (self at: each) = anObject ] ifNone: aBlock",
  9907. messageSends: ["detect:ifNone:", "keys", "=", "at:"],
  9908. referencedClasses: []
  9909. }),
  9910. smalltalk.HashedCollection);
  9911. smalltalk.addMethod(
  9912. smalltalk.method({
  9913. selector: "keyAtValue:",
  9914. category: 'accessing',
  9915. fn: function (anObject){
  9916. var self=this;
  9917. return smalltalk.withContext(function($ctx1) {
  9918. var $1;
  9919. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  9920. return smalltalk.withContext(function($ctx2) {
  9921. return self._errorNotFound();
  9922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9923. return $1;
  9924. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},smalltalk.HashedCollection)})},
  9925. args: ["anObject"],
  9926. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9927. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"],
  9928. referencedClasses: []
  9929. }),
  9930. smalltalk.HashedCollection);
  9931. smalltalk.addMethod(
  9932. smalltalk.method({
  9933. selector: "keyAtValue:ifAbsent:",
  9934. category: 'accessing',
  9935. fn: function (anObject,aBlock){
  9936. var self=this;
  9937. return smalltalk.withContext(function($ctx1) {
  9938. var $1;
  9939. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  9940. return $1;
  9941. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.HashedCollection)})},
  9942. args: ["anObject", "aBlock"],
  9943. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9944. messageSends: ["indexOf:ifAbsent:"],
  9945. referencedClasses: []
  9946. }),
  9947. smalltalk.HashedCollection);
  9948. smalltalk.addMethod(
  9949. smalltalk.method({
  9950. selector: "keys",
  9951. category: 'accessing',
  9952. fn: function (){
  9953. var self=this;
  9954. return smalltalk.withContext(function($ctx1) {
  9955. if ('function'===typeof Object.keys) return Object.keys(self);
  9956. var keys = [];
  9957. for(var i in self) {
  9958. if(self.hasOwnProperty(i)) {
  9959. keys.push(i);
  9960. }
  9961. };
  9962. return keys;
  9963. ;
  9964. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.HashedCollection)})},
  9965. args: [],
  9966. 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>",
  9967. messageSends: [],
  9968. referencedClasses: []
  9969. }),
  9970. smalltalk.HashedCollection);
  9971. smalltalk.addMethod(
  9972. smalltalk.method({
  9973. selector: "keysAndValuesDo:",
  9974. category: 'enumerating',
  9975. fn: function (aBlock){
  9976. var self=this;
  9977. return smalltalk.withContext(function($ctx1) {
  9978. self._keysDo_((function(each){
  9979. return smalltalk.withContext(function($ctx2) {
  9980. return _st(aBlock)._value_value_(each,self._at_(each));
  9981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9982. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  9983. args: ["aBlock"],
  9984. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09\x09aBlock value: each value: (self at: each)]",
  9985. messageSends: ["keysDo:", "value:value:", "at:"],
  9986. referencedClasses: []
  9987. }),
  9988. smalltalk.HashedCollection);
  9989. smalltalk.addMethod(
  9990. smalltalk.method({
  9991. selector: "keysDo:",
  9992. category: 'enumerating',
  9993. fn: function (aBlock){
  9994. var self=this;
  9995. return smalltalk.withContext(function($ctx1) {
  9996. _st(self._keys())._do_(aBlock);
  9997. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  9998. args: ["aBlock"],
  9999. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  10000. messageSends: ["do:", "keys"],
  10001. referencedClasses: []
  10002. }),
  10003. smalltalk.HashedCollection);
  10004. smalltalk.addMethod(
  10005. smalltalk.method({
  10006. selector: "printOn:",
  10007. category: 'printing',
  10008. fn: function (aStream){
  10009. var self=this;
  10010. return smalltalk.withContext(function($ctx1) {
  10011. smalltalk.HashedCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  10012. _st(aStream)._nextPutAll_(" (");
  10013. _st(self._associations())._do_separatedBy_((function(each){
  10014. return smalltalk.withContext(function($ctx2) {
  10015. return _st(each)._printOn_(aStream);
  10016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  10017. return smalltalk.withContext(function($ctx2) {
  10018. return _st(aStream)._nextPutAll_(" , ");
  10019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  10020. _st(aStream)._nextPutAll_(")");
  10021. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.HashedCollection)})},
  10022. args: ["aStream"],
  10023. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [:each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  10024. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  10025. referencedClasses: []
  10026. }),
  10027. smalltalk.HashedCollection);
  10028. smalltalk.addMethod(
  10029. smalltalk.method({
  10030. selector: "remove:ifAbsent:",
  10031. category: 'adding/removing',
  10032. fn: function (aKey,aBlock){
  10033. var self=this;
  10034. return smalltalk.withContext(function($ctx1) {
  10035. var $1;
  10036. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  10037. return $1;
  10038. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10039. args: ["aKey", "aBlock"],
  10040. source: "remove: aKey ifAbsent: aBlock\x0a\x09^self removeKey: aKey ifAbsent: aBlock",
  10041. messageSends: ["removeKey:ifAbsent:"],
  10042. referencedClasses: []
  10043. }),
  10044. smalltalk.HashedCollection);
  10045. smalltalk.addMethod(
  10046. smalltalk.method({
  10047. selector: "removeKey:",
  10048. category: 'adding/removing',
  10049. fn: function (aKey){
  10050. var self=this;
  10051. return smalltalk.withContext(function($ctx1) {
  10052. var $1;
  10053. $1=self._remove_(aKey);
  10054. return $1;
  10055. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},smalltalk.HashedCollection)})},
  10056. args: ["aKey"],
  10057. source: "removeKey: aKey\x0a\x09^self remove: aKey",
  10058. messageSends: ["remove:"],
  10059. referencedClasses: []
  10060. }),
  10061. smalltalk.HashedCollection);
  10062. smalltalk.addMethod(
  10063. smalltalk.method({
  10064. selector: "removeKey:ifAbsent:",
  10065. category: 'adding/removing',
  10066. fn: function (aKey,aBlock){
  10067. var self=this;
  10068. return smalltalk.withContext(function($ctx1) {
  10069. var $2,$1;
  10070. $2=self._includesKey_(aKey);
  10071. if(smalltalk.assert($2)){
  10072. $1=self._basicDelete_(aKey);
  10073. } else {
  10074. $1=_st(aBlock)._value();
  10075. };
  10076. return $1;
  10077. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.HashedCollection)})},
  10078. args: ["aKey", "aBlock"],
  10079. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  10080. messageSends: ["ifFalse:ifTrue:", "includesKey:", "value", "basicDelete:"],
  10081. referencedClasses: []
  10082. }),
  10083. smalltalk.HashedCollection);
  10084. smalltalk.addMethod(
  10085. smalltalk.method({
  10086. selector: "select:",
  10087. category: 'enumerating',
  10088. fn: function (aBlock){
  10089. var self=this;
  10090. var newDict;
  10091. return smalltalk.withContext(function($ctx1) {
  10092. var $1,$2;
  10093. newDict=_st(self._class())._new();
  10094. self._keysAndValuesDo_((function(key,value){
  10095. return smalltalk.withContext(function($ctx2) {
  10096. $1=_st(aBlock)._value_(value);
  10097. if(smalltalk.assert($1)){
  10098. return _st(newDict)._at_put_(key,value);
  10099. };
  10100. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10101. $2=newDict;
  10102. return $2;
  10103. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},smalltalk.HashedCollection)})},
  10104. args: ["aBlock"],
  10105. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  10106. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
  10107. referencedClasses: []
  10108. }),
  10109. smalltalk.HashedCollection);
  10110. smalltalk.addMethod(
  10111. smalltalk.method({
  10112. selector: "shallowCopy",
  10113. category: 'copying',
  10114. fn: function (){
  10115. var self=this;
  10116. var copy;
  10117. return smalltalk.withContext(function($ctx1) {
  10118. var $1;
  10119. copy=_st(self._class())._new();
  10120. self._keysAndValuesDo_((function(key,value){
  10121. return smalltalk.withContext(function($ctx2) {
  10122. return _st(copy)._at_put_(key,value);
  10123. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10124. $1=copy;
  10125. return $1;
  10126. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},smalltalk.HashedCollection)})},
  10127. args: [],
  10128. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09copy at: key put: value].\x0a\x09^copy",
  10129. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  10130. referencedClasses: []
  10131. }),
  10132. smalltalk.HashedCollection);
  10133. smalltalk.addMethod(
  10134. smalltalk.method({
  10135. selector: "size",
  10136. category: 'accessing',
  10137. fn: function (){
  10138. var self=this;
  10139. return smalltalk.withContext(function($ctx1) {
  10140. var $1;
  10141. $1=_st(self._keys())._size();
  10142. return $1;
  10143. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.HashedCollection)})},
  10144. args: [],
  10145. source: "size\x0a\x09^self keys size",
  10146. messageSends: ["size", "keys"],
  10147. referencedClasses: []
  10148. }),
  10149. smalltalk.HashedCollection);
  10150. smalltalk.addMethod(
  10151. smalltalk.method({
  10152. selector: "values",
  10153. category: 'accessing',
  10154. fn: function (){
  10155. var self=this;
  10156. return smalltalk.withContext(function($ctx1) {
  10157. return self._keys().map(function(key){
  10158. return self._at_(key);
  10159. });
  10160. ;
  10161. return self}, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.HashedCollection)})},
  10162. args: [],
  10163. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  10164. messageSends: [],
  10165. referencedClasses: []
  10166. }),
  10167. smalltalk.HashedCollection);
  10168. smalltalk.addMethod(
  10169. smalltalk.method({
  10170. selector: "valuesDo:",
  10171. category: 'enumerating',
  10172. fn: function (aBlock){
  10173. var self=this;
  10174. return smalltalk.withContext(function($ctx1) {
  10175. _st(self._values())._do_((function(value){
  10176. return smalltalk.withContext(function($ctx2) {
  10177. return _st(aBlock)._value_(value);
  10178. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  10179. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10180. args: ["aBlock"],
  10181. source: "valuesDo: aBlock\x0a\x09self values do: [ :value | aBlock value: value ]",
  10182. messageSends: ["do:", "values", "value:"],
  10183. referencedClasses: []
  10184. }),
  10185. smalltalk.HashedCollection);
  10186. smalltalk.addMethod(
  10187. smalltalk.method({
  10188. selector: "withIndexDo:",
  10189. category: 'enumerating',
  10190. fn: function (aBlock){
  10191. var self=this;
  10192. return smalltalk.withContext(function($ctx1) {
  10193. self._keysAndValuesDo_((function(key,value){
  10194. return smalltalk.withContext(function($ctx2) {
  10195. return _st(aBlock)._value_value_(value,key);
  10196. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10197. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.HashedCollection)})},
  10198. args: ["aBlock"],
  10199. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  10200. messageSends: ["keysAndValuesDo:", "value:value:"],
  10201. referencedClasses: []
  10202. }),
  10203. smalltalk.HashedCollection);
  10204. smalltalk.addMethod(
  10205. smalltalk.method({
  10206. selector: "from:",
  10207. category: 'instance creation',
  10208. fn: function (aCollection){
  10209. var self=this;
  10210. var newCollection;
  10211. return smalltalk.withContext(function($ctx1) {
  10212. var $1;
  10213. newCollection=self._new();
  10214. _st(aCollection)._do_((function(each){
  10215. return smalltalk.withContext(function($ctx2) {
  10216. return _st(newCollection)._add_(each);
  10217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10218. $1=newCollection;
  10219. return $1;
  10220. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  10221. args: ["aCollection"],
  10222. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  10223. messageSends: ["new", "do:", "add:"],
  10224. referencedClasses: []
  10225. }),
  10226. smalltalk.HashedCollection.klass);
  10227. smalltalk.addMethod(
  10228. smalltalk.method({
  10229. selector: "fromPairs:",
  10230. category: 'instance creation',
  10231. fn: function (aCollection){
  10232. var self=this;
  10233. return smalltalk.withContext(function($ctx1) {
  10234. var $1;
  10235. $1=self._from_(aCollection);
  10236. return $1;
  10237. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},smalltalk.HashedCollection.klass)})},
  10238. args: ["aCollection"],
  10239. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  10240. messageSends: ["from:"],
  10241. referencedClasses: []
  10242. }),
  10243. smalltalk.HashedCollection.klass);
  10244. smalltalk.addMethod(
  10245. smalltalk.method({
  10246. selector: "newFromPairs:",
  10247. category: 'instance creation',
  10248. fn: function (aCollection){
  10249. var self=this;
  10250. var newCollection;
  10251. return smalltalk.withContext(function($ctx1) {
  10252. var $1,$2;
  10253. $1=_st(_st(aCollection)._size())._even();
  10254. if(! smalltalk.assert($1)){
  10255. self._error_("#newFromPairs only accepts arrays of an even length");
  10256. };
  10257. newCollection=self._new();
  10258. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  10259. return smalltalk.withContext(function($ctx2) {
  10260. return _st(newCollection)._at_put_(_st(aCollection)._at_(each),_st(aCollection)._at_(_st(each).__plus((1))));
  10261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  10262. $2=newCollection;
  10263. return $2;
  10264. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},smalltalk.HashedCollection.klass)})},
  10265. args: ["aCollection"],
  10266. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  10267. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"],
  10268. referencedClasses: []
  10269. }),
  10270. smalltalk.HashedCollection.klass);
  10271. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  10272. smalltalk.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  10273. smalltalk.addMethod(
  10274. smalltalk.method({
  10275. selector: "asHashedCollection",
  10276. category: 'converting',
  10277. fn: function (){
  10278. var self=this;
  10279. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10280. return smalltalk.withContext(function($ctx1) {
  10281. var $1;
  10282. $1=_st($HashedCollection())._from_(self._associations());
  10283. return $1;
  10284. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},smalltalk.Dictionary)})},
  10285. args: [],
  10286. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  10287. messageSends: ["from:", "associations"],
  10288. referencedClasses: ["HashedCollection"]
  10289. }),
  10290. smalltalk.Dictionary);
  10291. smalltalk.addMethod(
  10292. smalltalk.method({
  10293. selector: "asJSON",
  10294. category: 'converting',
  10295. fn: function (){
  10296. var self=this;
  10297. return smalltalk.withContext(function($ctx1) {
  10298. var $1;
  10299. $1=_st(self._asHashedCollection())._asJSON();
  10300. return $1;
  10301. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.Dictionary)})},
  10302. args: [],
  10303. source: "asJSON\x0a\x09^ self asHashedCollection asJSON",
  10304. messageSends: ["asJSON", "asHashedCollection"],
  10305. referencedClasses: []
  10306. }),
  10307. smalltalk.Dictionary);
  10308. smalltalk.addMethod(
  10309. smalltalk.method({
  10310. selector: "at:ifAbsent:",
  10311. category: 'accessing',
  10312. fn: function (aKey,aBlock){
  10313. var self=this;
  10314. return smalltalk.withContext(function($ctx1) {
  10315. var index = self._positionOfKey_(aKey);
  10316. return index >=0 ? self['@values'][index] : aBlock._value();
  10317. ;
  10318. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  10319. args: ["aKey", "aBlock"],
  10320. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  10321. messageSends: [],
  10322. referencedClasses: []
  10323. }),
  10324. smalltalk.Dictionary);
  10325. smalltalk.addMethod(
  10326. smalltalk.method({
  10327. selector: "at:put:",
  10328. category: 'accessing',
  10329. fn: function (aKey,aValue){
  10330. var self=this;
  10331. return smalltalk.withContext(function($ctx1) {
  10332. var index = self._positionOfKey_(aKey);
  10333. if(index === -1) {
  10334. var keys = self['@keys'];
  10335. index = keys.length;
  10336. keys.push(aKey);
  10337. }
  10338. return self['@values'][index] = aValue;
  10339. ;
  10340. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},smalltalk.Dictionary)})},
  10341. args: ["aKey", "aValue"],
  10342. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  10343. messageSends: [],
  10344. referencedClasses: []
  10345. }),
  10346. smalltalk.Dictionary);
  10347. smalltalk.addMethod(
  10348. smalltalk.method({
  10349. selector: "includesKey:",
  10350. category: 'testing',
  10351. fn: function (aKey){
  10352. var self=this;
  10353. return smalltalk.withContext(function($ctx1) {
  10354. return self._positionOfKey_(aKey) >= 0; ;
  10355. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Dictionary)})},
  10356. args: ["aKey"],
  10357. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  10358. messageSends: [],
  10359. referencedClasses: []
  10360. }),
  10361. smalltalk.Dictionary);
  10362. smalltalk.addMethod(
  10363. smalltalk.method({
  10364. selector: "indexOf:ifAbsent:",
  10365. category: 'accessing',
  10366. fn: function (anObject,aBlock){
  10367. var self=this;
  10368. var index;
  10369. return smalltalk.withContext(function($ctx1) {
  10370. var $2,$1;
  10371. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  10372. return smalltalk.withContext(function($ctx2) {
  10373. return (0);
  10374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10375. $2=_st(index).__eq((0));
  10376. if(smalltalk.assert($2)){
  10377. $1=_st(aBlock)._value();
  10378. } else {
  10379. $1=_st(self["@keys"])._at_(index);
  10380. };
  10381. return $1;
  10382. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},smalltalk.Dictionary)})},
  10383. args: ["anObject", "aBlock"],
  10384. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  10385. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"],
  10386. referencedClasses: []
  10387. }),
  10388. smalltalk.Dictionary);
  10389. smalltalk.addMethod(
  10390. smalltalk.method({
  10391. selector: "initialize",
  10392. category: 'initialization',
  10393. fn: function (){
  10394. var self=this;
  10395. return smalltalk.withContext(function($ctx1) {
  10396. smalltalk.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []);
  10397. self["@keys"]=[];
  10398. self["@values"]=[];
  10399. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Dictionary)})},
  10400. args: [],
  10401. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  10402. messageSends: ["initialize"],
  10403. referencedClasses: []
  10404. }),
  10405. smalltalk.Dictionary);
  10406. smalltalk.addMethod(
  10407. smalltalk.method({
  10408. selector: "keys",
  10409. category: 'accessing',
  10410. fn: function (){
  10411. var self=this;
  10412. return smalltalk.withContext(function($ctx1) {
  10413. var $1;
  10414. $1=_st(self["@keys"])._copy();
  10415. return $1;
  10416. }, function($ctx1) {$ctx1.fill(self,"keys",{},smalltalk.Dictionary)})},
  10417. args: [],
  10418. source: "keys\x0a\x09^ keys copy",
  10419. messageSends: ["copy"],
  10420. referencedClasses: []
  10421. }),
  10422. smalltalk.Dictionary);
  10423. smalltalk.addMethod(
  10424. smalltalk.method({
  10425. selector: "keysAndValuesDo:",
  10426. category: 'enumerating',
  10427. fn: function (aBlock){
  10428. var self=this;
  10429. return smalltalk.withContext(function($ctx1) {
  10430. var $1;
  10431. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  10432. return $1;
  10433. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  10434. args: ["aBlock"],
  10435. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  10436. messageSends: ["with:do:"],
  10437. referencedClasses: []
  10438. }),
  10439. smalltalk.Dictionary);
  10440. smalltalk.addMethod(
  10441. smalltalk.method({
  10442. selector: "keysDo:",
  10443. category: 'enumerating',
  10444. fn: function (aBlock){
  10445. var self=this;
  10446. return smalltalk.withContext(function($ctx1) {
  10447. var $1;
  10448. $1=_st(self["@keys"])._do_(aBlock);
  10449. return $1;
  10450. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  10451. args: ["aBlock"],
  10452. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  10453. messageSends: ["do:"],
  10454. referencedClasses: []
  10455. }),
  10456. smalltalk.Dictionary);
  10457. smalltalk.addMethod(
  10458. smalltalk.method({
  10459. selector: "positionOfKey:",
  10460. category: 'private',
  10461. fn: function (anObject){
  10462. var self=this;
  10463. return smalltalk.withContext(function($ctx1) {
  10464. var keys = self['@keys'];
  10465. for(var i=0;i<keys.length;i++){
  10466. if(keys[i].__eq(anObject)) { return i;}
  10467. }
  10468. return -1;
  10469. ;
  10470. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},smalltalk.Dictionary)})},
  10471. args: ["anObject"],
  10472. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  10473. messageSends: [],
  10474. referencedClasses: []
  10475. }),
  10476. smalltalk.Dictionary);
  10477. smalltalk.addMethod(
  10478. smalltalk.method({
  10479. selector: "removeKey:ifAbsent:",
  10480. category: 'adding/removing',
  10481. fn: function (aKey,aBlock){
  10482. var self=this;
  10483. return smalltalk.withContext(function($ctx1) {
  10484. var index = self._positionOfKey_(aKey);
  10485. if(index === -1) {
  10486. return aBlock._value()
  10487. } else {
  10488. var keys = self['@keys'], values = self['@values'];
  10489. var value = values[index], l = keys.length;
  10490. keys[index] = keys[l-1];
  10491. keys.pop();
  10492. values[index] = values[l-1];
  10493. values.pop();
  10494. return value;
  10495. }
  10496. ;
  10497. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Dictionary)})},
  10498. args: ["aKey", "aBlock"],
  10499. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  10500. messageSends: [],
  10501. referencedClasses: []
  10502. }),
  10503. smalltalk.Dictionary);
  10504. smalltalk.addMethod(
  10505. smalltalk.method({
  10506. selector: "values",
  10507. category: 'accessing',
  10508. fn: function (){
  10509. var self=this;
  10510. return smalltalk.withContext(function($ctx1) {
  10511. var $1;
  10512. $1=self["@values"];
  10513. return $1;
  10514. }, function($ctx1) {$ctx1.fill(self,"values",{},smalltalk.Dictionary)})},
  10515. args: [],
  10516. source: "values\x0a\x09^ values",
  10517. messageSends: [],
  10518. referencedClasses: []
  10519. }),
  10520. smalltalk.Dictionary);
  10521. smalltalk.addMethod(
  10522. smalltalk.method({
  10523. selector: "valuesDo:",
  10524. category: 'enumerating',
  10525. fn: function (aBlock){
  10526. var self=this;
  10527. return smalltalk.withContext(function($ctx1) {
  10528. var $1;
  10529. $1=_st(self["@values"])._do_(aBlock);
  10530. return $1;
  10531. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},smalltalk.Dictionary)})},
  10532. args: ["aBlock"],
  10533. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  10534. messageSends: ["do:"],
  10535. referencedClasses: []
  10536. }),
  10537. smalltalk.Dictionary);
  10538. smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  10539. smalltalk.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  10540. smalltalk.addMethod(
  10541. smalltalk.method({
  10542. selector: "=",
  10543. category: 'comparing',
  10544. fn: function (aCollection){
  10545. var self=this;
  10546. return smalltalk.withContext(function($ctx1) {
  10547. var $1,$2;
  10548. var $early={};
  10549. try {
  10550. $1=_st(_st(self._class()).__eq(_st(aCollection)._class()))._and_((function(){
  10551. return smalltalk.withContext(function($ctx2) {
  10552. return _st(self._size()).__eq(_st(aCollection)._size());
  10553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10554. if(! smalltalk.assert($1)){
  10555. return false;
  10556. };
  10557. self._withIndexDo_((function(each,i){
  10558. return smalltalk.withContext(function($ctx2) {
  10559. $2=_st(_st(aCollection)._at_(i)).__eq(each);
  10560. if(! smalltalk.assert($2)){
  10561. throw $early=[false];
  10562. };
  10563. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  10564. return true;
  10565. }
  10566. catch(e) {if(e===$early)return e[0]; throw e}
  10567. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.SequenceableCollection)})},
  10568. args: ["aCollection"],
  10569. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  10570. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
  10571. referencedClasses: []
  10572. }),
  10573. smalltalk.SequenceableCollection);
  10574. smalltalk.addMethod(
  10575. smalltalk.method({
  10576. selector: "addLast:",
  10577. category: 'adding/removing',
  10578. fn: function (anObject){
  10579. var self=this;
  10580. return smalltalk.withContext(function($ctx1) {
  10581. self._add_(anObject);
  10582. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  10583. args: ["anObject"],
  10584. source: "addLast: anObject\x0a\x09self add: anObject",
  10585. messageSends: ["add:"],
  10586. referencedClasses: []
  10587. }),
  10588. smalltalk.SequenceableCollection);
  10589. smalltalk.addMethod(
  10590. smalltalk.method({
  10591. selector: "allButFirst",
  10592. category: 'accessing',
  10593. fn: function (){
  10594. var self=this;
  10595. return smalltalk.withContext(function($ctx1) {
  10596. var $1;
  10597. $1=self._copyFrom_to_((2),self._size());
  10598. return $1;
  10599. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},smalltalk.SequenceableCollection)})},
  10600. args: [],
  10601. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  10602. messageSends: ["copyFrom:to:", "size"],
  10603. referencedClasses: []
  10604. }),
  10605. smalltalk.SequenceableCollection);
  10606. smalltalk.addMethod(
  10607. smalltalk.method({
  10608. selector: "allButLast",
  10609. category: 'accessing',
  10610. fn: function (){
  10611. var self=this;
  10612. return smalltalk.withContext(function($ctx1) {
  10613. var $1;
  10614. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  10615. return $1;
  10616. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},smalltalk.SequenceableCollection)})},
  10617. args: [],
  10618. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  10619. messageSends: ["copyFrom:to:", "-", "size"],
  10620. referencedClasses: []
  10621. }),
  10622. smalltalk.SequenceableCollection);
  10623. smalltalk.addMethod(
  10624. smalltalk.method({
  10625. selector: "atRandom",
  10626. category: 'accessing',
  10627. fn: function (){
  10628. var self=this;
  10629. return smalltalk.withContext(function($ctx1) {
  10630. var $1;
  10631. $1=self._at_(_st(self._size())._atRandom());
  10632. return $1;
  10633. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},smalltalk.SequenceableCollection)})},
  10634. args: [],
  10635. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10636. messageSends: ["at:", "atRandom", "size"],
  10637. referencedClasses: []
  10638. }),
  10639. smalltalk.SequenceableCollection);
  10640. smalltalk.addMethod(
  10641. smalltalk.method({
  10642. selector: "copyFrom:to:",
  10643. category: 'copying',
  10644. fn: function (anIndex,anotherIndex){
  10645. var self=this;
  10646. var range,newCollection;
  10647. return smalltalk.withContext(function($ctx1) {
  10648. var $1;
  10649. range=_st(anIndex)._to_(anotherIndex);
  10650. newCollection=_st(self._class())._new_(_st(range)._size());
  10651. _st(range)._withIndexDo_((function(each,i){
  10652. return smalltalk.withContext(function($ctx2) {
  10653. return _st(newCollection)._at_put_(i,self._at_(each));
  10654. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  10655. $1=newCollection;
  10656. return $1;
  10657. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},smalltalk.SequenceableCollection)})},
  10658. args: ["anIndex", "anotherIndex"],
  10659. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [:each :i |\x0a\x09\x09newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  10660. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
  10661. referencedClasses: []
  10662. }),
  10663. smalltalk.SequenceableCollection);
  10664. smalltalk.addMethod(
  10665. smalltalk.method({
  10666. selector: "deepCopy",
  10667. category: 'copying',
  10668. fn: function (){
  10669. var self=this;
  10670. var newCollection;
  10671. return smalltalk.withContext(function($ctx1) {
  10672. var $1;
  10673. newCollection=_st(self._class())._new_(self._size());
  10674. self._withIndexDo_((function(each,index){
  10675. return smalltalk.withContext(function($ctx2) {
  10676. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  10677. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  10678. $1=newCollection;
  10679. return $1;
  10680. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  10681. args: [],
  10682. 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",
  10683. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
  10684. referencedClasses: []
  10685. }),
  10686. smalltalk.SequenceableCollection);
  10687. smalltalk.addMethod(
  10688. smalltalk.method({
  10689. selector: "detect:ifNone:",
  10690. category: 'enumerating',
  10691. fn: function (aBlock,anotherBlock){
  10692. var self=this;
  10693. return smalltalk.withContext(function($ctx1) {
  10694. for(var i = 0; i < self.length; i++)
  10695. if(aBlock._value_(self[i]))
  10696. return self[i];
  10697. return anotherBlock._value();
  10698. ;
  10699. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.SequenceableCollection)})},
  10700. args: ["aBlock", "anotherBlock"],
  10701. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  10702. messageSends: [],
  10703. referencedClasses: []
  10704. }),
  10705. smalltalk.SequenceableCollection);
  10706. smalltalk.addMethod(
  10707. smalltalk.method({
  10708. selector: "do:",
  10709. category: 'enumerating',
  10710. fn: function (aBlock){
  10711. var self=this;
  10712. return smalltalk.withContext(function($ctx1) {
  10713. for(var i=0;i<self.length;i++){aBlock._value_(self[i]);};
  10714. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  10715. args: ["aBlock"],
  10716. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self[i]);}>",
  10717. messageSends: [],
  10718. referencedClasses: []
  10719. }),
  10720. smalltalk.SequenceableCollection);
  10721. smalltalk.addMethod(
  10722. smalltalk.method({
  10723. selector: "first",
  10724. category: 'accessing',
  10725. fn: function (){
  10726. var self=this;
  10727. return smalltalk.withContext(function($ctx1) {
  10728. var $1;
  10729. $1=self._at_((1));
  10730. return $1;
  10731. }, function($ctx1) {$ctx1.fill(self,"first",{},smalltalk.SequenceableCollection)})},
  10732. args: [],
  10733. source: "first\x0a\x09^self at: 1",
  10734. messageSends: ["at:"],
  10735. referencedClasses: []
  10736. }),
  10737. smalltalk.SequenceableCollection);
  10738. smalltalk.addMethod(
  10739. smalltalk.method({
  10740. selector: "first:",
  10741. category: 'accessing',
  10742. fn: function (n){
  10743. var self=this;
  10744. return smalltalk.withContext(function($ctx1) {
  10745. var $1;
  10746. $1=self._copyFrom_to_((1),n);
  10747. return $1;
  10748. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n},smalltalk.SequenceableCollection)})},
  10749. args: ["n"],
  10750. 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",
  10751. messageSends: ["copyFrom:to:"],
  10752. referencedClasses: []
  10753. }),
  10754. smalltalk.SequenceableCollection);
  10755. smalltalk.addMethod(
  10756. smalltalk.method({
  10757. selector: "fourth",
  10758. category: 'accessing',
  10759. fn: function (){
  10760. var self=this;
  10761. return smalltalk.withContext(function($ctx1) {
  10762. var $1;
  10763. $1=self._at_((4));
  10764. return $1;
  10765. }, function($ctx1) {$ctx1.fill(self,"fourth",{},smalltalk.SequenceableCollection)})},
  10766. args: [],
  10767. source: "fourth\x0a\x09^self at: 4",
  10768. messageSends: ["at:"],
  10769. referencedClasses: []
  10770. }),
  10771. smalltalk.SequenceableCollection);
  10772. smalltalk.addMethod(
  10773. smalltalk.method({
  10774. selector: "includes:",
  10775. category: 'testing',
  10776. fn: function (anObject){
  10777. var self=this;
  10778. return smalltalk.withContext(function($ctx1) {
  10779. var $1;
  10780. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  10781. return smalltalk.withContext(function($ctx2) {
  10782. return nil;
  10783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._notNil();
  10784. return $1;
  10785. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.SequenceableCollection)})},
  10786. args: ["anObject"],
  10787. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  10788. messageSends: ["notNil", "indexOf:ifAbsent:"],
  10789. referencedClasses: []
  10790. }),
  10791. smalltalk.SequenceableCollection);
  10792. smalltalk.addMethod(
  10793. smalltalk.method({
  10794. selector: "indexOf:ifAbsent:",
  10795. category: 'accessing',
  10796. fn: function (anObject,aBlock){
  10797. var self=this;
  10798. return smalltalk.withContext(function($ctx1) {
  10799. for(var i=0;i<self.length;i++) {
  10800. if(self[i].__eq(anObject)) {return i+1}
  10801. };
  10802. return aBlock._value();
  10803. ;
  10804. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  10805. args: ["anObject", "aBlock"],
  10806. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  10807. messageSends: [],
  10808. referencedClasses: []
  10809. }),
  10810. smalltalk.SequenceableCollection);
  10811. smalltalk.addMethod(
  10812. smalltalk.method({
  10813. selector: "indexOf:startingAt:",
  10814. category: 'accessing',
  10815. fn: function (anObject,start){
  10816. var self=this;
  10817. return smalltalk.withContext(function($ctx1) {
  10818. var $1;
  10819. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10820. return smalltalk.withContext(function($ctx2) {
  10821. return (0);
  10822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10823. return $1;
  10824. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},smalltalk.SequenceableCollection)})},
  10825. args: ["anObject", "start"],
  10826. 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]",
  10827. messageSends: ["indexOf:startingAt:ifAbsent:"],
  10828. referencedClasses: []
  10829. }),
  10830. smalltalk.SequenceableCollection);
  10831. smalltalk.addMethod(
  10832. smalltalk.method({
  10833. selector: "indexOf:startingAt:ifAbsent:",
  10834. category: 'accessing',
  10835. fn: function (anObject,start,aBlock){
  10836. var self=this;
  10837. return smalltalk.withContext(function($ctx1) {
  10838. for(var i=start-1;i<self.length;i++){
  10839. if(self[i].__eq(anObject)) {return i+1}
  10840. }
  10841. return aBlock._value();
  10842. ;
  10843. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  10844. args: ["anObject", "start", "aBlock"],
  10845. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  10846. messageSends: [],
  10847. referencedClasses: []
  10848. }),
  10849. smalltalk.SequenceableCollection);
  10850. smalltalk.addMethod(
  10851. smalltalk.method({
  10852. selector: "last",
  10853. category: 'accessing',
  10854. fn: function (){
  10855. var self=this;
  10856. return smalltalk.withContext(function($ctx1) {
  10857. var $1;
  10858. $1=self._at_(self._size());
  10859. return $1;
  10860. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.SequenceableCollection)})},
  10861. args: [],
  10862. source: "last\x0a\x09^self at: self size",
  10863. messageSends: ["at:", "size"],
  10864. referencedClasses: []
  10865. }),
  10866. smalltalk.SequenceableCollection);
  10867. smalltalk.addMethod(
  10868. smalltalk.method({
  10869. selector: "newStream",
  10870. category: 'streaming',
  10871. fn: function (){
  10872. var self=this;
  10873. return smalltalk.withContext(function($ctx1) {
  10874. var $1;
  10875. $1=_st(self._streamClass())._on_(self);
  10876. return $1;
  10877. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.SequenceableCollection)})},
  10878. args: [],
  10879. source: "newStream\x0a\x09^self streamClass on: self",
  10880. messageSends: ["on:", "streamClass"],
  10881. referencedClasses: []
  10882. }),
  10883. smalltalk.SequenceableCollection);
  10884. smalltalk.addMethod(
  10885. smalltalk.method({
  10886. selector: "readStream",
  10887. category: 'streaming',
  10888. fn: function (){
  10889. var self=this;
  10890. return smalltalk.withContext(function($ctx1) {
  10891. var $1;
  10892. $1=self._stream();
  10893. return $1;
  10894. }, function($ctx1) {$ctx1.fill(self,"readStream",{},smalltalk.SequenceableCollection)})},
  10895. args: [],
  10896. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  10897. messageSends: ["stream"],
  10898. referencedClasses: []
  10899. }),
  10900. smalltalk.SequenceableCollection);
  10901. smalltalk.addMethod(
  10902. smalltalk.method({
  10903. selector: "removeLast",
  10904. category: 'adding/removing',
  10905. fn: function (){
  10906. var self=this;
  10907. return smalltalk.withContext(function($ctx1) {
  10908. var $1;
  10909. $1=self._remove_(self._last());
  10910. return $1;
  10911. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.SequenceableCollection)})},
  10912. args: [],
  10913. source: "removeLast\x0a\x09^ self remove: self last",
  10914. messageSends: ["remove:", "last"],
  10915. referencedClasses: []
  10916. }),
  10917. smalltalk.SequenceableCollection);
  10918. smalltalk.addMethod(
  10919. smalltalk.method({
  10920. selector: "reversed",
  10921. category: 'converting',
  10922. fn: function (){
  10923. var self=this;
  10924. return smalltalk.withContext(function($ctx1) {
  10925. self._subclassResponsibility();
  10926. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.SequenceableCollection)})},
  10927. args: [],
  10928. source: "reversed\x0a\x09self subclassResponsibility",
  10929. messageSends: ["subclassResponsibility"],
  10930. referencedClasses: []
  10931. }),
  10932. smalltalk.SequenceableCollection);
  10933. smalltalk.addMethod(
  10934. smalltalk.method({
  10935. selector: "second",
  10936. category: 'accessing',
  10937. fn: function (){
  10938. var self=this;
  10939. return smalltalk.withContext(function($ctx1) {
  10940. var $1;
  10941. $1=self._at_((2));
  10942. return $1;
  10943. }, function($ctx1) {$ctx1.fill(self,"second",{},smalltalk.SequenceableCollection)})},
  10944. args: [],
  10945. source: "second\x0a\x09^self at: 2",
  10946. messageSends: ["at:"],
  10947. referencedClasses: []
  10948. }),
  10949. smalltalk.SequenceableCollection);
  10950. smalltalk.addMethod(
  10951. smalltalk.method({
  10952. selector: "shallowCopy",
  10953. category: 'copying',
  10954. fn: function (){
  10955. var self=this;
  10956. var newCollection;
  10957. return smalltalk.withContext(function($ctx1) {
  10958. var $1;
  10959. newCollection=_st(self._class())._new_(self._size());
  10960. self._withIndexDo_((function(each,index){
  10961. return smalltalk.withContext(function($ctx2) {
  10962. return _st(newCollection)._at_put_(index,each);
  10963. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  10964. $1=newCollection;
  10965. return $1;
  10966. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},smalltalk.SequenceableCollection)})},
  10967. args: [],
  10968. 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",
  10969. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  10970. referencedClasses: []
  10971. }),
  10972. smalltalk.SequenceableCollection);
  10973. smalltalk.addMethod(
  10974. smalltalk.method({
  10975. selector: "stream",
  10976. category: 'streaming',
  10977. fn: function (){
  10978. var self=this;
  10979. return smalltalk.withContext(function($ctx1) {
  10980. var $1;
  10981. $1=self._newStream();
  10982. return $1;
  10983. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.SequenceableCollection)})},
  10984. args: [],
  10985. source: "stream\x0a\x09^self newStream",
  10986. messageSends: ["newStream"],
  10987. referencedClasses: []
  10988. }),
  10989. smalltalk.SequenceableCollection);
  10990. smalltalk.addMethod(
  10991. smalltalk.method({
  10992. selector: "streamClass",
  10993. category: 'streaming',
  10994. fn: function (){
  10995. var self=this;
  10996. return smalltalk.withContext(function($ctx1) {
  10997. var $1;
  10998. $1=_st(self._class())._streamClass();
  10999. return $1;
  11000. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection)})},
  11001. args: [],
  11002. source: "streamClass\x0a\x09^self class streamClass",
  11003. messageSends: ["streamClass", "class"],
  11004. referencedClasses: []
  11005. }),
  11006. smalltalk.SequenceableCollection);
  11007. smalltalk.addMethod(
  11008. smalltalk.method({
  11009. selector: "third",
  11010. category: 'accessing',
  11011. fn: function (){
  11012. var self=this;
  11013. return smalltalk.withContext(function($ctx1) {
  11014. var $1;
  11015. $1=self._at_((3));
  11016. return $1;
  11017. }, function($ctx1) {$ctx1.fill(self,"third",{},smalltalk.SequenceableCollection)})},
  11018. args: [],
  11019. source: "third\x0a\x09^self at: 3",
  11020. messageSends: ["at:"],
  11021. referencedClasses: []
  11022. }),
  11023. smalltalk.SequenceableCollection);
  11024. smalltalk.addMethod(
  11025. smalltalk.method({
  11026. selector: "with:do:",
  11027. category: 'enumerating',
  11028. fn: function (anotherCollection,aBlock){
  11029. var self=this;
  11030. return smalltalk.withContext(function($ctx1) {
  11031. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);};
  11032. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11033. args: ["anotherCollection", "aBlock"],
  11034. source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], anotherCollection[i]);}>",
  11035. messageSends: [],
  11036. referencedClasses: []
  11037. }),
  11038. smalltalk.SequenceableCollection);
  11039. smalltalk.addMethod(
  11040. smalltalk.method({
  11041. selector: "withIndexDo:",
  11042. category: 'enumerating',
  11043. fn: function (aBlock){
  11044. var self=this;
  11045. return smalltalk.withContext(function($ctx1) {
  11046. for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);};
  11047. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
  11048. args: ["aBlock"],
  11049. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self[i], i+1);}>",
  11050. messageSends: [],
  11051. referencedClasses: []
  11052. }),
  11053. smalltalk.SequenceableCollection);
  11054. smalltalk.addMethod(
  11055. smalltalk.method({
  11056. selector: "writeStream",
  11057. category: 'streaming',
  11058. fn: function (){
  11059. var self=this;
  11060. return smalltalk.withContext(function($ctx1) {
  11061. var $1;
  11062. $1=self._stream();
  11063. return $1;
  11064. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},smalltalk.SequenceableCollection)})},
  11065. args: [],
  11066. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^self stream",
  11067. messageSends: ["stream"],
  11068. referencedClasses: []
  11069. }),
  11070. smalltalk.SequenceableCollection);
  11071. smalltalk.addMethod(
  11072. smalltalk.method({
  11073. selector: "streamClass",
  11074. category: 'accessing',
  11075. fn: function (){
  11076. var self=this;
  11077. function $Stream(){return smalltalk.Stream||(typeof Stream=="undefined"?nil:Stream)}
  11078. return smalltalk.withContext(function($ctx1) {
  11079. var $1;
  11080. $1=$Stream();
  11081. return $1;
  11082. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.SequenceableCollection.klass)})},
  11083. args: [],
  11084. source: "streamClass\x0a\x09\x09^Stream",
  11085. messageSends: [],
  11086. referencedClasses: ["Stream"]
  11087. }),
  11088. smalltalk.SequenceableCollection.klass);
  11089. smalltalk.addMethod(
  11090. smalltalk.method({
  11091. selector: "streamContents:",
  11092. category: 'streaming',
  11093. fn: function (aBlock){
  11094. var self=this;
  11095. var stream;
  11096. return smalltalk.withContext(function($ctx1) {
  11097. var $1;
  11098. stream=_st(self._streamClass())._on_(self._new());
  11099. _st(aBlock)._value_(stream);
  11100. $1=_st(stream)._contents();
  11101. return $1;
  11102. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},smalltalk.SequenceableCollection.klass)})},
  11103. args: ["aBlock"],
  11104. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  11105. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  11106. referencedClasses: []
  11107. }),
  11108. smalltalk.SequenceableCollection.klass);
  11109. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  11110. smalltalk.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  11111. smalltalk.addMethod(
  11112. smalltalk.method({
  11113. selector: "add:",
  11114. category: 'adding/removing',
  11115. fn: function (anObject){
  11116. var self=this;
  11117. return smalltalk.withContext(function($ctx1) {
  11118. self.push(anObject); return anObject;;
  11119. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Array)})},
  11120. args: ["anObject"],
  11121. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  11122. messageSends: [],
  11123. referencedClasses: []
  11124. }),
  11125. smalltalk.Array);
  11126. smalltalk.addMethod(
  11127. smalltalk.method({
  11128. selector: "addFirst:",
  11129. category: 'adding/removing',
  11130. fn: function (anObject){
  11131. var self=this;
  11132. return smalltalk.withContext(function($ctx1) {
  11133. self.unshift(anObject); return anObject;;
  11134. return self}, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},smalltalk.Array)})},
  11135. args: ["anObject"],
  11136. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  11137. messageSends: [],
  11138. referencedClasses: []
  11139. }),
  11140. smalltalk.Array);
  11141. smalltalk.addMethod(
  11142. smalltalk.method({
  11143. selector: "asJavascript",
  11144. category: 'converting',
  11145. fn: function (){
  11146. var self=this;
  11147. return smalltalk.withContext(function($ctx1) {
  11148. var $1;
  11149. $1=_st("[".__comma(_st(self._collect_((function(each){
  11150. return smalltalk.withContext(function($ctx2) {
  11151. return _st(each)._asJavascript();
  11152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._join_(", "))).__comma("]");
  11153. return $1;
  11154. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Array)})},
  11155. args: [],
  11156. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  11157. messageSends: [",", "join:", "collect:", "asJavascript"],
  11158. referencedClasses: []
  11159. }),
  11160. smalltalk.Array);
  11161. smalltalk.addMethod(
  11162. smalltalk.method({
  11163. selector: "at:ifAbsent:",
  11164. category: 'accessing',
  11165. fn: function (anIndex,aBlock){
  11166. var self=this;
  11167. return smalltalk.withContext(function($ctx1) {
  11168. if((anIndex < 1) || (self.length < anIndex)) {return aBlock._value()};
  11169. return self[anIndex - 1];
  11170. ;
  11171. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.Array)})},
  11172. args: ["anIndex", "aBlock"],
  11173. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock._value()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  11174. messageSends: [],
  11175. referencedClasses: []
  11176. }),
  11177. smalltalk.Array);
  11178. smalltalk.addMethod(
  11179. smalltalk.method({
  11180. selector: "at:ifPresent:ifAbsent:",
  11181. category: 'accessing',
  11182. fn: function (anIndex,aBlock,anotherBlock){
  11183. var self=this;
  11184. return smalltalk.withContext(function($ctx1) {
  11185. return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);;
  11186. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Array)})},
  11187. args: ["anIndex", "aBlock", "anotherBlock"],
  11188. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<return anIndex < 1 || self.length < anIndex ? anotherBlock._value() : aBlock._value_(self[anIndex - 1]);>",
  11189. messageSends: [],
  11190. referencedClasses: []
  11191. }),
  11192. smalltalk.Array);
  11193. smalltalk.addMethod(
  11194. smalltalk.method({
  11195. selector: "at:put:",
  11196. category: 'accessing',
  11197. fn: function (anIndex,anObject){
  11198. var self=this;
  11199. return smalltalk.withContext(function($ctx1) {
  11200. return self[anIndex - 1] = anObject;
  11201. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.Array)})},
  11202. args: ["anIndex", "anObject"],
  11203. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  11204. messageSends: [],
  11205. referencedClasses: []
  11206. }),
  11207. smalltalk.Array);
  11208. smalltalk.addMethod(
  11209. smalltalk.method({
  11210. selector: "collect:",
  11211. category: 'enumerating',
  11212. fn: function (aBlock){
  11213. var self=this;
  11214. return smalltalk.withContext(function($ctx1) {
  11215. return self.map(function(each) {return aBlock._value_(each)});
  11216. return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Array)})},
  11217. args: ["aBlock"],
  11218. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  11219. messageSends: [],
  11220. referencedClasses: []
  11221. }),
  11222. smalltalk.Array);
  11223. smalltalk.addMethod(
  11224. smalltalk.method({
  11225. selector: "join:",
  11226. category: 'enumerating',
  11227. fn: function (aString){
  11228. var self=this;
  11229. return smalltalk.withContext(function($ctx1) {
  11230. return self.join(aString);
  11231. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},smalltalk.Array)})},
  11232. args: ["aString"],
  11233. source: "join: aString\x0a\x09<return self.join(aString)>",
  11234. messageSends: [],
  11235. referencedClasses: []
  11236. }),
  11237. smalltalk.Array);
  11238. smalltalk.addMethod(
  11239. smalltalk.method({
  11240. selector: "printOn:",
  11241. category: 'printing',
  11242. fn: function (aStream){
  11243. var self=this;
  11244. return smalltalk.withContext(function($ctx1) {
  11245. smalltalk.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  11246. _st(aStream)._nextPutAll_(" (");
  11247. self._do_separatedBy_((function(each){
  11248. return smalltalk.withContext(function($ctx2) {
  11249. return _st(each)._printOn_(aStream);
  11250. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  11251. return smalltalk.withContext(function($ctx2) {
  11252. return _st(aStream)._nextPutAll_(" ");
  11253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  11254. _st(aStream)._nextPutAll_(")");
  11255. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Array)})},
  11256. args: ["aStream"],
  11257. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  11258. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  11259. referencedClasses: []
  11260. }),
  11261. smalltalk.Array);
  11262. smalltalk.addMethod(
  11263. smalltalk.method({
  11264. selector: "remove:ifAbsent:",
  11265. category: 'adding/removing',
  11266. fn: function (anObject,aBlock){
  11267. var self=this;
  11268. return smalltalk.withContext(function($ctx1) {
  11269. for(var i=0;i<self.length;i++) {
  11270. if(_st(self[i]).__eq(anObject)) {
  11271. self.splice(i,1);
  11272. return self;
  11273. }
  11274. };
  11275. aBlock._value();
  11276. ;
  11277. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Array)})},
  11278. args: ["anObject", "aBlock"],
  11279. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09aBlock._value();\x0a\x09>",
  11280. messageSends: [],
  11281. referencedClasses: []
  11282. }),
  11283. smalltalk.Array);
  11284. smalltalk.addMethod(
  11285. smalltalk.method({
  11286. selector: "removeFrom:to:",
  11287. category: 'adding/removing',
  11288. fn: function (aNumber,anotherNumber){
  11289. var self=this;
  11290. return smalltalk.withContext(function($ctx1) {
  11291. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  11292. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},smalltalk.Array)})},
  11293. args: ["aNumber", "anotherNumber"],
  11294. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  11295. messageSends: [],
  11296. referencedClasses: []
  11297. }),
  11298. smalltalk.Array);
  11299. smalltalk.addMethod(
  11300. smalltalk.method({
  11301. selector: "removeIndex:",
  11302. category: 'adding/removing',
  11303. fn: function (anInteger){
  11304. var self=this;
  11305. return smalltalk.withContext(function($ctx1) {
  11306. self.splice(anInteger - 1, 1);
  11307. return self}, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},smalltalk.Array)})},
  11308. args: ["anInteger"],
  11309. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  11310. messageSends: [],
  11311. referencedClasses: []
  11312. }),
  11313. smalltalk.Array);
  11314. smalltalk.addMethod(
  11315. smalltalk.method({
  11316. selector: "removeLast",
  11317. category: 'adding/removing',
  11318. fn: function (){
  11319. var self=this;
  11320. return smalltalk.withContext(function($ctx1) {
  11321. return self.pop();;
  11322. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},smalltalk.Array)})},
  11323. args: [],
  11324. source: "removeLast\x0a\x09<return self.pop();>",
  11325. messageSends: [],
  11326. referencedClasses: []
  11327. }),
  11328. smalltalk.Array);
  11329. smalltalk.addMethod(
  11330. smalltalk.method({
  11331. selector: "reversed",
  11332. category: 'converting',
  11333. fn: function (){
  11334. var self=this;
  11335. return smalltalk.withContext(function($ctx1) {
  11336. return self._copy().reverse();
  11337. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})},
  11338. args: [],
  11339. source: "reversed\x0a\x09<return self._copy().reverse()>",
  11340. messageSends: [],
  11341. referencedClasses: []
  11342. }),
  11343. smalltalk.Array);
  11344. smalltalk.addMethod(
  11345. smalltalk.method({
  11346. selector: "select:",
  11347. category: 'enumerating',
  11348. fn: function (aBlock){
  11349. var self=this;
  11350. return smalltalk.withContext(function($ctx1) {
  11351. var result = self.klass._new();
  11352. for(var i=0; i<self.length; i++) {
  11353. if(aBlock._value_(self[i])) {
  11354. result.push(self[i]);
  11355. }
  11356. }
  11357. return result;
  11358. ;
  11359. return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},smalltalk.Array)})},
  11360. args: ["aBlock"],
  11361. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  11362. messageSends: [],
  11363. referencedClasses: []
  11364. }),
  11365. smalltalk.Array);
  11366. smalltalk.addMethod(
  11367. smalltalk.method({
  11368. selector: "size",
  11369. category: 'accessing',
  11370. fn: function (){
  11371. var self=this;
  11372. return smalltalk.withContext(function($ctx1) {
  11373. return self.length;
  11374. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Array)})},
  11375. args: [],
  11376. source: "size\x0a\x09<return self.length>",
  11377. messageSends: [],
  11378. referencedClasses: []
  11379. }),
  11380. smalltalk.Array);
  11381. smalltalk.addMethod(
  11382. smalltalk.method({
  11383. selector: "sort",
  11384. category: 'enumerating',
  11385. fn: function (){
  11386. var self=this;
  11387. return smalltalk.withContext(function($ctx1) {
  11388. var $1;
  11389. $1=self._basicPerform_("sort");
  11390. return $1;
  11391. }, function($ctx1) {$ctx1.fill(self,"sort",{},smalltalk.Array)})},
  11392. args: [],
  11393. source: "sort\x0a\x09^self basicPerform: 'sort'",
  11394. messageSends: ["basicPerform:"],
  11395. referencedClasses: []
  11396. }),
  11397. smalltalk.Array);
  11398. smalltalk.addMethod(
  11399. smalltalk.method({
  11400. selector: "sort:",
  11401. category: 'enumerating',
  11402. fn: function (aBlock){
  11403. var self=this;
  11404. return smalltalk.withContext(function($ctx1) {
  11405. return self.sort(function(a, b) {
  11406. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  11407. })
  11408. ;
  11409. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},smalltalk.Array)})},
  11410. args: ["aBlock"],
  11411. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  11412. messageSends: [],
  11413. referencedClasses: []
  11414. }),
  11415. smalltalk.Array);
  11416. smalltalk.addMethod(
  11417. smalltalk.method({
  11418. selector: "sorted",
  11419. category: 'enumerating',
  11420. fn: function (){
  11421. var self=this;
  11422. return smalltalk.withContext(function($ctx1) {
  11423. var $1;
  11424. $1=_st(self._copy())._sort();
  11425. return $1;
  11426. }, function($ctx1) {$ctx1.fill(self,"sorted",{},smalltalk.Array)})},
  11427. args: [],
  11428. source: "sorted\x0a\x09^self copy sort",
  11429. messageSends: ["sort", "copy"],
  11430. referencedClasses: []
  11431. }),
  11432. smalltalk.Array);
  11433. smalltalk.addMethod(
  11434. smalltalk.method({
  11435. selector: "sorted:",
  11436. category: 'enumerating',
  11437. fn: function (aBlock){
  11438. var self=this;
  11439. return smalltalk.withContext(function($ctx1) {
  11440. var $1;
  11441. $1=_st(self._copy())._sort_(aBlock);
  11442. return $1;
  11443. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},smalltalk.Array)})},
  11444. args: ["aBlock"],
  11445. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  11446. messageSends: ["sort:", "copy"],
  11447. referencedClasses: []
  11448. }),
  11449. smalltalk.Array);
  11450. smalltalk.addMethod(
  11451. smalltalk.method({
  11452. selector: "new:",
  11453. category: 'instance creation',
  11454. fn: function (anInteger){
  11455. var self=this;
  11456. return smalltalk.withContext(function($ctx1) {
  11457. return new Array(anInteger);
  11458. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},smalltalk.Array.klass)})},
  11459. args: ["anInteger"],
  11460. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  11461. messageSends: [],
  11462. referencedClasses: []
  11463. }),
  11464. smalltalk.Array.klass);
  11465. smalltalk.addMethod(
  11466. smalltalk.method({
  11467. selector: "with:",
  11468. category: 'instance creation',
  11469. fn: function (anObject){
  11470. var self=this;
  11471. return smalltalk.withContext(function($ctx1) {
  11472. var $2,$3,$1;
  11473. $2=self._new_((1));
  11474. _st($2)._at_put_((1),anObject);
  11475. $3=_st($2)._yourself();
  11476. $1=$3;
  11477. return $1;
  11478. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},smalltalk.Array.klass)})},
  11479. args: ["anObject"],
  11480. source: "with: anObject\x0a\x09\x09^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11481. messageSends: ["at:put:", "new:", "yourself"],
  11482. referencedClasses: []
  11483. }),
  11484. smalltalk.Array.klass);
  11485. smalltalk.addMethod(
  11486. smalltalk.method({
  11487. selector: "with:with:",
  11488. category: 'instance creation',
  11489. fn: function (anObject,anObject2){
  11490. var self=this;
  11491. return smalltalk.withContext(function($ctx1) {
  11492. var $2,$3,$1;
  11493. $2=self._new_((2));
  11494. _st($2)._at_put_((1),anObject);
  11495. _st($2)._at_put_((2),anObject2);
  11496. $3=_st($2)._yourself();
  11497. $1=$3;
  11498. return $1;
  11499. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},smalltalk.Array.klass)})},
  11500. args: ["anObject", "anObject2"],
  11501. source: "with: anObject with: anObject2\x0a\x09\x09^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  11502. messageSends: ["at:put:", "new:", "yourself"],
  11503. referencedClasses: []
  11504. }),
  11505. smalltalk.Array.klass);
  11506. smalltalk.addMethod(
  11507. smalltalk.method({
  11508. selector: "with:with:with:",
  11509. category: 'instance creation',
  11510. fn: function (anObject,anObject2,anObject3){
  11511. var self=this;
  11512. return smalltalk.withContext(function($ctx1) {
  11513. var $2,$3,$1;
  11514. $2=self._new_((3));
  11515. _st($2)._at_put_((1),anObject);
  11516. _st($2)._at_put_((2),anObject2);
  11517. _st($2)._at_put_((3),anObject3);
  11518. $3=_st($2)._yourself();
  11519. $1=$3;
  11520. return $1;
  11521. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.Array.klass)})},
  11522. args: ["anObject", "anObject2", "anObject3"],
  11523. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^(self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  11524. messageSends: ["at:put:", "new:", "yourself"],
  11525. referencedClasses: []
  11526. }),
  11527. smalltalk.Array.klass);
  11528. smalltalk.addMethod(
  11529. smalltalk.method({
  11530. selector: "withAll:",
  11531. category: 'instance creation',
  11532. fn: function (aCollection){
  11533. var self=this;
  11534. var instance,index;
  11535. return smalltalk.withContext(function($ctx1) {
  11536. var $1;
  11537. index=(1);
  11538. instance=self._new_(_st(aCollection)._size());
  11539. _st(aCollection)._do_((function(each){
  11540. return smalltalk.withContext(function($ctx2) {
  11541. _st(instance)._at_put_(index,each);
  11542. index=_st(index).__plus((1));
  11543. return index;
  11544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  11545. $1=instance;
  11546. return $1;
  11547. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},smalltalk.Array.klass)})},
  11548. args: ["aCollection"],
  11549. 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",
  11550. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  11551. referencedClasses: []
  11552. }),
  11553. smalltalk.Array.klass);
  11554. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  11555. smalltalk.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11556. smalltalk.addMethod(
  11557. smalltalk.method({
  11558. selector: ",",
  11559. category: 'copying',
  11560. fn: function (aString){
  11561. var self=this;
  11562. return smalltalk.withContext(function($ctx1) {
  11563. var $1;
  11564. $1=_st(self._asString()).__comma(_st(aString)._asString());
  11565. return $1;
  11566. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.CharacterArray)})},
  11567. args: ["aString"],
  11568. source: ", aString\x0a\x09^self asString, aString asString",
  11569. messageSends: [",", "asString"],
  11570. referencedClasses: []
  11571. }),
  11572. smalltalk.CharacterArray);
  11573. smalltalk.addMethod(
  11574. smalltalk.method({
  11575. selector: "add:",
  11576. category: 'adding/removing',
  11577. fn: function (anObject){
  11578. var self=this;
  11579. return smalltalk.withContext(function($ctx1) {
  11580. self._errorReadOnly();
  11581. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.CharacterArray)})},
  11582. args: ["anObject"],
  11583. source: "add: anObject\x0a\x09self errorReadOnly",
  11584. messageSends: ["errorReadOnly"],
  11585. referencedClasses: []
  11586. }),
  11587. smalltalk.CharacterArray);
  11588. smalltalk.addMethod(
  11589. smalltalk.method({
  11590. selector: "asLowercase",
  11591. category: 'converting',
  11592. fn: function (){
  11593. var self=this;
  11594. return smalltalk.withContext(function($ctx1) {
  11595. var $1;
  11596. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  11597. return $1;
  11598. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.CharacterArray)})},
  11599. args: [],
  11600. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  11601. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  11602. referencedClasses: []
  11603. }),
  11604. smalltalk.CharacterArray);
  11605. smalltalk.addMethod(
  11606. smalltalk.method({
  11607. selector: "asNumber",
  11608. category: 'converting',
  11609. fn: function (){
  11610. var self=this;
  11611. return smalltalk.withContext(function($ctx1) {
  11612. var $1;
  11613. $1=_st(self._asString())._asNumber();
  11614. return $1;
  11615. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.CharacterArray)})},
  11616. args: [],
  11617. source: "asNumber\x0a\x09^self asString asNumber",
  11618. messageSends: ["asNumber", "asString"],
  11619. referencedClasses: []
  11620. }),
  11621. smalltalk.CharacterArray);
  11622. smalltalk.addMethod(
  11623. smalltalk.method({
  11624. selector: "asString",
  11625. category: 'converting',
  11626. fn: function (){
  11627. var self=this;
  11628. return smalltalk.withContext(function($ctx1) {
  11629. var $1;
  11630. $1=self._subclassResponsibility();
  11631. return $1;
  11632. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.CharacterArray)})},
  11633. args: [],
  11634. source: "asString\x0a\x09^self subclassResponsibility",
  11635. messageSends: ["subclassResponsibility"],
  11636. referencedClasses: []
  11637. }),
  11638. smalltalk.CharacterArray);
  11639. smalltalk.addMethod(
  11640. smalltalk.method({
  11641. selector: "asSymbol",
  11642. category: 'converting',
  11643. fn: function (){
  11644. var self=this;
  11645. return smalltalk.withContext(function($ctx1) {
  11646. var $1;
  11647. $1=self._asString();
  11648. return $1;
  11649. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.CharacterArray)})},
  11650. args: [],
  11651. source: "asSymbol\x0a\x09^self asString",
  11652. messageSends: ["asString"],
  11653. referencedClasses: []
  11654. }),
  11655. smalltalk.CharacterArray);
  11656. smalltalk.addMethod(
  11657. smalltalk.method({
  11658. selector: "asUppercase",
  11659. category: 'converting',
  11660. fn: function (){
  11661. var self=this;
  11662. return smalltalk.withContext(function($ctx1) {
  11663. var $1;
  11664. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  11665. return $1;
  11666. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.CharacterArray)})},
  11667. args: [],
  11668. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  11669. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  11670. referencedClasses: []
  11671. }),
  11672. smalltalk.CharacterArray);
  11673. smalltalk.addMethod(
  11674. smalltalk.method({
  11675. selector: "at:put:",
  11676. category: 'accessing',
  11677. fn: function (anIndex,anObject){
  11678. var self=this;
  11679. return smalltalk.withContext(function($ctx1) {
  11680. self._errorReadOnly();
  11681. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},smalltalk.CharacterArray)})},
  11682. args: ["anIndex", "anObject"],
  11683. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11684. messageSends: ["errorReadOnly"],
  11685. referencedClasses: []
  11686. }),
  11687. smalltalk.CharacterArray);
  11688. smalltalk.addMethod(
  11689. smalltalk.method({
  11690. selector: "errorReadOnly",
  11691. category: 'error handling',
  11692. fn: function (){
  11693. var self=this;
  11694. return smalltalk.withContext(function($ctx1) {
  11695. self._error_("Object is read-only");
  11696. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},smalltalk.CharacterArray)})},
  11697. args: [],
  11698. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11699. messageSends: ["error:"],
  11700. referencedClasses: []
  11701. }),
  11702. smalltalk.CharacterArray);
  11703. smalltalk.addMethod(
  11704. smalltalk.method({
  11705. selector: "printOn:",
  11706. category: 'printing',
  11707. fn: function (aStream){
  11708. var self=this;
  11709. return smalltalk.withContext(function($ctx1) {
  11710. _st(self._asString())._printOn_(aStream);
  11711. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  11712. args: ["aStream"],
  11713. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11714. messageSends: ["printOn:", "asString"],
  11715. referencedClasses: []
  11716. }),
  11717. smalltalk.CharacterArray);
  11718. smalltalk.addMethod(
  11719. smalltalk.method({
  11720. selector: "putOn:",
  11721. category: 'streaming',
  11722. fn: function (aStream){
  11723. var self=this;
  11724. return smalltalk.withContext(function($ctx1) {
  11725. _st(aStream)._nextPutString_(self);
  11726. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},smalltalk.CharacterArray)})},
  11727. args: ["aStream"],
  11728. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11729. messageSends: ["nextPutString:"],
  11730. referencedClasses: []
  11731. }),
  11732. smalltalk.CharacterArray);
  11733. smalltalk.addMethod(
  11734. smalltalk.method({
  11735. selector: "remove:",
  11736. category: 'adding/removing',
  11737. fn: function (anObject){
  11738. var self=this;
  11739. return smalltalk.withContext(function($ctx1) {
  11740. self._errorReadOnly();
  11741. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.CharacterArray)})},
  11742. args: ["anObject"],
  11743. source: "remove: anObject\x0a\x09self errorReadOnly",
  11744. messageSends: ["errorReadOnly"],
  11745. referencedClasses: []
  11746. }),
  11747. smalltalk.CharacterArray);
  11748. smalltalk.addMethod(
  11749. smalltalk.method({
  11750. selector: "fromString:",
  11751. category: 'instance creation',
  11752. fn: function (aString){
  11753. var self=this;
  11754. return smalltalk.withContext(function($ctx1) {
  11755. self._subclassResponsibility();
  11756. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.CharacterArray.klass)})},
  11757. args: ["aString"],
  11758. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11759. messageSends: ["subclassResponsibility"],
  11760. referencedClasses: []
  11761. }),
  11762. smalltalk.CharacterArray.klass);
  11763. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  11764. smalltalk.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  11765. smalltalk.addMethod(
  11766. smalltalk.method({
  11767. selector: ",",
  11768. category: 'copying',
  11769. fn: function (aString){
  11770. var self=this;
  11771. return smalltalk.withContext(function($ctx1) {
  11772. return self + aString;
  11773. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},smalltalk.String)})},
  11774. args: ["aString"],
  11775. source: ", aString\x0a\x09<return self + aString>",
  11776. messageSends: [],
  11777. referencedClasses: []
  11778. }),
  11779. smalltalk.String);
  11780. smalltalk.addMethod(
  11781. smalltalk.method({
  11782. selector: "<",
  11783. category: 'comparing',
  11784. fn: function (aString){
  11785. var self=this;
  11786. return smalltalk.withContext(function($ctx1) {
  11787. return String(self) < aString._asString();
  11788. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},smalltalk.String)})},
  11789. args: ["aString"],
  11790. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  11791. messageSends: [],
  11792. referencedClasses: []
  11793. }),
  11794. smalltalk.String);
  11795. smalltalk.addMethod(
  11796. smalltalk.method({
  11797. selector: "<=",
  11798. category: 'comparing',
  11799. fn: function (aString){
  11800. var self=this;
  11801. return smalltalk.withContext(function($ctx1) {
  11802. return String(self) <= aString._asString();
  11803. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},smalltalk.String)})},
  11804. args: ["aString"],
  11805. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  11806. messageSends: [],
  11807. referencedClasses: []
  11808. }),
  11809. smalltalk.String);
  11810. smalltalk.addMethod(
  11811. smalltalk.method({
  11812. selector: "=",
  11813. category: 'comparing',
  11814. fn: function (aString){
  11815. var self=this;
  11816. return smalltalk.withContext(function($ctx1) {
  11817. if(typeof aString === 'undefined') { return false }
  11818. if(!aString._isString || ! aString._isString()) {
  11819. return false;
  11820. }
  11821. return String(self) === String(aString)
  11822. ;
  11823. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},smalltalk.String)})},
  11824. args: ["aString"],
  11825. source: "= aString\x0a\x09<\x0a\x09\x09if(typeof aString === 'undefined') { return false }\x0a\x09\x09if(!aString._isString || ! aString._isString()) {\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09return String(self) === String(aString)\x0a\x09>",
  11826. messageSends: [],
  11827. referencedClasses: []
  11828. }),
  11829. smalltalk.String);
  11830. smalltalk.addMethod(
  11831. smalltalk.method({
  11832. selector: "==",
  11833. category: 'comparing',
  11834. fn: function (aString){
  11835. var self=this;
  11836. return smalltalk.withContext(function($ctx1) {
  11837. var $1;
  11838. $1=self.__eq(aString);
  11839. return $1;
  11840. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},smalltalk.String)})},
  11841. args: ["aString"],
  11842. source: "== aString\x0a\x09^self = aString",
  11843. messageSends: ["="],
  11844. referencedClasses: []
  11845. }),
  11846. smalltalk.String);
  11847. smalltalk.addMethod(
  11848. smalltalk.method({
  11849. selector: ">",
  11850. category: 'comparing',
  11851. fn: function (aString){
  11852. var self=this;
  11853. return smalltalk.withContext(function($ctx1) {
  11854. return String(self) > aString._asString();
  11855. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},smalltalk.String)})},
  11856. args: ["aString"],
  11857. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  11858. messageSends: [],
  11859. referencedClasses: []
  11860. }),
  11861. smalltalk.String);
  11862. smalltalk.addMethod(
  11863. smalltalk.method({
  11864. selector: ">=",
  11865. category: 'comparing',
  11866. fn: function (aString){
  11867. var self=this;
  11868. return smalltalk.withContext(function($ctx1) {
  11869. return String(self) >= aString._asString();
  11870. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},smalltalk.String)})},
  11871. args: ["aString"],
  11872. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  11873. messageSends: [],
  11874. referencedClasses: []
  11875. }),
  11876. smalltalk.String);
  11877. smalltalk.addMethod(
  11878. smalltalk.method({
  11879. selector: "asJSON",
  11880. category: 'converting',
  11881. fn: function (){
  11882. var self=this;
  11883. return smalltalk.withContext(function($ctx1) {
  11884. var $1;
  11885. $1=self;
  11886. return $1;
  11887. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.String)})},
  11888. args: [],
  11889. source: "asJSON\x0a\x09^self",
  11890. messageSends: [],
  11891. referencedClasses: []
  11892. }),
  11893. smalltalk.String);
  11894. smalltalk.addMethod(
  11895. smalltalk.method({
  11896. selector: "asJavascript",
  11897. category: 'converting',
  11898. fn: function (){
  11899. var self=this;
  11900. return smalltalk.withContext(function($ctx1) {
  11901. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11902. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11903. else
  11904. return "\"" + self + "\"";
  11905. ;
  11906. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.String)})},
  11907. args: [],
  11908. 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>",
  11909. messageSends: [],
  11910. referencedClasses: []
  11911. }),
  11912. smalltalk.String);
  11913. smalltalk.addMethod(
  11914. smalltalk.method({
  11915. selector: "asLowercase",
  11916. category: 'converting',
  11917. fn: function (){
  11918. var self=this;
  11919. return smalltalk.withContext(function($ctx1) {
  11920. return self.toLowerCase();
  11921. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},smalltalk.String)})},
  11922. args: [],
  11923. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  11924. messageSends: [],
  11925. referencedClasses: []
  11926. }),
  11927. smalltalk.String);
  11928. smalltalk.addMethod(
  11929. smalltalk.method({
  11930. selector: "asMutator",
  11931. category: 'converting',
  11932. fn: function (){
  11933. var self=this;
  11934. return smalltalk.withContext(function($ctx1) {
  11935. var $1,$2,$3;
  11936. $1=_st(self._last()).__eq(":");
  11937. if(! smalltalk.assert($1)){
  11938. $2=self.__comma(":");
  11939. return $2;
  11940. };
  11941. $3=self;
  11942. return $3;
  11943. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},smalltalk.String)})},
  11944. args: [],
  11945. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  11946. messageSends: ["ifFalse:", "=", "last", ","],
  11947. referencedClasses: []
  11948. }),
  11949. smalltalk.String);
  11950. smalltalk.addMethod(
  11951. smalltalk.method({
  11952. selector: "asNumber",
  11953. category: 'converting',
  11954. fn: function (){
  11955. var self=this;
  11956. return smalltalk.withContext(function($ctx1) {
  11957. return Number(self);
  11958. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},smalltalk.String)})},
  11959. args: [],
  11960. source: "asNumber\x0a\x09<return Number(self)>",
  11961. messageSends: [],
  11962. referencedClasses: []
  11963. }),
  11964. smalltalk.String);
  11965. smalltalk.addMethod(
  11966. smalltalk.method({
  11967. selector: "asRegexp",
  11968. category: 'converting',
  11969. fn: function (){
  11970. var self=this;
  11971. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  11972. return smalltalk.withContext(function($ctx1) {
  11973. var $1;
  11974. $1=_st($RegularExpression())._fromString_(self);
  11975. return $1;
  11976. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},smalltalk.String)})},
  11977. args: [],
  11978. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11979. messageSends: ["fromString:"],
  11980. referencedClasses: ["RegularExpression"]
  11981. }),
  11982. smalltalk.String);
  11983. smalltalk.addMethod(
  11984. smalltalk.method({
  11985. selector: "asSelector",
  11986. category: 'converting',
  11987. fn: function (){
  11988. var self=this;
  11989. return smalltalk.withContext(function($ctx1) {
  11990. return smalltalk.selector(self);
  11991. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},smalltalk.String)})},
  11992. args: [],
  11993. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  11994. messageSends: [],
  11995. referencedClasses: []
  11996. }),
  11997. smalltalk.String);
  11998. smalltalk.addMethod(
  11999. smalltalk.method({
  12000. selector: "asString",
  12001. category: 'converting',
  12002. fn: function (){
  12003. var self=this;
  12004. return smalltalk.withContext(function($ctx1) {
  12005. var $1;
  12006. $1=self;
  12007. return $1;
  12008. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.String)})},
  12009. args: [],
  12010. source: "asString\x0a\x09^self",
  12011. messageSends: [],
  12012. referencedClasses: []
  12013. }),
  12014. smalltalk.String);
  12015. smalltalk.addMethod(
  12016. smalltalk.method({
  12017. selector: "asSymbol",
  12018. category: 'converting',
  12019. fn: function (){
  12020. var self=this;
  12021. return smalltalk.withContext(function($ctx1) {
  12022. var $1;
  12023. $1=self;
  12024. return $1;
  12025. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},smalltalk.String)})},
  12026. args: [],
  12027. source: "asSymbol\x0a\x09^ self",
  12028. messageSends: [],
  12029. referencedClasses: []
  12030. }),
  12031. smalltalk.String);
  12032. smalltalk.addMethod(
  12033. smalltalk.method({
  12034. selector: "asUppercase",
  12035. category: 'converting',
  12036. fn: function (){
  12037. var self=this;
  12038. return smalltalk.withContext(function($ctx1) {
  12039. return self.toUpperCase();
  12040. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},smalltalk.String)})},
  12041. args: [],
  12042. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  12043. messageSends: [],
  12044. referencedClasses: []
  12045. }),
  12046. smalltalk.String);
  12047. smalltalk.addMethod(
  12048. smalltalk.method({
  12049. selector: "asciiValue",
  12050. category: 'accessing',
  12051. fn: function (){
  12052. var self=this;
  12053. return smalltalk.withContext(function($ctx1) {
  12054. return self.charCodeAt(0);;
  12055. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},smalltalk.String)})},
  12056. args: [],
  12057. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  12058. messageSends: [],
  12059. referencedClasses: []
  12060. }),
  12061. smalltalk.String);
  12062. smalltalk.addMethod(
  12063. smalltalk.method({
  12064. selector: "at:ifAbsent:",
  12065. category: 'accessing',
  12066. fn: function (anIndex,aBlock){
  12067. var self=this;
  12068. return smalltalk.withContext(function($ctx1) {
  12069. return String(self).charAt(anIndex - 1) || aBlock._value();
  12070. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},smalltalk.String)})},
  12071. args: ["anIndex", "aBlock"],
  12072. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock._value()>",
  12073. messageSends: [],
  12074. referencedClasses: []
  12075. }),
  12076. smalltalk.String);
  12077. smalltalk.addMethod(
  12078. smalltalk.method({
  12079. selector: "at:ifPresent:ifAbsent:",
  12080. category: 'accessing',
  12081. fn: function (anIndex,aBlock,anotherBlock){
  12082. var self=this;
  12083. return smalltalk.withContext(function($ctx1) {
  12084. var result = String(self).charAt(anIndex - 1);
  12085. return result ? aBlock._value_(result) : anotherBlock._value();
  12086. ;
  12087. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.String)})},
  12088. args: ["anIndex", "aBlock", "anotherBlock"],
  12089. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self).charAt(anIndex - 1);\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  12090. messageSends: [],
  12091. referencedClasses: []
  12092. }),
  12093. smalltalk.String);
  12094. smalltalk.addMethod(
  12095. smalltalk.method({
  12096. selector: "charCodeAt:",
  12097. category: 'accessing',
  12098. fn: function (anInteger){
  12099. var self=this;
  12100. return smalltalk.withContext(function($ctx1) {
  12101. return self.charCodeAt(anInteger - 1) ;
  12102. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},smalltalk.String)})},
  12103. args: ["anInteger"],
  12104. source: "charCodeAt: anInteger\x0a\x09< return self.charCodeAt(anInteger - 1) >",
  12105. messageSends: [],
  12106. referencedClasses: []
  12107. }),
  12108. smalltalk.String);
  12109. smalltalk.addMethod(
  12110. smalltalk.method({
  12111. selector: "copyFrom:to:",
  12112. category: 'copying',
  12113. fn: function (anIndex,anotherIndex){
  12114. var self=this;
  12115. return smalltalk.withContext(function($ctx1) {
  12116. return self.substring(anIndex - 1, anotherIndex);
  12117. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},smalltalk.String)})},
  12118. args: ["anIndex", "anotherIndex"],
  12119. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  12120. messageSends: [],
  12121. referencedClasses: []
  12122. }),
  12123. smalltalk.String);
  12124. smalltalk.addMethod(
  12125. smalltalk.method({
  12126. selector: "crlfSanitized",
  12127. category: 'converting',
  12128. fn: function (){
  12129. var self=this;
  12130. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12131. return smalltalk.withContext(function($ctx1) {
  12132. var $1;
  12133. $1=_st(self._lines())._join_(_st($String())._lf());
  12134. return $1;
  12135. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},smalltalk.String)})},
  12136. args: [],
  12137. source: "crlfSanitized\x0a\x09^self lines join: String lf",
  12138. messageSends: ["join:", "lines", "lf"],
  12139. referencedClasses: ["String"]
  12140. }),
  12141. smalltalk.String);
  12142. smalltalk.addMethod(
  12143. smalltalk.method({
  12144. selector: "deepCopy",
  12145. category: 'copying',
  12146. fn: function (){
  12147. var self=this;
  12148. return smalltalk.withContext(function($ctx1) {
  12149. var $1;
  12150. $1=self._shallowCopy();
  12151. return $1;
  12152. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},smalltalk.String)})},
  12153. args: [],
  12154. source: "deepCopy\x0a\x09^self shallowCopy",
  12155. messageSends: ["shallowCopy"],
  12156. referencedClasses: []
  12157. }),
  12158. smalltalk.String);
  12159. smalltalk.addMethod(
  12160. smalltalk.method({
  12161. selector: "do:",
  12162. category: 'enumerating',
  12163. fn: function (aBlock){
  12164. var self=this;
  12165. return smalltalk.withContext(function($ctx1) {
  12166. for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));};
  12167. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.String)})},
  12168. args: ["aBlock"],
  12169. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_(self.charAt(i));}>",
  12170. messageSends: [],
  12171. referencedClasses: []
  12172. }),
  12173. smalltalk.String);
  12174. smalltalk.addMethod(
  12175. smalltalk.method({
  12176. selector: "escaped",
  12177. category: 'accessing',
  12178. fn: function (){
  12179. var self=this;
  12180. return smalltalk.withContext(function($ctx1) {
  12181. return escape(self);
  12182. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},smalltalk.String)})},
  12183. args: [],
  12184. source: "escaped\x0a\x09<return escape(self)>",
  12185. messageSends: [],
  12186. referencedClasses: []
  12187. }),
  12188. smalltalk.String);
  12189. smalltalk.addMethod(
  12190. smalltalk.method({
  12191. selector: "includesSubString:",
  12192. category: 'testing',
  12193. fn: function (subString){
  12194. var self=this;
  12195. return smalltalk.withContext(function($ctx1) {
  12196. return self.indexOf(subString) != -1 ;
  12197. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},smalltalk.String)})},
  12198. args: ["subString"],
  12199. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  12200. messageSends: [],
  12201. referencedClasses: []
  12202. }),
  12203. smalltalk.String);
  12204. smalltalk.addMethod(
  12205. smalltalk.method({
  12206. selector: "isImmutable",
  12207. category: 'testing',
  12208. fn: function (){
  12209. var self=this;
  12210. return smalltalk.withContext(function($ctx1) {
  12211. return true;
  12212. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.String)})},
  12213. args: [],
  12214. source: "isImmutable\x0a\x09^ true",
  12215. messageSends: [],
  12216. referencedClasses: []
  12217. }),
  12218. smalltalk.String);
  12219. smalltalk.addMethod(
  12220. smalltalk.method({
  12221. selector: "isString",
  12222. category: 'testing',
  12223. fn: function (){
  12224. var self=this;
  12225. return smalltalk.withContext(function($ctx1) {
  12226. return true;
  12227. }, function($ctx1) {$ctx1.fill(self,"isString",{},smalltalk.String)})},
  12228. args: [],
  12229. source: "isString\x0a\x09^true",
  12230. messageSends: [],
  12231. referencedClasses: []
  12232. }),
  12233. smalltalk.String);
  12234. smalltalk.addMethod(
  12235. smalltalk.method({
  12236. selector: "isVowel",
  12237. category: 'testing',
  12238. fn: function (){
  12239. var self=this;
  12240. return smalltalk.withContext(function($ctx1) {
  12241. var $1;
  12242. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  12243. return smalltalk.withContext(function($ctx2) {
  12244. return "aeiou"._includes_(self._asLowercase());
  12245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  12246. return $1;
  12247. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},smalltalk.String)})},
  12248. args: [],
  12249. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  12250. messageSends: ["and:", "=", "size", "includes:", "asLowercase"],
  12251. referencedClasses: []
  12252. }),
  12253. smalltalk.String);
  12254. smalltalk.addMethod(
  12255. smalltalk.method({
  12256. selector: "join:",
  12257. category: 'split join',
  12258. fn: function (aCollection){
  12259. var self=this;
  12260. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12261. return smalltalk.withContext(function($ctx1) {
  12262. var $1;
  12263. $1=_st($String())._streamContents_((function(stream){
  12264. return smalltalk.withContext(function($ctx2) {
  12265. return _st(aCollection)._do_separatedBy_((function(each){
  12266. return smalltalk.withContext(function($ctx3) {
  12267. return _st(stream)._nextPutAll_(_st(each)._asString());
  12268. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  12269. return smalltalk.withContext(function($ctx3) {
  12270. return _st(stream)._nextPutAll_(self);
  12271. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  12272. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  12273. return $1;
  12274. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},smalltalk.String)})},
  12275. args: ["aCollection"],
  12276. 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]]",
  12277. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  12278. referencedClasses: ["String"]
  12279. }),
  12280. smalltalk.String);
  12281. smalltalk.addMethod(
  12282. smalltalk.method({
  12283. selector: "lineIndicesDo:",
  12284. category: 'split join',
  12285. fn: function (aBlock){
  12286. var self=this;
  12287. var cr,lf,start,sz,nextLF,nextCR;
  12288. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12289. return smalltalk.withContext(function($ctx1) {
  12290. var $1,$2,$3,$4;
  12291. var $early={};
  12292. try {
  12293. start=(1);
  12294. sz=self._size();
  12295. cr=_st($String())._cr();
  12296. nextCR=self._indexOf_startingAt_(cr,(1));
  12297. lf=_st($String())._lf();
  12298. nextLF=self._indexOf_startingAt_(lf,(1));
  12299. _st((function(){
  12300. return smalltalk.withContext(function($ctx2) {
  12301. return _st(start).__lt_eq(sz);
  12302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  12303. return smalltalk.withContext(function($ctx2) {
  12304. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  12305. return smalltalk.withContext(function($ctx3) {
  12306. return _st(nextCR).__eq((0));
  12307. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  12308. if(smalltalk.assert($1)){
  12309. _st(aBlock)._value_value_value_(start,sz,sz);
  12310. $2=self;
  12311. throw $early=[$2];
  12312. };
  12313. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  12314. return smalltalk.withContext(function($ctx3) {
  12315. return _st((0).__lt(nextLF))._and_((function(){
  12316. return smalltalk.withContext(function($ctx4) {
  12317. return _st(nextLF).__lt(nextCR);
  12318. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  12319. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  12320. if(smalltalk.assert($3)){
  12321. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  12322. start=(1).__plus(nextLF);
  12323. start;
  12324. nextLF=self._indexOf_startingAt_(lf,start);
  12325. return nextLF;
  12326. } else {
  12327. $4=_st((1).__plus(nextCR)).__eq(nextLF);
  12328. if(smalltalk.assert($4)){
  12329. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  12330. start=(1).__plus(nextLF);
  12331. start;
  12332. nextCR=self._indexOf_startingAt_(cr,start);
  12333. nextCR;
  12334. nextLF=self._indexOf_startingAt_(lf,start);
  12335. return nextLF;
  12336. } else {
  12337. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  12338. start=(1).__plus(nextCR);
  12339. start;
  12340. nextCR=self._indexOf_startingAt_(cr,start);
  12341. return nextCR;
  12342. };
  12343. };
  12344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  12345. return self}
  12346. catch(e) {if(e===$early)return e[0]; throw e}
  12347. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},smalltalk.String)})},
  12348. args: ["aBlock"],
  12349. 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 ]]]",
  12350. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  12351. referencedClasses: ["String"]
  12352. }),
  12353. smalltalk.String);
  12354. smalltalk.addMethod(
  12355. smalltalk.method({
  12356. selector: "lineNumber:",
  12357. category: 'split join',
  12358. fn: function (anIndex){
  12359. var self=this;
  12360. var lineCount;
  12361. return smalltalk.withContext(function($ctx1) {
  12362. var $1,$2;
  12363. var $early={};
  12364. try {
  12365. lineCount=(0);
  12366. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12367. return smalltalk.withContext(function($ctx2) {
  12368. lineCount=_st(lineCount).__plus((1));
  12369. $1=_st(lineCount).__eq(anIndex);
  12370. if(smalltalk.assert($1)){
  12371. $2=self._copyFrom_to_(start,endWithoutDelimiters);
  12372. throw $early=[$2];
  12373. };
  12374. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  12375. return nil;
  12376. }
  12377. catch(e) {if(e===$early)return e[0]; throw e}
  12378. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},smalltalk.String)})},
  12379. args: ["anIndex"],
  12380. 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",
  12381. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  12382. referencedClasses: []
  12383. }),
  12384. smalltalk.String);
  12385. smalltalk.addMethod(
  12386. smalltalk.method({
  12387. selector: "lines",
  12388. category: 'split join',
  12389. fn: function (){
  12390. var self=this;
  12391. var lines;
  12392. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  12393. return smalltalk.withContext(function($ctx1) {
  12394. var $1;
  12395. lines=_st($Array())._new();
  12396. self._linesDo_((function(aLine){
  12397. return smalltalk.withContext(function($ctx2) {
  12398. return _st(lines)._add_(aLine);
  12399. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)})}));
  12400. $1=lines;
  12401. return $1;
  12402. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},smalltalk.String)})},
  12403. args: [],
  12404. 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",
  12405. messageSends: ["new", "linesDo:", "add:"],
  12406. referencedClasses: ["Array"]
  12407. }),
  12408. smalltalk.String);
  12409. smalltalk.addMethod(
  12410. smalltalk.method({
  12411. selector: "linesDo:",
  12412. category: 'split join',
  12413. fn: function (aBlock){
  12414. var self=this;
  12415. return smalltalk.withContext(function($ctx1) {
  12416. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12417. return smalltalk.withContext(function($ctx2) {
  12418. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  12419. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  12420. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},smalltalk.String)})},
  12421. args: ["aBlock"],
  12422. 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)]",
  12423. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  12424. referencedClasses: []
  12425. }),
  12426. smalltalk.String);
  12427. smalltalk.addMethod(
  12428. smalltalk.method({
  12429. selector: "match:",
  12430. category: 'regular expressions',
  12431. fn: function (aRegexp){
  12432. var self=this;
  12433. return smalltalk.withContext(function($ctx1) {
  12434. return self.search(aRegexp) != -1;
  12435. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},smalltalk.String)})},
  12436. args: ["aRegexp"],
  12437. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  12438. messageSends: [],
  12439. referencedClasses: []
  12440. }),
  12441. smalltalk.String);
  12442. smalltalk.addMethod(
  12443. smalltalk.method({
  12444. selector: "matchesOf:",
  12445. category: 'regular expressions',
  12446. fn: function (aRegularExpression){
  12447. var self=this;
  12448. return smalltalk.withContext(function($ctx1) {
  12449. return self.match(aRegularExpression);
  12450. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},smalltalk.String)})},
  12451. args: ["aRegularExpression"],
  12452. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  12453. messageSends: [],
  12454. referencedClasses: []
  12455. }),
  12456. smalltalk.String);
  12457. smalltalk.addMethod(
  12458. smalltalk.method({
  12459. selector: "printNl",
  12460. category: 'printing',
  12461. fn: function (){
  12462. var self=this;
  12463. return smalltalk.withContext(function($ctx1) {
  12464. console.log(self);
  12465. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},smalltalk.String)})},
  12466. args: [],
  12467. source: "printNl\x0a\x09<console.log(self)>",
  12468. messageSends: [],
  12469. referencedClasses: []
  12470. }),
  12471. smalltalk.String);
  12472. smalltalk.addMethod(
  12473. smalltalk.method({
  12474. selector: "printOn:",
  12475. category: 'printing',
  12476. fn: function (aStream){
  12477. var self=this;
  12478. return smalltalk.withContext(function($ctx1) {
  12479. var $1,$2;
  12480. $1=aStream;
  12481. _st($1)._nextPutAll_("'");
  12482. _st($1)._nextPutAll_(self);
  12483. $2=_st($1)._nextPutAll_("'");
  12484. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.String)})},
  12485. args: ["aStream"],
  12486. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  12487. messageSends: ["nextPutAll:"],
  12488. referencedClasses: []
  12489. }),
  12490. smalltalk.String);
  12491. smalltalk.addMethod(
  12492. smalltalk.method({
  12493. selector: "replace:with:",
  12494. category: 'regular expressions',
  12495. fn: function (aString,anotherString){
  12496. var self=this;
  12497. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  12498. return smalltalk.withContext(function($ctx1) {
  12499. var $1;
  12500. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  12501. return $1;
  12502. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},smalltalk.String)})},
  12503. args: ["aString", "anotherString"],
  12504. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12505. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  12506. referencedClasses: ["RegularExpression"]
  12507. }),
  12508. smalltalk.String);
  12509. smalltalk.addMethod(
  12510. smalltalk.method({
  12511. selector: "replaceRegexp:with:",
  12512. category: 'regular expressions',
  12513. fn: function (aRegexp,aString){
  12514. var self=this;
  12515. return smalltalk.withContext(function($ctx1) {
  12516. return self.replace(aRegexp, aString);
  12517. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},smalltalk.String)})},
  12518. args: ["aRegexp", "aString"],
  12519. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  12520. messageSends: [],
  12521. referencedClasses: []
  12522. }),
  12523. smalltalk.String);
  12524. smalltalk.addMethod(
  12525. smalltalk.method({
  12526. selector: "reversed",
  12527. category: 'converting',
  12528. fn: function (){
  12529. var self=this;
  12530. return smalltalk.withContext(function($ctx1) {
  12531. return self.split("").reverse().join("");
  12532. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.String)})},
  12533. args: [],
  12534. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  12535. messageSends: [],
  12536. referencedClasses: []
  12537. }),
  12538. smalltalk.String);
  12539. smalltalk.addMethod(
  12540. smalltalk.method({
  12541. selector: "shallowCopy",
  12542. category: 'copying',
  12543. fn: function (){
  12544. var self=this;
  12545. return smalltalk.withContext(function($ctx1) {
  12546. var $1;
  12547. $1=_st(self._class())._fromString_(self);
  12548. return $1;
  12549. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},smalltalk.String)})},
  12550. args: [],
  12551. source: "shallowCopy\x0a\x09^self class fromString: self",
  12552. messageSends: ["fromString:", "class"],
  12553. referencedClasses: []
  12554. }),
  12555. smalltalk.String);
  12556. smalltalk.addMethod(
  12557. smalltalk.method({
  12558. selector: "size",
  12559. category: 'accessing',
  12560. fn: function (){
  12561. var self=this;
  12562. return smalltalk.withContext(function($ctx1) {
  12563. return self.length;
  12564. return self}, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.String)})},
  12565. args: [],
  12566. source: "size\x0a\x09<return self.length>",
  12567. messageSends: [],
  12568. referencedClasses: []
  12569. }),
  12570. smalltalk.String);
  12571. smalltalk.addMethod(
  12572. smalltalk.method({
  12573. selector: "subStrings:",
  12574. category: 'split join',
  12575. fn: function (aString){
  12576. var self=this;
  12577. return smalltalk.withContext(function($ctx1) {
  12578. var $1;
  12579. $1=self._tokenize_(aString);
  12580. return $1;
  12581. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},smalltalk.String)})},
  12582. args: ["aString"],
  12583. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12584. messageSends: ["tokenize:"],
  12585. referencedClasses: []
  12586. }),
  12587. smalltalk.String);
  12588. smalltalk.addMethod(
  12589. smalltalk.method({
  12590. selector: "tokenize:",
  12591. category: 'split join',
  12592. fn: function (aString){
  12593. var self=this;
  12594. return smalltalk.withContext(function($ctx1) {
  12595. return self.split(aString);
  12596. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},smalltalk.String)})},
  12597. args: ["aString"],
  12598. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  12599. messageSends: [],
  12600. referencedClasses: []
  12601. }),
  12602. smalltalk.String);
  12603. smalltalk.addMethod(
  12604. smalltalk.method({
  12605. selector: "trimBoth",
  12606. category: 'regular expressions',
  12607. fn: function (){
  12608. var self=this;
  12609. return smalltalk.withContext(function($ctx1) {
  12610. var $1;
  12611. $1=self._trimBoth_("\x5cs");
  12612. return $1;
  12613. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},smalltalk.String)})},
  12614. args: [],
  12615. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  12616. messageSends: ["trimBoth:"],
  12617. referencedClasses: []
  12618. }),
  12619. smalltalk.String);
  12620. smalltalk.addMethod(
  12621. smalltalk.method({
  12622. selector: "trimBoth:",
  12623. category: 'regular expressions',
  12624. fn: function (separators){
  12625. var self=this;
  12626. return smalltalk.withContext(function($ctx1) {
  12627. var $1;
  12628. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  12629. return $1;
  12630. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},smalltalk.String)})},
  12631. args: ["separators"],
  12632. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  12633. messageSends: ["trimRight:", "trimLeft:"],
  12634. referencedClasses: []
  12635. }),
  12636. smalltalk.String);
  12637. smalltalk.addMethod(
  12638. smalltalk.method({
  12639. selector: "trimLeft",
  12640. category: 'regular expressions',
  12641. fn: function (){
  12642. var self=this;
  12643. return smalltalk.withContext(function($ctx1) {
  12644. var $1;
  12645. $1=self._trimLeft_("\x5cs");
  12646. return $1;
  12647. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},smalltalk.String)})},
  12648. args: [],
  12649. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  12650. messageSends: ["trimLeft:"],
  12651. referencedClasses: []
  12652. }),
  12653. smalltalk.String);
  12654. smalltalk.addMethod(
  12655. smalltalk.method({
  12656. selector: "trimLeft:",
  12657. category: 'regular expressions',
  12658. fn: function (separators){
  12659. var self=this;
  12660. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  12661. return smalltalk.withContext(function($ctx1) {
  12662. var $1;
  12663. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("^[".__comma(separators)).__comma("]+"),"g"),"");
  12664. return $1;
  12665. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},smalltalk.String)})},
  12666. args: ["separators"],
  12667. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12668. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  12669. referencedClasses: ["RegularExpression"]
  12670. }),
  12671. smalltalk.String);
  12672. smalltalk.addMethod(
  12673. smalltalk.method({
  12674. selector: "trimRight",
  12675. category: 'regular expressions',
  12676. fn: function (){
  12677. var self=this;
  12678. return smalltalk.withContext(function($ctx1) {
  12679. var $1;
  12680. $1=self._trimRight_("\x5cs");
  12681. return $1;
  12682. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},smalltalk.String)})},
  12683. args: [],
  12684. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  12685. messageSends: ["trimRight:"],
  12686. referencedClasses: []
  12687. }),
  12688. smalltalk.String);
  12689. smalltalk.addMethod(
  12690. smalltalk.method({
  12691. selector: "trimRight:",
  12692. category: 'regular expressions',
  12693. fn: function (separators){
  12694. var self=this;
  12695. function $RegularExpression(){return smalltalk.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  12696. return smalltalk.withContext(function($ctx1) {
  12697. var $1;
  12698. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(_st("[".__comma(separators)).__comma("]+$"),"g"),"");
  12699. return $1;
  12700. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},smalltalk.String)})},
  12701. args: ["separators"],
  12702. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12703. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  12704. referencedClasses: ["RegularExpression"]
  12705. }),
  12706. smalltalk.String);
  12707. smalltalk.addMethod(
  12708. smalltalk.method({
  12709. selector: "unescaped",
  12710. category: 'accessing',
  12711. fn: function (){
  12712. var self=this;
  12713. return smalltalk.withContext(function($ctx1) {
  12714. return unescape(self);
  12715. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},smalltalk.String)})},
  12716. args: [],
  12717. source: "unescaped\x0a\x09<return unescape(self)>",
  12718. messageSends: [],
  12719. referencedClasses: []
  12720. }),
  12721. smalltalk.String);
  12722. smalltalk.addMethod(
  12723. smalltalk.method({
  12724. selector: "withIndexDo:",
  12725. category: 'enumerating',
  12726. fn: function (aBlock){
  12727. var self=this;
  12728. return smalltalk.withContext(function($ctx1) {
  12729. for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);};
  12730. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},smalltalk.String)})},
  12731. args: ["aBlock"],
  12732. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock._value_value_(self.charAt(i), i+1);}>",
  12733. messageSends: [],
  12734. referencedClasses: []
  12735. }),
  12736. smalltalk.String);
  12737. smalltalk.addMethod(
  12738. smalltalk.method({
  12739. selector: "cr",
  12740. category: 'accessing',
  12741. fn: function (){
  12742. var self=this;
  12743. return smalltalk.withContext(function($ctx1) {
  12744. return '\r';
  12745. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.String.klass)})},
  12746. args: [],
  12747. source: "cr\x0a\x09<return '\x5cr'>",
  12748. messageSends: [],
  12749. referencedClasses: []
  12750. }),
  12751. smalltalk.String.klass);
  12752. smalltalk.addMethod(
  12753. smalltalk.method({
  12754. selector: "crlf",
  12755. category: 'accessing',
  12756. fn: function (){
  12757. var self=this;
  12758. return smalltalk.withContext(function($ctx1) {
  12759. return '\r\n';
  12760. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.String.klass)})},
  12761. args: [],
  12762. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  12763. messageSends: [],
  12764. referencedClasses: []
  12765. }),
  12766. smalltalk.String.klass);
  12767. smalltalk.addMethod(
  12768. smalltalk.method({
  12769. selector: "esc",
  12770. category: 'accessing',
  12771. fn: function (){
  12772. var self=this;
  12773. return smalltalk.withContext(function($ctx1) {
  12774. var $1;
  12775. $1=self._fromCharCode_((27));
  12776. return $1;
  12777. }, function($ctx1) {$ctx1.fill(self,"esc",{},smalltalk.String.klass)})},
  12778. args: [],
  12779. source: "esc\x0a\x09^ self fromCharCode: 27",
  12780. messageSends: ["fromCharCode:"],
  12781. referencedClasses: []
  12782. }),
  12783. smalltalk.String.klass);
  12784. smalltalk.addMethod(
  12785. smalltalk.method({
  12786. selector: "fromCharCode:",
  12787. category: 'instance creation',
  12788. fn: function (anInteger){
  12789. var self=this;
  12790. return smalltalk.withContext(function($ctx1) {
  12791. return String.fromCharCode(anInteger);
  12792. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},smalltalk.String.klass)})},
  12793. args: ["anInteger"],
  12794. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  12795. messageSends: [],
  12796. referencedClasses: []
  12797. }),
  12798. smalltalk.String.klass);
  12799. smalltalk.addMethod(
  12800. smalltalk.method({
  12801. selector: "fromString:",
  12802. category: 'instance creation',
  12803. fn: function (aString){
  12804. var self=this;
  12805. return smalltalk.withContext(function($ctx1) {
  12806. return String(aString);
  12807. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.String.klass)})},
  12808. args: ["aString"],
  12809. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  12810. messageSends: [],
  12811. referencedClasses: []
  12812. }),
  12813. smalltalk.String.klass);
  12814. smalltalk.addMethod(
  12815. smalltalk.method({
  12816. selector: "lf",
  12817. category: 'accessing',
  12818. fn: function (){
  12819. var self=this;
  12820. return smalltalk.withContext(function($ctx1) {
  12821. return '\n';
  12822. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.String.klass)})},
  12823. args: [],
  12824. source: "lf\x0a\x09<return '\x5cn'>",
  12825. messageSends: [],
  12826. referencedClasses: []
  12827. }),
  12828. smalltalk.String.klass);
  12829. smalltalk.addMethod(
  12830. smalltalk.method({
  12831. selector: "random",
  12832. category: 'random',
  12833. fn: function (){
  12834. var self=this;
  12835. return smalltalk.withContext(function($ctx1) {
  12836. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12837. return self}, function($ctx1) {$ctx1.fill(self,"random",{},smalltalk.String.klass)})},
  12838. args: [],
  12839. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  12840. messageSends: [],
  12841. referencedClasses: []
  12842. }),
  12843. smalltalk.String.klass);
  12844. smalltalk.addMethod(
  12845. smalltalk.method({
  12846. selector: "randomNotIn:",
  12847. category: 'random',
  12848. fn: function (aString){
  12849. var self=this;
  12850. var result;
  12851. return smalltalk.withContext(function($ctx1) {
  12852. var $1;
  12853. _st((function(){
  12854. return smalltalk.withContext(function($ctx2) {
  12855. result=self._random();
  12856. result;
  12857. return _st(aString)._includesSubString_(result);
  12858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue();
  12859. $1=result;
  12860. return $1;
  12861. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},smalltalk.String.klass)})},
  12862. args: ["aString"],
  12863. source: "randomNotIn: aString\x0a\x09| result |\x0a [ result := self random. aString includesSubString: result ] whileTrue.\x0a ^result",
  12864. messageSends: ["whileTrue", "random", "includesSubString:"],
  12865. referencedClasses: []
  12866. }),
  12867. smalltalk.String.klass);
  12868. smalltalk.addMethod(
  12869. smalltalk.method({
  12870. selector: "space",
  12871. category: 'accessing',
  12872. fn: function (){
  12873. var self=this;
  12874. return smalltalk.withContext(function($ctx1) {
  12875. return ' ';
  12876. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.String.klass)})},
  12877. args: [],
  12878. source: "space\x0a\x09<return ' '>",
  12879. messageSends: [],
  12880. referencedClasses: []
  12881. }),
  12882. smalltalk.String.klass);
  12883. smalltalk.addMethod(
  12884. smalltalk.method({
  12885. selector: "streamClass",
  12886. category: 'accessing',
  12887. fn: function (){
  12888. var self=this;
  12889. function $StringStream(){return smalltalk.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  12890. return smalltalk.withContext(function($ctx1) {
  12891. var $1;
  12892. $1=$StringStream();
  12893. return $1;
  12894. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},smalltalk.String.klass)})},
  12895. args: [],
  12896. source: "streamClass\x0a\x09\x09^StringStream",
  12897. messageSends: [],
  12898. referencedClasses: ["StringStream"]
  12899. }),
  12900. smalltalk.String.klass);
  12901. smalltalk.addMethod(
  12902. smalltalk.method({
  12903. selector: "tab",
  12904. category: 'accessing',
  12905. fn: function (){
  12906. var self=this;
  12907. return smalltalk.withContext(function($ctx1) {
  12908. return '\t';
  12909. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.String.klass)})},
  12910. args: [],
  12911. source: "tab\x0a\x09<return '\x5ct'>",
  12912. messageSends: [],
  12913. referencedClasses: []
  12914. }),
  12915. smalltalk.String.klass);
  12916. smalltalk.addMethod(
  12917. smalltalk.method({
  12918. selector: "value:",
  12919. category: 'instance creation',
  12920. fn: function (aUTFCharCode){
  12921. var self=this;
  12922. return smalltalk.withContext(function($ctx1) {
  12923. return String.fromCharCode(aUTFCharCode);;
  12924. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},smalltalk.String.klass)})},
  12925. args: ["aUTFCharCode"],
  12926. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  12927. messageSends: [],
  12928. referencedClasses: []
  12929. }),
  12930. smalltalk.String.klass);
  12931. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  12932. smalltalk.Set.comment="I represent an unordered set of objects without duplicates.";
  12933. smalltalk.addMethod(
  12934. smalltalk.method({
  12935. selector: "=",
  12936. category: 'comparing',
  12937. fn: function (aCollection){
  12938. var self=this;
  12939. return smalltalk.withContext(function($ctx1) {
  12940. var $1,$2,$3;
  12941. var $early={};
  12942. try {
  12943. $1=_st(self._class()).__eq(_st(aCollection)._class());
  12944. if(! smalltalk.assert($1)){
  12945. return false;
  12946. };
  12947. $2=_st(self._size()).__eq(_st(aCollection)._size());
  12948. if(! smalltalk.assert($2)){
  12949. return false;
  12950. };
  12951. self._do_((function(each){
  12952. return smalltalk.withContext(function($ctx2) {
  12953. $3=_st(aCollection)._includes_(each);
  12954. if(! smalltalk.assert($3)){
  12955. throw $early=[false];
  12956. };
  12957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  12958. return true;
  12959. }
  12960. catch(e) {if(e===$early)return e[0]; throw e}
  12961. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},smalltalk.Set)})},
  12962. args: ["aCollection"],
  12963. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  12964. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  12965. referencedClasses: []
  12966. }),
  12967. smalltalk.Set);
  12968. smalltalk.addMethod(
  12969. smalltalk.method({
  12970. selector: "add:",
  12971. category: 'adding/removing',
  12972. fn: function (anObject){
  12973. var self=this;
  12974. return smalltalk.withContext(function($ctx1) {
  12975. var found;
  12976. for(var i=0; i < self['@elements'].length; i++) {
  12977. if(_st(anObject).__eq(self['@elements'][i])) {
  12978. found = true;
  12979. break;
  12980. }
  12981. }
  12982. if(!found) {self['@elements'].push(anObject)}
  12983. ;
  12984. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.Set)})},
  12985. args: ["anObject"],
  12986. source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(_st(anObject).__eq(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>",
  12987. messageSends: [],
  12988. referencedClasses: []
  12989. }),
  12990. smalltalk.Set);
  12991. smalltalk.addMethod(
  12992. smalltalk.method({
  12993. selector: "asArray",
  12994. category: 'converting',
  12995. fn: function (){
  12996. var self=this;
  12997. return smalltalk.withContext(function($ctx1) {
  12998. var $1;
  12999. $1=_st(self["@elements"])._copy();
  13000. return $1;
  13001. }, function($ctx1) {$ctx1.fill(self,"asArray",{},smalltalk.Set)})},
  13002. args: [],
  13003. source: "asArray\x0a\x09^elements copy",
  13004. messageSends: ["copy"],
  13005. referencedClasses: []
  13006. }),
  13007. smalltalk.Set);
  13008. smalltalk.addMethod(
  13009. smalltalk.method({
  13010. selector: "collect:",
  13011. category: 'enumerating',
  13012. fn: function (aBlock){
  13013. var self=this;
  13014. return smalltalk.withContext(function($ctx1) {
  13015. var $1;
  13016. $1=_st(self._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  13017. return $1;
  13018. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Set)})},
  13019. args: ["aBlock"],
  13020. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  13021. messageSends: ["withAll:", "class", "collect:"],
  13022. referencedClasses: []
  13023. }),
  13024. smalltalk.Set);
  13025. smalltalk.addMethod(
  13026. smalltalk.method({
  13027. selector: "detect:ifNone:",
  13028. category: 'enumerating',
  13029. fn: function (aBlock,anotherBlock){
  13030. var self=this;
  13031. return smalltalk.withContext(function($ctx1) {
  13032. var $1;
  13033. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  13034. return $1;
  13035. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.Set)})},
  13036. args: ["aBlock", "anotherBlock"],
  13037. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  13038. messageSends: ["detect:ifNone:"],
  13039. referencedClasses: []
  13040. }),
  13041. smalltalk.Set);
  13042. smalltalk.addMethod(
  13043. smalltalk.method({
  13044. selector: "do:",
  13045. category: 'enumerating',
  13046. fn: function (aBlock){
  13047. var self=this;
  13048. return smalltalk.withContext(function($ctx1) {
  13049. _st(self["@elements"])._do_(aBlock);
  13050. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Set)})},
  13051. args: ["aBlock"],
  13052. source: "do: aBlock\x0a\x09elements do: aBlock",
  13053. messageSends: ["do:"],
  13054. referencedClasses: []
  13055. }),
  13056. smalltalk.Set);
  13057. smalltalk.addMethod(
  13058. smalltalk.method({
  13059. selector: "includes:",
  13060. category: 'testing',
  13061. fn: function (anObject){
  13062. var self=this;
  13063. return smalltalk.withContext(function($ctx1) {
  13064. var $1;
  13065. $1=_st(self["@elements"])._includes_(anObject);
  13066. return $1;
  13067. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},smalltalk.Set)})},
  13068. args: ["anObject"],
  13069. source: "includes: anObject\x0a\x09^elements includes: anObject",
  13070. messageSends: ["includes:"],
  13071. referencedClasses: []
  13072. }),
  13073. smalltalk.Set);
  13074. smalltalk.addMethod(
  13075. smalltalk.method({
  13076. selector: "initialize",
  13077. category: 'initialization',
  13078. fn: function (){
  13079. var self=this;
  13080. return smalltalk.withContext(function($ctx1) {
  13081. smalltalk.Set.superclass.fn.prototype._initialize.apply(_st(self), []);
  13082. self["@elements"]=[];
  13083. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Set)})},
  13084. args: [],
  13085. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  13086. messageSends: ["initialize"],
  13087. referencedClasses: []
  13088. }),
  13089. smalltalk.Set);
  13090. smalltalk.addMethod(
  13091. smalltalk.method({
  13092. selector: "printOn:",
  13093. category: 'printing',
  13094. fn: function (aStream){
  13095. var self=this;
  13096. return smalltalk.withContext(function($ctx1) {
  13097. smalltalk.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  13098. _st(aStream)._nextPutAll_(" (");
  13099. self._do_separatedBy_((function(each){
  13100. return smalltalk.withContext(function($ctx2) {
  13101. return _st(each)._printOn_(aStream);
  13102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  13103. return smalltalk.withContext(function($ctx2) {
  13104. return _st(aStream)._nextPutAll_(" ");
  13105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  13106. _st(aStream)._nextPutAll_(")");
  13107. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Set)})},
  13108. args: ["aStream"],
  13109. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  13110. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  13111. referencedClasses: []
  13112. }),
  13113. smalltalk.Set);
  13114. smalltalk.addMethod(
  13115. smalltalk.method({
  13116. selector: "remove:",
  13117. category: 'adding/removing',
  13118. fn: function (anObject){
  13119. var self=this;
  13120. return smalltalk.withContext(function($ctx1) {
  13121. _st(self["@elements"])._remove_(anObject);
  13122. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},smalltalk.Set)})},
  13123. args: ["anObject"],
  13124. source: "remove: anObject\x0a\x09elements remove: anObject",
  13125. messageSends: ["remove:"],
  13126. referencedClasses: []
  13127. }),
  13128. smalltalk.Set);
  13129. smalltalk.addMethod(
  13130. smalltalk.method({
  13131. selector: "remove:ifAbsent:",
  13132. category: 'adding/removing',
  13133. fn: function (anObject,aBlock){
  13134. var self=this;
  13135. return smalltalk.withContext(function($ctx1) {
  13136. _st(self["@elements"])._remove_ifAbsent_(anObject,aBlock);
  13137. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},smalltalk.Set)})},
  13138. args: ["anObject", "aBlock"],
  13139. source: "remove: anObject ifAbsent: aBlock\x0a\x09elements remove: anObject ifAbsent: aBlock",
  13140. messageSends: ["remove:ifAbsent:"],
  13141. referencedClasses: []
  13142. }),
  13143. smalltalk.Set);
  13144. smalltalk.addMethod(
  13145. smalltalk.method({
  13146. selector: "select:",
  13147. category: 'enumerating',
  13148. fn: function (aBlock){
  13149. var self=this;
  13150. var collection;
  13151. return smalltalk.withContext(function($ctx1) {
  13152. var $1,$2;
  13153. collection=_st(self._class())._new();
  13154. self._do_((function(each){
  13155. return smalltalk.withContext(function($ctx2) {
  13156. $1=_st(aBlock)._value_(each);
  13157. if(smalltalk.assert($1)){
  13158. return _st(collection)._add_(each);
  13159. };
  13160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  13161. $2=collection;
  13162. return $2;
  13163. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},smalltalk.Set)})},
  13164. args: ["aBlock"],
  13165. 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",
  13166. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  13167. referencedClasses: []
  13168. }),
  13169. smalltalk.Set);
  13170. smalltalk.addMethod(
  13171. smalltalk.method({
  13172. selector: "size",
  13173. category: 'accessing',
  13174. fn: function (){
  13175. var self=this;
  13176. return smalltalk.withContext(function($ctx1) {
  13177. var $1;
  13178. $1=_st(self["@elements"])._size();
  13179. return $1;
  13180. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Set)})},
  13181. args: [],
  13182. source: "size\x0a\x09^elements size",
  13183. messageSends: ["size"],
  13184. referencedClasses: []
  13185. }),
  13186. smalltalk.Set);
  13187. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  13188. smalltalk.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  13189. smalltalk.addMethod(
  13190. smalltalk.method({
  13191. selector: "initialize",
  13192. category: 'initialization',
  13193. fn: function (){
  13194. var self=this;
  13195. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  13196. return smalltalk.withContext(function($ctx1) {
  13197. smalltalk.Queue.superclass.fn.prototype._initialize.apply(_st(self), []);
  13198. self["@read"]=_st($OrderedCollection())._new();
  13199. self["@write"]=_st($OrderedCollection())._new();
  13200. self["@readIndex"]=(1);
  13201. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Queue)})},
  13202. args: [],
  13203. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13204. messageSends: ["initialize", "new"],
  13205. referencedClasses: ["OrderedCollection"]
  13206. }),
  13207. smalltalk.Queue);
  13208. smalltalk.addMethod(
  13209. smalltalk.method({
  13210. selector: "next",
  13211. category: 'accessing',
  13212. fn: function (){
  13213. var self=this;
  13214. return smalltalk.withContext(function($ctx1) {
  13215. var $1;
  13216. $1=self._nextIfAbsent_((function(){
  13217. return smalltalk.withContext(function($ctx2) {
  13218. return self._error_("Cannot read from empty Queue.");
  13219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13220. return $1;
  13221. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Queue)})},
  13222. args: [],
  13223. source: "next\x0a\x09^self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13224. messageSends: ["nextIfAbsent:", "error:"],
  13225. referencedClasses: []
  13226. }),
  13227. smalltalk.Queue);
  13228. smalltalk.addMethod(
  13229. smalltalk.method({
  13230. selector: "nextIfAbsent:",
  13231. category: 'accessing',
  13232. fn: function (aBlock){
  13233. var self=this;
  13234. var result;
  13235. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  13236. return smalltalk.withContext(function($ctx1) {
  13237. var $1,$2,$3,$4;
  13238. var $early={};
  13239. try {
  13240. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  13241. return smalltalk.withContext(function($ctx2) {
  13242. $1=_st(self["@write"])._isEmpty();
  13243. if(smalltalk.assert($1)){
  13244. $2=_st(self["@readIndex"]).__gt((1));
  13245. if(smalltalk.assert($2)){
  13246. self["@read"]=[];
  13247. self["@read"];
  13248. self["@readIndex"]=(1);
  13249. self["@readIndex"];
  13250. };
  13251. $3=_st(aBlock)._value();
  13252. throw $early=[$3];
  13253. };
  13254. self["@read"]=self["@write"];
  13255. self["@read"];
  13256. self["@readIndex"]=(1);
  13257. self["@readIndex"];
  13258. self["@write"]=_st($OrderedCollection())._new();
  13259. self["@write"];
  13260. return _st(self["@read"])._first();
  13261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13262. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  13263. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  13264. $4=result;
  13265. return $4;
  13266. }
  13267. catch(e) {if(e===$early)return e[0]; throw e}
  13268. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},smalltalk.Queue)})},
  13269. args: ["aBlock"],
  13270. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^result",
  13271. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"],
  13272. referencedClasses: ["OrderedCollection"]
  13273. }),
  13274. smalltalk.Queue);
  13275. smalltalk.addMethod(
  13276. smalltalk.method({
  13277. selector: "nextPut:",
  13278. category: 'accessing',
  13279. fn: function (anObject){
  13280. var self=this;
  13281. return smalltalk.withContext(function($ctx1) {
  13282. _st(self["@write"])._add_(anObject);
  13283. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Queue)})},
  13284. args: ["anObject"],
  13285. source: "nextPut: anObject\x0a\x09write add: anObject",
  13286. messageSends: ["add:"],
  13287. referencedClasses: []
  13288. }),
  13289. smalltalk.Queue);
  13290. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  13291. smalltalk.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13292. smalltalk.addMethod(
  13293. smalltalk.method({
  13294. selector: "compile:",
  13295. category: 'evaluating',
  13296. fn: function (aString){
  13297. var self=this;
  13298. return smalltalk.withContext(function($ctx1) {
  13299. return self.compile(aString);
  13300. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.RegularExpression)})},
  13301. args: ["aString"],
  13302. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  13303. messageSends: [],
  13304. referencedClasses: []
  13305. }),
  13306. smalltalk.RegularExpression);
  13307. smalltalk.addMethod(
  13308. smalltalk.method({
  13309. selector: "exec:",
  13310. category: 'evaluating',
  13311. fn: function (aString){
  13312. var self=this;
  13313. return smalltalk.withContext(function($ctx1) {
  13314. return self.exec(aString) || nil;
  13315. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},smalltalk.RegularExpression)})},
  13316. args: ["aString"],
  13317. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  13318. messageSends: [],
  13319. referencedClasses: []
  13320. }),
  13321. smalltalk.RegularExpression);
  13322. smalltalk.addMethod(
  13323. smalltalk.method({
  13324. selector: "test:",
  13325. category: 'evaluating',
  13326. fn: function (aString){
  13327. var self=this;
  13328. return smalltalk.withContext(function($ctx1) {
  13329. return self.test(aString);
  13330. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},smalltalk.RegularExpression)})},
  13331. args: ["aString"],
  13332. source: "test: aString\x0a\x09<return self.test(aString)>",
  13333. messageSends: [],
  13334. referencedClasses: []
  13335. }),
  13336. smalltalk.RegularExpression);
  13337. smalltalk.addMethod(
  13338. smalltalk.method({
  13339. selector: "fromString:",
  13340. category: 'instance creation',
  13341. fn: function (aString){
  13342. var self=this;
  13343. return smalltalk.withContext(function($ctx1) {
  13344. var $1;
  13345. $1=self._fromString_flag_(aString,"");
  13346. return $1;
  13347. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},smalltalk.RegularExpression.klass)})},
  13348. args: ["aString"],
  13349. source: "fromString: aString\x0a\x09\x09^self fromString: aString flag: ''",
  13350. messageSends: ["fromString:flag:"],
  13351. referencedClasses: []
  13352. }),
  13353. smalltalk.RegularExpression.klass);
  13354. smalltalk.addMethod(
  13355. smalltalk.method({
  13356. selector: "fromString:flag:",
  13357. category: 'instance creation',
  13358. fn: function (aString,anotherString){
  13359. var self=this;
  13360. return smalltalk.withContext(function($ctx1) {
  13361. return new RegExp(aString, anotherString);
  13362. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},smalltalk.RegularExpression.klass)})},
  13363. args: ["aString", "anotherString"],
  13364. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  13365. messageSends: [],
  13366. referencedClasses: []
  13367. }),
  13368. smalltalk.RegularExpression.klass);
  13369. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  13370. smalltalk.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  13371. smalltalk.addMethod(
  13372. smalltalk.method({
  13373. selector: "<<",
  13374. category: 'writing',
  13375. fn: function (anObject){
  13376. var self=this;
  13377. return smalltalk.withContext(function($ctx1) {
  13378. self._write_(anObject);
  13379. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},smalltalk.Stream)})},
  13380. args: ["anObject"],
  13381. source: "<< anObject\x0a\x09self write: anObject",
  13382. messageSends: ["write:"],
  13383. referencedClasses: []
  13384. }),
  13385. smalltalk.Stream);
  13386. smalltalk.addMethod(
  13387. smalltalk.method({
  13388. selector: "atEnd",
  13389. category: 'testing',
  13390. fn: function (){
  13391. var self=this;
  13392. return smalltalk.withContext(function($ctx1) {
  13393. var $1;
  13394. $1=_st(self._position()).__eq(self._size());
  13395. return $1;
  13396. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Stream)})},
  13397. args: [],
  13398. source: "atEnd\x0a\x09^self position = self size",
  13399. messageSends: ["=", "position", "size"],
  13400. referencedClasses: []
  13401. }),
  13402. smalltalk.Stream);
  13403. smalltalk.addMethod(
  13404. smalltalk.method({
  13405. selector: "atStart",
  13406. category: 'testing',
  13407. fn: function (){
  13408. var self=this;
  13409. return smalltalk.withContext(function($ctx1) {
  13410. var $1;
  13411. $1=_st(self._position()).__eq((0));
  13412. return $1;
  13413. }, function($ctx1) {$ctx1.fill(self,"atStart",{},smalltalk.Stream)})},
  13414. args: [],
  13415. source: "atStart\x0a\x09^self position = 0",
  13416. messageSends: ["=", "position"],
  13417. referencedClasses: []
  13418. }),
  13419. smalltalk.Stream);
  13420. smalltalk.addMethod(
  13421. smalltalk.method({
  13422. selector: "close",
  13423. category: 'actions',
  13424. fn: function (){
  13425. var self=this;
  13426. return smalltalk.withContext(function($ctx1) {
  13427. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Stream)})},
  13428. args: [],
  13429. source: "close",
  13430. messageSends: [],
  13431. referencedClasses: []
  13432. }),
  13433. smalltalk.Stream);
  13434. smalltalk.addMethod(
  13435. smalltalk.method({
  13436. selector: "collection",
  13437. category: 'accessing',
  13438. fn: function (){
  13439. var self=this;
  13440. return smalltalk.withContext(function($ctx1) {
  13441. var $1;
  13442. $1=self["@collection"];
  13443. return $1;
  13444. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.Stream)})},
  13445. args: [],
  13446. source: "collection\x0a\x09^collection",
  13447. messageSends: [],
  13448. referencedClasses: []
  13449. }),
  13450. smalltalk.Stream);
  13451. smalltalk.addMethod(
  13452. smalltalk.method({
  13453. selector: "contents",
  13454. category: 'accessing',
  13455. fn: function (){
  13456. var self=this;
  13457. return smalltalk.withContext(function($ctx1) {
  13458. var $1;
  13459. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  13460. return $1;
  13461. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.Stream)})},
  13462. args: [],
  13463. source: "contents\x0a\x09^self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13464. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  13465. referencedClasses: []
  13466. }),
  13467. smalltalk.Stream);
  13468. smalltalk.addMethod(
  13469. smalltalk.method({
  13470. selector: "do:",
  13471. category: 'enumerating',
  13472. fn: function (aBlock){
  13473. var self=this;
  13474. return smalltalk.withContext(function($ctx1) {
  13475. _st((function(){
  13476. return smalltalk.withContext(function($ctx2) {
  13477. return self._atEnd();
  13478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  13479. return smalltalk.withContext(function($ctx2) {
  13480. return _st(aBlock)._value_(self._next());
  13481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  13482. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},smalltalk.Stream)})},
  13483. args: ["aBlock"],
  13484. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  13485. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  13486. referencedClasses: []
  13487. }),
  13488. smalltalk.Stream);
  13489. smalltalk.addMethod(
  13490. smalltalk.method({
  13491. selector: "flush",
  13492. category: 'actions',
  13493. fn: function (){
  13494. var self=this;
  13495. return smalltalk.withContext(function($ctx1) {
  13496. return self}, function($ctx1) {$ctx1.fill(self,"flush",{},smalltalk.Stream)})},
  13497. args: [],
  13498. source: "flush",
  13499. messageSends: [],
  13500. referencedClasses: []
  13501. }),
  13502. smalltalk.Stream);
  13503. smalltalk.addMethod(
  13504. smalltalk.method({
  13505. selector: "isEmpty",
  13506. category: 'testing',
  13507. fn: function (){
  13508. var self=this;
  13509. return smalltalk.withContext(function($ctx1) {
  13510. var $1;
  13511. $1=_st(self._size()).__eq((0));
  13512. return $1;
  13513. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},smalltalk.Stream)})},
  13514. args: [],
  13515. source: "isEmpty\x0a\x09^self size = 0",
  13516. messageSends: ["=", "size"],
  13517. referencedClasses: []
  13518. }),
  13519. smalltalk.Stream);
  13520. smalltalk.addMethod(
  13521. smalltalk.method({
  13522. selector: "next",
  13523. category: 'reading',
  13524. fn: function (){
  13525. var self=this;
  13526. return smalltalk.withContext(function($ctx1) {
  13527. var $2,$1;
  13528. $2=self._atEnd();
  13529. if(smalltalk.assert($2)){
  13530. $1=nil;
  13531. } else {
  13532. self._position_(_st(self._position()).__plus((1)));
  13533. $1=_st(self["@collection"])._at_(self._position());
  13534. };
  13535. return $1;
  13536. }, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Stream)})},
  13537. args: [],
  13538. 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]",
  13539. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  13540. referencedClasses: []
  13541. }),
  13542. smalltalk.Stream);
  13543. smalltalk.addMethod(
  13544. smalltalk.method({
  13545. selector: "next:",
  13546. category: 'reading',
  13547. fn: function (anInteger){
  13548. var self=this;
  13549. var tempCollection;
  13550. return smalltalk.withContext(function($ctx1) {
  13551. var $1,$2;
  13552. tempCollection=_st(_st(self._collection())._class())._new();
  13553. _st(anInteger)._timesRepeat_((function(){
  13554. return smalltalk.withContext(function($ctx2) {
  13555. $1=self._atEnd();
  13556. if(! smalltalk.assert($1)){
  13557. return _st(tempCollection)._add_(self._next());
  13558. };
  13559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13560. $2=tempCollection;
  13561. return $2;
  13562. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.Stream)})},
  13563. args: ["anInteger"],
  13564. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  13565. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  13566. referencedClasses: []
  13567. }),
  13568. smalltalk.Stream);
  13569. smalltalk.addMethod(
  13570. smalltalk.method({
  13571. selector: "nextPut:",
  13572. category: 'writing',
  13573. fn: function (anObject){
  13574. var self=this;
  13575. return smalltalk.withContext(function($ctx1) {
  13576. self._position_(_st(self._position()).__plus((1)));
  13577. _st(self._collection())._at_put_(self._position(),anObject);
  13578. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  13579. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},smalltalk.Stream)})},
  13580. args: ["anObject"],
  13581. 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)",
  13582. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  13583. referencedClasses: []
  13584. }),
  13585. smalltalk.Stream);
  13586. smalltalk.addMethod(
  13587. smalltalk.method({
  13588. selector: "nextPutAll:",
  13589. category: 'writing',
  13590. fn: function (aCollection){
  13591. var self=this;
  13592. return smalltalk.withContext(function($ctx1) {
  13593. _st(aCollection)._do_((function(each){
  13594. return smalltalk.withContext(function($ctx2) {
  13595. return self._nextPut_(each);
  13596. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  13597. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},smalltalk.Stream)})},
  13598. args: ["aCollection"],
  13599. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09\x09self nextPut: each]",
  13600. messageSends: ["do:", "nextPut:"],
  13601. referencedClasses: []
  13602. }),
  13603. smalltalk.Stream);
  13604. smalltalk.addMethod(
  13605. smalltalk.method({
  13606. selector: "nextPutString:",
  13607. category: 'writing',
  13608. fn: function (aString){
  13609. var self=this;
  13610. return smalltalk.withContext(function($ctx1) {
  13611. self._nextPut_(aString);
  13612. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.Stream)})},
  13613. args: ["aString"],
  13614. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13615. messageSends: ["nextPut:"],
  13616. referencedClasses: []
  13617. }),
  13618. smalltalk.Stream);
  13619. smalltalk.addMethod(
  13620. smalltalk.method({
  13621. selector: "peek",
  13622. category: 'reading',
  13623. fn: function (){
  13624. var self=this;
  13625. return smalltalk.withContext(function($ctx1) {
  13626. var $2,$1;
  13627. $2=self._atEnd();
  13628. if(! smalltalk.assert($2)){
  13629. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  13630. };
  13631. return $1;
  13632. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Stream)})},
  13633. args: [],
  13634. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1]",
  13635. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  13636. referencedClasses: []
  13637. }),
  13638. smalltalk.Stream);
  13639. smalltalk.addMethod(
  13640. smalltalk.method({
  13641. selector: "position",
  13642. category: 'accessing',
  13643. fn: function (){
  13644. var self=this;
  13645. return smalltalk.withContext(function($ctx1) {
  13646. var $2,$1;
  13647. $2=self["@position"];
  13648. if(($receiver = $2) == nil || $receiver == null){
  13649. self["@position"]=(0);
  13650. $1=self["@position"];
  13651. } else {
  13652. $1=$2;
  13653. };
  13654. return $1;
  13655. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Stream)})},
  13656. args: [],
  13657. source: "position\x0a\x09^position ifNil: [position := 0]",
  13658. messageSends: ["ifNil:"],
  13659. referencedClasses: []
  13660. }),
  13661. smalltalk.Stream);
  13662. smalltalk.addMethod(
  13663. smalltalk.method({
  13664. selector: "position:",
  13665. category: 'accessing',
  13666. fn: function (anInteger){
  13667. var self=this;
  13668. return smalltalk.withContext(function($ctx1) {
  13669. self["@position"]=anInteger;
  13670. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger},smalltalk.Stream)})},
  13671. args: ["anInteger"],
  13672. source: "position: anInteger\x0a\x09position := anInteger",
  13673. messageSends: [],
  13674. referencedClasses: []
  13675. }),
  13676. smalltalk.Stream);
  13677. smalltalk.addMethod(
  13678. smalltalk.method({
  13679. selector: "reset",
  13680. category: 'actions',
  13681. fn: function (){
  13682. var self=this;
  13683. return smalltalk.withContext(function($ctx1) {
  13684. self._position_((0));
  13685. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},smalltalk.Stream)})},
  13686. args: [],
  13687. source: "reset\x0a\x09self position: 0",
  13688. messageSends: ["position:"],
  13689. referencedClasses: []
  13690. }),
  13691. smalltalk.Stream);
  13692. smalltalk.addMethod(
  13693. smalltalk.method({
  13694. selector: "resetContents",
  13695. category: 'actions',
  13696. fn: function (){
  13697. var self=this;
  13698. return smalltalk.withContext(function($ctx1) {
  13699. self._reset();
  13700. self._setStreamSize_((0));
  13701. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},smalltalk.Stream)})},
  13702. args: [],
  13703. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13704. messageSends: ["reset", "setStreamSize:"],
  13705. referencedClasses: []
  13706. }),
  13707. smalltalk.Stream);
  13708. smalltalk.addMethod(
  13709. smalltalk.method({
  13710. selector: "setCollection:",
  13711. category: 'accessing',
  13712. fn: function (aCollection){
  13713. var self=this;
  13714. return smalltalk.withContext(function($ctx1) {
  13715. self["@collection"]=aCollection;
  13716. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection},smalltalk.Stream)})},
  13717. args: ["aCollection"],
  13718. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13719. messageSends: [],
  13720. referencedClasses: []
  13721. }),
  13722. smalltalk.Stream);
  13723. smalltalk.addMethod(
  13724. smalltalk.method({
  13725. selector: "setStreamSize:",
  13726. category: 'accessing',
  13727. fn: function (anInteger){
  13728. var self=this;
  13729. return smalltalk.withContext(function($ctx1) {
  13730. self["@streamSize"]=anInteger;
  13731. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger},smalltalk.Stream)})},
  13732. args: ["anInteger"],
  13733. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13734. messageSends: [],
  13735. referencedClasses: []
  13736. }),
  13737. smalltalk.Stream);
  13738. smalltalk.addMethod(
  13739. smalltalk.method({
  13740. selector: "setToEnd",
  13741. category: 'positioning',
  13742. fn: function (){
  13743. var self=this;
  13744. return smalltalk.withContext(function($ctx1) {
  13745. self._position_(self._size());
  13746. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},smalltalk.Stream)})},
  13747. args: [],
  13748. source: "setToEnd\x0a\x09self position: self size",
  13749. messageSends: ["position:", "size"],
  13750. referencedClasses: []
  13751. }),
  13752. smalltalk.Stream);
  13753. smalltalk.addMethod(
  13754. smalltalk.method({
  13755. selector: "size",
  13756. category: 'accessing',
  13757. fn: function (){
  13758. var self=this;
  13759. return smalltalk.withContext(function($ctx1) {
  13760. var $1;
  13761. $1=self._streamSize();
  13762. return $1;
  13763. }, function($ctx1) {$ctx1.fill(self,"size",{},smalltalk.Stream)})},
  13764. args: [],
  13765. source: "size\x0a\x09^self streamSize",
  13766. messageSends: ["streamSize"],
  13767. referencedClasses: []
  13768. }),
  13769. smalltalk.Stream);
  13770. smalltalk.addMethod(
  13771. smalltalk.method({
  13772. selector: "skip:",
  13773. category: 'positioning',
  13774. fn: function (anInteger){
  13775. var self=this;
  13776. return smalltalk.withContext(function($ctx1) {
  13777. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  13778. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},smalltalk.Stream)})},
  13779. args: ["anInteger"],
  13780. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13781. messageSends: ["position:", "min:max:", "+", "position", "size"],
  13782. referencedClasses: []
  13783. }),
  13784. smalltalk.Stream);
  13785. smalltalk.addMethod(
  13786. smalltalk.method({
  13787. selector: "streamSize",
  13788. category: 'accessing',
  13789. fn: function (){
  13790. var self=this;
  13791. return smalltalk.withContext(function($ctx1) {
  13792. var $1;
  13793. $1=self["@streamSize"];
  13794. return $1;
  13795. }, function($ctx1) {$ctx1.fill(self,"streamSize",{},smalltalk.Stream)})},
  13796. args: [],
  13797. source: "streamSize\x0a\x09^streamSize",
  13798. messageSends: [],
  13799. referencedClasses: []
  13800. }),
  13801. smalltalk.Stream);
  13802. smalltalk.addMethod(
  13803. smalltalk.method({
  13804. selector: "write:",
  13805. category: 'writing',
  13806. fn: function (anObject){
  13807. var self=this;
  13808. return smalltalk.withContext(function($ctx1) {
  13809. _st(anObject)._putOn_(self);
  13810. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},smalltalk.Stream)})},
  13811. args: ["anObject"],
  13812. source: "write: anObject\x0a\x09anObject putOn: self",
  13813. messageSends: ["putOn:"],
  13814. referencedClasses: []
  13815. }),
  13816. smalltalk.Stream);
  13817. smalltalk.addMethod(
  13818. smalltalk.method({
  13819. selector: "on:",
  13820. category: 'instance creation',
  13821. fn: function (aCollection){
  13822. var self=this;
  13823. return smalltalk.withContext(function($ctx1) {
  13824. var $2,$3,$1;
  13825. $2=self._new();
  13826. _st($2)._setCollection_(aCollection);
  13827. _st($2)._setStreamSize_(_st(aCollection)._size());
  13828. $3=_st($2)._yourself();
  13829. $1=$3;
  13830. return $1;
  13831. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},smalltalk.Stream.klass)})},
  13832. args: ["aCollection"],
  13833. source: "on: aCollection\x0a\x09\x09^self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13834. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  13835. referencedClasses: []
  13836. }),
  13837. smalltalk.Stream.klass);
  13838. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  13839. smalltalk.StringStream.comment="I am a Stream specific to `String` objects.";
  13840. smalltalk.addMethod(
  13841. smalltalk.method({
  13842. selector: "cr",
  13843. category: 'writing',
  13844. fn: function (){
  13845. var self=this;
  13846. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13847. return smalltalk.withContext(function($ctx1) {
  13848. var $1;
  13849. $1=self._nextPutAll_(_st($String())._cr());
  13850. return $1;
  13851. }, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.StringStream)})},
  13852. args: [],
  13853. source: "cr\x0a\x09^self nextPutAll: String cr",
  13854. messageSends: ["nextPutAll:", "cr"],
  13855. referencedClasses: ["String"]
  13856. }),
  13857. smalltalk.StringStream);
  13858. smalltalk.addMethod(
  13859. smalltalk.method({
  13860. selector: "crlf",
  13861. category: 'writing',
  13862. fn: function (){
  13863. var self=this;
  13864. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13865. return smalltalk.withContext(function($ctx1) {
  13866. var $1;
  13867. $1=self._nextPutAll_(_st($String())._crlf());
  13868. return $1;
  13869. }, function($ctx1) {$ctx1.fill(self,"crlf",{},smalltalk.StringStream)})},
  13870. args: [],
  13871. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  13872. messageSends: ["nextPutAll:", "crlf"],
  13873. referencedClasses: ["String"]
  13874. }),
  13875. smalltalk.StringStream);
  13876. smalltalk.addMethod(
  13877. smalltalk.method({
  13878. selector: "lf",
  13879. category: 'writing',
  13880. fn: function (){
  13881. var self=this;
  13882. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  13883. return smalltalk.withContext(function($ctx1) {
  13884. var $1;
  13885. $1=self._nextPutAll_(_st($String())._lf());
  13886. return $1;
  13887. }, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.StringStream)})},
  13888. args: [],
  13889. source: "lf\x0a\x09^self nextPutAll: String lf",
  13890. messageSends: ["nextPutAll:", "lf"],
  13891. referencedClasses: ["String"]
  13892. }),
  13893. smalltalk.StringStream);
  13894. smalltalk.addMethod(
  13895. smalltalk.method({
  13896. selector: "next:",
  13897. category: 'reading',
  13898. fn: function (anInteger){
  13899. var self=this;
  13900. var tempCollection;
  13901. return smalltalk.withContext(function($ctx1) {
  13902. var $1,$2;
  13903. tempCollection=_st(_st(self._collection())._class())._new();
  13904. _st(anInteger)._timesRepeat_((function(){
  13905. return smalltalk.withContext(function($ctx2) {
  13906. $1=self._atEnd();
  13907. if(! smalltalk.assert($1)){
  13908. tempCollection=_st(tempCollection).__comma(self._next());
  13909. return tempCollection;
  13910. };
  13911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13912. $2=tempCollection;
  13913. return $2;
  13914. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},smalltalk.StringStream)})},
  13915. args: ["anInteger"],
  13916. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  13917. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  13918. referencedClasses: []
  13919. }),
  13920. smalltalk.StringStream);
  13921. smalltalk.addMethod(
  13922. smalltalk.method({
  13923. selector: "nextPut:",
  13924. category: 'writing',
  13925. fn: function (aString){
  13926. var self=this;
  13927. return smalltalk.withContext(function($ctx1) {
  13928. self._nextPutAll_(aString);
  13929. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.StringStream)})},
  13930. args: ["aString"],
  13931. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13932. messageSends: ["nextPutAll:"],
  13933. referencedClasses: []
  13934. }),
  13935. smalltalk.StringStream);
  13936. smalltalk.addMethod(
  13937. smalltalk.method({
  13938. selector: "nextPutAll:",
  13939. category: 'writing',
  13940. fn: function (aString){
  13941. var self=this;
  13942. var pre,post;
  13943. return smalltalk.withContext(function($ctx1) {
  13944. var $1;
  13945. $1=self._atEnd();
  13946. if(smalltalk.assert($1)){
  13947. self._setCollection_(_st(self._collection()).__comma(aString));
  13948. } else {
  13949. pre=_st(self._collection())._copyFrom_to_((1),self._position());
  13950. pre;
  13951. post=_st(self._collection())._copyFrom_to_(_st(_st(self._position()).__plus((1))).__plus(_st(aString)._size()),_st(self._collection())._size());
  13952. post;
  13953. self._setCollection_(_st(_st(pre).__comma(aString)).__comma(post));
  13954. };
  13955. self._position_(_st(self._position()).__plus(_st(aString)._size()));
  13956. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  13957. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},smalltalk.StringStream)})},
  13958. args: ["aString"],
  13959. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13960. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  13961. referencedClasses: []
  13962. }),
  13963. smalltalk.StringStream);
  13964. smalltalk.addMethod(
  13965. smalltalk.method({
  13966. selector: "nextPutString:",
  13967. category: 'writing',
  13968. fn: function (aString){
  13969. var self=this;
  13970. return smalltalk.withContext(function($ctx1) {
  13971. self._nextPutAll_(aString);
  13972. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},smalltalk.StringStream)})},
  13973. args: ["aString"],
  13974. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13975. messageSends: ["nextPutAll:"],
  13976. referencedClasses: []
  13977. }),
  13978. smalltalk.StringStream);
  13979. smalltalk.addMethod(
  13980. smalltalk.method({
  13981. selector: "space",
  13982. category: 'writing',
  13983. fn: function (){
  13984. var self=this;
  13985. return smalltalk.withContext(function($ctx1) {
  13986. self._nextPut_(" ");
  13987. return self}, function($ctx1) {$ctx1.fill(self,"space",{},smalltalk.StringStream)})},
  13988. args: [],
  13989. source: "space\x0a\x09self nextPut: ' '",
  13990. messageSends: ["nextPut:"],
  13991. referencedClasses: []
  13992. }),
  13993. smalltalk.StringStream);
  13994. smalltalk.addMethod(
  13995. smalltalk.method({
  13996. selector: "tab",
  13997. category: 'writing',
  13998. fn: function (){
  13999. var self=this;
  14000. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  14001. return smalltalk.withContext(function($ctx1) {
  14002. var $1;
  14003. $1=self._nextPutAll_(_st($String())._tab());
  14004. return $1;
  14005. }, function($ctx1) {$ctx1.fill(self,"tab",{},smalltalk.StringStream)})},
  14006. args: [],
  14007. source: "tab\x0a\x09^self nextPutAll: String tab",
  14008. messageSends: ["nextPutAll:", "tab"],
  14009. referencedClasses: ["String"]
  14010. }),
  14011. smalltalk.StringStream);
  14012. });
  14013. define("amber_core/Kernel-Infrastructure", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  14014. smalltalk.addPackage('Kernel-Infrastructure');
  14015. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14016. smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
  14017. smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
  14018. smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
  14019. smalltalk.addMethod(
  14020. smalltalk.method({
  14021. selector: "inspect:",
  14022. category: 'registration',
  14023. fn: function (anObject){
  14024. var self=this;
  14025. return smalltalk.withContext(function($ctx1) {
  14026. var $1;
  14027. $1=_st(self._inspector())._inspect_(anObject);
  14028. return $1;
  14029. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.InspectorHandler.klass)})},
  14030. args: ["anObject"],
  14031. source: "inspect: anObject\x0a\x09^ self inspector inspect: anObject",
  14032. messageSends: ["inspect:", "inspector"],
  14033. referencedClasses: []
  14034. }),
  14035. smalltalk.InspectorHandler.klass);
  14036. smalltalk.addMethod(
  14037. smalltalk.method({
  14038. selector: "inspector",
  14039. category: 'accessing',
  14040. fn: function (){
  14041. var self=this;
  14042. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  14043. return smalltalk.withContext(function($ctx1) {
  14044. var $2,$1;
  14045. $2=self["@inspector"];
  14046. if(($receiver = $2) == nil || $receiver == null){
  14047. self["@inspector"]=$Transcript();
  14048. $1=self["@inspector"];
  14049. } else {
  14050. $1=$2;
  14051. };
  14052. return $1;
  14053. }, function($ctx1) {$ctx1.fill(self,"inspector",{},smalltalk.InspectorHandler.klass)})},
  14054. args: [],
  14055. source: "inspector\x0a\x09^ inspector ifNil: [ inspector := Transcript ]",
  14056. messageSends: ["ifNil:"],
  14057. referencedClasses: ["Transcript"]
  14058. }),
  14059. smalltalk.InspectorHandler.klass);
  14060. smalltalk.addMethod(
  14061. smalltalk.method({
  14062. selector: "register:",
  14063. category: 'registration',
  14064. fn: function (anInspector){
  14065. var self=this;
  14066. return smalltalk.withContext(function($ctx1) {
  14067. self["@inspector"]=anInspector;
  14068. return self}, function($ctx1) {$ctx1.fill(self,"register:",{anInspector:anInspector},smalltalk.InspectorHandler.klass)})},
  14069. args: ["anInspector"],
  14070. source: "register: anInspector\x0a\x09inspector := anInspector",
  14071. messageSends: [],
  14072. referencedClasses: []
  14073. }),
  14074. smalltalk.InspectorHandler.klass);
  14075. smalltalk.addClass('InterfacingObject', smalltalk.Object, [], 'Kernel-Infrastructure');
  14076. smalltalk.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  14077. smalltalk.addMethod(
  14078. smalltalk.method({
  14079. selector: "ajax:",
  14080. category: 'actions',
  14081. fn: function (anObject){
  14082. var self=this;
  14083. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  14084. return smalltalk.withContext(function($ctx1) {
  14085. var $1;
  14086. $1=_st($PlatformInterface())._ajax_(anObject);
  14087. return $1;
  14088. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.InterfacingObject)})},
  14089. args: ["anObject"],
  14090. source: "ajax: anObject\x0a\x09^PlatformInterface ajax: anObject",
  14091. messageSends: ["ajax:"],
  14092. referencedClasses: ["PlatformInterface"]
  14093. }),
  14094. smalltalk.InterfacingObject);
  14095. smalltalk.addMethod(
  14096. smalltalk.method({
  14097. selector: "alert:",
  14098. category: 'actions',
  14099. fn: function (aString){
  14100. var self=this;
  14101. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  14102. return smalltalk.withContext(function($ctx1) {
  14103. var $1;
  14104. $1=_st($PlatformInterface())._alert_(aString);
  14105. return $1;
  14106. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.InterfacingObject)})},
  14107. args: ["aString"],
  14108. source: "alert: aString\x0a\x09^PlatformInterface alert: aString",
  14109. messageSends: ["alert:"],
  14110. referencedClasses: ["PlatformInterface"]
  14111. }),
  14112. smalltalk.InterfacingObject);
  14113. smalltalk.addMethod(
  14114. smalltalk.method({
  14115. selector: "confirm:",
  14116. category: 'actions',
  14117. fn: function (aString){
  14118. var self=this;
  14119. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  14120. return smalltalk.withContext(function($ctx1) {
  14121. var $1;
  14122. $1=_st($PlatformInterface())._confirm_(aString);
  14123. return $1;
  14124. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.InterfacingObject)})},
  14125. args: ["aString"],
  14126. source: "confirm: aString\x0a\x09^PlatformInterface confirm: aString",
  14127. messageSends: ["confirm:"],
  14128. referencedClasses: ["PlatformInterface"]
  14129. }),
  14130. smalltalk.InterfacingObject);
  14131. smalltalk.addMethod(
  14132. smalltalk.method({
  14133. selector: "prompt:",
  14134. category: 'actions',
  14135. fn: function (aString){
  14136. var self=this;
  14137. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  14138. return smalltalk.withContext(function($ctx1) {
  14139. var $1;
  14140. $1=_st($PlatformInterface())._prompt_(aString);
  14141. return $1;
  14142. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.InterfacingObject)})},
  14143. args: ["aString"],
  14144. source: "prompt: aString\x0a\x09^PlatformInterface prompt: aString",
  14145. messageSends: ["prompt:"],
  14146. referencedClasses: ["PlatformInterface"]
  14147. }),
  14148. smalltalk.InterfacingObject);
  14149. smalltalk.addClass('Environment', smalltalk.InterfacingObject, [], 'Kernel-Infrastructure');
  14150. smalltalk.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  14151. smalltalk.addMethod(
  14152. smalltalk.method({
  14153. selector: "addInstVarNamed:to:",
  14154. category: 'compiling',
  14155. fn: function (aString,aClass){
  14156. var self=this;
  14157. return smalltalk.withContext(function($ctx1) {
  14158. var $1,$2;
  14159. $1=_st(_st(aClass)._instanceVariableNames())._copy();
  14160. _st($1)._add_(aString);
  14161. $2=_st($1)._yourself();
  14162. _st(self._classBuilder())._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),_st(aClass)._name(),$2,_st(_st(aClass)._package())._name());
  14163. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  14164. args: ["aString", "aClass"],
  14165. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  14166. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
  14167. referencedClasses: []
  14168. }),
  14169. smalltalk.Environment);
  14170. smalltalk.addMethod(
  14171. smalltalk.method({
  14172. selector: "allSelectors",
  14173. category: 'accessing',
  14174. fn: function (){
  14175. var self=this;
  14176. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14177. return smalltalk.withContext(function($ctx1) {
  14178. var $1;
  14179. $1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
  14180. return $1;
  14181. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
  14182. args: [],
  14183. source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
  14184. messageSends: ["value", "at:", "current"],
  14185. referencedClasses: ["Smalltalk"]
  14186. }),
  14187. smalltalk.Environment);
  14188. smalltalk.addMethod(
  14189. smalltalk.method({
  14190. selector: "availableClassNames",
  14191. category: 'accessing',
  14192. fn: function (){
  14193. var self=this;
  14194. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14195. return smalltalk.withContext(function($ctx1) {
  14196. var $1;
  14197. $1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  14198. return smalltalk.withContext(function($ctx2) {
  14199. return _st(each)._name();
  14200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14201. return $1;
  14202. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
  14203. args: [],
  14204. source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
  14205. messageSends: ["collect:", "classes", "current", "name"],
  14206. referencedClasses: ["Smalltalk"]
  14207. }),
  14208. smalltalk.Environment);
  14209. smalltalk.addMethod(
  14210. smalltalk.method({
  14211. selector: "availablePackageNames",
  14212. category: 'accessing',
  14213. fn: function (){
  14214. var self=this;
  14215. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14216. return smalltalk.withContext(function($ctx1) {
  14217. var $1;
  14218. $1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
  14219. return smalltalk.withContext(function($ctx2) {
  14220. return _st(each)._name();
  14221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14222. return $1;
  14223. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
  14224. args: [],
  14225. source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
  14226. messageSends: ["collect:", "packages", "current", "name"],
  14227. referencedClasses: ["Smalltalk"]
  14228. }),
  14229. smalltalk.Environment);
  14230. smalltalk.addMethod(
  14231. smalltalk.method({
  14232. selector: "availableProtocolsFor:",
  14233. category: 'accessing',
  14234. fn: function (aClass){
  14235. var self=this;
  14236. var protocols;
  14237. return smalltalk.withContext(function($ctx1) {
  14238. var $1,$2;
  14239. protocols=_st(aClass)._protocols();
  14240. $1=_st(aClass)._superclass();
  14241. if(($receiver = $1) == nil || $receiver == null){
  14242. $1;
  14243. } else {
  14244. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  14245. };
  14246. $2=_st(_st(protocols)._asSet())._asArray();
  14247. return $2;
  14248. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
  14249. args: ["aClass"],
  14250. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray",
  14251. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "asArray", "asSet"],
  14252. referencedClasses: []
  14253. }),
  14254. smalltalk.Environment);
  14255. smalltalk.addMethod(
  14256. smalltalk.method({
  14257. selector: "classBuilder",
  14258. category: 'accessing',
  14259. fn: function (){
  14260. var self=this;
  14261. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  14262. return smalltalk.withContext(function($ctx1) {
  14263. var $1;
  14264. $1=_st($ClassBuilder())._new();
  14265. return $1;
  14266. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},smalltalk.Environment)})},
  14267. args: [],
  14268. source: "classBuilder\x0a\x09^ ClassBuilder new",
  14269. messageSends: ["new"],
  14270. referencedClasses: ["ClassBuilder"]
  14271. }),
  14272. smalltalk.Environment);
  14273. smalltalk.addMethod(
  14274. smalltalk.method({
  14275. selector: "classNamed:",
  14276. category: 'accessing',
  14277. fn: function (aString){
  14278. var self=this;
  14279. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14280. return smalltalk.withContext(function($ctx1) {
  14281. var $2,$1;
  14282. $2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
  14283. if(($receiver = $2) == nil || $receiver == null){
  14284. $1=self._error_("Invalid class name");
  14285. } else {
  14286. $1=$2;
  14287. };
  14288. return $1;
  14289. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
  14290. args: ["aString"],
  14291. source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  14292. messageSends: ["ifNil:", "at:", "current", "asSymbol", "error:"],
  14293. referencedClasses: ["Smalltalk"]
  14294. }),
  14295. smalltalk.Environment);
  14296. smalltalk.addMethod(
  14297. smalltalk.method({
  14298. selector: "classes",
  14299. category: 'accessing',
  14300. fn: function (){
  14301. var self=this;
  14302. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14303. return smalltalk.withContext(function($ctx1) {
  14304. var $1;
  14305. $1=_st(_st($Smalltalk())._current())._classes();
  14306. return $1;
  14307. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
  14308. args: [],
  14309. source: "classes\x0a\x09^ Smalltalk current classes",
  14310. messageSends: ["classes", "current"],
  14311. referencedClasses: ["Smalltalk"]
  14312. }),
  14313. smalltalk.Environment);
  14314. smalltalk.addMethod(
  14315. smalltalk.method({
  14316. selector: "commitPackage:",
  14317. category: 'actions',
  14318. fn: function (aPackage){
  14319. var self=this;
  14320. return smalltalk.withContext(function($ctx1) {
  14321. _st(aPackage)._commit();
  14322. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:",{aPackage:aPackage},smalltalk.Environment)})},
  14323. args: ["aPackage"],
  14324. source: "commitPackage: aPackage\x0a\x09aPackage commit",
  14325. messageSends: ["commit"],
  14326. referencedClasses: []
  14327. }),
  14328. smalltalk.Environment);
  14329. smalltalk.addMethod(
  14330. smalltalk.method({
  14331. selector: "compileClassComment:for:",
  14332. category: 'compiling',
  14333. fn: function (aString,aClass){
  14334. var self=this;
  14335. return smalltalk.withContext(function($ctx1) {
  14336. _st(aClass)._comment_(aString);
  14337. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  14338. args: ["aString", "aClass"],
  14339. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  14340. messageSends: ["comment:"],
  14341. referencedClasses: []
  14342. }),
  14343. smalltalk.Environment);
  14344. smalltalk.addMethod(
  14345. smalltalk.method({
  14346. selector: "compileClassDefinition:",
  14347. category: 'compiling',
  14348. fn: function (aString){
  14349. var self=this;
  14350. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  14351. return smalltalk.withContext(function($ctx1) {
  14352. self._eval_on_(aString,_st($DoIt())._new());
  14353. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},smalltalk.Environment)})},
  14354. args: ["aString"],
  14355. source: "compileClassDefinition: aString\x0a\x09self eval: aString on: DoIt new",
  14356. messageSends: ["eval:on:", "new"],
  14357. referencedClasses: ["DoIt"]
  14358. }),
  14359. smalltalk.Environment);
  14360. smalltalk.addMethod(
  14361. smalltalk.method({
  14362. selector: "compileMethod:for:protocol:",
  14363. category: 'compiling',
  14364. fn: function (sourceCode,class_,protocol){
  14365. var self=this;
  14366. return smalltalk.withContext(function($ctx1) {
  14367. var $1;
  14368. $1=_st(class_)._compile_category_(sourceCode,protocol);
  14369. return $1;
  14370. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},smalltalk.Environment)})},
  14371. args: ["sourceCode", "class", "protocol"],
  14372. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09category: protocol",
  14373. messageSends: ["compile:category:"],
  14374. referencedClasses: []
  14375. }),
  14376. smalltalk.Environment);
  14377. smalltalk.addMethod(
  14378. smalltalk.method({
  14379. selector: "copyClass:to:",
  14380. category: 'actions',
  14381. fn: function (aClass,aClassName){
  14382. var self=this;
  14383. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14384. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  14385. return smalltalk.withContext(function($ctx1) {
  14386. var $1;
  14387. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  14388. if(($receiver = $1) == nil || $receiver == null){
  14389. $1;
  14390. } else {
  14391. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  14392. };
  14393. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  14394. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  14395. args: ["aClass", "aClassName"],
  14396. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  14397. messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "copyClass:named:", "new"],
  14398. referencedClasses: ["Smalltalk", "ClassBuilder"]
  14399. }),
  14400. smalltalk.Environment);
  14401. smalltalk.addMethod(
  14402. smalltalk.method({
  14403. selector: "eval:on:",
  14404. category: 'actions',
  14405. fn: function (aString,aReceiver){
  14406. var self=this;
  14407. var compiler;
  14408. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  14409. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  14410. return smalltalk.withContext(function($ctx1) {
  14411. var $1,$2;
  14412. var $early={};
  14413. try {
  14414. compiler=_st($Compiler())._new();
  14415. _st((function(){
  14416. return smalltalk.withContext(function($ctx2) {
  14417. return _st(compiler)._parseExpression_(aString);
  14418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  14419. return smalltalk.withContext(function($ctx2) {
  14420. $1=self._alert_(_st(ex)._messageText());
  14421. throw $early=[$1];
  14422. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  14423. $2=_st(compiler)._evaluateExpression_on_(aString,aReceiver);
  14424. return $2;
  14425. }
  14426. catch(e) {if(e===$early)return e[0]; throw e}
  14427. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{aString:aString,aReceiver:aReceiver,compiler:compiler},smalltalk.Environment)})},
  14428. args: ["aString", "aReceiver"],
  14429. source: "eval: aString on: aReceiver\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] on: Error do: [ :ex |\x0a\x09\x09^ self alert: ex messageText ].\x0a\x09^ compiler evaluateExpression: aString on: aReceiver",
  14430. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
  14431. referencedClasses: ["Compiler", "Error"]
  14432. }),
  14433. smalltalk.Environment);
  14434. smalltalk.addMethod(
  14435. smalltalk.method({
  14436. selector: "evaluate:on:do:",
  14437. category: 'error handling',
  14438. fn: function (aBlock,anErrorClass,exceptionBlock){
  14439. var self=this;
  14440. return smalltalk.withContext(function($ctx1) {
  14441. var $1;
  14442. self._try_catch_(aBlock,(function(exception){
  14443. return smalltalk.withContext(function($ctx2) {
  14444. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  14445. if(smalltalk.assert($1)){
  14446. return _st(exceptionBlock)._value_(exception);
  14447. } else {
  14448. return _st(exception)._signal();
  14449. };
  14450. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
  14451. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},smalltalk.Environment)})},
  14452. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  14453. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09self try: aBlock catch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  14454. messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
  14455. referencedClasses: []
  14456. }),
  14457. smalltalk.Environment);
  14458. smalltalk.addMethod(
  14459. smalltalk.method({
  14460. selector: "inspect:",
  14461. category: 'actions',
  14462. fn: function (anObject){
  14463. var self=this;
  14464. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  14465. return smalltalk.withContext(function($ctx1) {
  14466. _st(_st($InspectorHandler())._inspector())._inspect_(anObject);
  14467. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Environment)})},
  14468. args: ["anObject"],
  14469. source: "inspect: anObject\x0a\x09InspectorHandler inspector inspect: anObject",
  14470. messageSends: ["inspect:", "inspector"],
  14471. referencedClasses: ["InspectorHandler"]
  14472. }),
  14473. smalltalk.Environment);
  14474. smalltalk.addMethod(
  14475. smalltalk.method({
  14476. selector: "moveClass:toPackage:",
  14477. category: 'actions',
  14478. fn: function (aClass,aPackageName){
  14479. var self=this;
  14480. var package_;
  14481. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  14482. return smalltalk.withContext(function($ctx1) {
  14483. var $1,$2,$3;
  14484. package_=_st($Package())._named_(aPackageName);
  14485. $1=package_;
  14486. if(($receiver = $1) == nil || $receiver == null){
  14487. self._error_("Invalid package name");
  14488. } else {
  14489. $1;
  14490. };
  14491. $2=_st(package_).__eq_eq(_st(aClass)._package());
  14492. if(smalltalk.assert($2)){
  14493. $3=self;
  14494. return $3;
  14495. };
  14496. _st(aClass)._package_(package_);
  14497. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},smalltalk.Environment)})},
  14498. args: ["aClass", "aPackageName"],
  14499. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  14500. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  14501. referencedClasses: ["Package"]
  14502. }),
  14503. smalltalk.Environment);
  14504. smalltalk.addMethod(
  14505. smalltalk.method({
  14506. selector: "moveMethod:toClass:",
  14507. category: 'actions',
  14508. fn: function (aMethod,aClassName){
  14509. var self=this;
  14510. var destinationClass;
  14511. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14512. return smalltalk.withContext(function($ctx1) {
  14513. var $1,$2,$3;
  14514. destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
  14515. $1=destinationClass;
  14516. if(($receiver = $1) == nil || $receiver == null){
  14517. self._error_("Invalid class name");
  14518. } else {
  14519. $1;
  14520. };
  14521. $2=_st(destinationClass).__eq_eq(_st(aMethod)._methodClass());
  14522. if(smalltalk.assert($2)){
  14523. $3=self;
  14524. return $3;
  14525. };
  14526. _st(destinationClass)._compile_category_(_st(aMethod)._source(),_st(aMethod)._protocol());
  14527. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  14528. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
  14529. args: ["aMethod", "aClassName"],
  14530. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09category: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  14531. messageSends: ["at:", "current", "asSymbol", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:category:", "source", "protocol", "removeCompiledMethod:"],
  14532. referencedClasses: ["Smalltalk"]
  14533. }),
  14534. smalltalk.Environment);
  14535. smalltalk.addMethod(
  14536. smalltalk.method({
  14537. selector: "moveMethod:toProtocol:",
  14538. category: 'actions',
  14539. fn: function (aMethod,aProtocol){
  14540. var self=this;
  14541. return smalltalk.withContext(function($ctx1) {
  14542. _st(aMethod)._category_(aProtocol);
  14543. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},smalltalk.Environment)})},
  14544. args: ["aMethod", "aProtocol"],
  14545. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod category: aProtocol",
  14546. messageSends: ["category:"],
  14547. referencedClasses: []
  14548. }),
  14549. smalltalk.Environment);
  14550. smalltalk.addMethod(
  14551. smalltalk.method({
  14552. selector: "packages",
  14553. category: 'accessing',
  14554. fn: function (){
  14555. var self=this;
  14556. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14557. return smalltalk.withContext(function($ctx1) {
  14558. var $1;
  14559. $1=_st(_st($Smalltalk())._current())._packages();
  14560. return $1;
  14561. }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
  14562. args: [],
  14563. source: "packages\x0a\x09^ Smalltalk current packages",
  14564. messageSends: ["packages", "current"],
  14565. referencedClasses: ["Smalltalk"]
  14566. }),
  14567. smalltalk.Environment);
  14568. smalltalk.addMethod(
  14569. smalltalk.method({
  14570. selector: "registerErrorHandler:",
  14571. category: 'actions',
  14572. fn: function (anErrorHandler){
  14573. var self=this;
  14574. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  14575. return smalltalk.withContext(function($ctx1) {
  14576. _st($ErrorHandler())._setCurrent_(anErrorHandler);
  14577. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},smalltalk.Environment)})},
  14578. args: ["anErrorHandler"],
  14579. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler setCurrent: anErrorHandler",
  14580. messageSends: ["setCurrent:"],
  14581. referencedClasses: ["ErrorHandler"]
  14582. }),
  14583. smalltalk.Environment);
  14584. smalltalk.addMethod(
  14585. smalltalk.method({
  14586. selector: "registerInspector:",
  14587. category: 'actions',
  14588. fn: function (anInspector){
  14589. var self=this;
  14590. function $InspectorHandler(){return smalltalk.InspectorHandler||(typeof InspectorHandler=="undefined"?nil:InspectorHandler)}
  14591. return smalltalk.withContext(function($ctx1) {
  14592. _st($InspectorHandler())._register_(anInspector);
  14593. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},smalltalk.Environment)})},
  14594. args: ["anInspector"],
  14595. source: "registerInspector: anInspector\x0a\x09InspectorHandler register: anInspector",
  14596. messageSends: ["register:"],
  14597. referencedClasses: ["InspectorHandler"]
  14598. }),
  14599. smalltalk.Environment);
  14600. smalltalk.addMethod(
  14601. smalltalk.method({
  14602. selector: "registerProgressHandler:",
  14603. category: 'actions',
  14604. fn: function (aProgressHandler){
  14605. var self=this;
  14606. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  14607. return smalltalk.withContext(function($ctx1) {
  14608. _st($ProgressHandler())._setCurrent_(aProgressHandler);
  14609. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},smalltalk.Environment)})},
  14610. args: ["aProgressHandler"],
  14611. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler setCurrent: aProgressHandler",
  14612. messageSends: ["setCurrent:"],
  14613. referencedClasses: ["ProgressHandler"]
  14614. }),
  14615. smalltalk.Environment);
  14616. smalltalk.addMethod(
  14617. smalltalk.method({
  14618. selector: "removeClass:",
  14619. category: 'actions',
  14620. fn: function (aClass){
  14621. var self=this;
  14622. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14623. return smalltalk.withContext(function($ctx1) {
  14624. _st(_st($Smalltalk())._current())._removeClass_(aClass);
  14625. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
  14626. args: ["aClass"],
  14627. source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
  14628. messageSends: ["removeClass:", "current"],
  14629. referencedClasses: ["Smalltalk"]
  14630. }),
  14631. smalltalk.Environment);
  14632. smalltalk.addMethod(
  14633. smalltalk.method({
  14634. selector: "removeMethod:",
  14635. category: 'actions',
  14636. fn: function (aMethod){
  14637. var self=this;
  14638. return smalltalk.withContext(function($ctx1) {
  14639. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  14640. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},smalltalk.Environment)})},
  14641. args: ["aMethod"],
  14642. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  14643. messageSends: ["removeCompiledMethod:", "methodClass"],
  14644. referencedClasses: []
  14645. }),
  14646. smalltalk.Environment);
  14647. smalltalk.addMethod(
  14648. smalltalk.method({
  14649. selector: "removeProtocol:from:",
  14650. category: 'actions',
  14651. fn: function (aString,aClass){
  14652. var self=this;
  14653. return smalltalk.withContext(function($ctx1) {
  14654. _st(_st(_st(aClass)._methods())._select_((function(each){
  14655. return smalltalk.withContext(function($ctx2) {
  14656. return _st(_st(each)._protocol()).__eq(aString);
  14657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._do_((function(each){
  14658. return smalltalk.withContext(function($ctx2) {
  14659. return _st(aClass)._removeCompiledMethod_(each);
  14660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  14661. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},smalltalk.Environment)})},
  14662. args: ["aString", "aClass"],
  14663. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  14664. messageSends: ["do:", "select:", "methods", "=", "protocol", "removeCompiledMethod:"],
  14665. referencedClasses: []
  14666. }),
  14667. smalltalk.Environment);
  14668. smalltalk.addMethod(
  14669. smalltalk.method({
  14670. selector: "renameClass:to:",
  14671. category: 'actions',
  14672. fn: function (aClass,aClassName){
  14673. var self=this;
  14674. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14675. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  14676. return smalltalk.withContext(function($ctx1) {
  14677. var $1;
  14678. $1=_st(_st($Smalltalk())._current())._at_(aClassName);
  14679. if(($receiver = $1) == nil || $receiver == null){
  14680. $1;
  14681. } else {
  14682. self._error_(_st("A class named ".__comma(aClassName)).__comma(" already exists"));
  14683. };
  14684. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  14685. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
  14686. args: ["aClass", "aClassName"],
  14687. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  14688. messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "renameClass:to:", "new"],
  14689. referencedClasses: ["Smalltalk", "ClassBuilder"]
  14690. }),
  14691. smalltalk.Environment);
  14692. smalltalk.addMethod(
  14693. smalltalk.method({
  14694. selector: "renameProtocol:to:in:",
  14695. category: 'actions',
  14696. fn: function (aString,anotherString,aClass){
  14697. var self=this;
  14698. return smalltalk.withContext(function($ctx1) {
  14699. _st(_st(_st(aClass)._methods())._select_((function(each){
  14700. return smalltalk.withContext(function($ctx2) {
  14701. return _st(_st(each)._protocol()).__eq(aString);
  14702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._do_((function(each){
  14703. return smalltalk.withContext(function($ctx2) {
  14704. return _st(each)._protocol_(anotherString);
  14705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  14706. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},smalltalk.Environment)})},
  14707. args: ["aString", "anotherString", "aClass"],
  14708. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methods\x0a\x09\x09select: [ :each | each protocol = aString ])\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  14709. messageSends: ["do:", "select:", "methods", "=", "protocol", "protocol:"],
  14710. referencedClasses: []
  14711. }),
  14712. smalltalk.Environment);
  14713. smalltalk.addMethod(
  14714. smalltalk.method({
  14715. selector: "setClassCommentOf:to:",
  14716. category: 'actions',
  14717. fn: function (aClass,aString){
  14718. var self=this;
  14719. return smalltalk.withContext(function($ctx1) {
  14720. _st(aClass)._comment_(aString);
  14721. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},smalltalk.Environment)})},
  14722. args: ["aClass", "aString"],
  14723. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  14724. messageSends: ["comment:"],
  14725. referencedClasses: []
  14726. }),
  14727. smalltalk.Environment);
  14728. smalltalk.addMethod(
  14729. smalltalk.method({
  14730. selector: "systemAnnouncer",
  14731. category: 'accessing',
  14732. fn: function (){
  14733. var self=this;
  14734. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  14735. return smalltalk.withContext(function($ctx1) {
  14736. var $1;
  14737. $1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
  14738. return $1;
  14739. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
  14740. args: [],
  14741. source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
  14742. messageSends: ["current", "at:"],
  14743. referencedClasses: ["Smalltalk"]
  14744. }),
  14745. smalltalk.Environment);
  14746. smalltalk.addClass('JSObjectProxy', smalltalk.Object, ['jsObject'], 'Kernel-Infrastructure');
  14747. smalltalk.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  14748. smalltalk.addMethod(
  14749. smalltalk.method({
  14750. selector: "addObjectVariablesTo:",
  14751. category: 'proxy',
  14752. fn: function (aDictionary){
  14753. var self=this;
  14754. return smalltalk.withContext(function($ctx1) {
  14755. for(var i in self['@jsObject']) {
  14756. aDictionary._at_put_(i, self['@jsObject'][i]);
  14757. }
  14758. ;
  14759. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},smalltalk.JSObjectProxy)})},
  14760. args: ["aDictionary"],
  14761. source: "addObjectVariablesTo: aDictionary\x0a\x09<\x0a\x09\x09for(var i in self['@jsObject']) {\x0a\x09\x09\x09aDictionary._at_put_(i, self['@jsObject'][i]);\x0a\x09\x09}\x0a\x09>",
  14762. messageSends: [],
  14763. referencedClasses: []
  14764. }),
  14765. smalltalk.JSObjectProxy);
  14766. smalltalk.addMethod(
  14767. smalltalk.method({
  14768. selector: "at:",
  14769. category: 'accessing',
  14770. fn: function (aString){
  14771. var self=this;
  14772. return smalltalk.withContext(function($ctx1) {
  14773. return self['@jsObject'][aString];
  14774. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.JSObjectProxy)})},
  14775. args: ["aString"],
  14776. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  14777. messageSends: [],
  14778. referencedClasses: []
  14779. }),
  14780. smalltalk.JSObjectProxy);
  14781. smalltalk.addMethod(
  14782. smalltalk.method({
  14783. selector: "at:ifAbsent:",
  14784. category: 'accessing',
  14785. fn: function (aString,aBlock){
  14786. var self=this;
  14787. return smalltalk.withContext(function($ctx1) {
  14788. var obj = self['@jsObject'];
  14789. return aString in obj ? obj[aString] : aBlock._value();
  14790. ;
  14791. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  14792. args: ["aString", "aBlock"],
  14793. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  14794. messageSends: [],
  14795. referencedClasses: []
  14796. }),
  14797. smalltalk.JSObjectProxy);
  14798. smalltalk.addMethod(
  14799. smalltalk.method({
  14800. selector: "at:ifPresent:",
  14801. category: 'accessing',
  14802. fn: function (aString,aBlock){
  14803. var self=this;
  14804. return smalltalk.withContext(function($ctx1) {
  14805. var obj = self['@jsObject'];
  14806. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  14807. ;
  14808. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},smalltalk.JSObjectProxy)})},
  14809. args: ["aString", "aBlock"],
  14810. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  14811. messageSends: [],
  14812. referencedClasses: []
  14813. }),
  14814. smalltalk.JSObjectProxy);
  14815. smalltalk.addMethod(
  14816. smalltalk.method({
  14817. selector: "at:ifPresent:ifAbsent:",
  14818. category: 'accessing',
  14819. fn: function (aString,aBlock,anotherBlock){
  14820. var self=this;
  14821. return smalltalk.withContext(function($ctx1) {
  14822. var obj = self['@jsObject'];
  14823. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  14824. ;
  14825. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSObjectProxy)})},
  14826. args: ["aString", "aBlock", "anotherBlock"],
  14827. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  14828. messageSends: [],
  14829. referencedClasses: []
  14830. }),
  14831. smalltalk.JSObjectProxy);
  14832. smalltalk.addMethod(
  14833. smalltalk.method({
  14834. selector: "at:put:",
  14835. category: 'accessing',
  14836. fn: function (aString,anObject){
  14837. var self=this;
  14838. return smalltalk.withContext(function($ctx1) {
  14839. self['@jsObject'][aString] = anObject;
  14840. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.JSObjectProxy)})},
  14841. args: ["aString", "anObject"],
  14842. source: "at: aString put: anObject\x0a\x09<self['@jsObject'][aString] = anObject>",
  14843. messageSends: [],
  14844. referencedClasses: []
  14845. }),
  14846. smalltalk.JSObjectProxy);
  14847. smalltalk.addMethod(
  14848. smalltalk.method({
  14849. selector: "doesNotUnderstand:",
  14850. category: 'proxy',
  14851. fn: function (aMessage){
  14852. var self=this;
  14853. return smalltalk.withContext(function($ctx1) {
  14854. var $2,$1;
  14855. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  14856. if(($receiver = $2) == nil || $receiver == null){
  14857. $1=smalltalk.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]);
  14858. } else {
  14859. var jsSelector;
  14860. jsSelector=$receiver;
  14861. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  14862. };
  14863. return $1;
  14864. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},smalltalk.JSObjectProxy)})},
  14865. args: ["aMessage"],
  14866. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptSelector)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments ]",
  14867. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
  14868. referencedClasses: []
  14869. }),
  14870. smalltalk.JSObjectProxy);
  14871. smalltalk.addMethod(
  14872. smalltalk.method({
  14873. selector: "forwardMessage:withArguments:",
  14874. category: 'proxy',
  14875. fn: function (aString,anArray){
  14876. var self=this;
  14877. return smalltalk.withContext(function($ctx1) {
  14878. return smalltalk.send(self._jsObject(), aString, anArray);
  14879. ;
  14880. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},smalltalk.JSObjectProxy)})},
  14881. args: ["aString", "anArray"],
  14882. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  14883. messageSends: [],
  14884. referencedClasses: []
  14885. }),
  14886. smalltalk.JSObjectProxy);
  14887. smalltalk.addMethod(
  14888. smalltalk.method({
  14889. selector: "inspectOn:",
  14890. category: 'proxy',
  14891. fn: function (anInspector){
  14892. var self=this;
  14893. var variables;
  14894. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  14895. return smalltalk.withContext(function($ctx1) {
  14896. variables=_st($Dictionary())._new();
  14897. _st(variables)._at_put_("#self",self._jsObject());
  14898. _st(anInspector)._setLabel_(self._printString());
  14899. self._addObjectVariablesTo_(variables);
  14900. _st(anInspector)._setVariables_(variables);
  14901. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},smalltalk.JSObjectProxy)})},
  14902. args: ["anInspector"],
  14903. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09self addObjectVariablesTo: variables.\x0a\x09anInspector setVariables: variables",
  14904. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  14905. referencedClasses: ["Dictionary"]
  14906. }),
  14907. smalltalk.JSObjectProxy);
  14908. smalltalk.addMethod(
  14909. smalltalk.method({
  14910. selector: "jsObject",
  14911. category: 'accessing',
  14912. fn: function (){
  14913. var self=this;
  14914. return smalltalk.withContext(function($ctx1) {
  14915. var $1;
  14916. $1=self["@jsObject"];
  14917. return $1;
  14918. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxy)})},
  14919. args: [],
  14920. source: "jsObject\x0a\x09^jsObject",
  14921. messageSends: [],
  14922. referencedClasses: []
  14923. }),
  14924. smalltalk.JSObjectProxy);
  14925. smalltalk.addMethod(
  14926. smalltalk.method({
  14927. selector: "jsObject:",
  14928. category: 'accessing',
  14929. fn: function (aJSObject){
  14930. var self=this;
  14931. return smalltalk.withContext(function($ctx1) {
  14932. self["@jsObject"]=aJSObject;
  14933. return self}, function($ctx1) {$ctx1.fill(self,"jsObject:",{aJSObject:aJSObject},smalltalk.JSObjectProxy)})},
  14934. args: ["aJSObject"],
  14935. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  14936. messageSends: [],
  14937. referencedClasses: []
  14938. }),
  14939. smalltalk.JSObjectProxy);
  14940. smalltalk.addMethod(
  14941. smalltalk.method({
  14942. selector: "keysAndValuesDo:",
  14943. category: 'enumerating',
  14944. fn: function (aBlock){
  14945. var self=this;
  14946. return smalltalk.withContext(function($ctx1) {
  14947. var o = self['@jsObject'];
  14948. for(var i in o) {
  14949. aBlock._value_value_(i, o[i]);
  14950. }
  14951. ;
  14952. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},smalltalk.JSObjectProxy)})},
  14953. args: ["aBlock"],
  14954. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  14955. messageSends: [],
  14956. referencedClasses: []
  14957. }),
  14958. smalltalk.JSObjectProxy);
  14959. smalltalk.addMethod(
  14960. smalltalk.method({
  14961. selector: "lookupProperty:",
  14962. category: 'accessing',
  14963. fn: function (aString){
  14964. var self=this;
  14965. return smalltalk.withContext(function($ctx1) {
  14966. return aString in self._jsObject() ? aString : nil;
  14967. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},smalltalk.JSObjectProxy)})},
  14968. args: ["aString"],
  14969. source: "lookupProperty: aString\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in self._jsObject() ? aString : nil>",
  14970. messageSends: [],
  14971. referencedClasses: []
  14972. }),
  14973. smalltalk.JSObjectProxy);
  14974. smalltalk.addMethod(
  14975. smalltalk.method({
  14976. selector: "printOn:",
  14977. category: 'printing',
  14978. fn: function (aStream){
  14979. var self=this;
  14980. return smalltalk.withContext(function($ctx1) {
  14981. _st(aStream)._nextPutAll_(self._printString());
  14982. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.JSObjectProxy)})},
  14983. args: ["aStream"],
  14984. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  14985. messageSends: ["nextPutAll:", "printString"],
  14986. referencedClasses: []
  14987. }),
  14988. smalltalk.JSObjectProxy);
  14989. smalltalk.addMethod(
  14990. smalltalk.method({
  14991. selector: "printString",
  14992. category: 'printing',
  14993. fn: function (){
  14994. var self=this;
  14995. return smalltalk.withContext(function($ctx1) {
  14996. var js = self['@jsObject'];
  14997. return js.toString
  14998. ? js.toString()
  14999. : Object.prototype.toString.call(js)
  15000. ;
  15001. return self}, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.JSObjectProxy)})},
  15002. args: [],
  15003. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  15004. messageSends: [],
  15005. referencedClasses: []
  15006. }),
  15007. smalltalk.JSObjectProxy);
  15008. smalltalk.addMethod(
  15009. smalltalk.method({
  15010. selector: "value",
  15011. category: 'accessing',
  15012. fn: function (){
  15013. var self=this;
  15014. return smalltalk.withContext(function($ctx1) {
  15015. var $1;
  15016. $1=self._at_ifAbsent_("value",(function(){
  15017. return smalltalk.withContext(function($ctx2) {
  15018. return smalltalk.JSObjectProxy.superclass.fn.prototype._value.apply(_st(self), []);
  15019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15020. return $1;
  15021. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.JSObjectProxy)})},
  15022. args: [],
  15023. source: "value\x0a\x09\x22if attribute 'value' exists on the JS object return it,\x0a\x09otherwise return the result of Object>>value.\x22\x0a\x09\x0a\x09^ self \x0a\x09\x09at: 'value' \x0a\x09\x09ifAbsent: [ super value ]",
  15024. messageSends: ["at:ifAbsent:", "value"],
  15025. referencedClasses: []
  15026. }),
  15027. smalltalk.JSObjectProxy);
  15028. smalltalk.addMethod(
  15029. smalltalk.method({
  15030. selector: "on:",
  15031. category: 'instance creation',
  15032. fn: function (aJSObject){
  15033. var self=this;
  15034. return smalltalk.withContext(function($ctx1) {
  15035. var $2,$3,$1;
  15036. $2=self._new();
  15037. _st($2)._jsObject_(aJSObject);
  15038. $3=_st($2)._yourself();
  15039. $1=$3;
  15040. return $1;
  15041. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},smalltalk.JSObjectProxy.klass)})},
  15042. args: ["aJSObject"],
  15043. source: "on: aJSObject\x0a\x09^self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  15044. messageSends: ["jsObject:", "new", "yourself"],
  15045. referencedClasses: []
  15046. }),
  15047. smalltalk.JSObjectProxy.klass);
  15048. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Infrastructure');
  15049. smalltalk.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  15050. smalltalk.addMethod(
  15051. smalltalk.method({
  15052. selector: "addElement:",
  15053. category: 'accessing',
  15054. fn: function (anObject){
  15055. var self=this;
  15056. return smalltalk.withContext(function($ctx1) {
  15057. self.elements.addElement(anObject);
  15058. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},smalltalk.Organizer)})},
  15059. args: ["anObject"],
  15060. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  15061. messageSends: [],
  15062. referencedClasses: []
  15063. }),
  15064. smalltalk.Organizer);
  15065. smalltalk.addMethod(
  15066. smalltalk.method({
  15067. selector: "elements",
  15068. category: 'accessing',
  15069. fn: function (){
  15070. var self=this;
  15071. return smalltalk.withContext(function($ctx1) {
  15072. var $1;
  15073. $1=_st(self._basicAt_("elements"))._copy();
  15074. return $1;
  15075. }, function($ctx1) {$ctx1.fill(self,"elements",{},smalltalk.Organizer)})},
  15076. args: [],
  15077. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  15078. messageSends: ["copy", "basicAt:"],
  15079. referencedClasses: []
  15080. }),
  15081. smalltalk.Organizer);
  15082. smalltalk.addMethod(
  15083. smalltalk.method({
  15084. selector: "removeElement:",
  15085. category: 'accessing',
  15086. fn: function (anObject){
  15087. var self=this;
  15088. return smalltalk.withContext(function($ctx1) {
  15089. self.elements.removeElement(anObject);
  15090. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},smalltalk.Organizer)})},
  15091. args: ["anObject"],
  15092. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  15093. messageSends: [],
  15094. referencedClasses: []
  15095. }),
  15096. smalltalk.Organizer);
  15097. smalltalk.addClass('ClassOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastructure');
  15098. smalltalk.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  15099. smalltalk.addMethod(
  15100. smalltalk.method({
  15101. selector: "addElement:",
  15102. category: 'accessing',
  15103. fn: function (aString){
  15104. var self=this;
  15105. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  15106. function $ProtocolAdded(){return smalltalk.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  15107. return smalltalk.withContext(function($ctx1) {
  15108. var $1,$2;
  15109. smalltalk.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]);
  15110. $1=_st($ProtocolAdded())._new();
  15111. _st($1)._protocol_(aString);
  15112. _st($1)._theClass_(self._theClass());
  15113. $2=_st($1)._yourself();
  15114. _st(_st($SystemAnnouncer())._current())._announce_($2);
  15115. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  15116. args: ["aString"],
  15117. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  15118. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  15119. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
  15120. }),
  15121. smalltalk.ClassOrganizer);
  15122. smalltalk.addMethod(
  15123. smalltalk.method({
  15124. selector: "removeElement:",
  15125. category: 'accessing',
  15126. fn: function (aString){
  15127. var self=this;
  15128. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  15129. function $ProtocolRemoved(){return smalltalk.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  15130. return smalltalk.withContext(function($ctx1) {
  15131. var $1,$2;
  15132. smalltalk.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]);
  15133. $1=_st($ProtocolRemoved())._new();
  15134. _st($1)._protocol_(aString);
  15135. _st($1)._theClass_(self._theClass());
  15136. $2=_st($1)._yourself();
  15137. _st(_st($SystemAnnouncer())._current())._announce_($2);
  15138. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},smalltalk.ClassOrganizer)})},
  15139. args: ["aString"],
  15140. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  15141. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  15142. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
  15143. }),
  15144. smalltalk.ClassOrganizer);
  15145. smalltalk.addMethod(
  15146. smalltalk.method({
  15147. selector: "theClass",
  15148. category: 'accessing',
  15149. fn: function (){
  15150. var self=this;
  15151. return smalltalk.withContext(function($ctx1) {
  15152. return self.theClass ;
  15153. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassOrganizer)})},
  15154. args: [],
  15155. source: "theClass\x0a\x09< return self.theClass >",
  15156. messageSends: [],
  15157. referencedClasses: []
  15158. }),
  15159. smalltalk.ClassOrganizer);
  15160. smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastructure');
  15161. smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  15162. smalltalk.addClass('Package', smalltalk.Object, ['transport'], 'Kernel-Infrastructure');
  15163. smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  15164. smalltalk.addMethod(
  15165. smalltalk.method({
  15166. selector: "basicTransport",
  15167. category: 'accessing',
  15168. fn: function (){
  15169. var self=this;
  15170. return smalltalk.withContext(function($ctx1) {
  15171. return self.transport;
  15172. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},smalltalk.Package)})},
  15173. args: [],
  15174. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  15175. messageSends: [],
  15176. referencedClasses: []
  15177. }),
  15178. smalltalk.Package);
  15179. smalltalk.addMethod(
  15180. smalltalk.method({
  15181. selector: "classes",
  15182. category: 'classes',
  15183. fn: function (){
  15184. var self=this;
  15185. return smalltalk.withContext(function($ctx1) {
  15186. var $1;
  15187. $1=_st(_st(_st(self._organization())._elements())._asSet())._asArray();
  15188. return $1;
  15189. }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Package)})},
  15190. args: [],
  15191. source: "classes\x0a\x09^ self organization elements asSet asArray",
  15192. messageSends: ["asArray", "asSet", "elements", "organization"],
  15193. referencedClasses: []
  15194. }),
  15195. smalltalk.Package);
  15196. smalltalk.addMethod(
  15197. smalltalk.method({
  15198. selector: "isPackage",
  15199. category: 'testing',
  15200. fn: function (){
  15201. var self=this;
  15202. return smalltalk.withContext(function($ctx1) {
  15203. return true;
  15204. }, function($ctx1) {$ctx1.fill(self,"isPackage",{},smalltalk.Package)})},
  15205. args: [],
  15206. source: "isPackage\x0a\x09^ true",
  15207. messageSends: [],
  15208. referencedClasses: []
  15209. }),
  15210. smalltalk.Package);
  15211. smalltalk.addMethod(
  15212. smalltalk.method({
  15213. selector: "loadDependencies",
  15214. category: 'dependencies',
  15215. fn: function (){
  15216. var self=this;
  15217. var classes,packages;
  15218. return smalltalk.withContext(function($ctx1) {
  15219. var $2,$3,$1;
  15220. classes=self._loadDependencyClasses();
  15221. $2=_st(_st(classes)._collect_((function(each){
  15222. return smalltalk.withContext(function($ctx2) {
  15223. return _st(each)._package();
  15224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  15225. _st($2)._remove_ifAbsent_(self,(function(){
  15226. return smalltalk.withContext(function($ctx2) {
  15227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  15228. $3=_st($2)._yourself();
  15229. $1=$3;
  15230. return $1;
  15231. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},smalltalk.Package)})},
  15232. args: [],
  15233. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^(classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  15234. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
  15235. referencedClasses: []
  15236. }),
  15237. smalltalk.Package);
  15238. smalltalk.addMethod(
  15239. smalltalk.method({
  15240. selector: "loadDependencyClasses",
  15241. category: 'dependencies',
  15242. fn: function (){
  15243. var self=this;
  15244. var starCategoryName;
  15245. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15246. return smalltalk.withContext(function($ctx1) {
  15247. var $2,$3,$1;
  15248. starCategoryName="*".__comma(self._name());
  15249. $2=_st(_st(self._classes())._collect_((function(each){
  15250. return smalltalk.withContext(function($ctx2) {
  15251. return _st(each)._superclass();
  15252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  15253. _st($2)._remove_ifAbsent_(nil,(function(){
  15254. return smalltalk.withContext(function($ctx2) {
  15255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  15256. _st($2)._addAll_(_st(_st(_st($Smalltalk())._current())._classes())._select_((function(each){
  15257. return smalltalk.withContext(function($ctx2) {
  15258. return _st(_st(each)._protocols())._includes_(starCategoryName);
  15259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
  15260. $3=_st($2)._yourself();
  15261. $1=$3;
  15262. return $1;
  15263. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},smalltalk.Package)})},
  15264. args: [],
  15265. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^(self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk current classes select: [ :each | each protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  15266. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "current", "includes:", "protocols", "yourself"],
  15267. referencedClasses: ["Smalltalk"]
  15268. }),
  15269. smalltalk.Package);
  15270. smalltalk.addMethod(
  15271. smalltalk.method({
  15272. selector: "name",
  15273. category: 'accessing',
  15274. fn: function (){
  15275. var self=this;
  15276. return smalltalk.withContext(function($ctx1) {
  15277. return self.pkgName;
  15278. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Package)})},
  15279. args: [],
  15280. source: "name\x0a\x09<return self.pkgName>",
  15281. messageSends: [],
  15282. referencedClasses: []
  15283. }),
  15284. smalltalk.Package);
  15285. smalltalk.addMethod(
  15286. smalltalk.method({
  15287. selector: "name:",
  15288. category: 'accessing',
  15289. fn: function (aString){
  15290. var self=this;
  15291. return smalltalk.withContext(function($ctx1) {
  15292. self.pkgName = aString;
  15293. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.Package)})},
  15294. args: ["aString"],
  15295. source: "name: aString\x0a\x09<self.pkgName = aString>",
  15296. messageSends: [],
  15297. referencedClasses: []
  15298. }),
  15299. smalltalk.Package);
  15300. smalltalk.addMethod(
  15301. smalltalk.method({
  15302. selector: "organization",
  15303. category: 'accessing',
  15304. fn: function (){
  15305. var self=this;
  15306. return smalltalk.withContext(function($ctx1) {
  15307. var $1;
  15308. $1=self._basicAt_("organization");
  15309. return $1;
  15310. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Package)})},
  15311. args: [],
  15312. source: "organization\x0a\x09^ self basicAt: 'organization'",
  15313. messageSends: ["basicAt:"],
  15314. referencedClasses: []
  15315. }),
  15316. smalltalk.Package);
  15317. smalltalk.addMethod(
  15318. smalltalk.method({
  15319. selector: "printOn:",
  15320. category: 'printing',
  15321. fn: function (aStream){
  15322. var self=this;
  15323. return smalltalk.withContext(function($ctx1) {
  15324. var $1,$2;
  15325. smalltalk.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  15326. $1=aStream;
  15327. _st($1)._nextPutAll_(" (");
  15328. _st($1)._nextPutAll_(self._name());
  15329. $2=_st($1)._nextPutAll_(")");
  15330. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Package)})},
  15331. args: ["aStream"],
  15332. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  15333. messageSends: ["printOn:", "nextPutAll:", "name"],
  15334. referencedClasses: []
  15335. }),
  15336. smalltalk.Package);
  15337. smalltalk.addMethod(
  15338. smalltalk.method({
  15339. selector: "setupClasses",
  15340. category: 'classes',
  15341. fn: function (){
  15342. var self=this;
  15343. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  15344. return smalltalk.withContext(function($ctx1) {
  15345. var $1,$2;
  15346. $1=self._classes();
  15347. _st($1)._do_((function(each){
  15348. return smalltalk.withContext(function($ctx2) {
  15349. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  15350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15351. $2=_st($1)._do_((function(each){
  15352. return smalltalk.withContext(function($ctx2) {
  15353. return _st(each)._initialize();
  15354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  15355. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},smalltalk.Package)})},
  15356. args: [],
  15357. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  15358. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
  15359. referencedClasses: ["ClassBuilder"]
  15360. }),
  15361. smalltalk.Package);
  15362. smalltalk.addMethod(
  15363. smalltalk.method({
  15364. selector: "sortedClasses",
  15365. category: 'classes',
  15366. fn: function (){
  15367. var self=this;
  15368. return smalltalk.withContext(function($ctx1) {
  15369. var $1;
  15370. $1=_st(self._class())._sortedClasses_(self._classes());
  15371. return $1;
  15372. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},smalltalk.Package)})},
  15373. args: [],
  15374. 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",
  15375. messageSends: ["sortedClasses:", "class", "classes"],
  15376. referencedClasses: []
  15377. }),
  15378. smalltalk.Package);
  15379. smalltalk.addMethod(
  15380. smalltalk.method({
  15381. selector: "transport",
  15382. category: 'accessing',
  15383. fn: function (){
  15384. var self=this;
  15385. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  15386. return smalltalk.withContext(function($ctx1) {
  15387. var $2,$3,$4,$1;
  15388. $2=self["@transport"];
  15389. if(($receiver = $2) == nil || $receiver == null){
  15390. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  15391. _st($3)._package_(self);
  15392. $4=_st($3)._yourself();
  15393. self["@transport"]=$4;
  15394. $1=self["@transport"];
  15395. } else {
  15396. $1=$2;
  15397. };
  15398. return $1;
  15399. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  15400. args: [],
  15401. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  15402. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
  15403. referencedClasses: ["PackageTransport"]
  15404. }),
  15405. smalltalk.Package);
  15406. smalltalk.addMethod(
  15407. smalltalk.method({
  15408. selector: "transport:",
  15409. category: 'accessing',
  15410. fn: function (aPackageTransport){
  15411. var self=this;
  15412. return smalltalk.withContext(function($ctx1) {
  15413. self["@transport"]=aPackageTransport;
  15414. return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},smalltalk.Package)})},
  15415. args: ["aPackageTransport"],
  15416. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport",
  15417. messageSends: [],
  15418. referencedClasses: []
  15419. }),
  15420. smalltalk.Package);
  15421. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  15422. smalltalk.addMethod(
  15423. smalltalk.method({
  15424. selector: "named:",
  15425. category: 'accessing',
  15426. fn: function (aPackageName){
  15427. var self=this;
  15428. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15429. return smalltalk.withContext(function($ctx1) {
  15430. var $1;
  15431. $1=_st(_st($Smalltalk())._current())._packageAt_(aPackageName);
  15432. return $1;
  15433. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  15434. args: ["aPackageName"],
  15435. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  15436. messageSends: ["packageAt:", "current"],
  15437. referencedClasses: ["Smalltalk"]
  15438. }),
  15439. smalltalk.Package.klass);
  15440. smalltalk.addMethod(
  15441. smalltalk.method({
  15442. selector: "named:ifAbsent:",
  15443. category: 'accessing',
  15444. fn: function (aPackageName,aBlock){
  15445. var self=this;
  15446. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  15447. return smalltalk.withContext(function($ctx1) {
  15448. var $1;
  15449. $1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
  15450. return $1;
  15451. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
  15452. args: ["aPackageName", "aBlock"],
  15453. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  15454. messageSends: ["packageAt:ifAbsent:", "current"],
  15455. referencedClasses: ["Smalltalk"]
  15456. }),
  15457. smalltalk.Package.klass);
  15458. smalltalk.addMethod(
  15459. smalltalk.method({
  15460. selector: "sortedClasses:",
  15461. category: 'sorting',
  15462. fn: function (classes){
  15463. var self=this;
  15464. var children,others,nodes,expandedClasses;
  15465. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  15466. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  15467. return smalltalk.withContext(function($ctx1) {
  15468. var $1,$2;
  15469. children=[];
  15470. others=[];
  15471. _st(classes)._do_((function(each){
  15472. return smalltalk.withContext(function($ctx2) {
  15473. $1=_st(classes)._includes_(_st(each)._superclass());
  15474. if(smalltalk.assert($1)){
  15475. return _st(others)._add_(each);
  15476. } else {
  15477. return _st(children)._add_(each);
  15478. };
  15479. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15480. nodes=_st(children)._collect_((function(each){
  15481. return smalltalk.withContext(function($ctx2) {
  15482. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  15483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  15484. nodes=_st(nodes)._sorted_((function(a,b){
  15485. return smalltalk.withContext(function($ctx2) {
  15486. return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  15487. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
  15488. expandedClasses=_st($Array())._new();
  15489. _st(nodes)._do_((function(aNode){
  15490. return smalltalk.withContext(function($ctx2) {
  15491. return _st(aNode)._traverseClassesWith_(expandedClasses);
  15492. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
  15493. $2=expandedClasses;
  15494. return $2;
  15495. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},smalltalk.Package.klass)})},
  15496. args: ["classes"],
  15497. 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",
  15498. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  15499. referencedClasses: ["ClassSorterNode", "Array"]
  15500. }),
  15501. smalltalk.Package.klass);
  15502. smalltalk.addClass('PlatformInterface', smalltalk.Object, [], 'Kernel-Infrastructure');
  15503. smalltalk.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  15504. smalltalk.PlatformInterface.klass.iVarNames = ['worker'];
  15505. smalltalk.addMethod(
  15506. smalltalk.method({
  15507. selector: "ajax:",
  15508. category: 'actions',
  15509. fn: function (anObject){
  15510. var self=this;
  15511. return smalltalk.withContext(function($ctx1) {
  15512. var $2,$1;
  15513. $2=self["@worker"];
  15514. if(($receiver = $2) == nil || $receiver == null){
  15515. $1=self._error_("ajax: not available");
  15516. } else {
  15517. $1=_st(self["@worker"])._ajax_(anObject);
  15518. };
  15519. return $1;
  15520. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},smalltalk.PlatformInterface.klass)})},
  15521. args: ["anObject"],
  15522. source: "ajax: anObject\x0a\x09^worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  15523. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
  15524. referencedClasses: []
  15525. }),
  15526. smalltalk.PlatformInterface.klass);
  15527. smalltalk.addMethod(
  15528. smalltalk.method({
  15529. selector: "alert:",
  15530. category: 'actions',
  15531. fn: function (aString){
  15532. var self=this;
  15533. return smalltalk.withContext(function($ctx1) {
  15534. var $2,$1;
  15535. $2=self["@worker"];
  15536. if(($receiver = $2) == nil || $receiver == null){
  15537. $1=self._error_("alert: not available");
  15538. } else {
  15539. $1=_st(self["@worker"])._alert_(aString);
  15540. };
  15541. return $1;
  15542. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  15543. args: ["aString"],
  15544. source: "alert: aString\x0a\x09^worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  15545. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
  15546. referencedClasses: []
  15547. }),
  15548. smalltalk.PlatformInterface.klass);
  15549. smalltalk.addMethod(
  15550. smalltalk.method({
  15551. selector: "confirm:",
  15552. category: 'actions',
  15553. fn: function (aString){
  15554. var self=this;
  15555. return smalltalk.withContext(function($ctx1) {
  15556. var $2,$1;
  15557. $2=self["@worker"];
  15558. if(($receiver = $2) == nil || $receiver == null){
  15559. $1=self._error_("confirm: not available");
  15560. } else {
  15561. $1=_st(self["@worker"])._confirm_(aString);
  15562. };
  15563. return $1;
  15564. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  15565. args: ["aString"],
  15566. source: "confirm: aString\x0a\x09^worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  15567. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
  15568. referencedClasses: []
  15569. }),
  15570. smalltalk.PlatformInterface.klass);
  15571. smalltalk.addMethod(
  15572. smalltalk.method({
  15573. selector: "existsGlobal:",
  15574. category: 'actions',
  15575. fn: function (aString){
  15576. var self=this;
  15577. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  15578. return smalltalk.withContext(function($ctx1) {
  15579. var $1;
  15580. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  15581. return smalltalk.withContext(function($ctx2) {
  15582. return true;
  15583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  15584. return smalltalk.withContext(function($ctx2) {
  15585. return false;
  15586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  15587. return $1;
  15588. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  15589. args: ["aString"],
  15590. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  15591. messageSends: ["at:ifPresent:ifAbsent:", "globals"],
  15592. referencedClasses: ["PlatformInterface"]
  15593. }),
  15594. smalltalk.PlatformInterface.klass);
  15595. smalltalk.addMethod(
  15596. smalltalk.method({
  15597. selector: "globals",
  15598. category: 'accessing',
  15599. fn: function (){
  15600. var self=this;
  15601. return smalltalk.withContext(function($ctx1) {
  15602. return (new Function('return this'))();;
  15603. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},smalltalk.PlatformInterface.klass)})},
  15604. args: [],
  15605. source: "globals\x0a\x09<return (new Function('return this'))();>",
  15606. messageSends: [],
  15607. referencedClasses: []
  15608. }),
  15609. smalltalk.PlatformInterface.klass);
  15610. smalltalk.addMethod(
  15611. smalltalk.method({
  15612. selector: "initialize",
  15613. category: 'initialization',
  15614. fn: function (){
  15615. var self=this;
  15616. var candidate;
  15617. function $BrowserInterface(){return smalltalk.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  15618. return smalltalk.withContext(function($ctx1) {
  15619. var $1,$2,$3;
  15620. smalltalk.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  15621. $1=$BrowserInterface();
  15622. if(($receiver = $1) == nil || $receiver == null){
  15623. $1;
  15624. } else {
  15625. candidate=_st($BrowserInterface())._new();
  15626. candidate;
  15627. $2=_st(candidate)._isAvailable();
  15628. if(smalltalk.assert($2)){
  15629. self._setWorker_(candidate);
  15630. $3=self;
  15631. return $3;
  15632. };
  15633. };
  15634. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},smalltalk.PlatformInterface.klass)})},
  15635. args: [],
  15636. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^self ]\x0a\x09]",
  15637. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
  15638. referencedClasses: ["BrowserInterface"]
  15639. }),
  15640. smalltalk.PlatformInterface.klass);
  15641. smalltalk.addMethod(
  15642. smalltalk.method({
  15643. selector: "prompt:",
  15644. category: 'actions',
  15645. fn: function (aString){
  15646. var self=this;
  15647. return smalltalk.withContext(function($ctx1) {
  15648. var $2,$1;
  15649. $2=self["@worker"];
  15650. if(($receiver = $2) == nil || $receiver == null){
  15651. $1=self._error_("prompt: not available");
  15652. } else {
  15653. $1=_st(self["@worker"])._prompt_(aString);
  15654. };
  15655. return $1;
  15656. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},smalltalk.PlatformInterface.klass)})},
  15657. args: ["aString"],
  15658. source: "prompt: aString\x0a\x09^worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  15659. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
  15660. referencedClasses: []
  15661. }),
  15662. smalltalk.PlatformInterface.klass);
  15663. smalltalk.addMethod(
  15664. smalltalk.method({
  15665. selector: "setWorker:",
  15666. category: 'accessing',
  15667. fn: function (anObject){
  15668. var self=this;
  15669. return smalltalk.withContext(function($ctx1) {
  15670. self["@worker"]=anObject;
  15671. return self}, function($ctx1) {$ctx1.fill(self,"setWorker:",{anObject:anObject},smalltalk.PlatformInterface.klass)})},
  15672. args: ["anObject"],
  15673. source: "setWorker: anObject\x0a\x09worker := anObject",
  15674. messageSends: [],
  15675. referencedClasses: []
  15676. }),
  15677. smalltalk.PlatformInterface.klass);
  15678. smalltalk.addClass('ProgressHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
  15679. smalltalk.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aSubclasses of can register themselves as the current handler with\x0a`ProgressHandler class >> register`.\x0a\x0aThe default behavior is to simply iterate over the collection.";
  15680. smalltalk.addMethod(
  15681. smalltalk.method({
  15682. selector: "do:on:displaying:",
  15683. category: 'progress handling',
  15684. fn: function (aBlock,aCollection,aString){
  15685. var self=this;
  15686. return smalltalk.withContext(function($ctx1) {
  15687. _st(aCollection)._do_(aBlock);
  15688. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},smalltalk.ProgressHandler)})},
  15689. args: ["aBlock", "aCollection", "aString"],
  15690. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  15691. messageSends: ["do:"],
  15692. referencedClasses: []
  15693. }),
  15694. smalltalk.ProgressHandler);
  15695. smalltalk.ProgressHandler.klass.iVarNames = ['current'];
  15696. smalltalk.addMethod(
  15697. smalltalk.method({
  15698. selector: "current",
  15699. category: 'accessing',
  15700. fn: function (){
  15701. var self=this;
  15702. return smalltalk.withContext(function($ctx1) {
  15703. var $2,$1;
  15704. $2=self["@current"];
  15705. if(($receiver = $2) == nil || $receiver == null){
  15706. self["@current"]=self._new();
  15707. $1=self["@current"];
  15708. } else {
  15709. $1=$2;
  15710. };
  15711. return $1;
  15712. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ProgressHandler.klass)})},
  15713. args: [],
  15714. source: "current\x0a\x09^current ifNil: [ current := self new ]",
  15715. messageSends: ["ifNil:", "new"],
  15716. referencedClasses: []
  15717. }),
  15718. smalltalk.ProgressHandler.klass);
  15719. smalltalk.addMethod(
  15720. smalltalk.method({
  15721. selector: "initialize",
  15722. category: 'initialization',
  15723. fn: function (){
  15724. var self=this;
  15725. return smalltalk.withContext(function($ctx1) {
  15726. self._register();
  15727. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProgressHandler.klass)})},
  15728. args: [],
  15729. source: "initialize\x0a\x09self register",
  15730. messageSends: ["register"],
  15731. referencedClasses: []
  15732. }),
  15733. smalltalk.ProgressHandler.klass);
  15734. smalltalk.addMethod(
  15735. smalltalk.method({
  15736. selector: "register",
  15737. category: 'initialization',
  15738. fn: function (){
  15739. var self=this;
  15740. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  15741. return smalltalk.withContext(function($ctx1) {
  15742. _st($ProgressHandler())._setCurrent_(self._new());
  15743. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ProgressHandler.klass)})},
  15744. args: [],
  15745. source: "register\x0a\x09ProgressHandler setCurrent: self new",
  15746. messageSends: ["setCurrent:", "new"],
  15747. referencedClasses: ["ProgressHandler"]
  15748. }),
  15749. smalltalk.ProgressHandler.klass);
  15750. smalltalk.addMethod(
  15751. smalltalk.method({
  15752. selector: "setCurrent:",
  15753. category: 'accessing',
  15754. fn: function (anHandler){
  15755. var self=this;
  15756. return smalltalk.withContext(function($ctx1) {
  15757. self["@current"]=anHandler;
  15758. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ProgressHandler.klass)})},
  15759. args: ["anHandler"],
  15760. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  15761. messageSends: [],
  15762. referencedClasses: []
  15763. }),
  15764. smalltalk.ProgressHandler.klass);
  15765. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Infrastructure');
  15766. smalltalk.Smalltalk.comment="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work.";
  15767. smalltalk.addMethod(
  15768. smalltalk.method({
  15769. selector: "addGlobalJsVariable:",
  15770. category: 'globals',
  15771. fn: function (aString){
  15772. var self=this;
  15773. return smalltalk.withContext(function($ctx1) {
  15774. _st(self._globalJsVariables())._add_(aString);
  15775. return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  15776. args: ["aString"],
  15777. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  15778. messageSends: ["add:", "globalJsVariables"],
  15779. referencedClasses: []
  15780. }),
  15781. smalltalk.Smalltalk);
  15782. smalltalk.addMethod(
  15783. smalltalk.method({
  15784. selector: "amdRequire",
  15785. category: 'accessing amd',
  15786. fn: function (){
  15787. var self=this;
  15788. return smalltalk.withContext(function($ctx1) {
  15789. var $1;
  15790. $1=self._at_("amdRequire");
  15791. return $1;
  15792. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},smalltalk.Smalltalk)})},
  15793. args: [],
  15794. source: "amdRequire\x0a\x09^ self at: 'amdRequire'",
  15795. messageSends: ["at:"],
  15796. referencedClasses: []
  15797. }),
  15798. smalltalk.Smalltalk);
  15799. smalltalk.addMethod(
  15800. smalltalk.method({
  15801. selector: "asSmalltalkException:",
  15802. category: 'error handling',
  15803. fn: function (anObject){
  15804. var self=this;
  15805. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  15806. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  15807. return smalltalk.withContext(function($ctx1) {
  15808. var $2,$1;
  15809. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  15810. return smalltalk.withContext(function($ctx2) {
  15811. return _st(anObject)._isKindOf_($Error());
  15812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15813. if(smalltalk.assert($2)){
  15814. $1=anObject;
  15815. } else {
  15816. $1=_st($JavaScriptException())._on_(anObject);
  15817. };
  15818. return $1;
  15819. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
  15820. args: ["anObject"],
  15821. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  15822. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
  15823. referencedClasses: ["Error", "JavaScriptException"]
  15824. }),
  15825. smalltalk.Smalltalk);
  15826. smalltalk.addMethod(
  15827. smalltalk.method({
  15828. selector: "at:",
  15829. category: 'accessing',
  15830. fn: function (aString){
  15831. var self=this;
  15832. return smalltalk.withContext(function($ctx1) {
  15833. var $1;
  15834. $1=self._basicAt_(aString);
  15835. return $1;
  15836. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
  15837. args: ["aString"],
  15838. source: "at: aString\x0a\x09^ self basicAt: aString",
  15839. messageSends: ["basicAt:"],
  15840. referencedClasses: []
  15841. }),
  15842. smalltalk.Smalltalk);
  15843. smalltalk.addMethod(
  15844. smalltalk.method({
  15845. selector: "at:ifAbsent:",
  15846. category: 'accessing',
  15847. fn: function (aKey,aBlock){
  15848. var self=this;
  15849. return smalltalk.withContext(function($ctx1) {
  15850. var $2,$1;
  15851. $2=self._includesKey_(aKey);
  15852. $1=_st($2)._ifTrue_ifFalse_((function(){
  15853. return smalltalk.withContext(function($ctx2) {
  15854. return self._at_(aKey);
  15855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),aBlock);
  15856. return $1;
  15857. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Smalltalk)})},
  15858. args: ["aKey", "aBlock"],
  15859. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [self at: aKey]\x0a\x09\x09ifFalse: aBlock",
  15860. messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:"],
  15861. referencedClasses: []
  15862. }),
  15863. smalltalk.Smalltalk);
  15864. smalltalk.addMethod(
  15865. smalltalk.method({
  15866. selector: "at:put:",
  15867. category: 'accessing',
  15868. fn: function (aString,anObject){
  15869. var self=this;
  15870. return smalltalk.withContext(function($ctx1) {
  15871. var $1;
  15872. $1=self._basicAt_put_(aString,anObject);
  15873. return $1;
  15874. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.Smalltalk)})},
  15875. args: ["aString", "anObject"],
  15876. source: "at: aString put: anObject\x0a\x09^ self basicAt: aString put: anObject",
  15877. messageSends: ["basicAt:put:"],
  15878. referencedClasses: []
  15879. }),
  15880. smalltalk.Smalltalk);
  15881. smalltalk.addMethod(
  15882. smalltalk.method({
  15883. selector: "basicParse:",
  15884. category: 'private',
  15885. fn: function (aString){
  15886. var self=this;
  15887. return smalltalk.withContext(function($ctx1) {
  15888. return smalltalk.parser.parse(aString);
  15889. return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
  15890. args: ["aString"],
  15891. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  15892. messageSends: [],
  15893. referencedClasses: []
  15894. }),
  15895. smalltalk.Smalltalk);
  15896. smalltalk.addMethod(
  15897. smalltalk.method({
  15898. selector: "classes",
  15899. category: 'classes',
  15900. fn: function (){
  15901. var self=this;
  15902. return smalltalk.withContext(function($ctx1) {
  15903. return self.classes();
  15904. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
  15905. args: [],
  15906. source: "classes\x0a\x09<return self.classes()>",
  15907. messageSends: [],
  15908. referencedClasses: []
  15909. }),
  15910. smalltalk.Smalltalk);
  15911. smalltalk.addMethod(
  15912. smalltalk.method({
  15913. selector: "createPackage:",
  15914. category: 'packages',
  15915. fn: function (packageName){
  15916. var self=this;
  15917. return smalltalk.withContext(function($ctx1) {
  15918. return smalltalk.addPackage(packageName);
  15919. return self}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  15920. args: ["packageName"],
  15921. source: "createPackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  15922. messageSends: [],
  15923. referencedClasses: []
  15924. }),
  15925. smalltalk.Smalltalk);
  15926. smalltalk.addMethod(
  15927. smalltalk.method({
  15928. selector: "createPackage:properties:",
  15929. category: 'private',
  15930. fn: function (packageName,aDict){
  15931. var self=this;
  15932. return smalltalk.withContext(function($ctx1) {
  15933. var $1,$2;
  15934. self._deprecatedAPI();
  15935. $1=_st(aDict)._isEmpty();
  15936. if(! smalltalk.assert($1)){
  15937. self._error_("createPackage:properties: called with nonempty properties");
  15938. };
  15939. $2=self._createPackage_(packageName);
  15940. return $2;
  15941. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
  15942. args: ["packageName", "aDict"],
  15943. source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
  15944. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
  15945. referencedClasses: []
  15946. }),
  15947. smalltalk.Smalltalk);
  15948. smalltalk.addMethod(
  15949. smalltalk.method({
  15950. selector: "defaultAmdNamespace",
  15951. category: 'accessing amd',
  15952. fn: function (){
  15953. var self=this;
  15954. return smalltalk.withContext(function($ctx1) {
  15955. var $1;
  15956. $1=self._at_("defaultAmdNamespace");
  15957. return $1;
  15958. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},smalltalk.Smalltalk)})},
  15959. args: [],
  15960. source: "defaultAmdNamespace\x0a\x09^ self at: 'defaultAmdNamespace'",
  15961. messageSends: ["at:"],
  15962. referencedClasses: []
  15963. }),
  15964. smalltalk.Smalltalk);
  15965. smalltalk.addMethod(
  15966. smalltalk.method({
  15967. selector: "defaultAmdNamespace:",
  15968. category: 'accessing amd',
  15969. fn: function (aString){
  15970. var self=this;
  15971. return smalltalk.withContext(function($ctx1) {
  15972. self._at_put_("defaultAmdNamespace",aString);
  15973. return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},smalltalk.Smalltalk)})},
  15974. args: ["aString"],
  15975. source: "defaultAmdNamespace: aString\x0a\x09self at: 'defaultAmdNamespace' put: aString",
  15976. messageSends: ["at:put:"],
  15977. referencedClasses: []
  15978. }),
  15979. smalltalk.Smalltalk);
  15980. smalltalk.addMethod(
  15981. smalltalk.method({
  15982. selector: "deleteClass:",
  15983. category: 'private',
  15984. fn: function (aClass){
  15985. var self=this;
  15986. return smalltalk.withContext(function($ctx1) {
  15987. self.removeClass(aClass);
  15988. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  15989. args: ["aClass"],
  15990. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<self.removeClass(aClass)>",
  15991. messageSends: [],
  15992. referencedClasses: []
  15993. }),
  15994. smalltalk.Smalltalk);
  15995. smalltalk.addMethod(
  15996. smalltalk.method({
  15997. selector: "deleteGlobalJsVariable:",
  15998. category: 'globals',
  15999. fn: function (aString){
  16000. var self=this;
  16001. return smalltalk.withContext(function($ctx1) {
  16002. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  16003. return smalltalk.withContext(function($ctx2) {
  16004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  16005. return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
  16006. args: ["aString"],
  16007. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  16008. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  16009. referencedClasses: []
  16010. }),
  16011. smalltalk.Smalltalk);
  16012. smalltalk.addMethod(
  16013. smalltalk.method({
  16014. selector: "deletePackage:",
  16015. category: 'private',
  16016. fn: function (packageName){
  16017. var self=this;
  16018. return smalltalk.withContext(function($ctx1) {
  16019. delete self.packages[packageName];
  16020. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
  16021. args: ["packageName"],
  16022. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete self.packages[packageName]>",
  16023. messageSends: [],
  16024. referencedClasses: []
  16025. }),
  16026. smalltalk.Smalltalk);
  16027. smalltalk.addMethod(
  16028. smalltalk.method({
  16029. selector: "globalJsVariables",
  16030. category: 'globals',
  16031. fn: function (){
  16032. var self=this;
  16033. return smalltalk.withContext(function($ctx1) {
  16034. return self.globalJsVariables;
  16035. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},smalltalk.Smalltalk)})},
  16036. args: [],
  16037. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return self.globalJsVariables>",
  16038. messageSends: [],
  16039. referencedClasses: []
  16040. }),
  16041. smalltalk.Smalltalk);
  16042. smalltalk.addMethod(
  16043. smalltalk.method({
  16044. selector: "includesKey:",
  16045. category: 'accessing',
  16046. fn: function (aKey){
  16047. var self=this;
  16048. return smalltalk.withContext(function($ctx1) {
  16049. return self.hasOwnProperty(aKey);
  16050. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Smalltalk)})},
  16051. args: ["aKey"],
  16052. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  16053. messageSends: [],
  16054. referencedClasses: []
  16055. }),
  16056. smalltalk.Smalltalk);
  16057. smalltalk.addMethod(
  16058. smalltalk.method({
  16059. selector: "isSmalltalkObject:",
  16060. category: 'testing',
  16061. fn: function (anObject){
  16062. var self=this;
  16063. return smalltalk.withContext(function($ctx1) {
  16064. return typeof anObject.klass !== 'undefined';
  16065. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  16066. args: ["anObject"],
  16067. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
  16068. messageSends: [],
  16069. referencedClasses: []
  16070. }),
  16071. smalltalk.Smalltalk);
  16072. smalltalk.addMethod(
  16073. smalltalk.method({
  16074. selector: "packageAt:",
  16075. category: 'packages',
  16076. fn: function (packageName){
  16077. var self=this;
  16078. return smalltalk.withContext(function($ctx1) {
  16079. return self.packages[packageName];
  16080. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
  16081. args: ["packageName"],
  16082. source: "packageAt: packageName\x0a\x09<return self.packages[packageName]>",
  16083. messageSends: [],
  16084. referencedClasses: []
  16085. }),
  16086. smalltalk.Smalltalk);
  16087. smalltalk.addMethod(
  16088. smalltalk.method({
  16089. selector: "packageAt:ifAbsent:",
  16090. category: 'packages',
  16091. fn: function (packageName,aBlock){
  16092. var self=this;
  16093. return smalltalk.withContext(function($ctx1) {
  16094. var $2,$1;
  16095. $2=self._packageAt_(packageName);
  16096. $1=_st($2)._ifNil_(aBlock);
  16097. return $1;
  16098. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
  16099. args: ["packageName", "aBlock"],
  16100. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^(self packageAt: packageName) ifNil: aBlock",
  16101. messageSends: ["ifNil:", "packageAt:"],
  16102. referencedClasses: []
  16103. }),
  16104. smalltalk.Smalltalk);
  16105. smalltalk.addMethod(
  16106. smalltalk.method({
  16107. selector: "packages",
  16108. category: 'packages',
  16109. fn: function (){
  16110. var self=this;
  16111. return smalltalk.withContext(function($ctx1) {
  16112. return self.packages.all();
  16113. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
  16114. args: [],
  16115. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  16116. messageSends: [],
  16117. referencedClasses: []
  16118. }),
  16119. smalltalk.Smalltalk);
  16120. smalltalk.addMethod(
  16121. smalltalk.method({
  16122. selector: "parse:",
  16123. category: 'accessing',
  16124. fn: function (aString){
  16125. var self=this;
  16126. var result;
  16127. return smalltalk.withContext(function($ctx1) {
  16128. var $2,$3,$1;
  16129. self._try_catch_((function(){
  16130. return smalltalk.withContext(function($ctx2) {
  16131. result=self._basicParse_(aString);
  16132. return result;
  16133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(ex){
  16134. return smalltalk.withContext(function($ctx2) {
  16135. return _st(self._parseError_parsing_(ex,aString))._signal();
  16136. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  16137. $2=result;
  16138. _st($2)._source_(aString);
  16139. $3=_st($2)._yourself();
  16140. $1=$3;
  16141. return $1;
  16142. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
  16143. args: ["aString"],
  16144. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [result := self basicParse: aString] \x0a\x09\x09catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  16145. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  16146. referencedClasses: []
  16147. }),
  16148. smalltalk.Smalltalk);
  16149. smalltalk.addMethod(
  16150. smalltalk.method({
  16151. selector: "parseError:parsing:",
  16152. category: 'error handling',
  16153. fn: function (anException,aString){
  16154. var self=this;
  16155. function $ParseError(){return smalltalk.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  16156. return smalltalk.withContext(function($ctx1) {
  16157. var $1;
  16158. $1=_st(_st($ParseError())._new())._messageText_(_st(_st(_st(_st("Parse error on line ".__comma(_st(anException)._basicAt_("line"))).__comma(" column ")).__comma(_st(anException)._basicAt_("column"))).__comma(" : Unexpected character ")).__comma(_st(anException)._basicAt_("found")));
  16159. return $1;
  16160. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
  16161. args: ["anException", "aString"],
  16162. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  16163. messageSends: ["messageText:", "new", ",", "basicAt:"],
  16164. referencedClasses: ["ParseError"]
  16165. }),
  16166. smalltalk.Smalltalk);
  16167. smalltalk.addMethod(
  16168. smalltalk.method({
  16169. selector: "pseudoVariableNames",
  16170. category: 'accessing',
  16171. fn: function (){
  16172. var self=this;
  16173. return smalltalk.withContext(function($ctx1) {
  16174. var $1;
  16175. $1=["self", "super", "nil", "true", "false", "thisContext"];
  16176. return $1;
  16177. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
  16178. args: [],
  16179. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  16180. messageSends: [],
  16181. referencedClasses: []
  16182. }),
  16183. smalltalk.Smalltalk);
  16184. smalltalk.addMethod(
  16185. smalltalk.method({
  16186. selector: "readJSObject:",
  16187. category: 'accessing',
  16188. fn: function (anObject){
  16189. var self=this;
  16190. return smalltalk.withContext(function($ctx1) {
  16191. return self.readJSObject(anObject);
  16192. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
  16193. args: ["anObject"],
  16194. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  16195. messageSends: [],
  16196. referencedClasses: []
  16197. }),
  16198. smalltalk.Smalltalk);
  16199. smalltalk.addMethod(
  16200. smalltalk.method({
  16201. selector: "removeClass:",
  16202. category: 'classes',
  16203. fn: function (aClass){
  16204. var self=this;
  16205. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  16206. function $ClassRemoved(){return smalltalk.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  16207. return smalltalk.withContext(function($ctx1) {
  16208. var $1,$2,$3;
  16209. $1=_st(aClass)._isMetaclass();
  16210. if(smalltalk.assert($1)){
  16211. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  16212. };
  16213. self._deleteClass_(aClass);
  16214. $2=_st($ClassRemoved())._new();
  16215. _st($2)._theClass_(aClass);
  16216. $3=_st($2)._yourself();
  16217. _st(_st($SystemAnnouncer())._current())._announce_($3);
  16218. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
  16219. args: ["aClass"],
  16220. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!'].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  16221. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
  16222. referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
  16223. }),
  16224. smalltalk.Smalltalk);
  16225. smalltalk.addMethod(
  16226. smalltalk.method({
  16227. selector: "removePackage:",
  16228. category: 'packages',
  16229. fn: function (packageName){
  16230. var self=this;
  16231. var pkg;
  16232. return smalltalk.withContext(function($ctx1) {
  16233. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  16234. return smalltalk.withContext(function($ctx2) {
  16235. return self._error_("Missing package: ".__comma(packageName));
  16236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  16237. _st(_st(pkg)._classes())._do_((function(each){
  16238. return smalltalk.withContext(function($ctx2) {
  16239. return self._removeClass_(each);
  16240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  16241. self._deletePackage_(packageName);
  16242. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
  16243. args: ["packageName"],
  16244. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09pkg classes do: [:each |\x0a\x09\x09\x09self removeClass: each].\x0a\x09self deletePackage: packageName",
  16245. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  16246. referencedClasses: []
  16247. }),
  16248. smalltalk.Smalltalk);
  16249. smalltalk.addMethod(
  16250. smalltalk.method({
  16251. selector: "renamePackage:to:",
  16252. category: 'packages',
  16253. fn: function (packageName,newName){
  16254. var self=this;
  16255. var pkg;
  16256. return smalltalk.withContext(function($ctx1) {
  16257. var $1;
  16258. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  16259. return smalltalk.withContext(function($ctx2) {
  16260. return self._error_("Missing package: ".__comma(packageName));
  16261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  16262. $1=self._packageAt_(newName);
  16263. if(($receiver = $1) == nil || $receiver == null){
  16264. $1;
  16265. } else {
  16266. self._error_("Already exists a package called: ".__comma(newName));
  16267. };
  16268. _st(self._at_("packages"))._at_put_(newName,pkg);
  16269. _st(pkg)._name_(newName);
  16270. self._deletePackage_(packageName);
  16271. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
  16272. args: ["packageName", "newName"],
  16273. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].\x0a\x09(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].\x0a\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  16274. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
  16275. referencedClasses: []
  16276. }),
  16277. smalltalk.Smalltalk);
  16278. smalltalk.addMethod(
  16279. smalltalk.method({
  16280. selector: "reservedWords",
  16281. category: 'accessing',
  16282. fn: function (){
  16283. var self=this;
  16284. return smalltalk.withContext(function($ctx1) {
  16285. return self.reservedWords;
  16286. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
  16287. args: [],
  16288. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  16289. messageSends: [],
  16290. referencedClasses: []
  16291. }),
  16292. smalltalk.Smalltalk);
  16293. smalltalk.addMethod(
  16294. smalltalk.method({
  16295. selector: "version",
  16296. category: 'accessing',
  16297. fn: function (){
  16298. var self=this;
  16299. return smalltalk.withContext(function($ctx1) {
  16300. return "0.12.0-pre";
  16301. }, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
  16302. args: [],
  16303. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.12.0-pre'",
  16304. messageSends: [],
  16305. referencedClasses: []
  16306. }),
  16307. smalltalk.Smalltalk);
  16308. smalltalk.addMethod(
  16309. smalltalk.method({
  16310. selector: "current",
  16311. category: 'accessing',
  16312. fn: function (){
  16313. var self=this;
  16314. return smalltalk.withContext(function($ctx1) {
  16315. return smalltalk;
  16316. return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
  16317. args: [],
  16318. source: "current\x0a\x09<return smalltalk>",
  16319. messageSends: [],
  16320. referencedClasses: []
  16321. }),
  16322. smalltalk.Smalltalk.klass);
  16323. smalltalk.addMethod(
  16324. smalltalk.method({
  16325. selector: "do:displayingProgress:",
  16326. category: '*Kernel-Infrastructure',
  16327. fn: function (aBlock,aString){
  16328. var self=this;
  16329. function $ProgressHandler(){return smalltalk.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  16330. return smalltalk.withContext(function($ctx1) {
  16331. _st(_st($ProgressHandler())._current())._do_on_displaying_(aBlock,self,aString);
  16332. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},smalltalk.SequenceableCollection)})},
  16333. args: ["aBlock", "aString"],
  16334. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler current\x0a\x09\x09do: aBlock on: self displaying: aString",
  16335. messageSends: ["do:on:displaying:", "current"],
  16336. referencedClasses: ["ProgressHandler"]
  16337. }),
  16338. smalltalk.SequenceableCollection);
  16339. smalltalk.addMethod(
  16340. smalltalk.method({
  16341. selector: "asJavaScriptSelector",
  16342. category: '*Kernel-Infrastructure',
  16343. fn: function (){
  16344. var self=this;
  16345. return smalltalk.withContext(function($ctx1) {
  16346. var $1;
  16347. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  16348. return $1;
  16349. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},smalltalk.String)})},
  16350. args: [],
  16351. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  16352. messageSends: ["replace:with:"],
  16353. referencedClasses: []
  16354. }),
  16355. smalltalk.String);
  16356. });
  16357. define("amber_core/Kernel-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  16358. smalltalk.addPackage('Kernel-Exceptions');
  16359. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16360. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  16361. smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  16362. smalltalk.addMethod(
  16363. smalltalk.method({
  16364. selector: "context",
  16365. category: 'accessing',
  16366. fn: function (){
  16367. var self=this;
  16368. return smalltalk.withContext(function($ctx1) {
  16369. return self.context;
  16370. return self}, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Error)})},
  16371. args: [],
  16372. source: "context\x0a\x09<return self.context>",
  16373. messageSends: [],
  16374. referencedClasses: []
  16375. }),
  16376. smalltalk.Error);
  16377. smalltalk.addMethod(
  16378. smalltalk.method({
  16379. selector: "initialize",
  16380. category: 'initialization',
  16381. fn: function (){
  16382. var self=this;
  16383. return smalltalk.withContext(function($ctx1) {
  16384. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  16385. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Error)})},
  16386. args: [],
  16387. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  16388. messageSends: ["messageText:", ",", "name", "class"],
  16389. referencedClasses: []
  16390. }),
  16391. smalltalk.Error);
  16392. smalltalk.addMethod(
  16393. smalltalk.method({
  16394. selector: "isSmalltalkError",
  16395. category: 'testing',
  16396. fn: function (){
  16397. var self=this;
  16398. return smalltalk.withContext(function($ctx1) {
  16399. return self.smalltalkError === true;
  16400. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},smalltalk.Error)})},
  16401. args: [],
  16402. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  16403. messageSends: [],
  16404. referencedClasses: []
  16405. }),
  16406. smalltalk.Error);
  16407. smalltalk.addMethod(
  16408. smalltalk.method({
  16409. selector: "jsStack",
  16410. category: 'accessing',
  16411. fn: function (){
  16412. var self=this;
  16413. return smalltalk.withContext(function($ctx1) {
  16414. return self.stack;
  16415. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},smalltalk.Error)})},
  16416. args: [],
  16417. source: "jsStack\x0a\x09<return self.stack>",
  16418. messageSends: [],
  16419. referencedClasses: []
  16420. }),
  16421. smalltalk.Error);
  16422. smalltalk.addMethod(
  16423. smalltalk.method({
  16424. selector: "messageText",
  16425. category: 'accessing',
  16426. fn: function (){
  16427. var self=this;
  16428. return smalltalk.withContext(function($ctx1) {
  16429. var $1;
  16430. $1=self["@messageText"];
  16431. return $1;
  16432. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.Error)})},
  16433. args: [],
  16434. source: "messageText\x0a\x09^messageText",
  16435. messageSends: [],
  16436. referencedClasses: []
  16437. }),
  16438. smalltalk.Error);
  16439. smalltalk.addMethod(
  16440. smalltalk.method({
  16441. selector: "messageText:",
  16442. category: 'accessing',
  16443. fn: function (aString){
  16444. var self=this;
  16445. return smalltalk.withContext(function($ctx1) {
  16446. self["@messageText"]=aString;
  16447. return self}, function($ctx1) {$ctx1.fill(self,"messageText:",{aString:aString},smalltalk.Error)})},
  16448. args: ["aString"],
  16449. source: "messageText: aString\x0a\x09messageText := aString",
  16450. messageSends: [],
  16451. referencedClasses: []
  16452. }),
  16453. smalltalk.Error);
  16454. smalltalk.addMethod(
  16455. smalltalk.method({
  16456. selector: "resignal",
  16457. category: 'signaling',
  16458. fn: function (){
  16459. var self=this;
  16460. return smalltalk.withContext(function($ctx1) {
  16461. throw(self);
  16462. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},smalltalk.Error)})},
  16463. args: [],
  16464. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<throw(self)>",
  16465. messageSends: [],
  16466. referencedClasses: []
  16467. }),
  16468. smalltalk.Error);
  16469. smalltalk.addMethod(
  16470. smalltalk.method({
  16471. selector: "signal",
  16472. category: 'signaling',
  16473. fn: function (){
  16474. var self=this;
  16475. return smalltalk.withContext(function($ctx1) {
  16476. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  16477. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error)})},
  16478. args: [],
  16479. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  16480. messageSends: [],
  16481. referencedClasses: []
  16482. }),
  16483. smalltalk.Error);
  16484. smalltalk.addMethod(
  16485. smalltalk.method({
  16486. selector: "signal:",
  16487. category: 'signaling',
  16488. fn: function (aString){
  16489. var self=this;
  16490. return smalltalk.withContext(function($ctx1) {
  16491. self._messageText_(aString);
  16492. self._signal();
  16493. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error)})},
  16494. args: ["aString"],
  16495. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  16496. messageSends: ["messageText:", "signal"],
  16497. referencedClasses: []
  16498. }),
  16499. smalltalk.Error);
  16500. smalltalk.addMethod(
  16501. smalltalk.method({
  16502. selector: "heliosClass",
  16503. category: 'helios',
  16504. fn: function (){
  16505. var self=this;
  16506. return smalltalk.withContext(function($ctx1) {
  16507. return "exception";
  16508. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.Error.klass)})},
  16509. args: [],
  16510. source: "heliosClass\x0a\x09^ 'exception'",
  16511. messageSends: [],
  16512. referencedClasses: []
  16513. }),
  16514. smalltalk.Error.klass);
  16515. smalltalk.addMethod(
  16516. smalltalk.method({
  16517. selector: "signal",
  16518. category: 'instance creation',
  16519. fn: function (){
  16520. var self=this;
  16521. return smalltalk.withContext(function($ctx1) {
  16522. var $1;
  16523. $1=_st(self._new())._signal();
  16524. return $1;
  16525. }, function($ctx1) {$ctx1.fill(self,"signal",{},smalltalk.Error.klass)})},
  16526. args: [],
  16527. source: "signal\x0a\x09^self new signal",
  16528. messageSends: ["signal", "new"],
  16529. referencedClasses: []
  16530. }),
  16531. smalltalk.Error.klass);
  16532. smalltalk.addMethod(
  16533. smalltalk.method({
  16534. selector: "signal:",
  16535. category: 'instance creation',
  16536. fn: function (aString){
  16537. var self=this;
  16538. return smalltalk.withContext(function($ctx1) {
  16539. var $1;
  16540. $1=_st(self._new())._signal_(aString);
  16541. return $1;
  16542. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},smalltalk.Error.klass)})},
  16543. args: ["aString"],
  16544. source: "signal: aString\x0a\x09\x09^self new\x0a\x09\x09signal: aString",
  16545. messageSends: ["signal:", "new"],
  16546. referencedClasses: []
  16547. }),
  16548. smalltalk.Error.klass);
  16549. smalltalk.addClass('JavaScriptException', smalltalk.Error, ['exception'], 'Kernel-Exceptions');
  16550. smalltalk.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  16551. smalltalk.addMethod(
  16552. smalltalk.method({
  16553. selector: "context:",
  16554. category: 'accessing',
  16555. fn: function (aMethodContext){
  16556. var self=this;
  16557. return smalltalk.withContext(function($ctx1) {
  16558. self.context = aMethodContext;
  16559. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.JavaScriptException)})},
  16560. args: ["aMethodContext"],
  16561. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  16562. messageSends: [],
  16563. referencedClasses: []
  16564. }),
  16565. smalltalk.JavaScriptException);
  16566. smalltalk.addMethod(
  16567. smalltalk.method({
  16568. selector: "exception",
  16569. category: 'accessing',
  16570. fn: function (){
  16571. var self=this;
  16572. return smalltalk.withContext(function($ctx1) {
  16573. var $1;
  16574. $1=self["@exception"];
  16575. return $1;
  16576. }, function($ctx1) {$ctx1.fill(self,"exception",{},smalltalk.JavaScriptException)})},
  16577. args: [],
  16578. source: "exception\x0a\x09^ exception",
  16579. messageSends: [],
  16580. referencedClasses: []
  16581. }),
  16582. smalltalk.JavaScriptException);
  16583. smalltalk.addMethod(
  16584. smalltalk.method({
  16585. selector: "exception:",
  16586. category: 'accessing',
  16587. fn: function (anException){
  16588. var self=this;
  16589. return smalltalk.withContext(function($ctx1) {
  16590. self["@exception"]=anException;
  16591. return self}, function($ctx1) {$ctx1.fill(self,"exception:",{anException:anException},smalltalk.JavaScriptException)})},
  16592. args: ["anException"],
  16593. source: "exception: anException\x0a\x09exception := anException",
  16594. messageSends: [],
  16595. referencedClasses: []
  16596. }),
  16597. smalltalk.JavaScriptException);
  16598. smalltalk.addMethod(
  16599. smalltalk.method({
  16600. selector: "messageText",
  16601. category: 'accessing',
  16602. fn: function (){
  16603. var self=this;
  16604. return smalltalk.withContext(function($ctx1) {
  16605. return 'JavaScript exception: ' + self["@exception"].toString();
  16606. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.JavaScriptException)})},
  16607. args: [],
  16608. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  16609. messageSends: [],
  16610. referencedClasses: []
  16611. }),
  16612. smalltalk.JavaScriptException);
  16613. smalltalk.addMethod(
  16614. smalltalk.method({
  16615. selector: "on:",
  16616. category: 'instance creation',
  16617. fn: function (anException){
  16618. var self=this;
  16619. return smalltalk.withContext(function($ctx1) {
  16620. var $2,$3,$1;
  16621. $2=self._new();
  16622. _st($2)._exception_(anException);
  16623. $3=_st($2)._yourself();
  16624. $1=$3;
  16625. return $1;
  16626. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},smalltalk.JavaScriptException.klass)})},
  16627. args: ["anException"],
  16628. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  16629. messageSends: ["exception:", "new", "yourself"],
  16630. referencedClasses: []
  16631. }),
  16632. smalltalk.JavaScriptException.klass);
  16633. smalltalk.addMethod(
  16634. smalltalk.method({
  16635. selector: "on:context:",
  16636. category: 'instance creation',
  16637. fn: function (anException,aMethodContext){
  16638. var self=this;
  16639. return smalltalk.withContext(function($ctx1) {
  16640. var $2,$3,$1;
  16641. $2=self._new();
  16642. _st($2)._exception_(anException);
  16643. _st($2)._context_(aMethodContext);
  16644. $3=_st($2)._yourself();
  16645. $1=$3;
  16646. return $1;
  16647. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},smalltalk.JavaScriptException.klass)})},
  16648. args: ["anException", "aMethodContext"],
  16649. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  16650. messageSends: ["exception:", "new", "context:", "yourself"],
  16651. referencedClasses: []
  16652. }),
  16653. smalltalk.JavaScriptException.klass);
  16654. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  16655. smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  16656. smalltalk.addMethod(
  16657. smalltalk.method({
  16658. selector: "message",
  16659. category: 'accessing',
  16660. fn: function (){
  16661. var self=this;
  16662. return smalltalk.withContext(function($ctx1) {
  16663. var $1;
  16664. $1=self["@message"];
  16665. return $1;
  16666. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.MessageNotUnderstood)})},
  16667. args: [],
  16668. source: "message\x0a\x09^message",
  16669. messageSends: [],
  16670. referencedClasses: []
  16671. }),
  16672. smalltalk.MessageNotUnderstood);
  16673. smalltalk.addMethod(
  16674. smalltalk.method({
  16675. selector: "message:",
  16676. category: 'accessing',
  16677. fn: function (aMessage){
  16678. var self=this;
  16679. return smalltalk.withContext(function($ctx1) {
  16680. self["@message"]=aMessage;
  16681. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aMessage:aMessage},smalltalk.MessageNotUnderstood)})},
  16682. args: ["aMessage"],
  16683. source: "message: aMessage\x0a\x09message := aMessage",
  16684. messageSends: [],
  16685. referencedClasses: []
  16686. }),
  16687. smalltalk.MessageNotUnderstood);
  16688. smalltalk.addMethod(
  16689. smalltalk.method({
  16690. selector: "messageText",
  16691. category: 'accessing',
  16692. fn: function (){
  16693. var self=this;
  16694. return smalltalk.withContext(function($ctx1) {
  16695. var $1;
  16696. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  16697. return $1;
  16698. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.MessageNotUnderstood)})},
  16699. args: [],
  16700. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  16701. messageSends: [",", "asString", "receiver", "selector", "message"],
  16702. referencedClasses: []
  16703. }),
  16704. smalltalk.MessageNotUnderstood);
  16705. smalltalk.addMethod(
  16706. smalltalk.method({
  16707. selector: "receiver",
  16708. category: 'accessing',
  16709. fn: function (){
  16710. var self=this;
  16711. return smalltalk.withContext(function($ctx1) {
  16712. var $1;
  16713. $1=self["@receiver"];
  16714. return $1;
  16715. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MessageNotUnderstood)})},
  16716. args: [],
  16717. source: "receiver\x0a\x09^receiver",
  16718. messageSends: [],
  16719. referencedClasses: []
  16720. }),
  16721. smalltalk.MessageNotUnderstood);
  16722. smalltalk.addMethod(
  16723. smalltalk.method({
  16724. selector: "receiver:",
  16725. category: 'accessing',
  16726. fn: function (anObject){
  16727. var self=this;
  16728. return smalltalk.withContext(function($ctx1) {
  16729. self["@receiver"]=anObject;
  16730. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.MessageNotUnderstood)})},
  16731. args: ["anObject"],
  16732. source: "receiver: anObject\x0a\x09receiver := anObject",
  16733. messageSends: [],
  16734. referencedClasses: []
  16735. }),
  16736. smalltalk.MessageNotUnderstood);
  16737. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  16738. smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  16739. smalltalk.addMethod(
  16740. smalltalk.method({
  16741. selector: "object",
  16742. category: 'accessing',
  16743. fn: function (){
  16744. var self=this;
  16745. return smalltalk.withContext(function($ctx1) {
  16746. var $1;
  16747. $1=self["@object"];
  16748. return $1;
  16749. }, function($ctx1) {$ctx1.fill(self,"object",{},smalltalk.NonBooleanReceiver)})},
  16750. args: [],
  16751. source: "object\x0a\x09^ object",
  16752. messageSends: [],
  16753. referencedClasses: []
  16754. }),
  16755. smalltalk.NonBooleanReceiver);
  16756. smalltalk.addMethod(
  16757. smalltalk.method({
  16758. selector: "object:",
  16759. category: 'accessing',
  16760. fn: function (anObject){
  16761. var self=this;
  16762. return smalltalk.withContext(function($ctx1) {
  16763. self["@object"]=anObject;
  16764. return self}, function($ctx1) {$ctx1.fill(self,"object:",{anObject:anObject},smalltalk.NonBooleanReceiver)})},
  16765. args: ["anObject"],
  16766. source: "object: anObject\x0a\x09object := anObject",
  16767. messageSends: [],
  16768. referencedClasses: []
  16769. }),
  16770. smalltalk.NonBooleanReceiver);
  16771. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  16772. smalltalk.ErrorHandler.comment="I am used to manage Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console.";
  16773. smalltalk.addMethod(
  16774. smalltalk.method({
  16775. selector: "handleError:",
  16776. category: 'error handling',
  16777. fn: function (anError){
  16778. var self=this;
  16779. return smalltalk.withContext(function($ctx1) {
  16780. var $1;
  16781. $1=_st(anError)._context();
  16782. if(($receiver = $1) == nil || $receiver == null){
  16783. $1;
  16784. } else {
  16785. self._logErrorContext_(_st(anError)._context());
  16786. };
  16787. self._logError_(anError);
  16788. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.ErrorHandler)})},
  16789. args: ["anError"],
  16790. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  16791. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
  16792. referencedClasses: []
  16793. }),
  16794. smalltalk.ErrorHandler);
  16795. smalltalk.addMethod(
  16796. smalltalk.method({
  16797. selector: "log:",
  16798. category: 'private',
  16799. fn: function (aString){
  16800. var self=this;
  16801. return smalltalk.withContext(function($ctx1) {
  16802. _st(console)._log_(aString);
  16803. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},smalltalk.ErrorHandler)})},
  16804. args: ["aString"],
  16805. source: "log: aString\x0a\x09console log: aString",
  16806. messageSends: ["log:"],
  16807. referencedClasses: []
  16808. }),
  16809. smalltalk.ErrorHandler);
  16810. smalltalk.addMethod(
  16811. smalltalk.method({
  16812. selector: "logContext:",
  16813. category: 'private',
  16814. fn: function (aContext){
  16815. var self=this;
  16816. return smalltalk.withContext(function($ctx1) {
  16817. var $1;
  16818. $1=_st(aContext)._home();
  16819. if(($receiver = $1) == nil || $receiver == null){
  16820. $1;
  16821. } else {
  16822. self._logContext_(_st(aContext)._home());
  16823. };
  16824. self._log_(_st(aContext)._asString());
  16825. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  16826. args: ["aContext"],
  16827. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext asString",
  16828. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"],
  16829. referencedClasses: []
  16830. }),
  16831. smalltalk.ErrorHandler);
  16832. smalltalk.addMethod(
  16833. smalltalk.method({
  16834. selector: "logError:",
  16835. category: 'private',
  16836. fn: function (anError){
  16837. var self=this;
  16838. return smalltalk.withContext(function($ctx1) {
  16839. self._log_(_st(anError)._messageText());
  16840. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},smalltalk.ErrorHandler)})},
  16841. args: ["anError"],
  16842. source: "logError: anError\x0a\x09self log: anError messageText",
  16843. messageSends: ["log:", "messageText"],
  16844. referencedClasses: []
  16845. }),
  16846. smalltalk.ErrorHandler);
  16847. smalltalk.addMethod(
  16848. smalltalk.method({
  16849. selector: "logErrorContext:",
  16850. category: 'private',
  16851. fn: function (aContext){
  16852. var self=this;
  16853. return smalltalk.withContext(function($ctx1) {
  16854. var $1,$2;
  16855. $1=aContext;
  16856. if(($receiver = $1) == nil || $receiver == null){
  16857. $1;
  16858. } else {
  16859. $2=_st(aContext)._home();
  16860. if(($receiver = $2) == nil || $receiver == null){
  16861. $2;
  16862. } else {
  16863. self._logContext_(_st(aContext)._home());
  16864. };
  16865. };
  16866. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},smalltalk.ErrorHandler)})},
  16867. args: ["aContext"],
  16868. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  16869. messageSends: ["ifNotNil:", "home", "logContext:"],
  16870. referencedClasses: []
  16871. }),
  16872. smalltalk.ErrorHandler);
  16873. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  16874. smalltalk.addMethod(
  16875. smalltalk.method({
  16876. selector: "current",
  16877. category: 'accessing',
  16878. fn: function (){
  16879. var self=this;
  16880. return smalltalk.withContext(function($ctx1) {
  16881. var $2,$1;
  16882. $2=self["@current"];
  16883. if(($receiver = $2) == nil || $receiver == null){
  16884. self["@current"]=self._new();
  16885. $1=self["@current"];
  16886. } else {
  16887. $1=$2;
  16888. };
  16889. return $1;
  16890. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.ErrorHandler.klass)})},
  16891. args: [],
  16892. source: "current\x0a\x09^current ifNil: [current := self new]",
  16893. messageSends: ["ifNil:", "new"],
  16894. referencedClasses: []
  16895. }),
  16896. smalltalk.ErrorHandler.klass);
  16897. smalltalk.addMethod(
  16898. smalltalk.method({
  16899. selector: "initialize",
  16900. category: 'initialization',
  16901. fn: function (){
  16902. var self=this;
  16903. return smalltalk.withContext(function($ctx1) {
  16904. self._register();
  16905. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ErrorHandler.klass)})},
  16906. args: [],
  16907. source: "initialize\x0a\x09self register",
  16908. messageSends: ["register"],
  16909. referencedClasses: []
  16910. }),
  16911. smalltalk.ErrorHandler.klass);
  16912. smalltalk.addMethod(
  16913. smalltalk.method({
  16914. selector: "register",
  16915. category: 'initialization',
  16916. fn: function (){
  16917. var self=this;
  16918. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  16919. return smalltalk.withContext(function($ctx1) {
  16920. _st($ErrorHandler())._setCurrent_(self._new());
  16921. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.ErrorHandler.klass)})},
  16922. args: [],
  16923. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  16924. messageSends: ["setCurrent:", "new"],
  16925. referencedClasses: ["ErrorHandler"]
  16926. }),
  16927. smalltalk.ErrorHandler.klass);
  16928. smalltalk.addMethod(
  16929. smalltalk.method({
  16930. selector: "setCurrent:",
  16931. category: 'accessing',
  16932. fn: function (anHandler){
  16933. var self=this;
  16934. return smalltalk.withContext(function($ctx1) {
  16935. self["@current"]=anHandler;
  16936. return self}, function($ctx1) {$ctx1.fill(self,"setCurrent:",{anHandler:anHandler},smalltalk.ErrorHandler.klass)})},
  16937. args: ["anHandler"],
  16938. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  16939. messageSends: [],
  16940. referencedClasses: []
  16941. }),
  16942. smalltalk.ErrorHandler.klass);
  16943. });
  16944. define("amber_core/Kernel-Transcript", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  16945. smalltalk.addPackage('Kernel-Transcript');
  16946. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16947. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  16948. smalltalk.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  16949. smalltalk.addMethod(
  16950. smalltalk.method({
  16951. selector: "clear",
  16952. category: 'printing',
  16953. fn: function (){
  16954. var self=this;
  16955. return smalltalk.withContext(function($ctx1) {
  16956. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
  16957. args: [],
  16958. source: "clear\x0a\x09\x22no op\x22",
  16959. messageSends: [],
  16960. referencedClasses: []
  16961. }),
  16962. smalltalk.ConsoleTranscript);
  16963. smalltalk.addMethod(
  16964. smalltalk.method({
  16965. selector: "cr",
  16966. category: 'printing',
  16967. fn: function (){
  16968. var self=this;
  16969. return smalltalk.withContext(function($ctx1) {
  16970. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
  16971. args: [],
  16972. source: "cr\x0a\x09\x22no op\x22",
  16973. messageSends: [],
  16974. referencedClasses: []
  16975. }),
  16976. smalltalk.ConsoleTranscript);
  16977. smalltalk.addMethod(
  16978. smalltalk.method({
  16979. selector: "open",
  16980. category: 'actions',
  16981. fn: function (){
  16982. var self=this;
  16983. return smalltalk.withContext(function($ctx1) {
  16984. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
  16985. args: [],
  16986. source: "open",
  16987. messageSends: [],
  16988. referencedClasses: []
  16989. }),
  16990. smalltalk.ConsoleTranscript);
  16991. smalltalk.addMethod(
  16992. smalltalk.method({
  16993. selector: "show:",
  16994. category: 'printing',
  16995. fn: function (anObject){
  16996. var self=this;
  16997. return smalltalk.withContext(function($ctx1) {
  16998. console.log(String(_st(anObject)._asString()));
  16999. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
  17000. args: ["anObject"],
  17001. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String(_st(anObject)._asString()))>",
  17002. messageSends: [],
  17003. referencedClasses: []
  17004. }),
  17005. smalltalk.ConsoleTranscript);
  17006. smalltalk.addMethod(
  17007. smalltalk.method({
  17008. selector: "initialize",
  17009. category: 'initialization',
  17010. fn: function (){
  17011. var self=this;
  17012. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  17013. return smalltalk.withContext(function($ctx1) {
  17014. _st($Transcript())._register_(self._new());
  17015. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
  17016. args: [],
  17017. source: "initialize\x0a\x09Transcript register: self new",
  17018. messageSends: ["register:", "new"],
  17019. referencedClasses: ["Transcript"]
  17020. }),
  17021. smalltalk.ConsoleTranscript.klass);
  17022. smalltalk.addClass('Transcript', smalltalk.Object, [], 'Kernel-Transcript');
  17023. smalltalk.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  17024. smalltalk.Transcript.klass.iVarNames = ['current'];
  17025. smalltalk.addMethod(
  17026. smalltalk.method({
  17027. selector: "clear",
  17028. category: 'printing',
  17029. fn: function (){
  17030. var self=this;
  17031. return smalltalk.withContext(function($ctx1) {
  17032. _st(self._current())._clear();
  17033. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
  17034. args: [],
  17035. source: "clear\x0a\x09self current clear",
  17036. messageSends: ["clear", "current"],
  17037. referencedClasses: []
  17038. }),
  17039. smalltalk.Transcript.klass);
  17040. smalltalk.addMethod(
  17041. smalltalk.method({
  17042. selector: "cr",
  17043. category: 'printing',
  17044. fn: function (){
  17045. var self=this;
  17046. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  17047. return smalltalk.withContext(function($ctx1) {
  17048. _st(self._current())._show_(_st($String())._cr());
  17049. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
  17050. args: [],
  17051. source: "cr\x0a\x09self current show: String cr",
  17052. messageSends: ["show:", "current", "cr"],
  17053. referencedClasses: ["String"]
  17054. }),
  17055. smalltalk.Transcript.klass);
  17056. smalltalk.addMethod(
  17057. smalltalk.method({
  17058. selector: "current",
  17059. category: 'instance creation',
  17060. fn: function (){
  17061. var self=this;
  17062. return smalltalk.withContext(function($ctx1) {
  17063. var $1;
  17064. $1=self["@current"];
  17065. return $1;
  17066. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
  17067. args: [],
  17068. source: "current\x0a\x09^current",
  17069. messageSends: [],
  17070. referencedClasses: []
  17071. }),
  17072. smalltalk.Transcript.klass);
  17073. smalltalk.addMethod(
  17074. smalltalk.method({
  17075. selector: "inspect:",
  17076. category: 'printing',
  17077. fn: function (anObject){
  17078. var self=this;
  17079. return smalltalk.withContext(function($ctx1) {
  17080. self._show_(anObject);
  17081. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Transcript.klass)})},
  17082. args: ["anObject"],
  17083. source: "inspect: anObject\x0a\x09self show: anObject",
  17084. messageSends: ["show:"],
  17085. referencedClasses: []
  17086. }),
  17087. smalltalk.Transcript.klass);
  17088. smalltalk.addMethod(
  17089. smalltalk.method({
  17090. selector: "new",
  17091. category: 'instance creation',
  17092. fn: function (){
  17093. var self=this;
  17094. return smalltalk.withContext(function($ctx1) {
  17095. self._shouldNotImplement();
  17096. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
  17097. args: [],
  17098. source: "new\x0a\x09self shouldNotImplement",
  17099. messageSends: ["shouldNotImplement"],
  17100. referencedClasses: []
  17101. }),
  17102. smalltalk.Transcript.klass);
  17103. smalltalk.addMethod(
  17104. smalltalk.method({
  17105. selector: "open",
  17106. category: 'instance creation',
  17107. fn: function (){
  17108. var self=this;
  17109. return smalltalk.withContext(function($ctx1) {
  17110. _st(self._current())._open();
  17111. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
  17112. args: [],
  17113. source: "open\x0a\x09self current open",
  17114. messageSends: ["open", "current"],
  17115. referencedClasses: []
  17116. }),
  17117. smalltalk.Transcript.klass);
  17118. smalltalk.addMethod(
  17119. smalltalk.method({
  17120. selector: "register:",
  17121. category: 'instance creation',
  17122. fn: function (aTranscript){
  17123. var self=this;
  17124. return smalltalk.withContext(function($ctx1) {
  17125. self["@current"]=aTranscript;
  17126. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
  17127. args: ["aTranscript"],
  17128. source: "register: aTranscript\x0a\x09current := aTranscript",
  17129. messageSends: [],
  17130. referencedClasses: []
  17131. }),
  17132. smalltalk.Transcript.klass);
  17133. smalltalk.addMethod(
  17134. smalltalk.method({
  17135. selector: "show:",
  17136. category: 'printing',
  17137. fn: function (anObject){
  17138. var self=this;
  17139. return smalltalk.withContext(function($ctx1) {
  17140. _st(self._current())._show_(anObject);
  17141. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
  17142. args: ["anObject"],
  17143. source: "show: anObject\x0a\x09self current show: anObject",
  17144. messageSends: ["show:", "current"],
  17145. referencedClasses: []
  17146. }),
  17147. smalltalk.Transcript.klass);
  17148. });
  17149. define("amber_core/Kernel-Announcements", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  17150. smalltalk.addPackage('Kernel-Announcements');
  17151. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17152. smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  17153. smalltalk.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  17154. smalltalk.addMethod(
  17155. smalltalk.method({
  17156. selector: "announcementClass",
  17157. category: 'accessing',
  17158. fn: function (){
  17159. var self=this;
  17160. return smalltalk.withContext(function($ctx1) {
  17161. var $1;
  17162. $1=self["@announcementClass"];
  17163. return $1;
  17164. }, function($ctx1) {$ctx1.fill(self,"announcementClass",{},smalltalk.AnnouncementSubscription)})},
  17165. args: [],
  17166. source: "announcementClass\x0a\x09^ announcementClass",
  17167. messageSends: [],
  17168. referencedClasses: []
  17169. }),
  17170. smalltalk.AnnouncementSubscription);
  17171. smalltalk.addMethod(
  17172. smalltalk.method({
  17173. selector: "announcementClass:",
  17174. category: 'accessing',
  17175. fn: function (aClass){
  17176. var self=this;
  17177. return smalltalk.withContext(function($ctx1) {
  17178. self["@announcementClass"]=aClass;
  17179. return self}, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},smalltalk.AnnouncementSubscription)})},
  17180. args: ["aClass"],
  17181. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  17182. messageSends: [],
  17183. referencedClasses: []
  17184. }),
  17185. smalltalk.AnnouncementSubscription);
  17186. smalltalk.addMethod(
  17187. smalltalk.method({
  17188. selector: "block",
  17189. category: 'accessing',
  17190. fn: function (){
  17191. var self=this;
  17192. return smalltalk.withContext(function($ctx1) {
  17193. var $1;
  17194. self._deprecatedAPI();
  17195. $1=self._valuable();
  17196. return $1;
  17197. }, function($ctx1) {$ctx1.fill(self,"block",{},smalltalk.AnnouncementSubscription)})},
  17198. args: [],
  17199. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  17200. messageSends: ["deprecatedAPI", "valuable"],
  17201. referencedClasses: []
  17202. }),
  17203. smalltalk.AnnouncementSubscription);
  17204. smalltalk.addMethod(
  17205. smalltalk.method({
  17206. selector: "block:",
  17207. category: 'accessing',
  17208. fn: function (aValuable){
  17209. var self=this;
  17210. return smalltalk.withContext(function($ctx1) {
  17211. self._deprecatedAPI();
  17212. self._valuable_(aValuable);
  17213. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  17214. args: ["aValuable"],
  17215. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  17216. messageSends: ["deprecatedAPI", "valuable:"],
  17217. referencedClasses: []
  17218. }),
  17219. smalltalk.AnnouncementSubscription);
  17220. smalltalk.addMethod(
  17221. smalltalk.method({
  17222. selector: "deliver:",
  17223. category: 'announcing',
  17224. fn: function (anAnnouncement){
  17225. var self=this;
  17226. return smalltalk.withContext(function($ctx1) {
  17227. var $1;
  17228. $1=self._handlesAnnouncement_(anAnnouncement);
  17229. if(smalltalk.assert($1)){
  17230. _st(self._valuable())._value_(anAnnouncement);
  17231. };
  17232. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  17233. args: ["anAnnouncement"],
  17234. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self valuable value: anAnnouncement]",
  17235. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"],
  17236. referencedClasses: []
  17237. }),
  17238. smalltalk.AnnouncementSubscription);
  17239. smalltalk.addMethod(
  17240. smalltalk.method({
  17241. selector: "handlesAnnouncement:",
  17242. category: 'announcing',
  17243. fn: function (anAnnouncement){
  17244. var self=this;
  17245. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17246. return smalltalk.withContext(function($ctx1) {
  17247. var $2,$1;
  17248. $2=_st(_st($Smalltalk())._current())._at_(_st(self._announcementClass())._name());
  17249. if(($receiver = $2) == nil || $receiver == null){
  17250. return false;
  17251. } else {
  17252. var class_;
  17253. class_=$receiver;
  17254. $1=_st(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  17255. };
  17256. return $1;
  17257. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
  17258. args: ["anAnnouncement"],
  17259. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk current at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  17260. messageSends: ["ifNil:ifNotNil:", "at:", "current", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
  17261. referencedClasses: ["Smalltalk"]
  17262. }),
  17263. smalltalk.AnnouncementSubscription);
  17264. smalltalk.addMethod(
  17265. smalltalk.method({
  17266. selector: "receiver",
  17267. category: 'accessing',
  17268. fn: function (){
  17269. var self=this;
  17270. return smalltalk.withContext(function($ctx1) {
  17271. var $1;
  17272. $1=_st(self._valuable())._receiver();
  17273. return $1;
  17274. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AnnouncementSubscription)})},
  17275. args: [],
  17276. source: "receiver\x0a\x09^ self valuable receiver",
  17277. messageSends: ["receiver", "valuable"],
  17278. referencedClasses: []
  17279. }),
  17280. smalltalk.AnnouncementSubscription);
  17281. smalltalk.addMethod(
  17282. smalltalk.method({
  17283. selector: "valuable",
  17284. category: 'accessing',
  17285. fn: function (){
  17286. var self=this;
  17287. return smalltalk.withContext(function($ctx1) {
  17288. var $1;
  17289. $1=self["@valuable"];
  17290. return $1;
  17291. }, function($ctx1) {$ctx1.fill(self,"valuable",{},smalltalk.AnnouncementSubscription)})},
  17292. args: [],
  17293. source: "valuable\x0a\x09^ valuable",
  17294. messageSends: [],
  17295. referencedClasses: []
  17296. }),
  17297. smalltalk.AnnouncementSubscription);
  17298. smalltalk.addMethod(
  17299. smalltalk.method({
  17300. selector: "valuable:",
  17301. category: 'accessing',
  17302. fn: function (aValuable){
  17303. var self=this;
  17304. return smalltalk.withContext(function($ctx1) {
  17305. self["@valuable"]=aValuable;
  17306. return self}, function($ctx1) {$ctx1.fill(self,"valuable:",{aValuable:aValuable},smalltalk.AnnouncementSubscription)})},
  17307. args: ["aValuable"],
  17308. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  17309. messageSends: [],
  17310. referencedClasses: []
  17311. }),
  17312. smalltalk.AnnouncementSubscription);
  17313. smalltalk.addClass('Announcer', smalltalk.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  17314. smalltalk.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  17315. smalltalk.addMethod(
  17316. smalltalk.method({
  17317. selector: "announce:",
  17318. category: 'announcing',
  17319. fn: function (anAnnouncement){
  17320. var self=this;
  17321. return smalltalk.withContext(function($ctx1) {
  17322. _st(self["@subscriptions"])._do_((function(each){
  17323. return smalltalk.withContext(function($ctx2) {
  17324. return _st(each)._deliver_(anAnnouncement);
  17325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17326. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},smalltalk.Announcer)})},
  17327. args: ["anAnnouncement"],
  17328. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  17329. messageSends: ["do:", "deliver:"],
  17330. referencedClasses: []
  17331. }),
  17332. smalltalk.Announcer);
  17333. smalltalk.addMethod(
  17334. smalltalk.method({
  17335. selector: "initialize",
  17336. category: 'initialization',
  17337. fn: function (){
  17338. var self=this;
  17339. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17340. return smalltalk.withContext(function($ctx1) {
  17341. smalltalk.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []);
  17342. self["@subscriptions"]=_st($OrderedCollection())._new();
  17343. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Announcer)})},
  17344. args: [],
  17345. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  17346. messageSends: ["initialize", "new"],
  17347. referencedClasses: ["OrderedCollection"]
  17348. }),
  17349. smalltalk.Announcer);
  17350. smalltalk.addMethod(
  17351. smalltalk.method({
  17352. selector: "on:do:",
  17353. category: 'subscribing',
  17354. fn: function (aClass,aBlock){
  17355. var self=this;
  17356. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  17357. return smalltalk.withContext(function($ctx1) {
  17358. var $1,$2;
  17359. $1=_st($AnnouncementSubscription())._new();
  17360. _st($1)._valuable_(aBlock);
  17361. _st($1)._announcementClass_(aClass);
  17362. $2=_st($1)._yourself();
  17363. _st(self["@subscriptions"])._add_($2);
  17364. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},smalltalk.Announcer)})},
  17365. args: ["aClass", "aBlock"],
  17366. source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  17367. messageSends: ["add:", "valuable:", "new", "announcementClass:", "yourself"],
  17368. referencedClasses: ["AnnouncementSubscription"]
  17369. }),
  17370. smalltalk.Announcer);
  17371. smalltalk.addMethod(
  17372. smalltalk.method({
  17373. selector: "on:send:to:",
  17374. category: 'subscribing',
  17375. fn: function (aClass,aSelector,anObject){
  17376. var self=this;
  17377. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  17378. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  17379. return smalltalk.withContext(function($ctx1) {
  17380. var $1,$2,$3,$4;
  17381. $1=_st($AnnouncementSubscription())._new();
  17382. $2=_st($MessageSend())._new();
  17383. _st($2)._receiver_(anObject);
  17384. _st($2)._selector_(aSelector);
  17385. $3=_st($2)._yourself();
  17386. _st($1)._valuable_($3);
  17387. _st($1)._announcementClass_(aClass);
  17388. $4=_st($1)._yourself();
  17389. _st(self["@subscriptions"])._add_($4);
  17390. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},smalltalk.Announcer)})},
  17391. args: ["aClass", "aSelector", "anObject"],
  17392. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  17393. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"],
  17394. referencedClasses: ["AnnouncementSubscription", "MessageSend"]
  17395. }),
  17396. smalltalk.Announcer);
  17397. smalltalk.addMethod(
  17398. smalltalk.method({
  17399. selector: "unsubscribe:",
  17400. category: 'subscribing',
  17401. fn: function (anObject){
  17402. var self=this;
  17403. return smalltalk.withContext(function($ctx1) {
  17404. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  17405. return smalltalk.withContext(function($ctx2) {
  17406. return _st(_st(each)._receiver()).__eq(anObject);
  17407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17408. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},smalltalk.Announcer)})},
  17409. args: ["anObject"],
  17410. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  17411. messageSends: ["reject:", "=", "receiver"],
  17412. referencedClasses: []
  17413. }),
  17414. smalltalk.Announcer);
  17415. smalltalk.addClass('SystemAnnouncer', smalltalk.Announcer, [], 'Kernel-Announcements');
  17416. smalltalk.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  17417. smalltalk.SystemAnnouncer.klass.iVarNames = ['current'];
  17418. smalltalk.addMethod(
  17419. smalltalk.method({
  17420. selector: "current",
  17421. category: 'accessing',
  17422. fn: function (){
  17423. var self=this;
  17424. return smalltalk.withContext(function($ctx1) {
  17425. var $2,$1;
  17426. $2=self["@current"];
  17427. if(($receiver = $2) == nil || $receiver == null){
  17428. self["@current"]=smalltalk.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []);
  17429. $1=self["@current"];
  17430. } else {
  17431. $1=$2;
  17432. };
  17433. return $1;
  17434. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SystemAnnouncer.klass)})},
  17435. args: [],
  17436. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  17437. messageSends: ["ifNil:", "new"],
  17438. referencedClasses: []
  17439. }),
  17440. smalltalk.SystemAnnouncer.klass);
  17441. smalltalk.addMethod(
  17442. smalltalk.method({
  17443. selector: "new",
  17444. category: 'instance creation',
  17445. fn: function (){
  17446. var self=this;
  17447. return smalltalk.withContext(function($ctx1) {
  17448. self._shouldNotImplement();
  17449. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SystemAnnouncer.klass)})},
  17450. args: [],
  17451. source: "new\x0a\x09self shouldNotImplement",
  17452. messageSends: ["shouldNotImplement"],
  17453. referencedClasses: []
  17454. }),
  17455. smalltalk.SystemAnnouncer.klass);
  17456. smalltalk.addClass('SystemAnnouncement', smalltalk.Object, ['theClass'], 'Kernel-Announcements');
  17457. smalltalk.SystemAnnouncement.comment="I am the superclass of all system announcements";
  17458. smalltalk.addMethod(
  17459. smalltalk.method({
  17460. selector: "theClass",
  17461. category: 'accessing',
  17462. fn: function (){
  17463. var self=this;
  17464. return smalltalk.withContext(function($ctx1) {
  17465. var $1;
  17466. $1=self["@theClass"];
  17467. return $1;
  17468. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SystemAnnouncement)})},
  17469. args: [],
  17470. source: "theClass\x0a\x09^ theClass",
  17471. messageSends: [],
  17472. referencedClasses: []
  17473. }),
  17474. smalltalk.SystemAnnouncement);
  17475. smalltalk.addMethod(
  17476. smalltalk.method({
  17477. selector: "theClass:",
  17478. category: 'accessing',
  17479. fn: function (aClass){
  17480. var self=this;
  17481. return smalltalk.withContext(function($ctx1) {
  17482. self["@theClass"]=aClass;
  17483. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SystemAnnouncement)})},
  17484. args: ["aClass"],
  17485. source: "theClass: aClass\x0a\x09theClass := aClass",
  17486. messageSends: [],
  17487. referencedClasses: []
  17488. }),
  17489. smalltalk.SystemAnnouncement);
  17490. smalltalk.addMethod(
  17491. smalltalk.method({
  17492. selector: "heliosClass",
  17493. category: 'helios',
  17494. fn: function (){
  17495. var self=this;
  17496. return smalltalk.withContext(function($ctx1) {
  17497. return "announcement";
  17498. }, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
  17499. args: [],
  17500. source: "heliosClass\x0a\x09^ 'announcement'",
  17501. messageSends: [],
  17502. referencedClasses: []
  17503. }),
  17504. smalltalk.SystemAnnouncement.klass);
  17505. smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  17506. smalltalk.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  17507. smalltalk.addMethod(
  17508. smalltalk.method({
  17509. selector: "theClass",
  17510. category: 'accessing',
  17511. fn: function (){
  17512. var self=this;
  17513. return smalltalk.withContext(function($ctx1) {
  17514. var $1;
  17515. $1=self["@theClass"];
  17516. return $1;
  17517. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassAnnouncement)})},
  17518. args: [],
  17519. source: "theClass\x0a\x09^ theClass",
  17520. messageSends: [],
  17521. referencedClasses: []
  17522. }),
  17523. smalltalk.ClassAnnouncement);
  17524. smalltalk.addMethod(
  17525. smalltalk.method({
  17526. selector: "theClass:",
  17527. category: 'accessing',
  17528. fn: function (aClass){
  17529. var self=this;
  17530. return smalltalk.withContext(function($ctx1) {
  17531. self["@theClass"]=aClass;
  17532. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassAnnouncement)})},
  17533. args: ["aClass"],
  17534. source: "theClass: aClass\x0a\x09theClass := aClass",
  17535. messageSends: [],
  17536. referencedClasses: []
  17537. }),
  17538. smalltalk.ClassAnnouncement);
  17539. smalltalk.addClass('ClassAdded', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  17540. smalltalk.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  17541. smalltalk.addClass('ClassCommentChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  17542. smalltalk.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  17543. smalltalk.addClass('ClassDefinitionChanged', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  17544. smalltalk.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  17545. smalltalk.addClass('ClassMigrated', smalltalk.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  17546. smalltalk.ClassMigrated.comment="I am emitted when a class is migrated.";
  17547. smalltalk.addMethod(
  17548. smalltalk.method({
  17549. selector: "oldClass",
  17550. category: 'accessing',
  17551. fn: function (){
  17552. var self=this;
  17553. return smalltalk.withContext(function($ctx1) {
  17554. var $1;
  17555. $1=self["@oldClass"];
  17556. return $1;
  17557. }, function($ctx1) {$ctx1.fill(self,"oldClass",{},smalltalk.ClassMigrated)})},
  17558. args: [],
  17559. source: "oldClass\x0a\x09^ oldClass",
  17560. messageSends: [],
  17561. referencedClasses: []
  17562. }),
  17563. smalltalk.ClassMigrated);
  17564. smalltalk.addMethod(
  17565. smalltalk.method({
  17566. selector: "oldClass:",
  17567. category: 'accessing',
  17568. fn: function (aClass){
  17569. var self=this;
  17570. return smalltalk.withContext(function($ctx1) {
  17571. self["@oldClass"]=aClass;
  17572. return self}, function($ctx1) {$ctx1.fill(self,"oldClass:",{aClass:aClass},smalltalk.ClassMigrated)})},
  17573. args: ["aClass"],
  17574. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  17575. messageSends: [],
  17576. referencedClasses: []
  17577. }),
  17578. smalltalk.ClassMigrated);
  17579. smalltalk.addClass('ClassMoved', smalltalk.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  17580. smalltalk.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  17581. smalltalk.addMethod(
  17582. smalltalk.method({
  17583. selector: "oldPackage",
  17584. category: 'accessing',
  17585. fn: function (){
  17586. var self=this;
  17587. return smalltalk.withContext(function($ctx1) {
  17588. var $1;
  17589. $1=self["@oldPackage"];
  17590. return $1;
  17591. }, function($ctx1) {$ctx1.fill(self,"oldPackage",{},smalltalk.ClassMoved)})},
  17592. args: [],
  17593. source: "oldPackage\x0a\x09^ oldPackage",
  17594. messageSends: [],
  17595. referencedClasses: []
  17596. }),
  17597. smalltalk.ClassMoved);
  17598. smalltalk.addMethod(
  17599. smalltalk.method({
  17600. selector: "oldPackage:",
  17601. category: 'accessing',
  17602. fn: function (aPackage){
  17603. var self=this;
  17604. return smalltalk.withContext(function($ctx1) {
  17605. self["@oldPackage"]=aPackage;
  17606. return self}, function($ctx1) {$ctx1.fill(self,"oldPackage:",{aPackage:aPackage},smalltalk.ClassMoved)})},
  17607. args: ["aPackage"],
  17608. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  17609. messageSends: [],
  17610. referencedClasses: []
  17611. }),
  17612. smalltalk.ClassMoved);
  17613. smalltalk.addClass('ClassRemoved', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  17614. smalltalk.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  17615. smalltalk.addClass('ClassRenamed', smalltalk.ClassAnnouncement, [], 'Kernel-Announcements');
  17616. smalltalk.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  17617. smalltalk.addClass('MethodAnnouncement', smalltalk.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  17618. smalltalk.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  17619. smalltalk.addMethod(
  17620. smalltalk.method({
  17621. selector: "method",
  17622. category: 'accessing',
  17623. fn: function (){
  17624. var self=this;
  17625. return smalltalk.withContext(function($ctx1) {
  17626. var $1;
  17627. $1=self["@method"];
  17628. return $1;
  17629. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodAnnouncement)})},
  17630. args: [],
  17631. source: "method\x0a\x09^ method",
  17632. messageSends: [],
  17633. referencedClasses: []
  17634. }),
  17635. smalltalk.MethodAnnouncement);
  17636. smalltalk.addMethod(
  17637. smalltalk.method({
  17638. selector: "method:",
  17639. category: 'accessing',
  17640. fn: function (aCompiledMethod){
  17641. var self=this;
  17642. return smalltalk.withContext(function($ctx1) {
  17643. self["@method"]=aCompiledMethod;
  17644. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.MethodAnnouncement)})},
  17645. args: ["aCompiledMethod"],
  17646. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  17647. messageSends: [],
  17648. referencedClasses: []
  17649. }),
  17650. smalltalk.MethodAnnouncement);
  17651. smalltalk.addClass('MethodAdded', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  17652. smalltalk.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  17653. smalltalk.addClass('MethodModified', smalltalk.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  17654. smalltalk.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  17655. smalltalk.addMethod(
  17656. smalltalk.method({
  17657. selector: "oldMethod",
  17658. category: 'accessing',
  17659. fn: function (){
  17660. var self=this;
  17661. return smalltalk.withContext(function($ctx1) {
  17662. var $1;
  17663. $1=self["@oldMethod"];
  17664. return $1;
  17665. }, function($ctx1) {$ctx1.fill(self,"oldMethod",{},smalltalk.MethodModified)})},
  17666. args: [],
  17667. source: "oldMethod\x0a\x09^ oldMethod",
  17668. messageSends: [],
  17669. referencedClasses: []
  17670. }),
  17671. smalltalk.MethodModified);
  17672. smalltalk.addMethod(
  17673. smalltalk.method({
  17674. selector: "oldMethod:",
  17675. category: 'accessing',
  17676. fn: function (aMethod){
  17677. var self=this;
  17678. return smalltalk.withContext(function($ctx1) {
  17679. self["@oldMethod"]=aMethod;
  17680. return self}, function($ctx1) {$ctx1.fill(self,"oldMethod:",{aMethod:aMethod},smalltalk.MethodModified)})},
  17681. args: ["aMethod"],
  17682. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  17683. messageSends: [],
  17684. referencedClasses: []
  17685. }),
  17686. smalltalk.MethodModified);
  17687. smalltalk.addClass('MethodMoved', smalltalk.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  17688. smalltalk.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  17689. smalltalk.addMethod(
  17690. smalltalk.method({
  17691. selector: "oldProtocol",
  17692. category: 'accessing',
  17693. fn: function (){
  17694. var self=this;
  17695. return smalltalk.withContext(function($ctx1) {
  17696. var $1;
  17697. $1=self["@oldProtocol"];
  17698. return $1;
  17699. }, function($ctx1) {$ctx1.fill(self,"oldProtocol",{},smalltalk.MethodMoved)})},
  17700. args: [],
  17701. source: "oldProtocol\x0a\x09^ oldProtocol",
  17702. messageSends: [],
  17703. referencedClasses: []
  17704. }),
  17705. smalltalk.MethodMoved);
  17706. smalltalk.addMethod(
  17707. smalltalk.method({
  17708. selector: "oldProtocol:",
  17709. category: 'accessing',
  17710. fn: function (aString){
  17711. var self=this;
  17712. return smalltalk.withContext(function($ctx1) {
  17713. self["@oldProtocol"]=aString;
  17714. return self}, function($ctx1) {$ctx1.fill(self,"oldProtocol:",{aString:aString},smalltalk.MethodMoved)})},
  17715. args: ["aString"],
  17716. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  17717. messageSends: [],
  17718. referencedClasses: []
  17719. }),
  17720. smalltalk.MethodMoved);
  17721. smalltalk.addClass('MethodRemoved', smalltalk.MethodAnnouncement, [], 'Kernel-Announcements');
  17722. smalltalk.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  17723. smalltalk.addClass('PackageAnnouncement', smalltalk.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  17724. smalltalk.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  17725. smalltalk.addMethod(
  17726. smalltalk.method({
  17727. selector: "package",
  17728. category: 'accessing',
  17729. fn: function (){
  17730. var self=this;
  17731. return smalltalk.withContext(function($ctx1) {
  17732. var $1;
  17733. $1=self["@package"];
  17734. return $1;
  17735. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageAnnouncement)})},
  17736. args: [],
  17737. source: "package\x0a\x09^ package",
  17738. messageSends: [],
  17739. referencedClasses: []
  17740. }),
  17741. smalltalk.PackageAnnouncement);
  17742. smalltalk.addMethod(
  17743. smalltalk.method({
  17744. selector: "package:",
  17745. category: 'accessing',
  17746. fn: function (aPackage){
  17747. var self=this;
  17748. return smalltalk.withContext(function($ctx1) {
  17749. self["@package"]=aPackage;
  17750. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageAnnouncement)})},
  17751. args: ["aPackage"],
  17752. source: "package: aPackage\x0a\x09package := aPackage",
  17753. messageSends: [],
  17754. referencedClasses: []
  17755. }),
  17756. smalltalk.PackageAnnouncement);
  17757. smalltalk.addClass('PackageAdded', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  17758. smalltalk.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  17759. smalltalk.addClass('PackageRemoved', smalltalk.PackageAnnouncement, [], 'Kernel-Announcements');
  17760. smalltalk.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  17761. smalltalk.addClass('ProtocolAnnouncement', smalltalk.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  17762. smalltalk.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  17763. smalltalk.addMethod(
  17764. smalltalk.method({
  17765. selector: "protocol",
  17766. category: 'accessing',
  17767. fn: function (){
  17768. var self=this;
  17769. return smalltalk.withContext(function($ctx1) {
  17770. var $1;
  17771. $1=self["@protocol"];
  17772. return $1;
  17773. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.ProtocolAnnouncement)})},
  17774. args: [],
  17775. source: "protocol\x0a\x09^ protocol",
  17776. messageSends: [],
  17777. referencedClasses: []
  17778. }),
  17779. smalltalk.ProtocolAnnouncement);
  17780. smalltalk.addMethod(
  17781. smalltalk.method({
  17782. selector: "protocol:",
  17783. category: 'accessing',
  17784. fn: function (aString){
  17785. var self=this;
  17786. return smalltalk.withContext(function($ctx1) {
  17787. self["@protocol"]=aString;
  17788. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString},smalltalk.ProtocolAnnouncement)})},
  17789. args: ["aString"],
  17790. source: "protocol: aString\x0a\x09protocol := aString",
  17791. messageSends: [],
  17792. referencedClasses: []
  17793. }),
  17794. smalltalk.ProtocolAnnouncement);
  17795. smalltalk.addMethod(
  17796. smalltalk.method({
  17797. selector: "theClass",
  17798. category: 'accessing',
  17799. fn: function (){
  17800. var self=this;
  17801. return smalltalk.withContext(function($ctx1) {
  17802. var $1;
  17803. $1=self["@theClass"];
  17804. return $1;
  17805. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ProtocolAnnouncement)})},
  17806. args: [],
  17807. source: "theClass\x0a\x09^ theClass",
  17808. messageSends: [],
  17809. referencedClasses: []
  17810. }),
  17811. smalltalk.ProtocolAnnouncement);
  17812. smalltalk.addMethod(
  17813. smalltalk.method({
  17814. selector: "theClass:",
  17815. category: 'accessing',
  17816. fn: function (aClass){
  17817. var self=this;
  17818. return smalltalk.withContext(function($ctx1) {
  17819. self["@theClass"]=aClass;
  17820. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ProtocolAnnouncement)})},
  17821. args: ["aClass"],
  17822. source: "theClass: aClass\x0a\x09theClass := aClass",
  17823. messageSends: [],
  17824. referencedClasses: []
  17825. }),
  17826. smalltalk.ProtocolAnnouncement);
  17827. smalltalk.addClass('ProtocolAdded', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  17828. smalltalk.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  17829. smalltalk.addClass('ProtocolRemoved', smalltalk.ProtocolAnnouncement, [], 'Kernel-Announcements');
  17830. smalltalk.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  17831. });
  17832. define("amber_core/Compiler-Exceptions", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Exceptions"], function(smalltalk,nil,_st){
  17833. smalltalk.addPackage('Compiler-Exceptions');
  17834. smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17835. smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
  17836. smalltalk.CompilerError.comment="I am the common superclass of all compiling errors.";
  17837. smalltalk.addClass('ParseError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  17838. smalltalk.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  17839. smalltalk.addClass('SemanticError', smalltalk.CompilerError, [], 'Compiler-Exceptions');
  17840. 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";
  17841. smalltalk.addClass('InliningError', smalltalk.SemanticError, [], 'Compiler-Exceptions');
  17842. smalltalk.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  17843. smalltalk.addClass('InvalidAssignmentError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  17844. smalltalk.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  17845. smalltalk.addMethod(
  17846. smalltalk.method({
  17847. selector: "messageText",
  17848. category: 'accessing',
  17849. fn: function (){
  17850. var self=this;
  17851. return smalltalk.withContext(function($ctx1) {
  17852. var $1;
  17853. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  17854. return $1;
  17855. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.InvalidAssignmentError)})},
  17856. args: [],
  17857. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  17858. messageSends: [",", "variableName"],
  17859. referencedClasses: []
  17860. }),
  17861. smalltalk.InvalidAssignmentError);
  17862. smalltalk.addMethod(
  17863. smalltalk.method({
  17864. selector: "variableName",
  17865. category: 'accessing',
  17866. fn: function (){
  17867. var self=this;
  17868. return smalltalk.withContext(function($ctx1) {
  17869. var $1;
  17870. $1=self["@variableName"];
  17871. return $1;
  17872. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.InvalidAssignmentError)})},
  17873. args: [],
  17874. source: "variableName\x0a\x09^ variableName",
  17875. messageSends: [],
  17876. referencedClasses: []
  17877. }),
  17878. smalltalk.InvalidAssignmentError);
  17879. smalltalk.addMethod(
  17880. smalltalk.method({
  17881. selector: "variableName:",
  17882. category: 'accessing',
  17883. fn: function (aString){
  17884. var self=this;
  17885. return smalltalk.withContext(function($ctx1) {
  17886. self["@variableName"]=aString;
  17887. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.InvalidAssignmentError)})},
  17888. args: ["aString"],
  17889. source: "variableName: aString\x0a\x09variableName := aString",
  17890. messageSends: [],
  17891. referencedClasses: []
  17892. }),
  17893. smalltalk.InvalidAssignmentError);
  17894. smalltalk.addClass('ShadowingVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  17895. 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.";
  17896. smalltalk.addMethod(
  17897. smalltalk.method({
  17898. selector: "messageText",
  17899. category: 'accessing',
  17900. fn: function (){
  17901. var self=this;
  17902. return smalltalk.withContext(function($ctx1) {
  17903. var $1;
  17904. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  17905. return $1;
  17906. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.ShadowingVariableError)})},
  17907. args: [],
  17908. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  17909. messageSends: [",", "variableName"],
  17910. referencedClasses: []
  17911. }),
  17912. smalltalk.ShadowingVariableError);
  17913. smalltalk.addMethod(
  17914. smalltalk.method({
  17915. selector: "variableName",
  17916. category: 'accessing',
  17917. fn: function (){
  17918. var self=this;
  17919. return smalltalk.withContext(function($ctx1) {
  17920. var $1;
  17921. $1=self["@variableName"];
  17922. return $1;
  17923. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.ShadowingVariableError)})},
  17924. args: [],
  17925. source: "variableName\x0a\x09^ variableName",
  17926. messageSends: [],
  17927. referencedClasses: []
  17928. }),
  17929. smalltalk.ShadowingVariableError);
  17930. smalltalk.addMethod(
  17931. smalltalk.method({
  17932. selector: "variableName:",
  17933. category: 'accessing',
  17934. fn: function (aString){
  17935. var self=this;
  17936. return smalltalk.withContext(function($ctx1) {
  17937. self["@variableName"]=aString;
  17938. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.ShadowingVariableError)})},
  17939. args: ["aString"],
  17940. source: "variableName: aString\x0a\x09variableName := aString",
  17941. messageSends: [],
  17942. referencedClasses: []
  17943. }),
  17944. smalltalk.ShadowingVariableError);
  17945. smalltalk.addClass('UnknownVariableError', smalltalk.SemanticError, ['variableName'], 'Compiler-Exceptions');
  17946. 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.";
  17947. smalltalk.addMethod(
  17948. smalltalk.method({
  17949. selector: "messageText",
  17950. category: 'accessing',
  17951. fn: function (){
  17952. var self=this;
  17953. return smalltalk.withContext(function($ctx1) {
  17954. var $1;
  17955. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  17956. return $1;
  17957. }, function($ctx1) {$ctx1.fill(self,"messageText",{},smalltalk.UnknownVariableError)})},
  17958. args: [],
  17959. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  17960. messageSends: [",", "variableName"],
  17961. referencedClasses: []
  17962. }),
  17963. smalltalk.UnknownVariableError);
  17964. smalltalk.addMethod(
  17965. smalltalk.method({
  17966. selector: "variableName",
  17967. category: 'accessing',
  17968. fn: function (){
  17969. var self=this;
  17970. return smalltalk.withContext(function($ctx1) {
  17971. var $1;
  17972. $1=self["@variableName"];
  17973. return $1;
  17974. }, function($ctx1) {$ctx1.fill(self,"variableName",{},smalltalk.UnknownVariableError)})},
  17975. args: [],
  17976. source: "variableName\x0a\x09^ variableName",
  17977. messageSends: [],
  17978. referencedClasses: []
  17979. }),
  17980. smalltalk.UnknownVariableError);
  17981. smalltalk.addMethod(
  17982. smalltalk.method({
  17983. selector: "variableName:",
  17984. category: 'accessing',
  17985. fn: function (aString){
  17986. var self=this;
  17987. return smalltalk.withContext(function($ctx1) {
  17988. self["@variableName"]=aString;
  17989. return self}, function($ctx1) {$ctx1.fill(self,"variableName:",{aString:aString},smalltalk.UnknownVariableError)})},
  17990. args: ["aString"],
  17991. source: "variableName: aString\x0a\x09variableName := aString",
  17992. messageSends: [],
  17993. referencedClasses: []
  17994. }),
  17995. smalltalk.UnknownVariableError);
  17996. smalltalk.addClass('RethrowErrorHandler', smalltalk.ErrorHandler, [], 'Compiler-Exceptions');
  17997. smalltalk.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  17998. smalltalk.addMethod(
  17999. smalltalk.method({
  18000. selector: "basicSignal:",
  18001. category: 'error handling',
  18002. fn: function (anError){
  18003. var self=this;
  18004. return smalltalk.withContext(function($ctx1) {
  18005. throw anError;
  18006. return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  18007. args: ["anError"],
  18008. source: "basicSignal: anError\x0a\x09<throw anError>",
  18009. messageSends: [],
  18010. referencedClasses: []
  18011. }),
  18012. smalltalk.RethrowErrorHandler);
  18013. smalltalk.addMethod(
  18014. smalltalk.method({
  18015. selector: "handleError:",
  18016. category: 'error handling',
  18017. fn: function (anError){
  18018. var self=this;
  18019. return smalltalk.withContext(function($ctx1) {
  18020. smalltalk.RethrowErrorHandler.superclass.fn.prototype._handleError_.apply(_st(self), [anError]);
  18021. self._basicSignal_(anError);
  18022. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},smalltalk.RethrowErrorHandler)})},
  18023. args: ["anError"],
  18024. source: "handleError: anError\x0a\x09super handleError: anError.\x0a\x09self basicSignal: anError",
  18025. messageSends: ["handleError:", "basicSignal:"],
  18026. referencedClasses: []
  18027. }),
  18028. smalltalk.RethrowErrorHandler);
  18029. });
  18030. define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  18031. smalltalk.addPackage('Compiler-Core');
  18032. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18033. smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
  18034. smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  18035. smalltalk.addMethod(
  18036. smalltalk.method({
  18037. selector: "classNameFor:",
  18038. category: 'accessing',
  18039. fn: function (aClass){
  18040. var self=this;
  18041. return smalltalk.withContext(function($ctx1) {
  18042. var $2,$3,$1;
  18043. $2=_st(aClass)._isMetaclass();
  18044. if(smalltalk.assert($2)){
  18045. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  18046. } else {
  18047. $3=_st(aClass)._isNil();
  18048. if(smalltalk.assert($3)){
  18049. $1="nil";
  18050. } else {
  18051. $1=_st(aClass)._name();
  18052. };
  18053. };
  18054. return $1;
  18055. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  18056. args: ["aClass"],
  18057. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [aClass instanceClass name, '.klass']\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: ['nil']\x0a\x09\x09\x09ifFalse: [aClass name]]",
  18058. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  18059. referencedClasses: []
  18060. }),
  18061. smalltalk.AbstractCodeGenerator);
  18062. smalltalk.addMethod(
  18063. smalltalk.method({
  18064. selector: "compileNode:",
  18065. category: 'compiling',
  18066. fn: function (aNode){
  18067. var self=this;
  18068. return smalltalk.withContext(function($ctx1) {
  18069. self._subclassResponsibility();
  18070. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},smalltalk.AbstractCodeGenerator)})},
  18071. args: ["aNode"],
  18072. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  18073. messageSends: ["subclassResponsibility"],
  18074. referencedClasses: []
  18075. }),
  18076. smalltalk.AbstractCodeGenerator);
  18077. smalltalk.addMethod(
  18078. smalltalk.method({
  18079. selector: "currentClass",
  18080. category: 'accessing',
  18081. fn: function (){
  18082. var self=this;
  18083. return smalltalk.withContext(function($ctx1) {
  18084. var $1;
  18085. $1=self["@currentClass"];
  18086. return $1;
  18087. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.AbstractCodeGenerator)})},
  18088. args: [],
  18089. source: "currentClass\x0a\x09^currentClass",
  18090. messageSends: [],
  18091. referencedClasses: []
  18092. }),
  18093. smalltalk.AbstractCodeGenerator);
  18094. smalltalk.addMethod(
  18095. smalltalk.method({
  18096. selector: "currentClass:",
  18097. category: 'accessing',
  18098. fn: function (aClass){
  18099. var self=this;
  18100. return smalltalk.withContext(function($ctx1) {
  18101. self["@currentClass"]=aClass;
  18102. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.AbstractCodeGenerator)})},
  18103. args: ["aClass"],
  18104. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  18105. messageSends: [],
  18106. referencedClasses: []
  18107. }),
  18108. smalltalk.AbstractCodeGenerator);
  18109. smalltalk.addMethod(
  18110. smalltalk.method({
  18111. selector: "pseudoVariables",
  18112. category: 'accessing',
  18113. fn: function (){
  18114. var self=this;
  18115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18116. return smalltalk.withContext(function($ctx1) {
  18117. var $1;
  18118. $1=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  18119. return $1;
  18120. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},smalltalk.AbstractCodeGenerator)})},
  18121. args: [],
  18122. source: "pseudoVariables\x0a\x09^ Smalltalk current pseudoVariableNames",
  18123. messageSends: ["pseudoVariableNames", "current"],
  18124. referencedClasses: ["Smalltalk"]
  18125. }),
  18126. smalltalk.AbstractCodeGenerator);
  18127. smalltalk.addMethod(
  18128. smalltalk.method({
  18129. selector: "safeVariableNameFor:",
  18130. category: 'accessing',
  18131. fn: function (aString){
  18132. var self=this;
  18133. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18134. return smalltalk.withContext(function($ctx1) {
  18135. var $2,$1;
  18136. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(aString);
  18137. if(smalltalk.assert($2)){
  18138. $1=_st(aString).__comma("_");
  18139. } else {
  18140. $1=aString;
  18141. };
  18142. return $1;
  18143. }, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  18144. args: ["aString"],
  18145. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  18146. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
  18147. referencedClasses: ["Smalltalk"]
  18148. }),
  18149. smalltalk.AbstractCodeGenerator);
  18150. smalltalk.addMethod(
  18151. smalltalk.method({
  18152. selector: "source",
  18153. category: 'accessing',
  18154. fn: function (){
  18155. var self=this;
  18156. return smalltalk.withContext(function($ctx1) {
  18157. var $2,$1;
  18158. $2=self["@source"];
  18159. if(($receiver = $2) == nil || $receiver == null){
  18160. $1="";
  18161. } else {
  18162. $1=$2;
  18163. };
  18164. return $1;
  18165. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.AbstractCodeGenerator)})},
  18166. args: [],
  18167. source: "source\x0a\x09^source ifNil: ['']",
  18168. messageSends: ["ifNil:"],
  18169. referencedClasses: []
  18170. }),
  18171. smalltalk.AbstractCodeGenerator);
  18172. smalltalk.addMethod(
  18173. smalltalk.method({
  18174. selector: "source:",
  18175. category: 'accessing',
  18176. fn: function (aString){
  18177. var self=this;
  18178. return smalltalk.withContext(function($ctx1) {
  18179. self["@source"]=aString;
  18180. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
  18181. args: ["aString"],
  18182. source: "source: aString\x0a\x09source := aString",
  18183. messageSends: [],
  18184. referencedClasses: []
  18185. }),
  18186. smalltalk.AbstractCodeGenerator);
  18187. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  18188. 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.";
  18189. smalltalk.addMethod(
  18190. smalltalk.method({
  18191. selector: "compileNode:",
  18192. category: 'compiling',
  18193. fn: function (aNode){
  18194. var self=this;
  18195. var ir,stream;
  18196. return smalltalk.withContext(function($ctx1) {
  18197. var $2,$3,$1;
  18198. _st(self._semanticAnalyzer())._visit_(aNode);
  18199. ir=_st(self._translator())._visit_(aNode);
  18200. $2=self._irTranslator();
  18201. _st($2)._currentClass_(self._currentClass());
  18202. _st($2)._visit_(ir);
  18203. $3=_st($2)._contents();
  18204. $1=$3;
  18205. return $1;
  18206. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.CodeGenerator)})},
  18207. args: ["aNode"],
  18208. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  18209. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"],
  18210. referencedClasses: []
  18211. }),
  18212. smalltalk.CodeGenerator);
  18213. smalltalk.addMethod(
  18214. smalltalk.method({
  18215. selector: "irTranslator",
  18216. category: 'compiling',
  18217. fn: function (){
  18218. var self=this;
  18219. function $IRJSTranslator(){return smalltalk.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  18220. return smalltalk.withContext(function($ctx1) {
  18221. var $1;
  18222. $1=_st($IRJSTranslator())._new();
  18223. return $1;
  18224. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.CodeGenerator)})},
  18225. args: [],
  18226. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  18227. messageSends: ["new"],
  18228. referencedClasses: ["IRJSTranslator"]
  18229. }),
  18230. smalltalk.CodeGenerator);
  18231. smalltalk.addMethod(
  18232. smalltalk.method({
  18233. selector: "semanticAnalyzer",
  18234. category: 'compiling',
  18235. fn: function (){
  18236. var self=this;
  18237. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  18238. return smalltalk.withContext(function($ctx1) {
  18239. var $1;
  18240. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  18241. return $1;
  18242. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},smalltalk.CodeGenerator)})},
  18243. args: [],
  18244. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  18245. messageSends: ["on:", "currentClass"],
  18246. referencedClasses: ["SemanticAnalyzer"]
  18247. }),
  18248. smalltalk.CodeGenerator);
  18249. smalltalk.addMethod(
  18250. smalltalk.method({
  18251. selector: "translator",
  18252. category: 'compiling',
  18253. fn: function (){
  18254. var self=this;
  18255. function $IRASTTranslator(){return smalltalk.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  18256. return smalltalk.withContext(function($ctx1) {
  18257. var $2,$3,$1;
  18258. $2=_st($IRASTTranslator())._new();
  18259. _st($2)._source_(self._source());
  18260. _st($2)._theClass_(self._currentClass());
  18261. $3=_st($2)._yourself();
  18262. $1=$3;
  18263. return $1;
  18264. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.CodeGenerator)})},
  18265. args: [],
  18266. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  18267. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"],
  18268. referencedClasses: ["IRASTTranslator"]
  18269. }),
  18270. smalltalk.CodeGenerator);
  18271. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  18272. 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`";
  18273. smalltalk.addMethod(
  18274. smalltalk.method({
  18275. selector: "codeGeneratorClass",
  18276. category: 'accessing',
  18277. fn: function (){
  18278. var self=this;
  18279. function $InliningCodeGenerator(){return smalltalk.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  18280. return smalltalk.withContext(function($ctx1) {
  18281. var $2,$1;
  18282. $2=self["@codeGeneratorClass"];
  18283. if(($receiver = $2) == nil || $receiver == null){
  18284. $1=$InliningCodeGenerator();
  18285. } else {
  18286. $1=$2;
  18287. };
  18288. return $1;
  18289. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.Compiler)})},
  18290. args: [],
  18291. source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
  18292. messageSends: ["ifNil:"],
  18293. referencedClasses: ["InliningCodeGenerator"]
  18294. }),
  18295. smalltalk.Compiler);
  18296. smalltalk.addMethod(
  18297. smalltalk.method({
  18298. selector: "codeGeneratorClass:",
  18299. category: 'accessing',
  18300. fn: function (aClass){
  18301. var self=this;
  18302. return smalltalk.withContext(function($ctx1) {
  18303. self["@codeGeneratorClass"]=aClass;
  18304. return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass},smalltalk.Compiler)})},
  18305. args: ["aClass"],
  18306. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  18307. messageSends: [],
  18308. referencedClasses: []
  18309. }),
  18310. smalltalk.Compiler);
  18311. smalltalk.addMethod(
  18312. smalltalk.method({
  18313. selector: "compile:",
  18314. category: 'compiling',
  18315. fn: function (aString){
  18316. var self=this;
  18317. return smalltalk.withContext(function($ctx1) {
  18318. var $1;
  18319. $1=self._compileNode_(self._parse_(aString));
  18320. return $1;
  18321. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Compiler)})},
  18322. args: ["aString"],
  18323. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  18324. messageSends: ["compileNode:", "parse:"],
  18325. referencedClasses: []
  18326. }),
  18327. smalltalk.Compiler);
  18328. smalltalk.addMethod(
  18329. smalltalk.method({
  18330. selector: "compile:forClass:",
  18331. category: 'compiling',
  18332. fn: function (aString,aClass){
  18333. var self=this;
  18334. return smalltalk.withContext(function($ctx1) {
  18335. var $1;
  18336. self._currentClass_(aClass);
  18337. self._source_(aString);
  18338. $1=self._compile_(aString);
  18339. return $1;
  18340. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},smalltalk.Compiler)})},
  18341. args: ["aString", "aClass"],
  18342. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  18343. messageSends: ["currentClass:", "source:", "compile:"],
  18344. referencedClasses: []
  18345. }),
  18346. smalltalk.Compiler);
  18347. smalltalk.addMethod(
  18348. smalltalk.method({
  18349. selector: "compileExpression:",
  18350. category: 'compiling',
  18351. fn: function (aString){
  18352. var self=this;
  18353. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  18354. return smalltalk.withContext(function($ctx1) {
  18355. var $1;
  18356. self._currentClass_($DoIt());
  18357. self._source_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  18358. $1=self._compileNode_(self._parse_(self._source()));
  18359. return $1;
  18360. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},smalltalk.Compiler)})},
  18361. args: ["aString"],
  18362. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  18363. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  18364. referencedClasses: ["DoIt"]
  18365. }),
  18366. smalltalk.Compiler);
  18367. smalltalk.addMethod(
  18368. smalltalk.method({
  18369. selector: "compileExpression:on:",
  18370. category: 'compiling',
  18371. fn: function (aString,anObject){
  18372. var self=this;
  18373. return smalltalk.withContext(function($ctx1) {
  18374. var $1;
  18375. self._currentClass_(_st(anObject)._class());
  18376. self._source_(_st("xxxDoIt ^[".__comma(aString)).__comma("] value"));
  18377. $1=self._compileNode_(self._parse_(self._source()));
  18378. return $1;
  18379. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},smalltalk.Compiler)})},
  18380. args: ["aString", "anObject"],
  18381. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  18382. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  18383. referencedClasses: []
  18384. }),
  18385. smalltalk.Compiler);
  18386. smalltalk.addMethod(
  18387. smalltalk.method({
  18388. selector: "compileNode:",
  18389. category: 'compiling',
  18390. fn: function (aNode){
  18391. var self=this;
  18392. var generator,result;
  18393. return smalltalk.withContext(function($ctx1) {
  18394. var $1,$2,$3;
  18395. generator=_st(self._codeGeneratorClass())._new();
  18396. $1=generator;
  18397. _st($1)._source_(self._source());
  18398. $2=_st($1)._currentClass_(self._currentClass());
  18399. result=_st(generator)._compileNode_(aNode);
  18400. self._unknownVariables_([]);
  18401. $3=result;
  18402. return $3;
  18403. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},smalltalk.Compiler)})},
  18404. args: ["aNode"],
  18405. 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",
  18406. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  18407. referencedClasses: []
  18408. }),
  18409. smalltalk.Compiler);
  18410. smalltalk.addMethod(
  18411. smalltalk.method({
  18412. selector: "currentClass",
  18413. category: 'accessing',
  18414. fn: function (){
  18415. var self=this;
  18416. return smalltalk.withContext(function($ctx1) {
  18417. var $1;
  18418. $1=self["@currentClass"];
  18419. return $1;
  18420. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.Compiler)})},
  18421. args: [],
  18422. source: "currentClass\x0a\x09^currentClass",
  18423. messageSends: [],
  18424. referencedClasses: []
  18425. }),
  18426. smalltalk.Compiler);
  18427. smalltalk.addMethod(
  18428. smalltalk.method({
  18429. selector: "currentClass:",
  18430. category: 'accessing',
  18431. fn: function (aClass){
  18432. var self=this;
  18433. return smalltalk.withContext(function($ctx1) {
  18434. self["@currentClass"]=aClass;
  18435. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.Compiler)})},
  18436. args: ["aClass"],
  18437. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  18438. messageSends: [],
  18439. referencedClasses: []
  18440. }),
  18441. smalltalk.Compiler);
  18442. smalltalk.addMethod(
  18443. smalltalk.method({
  18444. selector: "eval:",
  18445. category: 'compiling',
  18446. fn: function (aString){
  18447. var self=this;
  18448. return smalltalk.withContext(function($ctx1) {
  18449. return eval(aString);
  18450. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},smalltalk.Compiler)})},
  18451. args: ["aString"],
  18452. source: "eval: aString\x0a\x09<return eval(aString)>",
  18453. messageSends: [],
  18454. referencedClasses: []
  18455. }),
  18456. smalltalk.Compiler);
  18457. smalltalk.addMethod(
  18458. smalltalk.method({
  18459. selector: "evaluateExpression:",
  18460. category: 'compiling',
  18461. fn: function (aString){
  18462. var self=this;
  18463. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  18464. return smalltalk.withContext(function($ctx1) {
  18465. var $1;
  18466. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  18467. return $1;
  18468. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},smalltalk.Compiler)})},
  18469. args: ["aString"],
  18470. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  18471. messageSends: ["evaluateExpression:on:", "new"],
  18472. referencedClasses: ["DoIt"]
  18473. }),
  18474. smalltalk.Compiler);
  18475. smalltalk.addMethod(
  18476. smalltalk.method({
  18477. selector: "evaluateExpression:on:",
  18478. category: 'compiling',
  18479. fn: function (aString,anObject){
  18480. var self=this;
  18481. var result,method;
  18482. return smalltalk.withContext(function($ctx1) {
  18483. var $1;
  18484. method=self._eval_(self._compileExpression_on_(aString,anObject));
  18485. _st(method)._category_("xxxDoIt");
  18486. _st(_st(anObject)._class())._addCompiledMethod_(method);
  18487. result=_st(anObject)._xxxDoIt();
  18488. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  18489. $1=result;
  18490. return $1;
  18491. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},smalltalk.Compiler)})},
  18492. args: ["aString", "anObject"],
  18493. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method category: 'xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^result",
  18494. messageSends: ["eval:", "compileExpression:on:", "category:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  18495. referencedClasses: []
  18496. }),
  18497. smalltalk.Compiler);
  18498. smalltalk.addMethod(
  18499. smalltalk.method({
  18500. selector: "install:forClass:category:",
  18501. category: 'compiling',
  18502. fn: function (aString,aBehavior,anotherString){
  18503. var self=this;
  18504. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18505. return smalltalk.withContext(function($ctx1) {
  18506. var $1;
  18507. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_category_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  18508. return $1;
  18509. }, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},smalltalk.Compiler)})},
  18510. args: ["aString", "aBehavior", "anotherString"],
  18511. source: "install: aString forClass: aBehavior category: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09category: anotherString",
  18512. messageSends: ["installMethod:forClass:category:", "new", "eval:", "compile:forClass:"],
  18513. referencedClasses: ["ClassBuilder"]
  18514. }),
  18515. smalltalk.Compiler);
  18516. smalltalk.addMethod(
  18517. smalltalk.method({
  18518. selector: "parse:",
  18519. category: 'compiling',
  18520. fn: function (aString){
  18521. var self=this;
  18522. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18523. return smalltalk.withContext(function($ctx1) {
  18524. var $1;
  18525. $1=_st(_st($Smalltalk())._current())._parse_(aString);
  18526. return $1;
  18527. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Compiler)})},
  18528. args: ["aString"],
  18529. source: "parse: aString\x0a\x09^Smalltalk current parse: aString",
  18530. messageSends: ["parse:", "current"],
  18531. referencedClasses: ["Smalltalk"]
  18532. }),
  18533. smalltalk.Compiler);
  18534. smalltalk.addMethod(
  18535. smalltalk.method({
  18536. selector: "parseExpression:",
  18537. category: 'compiling',
  18538. fn: function (aString){
  18539. var self=this;
  18540. return smalltalk.withContext(function($ctx1) {
  18541. var $1;
  18542. $1=self._parse_(_st("doIt ^[".__comma(aString)).__comma("] value"));
  18543. return $1;
  18544. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},smalltalk.Compiler)})},
  18545. args: ["aString"],
  18546. source: "parseExpression: aString\x0a\x09^self parse: 'doIt ^[', aString, '] value'",
  18547. messageSends: ["parse:", ","],
  18548. referencedClasses: []
  18549. }),
  18550. smalltalk.Compiler);
  18551. smalltalk.addMethod(
  18552. smalltalk.method({
  18553. selector: "recompile:",
  18554. category: 'compiling',
  18555. fn: function (aClass){
  18556. var self=this;
  18557. return smalltalk.withContext(function($ctx1) {
  18558. var $1;
  18559. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  18560. return smalltalk.withContext(function($ctx2) {
  18561. return self._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
  18562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  18563. $1=_st(aClass)._isMetaclass();
  18564. if(! smalltalk.assert($1)){
  18565. self._recompile_(_st(aClass)._class());
  18566. };
  18567. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler)})},
  18568. args: ["aClass"],
  18569. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | self install: each source forClass: aClass category: each category ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09\x22self setupClass: aClass.\x22\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  18570. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:category:", "source", "category", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"],
  18571. referencedClasses: []
  18572. }),
  18573. smalltalk.Compiler);
  18574. smalltalk.addMethod(
  18575. smalltalk.method({
  18576. selector: "recompileAll",
  18577. category: 'compiling',
  18578. fn: function (){
  18579. var self=this;
  18580. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18581. return smalltalk.withContext(function($ctx1) {
  18582. _st(_st(_st($Smalltalk())._current())._classes())._do_displayingProgress_((function(each){
  18583. return smalltalk.withContext(function($ctx2) {
  18584. return self._recompile_(each);
  18585. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
  18586. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler)})},
  18587. args: [],
  18588. source: "recompileAll\x0a\x09Smalltalk current classes \x0a\x09\x09do: [:each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  18589. messageSends: ["do:displayingProgress:", "classes", "current", "recompile:"],
  18590. referencedClasses: ["Smalltalk"]
  18591. }),
  18592. smalltalk.Compiler);
  18593. smalltalk.addMethod(
  18594. smalltalk.method({
  18595. selector: "source",
  18596. category: 'accessing',
  18597. fn: function (){
  18598. var self=this;
  18599. return smalltalk.withContext(function($ctx1) {
  18600. var $2,$1;
  18601. $2=self["@source"];
  18602. if(($receiver = $2) == nil || $receiver == null){
  18603. $1="";
  18604. } else {
  18605. $1=$2;
  18606. };
  18607. return $1;
  18608. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.Compiler)})},
  18609. args: [],
  18610. source: "source\x0a\x09^source ifNil: ['']",
  18611. messageSends: ["ifNil:"],
  18612. referencedClasses: []
  18613. }),
  18614. smalltalk.Compiler);
  18615. smalltalk.addMethod(
  18616. smalltalk.method({
  18617. selector: "source:",
  18618. category: 'accessing',
  18619. fn: function (aString){
  18620. var self=this;
  18621. return smalltalk.withContext(function($ctx1) {
  18622. self["@source"]=aString;
  18623. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.Compiler)})},
  18624. args: ["aString"],
  18625. source: "source: aString\x0a\x09source := aString",
  18626. messageSends: [],
  18627. referencedClasses: []
  18628. }),
  18629. smalltalk.Compiler);
  18630. smalltalk.addMethod(
  18631. smalltalk.method({
  18632. selector: "unknownVariables",
  18633. category: 'accessing',
  18634. fn: function (){
  18635. var self=this;
  18636. return smalltalk.withContext(function($ctx1) {
  18637. var $1;
  18638. $1=self["@unknownVariables"];
  18639. return $1;
  18640. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.Compiler)})},
  18641. args: [],
  18642. source: "unknownVariables\x0a\x09^unknownVariables",
  18643. messageSends: [],
  18644. referencedClasses: []
  18645. }),
  18646. smalltalk.Compiler);
  18647. smalltalk.addMethod(
  18648. smalltalk.method({
  18649. selector: "unknownVariables:",
  18650. category: 'accessing',
  18651. fn: function (aCollection){
  18652. var self=this;
  18653. return smalltalk.withContext(function($ctx1) {
  18654. self["@unknownVariables"]=aCollection;
  18655. return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection},smalltalk.Compiler)})},
  18656. args: ["aCollection"],
  18657. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  18658. messageSends: [],
  18659. referencedClasses: []
  18660. }),
  18661. smalltalk.Compiler);
  18662. smalltalk.addMethod(
  18663. smalltalk.method({
  18664. selector: "recompile:",
  18665. category: 'compiling',
  18666. fn: function (aClass){
  18667. var self=this;
  18668. return smalltalk.withContext(function($ctx1) {
  18669. _st(self._new())._recompile_(aClass);
  18670. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},smalltalk.Compiler.klass)})},
  18671. args: ["aClass"],
  18672. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  18673. messageSends: ["recompile:", "new"],
  18674. referencedClasses: []
  18675. }),
  18676. smalltalk.Compiler.klass);
  18677. smalltalk.addMethod(
  18678. smalltalk.method({
  18679. selector: "recompileAll",
  18680. category: 'compiling',
  18681. fn: function (){
  18682. var self=this;
  18683. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18684. return smalltalk.withContext(function($ctx1) {
  18685. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  18686. return smalltalk.withContext(function($ctx2) {
  18687. return self._recompile_(each);
  18688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  18689. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler.klass)})},
  18690. args: [],
  18691. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  18692. messageSends: ["do:", "classes", "current", "recompile:"],
  18693. referencedClasses: ["Smalltalk"]
  18694. }),
  18695. smalltalk.Compiler.klass);
  18696. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  18697. smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  18698. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  18699. smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  18700. smalltalk.addMethod(
  18701. smalltalk.method({
  18702. selector: "visit:",
  18703. category: 'visiting',
  18704. fn: function (aNode){
  18705. var self=this;
  18706. return smalltalk.withContext(function($ctx1) {
  18707. var $1;
  18708. $1=_st(aNode)._accept_(self);
  18709. return $1;
  18710. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18711. args: ["aNode"],
  18712. source: "visit: aNode\x0a\x09^ aNode accept: self",
  18713. messageSends: ["accept:"],
  18714. referencedClasses: []
  18715. }),
  18716. smalltalk.NodeVisitor);
  18717. smalltalk.addMethod(
  18718. smalltalk.method({
  18719. selector: "visitAll:",
  18720. category: 'visiting',
  18721. fn: function (aCollection){
  18722. var self=this;
  18723. return smalltalk.withContext(function($ctx1) {
  18724. var $1;
  18725. $1=_st(aCollection)._collect_((function(each){
  18726. return smalltalk.withContext(function($ctx2) {
  18727. return self._visit_(each);
  18728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  18729. return $1;
  18730. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},smalltalk.NodeVisitor)})},
  18731. args: ["aCollection"],
  18732. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  18733. messageSends: ["collect:", "visit:"],
  18734. referencedClasses: []
  18735. }),
  18736. smalltalk.NodeVisitor);
  18737. smalltalk.addMethod(
  18738. smalltalk.method({
  18739. selector: "visitAssignmentNode:",
  18740. category: 'visiting',
  18741. fn: function (aNode){
  18742. var self=this;
  18743. return smalltalk.withContext(function($ctx1) {
  18744. var $1;
  18745. $1=self._visitNode_(aNode);
  18746. return $1;
  18747. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18748. args: ["aNode"],
  18749. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  18750. messageSends: ["visitNode:"],
  18751. referencedClasses: []
  18752. }),
  18753. smalltalk.NodeVisitor);
  18754. smalltalk.addMethod(
  18755. smalltalk.method({
  18756. selector: "visitBlockNode:",
  18757. category: 'visiting',
  18758. fn: function (aNode){
  18759. var self=this;
  18760. return smalltalk.withContext(function($ctx1) {
  18761. var $1;
  18762. $1=self._visitNode_(aNode);
  18763. return $1;
  18764. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18765. args: ["aNode"],
  18766. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  18767. messageSends: ["visitNode:"],
  18768. referencedClasses: []
  18769. }),
  18770. smalltalk.NodeVisitor);
  18771. smalltalk.addMethod(
  18772. smalltalk.method({
  18773. selector: "visitBlockSequenceNode:",
  18774. category: 'visiting',
  18775. fn: function (aNode){
  18776. var self=this;
  18777. return smalltalk.withContext(function($ctx1) {
  18778. var $1;
  18779. $1=self._visitSequenceNode_(aNode);
  18780. return $1;
  18781. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18782. args: ["aNode"],
  18783. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  18784. messageSends: ["visitSequenceNode:"],
  18785. referencedClasses: []
  18786. }),
  18787. smalltalk.NodeVisitor);
  18788. smalltalk.addMethod(
  18789. smalltalk.method({
  18790. selector: "visitCascadeNode:",
  18791. category: 'visiting',
  18792. fn: function (aNode){
  18793. var self=this;
  18794. return smalltalk.withContext(function($ctx1) {
  18795. var $1;
  18796. $1=self._visitNode_(aNode);
  18797. return $1;
  18798. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18799. args: ["aNode"],
  18800. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  18801. messageSends: ["visitNode:"],
  18802. referencedClasses: []
  18803. }),
  18804. smalltalk.NodeVisitor);
  18805. smalltalk.addMethod(
  18806. smalltalk.method({
  18807. selector: "visitDynamicArrayNode:",
  18808. category: 'visiting',
  18809. fn: function (aNode){
  18810. var self=this;
  18811. return smalltalk.withContext(function($ctx1) {
  18812. var $1;
  18813. $1=self._visitNode_(aNode);
  18814. return $1;
  18815. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18816. args: ["aNode"],
  18817. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  18818. messageSends: ["visitNode:"],
  18819. referencedClasses: []
  18820. }),
  18821. smalltalk.NodeVisitor);
  18822. smalltalk.addMethod(
  18823. smalltalk.method({
  18824. selector: "visitDynamicDictionaryNode:",
  18825. category: 'visiting',
  18826. fn: function (aNode){
  18827. var self=this;
  18828. return smalltalk.withContext(function($ctx1) {
  18829. var $1;
  18830. $1=self._visitNode_(aNode);
  18831. return $1;
  18832. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18833. args: ["aNode"],
  18834. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  18835. messageSends: ["visitNode:"],
  18836. referencedClasses: []
  18837. }),
  18838. smalltalk.NodeVisitor);
  18839. smalltalk.addMethod(
  18840. smalltalk.method({
  18841. selector: "visitJSStatementNode:",
  18842. category: 'visiting',
  18843. fn: function (aNode){
  18844. var self=this;
  18845. return smalltalk.withContext(function($ctx1) {
  18846. var $1;
  18847. $1=self._visitNode_(aNode);
  18848. return $1;
  18849. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18850. args: ["aNode"],
  18851. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  18852. messageSends: ["visitNode:"],
  18853. referencedClasses: []
  18854. }),
  18855. smalltalk.NodeVisitor);
  18856. smalltalk.addMethod(
  18857. smalltalk.method({
  18858. selector: "visitMethodNode:",
  18859. category: 'visiting',
  18860. fn: function (aNode){
  18861. var self=this;
  18862. return smalltalk.withContext(function($ctx1) {
  18863. var $1;
  18864. $1=self._visitNode_(aNode);
  18865. return $1;
  18866. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18867. args: ["aNode"],
  18868. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  18869. messageSends: ["visitNode:"],
  18870. referencedClasses: []
  18871. }),
  18872. smalltalk.NodeVisitor);
  18873. smalltalk.addMethod(
  18874. smalltalk.method({
  18875. selector: "visitNode:",
  18876. category: 'visiting',
  18877. fn: function (aNode){
  18878. var self=this;
  18879. return smalltalk.withContext(function($ctx1) {
  18880. var $1;
  18881. $1=self._visitAll_(_st(aNode)._nodes());
  18882. return $1;
  18883. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18884. args: ["aNode"],
  18885. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  18886. messageSends: ["visitAll:", "nodes"],
  18887. referencedClasses: []
  18888. }),
  18889. smalltalk.NodeVisitor);
  18890. smalltalk.addMethod(
  18891. smalltalk.method({
  18892. selector: "visitReturnNode:",
  18893. category: 'visiting',
  18894. fn: function (aNode){
  18895. var self=this;
  18896. return smalltalk.withContext(function($ctx1) {
  18897. var $1;
  18898. $1=self._visitNode_(aNode);
  18899. return $1;
  18900. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18901. args: ["aNode"],
  18902. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  18903. messageSends: ["visitNode:"],
  18904. referencedClasses: []
  18905. }),
  18906. smalltalk.NodeVisitor);
  18907. smalltalk.addMethod(
  18908. smalltalk.method({
  18909. selector: "visitSendNode:",
  18910. category: 'visiting',
  18911. fn: function (aNode){
  18912. var self=this;
  18913. return smalltalk.withContext(function($ctx1) {
  18914. var $1;
  18915. $1=self._visitNode_(aNode);
  18916. return $1;
  18917. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18918. args: ["aNode"],
  18919. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  18920. messageSends: ["visitNode:"],
  18921. referencedClasses: []
  18922. }),
  18923. smalltalk.NodeVisitor);
  18924. smalltalk.addMethod(
  18925. smalltalk.method({
  18926. selector: "visitSequenceNode:",
  18927. category: 'visiting',
  18928. fn: function (aNode){
  18929. var self=this;
  18930. return smalltalk.withContext(function($ctx1) {
  18931. var $1;
  18932. $1=self._visitNode_(aNode);
  18933. return $1;
  18934. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18935. args: ["aNode"],
  18936. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  18937. messageSends: ["visitNode:"],
  18938. referencedClasses: []
  18939. }),
  18940. smalltalk.NodeVisitor);
  18941. smalltalk.addMethod(
  18942. smalltalk.method({
  18943. selector: "visitValueNode:",
  18944. category: 'visiting',
  18945. fn: function (aNode){
  18946. var self=this;
  18947. return smalltalk.withContext(function($ctx1) {
  18948. var $1;
  18949. $1=self._visitNode_(aNode);
  18950. return $1;
  18951. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18952. args: ["aNode"],
  18953. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  18954. messageSends: ["visitNode:"],
  18955. referencedClasses: []
  18956. }),
  18957. smalltalk.NodeVisitor);
  18958. smalltalk.addMethod(
  18959. smalltalk.method({
  18960. selector: "visitVariableNode:",
  18961. category: 'visiting',
  18962. fn: function (aNode){
  18963. var self=this;
  18964. return smalltalk.withContext(function($ctx1) {
  18965. var $1;
  18966. $1=self._visitNode_(aNode);
  18967. return $1;
  18968. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.NodeVisitor)})},
  18969. args: ["aNode"],
  18970. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  18971. messageSends: ["visitNode:"],
  18972. referencedClasses: []
  18973. }),
  18974. smalltalk.NodeVisitor);
  18975. });
  18976. define("amber_core/Compiler-AST", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st){
  18977. smalltalk.addPackage('Compiler-AST');
  18978. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18979. smalltalk.addClass('Node', smalltalk.Object, ['parent', 'position', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  18980. smalltalk.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  18981. smalltalk.addMethod(
  18982. smalltalk.method({
  18983. selector: "accept:",
  18984. category: 'visiting',
  18985. fn: function (aVisitor){
  18986. var self=this;
  18987. return smalltalk.withContext(function($ctx1) {
  18988. var $1;
  18989. $1=_st(aVisitor)._visitNode_(self);
  18990. return $1;
  18991. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.Node)})},
  18992. args: ["aVisitor"],
  18993. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  18994. messageSends: ["visitNode:"],
  18995. referencedClasses: []
  18996. }),
  18997. smalltalk.Node);
  18998. smalltalk.addMethod(
  18999. smalltalk.method({
  19000. selector: "addNode:",
  19001. category: 'accessing',
  19002. fn: function (aNode){
  19003. var self=this;
  19004. return smalltalk.withContext(function($ctx1) {
  19005. _st(self._nodes())._add_(aNode);
  19006. _st(aNode)._parent_(self);
  19007. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},smalltalk.Node)})},
  19008. args: ["aNode"],
  19009. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  19010. messageSends: ["add:", "nodes", "parent:"],
  19011. referencedClasses: []
  19012. }),
  19013. smalltalk.Node);
  19014. smalltalk.addMethod(
  19015. smalltalk.method({
  19016. selector: "isAssignmentNode",
  19017. category: 'testing',
  19018. fn: function (){
  19019. var self=this;
  19020. return smalltalk.withContext(function($ctx1) {
  19021. return false;
  19022. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.Node)})},
  19023. args: [],
  19024. source: "isAssignmentNode\x0a\x09^ false",
  19025. messageSends: [],
  19026. referencedClasses: []
  19027. }),
  19028. smalltalk.Node);
  19029. smalltalk.addMethod(
  19030. smalltalk.method({
  19031. selector: "isBlockNode",
  19032. category: 'testing',
  19033. fn: function (){
  19034. var self=this;
  19035. return smalltalk.withContext(function($ctx1) {
  19036. return false;
  19037. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.Node)})},
  19038. args: [],
  19039. source: "isBlockNode\x0a\x09^false",
  19040. messageSends: [],
  19041. referencedClasses: []
  19042. }),
  19043. smalltalk.Node);
  19044. smalltalk.addMethod(
  19045. smalltalk.method({
  19046. selector: "isBlockSequenceNode",
  19047. category: 'testing',
  19048. fn: function (){
  19049. var self=this;
  19050. return smalltalk.withContext(function($ctx1) {
  19051. return false;
  19052. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.Node)})},
  19053. args: [],
  19054. source: "isBlockSequenceNode\x0a\x09^false",
  19055. messageSends: [],
  19056. referencedClasses: []
  19057. }),
  19058. smalltalk.Node);
  19059. smalltalk.addMethod(
  19060. smalltalk.method({
  19061. selector: "isCascadeNode",
  19062. category: 'testing',
  19063. fn: function (){
  19064. var self=this;
  19065. return smalltalk.withContext(function($ctx1) {
  19066. return false;
  19067. }, function($ctx1) {$ctx1.fill(self,"isCascadeNode",{},smalltalk.Node)})},
  19068. args: [],
  19069. source: "isCascadeNode\x0a\x09^ false",
  19070. messageSends: [],
  19071. referencedClasses: []
  19072. }),
  19073. smalltalk.Node);
  19074. smalltalk.addMethod(
  19075. smalltalk.method({
  19076. selector: "isImmutable",
  19077. category: 'testing',
  19078. fn: function (){
  19079. var self=this;
  19080. return smalltalk.withContext(function($ctx1) {
  19081. return false;
  19082. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.Node)})},
  19083. args: [],
  19084. source: "isImmutable\x0a\x09^false",
  19085. messageSends: [],
  19086. referencedClasses: []
  19087. }),
  19088. smalltalk.Node);
  19089. smalltalk.addMethod(
  19090. smalltalk.method({
  19091. selector: "isJSStatementNode",
  19092. category: 'testing',
  19093. fn: function (){
  19094. var self=this;
  19095. return smalltalk.withContext(function($ctx1) {
  19096. return false;
  19097. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.Node)})},
  19098. args: [],
  19099. source: "isJSStatementNode\x0a\x09^ false",
  19100. messageSends: [],
  19101. referencedClasses: []
  19102. }),
  19103. smalltalk.Node);
  19104. smalltalk.addMethod(
  19105. smalltalk.method({
  19106. selector: "isLastChild",
  19107. category: 'testing',
  19108. fn: function (){
  19109. var self=this;
  19110. return smalltalk.withContext(function($ctx1) {
  19111. var $1;
  19112. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  19113. return $1;
  19114. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},smalltalk.Node)})},
  19115. args: [],
  19116. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  19117. messageSends: ["=", "last", "nodes", "parent"],
  19118. referencedClasses: []
  19119. }),
  19120. smalltalk.Node);
  19121. smalltalk.addMethod(
  19122. smalltalk.method({
  19123. selector: "isNode",
  19124. category: 'testing',
  19125. fn: function (){
  19126. var self=this;
  19127. return smalltalk.withContext(function($ctx1) {
  19128. return true;
  19129. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Node)})},
  19130. args: [],
  19131. source: "isNode\x0a\x09^ true",
  19132. messageSends: [],
  19133. referencedClasses: []
  19134. }),
  19135. smalltalk.Node);
  19136. smalltalk.addMethod(
  19137. smalltalk.method({
  19138. selector: "isReturnNode",
  19139. category: 'testing',
  19140. fn: function (){
  19141. var self=this;
  19142. return smalltalk.withContext(function($ctx1) {
  19143. return false;
  19144. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.Node)})},
  19145. args: [],
  19146. source: "isReturnNode\x0a\x09^false",
  19147. messageSends: [],
  19148. referencedClasses: []
  19149. }),
  19150. smalltalk.Node);
  19151. smalltalk.addMethod(
  19152. smalltalk.method({
  19153. selector: "isSendNode",
  19154. category: 'testing',
  19155. fn: function (){
  19156. var self=this;
  19157. return smalltalk.withContext(function($ctx1) {
  19158. return false;
  19159. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.Node)})},
  19160. args: [],
  19161. source: "isSendNode\x0a\x09^false",
  19162. messageSends: [],
  19163. referencedClasses: []
  19164. }),
  19165. smalltalk.Node);
  19166. smalltalk.addMethod(
  19167. smalltalk.method({
  19168. selector: "isValueNode",
  19169. category: 'testing',
  19170. fn: function (){
  19171. var self=this;
  19172. return smalltalk.withContext(function($ctx1) {
  19173. return false;
  19174. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.Node)})},
  19175. args: [],
  19176. source: "isValueNode\x0a\x09^false",
  19177. messageSends: [],
  19178. referencedClasses: []
  19179. }),
  19180. smalltalk.Node);
  19181. smalltalk.addMethod(
  19182. smalltalk.method({
  19183. selector: "nextChild",
  19184. category: 'accessing',
  19185. fn: function (){
  19186. var self=this;
  19187. return smalltalk.withContext(function($ctx1) {
  19188. var $2,$1;
  19189. $2=_st(self._nodes())._isEmpty();
  19190. if(smalltalk.assert($2)){
  19191. $1=self;
  19192. } else {
  19193. $1=_st(_st(self._nodes())._first())._nextChild();
  19194. };
  19195. return $1;
  19196. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},smalltalk.Node)})},
  19197. args: [],
  19198. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  19199. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"],
  19200. referencedClasses: []
  19201. }),
  19202. smalltalk.Node);
  19203. smalltalk.addMethod(
  19204. smalltalk.method({
  19205. selector: "nextNode",
  19206. category: 'accessing',
  19207. fn: function (){
  19208. var self=this;
  19209. return smalltalk.withContext(function($ctx1) {
  19210. var $2,$1;
  19211. $2=self._parent();
  19212. if(($receiver = $2) == nil || $receiver == null){
  19213. $1=$2;
  19214. } else {
  19215. var node;
  19216. node=$receiver;
  19217. $1=_st(node)._nextNode_(self);
  19218. };
  19219. return $1;
  19220. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.Node)})},
  19221. args: [],
  19222. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  19223. messageSends: ["ifNotNil:", "parent", "nextNode:"],
  19224. referencedClasses: []
  19225. }),
  19226. smalltalk.Node);
  19227. smalltalk.addMethod(
  19228. smalltalk.method({
  19229. selector: "nextNode:",
  19230. category: 'accessing',
  19231. fn: function (aNode){
  19232. var self=this;
  19233. var next;
  19234. return smalltalk.withContext(function($ctx1) {
  19235. var $1,$2;
  19236. var $early={};
  19237. try {
  19238. next=_st(self._nodes())._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  19239. return smalltalk.withContext(function($ctx2) {
  19240. $1=self;
  19241. throw $early=[$1];
  19242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  19243. $2=_st(next)._nextChild();
  19244. return $2;
  19245. }
  19246. catch(e) {if(e===$early)return e[0]; throw e}
  19247. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},smalltalk.Node)})},
  19248. args: ["aNode"],
  19249. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  19250. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"],
  19251. referencedClasses: []
  19252. }),
  19253. smalltalk.Node);
  19254. smalltalk.addMethod(
  19255. smalltalk.method({
  19256. selector: "nodes",
  19257. category: 'accessing',
  19258. fn: function (){
  19259. var self=this;
  19260. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19261. return smalltalk.withContext(function($ctx1) {
  19262. var $2,$1;
  19263. $2=self["@nodes"];
  19264. if(($receiver = $2) == nil || $receiver == null){
  19265. self["@nodes"]=_st($Array())._new();
  19266. $1=self["@nodes"];
  19267. } else {
  19268. $1=$2;
  19269. };
  19270. return $1;
  19271. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.Node)})},
  19272. args: [],
  19273. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  19274. messageSends: ["ifNil:", "new"],
  19275. referencedClasses: ["Array"]
  19276. }),
  19277. smalltalk.Node);
  19278. smalltalk.addMethod(
  19279. smalltalk.method({
  19280. selector: "nodes:",
  19281. category: 'building',
  19282. fn: function (aCollection){
  19283. var self=this;
  19284. return smalltalk.withContext(function($ctx1) {
  19285. self["@nodes"]=aCollection;
  19286. _st(aCollection)._do_((function(each){
  19287. return smalltalk.withContext(function($ctx2) {
  19288. return _st(each)._parent_(self);
  19289. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  19290. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},smalltalk.Node)})},
  19291. args: ["aCollection"],
  19292. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  19293. messageSends: ["do:", "parent:"],
  19294. referencedClasses: []
  19295. }),
  19296. smalltalk.Node);
  19297. smalltalk.addMethod(
  19298. smalltalk.method({
  19299. selector: "parent",
  19300. category: 'accessing',
  19301. fn: function (){
  19302. var self=this;
  19303. return smalltalk.withContext(function($ctx1) {
  19304. var $1;
  19305. $1=self["@parent"];
  19306. return $1;
  19307. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.Node)})},
  19308. args: [],
  19309. source: "parent\x0a\x09^ parent",
  19310. messageSends: [],
  19311. referencedClasses: []
  19312. }),
  19313. smalltalk.Node);
  19314. smalltalk.addMethod(
  19315. smalltalk.method({
  19316. selector: "parent:",
  19317. category: 'accessing',
  19318. fn: function (aNode){
  19319. var self=this;
  19320. return smalltalk.withContext(function($ctx1) {
  19321. self["@parent"]=aNode;
  19322. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{aNode:aNode},smalltalk.Node)})},
  19323. args: ["aNode"],
  19324. source: "parent: aNode\x0a\x09parent := aNode",
  19325. messageSends: [],
  19326. referencedClasses: []
  19327. }),
  19328. smalltalk.Node);
  19329. smalltalk.addMethod(
  19330. smalltalk.method({
  19331. selector: "position",
  19332. category: 'accessing',
  19333. fn: function (){
  19334. var self=this;
  19335. return smalltalk.withContext(function($ctx1) {
  19336. var $2,$3,$1;
  19337. $2=self["@position"];
  19338. if(($receiver = $2) == nil || $receiver == null){
  19339. $3=self._parent();
  19340. if(($receiver = $3) == nil || $receiver == null){
  19341. $1=$3;
  19342. } else {
  19343. var node;
  19344. node=$receiver;
  19345. $1=_st(node)._position();
  19346. };
  19347. } else {
  19348. $1=$2;
  19349. };
  19350. return $1;
  19351. }, function($ctx1) {$ctx1.fill(self,"position",{},smalltalk.Node)})},
  19352. args: [],
  19353. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  19354. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"],
  19355. referencedClasses: []
  19356. }),
  19357. smalltalk.Node);
  19358. smalltalk.addMethod(
  19359. smalltalk.method({
  19360. selector: "position:",
  19361. category: 'building',
  19362. fn: function (aPosition){
  19363. var self=this;
  19364. return smalltalk.withContext(function($ctx1) {
  19365. self["@position"]=aPosition;
  19366. return self}, function($ctx1) {$ctx1.fill(self,"position:",{aPosition:aPosition},smalltalk.Node)})},
  19367. args: ["aPosition"],
  19368. source: "position: aPosition\x0a\x09position := aPosition",
  19369. messageSends: [],
  19370. referencedClasses: []
  19371. }),
  19372. smalltalk.Node);
  19373. smalltalk.addMethod(
  19374. smalltalk.method({
  19375. selector: "postCopy",
  19376. category: 'copying',
  19377. fn: function (){
  19378. var self=this;
  19379. return smalltalk.withContext(function($ctx1) {
  19380. smalltalk.Node.superclass.fn.prototype._postCopy.apply(_st(self), []);
  19381. _st(self._nodes())._do_((function(each){
  19382. return smalltalk.withContext(function($ctx2) {
  19383. return _st(each)._parent_(self);
  19384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  19385. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},smalltalk.Node)})},
  19386. args: [],
  19387. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  19388. messageSends: ["postCopy", "do:", "nodes", "parent:"],
  19389. referencedClasses: []
  19390. }),
  19391. smalltalk.Node);
  19392. smalltalk.addMethod(
  19393. smalltalk.method({
  19394. selector: "shouldBeAliased",
  19395. category: 'accessing',
  19396. fn: function (){
  19397. var self=this;
  19398. return smalltalk.withContext(function($ctx1) {
  19399. var $2,$1;
  19400. $2=self["@shouldBeAliased"];
  19401. if(($receiver = $2) == nil || $receiver == null){
  19402. $1=false;
  19403. } else {
  19404. $1=$2;
  19405. };
  19406. return $1;
  19407. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},smalltalk.Node)})},
  19408. args: [],
  19409. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  19410. messageSends: ["ifNil:"],
  19411. referencedClasses: []
  19412. }),
  19413. smalltalk.Node);
  19414. smalltalk.addMethod(
  19415. smalltalk.method({
  19416. selector: "shouldBeAliased:",
  19417. category: 'accessing',
  19418. fn: function (aBoolean){
  19419. var self=this;
  19420. return smalltalk.withContext(function($ctx1) {
  19421. self["@shouldBeAliased"]=aBoolean;
  19422. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeAliased:",{aBoolean:aBoolean},smalltalk.Node)})},
  19423. args: ["aBoolean"],
  19424. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  19425. messageSends: [],
  19426. referencedClasses: []
  19427. }),
  19428. smalltalk.Node);
  19429. smalltalk.addMethod(
  19430. smalltalk.method({
  19431. selector: "shouldBeInlined",
  19432. category: 'accessing',
  19433. fn: function (){
  19434. var self=this;
  19435. return smalltalk.withContext(function($ctx1) {
  19436. var $2,$1;
  19437. $2=self["@shouldBeInlined"];
  19438. if(($receiver = $2) == nil || $receiver == null){
  19439. $1=false;
  19440. } else {
  19441. $1=$2;
  19442. };
  19443. return $1;
  19444. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},smalltalk.Node)})},
  19445. args: [],
  19446. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  19447. messageSends: ["ifNil:"],
  19448. referencedClasses: []
  19449. }),
  19450. smalltalk.Node);
  19451. smalltalk.addMethod(
  19452. smalltalk.method({
  19453. selector: "shouldBeInlined:",
  19454. category: 'accessing',
  19455. fn: function (aBoolean){
  19456. var self=this;
  19457. return smalltalk.withContext(function($ctx1) {
  19458. self["@shouldBeInlined"]=aBoolean;
  19459. return self}, function($ctx1) {$ctx1.fill(self,"shouldBeInlined:",{aBoolean:aBoolean},smalltalk.Node)})},
  19460. args: ["aBoolean"],
  19461. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  19462. messageSends: [],
  19463. referencedClasses: []
  19464. }),
  19465. smalltalk.Node);
  19466. smalltalk.addMethod(
  19467. smalltalk.method({
  19468. selector: "stopOnStepping",
  19469. category: 'testing',
  19470. fn: function (){
  19471. var self=this;
  19472. return smalltalk.withContext(function($ctx1) {
  19473. return false;
  19474. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.Node)})},
  19475. args: [],
  19476. source: "stopOnStepping\x0a\x09^ false",
  19477. messageSends: [],
  19478. referencedClasses: []
  19479. }),
  19480. smalltalk.Node);
  19481. smalltalk.addMethod(
  19482. smalltalk.method({
  19483. selector: "subtreeNeedsAliasing",
  19484. category: 'testing',
  19485. fn: function (){
  19486. var self=this;
  19487. return smalltalk.withContext(function($ctx1) {
  19488. var $1;
  19489. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  19490. return smalltalk.withContext(function($ctx2) {
  19491. return self._shouldBeInlined();
  19492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
  19493. return smalltalk.withContext(function($ctx2) {
  19494. return _st(_st(self._nodes())._detect_ifNone_((function(each){
  19495. return smalltalk.withContext(function($ctx3) {
  19496. return _st(each)._subtreeNeedsAliasing();
  19497. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}),(function(){
  19498. return smalltalk.withContext(function($ctx3) {
  19499. return false;
  19500. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))).__tild_eq(false);
  19501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  19502. return $1;
  19503. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.Node)})},
  19504. args: [],
  19505. source: "subtreeNeedsAliasing\x0a\x09^(self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09(self nodes detect: [ :each | each subtreeNeedsAliasing ] ifNone: [ false ]) ~= false ]",
  19506. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "~=", "detect:ifNone:", "nodes", "subtreeNeedsAliasing"],
  19507. referencedClasses: []
  19508. }),
  19509. smalltalk.Node);
  19510. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler-AST');
  19511. smalltalk.AssignmentNode.comment="I represent an assignment node.";
  19512. smalltalk.addMethod(
  19513. smalltalk.method({
  19514. selector: "accept:",
  19515. category: 'visiting',
  19516. fn: function (aVisitor){
  19517. var self=this;
  19518. return smalltalk.withContext(function($ctx1) {
  19519. var $1;
  19520. $1=_st(aVisitor)._visitAssignmentNode_(self);
  19521. return $1;
  19522. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.AssignmentNode)})},
  19523. args: ["aVisitor"],
  19524. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  19525. messageSends: ["visitAssignmentNode:"],
  19526. referencedClasses: []
  19527. }),
  19528. smalltalk.AssignmentNode);
  19529. smalltalk.addMethod(
  19530. smalltalk.method({
  19531. selector: "isAssignmentNode",
  19532. category: 'testing',
  19533. fn: function (){
  19534. var self=this;
  19535. return smalltalk.withContext(function($ctx1) {
  19536. return true;
  19537. }, function($ctx1) {$ctx1.fill(self,"isAssignmentNode",{},smalltalk.AssignmentNode)})},
  19538. args: [],
  19539. source: "isAssignmentNode\x0a\x09^ true",
  19540. messageSends: [],
  19541. referencedClasses: []
  19542. }),
  19543. smalltalk.AssignmentNode);
  19544. smalltalk.addMethod(
  19545. smalltalk.method({
  19546. selector: "left",
  19547. category: 'accessing',
  19548. fn: function (){
  19549. var self=this;
  19550. return smalltalk.withContext(function($ctx1) {
  19551. var $1;
  19552. $1=self["@left"];
  19553. return $1;
  19554. }, function($ctx1) {$ctx1.fill(self,"left",{},smalltalk.AssignmentNode)})},
  19555. args: [],
  19556. source: "left\x0a\x09^left",
  19557. messageSends: [],
  19558. referencedClasses: []
  19559. }),
  19560. smalltalk.AssignmentNode);
  19561. smalltalk.addMethod(
  19562. smalltalk.method({
  19563. selector: "left:",
  19564. category: 'accessing',
  19565. fn: function (aNode){
  19566. var self=this;
  19567. return smalltalk.withContext(function($ctx1) {
  19568. self["@left"]=aNode;
  19569. _st(aNode)._parent_(self);
  19570. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},smalltalk.AssignmentNode)})},
  19571. args: ["aNode"],
  19572. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  19573. messageSends: ["parent:"],
  19574. referencedClasses: []
  19575. }),
  19576. smalltalk.AssignmentNode);
  19577. smalltalk.addMethod(
  19578. smalltalk.method({
  19579. selector: "nodes",
  19580. category: 'accessing',
  19581. fn: function (){
  19582. var self=this;
  19583. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19584. return smalltalk.withContext(function($ctx1) {
  19585. var $1;
  19586. $1=_st($Array())._with_with_(self._left(),self._right());
  19587. return $1;
  19588. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.AssignmentNode)})},
  19589. args: [],
  19590. source: "nodes\x0a\x09^ Array with: self left with: self right",
  19591. messageSends: ["with:with:", "left", "right"],
  19592. referencedClasses: ["Array"]
  19593. }),
  19594. smalltalk.AssignmentNode);
  19595. smalltalk.addMethod(
  19596. smalltalk.method({
  19597. selector: "right",
  19598. category: 'accessing',
  19599. fn: function (){
  19600. var self=this;
  19601. return smalltalk.withContext(function($ctx1) {
  19602. var $1;
  19603. $1=self["@right"];
  19604. return $1;
  19605. }, function($ctx1) {$ctx1.fill(self,"right",{},smalltalk.AssignmentNode)})},
  19606. args: [],
  19607. source: "right\x0a\x09^right",
  19608. messageSends: [],
  19609. referencedClasses: []
  19610. }),
  19611. smalltalk.AssignmentNode);
  19612. smalltalk.addMethod(
  19613. smalltalk.method({
  19614. selector: "right:",
  19615. category: 'accessing',
  19616. fn: function (aNode){
  19617. var self=this;
  19618. return smalltalk.withContext(function($ctx1) {
  19619. self["@right"]=aNode;
  19620. _st(aNode)._parent_(self);
  19621. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},smalltalk.AssignmentNode)})},
  19622. args: ["aNode"],
  19623. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  19624. messageSends: ["parent:"],
  19625. referencedClasses: []
  19626. }),
  19627. smalltalk.AssignmentNode);
  19628. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'scope'], 'Compiler-AST');
  19629. smalltalk.BlockNode.comment="I represent an block closure node.";
  19630. smalltalk.addMethod(
  19631. smalltalk.method({
  19632. selector: "accept:",
  19633. category: 'visiting',
  19634. fn: function (aVisitor){
  19635. var self=this;
  19636. return smalltalk.withContext(function($ctx1) {
  19637. var $1;
  19638. $1=_st(aVisitor)._visitBlockNode_(self);
  19639. return $1;
  19640. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockNode)})},
  19641. args: ["aVisitor"],
  19642. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  19643. messageSends: ["visitBlockNode:"],
  19644. referencedClasses: []
  19645. }),
  19646. smalltalk.BlockNode);
  19647. smalltalk.addMethod(
  19648. smalltalk.method({
  19649. selector: "isBlockNode",
  19650. category: 'testing',
  19651. fn: function (){
  19652. var self=this;
  19653. return smalltalk.withContext(function($ctx1) {
  19654. return true;
  19655. }, function($ctx1) {$ctx1.fill(self,"isBlockNode",{},smalltalk.BlockNode)})},
  19656. args: [],
  19657. source: "isBlockNode\x0a\x09^true",
  19658. messageSends: [],
  19659. referencedClasses: []
  19660. }),
  19661. smalltalk.BlockNode);
  19662. smalltalk.addMethod(
  19663. smalltalk.method({
  19664. selector: "nextChild",
  19665. category: 'accessing',
  19666. fn: function (){
  19667. var self=this;
  19668. return smalltalk.withContext(function($ctx1) {
  19669. var $1;
  19670. $1=self;
  19671. return $1;
  19672. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},smalltalk.BlockNode)})},
  19673. args: [],
  19674. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  19675. messageSends: [],
  19676. referencedClasses: []
  19677. }),
  19678. smalltalk.BlockNode);
  19679. smalltalk.addMethod(
  19680. smalltalk.method({
  19681. selector: "nextNode:",
  19682. category: 'accessing',
  19683. fn: function (aNode){
  19684. var self=this;
  19685. return smalltalk.withContext(function($ctx1) {
  19686. var $1;
  19687. $1=self;
  19688. return $1;
  19689. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode},smalltalk.BlockNode)})},
  19690. args: ["aNode"],
  19691. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  19692. messageSends: [],
  19693. referencedClasses: []
  19694. }),
  19695. smalltalk.BlockNode);
  19696. smalltalk.addMethod(
  19697. smalltalk.method({
  19698. selector: "parameters",
  19699. category: 'accessing',
  19700. fn: function (){
  19701. var self=this;
  19702. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  19703. return smalltalk.withContext(function($ctx1) {
  19704. var $2,$1;
  19705. $2=self["@parameters"];
  19706. if(($receiver = $2) == nil || $receiver == null){
  19707. self["@parameters"]=_st($Array())._new();
  19708. $1=self["@parameters"];
  19709. } else {
  19710. $1=$2;
  19711. };
  19712. return $1;
  19713. }, function($ctx1) {$ctx1.fill(self,"parameters",{},smalltalk.BlockNode)})},
  19714. args: [],
  19715. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  19716. messageSends: ["ifNil:", "new"],
  19717. referencedClasses: ["Array"]
  19718. }),
  19719. smalltalk.BlockNode);
  19720. smalltalk.addMethod(
  19721. smalltalk.method({
  19722. selector: "parameters:",
  19723. category: 'accessing',
  19724. fn: function (aCollection){
  19725. var self=this;
  19726. return smalltalk.withContext(function($ctx1) {
  19727. self["@parameters"]=aCollection;
  19728. return self}, function($ctx1) {$ctx1.fill(self,"parameters:",{aCollection:aCollection},smalltalk.BlockNode)})},
  19729. args: ["aCollection"],
  19730. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  19731. messageSends: [],
  19732. referencedClasses: []
  19733. }),
  19734. smalltalk.BlockNode);
  19735. smalltalk.addMethod(
  19736. smalltalk.method({
  19737. selector: "scope",
  19738. category: 'accessing',
  19739. fn: function (){
  19740. var self=this;
  19741. return smalltalk.withContext(function($ctx1) {
  19742. var $1;
  19743. $1=self["@scope"];
  19744. return $1;
  19745. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.BlockNode)})},
  19746. args: [],
  19747. source: "scope\x0a\x09^ scope",
  19748. messageSends: [],
  19749. referencedClasses: []
  19750. }),
  19751. smalltalk.BlockNode);
  19752. smalltalk.addMethod(
  19753. smalltalk.method({
  19754. selector: "scope:",
  19755. category: 'accessing',
  19756. fn: function (aLexicalScope){
  19757. var self=this;
  19758. return smalltalk.withContext(function($ctx1) {
  19759. self["@scope"]=aLexicalScope;
  19760. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.BlockNode)})},
  19761. args: ["aLexicalScope"],
  19762. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  19763. messageSends: [],
  19764. referencedClasses: []
  19765. }),
  19766. smalltalk.BlockNode);
  19767. smalltalk.addMethod(
  19768. smalltalk.method({
  19769. selector: "subtreeNeedsAliasing",
  19770. category: 'testing',
  19771. fn: function (){
  19772. var self=this;
  19773. return smalltalk.withContext(function($ctx1) {
  19774. var $1;
  19775. $1=_st(self._shouldBeAliased())._or_((function(){
  19776. return smalltalk.withContext(function($ctx2) {
  19777. return self._shouldBeInlined();
  19778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  19779. return $1;
  19780. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},smalltalk.BlockNode)})},
  19781. args: [],
  19782. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  19783. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"],
  19784. referencedClasses: []
  19785. }),
  19786. smalltalk.BlockNode);
  19787. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler-AST');
  19788. smalltalk.CascadeNode.comment="I represent an cascade node.";
  19789. smalltalk.addMethod(
  19790. smalltalk.method({
  19791. selector: "accept:",
  19792. category: 'visiting',
  19793. fn: function (aVisitor){
  19794. var self=this;
  19795. return smalltalk.withContext(function($ctx1) {
  19796. var $1;
  19797. $1=_st(aVisitor)._visitCascadeNode_(self);
  19798. return $1;
  19799. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.CascadeNode)})},
  19800. args: ["aVisitor"],
  19801. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  19802. messageSends: ["visitCascadeNode:"],
  19803. referencedClasses: []
  19804. }),
  19805. smalltalk.CascadeNode);
  19806. smalltalk.addMethod(
  19807. smalltalk.method({
  19808. selector: "isCascadeNode",
  19809. category: 'testing',
  19810. fn: function (){
  19811. var self=this;
  19812. return smalltalk.withContext(function($ctx1) {
  19813. return true;
  19814. }, function($ctx1) {$ctx1.fill(self,"isCascadeNode",{},smalltalk.CascadeNode)})},
  19815. args: [],
  19816. source: "isCascadeNode\x0a\x09^ true",
  19817. messageSends: [],
  19818. referencedClasses: []
  19819. }),
  19820. smalltalk.CascadeNode);
  19821. smalltalk.addMethod(
  19822. smalltalk.method({
  19823. selector: "receiver",
  19824. category: 'accessing',
  19825. fn: function (){
  19826. var self=this;
  19827. return smalltalk.withContext(function($ctx1) {
  19828. var $1;
  19829. $1=self["@receiver"];
  19830. return $1;
  19831. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.CascadeNode)})},
  19832. args: [],
  19833. source: "receiver\x0a\x09^receiver",
  19834. messageSends: [],
  19835. referencedClasses: []
  19836. }),
  19837. smalltalk.CascadeNode);
  19838. smalltalk.addMethod(
  19839. smalltalk.method({
  19840. selector: "receiver:",
  19841. category: 'accessing',
  19842. fn: function (aNode){
  19843. var self=this;
  19844. return smalltalk.withContext(function($ctx1) {
  19845. self["@receiver"]=aNode;
  19846. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.CascadeNode)})},
  19847. args: ["aNode"],
  19848. source: "receiver: aNode\x0a\x09receiver := aNode",
  19849. messageSends: [],
  19850. referencedClasses: []
  19851. }),
  19852. smalltalk.CascadeNode);
  19853. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler-AST');
  19854. smalltalk.DynamicArrayNode.comment="I represent an dynamic array node.";
  19855. smalltalk.addMethod(
  19856. smalltalk.method({
  19857. selector: "accept:",
  19858. category: 'visiting',
  19859. fn: function (aVisitor){
  19860. var self=this;
  19861. return smalltalk.withContext(function($ctx1) {
  19862. var $1;
  19863. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  19864. return $1;
  19865. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicArrayNode)})},
  19866. args: ["aVisitor"],
  19867. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  19868. messageSends: ["visitDynamicArrayNode:"],
  19869. referencedClasses: []
  19870. }),
  19871. smalltalk.DynamicArrayNode);
  19872. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler-AST');
  19873. smalltalk.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  19874. smalltalk.addMethod(
  19875. smalltalk.method({
  19876. selector: "accept:",
  19877. category: 'visiting',
  19878. fn: function (aVisitor){
  19879. var self=this;
  19880. return smalltalk.withContext(function($ctx1) {
  19881. var $1;
  19882. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  19883. return $1;
  19884. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.DynamicDictionaryNode)})},
  19885. args: ["aVisitor"],
  19886. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  19887. messageSends: ["visitDynamicDictionaryNode:"],
  19888. referencedClasses: []
  19889. }),
  19890. smalltalk.DynamicDictionaryNode);
  19891. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler-AST');
  19892. smalltalk.JSStatementNode.comment="I represent an JavaScript statement node.";
  19893. smalltalk.addMethod(
  19894. smalltalk.method({
  19895. selector: "accept:",
  19896. category: 'visiting',
  19897. fn: function (aVisitor){
  19898. var self=this;
  19899. return smalltalk.withContext(function($ctx1) {
  19900. var $1;
  19901. $1=_st(aVisitor)._visitJSStatementNode_(self);
  19902. return $1;
  19903. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.JSStatementNode)})},
  19904. args: ["aVisitor"],
  19905. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  19906. messageSends: ["visitJSStatementNode:"],
  19907. referencedClasses: []
  19908. }),
  19909. smalltalk.JSStatementNode);
  19910. smalltalk.addMethod(
  19911. smalltalk.method({
  19912. selector: "isJSStatementNode",
  19913. category: 'testing',
  19914. fn: function (){
  19915. var self=this;
  19916. return smalltalk.withContext(function($ctx1) {
  19917. return true;
  19918. }, function($ctx1) {$ctx1.fill(self,"isJSStatementNode",{},smalltalk.JSStatementNode)})},
  19919. args: [],
  19920. source: "isJSStatementNode\x0a\x09^ true",
  19921. messageSends: [],
  19922. referencedClasses: []
  19923. }),
  19924. smalltalk.JSStatementNode);
  19925. smalltalk.addMethod(
  19926. smalltalk.method({
  19927. selector: "source",
  19928. category: 'accessing',
  19929. fn: function (){
  19930. var self=this;
  19931. return smalltalk.withContext(function($ctx1) {
  19932. var $2,$1;
  19933. $2=self["@source"];
  19934. if(($receiver = $2) == nil || $receiver == null){
  19935. $1="";
  19936. } else {
  19937. $1=$2;
  19938. };
  19939. return $1;
  19940. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.JSStatementNode)})},
  19941. args: [],
  19942. source: "source\x0a\x09^source ifNil: ['']",
  19943. messageSends: ["ifNil:"],
  19944. referencedClasses: []
  19945. }),
  19946. smalltalk.JSStatementNode);
  19947. smalltalk.addMethod(
  19948. smalltalk.method({
  19949. selector: "source:",
  19950. category: 'accessing',
  19951. fn: function (aString){
  19952. var self=this;
  19953. return smalltalk.withContext(function($ctx1) {
  19954. self["@source"]=aString;
  19955. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.JSStatementNode)})},
  19956. args: ["aString"],
  19957. source: "source: aString\x0a\x09source := aString",
  19958. messageSends: [],
  19959. referencedClasses: []
  19960. }),
  19961. smalltalk.JSStatementNode);
  19962. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'messageSends', 'superSends'], 'Compiler-AST');
  19963. smalltalk.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  19964. smalltalk.addMethod(
  19965. smalltalk.method({
  19966. selector: "accept:",
  19967. category: 'visiting',
  19968. fn: function (aVisitor){
  19969. var self=this;
  19970. return smalltalk.withContext(function($ctx1) {
  19971. var $1;
  19972. $1=_st(aVisitor)._visitMethodNode_(self);
  19973. return $1;
  19974. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.MethodNode)})},
  19975. args: ["aVisitor"],
  19976. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  19977. messageSends: ["visitMethodNode:"],
  19978. referencedClasses: []
  19979. }),
  19980. smalltalk.MethodNode);
  19981. smalltalk.addMethod(
  19982. smalltalk.method({
  19983. selector: "arguments",
  19984. category: 'accessing',
  19985. fn: function (){
  19986. var self=this;
  19987. return smalltalk.withContext(function($ctx1) {
  19988. var $2,$1;
  19989. $2=self["@arguments"];
  19990. if(($receiver = $2) == nil || $receiver == null){
  19991. $1=[];
  19992. } else {
  19993. $1=$2;
  19994. };
  19995. return $1;
  19996. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.MethodNode)})},
  19997. args: [],
  19998. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  19999. messageSends: ["ifNil:"],
  20000. referencedClasses: []
  20001. }),
  20002. smalltalk.MethodNode);
  20003. smalltalk.addMethod(
  20004. smalltalk.method({
  20005. selector: "arguments:",
  20006. category: 'accessing',
  20007. fn: function (aCollection){
  20008. var self=this;
  20009. return smalltalk.withContext(function($ctx1) {
  20010. self["@arguments"]=aCollection;
  20011. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.MethodNode)})},
  20012. args: ["aCollection"],
  20013. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  20014. messageSends: [],
  20015. referencedClasses: []
  20016. }),
  20017. smalltalk.MethodNode);
  20018. smalltalk.addMethod(
  20019. smalltalk.method({
  20020. selector: "classReferences",
  20021. category: 'accessing',
  20022. fn: function (){
  20023. var self=this;
  20024. return smalltalk.withContext(function($ctx1) {
  20025. var $1;
  20026. $1=self["@classReferences"];
  20027. return $1;
  20028. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.MethodNode)})},
  20029. args: [],
  20030. source: "classReferences\x0a\x09^ classReferences",
  20031. messageSends: [],
  20032. referencedClasses: []
  20033. }),
  20034. smalltalk.MethodNode);
  20035. smalltalk.addMethod(
  20036. smalltalk.method({
  20037. selector: "classReferences:",
  20038. category: 'accessing',
  20039. fn: function (aCollection){
  20040. var self=this;
  20041. return smalltalk.withContext(function($ctx1) {
  20042. self["@classReferences"]=aCollection;
  20043. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.MethodNode)})},
  20044. args: ["aCollection"],
  20045. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  20046. messageSends: [],
  20047. referencedClasses: []
  20048. }),
  20049. smalltalk.MethodNode);
  20050. smalltalk.addMethod(
  20051. smalltalk.method({
  20052. selector: "extent",
  20053. category: 'accessing',
  20054. fn: function (){
  20055. var self=this;
  20056. return smalltalk.withContext(function($ctx1) {
  20057. var $1;
  20058. $1=_st(_st(_st(self._source())._lines())._size()).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__plus((1)));
  20059. return $1;
  20060. }, function($ctx1) {$ctx1.fill(self,"extent",{},smalltalk.MethodNode)})},
  20061. args: [],
  20062. source: "extent\x0a\x09^ self source lines size @ (self source lines last size + 1)",
  20063. messageSends: ["@", "size", "lines", "source", "+", "last"],
  20064. referencedClasses: []
  20065. }),
  20066. smalltalk.MethodNode);
  20067. smalltalk.addMethod(
  20068. smalltalk.method({
  20069. selector: "messageSends",
  20070. category: 'accessing',
  20071. fn: function (){
  20072. var self=this;
  20073. return smalltalk.withContext(function($ctx1) {
  20074. var $1;
  20075. $1=self["@messageSends"];
  20076. return $1;
  20077. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.MethodNode)})},
  20078. args: [],
  20079. source: "messageSends\x0a\x09^ messageSends",
  20080. messageSends: [],
  20081. referencedClasses: []
  20082. }),
  20083. smalltalk.MethodNode);
  20084. smalltalk.addMethod(
  20085. smalltalk.method({
  20086. selector: "messageSends:",
  20087. category: 'accessing',
  20088. fn: function (aCollection){
  20089. var self=this;
  20090. return smalltalk.withContext(function($ctx1) {
  20091. self["@messageSends"]=aCollection;
  20092. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  20093. args: ["aCollection"],
  20094. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  20095. messageSends: [],
  20096. referencedClasses: []
  20097. }),
  20098. smalltalk.MethodNode);
  20099. smalltalk.addMethod(
  20100. smalltalk.method({
  20101. selector: "scope",
  20102. category: 'accessing',
  20103. fn: function (){
  20104. var self=this;
  20105. return smalltalk.withContext(function($ctx1) {
  20106. var $1;
  20107. $1=self["@scope"];
  20108. return $1;
  20109. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.MethodNode)})},
  20110. args: [],
  20111. source: "scope\x0a\x09^ scope",
  20112. messageSends: [],
  20113. referencedClasses: []
  20114. }),
  20115. smalltalk.MethodNode);
  20116. smalltalk.addMethod(
  20117. smalltalk.method({
  20118. selector: "scope:",
  20119. category: 'accessing',
  20120. fn: function (aMethodScope){
  20121. var self=this;
  20122. return smalltalk.withContext(function($ctx1) {
  20123. self["@scope"]=aMethodScope;
  20124. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aMethodScope:aMethodScope},smalltalk.MethodNode)})},
  20125. args: ["aMethodScope"],
  20126. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  20127. messageSends: [],
  20128. referencedClasses: []
  20129. }),
  20130. smalltalk.MethodNode);
  20131. smalltalk.addMethod(
  20132. smalltalk.method({
  20133. selector: "selector",
  20134. category: 'accessing',
  20135. fn: function (){
  20136. var self=this;
  20137. return smalltalk.withContext(function($ctx1) {
  20138. var $1;
  20139. $1=self["@selector"];
  20140. return $1;
  20141. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodNode)})},
  20142. args: [],
  20143. source: "selector\x0a\x09^selector",
  20144. messageSends: [],
  20145. referencedClasses: []
  20146. }),
  20147. smalltalk.MethodNode);
  20148. smalltalk.addMethod(
  20149. smalltalk.method({
  20150. selector: "selector:",
  20151. category: 'accessing',
  20152. fn: function (aString){
  20153. var self=this;
  20154. return smalltalk.withContext(function($ctx1) {
  20155. self["@selector"]=aString;
  20156. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.MethodNode)})},
  20157. args: ["aString"],
  20158. source: "selector: aString\x0a\x09selector := aString",
  20159. messageSends: [],
  20160. referencedClasses: []
  20161. }),
  20162. smalltalk.MethodNode);
  20163. smalltalk.addMethod(
  20164. smalltalk.method({
  20165. selector: "source",
  20166. category: 'accessing',
  20167. fn: function (){
  20168. var self=this;
  20169. return smalltalk.withContext(function($ctx1) {
  20170. var $1;
  20171. $1=self["@source"];
  20172. return $1;
  20173. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.MethodNode)})},
  20174. args: [],
  20175. source: "source\x0a\x09^source",
  20176. messageSends: [],
  20177. referencedClasses: []
  20178. }),
  20179. smalltalk.MethodNode);
  20180. smalltalk.addMethod(
  20181. smalltalk.method({
  20182. selector: "source:",
  20183. category: 'accessing',
  20184. fn: function (aString){
  20185. var self=this;
  20186. return smalltalk.withContext(function($ctx1) {
  20187. self["@source"]=aString;
  20188. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.MethodNode)})},
  20189. args: ["aString"],
  20190. source: "source: aString\x0a\x09source := aString",
  20191. messageSends: [],
  20192. referencedClasses: []
  20193. }),
  20194. smalltalk.MethodNode);
  20195. smalltalk.addMethod(
  20196. smalltalk.method({
  20197. selector: "superSends",
  20198. category: 'accessing',
  20199. fn: function (){
  20200. var self=this;
  20201. return smalltalk.withContext(function($ctx1) {
  20202. var $1;
  20203. $1=self["@superSends"];
  20204. return $1;
  20205. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.MethodNode)})},
  20206. args: [],
  20207. source: "superSends\x0a\x09^ superSends",
  20208. messageSends: [],
  20209. referencedClasses: []
  20210. }),
  20211. smalltalk.MethodNode);
  20212. smalltalk.addMethod(
  20213. smalltalk.method({
  20214. selector: "superSends:",
  20215. category: 'accessing',
  20216. fn: function (aCollection){
  20217. var self=this;
  20218. return smalltalk.withContext(function($ctx1) {
  20219. self["@superSends"]=aCollection;
  20220. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.MethodNode)})},
  20221. args: ["aCollection"],
  20222. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  20223. messageSends: [],
  20224. referencedClasses: []
  20225. }),
  20226. smalltalk.MethodNode);
  20227. smalltalk.addClass('ReturnNode', smalltalk.Node, ['scope'], 'Compiler-AST');
  20228. smalltalk.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  20229. smalltalk.addMethod(
  20230. smalltalk.method({
  20231. selector: "accept:",
  20232. category: 'visiting',
  20233. fn: function (aVisitor){
  20234. var self=this;
  20235. return smalltalk.withContext(function($ctx1) {
  20236. var $1;
  20237. $1=_st(aVisitor)._visitReturnNode_(self);
  20238. return $1;
  20239. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ReturnNode)})},
  20240. args: ["aVisitor"],
  20241. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  20242. messageSends: ["visitReturnNode:"],
  20243. referencedClasses: []
  20244. }),
  20245. smalltalk.ReturnNode);
  20246. smalltalk.addMethod(
  20247. smalltalk.method({
  20248. selector: "isReturnNode",
  20249. category: 'testing',
  20250. fn: function (){
  20251. var self=this;
  20252. return smalltalk.withContext(function($ctx1) {
  20253. return true;
  20254. }, function($ctx1) {$ctx1.fill(self,"isReturnNode",{},smalltalk.ReturnNode)})},
  20255. args: [],
  20256. source: "isReturnNode\x0a\x09^ true",
  20257. messageSends: [],
  20258. referencedClasses: []
  20259. }),
  20260. smalltalk.ReturnNode);
  20261. smalltalk.addMethod(
  20262. smalltalk.method({
  20263. selector: "nonLocalReturn",
  20264. category: 'testing',
  20265. fn: function (){
  20266. var self=this;
  20267. return smalltalk.withContext(function($ctx1) {
  20268. var $1;
  20269. $1=_st(_st(self._scope())._isMethodScope())._not();
  20270. return $1;
  20271. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},smalltalk.ReturnNode)})},
  20272. args: [],
  20273. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  20274. messageSends: ["not", "isMethodScope", "scope"],
  20275. referencedClasses: []
  20276. }),
  20277. smalltalk.ReturnNode);
  20278. smalltalk.addMethod(
  20279. smalltalk.method({
  20280. selector: "scope",
  20281. category: 'accessing',
  20282. fn: function (){
  20283. var self=this;
  20284. return smalltalk.withContext(function($ctx1) {
  20285. var $1;
  20286. $1=self["@scope"];
  20287. return $1;
  20288. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ReturnNode)})},
  20289. args: [],
  20290. source: "scope\x0a\x09^ scope",
  20291. messageSends: [],
  20292. referencedClasses: []
  20293. }),
  20294. smalltalk.ReturnNode);
  20295. smalltalk.addMethod(
  20296. smalltalk.method({
  20297. selector: "scope:",
  20298. category: 'accessing',
  20299. fn: function (aLexicalScope){
  20300. var self=this;
  20301. return smalltalk.withContext(function($ctx1) {
  20302. self["@scope"]=aLexicalScope;
  20303. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.ReturnNode)})},
  20304. args: ["aLexicalScope"],
  20305. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  20306. messageSends: [],
  20307. referencedClasses: []
  20308. }),
  20309. smalltalk.ReturnNode);
  20310. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  20311. smalltalk.SendNode.comment="I represent an message send node.";
  20312. smalltalk.addMethod(
  20313. smalltalk.method({
  20314. selector: "accept:",
  20315. category: 'visiting',
  20316. fn: function (aVisitor){
  20317. var self=this;
  20318. return smalltalk.withContext(function($ctx1) {
  20319. var $1;
  20320. $1=_st(aVisitor)._visitSendNode_(self);
  20321. return $1;
  20322. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SendNode)})},
  20323. args: ["aVisitor"],
  20324. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  20325. messageSends: ["visitSendNode:"],
  20326. referencedClasses: []
  20327. }),
  20328. smalltalk.SendNode);
  20329. smalltalk.addMethod(
  20330. smalltalk.method({
  20331. selector: "arguments",
  20332. category: 'accessing',
  20333. fn: function (){
  20334. var self=this;
  20335. return smalltalk.withContext(function($ctx1) {
  20336. var $2,$1;
  20337. $2=self["@arguments"];
  20338. if(($receiver = $2) == nil || $receiver == null){
  20339. self["@arguments"]=[];
  20340. $1=self["@arguments"];
  20341. } else {
  20342. $1=$2;
  20343. };
  20344. return $1;
  20345. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.SendNode)})},
  20346. args: [],
  20347. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  20348. messageSends: ["ifNil:"],
  20349. referencedClasses: []
  20350. }),
  20351. smalltalk.SendNode);
  20352. smalltalk.addMethod(
  20353. smalltalk.method({
  20354. selector: "arguments:",
  20355. category: 'accessing',
  20356. fn: function (aCollection){
  20357. var self=this;
  20358. return smalltalk.withContext(function($ctx1) {
  20359. self["@arguments"]=aCollection;
  20360. _st(aCollection)._do_((function(each){
  20361. return smalltalk.withContext(function($ctx2) {
  20362. return _st(each)._parent_(self);
  20363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  20364. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.SendNode)})},
  20365. args: ["aCollection"],
  20366. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  20367. messageSends: ["do:", "parent:"],
  20368. referencedClasses: []
  20369. }),
  20370. smalltalk.SendNode);
  20371. smalltalk.addMethod(
  20372. smalltalk.method({
  20373. selector: "cascadeNodeWithMessages:",
  20374. category: 'accessing',
  20375. fn: function (aCollection){
  20376. var self=this;
  20377. var first;
  20378. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  20379. function $CascadeNode(){return smalltalk.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  20380. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  20381. return smalltalk.withContext(function($ctx1) {
  20382. var $1,$2,$4,$5,$3;
  20383. $1=_st($SendNode())._new();
  20384. _st($1)._selector_(self._selector());
  20385. _st($1)._arguments_(self._arguments());
  20386. $2=_st($1)._yourself();
  20387. first=$2;
  20388. $4=_st($CascadeNode())._new();
  20389. _st($4)._receiver_(self._receiver());
  20390. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  20391. $5=_st($4)._yourself();
  20392. $3=$5;
  20393. return $3;
  20394. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},smalltalk.SendNode)})},
  20395. args: ["aCollection"],
  20396. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  20397. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  20398. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  20399. }),
  20400. smalltalk.SendNode);
  20401. smalltalk.addMethod(
  20402. smalltalk.method({
  20403. selector: "index",
  20404. category: 'accessing',
  20405. fn: function (){
  20406. var self=this;
  20407. return smalltalk.withContext(function($ctx1) {
  20408. var $1;
  20409. $1=self["@index"];
  20410. return $1;
  20411. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.SendNode)})},
  20412. args: [],
  20413. source: "index\x0a\x09^ index",
  20414. messageSends: [],
  20415. referencedClasses: []
  20416. }),
  20417. smalltalk.SendNode);
  20418. smalltalk.addMethod(
  20419. smalltalk.method({
  20420. selector: "index:",
  20421. category: 'accessing',
  20422. fn: function (anInteger){
  20423. var self=this;
  20424. return smalltalk.withContext(function($ctx1) {
  20425. self["@index"]=anInteger;
  20426. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.SendNode)})},
  20427. args: ["anInteger"],
  20428. source: "index: anInteger\x0a\x09index := anInteger",
  20429. messageSends: [],
  20430. referencedClasses: []
  20431. }),
  20432. smalltalk.SendNode);
  20433. smalltalk.addMethod(
  20434. smalltalk.method({
  20435. selector: "isCascadeSendNode",
  20436. category: 'testing',
  20437. fn: function (){
  20438. var self=this;
  20439. return smalltalk.withContext(function($ctx1) {
  20440. var $1;
  20441. $1=_st(self._parent())._isCascadeNode();
  20442. return $1;
  20443. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},smalltalk.SendNode)})},
  20444. args: [],
  20445. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  20446. messageSends: ["isCascadeNode", "parent"],
  20447. referencedClasses: []
  20448. }),
  20449. smalltalk.SendNode);
  20450. smalltalk.addMethod(
  20451. smalltalk.method({
  20452. selector: "isSendNode",
  20453. category: 'testing',
  20454. fn: function (){
  20455. var self=this;
  20456. return smalltalk.withContext(function($ctx1) {
  20457. return true;
  20458. }, function($ctx1) {$ctx1.fill(self,"isSendNode",{},smalltalk.SendNode)})},
  20459. args: [],
  20460. source: "isSendNode\x0a\x09^ true",
  20461. messageSends: [],
  20462. referencedClasses: []
  20463. }),
  20464. smalltalk.SendNode);
  20465. smalltalk.addMethod(
  20466. smalltalk.method({
  20467. selector: "nodes",
  20468. category: 'accessing',
  20469. fn: function (){
  20470. var self=this;
  20471. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  20472. return smalltalk.withContext(function($ctx1) {
  20473. var $1,$2,$4,$5,$3;
  20474. $1=self._receiver();
  20475. if(($receiver = $1) == nil || $receiver == null){
  20476. $2=_st(self._arguments())._copy();
  20477. return $2;
  20478. } else {
  20479. $1;
  20480. };
  20481. $4=_st($Array())._with_(self._receiver());
  20482. _st($4)._addAll_(self._arguments());
  20483. $5=_st($4)._yourself();
  20484. $3=$5;
  20485. return $3;
  20486. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.SendNode)})},
  20487. args: [],
  20488. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  20489. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  20490. referencedClasses: ["Array"]
  20491. }),
  20492. smalltalk.SendNode);
  20493. smalltalk.addMethod(
  20494. smalltalk.method({
  20495. selector: "receiver",
  20496. category: 'accessing',
  20497. fn: function (){
  20498. var self=this;
  20499. return smalltalk.withContext(function($ctx1) {
  20500. var $1;
  20501. $1=self["@receiver"];
  20502. return $1;
  20503. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.SendNode)})},
  20504. args: [],
  20505. source: "receiver\x0a\x09^receiver",
  20506. messageSends: [],
  20507. referencedClasses: []
  20508. }),
  20509. smalltalk.SendNode);
  20510. smalltalk.addMethod(
  20511. smalltalk.method({
  20512. selector: "receiver:",
  20513. category: 'accessing',
  20514. fn: function (aNode){
  20515. var self=this;
  20516. return smalltalk.withContext(function($ctx1) {
  20517. var $1;
  20518. self["@receiver"]=aNode;
  20519. $1=_st(aNode)._isNode();
  20520. if(smalltalk.assert($1)){
  20521. _st(aNode)._parent_(self);
  20522. };
  20523. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},smalltalk.SendNode)})},
  20524. args: ["aNode"],
  20525. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  20526. messageSends: ["ifTrue:", "isNode", "parent:"],
  20527. referencedClasses: []
  20528. }),
  20529. smalltalk.SendNode);
  20530. smalltalk.addMethod(
  20531. smalltalk.method({
  20532. selector: "selector",
  20533. category: 'accessing',
  20534. fn: function (){
  20535. var self=this;
  20536. return smalltalk.withContext(function($ctx1) {
  20537. var $1;
  20538. $1=self["@selector"];
  20539. return $1;
  20540. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.SendNode)})},
  20541. args: [],
  20542. source: "selector\x0a\x09^selector",
  20543. messageSends: [],
  20544. referencedClasses: []
  20545. }),
  20546. smalltalk.SendNode);
  20547. smalltalk.addMethod(
  20548. smalltalk.method({
  20549. selector: "selector:",
  20550. category: 'accessing',
  20551. fn: function (aString){
  20552. var self=this;
  20553. return smalltalk.withContext(function($ctx1) {
  20554. self["@selector"]=aString;
  20555. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.SendNode)})},
  20556. args: ["aString"],
  20557. source: "selector: aString\x0a\x09selector := aString",
  20558. messageSends: [],
  20559. referencedClasses: []
  20560. }),
  20561. smalltalk.SendNode);
  20562. smalltalk.addMethod(
  20563. smalltalk.method({
  20564. selector: "stopOnStepping",
  20565. category: 'testing',
  20566. fn: function (){
  20567. var self=this;
  20568. return smalltalk.withContext(function($ctx1) {
  20569. return true;
  20570. }, function($ctx1) {$ctx1.fill(self,"stopOnStepping",{},smalltalk.SendNode)})},
  20571. args: [],
  20572. source: "stopOnStepping\x0a\x09^ true",
  20573. messageSends: [],
  20574. referencedClasses: []
  20575. }),
  20576. smalltalk.SendNode);
  20577. smalltalk.addMethod(
  20578. smalltalk.method({
  20579. selector: "superSend",
  20580. category: 'accessing',
  20581. fn: function (){
  20582. var self=this;
  20583. return smalltalk.withContext(function($ctx1) {
  20584. var $2,$1;
  20585. $2=self["@superSend"];
  20586. if(($receiver = $2) == nil || $receiver == null){
  20587. $1=false;
  20588. } else {
  20589. $1=$2;
  20590. };
  20591. return $1;
  20592. }, function($ctx1) {$ctx1.fill(self,"superSend",{},smalltalk.SendNode)})},
  20593. args: [],
  20594. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  20595. messageSends: ["ifNil:"],
  20596. referencedClasses: []
  20597. }),
  20598. smalltalk.SendNode);
  20599. smalltalk.addMethod(
  20600. smalltalk.method({
  20601. selector: "superSend:",
  20602. category: 'accessing',
  20603. fn: function (aBoolean){
  20604. var self=this;
  20605. return smalltalk.withContext(function($ctx1) {
  20606. self["@superSend"]=aBoolean;
  20607. return self}, function($ctx1) {$ctx1.fill(self,"superSend:",{aBoolean:aBoolean},smalltalk.SendNode)})},
  20608. args: ["aBoolean"],
  20609. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  20610. messageSends: [],
  20611. referencedClasses: []
  20612. }),
  20613. smalltalk.SendNode);
  20614. smalltalk.addMethod(
  20615. smalltalk.method({
  20616. selector: "valueForReceiver:",
  20617. category: 'accessing',
  20618. fn: function (anObject){
  20619. var self=this;
  20620. function $SendNode(){return smalltalk.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  20621. return smalltalk.withContext(function($ctx1) {
  20622. var $2,$3,$5,$4,$6,$1;
  20623. $2=_st($SendNode())._new();
  20624. _st($2)._position_(self._position());
  20625. $3=$2;
  20626. $5=self._receiver();
  20627. if(($receiver = $5) == nil || $receiver == null){
  20628. $4=anObject;
  20629. } else {
  20630. $4=_st(self._receiver())._valueForReceiver_(anObject);
  20631. };
  20632. _st($3)._receiver_($4);
  20633. _st($2)._selector_(self._selector());
  20634. _st($2)._arguments_(self._arguments());
  20635. $6=_st($2)._yourself();
  20636. $1=$6;
  20637. return $1;
  20638. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},smalltalk.SendNode)})},
  20639. args: ["anObject"],
  20640. source: "valueForReceiver: anObject\x0a\x09^SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [anObject]\x0a\x09\x09ifNotNil: [self receiver valueForReceiver: anObject]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  20641. messageSends: ["position:", "new", "position", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  20642. referencedClasses: ["SendNode"]
  20643. }),
  20644. smalltalk.SendNode);
  20645. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps', 'scope'], 'Compiler-AST');
  20646. smalltalk.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  20647. smalltalk.addMethod(
  20648. smalltalk.method({
  20649. selector: "accept:",
  20650. category: 'visiting',
  20651. fn: function (aVisitor){
  20652. var self=this;
  20653. return smalltalk.withContext(function($ctx1) {
  20654. var $1;
  20655. $1=_st(aVisitor)._visitSequenceNode_(self);
  20656. return $1;
  20657. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.SequenceNode)})},
  20658. args: ["aVisitor"],
  20659. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  20660. messageSends: ["visitSequenceNode:"],
  20661. referencedClasses: []
  20662. }),
  20663. smalltalk.SequenceNode);
  20664. smalltalk.addMethod(
  20665. smalltalk.method({
  20666. selector: "asBlockSequenceNode",
  20667. category: 'testing',
  20668. fn: function (){
  20669. var self=this;
  20670. function $BlockSequenceNode(){return smalltalk.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  20671. return smalltalk.withContext(function($ctx1) {
  20672. var $2,$3,$1;
  20673. $2=_st($BlockSequenceNode())._new();
  20674. _st($2)._position_(self._position());
  20675. _st($2)._nodes_(self._nodes());
  20676. _st($2)._temps_(self._temps());
  20677. $3=_st($2)._yourself();
  20678. $1=$3;
  20679. return $1;
  20680. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},smalltalk.SequenceNode)})},
  20681. args: [],
  20682. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  20683. messageSends: ["position:", "new", "position", "nodes:", "nodes", "temps:", "temps", "yourself"],
  20684. referencedClasses: ["BlockSequenceNode"]
  20685. }),
  20686. smalltalk.SequenceNode);
  20687. smalltalk.addMethod(
  20688. smalltalk.method({
  20689. selector: "scope",
  20690. category: 'accessing',
  20691. fn: function (){
  20692. var self=this;
  20693. return smalltalk.withContext(function($ctx1) {
  20694. var $1;
  20695. $1=self["@scope"];
  20696. return $1;
  20697. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.SequenceNode)})},
  20698. args: [],
  20699. source: "scope\x0a\x09^ scope",
  20700. messageSends: [],
  20701. referencedClasses: []
  20702. }),
  20703. smalltalk.SequenceNode);
  20704. smalltalk.addMethod(
  20705. smalltalk.method({
  20706. selector: "scope:",
  20707. category: 'accessing',
  20708. fn: function (aLexicalScope){
  20709. var self=this;
  20710. return smalltalk.withContext(function($ctx1) {
  20711. self["@scope"]=aLexicalScope;
  20712. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aLexicalScope:aLexicalScope},smalltalk.SequenceNode)})},
  20713. args: ["aLexicalScope"],
  20714. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  20715. messageSends: [],
  20716. referencedClasses: []
  20717. }),
  20718. smalltalk.SequenceNode);
  20719. smalltalk.addMethod(
  20720. smalltalk.method({
  20721. selector: "temps",
  20722. category: 'accessing',
  20723. fn: function (){
  20724. var self=this;
  20725. return smalltalk.withContext(function($ctx1) {
  20726. var $2,$1;
  20727. $2=self["@temps"];
  20728. if(($receiver = $2) == nil || $receiver == null){
  20729. $1=[];
  20730. } else {
  20731. $1=$2;
  20732. };
  20733. return $1;
  20734. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.SequenceNode)})},
  20735. args: [],
  20736. source: "temps\x0a\x09^temps ifNil: [#()]",
  20737. messageSends: ["ifNil:"],
  20738. referencedClasses: []
  20739. }),
  20740. smalltalk.SequenceNode);
  20741. smalltalk.addMethod(
  20742. smalltalk.method({
  20743. selector: "temps:",
  20744. category: 'accessing',
  20745. fn: function (aCollection){
  20746. var self=this;
  20747. return smalltalk.withContext(function($ctx1) {
  20748. self["@temps"]=aCollection;
  20749. return self}, function($ctx1) {$ctx1.fill(self,"temps:",{aCollection:aCollection},smalltalk.SequenceNode)})},
  20750. args: ["aCollection"],
  20751. source: "temps: aCollection\x0a\x09temps := aCollection",
  20752. messageSends: [],
  20753. referencedClasses: []
  20754. }),
  20755. smalltalk.SequenceNode);
  20756. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler-AST');
  20757. smalltalk.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  20758. smalltalk.addMethod(
  20759. smalltalk.method({
  20760. selector: "accept:",
  20761. category: 'visiting',
  20762. fn: function (aVisitor){
  20763. var self=this;
  20764. return smalltalk.withContext(function($ctx1) {
  20765. var $1;
  20766. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  20767. return $1;
  20768. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.BlockSequenceNode)})},
  20769. args: ["aVisitor"],
  20770. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  20771. messageSends: ["visitBlockSequenceNode:"],
  20772. referencedClasses: []
  20773. }),
  20774. smalltalk.BlockSequenceNode);
  20775. smalltalk.addMethod(
  20776. smalltalk.method({
  20777. selector: "isBlockSequenceNode",
  20778. category: 'testing',
  20779. fn: function (){
  20780. var self=this;
  20781. return smalltalk.withContext(function($ctx1) {
  20782. return true;
  20783. }, function($ctx1) {$ctx1.fill(self,"isBlockSequenceNode",{},smalltalk.BlockSequenceNode)})},
  20784. args: [],
  20785. source: "isBlockSequenceNode\x0a\x09^true",
  20786. messageSends: [],
  20787. referencedClasses: []
  20788. }),
  20789. smalltalk.BlockSequenceNode);
  20790. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler-AST');
  20791. smalltalk.ValueNode.comment="I represent a value node.";
  20792. smalltalk.addMethod(
  20793. smalltalk.method({
  20794. selector: "accept:",
  20795. category: 'visiting',
  20796. fn: function (aVisitor){
  20797. var self=this;
  20798. return smalltalk.withContext(function($ctx1) {
  20799. var $1;
  20800. $1=_st(aVisitor)._visitValueNode_(self);
  20801. return $1;
  20802. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.ValueNode)})},
  20803. args: ["aVisitor"],
  20804. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  20805. messageSends: ["visitValueNode:"],
  20806. referencedClasses: []
  20807. }),
  20808. smalltalk.ValueNode);
  20809. smalltalk.addMethod(
  20810. smalltalk.method({
  20811. selector: "isImmutable",
  20812. category: 'testing',
  20813. fn: function (){
  20814. var self=this;
  20815. return smalltalk.withContext(function($ctx1) {
  20816. var $1;
  20817. $1=_st(self._value())._isImmutable();
  20818. return $1;
  20819. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.ValueNode)})},
  20820. args: [],
  20821. source: "isImmutable\x0a\x09^ self value isImmutable",
  20822. messageSends: ["isImmutable", "value"],
  20823. referencedClasses: []
  20824. }),
  20825. smalltalk.ValueNode);
  20826. smalltalk.addMethod(
  20827. smalltalk.method({
  20828. selector: "isValueNode",
  20829. category: 'testing',
  20830. fn: function (){
  20831. var self=this;
  20832. return smalltalk.withContext(function($ctx1) {
  20833. return true;
  20834. }, function($ctx1) {$ctx1.fill(self,"isValueNode",{},smalltalk.ValueNode)})},
  20835. args: [],
  20836. source: "isValueNode\x0a\x09^true",
  20837. messageSends: [],
  20838. referencedClasses: []
  20839. }),
  20840. smalltalk.ValueNode);
  20841. smalltalk.addMethod(
  20842. smalltalk.method({
  20843. selector: "value",
  20844. category: 'accessing',
  20845. fn: function (){
  20846. var self=this;
  20847. return smalltalk.withContext(function($ctx1) {
  20848. var $1;
  20849. $1=self["@value"];
  20850. return $1;
  20851. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.ValueNode)})},
  20852. args: [],
  20853. source: "value\x0a\x09^value",
  20854. messageSends: [],
  20855. referencedClasses: []
  20856. }),
  20857. smalltalk.ValueNode);
  20858. smalltalk.addMethod(
  20859. smalltalk.method({
  20860. selector: "value:",
  20861. category: 'accessing',
  20862. fn: function (anObject){
  20863. var self=this;
  20864. return smalltalk.withContext(function($ctx1) {
  20865. self["@value"]=anObject;
  20866. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},smalltalk.ValueNode)})},
  20867. args: ["anObject"],
  20868. source: "value: anObject\x0a\x09value := anObject",
  20869. messageSends: [],
  20870. referencedClasses: []
  20871. }),
  20872. smalltalk.ValueNode);
  20873. smalltalk.addMethod(
  20874. smalltalk.method({
  20875. selector: "xxxDoIt",
  20876. category: 'xxxDoIt',
  20877. fn: function (){
  20878. var self=this;
  20879. return smalltalk.withContext(function($ctx1) {
  20880. var $1;
  20881. $1=_st((function(){
  20882. return smalltalk.withContext(function($ctx2) {
  20883. return self._stack();
  20884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  20885. return $1;
  20886. }, function($ctx1) {$ctx1.fill(self,"xxxDoIt",{},smalltalk.ValueNode)})},
  20887. args: [],
  20888. source: "xxxDoIt ^[self stack] value",
  20889. messageSends: ["value", "stack"],
  20890. referencedClasses: []
  20891. }),
  20892. smalltalk.ValueNode);
  20893. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  20894. smalltalk.VariableNode.comment="I represent an variable node.";
  20895. smalltalk.addMethod(
  20896. smalltalk.method({
  20897. selector: "accept:",
  20898. category: 'visiting',
  20899. fn: function (aVisitor){
  20900. var self=this;
  20901. return smalltalk.withContext(function($ctx1) {
  20902. var $1;
  20903. $1=_st(aVisitor)._visitVariableNode_(self);
  20904. return $1;
  20905. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.VariableNode)})},
  20906. args: ["aVisitor"],
  20907. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  20908. messageSends: ["visitVariableNode:"],
  20909. referencedClasses: []
  20910. }),
  20911. smalltalk.VariableNode);
  20912. smalltalk.addMethod(
  20913. smalltalk.method({
  20914. selector: "alias",
  20915. category: 'accessing',
  20916. fn: function (){
  20917. var self=this;
  20918. return smalltalk.withContext(function($ctx1) {
  20919. var $1;
  20920. $1=_st(self._binding())._alias();
  20921. return $1;
  20922. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.VariableNode)})},
  20923. args: [],
  20924. source: "alias\x0a\x09^ self binding alias",
  20925. messageSends: ["alias", "binding"],
  20926. referencedClasses: []
  20927. }),
  20928. smalltalk.VariableNode);
  20929. smalltalk.addMethod(
  20930. smalltalk.method({
  20931. selector: "assigned",
  20932. category: 'accessing',
  20933. fn: function (){
  20934. var self=this;
  20935. return smalltalk.withContext(function($ctx1) {
  20936. var $2,$1;
  20937. $2=self["@assigned"];
  20938. if(($receiver = $2) == nil || $receiver == null){
  20939. $1=false;
  20940. } else {
  20941. $1=$2;
  20942. };
  20943. return $1;
  20944. }, function($ctx1) {$ctx1.fill(self,"assigned",{},smalltalk.VariableNode)})},
  20945. args: [],
  20946. source: "assigned\x0a\x09^assigned ifNil: [false]",
  20947. messageSends: ["ifNil:"],
  20948. referencedClasses: []
  20949. }),
  20950. smalltalk.VariableNode);
  20951. smalltalk.addMethod(
  20952. smalltalk.method({
  20953. selector: "assigned:",
  20954. category: 'accessing',
  20955. fn: function (aBoolean){
  20956. var self=this;
  20957. return smalltalk.withContext(function($ctx1) {
  20958. self["@assigned"]=aBoolean;
  20959. return self}, function($ctx1) {$ctx1.fill(self,"assigned:",{aBoolean:aBoolean},smalltalk.VariableNode)})},
  20960. args: ["aBoolean"],
  20961. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  20962. messageSends: [],
  20963. referencedClasses: []
  20964. }),
  20965. smalltalk.VariableNode);
  20966. smalltalk.addMethod(
  20967. smalltalk.method({
  20968. selector: "beAssigned",
  20969. category: 'accessing',
  20970. fn: function (){
  20971. var self=this;
  20972. return smalltalk.withContext(function($ctx1) {
  20973. _st(self._binding())._validateAssignment();
  20974. self["@assigned"]=true;
  20975. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},smalltalk.VariableNode)})},
  20976. args: [],
  20977. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  20978. messageSends: ["validateAssignment", "binding"],
  20979. referencedClasses: []
  20980. }),
  20981. smalltalk.VariableNode);
  20982. smalltalk.addMethod(
  20983. smalltalk.method({
  20984. selector: "binding",
  20985. category: 'accessing',
  20986. fn: function (){
  20987. var self=this;
  20988. return smalltalk.withContext(function($ctx1) {
  20989. var $1;
  20990. $1=self["@binding"];
  20991. return $1;
  20992. }, function($ctx1) {$ctx1.fill(self,"binding",{},smalltalk.VariableNode)})},
  20993. args: [],
  20994. source: "binding\x0a\x09^ binding",
  20995. messageSends: [],
  20996. referencedClasses: []
  20997. }),
  20998. smalltalk.VariableNode);
  20999. smalltalk.addMethod(
  21000. smalltalk.method({
  21001. selector: "binding:",
  21002. category: 'accessing',
  21003. fn: function (aScopeVar){
  21004. var self=this;
  21005. return smalltalk.withContext(function($ctx1) {
  21006. self["@binding"]=aScopeVar;
  21007. return self}, function($ctx1) {$ctx1.fill(self,"binding:",{aScopeVar:aScopeVar},smalltalk.VariableNode)})},
  21008. args: ["aScopeVar"],
  21009. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  21010. messageSends: [],
  21011. referencedClasses: []
  21012. }),
  21013. smalltalk.VariableNode);
  21014. smalltalk.addMethod(
  21015. smalltalk.method({
  21016. selector: "isImmutable",
  21017. category: 'testing',
  21018. fn: function (){
  21019. var self=this;
  21020. return smalltalk.withContext(function($ctx1) {
  21021. return false;
  21022. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},smalltalk.VariableNode)})},
  21023. args: [],
  21024. source: "isImmutable\x0a\x09^false",
  21025. messageSends: [],
  21026. referencedClasses: []
  21027. }),
  21028. smalltalk.VariableNode);
  21029. smalltalk.addMethod(
  21030. smalltalk.method({
  21031. selector: "isNode",
  21032. category: '*Compiler-AST',
  21033. fn: function (){
  21034. var self=this;
  21035. return smalltalk.withContext(function($ctx1) {
  21036. return false;
  21037. }, function($ctx1) {$ctx1.fill(self,"isNode",{},smalltalk.Object)})},
  21038. args: [],
  21039. source: "isNode\x0a\x09^ false",
  21040. messageSends: [],
  21041. referencedClasses: []
  21042. }),
  21043. smalltalk.Object);
  21044. smalltalk.addMethod(
  21045. smalltalk.method({
  21046. selector: "ast",
  21047. category: '*Compiler-AST',
  21048. fn: function (){
  21049. var self=this;
  21050. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21051. return smalltalk.withContext(function($ctx1) {
  21052. var $1;
  21053. _st(self._source())._ifEmpty_((function(){
  21054. return smalltalk.withContext(function($ctx2) {
  21055. return self._error_("Method source is empty");
  21056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21057. $1=_st(_st($Smalltalk())._current())._parse_(self._source());
  21058. return $1;
  21059. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.CompiledMethod)})},
  21060. args: [],
  21061. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk current parse: self source",
  21062. messageSends: ["ifEmpty:", "source", "error:", "parse:", "current"],
  21063. referencedClasses: ["Smalltalk"]
  21064. }),
  21065. smalltalk.CompiledMethod);
  21066. });
  21067. define("amber_core/Compiler-IR", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  21068. smalltalk.addPackage('Compiler-IR');
  21069. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21070. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  21071. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  21072. smalltalk.addMethod(
  21073. smalltalk.method({
  21074. selector: "alias:",
  21075. category: 'visiting',
  21076. fn: function (aNode){
  21077. var self=this;
  21078. var variable;
  21079. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  21080. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  21081. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  21082. return smalltalk.withContext(function($ctx1) {
  21083. var $1,$2,$3,$4,$5,$6,$7;
  21084. $1=_st(aNode)._isImmutable();
  21085. if(smalltalk.assert($1)){
  21086. $2=self._visit_(aNode);
  21087. return $2;
  21088. };
  21089. $3=_st($IRVariable())._new();
  21090. _st($3)._variable_(_st(_st($AliasVar())._new())._name_("$".__comma(self._nextAlias())));
  21091. $4=_st($3)._yourself();
  21092. variable=$4;
  21093. $5=_st($IRAssignment())._new();
  21094. _st($5)._add_(variable);
  21095. _st($5)._add_(self._visit_(aNode));
  21096. $6=_st($5)._yourself();
  21097. _st(self._sequence())._add_($6);
  21098. _st(_st(self._method())._internalVariables())._add_(variable);
  21099. $7=variable;
  21100. return $7;
  21101. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},smalltalk.IRASTTranslator)})},
  21102. args: ["aNode"],
  21103. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  21104. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
  21105. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
  21106. }),
  21107. smalltalk.IRASTTranslator);
  21108. smalltalk.addMethod(
  21109. smalltalk.method({
  21110. selector: "aliasTemporally:",
  21111. category: 'visiting',
  21112. fn: function (aCollection){
  21113. var self=this;
  21114. var threshold,result;
  21115. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21116. return smalltalk.withContext(function($ctx1) {
  21117. var $1,$2,$4,$3,$5;
  21118. threshold=(0);
  21119. _st(aCollection)._withIndexDo_((function(each,i){
  21120. return smalltalk.withContext(function($ctx2) {
  21121. $1=_st(each)._subtreeNeedsAliasing();
  21122. if(smalltalk.assert($1)){
  21123. threshold=i;
  21124. return threshold;
  21125. };
  21126. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  21127. result=_st($OrderedCollection())._new();
  21128. _st(aCollection)._withIndexDo_((function(each,i){
  21129. return smalltalk.withContext(function($ctx2) {
  21130. $2=result;
  21131. $4=_st(i).__lt_eq(threshold);
  21132. if(smalltalk.assert($4)){
  21133. $3=self._alias_(each);
  21134. } else {
  21135. $3=self._visit_(each);
  21136. };
  21137. return _st($2)._add_($3);
  21138. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  21139. $5=result;
  21140. return $5;
  21141. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},smalltalk.IRASTTranslator)})},
  21142. args: ["aCollection"],
  21143. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ]].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ])].\x0a\x0a\x09^result",
  21144. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
  21145. referencedClasses: ["OrderedCollection"]
  21146. }),
  21147. smalltalk.IRASTTranslator);
  21148. smalltalk.addMethod(
  21149. smalltalk.method({
  21150. selector: "method",
  21151. category: 'accessing',
  21152. fn: function (){
  21153. var self=this;
  21154. return smalltalk.withContext(function($ctx1) {
  21155. var $1;
  21156. $1=self["@method"];
  21157. return $1;
  21158. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRASTTranslator)})},
  21159. args: [],
  21160. source: "method\x0a\x09^ method",
  21161. messageSends: [],
  21162. referencedClasses: []
  21163. }),
  21164. smalltalk.IRASTTranslator);
  21165. smalltalk.addMethod(
  21166. smalltalk.method({
  21167. selector: "method:",
  21168. category: 'accessing',
  21169. fn: function (anIRMethod){
  21170. var self=this;
  21171. return smalltalk.withContext(function($ctx1) {
  21172. self["@method"]=anIRMethod;
  21173. return self}, function($ctx1) {$ctx1.fill(self,"method:",{anIRMethod:anIRMethod},smalltalk.IRASTTranslator)})},
  21174. args: ["anIRMethod"],
  21175. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  21176. messageSends: [],
  21177. referencedClasses: []
  21178. }),
  21179. smalltalk.IRASTTranslator);
  21180. smalltalk.addMethod(
  21181. smalltalk.method({
  21182. selector: "nextAlias",
  21183. category: 'accessing',
  21184. fn: function (){
  21185. var self=this;
  21186. return smalltalk.withContext(function($ctx1) {
  21187. var $1,$2;
  21188. $1=self["@nextAlias"];
  21189. if(($receiver = $1) == nil || $receiver == null){
  21190. self["@nextAlias"]=(0);
  21191. self["@nextAlias"];
  21192. } else {
  21193. $1;
  21194. };
  21195. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  21196. $2=_st(self["@nextAlias"])._asString();
  21197. return $2;
  21198. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},smalltalk.IRASTTranslator)})},
  21199. args: [],
  21200. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  21201. messageSends: ["ifNil:", "+", "asString"],
  21202. referencedClasses: []
  21203. }),
  21204. smalltalk.IRASTTranslator);
  21205. smalltalk.addMethod(
  21206. smalltalk.method({
  21207. selector: "sequence",
  21208. category: 'accessing',
  21209. fn: function (){
  21210. var self=this;
  21211. return smalltalk.withContext(function($ctx1) {
  21212. var $1;
  21213. $1=self["@sequence"];
  21214. return $1;
  21215. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRASTTranslator)})},
  21216. args: [],
  21217. source: "sequence\x0a\x09^ sequence",
  21218. messageSends: [],
  21219. referencedClasses: []
  21220. }),
  21221. smalltalk.IRASTTranslator);
  21222. smalltalk.addMethod(
  21223. smalltalk.method({
  21224. selector: "sequence:",
  21225. category: 'accessing',
  21226. fn: function (anIRSequence){
  21227. var self=this;
  21228. return smalltalk.withContext(function($ctx1) {
  21229. self["@sequence"]=anIRSequence;
  21230. return self}, function($ctx1) {$ctx1.fill(self,"sequence:",{anIRSequence:anIRSequence},smalltalk.IRASTTranslator)})},
  21231. args: ["anIRSequence"],
  21232. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  21233. messageSends: [],
  21234. referencedClasses: []
  21235. }),
  21236. smalltalk.IRASTTranslator);
  21237. smalltalk.addMethod(
  21238. smalltalk.method({
  21239. selector: "source",
  21240. category: 'accessing',
  21241. fn: function (){
  21242. var self=this;
  21243. return smalltalk.withContext(function($ctx1) {
  21244. var $1;
  21245. $1=self["@source"];
  21246. return $1;
  21247. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRASTTranslator)})},
  21248. args: [],
  21249. source: "source\x0a\x09^ source",
  21250. messageSends: [],
  21251. referencedClasses: []
  21252. }),
  21253. smalltalk.IRASTTranslator);
  21254. smalltalk.addMethod(
  21255. smalltalk.method({
  21256. selector: "source:",
  21257. category: 'accessing',
  21258. fn: function (aString){
  21259. var self=this;
  21260. return smalltalk.withContext(function($ctx1) {
  21261. self["@source"]=aString;
  21262. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRASTTranslator)})},
  21263. args: ["aString"],
  21264. source: "source: aString\x0a\x09source := aString",
  21265. messageSends: [],
  21266. referencedClasses: []
  21267. }),
  21268. smalltalk.IRASTTranslator);
  21269. smalltalk.addMethod(
  21270. smalltalk.method({
  21271. selector: "theClass",
  21272. category: 'accessing',
  21273. fn: function (){
  21274. var self=this;
  21275. return smalltalk.withContext(function($ctx1) {
  21276. var $1;
  21277. $1=self["@theClass"];
  21278. return $1;
  21279. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRASTTranslator)})},
  21280. args: [],
  21281. source: "theClass\x0a\x09^ theClass",
  21282. messageSends: [],
  21283. referencedClasses: []
  21284. }),
  21285. smalltalk.IRASTTranslator);
  21286. smalltalk.addMethod(
  21287. smalltalk.method({
  21288. selector: "theClass:",
  21289. category: 'accessing',
  21290. fn: function (aClass){
  21291. var self=this;
  21292. return smalltalk.withContext(function($ctx1) {
  21293. self["@theClass"]=aClass;
  21294. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRASTTranslator)})},
  21295. args: ["aClass"],
  21296. source: "theClass: aClass\x0a\x09theClass := aClass",
  21297. messageSends: [],
  21298. referencedClasses: []
  21299. }),
  21300. smalltalk.IRASTTranslator);
  21301. smalltalk.addMethod(
  21302. smalltalk.method({
  21303. selector: "visitAssignmentNode:",
  21304. category: 'visiting',
  21305. fn: function (aNode){
  21306. var self=this;
  21307. var left,right,assignment;
  21308. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  21309. return smalltalk.withContext(function($ctx1) {
  21310. var $1,$2,$3;
  21311. right=self._visit_(_st(aNode)._right());
  21312. left=self._visit_(_st(aNode)._left());
  21313. $1=_st($IRAssignment())._new();
  21314. _st($1)._add_(left);
  21315. _st($1)._add_(right);
  21316. $2=_st($1)._yourself();
  21317. _st(self._sequence())._add_($2);
  21318. $3=left;
  21319. return $3;
  21320. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},smalltalk.IRASTTranslator)})},
  21321. args: ["aNode"],
  21322. 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",
  21323. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
  21324. referencedClasses: ["IRAssignment"]
  21325. }),
  21326. smalltalk.IRASTTranslator);
  21327. smalltalk.addMethod(
  21328. smalltalk.method({
  21329. selector: "visitBlockNode:",
  21330. category: 'visiting',
  21331. fn: function (aNode){
  21332. var self=this;
  21333. var closure;
  21334. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  21335. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  21336. return smalltalk.withContext(function($ctx1) {
  21337. var $1,$2,$3,$4,$5;
  21338. $1=_st($IRClosure())._new();
  21339. _st($1)._arguments_(_st(aNode)._parameters());
  21340. _st($1)._scope_(_st(aNode)._scope());
  21341. $2=_st($1)._yourself();
  21342. closure=$2;
  21343. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  21344. return smalltalk.withContext(function($ctx2) {
  21345. $3=_st($IRTempDeclaration())._new();
  21346. _st($3)._name_(_st(each)._name());
  21347. _st($3)._scope_(_st(aNode)._scope());
  21348. $4=_st($3)._yourself();
  21349. return _st(closure)._add_($4);
  21350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21351. _st(_st(aNode)._nodes())._do_((function(each){
  21352. return smalltalk.withContext(function($ctx2) {
  21353. return _st(closure)._add_(self._visit_(each));
  21354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  21355. $5=closure;
  21356. return $5;
  21357. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},smalltalk.IRASTTranslator)})},
  21358. args: ["aNode"],
  21359. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  21360. messageSends: ["arguments:", "new", "parameters", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  21361. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  21362. }),
  21363. smalltalk.IRASTTranslator);
  21364. smalltalk.addMethod(
  21365. smalltalk.method({
  21366. selector: "visitBlockSequenceNode:",
  21367. category: 'visiting',
  21368. fn: function (aNode){
  21369. var self=this;
  21370. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  21371. function $IRBlockReturn(){return smalltalk.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  21372. return smalltalk.withContext(function($ctx1) {
  21373. var $2,$3,$4,$1;
  21374. $1=self._withSequence_do_(_st($IRBlockSequence())._new(),(function(){
  21375. return smalltalk.withContext(function($ctx2) {
  21376. return _st(_st(aNode)._nodes())._ifNotEmpty_((function(){
  21377. return smalltalk.withContext(function($ctx3) {
  21378. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  21379. return smalltalk.withContext(function($ctx4) {
  21380. return _st(self._sequence())._add_(self._visit_(each));
  21381. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  21382. $2=_st(_st(_st(aNode)._nodes())._last())._isReturnNode();
  21383. if(smalltalk.assert($2)){
  21384. return _st(self._sequence())._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  21385. } else {
  21386. $3=_st($IRBlockReturn())._new();
  21387. _st($3)._add_(self._visit_(_st(_st(aNode)._nodes())._last()));
  21388. $4=_st($3)._yourself();
  21389. return _st(self._sequence())._add_($4);
  21390. };
  21391. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  21392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21393. return $1;
  21394. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21395. args: ["aNode"],
  21396. 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) ]]]",
  21397. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visit:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  21398. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  21399. }),
  21400. smalltalk.IRASTTranslator);
  21401. smalltalk.addMethod(
  21402. smalltalk.method({
  21403. selector: "visitCascadeNode:",
  21404. category: 'visiting',
  21405. fn: function (aNode){
  21406. var self=this;
  21407. var alias;
  21408. function $VariableNode(){return smalltalk.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  21409. return smalltalk.withContext(function($ctx1) {
  21410. var $1,$2;
  21411. $1=_st(_st(aNode)._receiver())._isImmutable();
  21412. if(! smalltalk.assert($1)){
  21413. alias=self._alias_(_st(aNode)._receiver());
  21414. alias;
  21415. _st(_st(aNode)._nodes())._do_((function(each){
  21416. return smalltalk.withContext(function($ctx2) {
  21417. return _st(each)._receiver_(_st(_st($VariableNode())._new())._binding_(_st(alias)._variable()));
  21418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  21419. };
  21420. _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
  21421. return smalltalk.withContext(function($ctx2) {
  21422. return _st(self._sequence())._add_(self._visit_(each));
  21423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  21424. $2=self._alias_(_st(_st(aNode)._nodes())._last());
  21425. return $2;
  21426. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias},smalltalk.IRASTTranslator)})},
  21427. args: ["aNode"],
  21428. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isImmutable ifFalse: [\x0a\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: (VariableNode new binding: alias variable) ]].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  21429. messageSends: ["ifFalse:", "isImmutable", "receiver", "alias:", "do:", "nodes", "receiver:", "binding:", "new", "variable", "allButLast", "add:", "sequence", "visit:", "last"],
  21430. referencedClasses: ["VariableNode"]
  21431. }),
  21432. smalltalk.IRASTTranslator);
  21433. smalltalk.addMethod(
  21434. smalltalk.method({
  21435. selector: "visitDynamicArrayNode:",
  21436. category: 'visiting',
  21437. fn: function (aNode){
  21438. var self=this;
  21439. var array;
  21440. function $IRDynamicArray(){return smalltalk.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  21441. return smalltalk.withContext(function($ctx1) {
  21442. var $1;
  21443. array=_st($IRDynamicArray())._new();
  21444. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  21445. return smalltalk.withContext(function($ctx2) {
  21446. return _st(array)._add_(each);
  21447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21448. $1=array;
  21449. return $1;
  21450. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.IRASTTranslator)})},
  21451. args: ["aNode"],
  21452. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | array add: each].\x0a\x09^ array",
  21453. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  21454. referencedClasses: ["IRDynamicArray"]
  21455. }),
  21456. smalltalk.IRASTTranslator);
  21457. smalltalk.addMethod(
  21458. smalltalk.method({
  21459. selector: "visitDynamicDictionaryNode:",
  21460. category: 'visiting',
  21461. fn: function (aNode){
  21462. var self=this;
  21463. var dictionary;
  21464. function $IRDynamicDictionary(){return smalltalk.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  21465. return smalltalk.withContext(function($ctx1) {
  21466. var $1;
  21467. dictionary=_st($IRDynamicDictionary())._new();
  21468. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  21469. return smalltalk.withContext(function($ctx2) {
  21470. return _st(dictionary)._add_(each);
  21471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21472. $1=dictionary;
  21473. return $1;
  21474. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},smalltalk.IRASTTranslator)})},
  21475. args: ["aNode"],
  21476. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [:each | dictionary add: each].\x0a\x09^ dictionary",
  21477. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  21478. referencedClasses: ["IRDynamicDictionary"]
  21479. }),
  21480. smalltalk.IRASTTranslator);
  21481. smalltalk.addMethod(
  21482. smalltalk.method({
  21483. selector: "visitJSStatementNode:",
  21484. category: 'visiting',
  21485. fn: function (aNode){
  21486. var self=this;
  21487. function $IRVerbatim(){return smalltalk.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  21488. return smalltalk.withContext(function($ctx1) {
  21489. var $2,$3,$1;
  21490. $2=_st($IRVerbatim())._new();
  21491. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  21492. $3=_st($2)._yourself();
  21493. $1=$3;
  21494. return $1;
  21495. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21496. args: ["aNode"],
  21497. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  21498. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
  21499. referencedClasses: ["IRVerbatim"]
  21500. }),
  21501. smalltalk.IRASTTranslator);
  21502. smalltalk.addMethod(
  21503. smalltalk.method({
  21504. selector: "visitMethodNode:",
  21505. category: 'visiting',
  21506. fn: function (aNode){
  21507. var self=this;
  21508. function $IRMethod(){return smalltalk.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  21509. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  21510. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  21511. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  21512. return smalltalk.withContext(function($ctx1) {
  21513. var $1,$2,$3,$4,$5,$6,$7,$8;
  21514. $1=_st($IRMethod())._new();
  21515. _st($1)._source_(_st(self._source())._crlfSanitized());
  21516. _st($1)._theClass_(self._theClass());
  21517. _st($1)._arguments_(_st(aNode)._arguments());
  21518. _st($1)._selector_(_st(aNode)._selector());
  21519. _st($1)._messageSends_(_st(aNode)._messageSends());
  21520. _st($1)._superSends_(_st(aNode)._superSends());
  21521. _st($1)._classReferences_(_st(aNode)._classReferences());
  21522. _st($1)._scope_(_st(aNode)._scope());
  21523. $2=_st($1)._yourself();
  21524. self._method_($2);
  21525. _st(_st(_st(aNode)._scope())._temps())._do_((function(each){
  21526. return smalltalk.withContext(function($ctx2) {
  21527. $3=_st($IRTempDeclaration())._new();
  21528. _st($3)._name_(_st(each)._name());
  21529. _st($3)._scope_(_st(aNode)._scope());
  21530. $4=_st($3)._yourself();
  21531. return _st(self._method())._add_($4);
  21532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21533. _st(_st(aNode)._nodes())._do_((function(each){
  21534. return smalltalk.withContext(function($ctx2) {
  21535. return _st(self._method())._add_(self._visit_(each));
  21536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  21537. $5=_st(_st(aNode)._scope())._hasLocalReturn();
  21538. if(! smalltalk.assert($5)){
  21539. $6=_st($IRVariable())._new();
  21540. _st($6)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  21541. $7=_st($6)._yourself();
  21542. _st(_st(self._method())._add_(_st($IRReturn())._new()))._add_($7);
  21543. };
  21544. $8=self._method();
  21545. return $8;
  21546. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21547. args: ["aNode"],
  21548. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09messageSends: aNode messageSends;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
  21549. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "superSends:", "superSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  21550. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  21551. }),
  21552. smalltalk.IRASTTranslator);
  21553. smalltalk.addMethod(
  21554. smalltalk.method({
  21555. selector: "visitReturnNode:",
  21556. category: 'visiting',
  21557. fn: function (aNode){
  21558. var self=this;
  21559. var return_;
  21560. function $IRNonLocalReturn(){return smalltalk.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  21561. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  21562. return smalltalk.withContext(function($ctx1) {
  21563. var $1,$2;
  21564. $1=_st(aNode)._nonLocalReturn();
  21565. if(smalltalk.assert($1)){
  21566. return_=_st($IRNonLocalReturn())._new();
  21567. } else {
  21568. return_=_st($IRReturn())._new();
  21569. };
  21570. _st(return_)._scope_(_st(aNode)._scope());
  21571. _st(_st(aNode)._nodes())._do_((function(each){
  21572. return smalltalk.withContext(function($ctx2) {
  21573. return _st(return_)._add_(self._alias_(each));
  21574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  21575. $2=return_;
  21576. return $2;
  21577. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},smalltalk.IRASTTranslator)})},
  21578. args: ["aNode"],
  21579. 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",
  21580. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
  21581. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  21582. }),
  21583. smalltalk.IRASTTranslator);
  21584. smalltalk.addMethod(
  21585. smalltalk.method({
  21586. selector: "visitSendNode:",
  21587. category: 'visiting',
  21588. fn: function (aNode){
  21589. var self=this;
  21590. var send,all,receiver,arguments;
  21591. function $IRSend(){return smalltalk.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  21592. return smalltalk.withContext(function($ctx1) {
  21593. var $1,$2,$3,$4;
  21594. send=_st($IRSend())._new();
  21595. $1=send;
  21596. _st($1)._selector_(_st(aNode)._selector());
  21597. $2=_st($1)._index_(_st(aNode)._index());
  21598. $3=_st(aNode)._superSend();
  21599. if(smalltalk.assert($3)){
  21600. _st(send)._classSend_(_st(self._theClass())._superclass());
  21601. };
  21602. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  21603. receiver=_st(all)._first();
  21604. arguments=_st(all)._allButFirst();
  21605. _st(send)._add_(receiver);
  21606. _st(arguments)._do_((function(each){
  21607. return smalltalk.withContext(function($ctx2) {
  21608. return _st(send)._add_(each);
  21609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  21610. $4=send;
  21611. return $4;
  21612. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},smalltalk.IRASTTranslator)})},
  21613. args: ["aNode"],
  21614. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  21615. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
  21616. referencedClasses: ["IRSend"]
  21617. }),
  21618. smalltalk.IRASTTranslator);
  21619. smalltalk.addMethod(
  21620. smalltalk.method({
  21621. selector: "visitSequenceNode:",
  21622. category: 'visiting',
  21623. fn: function (aNode){
  21624. var self=this;
  21625. function $IRSequence(){return smalltalk.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  21626. return smalltalk.withContext(function($ctx1) {
  21627. var $2,$1;
  21628. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  21629. return smalltalk.withContext(function($ctx2) {
  21630. return _st(_st(aNode)._nodes())._do_((function(each){
  21631. var instruction;
  21632. return smalltalk.withContext(function($ctx3) {
  21633. instruction=self._visit_(each);
  21634. instruction;
  21635. $2=_st(instruction)._isVariable();
  21636. if(! smalltalk.assert($2)){
  21637. return _st(self._sequence())._add_(instruction);
  21638. };
  21639. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)})}));
  21640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  21641. return $1;
  21642. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21643. args: ["aNode"],
  21644. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visit: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ]]]",
  21645. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visit:", "ifFalse:", "isVariable", "add:", "sequence"],
  21646. referencedClasses: ["IRSequence"]
  21647. }),
  21648. smalltalk.IRASTTranslator);
  21649. smalltalk.addMethod(
  21650. smalltalk.method({
  21651. selector: "visitValueNode:",
  21652. category: 'visiting',
  21653. fn: function (aNode){
  21654. var self=this;
  21655. function $IRValue(){return smalltalk.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  21656. return smalltalk.withContext(function($ctx1) {
  21657. var $2,$3,$1;
  21658. $2=_st($IRValue())._new();
  21659. _st($2)._value_(_st(aNode)._value());
  21660. $3=_st($2)._yourself();
  21661. $1=$3;
  21662. return $1;
  21663. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21664. args: ["aNode"],
  21665. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  21666. messageSends: ["value:", "new", "value", "yourself"],
  21667. referencedClasses: ["IRValue"]
  21668. }),
  21669. smalltalk.IRASTTranslator);
  21670. smalltalk.addMethod(
  21671. smalltalk.method({
  21672. selector: "visitVariableNode:",
  21673. category: 'visiting',
  21674. fn: function (aNode){
  21675. var self=this;
  21676. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  21677. return smalltalk.withContext(function($ctx1) {
  21678. var $2,$3,$1;
  21679. $2=_st($IRVariable())._new();
  21680. _st($2)._variable_(_st(aNode)._binding());
  21681. $3=_st($2)._yourself();
  21682. $1=$3;
  21683. return $1;
  21684. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.IRASTTranslator)})},
  21685. args: ["aNode"],
  21686. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  21687. messageSends: ["variable:", "new", "binding", "yourself"],
  21688. referencedClasses: ["IRVariable"]
  21689. }),
  21690. smalltalk.IRASTTranslator);
  21691. smalltalk.addMethod(
  21692. smalltalk.method({
  21693. selector: "withSequence:do:",
  21694. category: 'accessing',
  21695. fn: function (aSequence,aBlock){
  21696. var self=this;
  21697. var outerSequence;
  21698. return smalltalk.withContext(function($ctx1) {
  21699. var $1;
  21700. outerSequence=self._sequence();
  21701. self._sequence_(aSequence);
  21702. _st(aBlock)._value();
  21703. self._sequence_(outerSequence);
  21704. $1=aSequence;
  21705. return $1;
  21706. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},smalltalk.IRASTTranslator)})},
  21707. args: ["aSequence", "aBlock"],
  21708. 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",
  21709. messageSends: ["sequence", "sequence:", "value"],
  21710. referencedClasses: []
  21711. }),
  21712. smalltalk.IRASTTranslator);
  21713. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  21714. 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.";
  21715. smalltalk.addMethod(
  21716. smalltalk.method({
  21717. selector: "accept:",
  21718. category: 'visiting',
  21719. fn: function (aVisitor){
  21720. var self=this;
  21721. return smalltalk.withContext(function($ctx1) {
  21722. var $1;
  21723. $1=_st(aVisitor)._visitIRInstruction_(self);
  21724. return $1;
  21725. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInstruction)})},
  21726. args: ["aVisitor"],
  21727. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  21728. messageSends: ["visitIRInstruction:"],
  21729. referencedClasses: []
  21730. }),
  21731. smalltalk.IRInstruction);
  21732. smalltalk.addMethod(
  21733. smalltalk.method({
  21734. selector: "add:",
  21735. category: 'building',
  21736. fn: function (anObject){
  21737. var self=this;
  21738. return smalltalk.withContext(function($ctx1) {
  21739. var $1;
  21740. _st(anObject)._parent_(self);
  21741. $1=_st(self._instructions())._add_(anObject);
  21742. return $1;
  21743. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},smalltalk.IRInstruction)})},
  21744. args: ["anObject"],
  21745. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  21746. messageSends: ["parent:", "add:", "instructions"],
  21747. referencedClasses: []
  21748. }),
  21749. smalltalk.IRInstruction);
  21750. smalltalk.addMethod(
  21751. smalltalk.method({
  21752. selector: "canBeAssigned",
  21753. category: 'testing',
  21754. fn: function (){
  21755. var self=this;
  21756. return smalltalk.withContext(function($ctx1) {
  21757. return true;
  21758. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRInstruction)})},
  21759. args: [],
  21760. source: "canBeAssigned\x0a\x09^ true",
  21761. messageSends: [],
  21762. referencedClasses: []
  21763. }),
  21764. smalltalk.IRInstruction);
  21765. smalltalk.addMethod(
  21766. smalltalk.method({
  21767. selector: "instructions",
  21768. category: 'accessing',
  21769. fn: function (){
  21770. var self=this;
  21771. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21772. return smalltalk.withContext(function($ctx1) {
  21773. var $2,$1;
  21774. $2=self["@instructions"];
  21775. if(($receiver = $2) == nil || $receiver == null){
  21776. self["@instructions"]=_st($OrderedCollection())._new();
  21777. $1=self["@instructions"];
  21778. } else {
  21779. $1=$2;
  21780. };
  21781. return $1;
  21782. }, function($ctx1) {$ctx1.fill(self,"instructions",{},smalltalk.IRInstruction)})},
  21783. args: [],
  21784. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  21785. messageSends: ["ifNil:", "new"],
  21786. referencedClasses: ["OrderedCollection"]
  21787. }),
  21788. smalltalk.IRInstruction);
  21789. smalltalk.addMethod(
  21790. smalltalk.method({
  21791. selector: "isClosure",
  21792. category: 'testing',
  21793. fn: function (){
  21794. var self=this;
  21795. return smalltalk.withContext(function($ctx1) {
  21796. return false;
  21797. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRInstruction)})},
  21798. args: [],
  21799. source: "isClosure\x0a\x09^ false",
  21800. messageSends: [],
  21801. referencedClasses: []
  21802. }),
  21803. smalltalk.IRInstruction);
  21804. smalltalk.addMethod(
  21805. smalltalk.method({
  21806. selector: "isInlined",
  21807. category: 'testing',
  21808. fn: function (){
  21809. var self=this;
  21810. return smalltalk.withContext(function($ctx1) {
  21811. return false;
  21812. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInstruction)})},
  21813. args: [],
  21814. source: "isInlined\x0a\x09^ false",
  21815. messageSends: [],
  21816. referencedClasses: []
  21817. }),
  21818. smalltalk.IRInstruction);
  21819. smalltalk.addMethod(
  21820. smalltalk.method({
  21821. selector: "isLocalReturn",
  21822. category: 'testing',
  21823. fn: function (){
  21824. var self=this;
  21825. return smalltalk.withContext(function($ctx1) {
  21826. return false;
  21827. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRInstruction)})},
  21828. args: [],
  21829. source: "isLocalReturn\x0a\x09^ false",
  21830. messageSends: [],
  21831. referencedClasses: []
  21832. }),
  21833. smalltalk.IRInstruction);
  21834. smalltalk.addMethod(
  21835. smalltalk.method({
  21836. selector: "isMethod",
  21837. category: 'testing',
  21838. fn: function (){
  21839. var self=this;
  21840. return smalltalk.withContext(function($ctx1) {
  21841. return false;
  21842. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRInstruction)})},
  21843. args: [],
  21844. source: "isMethod\x0a\x09^ false",
  21845. messageSends: [],
  21846. referencedClasses: []
  21847. }),
  21848. smalltalk.IRInstruction);
  21849. smalltalk.addMethod(
  21850. smalltalk.method({
  21851. selector: "isReturn",
  21852. category: 'testing',
  21853. fn: function (){
  21854. var self=this;
  21855. return smalltalk.withContext(function($ctx1) {
  21856. return false;
  21857. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRInstruction)})},
  21858. args: [],
  21859. source: "isReturn\x0a\x09^ false",
  21860. messageSends: [],
  21861. referencedClasses: []
  21862. }),
  21863. smalltalk.IRInstruction);
  21864. smalltalk.addMethod(
  21865. smalltalk.method({
  21866. selector: "isSend",
  21867. category: 'testing',
  21868. fn: function (){
  21869. var self=this;
  21870. return smalltalk.withContext(function($ctx1) {
  21871. return false;
  21872. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRInstruction)})},
  21873. args: [],
  21874. source: "isSend\x0a\x09^ false",
  21875. messageSends: [],
  21876. referencedClasses: []
  21877. }),
  21878. smalltalk.IRInstruction);
  21879. smalltalk.addMethod(
  21880. smalltalk.method({
  21881. selector: "isSequence",
  21882. category: 'testing',
  21883. fn: function (){
  21884. var self=this;
  21885. return smalltalk.withContext(function($ctx1) {
  21886. return false;
  21887. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRInstruction)})},
  21888. args: [],
  21889. source: "isSequence\x0a\x09^ false",
  21890. messageSends: [],
  21891. referencedClasses: []
  21892. }),
  21893. smalltalk.IRInstruction);
  21894. smalltalk.addMethod(
  21895. smalltalk.method({
  21896. selector: "isTempDeclaration",
  21897. category: 'testing',
  21898. fn: function (){
  21899. var self=this;
  21900. return smalltalk.withContext(function($ctx1) {
  21901. return false;
  21902. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRInstruction)})},
  21903. args: [],
  21904. source: "isTempDeclaration\x0a\x09^ false",
  21905. messageSends: [],
  21906. referencedClasses: []
  21907. }),
  21908. smalltalk.IRInstruction);
  21909. smalltalk.addMethod(
  21910. smalltalk.method({
  21911. selector: "isVariable",
  21912. category: 'testing',
  21913. fn: function (){
  21914. var self=this;
  21915. return smalltalk.withContext(function($ctx1) {
  21916. return false;
  21917. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRInstruction)})},
  21918. args: [],
  21919. source: "isVariable\x0a\x09^ false",
  21920. messageSends: [],
  21921. referencedClasses: []
  21922. }),
  21923. smalltalk.IRInstruction);
  21924. smalltalk.addMethod(
  21925. smalltalk.method({
  21926. selector: "method",
  21927. category: 'accessing',
  21928. fn: function (){
  21929. var self=this;
  21930. return smalltalk.withContext(function($ctx1) {
  21931. var $1;
  21932. $1=_st(self._parent())._method();
  21933. return $1;
  21934. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRInstruction)})},
  21935. args: [],
  21936. source: "method\x0a\x09^ self parent method",
  21937. messageSends: ["method", "parent"],
  21938. referencedClasses: []
  21939. }),
  21940. smalltalk.IRInstruction);
  21941. smalltalk.addMethod(
  21942. smalltalk.method({
  21943. selector: "needsBoxingAsReceiver",
  21944. category: 'testing',
  21945. fn: function (){
  21946. var self=this;
  21947. return smalltalk.withContext(function($ctx1) {
  21948. return true;
  21949. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRInstruction)})},
  21950. args: [],
  21951. source: "needsBoxingAsReceiver\x0a\x09^ true",
  21952. messageSends: [],
  21953. referencedClasses: []
  21954. }),
  21955. smalltalk.IRInstruction);
  21956. smalltalk.addMethod(
  21957. smalltalk.method({
  21958. selector: "parent",
  21959. category: 'accessing',
  21960. fn: function (){
  21961. var self=this;
  21962. return smalltalk.withContext(function($ctx1) {
  21963. var $1;
  21964. $1=self["@parent"];
  21965. return $1;
  21966. }, function($ctx1) {$ctx1.fill(self,"parent",{},smalltalk.IRInstruction)})},
  21967. args: [],
  21968. source: "parent\x0a\x09^ parent",
  21969. messageSends: [],
  21970. referencedClasses: []
  21971. }),
  21972. smalltalk.IRInstruction);
  21973. smalltalk.addMethod(
  21974. smalltalk.method({
  21975. selector: "parent:",
  21976. category: 'accessing',
  21977. fn: function (anIRInstruction){
  21978. var self=this;
  21979. return smalltalk.withContext(function($ctx1) {
  21980. self["@parent"]=anIRInstruction;
  21981. return self}, function($ctx1) {$ctx1.fill(self,"parent:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  21982. args: ["anIRInstruction"],
  21983. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  21984. messageSends: [],
  21985. referencedClasses: []
  21986. }),
  21987. smalltalk.IRInstruction);
  21988. smalltalk.addMethod(
  21989. smalltalk.method({
  21990. selector: "remove",
  21991. category: 'building',
  21992. fn: function (){
  21993. var self=this;
  21994. return smalltalk.withContext(function($ctx1) {
  21995. _st(self._parent())._remove_(self);
  21996. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},smalltalk.IRInstruction)})},
  21997. args: [],
  21998. source: "remove\x0a\x09self parent remove: self",
  21999. messageSends: ["remove:", "parent"],
  22000. referencedClasses: []
  22001. }),
  22002. smalltalk.IRInstruction);
  22003. smalltalk.addMethod(
  22004. smalltalk.method({
  22005. selector: "remove:",
  22006. category: 'building',
  22007. fn: function (anIRInstruction){
  22008. var self=this;
  22009. return smalltalk.withContext(function($ctx1) {
  22010. _st(self._instructions())._remove_(anIRInstruction);
  22011. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  22012. args: ["anIRInstruction"],
  22013. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  22014. messageSends: ["remove:", "instructions"],
  22015. referencedClasses: []
  22016. }),
  22017. smalltalk.IRInstruction);
  22018. smalltalk.addMethod(
  22019. smalltalk.method({
  22020. selector: "replace:with:",
  22021. category: 'building',
  22022. fn: function (anIRInstruction,anotherIRInstruction){
  22023. var self=this;
  22024. return smalltalk.withContext(function($ctx1) {
  22025. _st(anotherIRInstruction)._parent_(self);
  22026. _st(self._instructions())._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  22027. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRInstruction)})},
  22028. args: ["anIRInstruction", "anotherIRInstruction"],
  22029. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  22030. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  22031. referencedClasses: []
  22032. }),
  22033. smalltalk.IRInstruction);
  22034. smalltalk.addMethod(
  22035. smalltalk.method({
  22036. selector: "replaceWith:",
  22037. category: 'building',
  22038. fn: function (anIRInstruction){
  22039. var self=this;
  22040. return smalltalk.withContext(function($ctx1) {
  22041. _st(self._parent())._replace_with_(self,anIRInstruction);
  22042. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},smalltalk.IRInstruction)})},
  22043. args: ["anIRInstruction"],
  22044. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  22045. messageSends: ["replace:with:", "parent"],
  22046. referencedClasses: []
  22047. }),
  22048. smalltalk.IRInstruction);
  22049. smalltalk.addMethod(
  22050. smalltalk.method({
  22051. selector: "on:",
  22052. category: 'instance creation',
  22053. fn: function (aBuilder){
  22054. var self=this;
  22055. return smalltalk.withContext(function($ctx1) {
  22056. var $2,$3,$1;
  22057. $2=self._new();
  22058. _st($2)._builder_(aBuilder);
  22059. $3=_st($2)._yourself();
  22060. $1=$3;
  22061. return $1;
  22062. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},smalltalk.IRInstruction.klass)})},
  22063. args: ["aBuilder"],
  22064. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  22065. messageSends: ["builder:", "new", "yourself"],
  22066. referencedClasses: []
  22067. }),
  22068. smalltalk.IRInstruction.klass);
  22069. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  22070. smalltalk.addMethod(
  22071. smalltalk.method({
  22072. selector: "accept:",
  22073. category: 'visiting',
  22074. fn: function (aVisitor){
  22075. var self=this;
  22076. return smalltalk.withContext(function($ctx1) {
  22077. var $1;
  22078. $1=_st(aVisitor)._visitIRAssignment_(self);
  22079. return $1;
  22080. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRAssignment)})},
  22081. args: ["aVisitor"],
  22082. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  22083. messageSends: ["visitIRAssignment:"],
  22084. referencedClasses: []
  22085. }),
  22086. smalltalk.IRAssignment);
  22087. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  22088. smalltalk.addMethod(
  22089. smalltalk.method({
  22090. selector: "accept:",
  22091. category: 'visiting',
  22092. fn: function (aVisitor){
  22093. var self=this;
  22094. return smalltalk.withContext(function($ctx1) {
  22095. var $1;
  22096. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  22097. return $1;
  22098. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicArray)})},
  22099. args: ["aVisitor"],
  22100. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  22101. messageSends: ["visitIRDynamicArray:"],
  22102. referencedClasses: []
  22103. }),
  22104. smalltalk.IRDynamicArray);
  22105. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  22106. smalltalk.addMethod(
  22107. smalltalk.method({
  22108. selector: "accept:",
  22109. category: 'visiting',
  22110. fn: function (aVisitor){
  22111. var self=this;
  22112. return smalltalk.withContext(function($ctx1) {
  22113. var $1;
  22114. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  22115. return $1;
  22116. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRDynamicDictionary)})},
  22117. args: ["aVisitor"],
  22118. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  22119. messageSends: ["visitIRDynamicDictionary:"],
  22120. referencedClasses: []
  22121. }),
  22122. smalltalk.IRDynamicDictionary);
  22123. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  22124. smalltalk.addMethod(
  22125. smalltalk.method({
  22126. selector: "scope",
  22127. category: 'accessing',
  22128. fn: function (){
  22129. var self=this;
  22130. return smalltalk.withContext(function($ctx1) {
  22131. var $1;
  22132. $1=self["@scope"];
  22133. return $1;
  22134. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.IRScopedInstruction)})},
  22135. args: [],
  22136. source: "scope\x0a\x09^ scope",
  22137. messageSends: [],
  22138. referencedClasses: []
  22139. }),
  22140. smalltalk.IRScopedInstruction);
  22141. smalltalk.addMethod(
  22142. smalltalk.method({
  22143. selector: "scope:",
  22144. category: 'accessing',
  22145. fn: function (aScope){
  22146. var self=this;
  22147. return smalltalk.withContext(function($ctx1) {
  22148. self["@scope"]=aScope;
  22149. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRScopedInstruction)})},
  22150. args: ["aScope"],
  22151. source: "scope: aScope\x0a\x09scope := aScope",
  22152. messageSends: [],
  22153. referencedClasses: []
  22154. }),
  22155. smalltalk.IRScopedInstruction);
  22156. smalltalk.addClass('IRClosureInstruction', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  22157. smalltalk.addMethod(
  22158. smalltalk.method({
  22159. selector: "arguments",
  22160. category: 'accessing',
  22161. fn: function (){
  22162. var self=this;
  22163. return smalltalk.withContext(function($ctx1) {
  22164. var $2,$1;
  22165. $2=self["@arguments"];
  22166. if(($receiver = $2) == nil || $receiver == null){
  22167. $1=[];
  22168. } else {
  22169. $1=$2;
  22170. };
  22171. return $1;
  22172. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.IRClosureInstruction)})},
  22173. args: [],
  22174. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  22175. messageSends: ["ifNil:"],
  22176. referencedClasses: []
  22177. }),
  22178. smalltalk.IRClosureInstruction);
  22179. smalltalk.addMethod(
  22180. smalltalk.method({
  22181. selector: "arguments:",
  22182. category: 'accessing',
  22183. fn: function (aCollection){
  22184. var self=this;
  22185. return smalltalk.withContext(function($ctx1) {
  22186. self["@arguments"]=aCollection;
  22187. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},smalltalk.IRClosureInstruction)})},
  22188. args: ["aCollection"],
  22189. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  22190. messageSends: [],
  22191. referencedClasses: []
  22192. }),
  22193. smalltalk.IRClosureInstruction);
  22194. smalltalk.addMethod(
  22195. smalltalk.method({
  22196. selector: "locals",
  22197. category: 'accessing',
  22198. fn: function (){
  22199. var self=this;
  22200. return smalltalk.withContext(function($ctx1) {
  22201. var $2,$3,$1;
  22202. $2=_st(self._arguments())._copy();
  22203. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  22204. return smalltalk.withContext(function($ctx2) {
  22205. return _st(each)._name();
  22206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  22207. $3=_st($2)._yourself();
  22208. $1=$3;
  22209. return $1;
  22210. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.IRClosureInstruction)})},
  22211. args: [],
  22212. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  22213. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
  22214. referencedClasses: []
  22215. }),
  22216. smalltalk.IRClosureInstruction);
  22217. smalltalk.addMethod(
  22218. smalltalk.method({
  22219. selector: "scope:",
  22220. category: 'accessing',
  22221. fn: function (aScope){
  22222. var self=this;
  22223. return smalltalk.withContext(function($ctx1) {
  22224. smalltalk.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]);
  22225. _st(aScope)._instruction_(self);
  22226. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.IRClosureInstruction)})},
  22227. args: ["aScope"],
  22228. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  22229. messageSends: ["scope:", "instruction:"],
  22230. referencedClasses: []
  22231. }),
  22232. smalltalk.IRClosureInstruction);
  22233. smalltalk.addMethod(
  22234. smalltalk.method({
  22235. selector: "tempDeclarations",
  22236. category: 'accessing',
  22237. fn: function (){
  22238. var self=this;
  22239. return smalltalk.withContext(function($ctx1) {
  22240. var $1;
  22241. $1=_st(self._instructions())._select_((function(each){
  22242. return smalltalk.withContext(function($ctx2) {
  22243. return _st(each)._isTempDeclaration();
  22244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22245. return $1;
  22246. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},smalltalk.IRClosureInstruction)})},
  22247. args: [],
  22248. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  22249. messageSends: ["select:", "instructions", "isTempDeclaration"],
  22250. referencedClasses: []
  22251. }),
  22252. smalltalk.IRClosureInstruction);
  22253. smalltalk.addClass('IRClosure', smalltalk.IRClosureInstruction, [], 'Compiler-IR');
  22254. smalltalk.addMethod(
  22255. smalltalk.method({
  22256. selector: "accept:",
  22257. category: 'visiting',
  22258. fn: function (aVisitor){
  22259. var self=this;
  22260. return smalltalk.withContext(function($ctx1) {
  22261. var $1;
  22262. $1=_st(aVisitor)._visitIRClosure_(self);
  22263. return $1;
  22264. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRClosure)})},
  22265. args: ["aVisitor"],
  22266. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  22267. messageSends: ["visitIRClosure:"],
  22268. referencedClasses: []
  22269. }),
  22270. smalltalk.IRClosure);
  22271. smalltalk.addMethod(
  22272. smalltalk.method({
  22273. selector: "isClosure",
  22274. category: 'testing',
  22275. fn: function (){
  22276. var self=this;
  22277. return smalltalk.withContext(function($ctx1) {
  22278. return true;
  22279. }, function($ctx1) {$ctx1.fill(self,"isClosure",{},smalltalk.IRClosure)})},
  22280. args: [],
  22281. source: "isClosure\x0a\x09^ true",
  22282. messageSends: [],
  22283. referencedClasses: []
  22284. }),
  22285. smalltalk.IRClosure);
  22286. smalltalk.addMethod(
  22287. smalltalk.method({
  22288. selector: "sequence",
  22289. category: 'accessing',
  22290. fn: function (){
  22291. var self=this;
  22292. return smalltalk.withContext(function($ctx1) {
  22293. var $1;
  22294. $1=_st(self._instructions())._last();
  22295. return $1;
  22296. }, function($ctx1) {$ctx1.fill(self,"sequence",{},smalltalk.IRClosure)})},
  22297. args: [],
  22298. source: "sequence\x0a\x09^ self instructions last",
  22299. messageSends: ["last", "instructions"],
  22300. referencedClasses: []
  22301. }),
  22302. smalltalk.IRClosure);
  22303. smalltalk.addClass('IRMethod', smalltalk.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'messageSends', 'superSends', 'internalVariables'], 'Compiler-IR');
  22304. smalltalk.IRMethod.comment="I am a method instruction";
  22305. smalltalk.addMethod(
  22306. smalltalk.method({
  22307. selector: "accept:",
  22308. category: 'visiting',
  22309. fn: function (aVisitor){
  22310. var self=this;
  22311. return smalltalk.withContext(function($ctx1) {
  22312. var $1;
  22313. $1=_st(aVisitor)._visitIRMethod_(self);
  22314. return $1;
  22315. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRMethod)})},
  22316. args: ["aVisitor"],
  22317. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  22318. messageSends: ["visitIRMethod:"],
  22319. referencedClasses: []
  22320. }),
  22321. smalltalk.IRMethod);
  22322. smalltalk.addMethod(
  22323. smalltalk.method({
  22324. selector: "classReferences",
  22325. category: 'accessing',
  22326. fn: function (){
  22327. var self=this;
  22328. return smalltalk.withContext(function($ctx1) {
  22329. var $1;
  22330. $1=self["@classReferences"];
  22331. return $1;
  22332. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.IRMethod)})},
  22333. args: [],
  22334. source: "classReferences\x0a\x09^ classReferences",
  22335. messageSends: [],
  22336. referencedClasses: []
  22337. }),
  22338. smalltalk.IRMethod);
  22339. smalltalk.addMethod(
  22340. smalltalk.method({
  22341. selector: "classReferences:",
  22342. category: 'accessing',
  22343. fn: function (aCollection){
  22344. var self=this;
  22345. return smalltalk.withContext(function($ctx1) {
  22346. self["@classReferences"]=aCollection;
  22347. return self}, function($ctx1) {$ctx1.fill(self,"classReferences:",{aCollection:aCollection},smalltalk.IRMethod)})},
  22348. args: ["aCollection"],
  22349. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  22350. messageSends: [],
  22351. referencedClasses: []
  22352. }),
  22353. smalltalk.IRMethod);
  22354. smalltalk.addMethod(
  22355. smalltalk.method({
  22356. selector: "internalVariables",
  22357. category: 'accessing',
  22358. fn: function (){
  22359. var self=this;
  22360. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  22361. return smalltalk.withContext(function($ctx1) {
  22362. var $2,$1;
  22363. $2=self["@internalVariables"];
  22364. if(($receiver = $2) == nil || $receiver == null){
  22365. self["@internalVariables"]=_st($Set())._new();
  22366. $1=self["@internalVariables"];
  22367. } else {
  22368. $1=$2;
  22369. };
  22370. return $1;
  22371. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},smalltalk.IRMethod)})},
  22372. args: [],
  22373. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  22374. messageSends: ["ifNil:", "new"],
  22375. referencedClasses: ["Set"]
  22376. }),
  22377. smalltalk.IRMethod);
  22378. smalltalk.addMethod(
  22379. smalltalk.method({
  22380. selector: "isMethod",
  22381. category: 'accessing',
  22382. fn: function (){
  22383. var self=this;
  22384. return smalltalk.withContext(function($ctx1) {
  22385. return true;
  22386. }, function($ctx1) {$ctx1.fill(self,"isMethod",{},smalltalk.IRMethod)})},
  22387. args: [],
  22388. source: "isMethod\x0a\x09^ true",
  22389. messageSends: [],
  22390. referencedClasses: []
  22391. }),
  22392. smalltalk.IRMethod);
  22393. smalltalk.addMethod(
  22394. smalltalk.method({
  22395. selector: "messageSends",
  22396. category: 'accessing',
  22397. fn: function (){
  22398. var self=this;
  22399. return smalltalk.withContext(function($ctx1) {
  22400. var $1;
  22401. $1=self["@messageSends"];
  22402. return $1;
  22403. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.IRMethod)})},
  22404. args: [],
  22405. source: "messageSends\x0a\x09^ messageSends",
  22406. messageSends: [],
  22407. referencedClasses: []
  22408. }),
  22409. smalltalk.IRMethod);
  22410. smalltalk.addMethod(
  22411. smalltalk.method({
  22412. selector: "messageSends:",
  22413. category: 'accessing',
  22414. fn: function (aCollection){
  22415. var self=this;
  22416. return smalltalk.withContext(function($ctx1) {
  22417. self["@messageSends"]=aCollection;
  22418. return self}, function($ctx1) {$ctx1.fill(self,"messageSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  22419. args: ["aCollection"],
  22420. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  22421. messageSends: [],
  22422. referencedClasses: []
  22423. }),
  22424. smalltalk.IRMethod);
  22425. smalltalk.addMethod(
  22426. smalltalk.method({
  22427. selector: "method",
  22428. category: 'accessing',
  22429. fn: function (){
  22430. var self=this;
  22431. return smalltalk.withContext(function($ctx1) {
  22432. var $1;
  22433. $1=self;
  22434. return $1;
  22435. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.IRMethod)})},
  22436. args: [],
  22437. source: "method\x0a\x09^ self",
  22438. messageSends: [],
  22439. referencedClasses: []
  22440. }),
  22441. smalltalk.IRMethod);
  22442. smalltalk.addMethod(
  22443. smalltalk.method({
  22444. selector: "selector",
  22445. category: 'accessing',
  22446. fn: function (){
  22447. var self=this;
  22448. return smalltalk.withContext(function($ctx1) {
  22449. var $1;
  22450. $1=self["@selector"];
  22451. return $1;
  22452. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRMethod)})},
  22453. args: [],
  22454. source: "selector\x0a\x09^ selector",
  22455. messageSends: [],
  22456. referencedClasses: []
  22457. }),
  22458. smalltalk.IRMethod);
  22459. smalltalk.addMethod(
  22460. smalltalk.method({
  22461. selector: "selector:",
  22462. category: 'accessing',
  22463. fn: function (aString){
  22464. var self=this;
  22465. return smalltalk.withContext(function($ctx1) {
  22466. self["@selector"]=aString;
  22467. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRMethod)})},
  22468. args: ["aString"],
  22469. source: "selector: aString\x0a\x09selector := aString",
  22470. messageSends: [],
  22471. referencedClasses: []
  22472. }),
  22473. smalltalk.IRMethod);
  22474. smalltalk.addMethod(
  22475. smalltalk.method({
  22476. selector: "source",
  22477. category: 'accessing',
  22478. fn: function (){
  22479. var self=this;
  22480. return smalltalk.withContext(function($ctx1) {
  22481. var $1;
  22482. $1=self["@source"];
  22483. return $1;
  22484. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRMethod)})},
  22485. args: [],
  22486. source: "source\x0a\x09^ source",
  22487. messageSends: [],
  22488. referencedClasses: []
  22489. }),
  22490. smalltalk.IRMethod);
  22491. smalltalk.addMethod(
  22492. smalltalk.method({
  22493. selector: "source:",
  22494. category: 'accessing',
  22495. fn: function (aString){
  22496. var self=this;
  22497. return smalltalk.withContext(function($ctx1) {
  22498. self["@source"]=aString;
  22499. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRMethod)})},
  22500. args: ["aString"],
  22501. source: "source: aString\x0a\x09source := aString",
  22502. messageSends: [],
  22503. referencedClasses: []
  22504. }),
  22505. smalltalk.IRMethod);
  22506. smalltalk.addMethod(
  22507. smalltalk.method({
  22508. selector: "superSends",
  22509. category: 'accessing',
  22510. fn: function (){
  22511. var self=this;
  22512. return smalltalk.withContext(function($ctx1) {
  22513. var $1;
  22514. $1=self["@superSends"];
  22515. return $1;
  22516. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.IRMethod)})},
  22517. args: [],
  22518. source: "superSends\x0a\x09^ superSends",
  22519. messageSends: [],
  22520. referencedClasses: []
  22521. }),
  22522. smalltalk.IRMethod);
  22523. smalltalk.addMethod(
  22524. smalltalk.method({
  22525. selector: "superSends:",
  22526. category: 'accessing',
  22527. fn: function (aCollection){
  22528. var self=this;
  22529. return smalltalk.withContext(function($ctx1) {
  22530. self["@superSends"]=aCollection;
  22531. return self}, function($ctx1) {$ctx1.fill(self,"superSends:",{aCollection:aCollection},smalltalk.IRMethod)})},
  22532. args: ["aCollection"],
  22533. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  22534. messageSends: [],
  22535. referencedClasses: []
  22536. }),
  22537. smalltalk.IRMethod);
  22538. smalltalk.addMethod(
  22539. smalltalk.method({
  22540. selector: "theClass",
  22541. category: 'accessing',
  22542. fn: function (){
  22543. var self=this;
  22544. return smalltalk.withContext(function($ctx1) {
  22545. var $1;
  22546. $1=self["@theClass"];
  22547. return $1;
  22548. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.IRMethod)})},
  22549. args: [],
  22550. source: "theClass\x0a\x09^ theClass",
  22551. messageSends: [],
  22552. referencedClasses: []
  22553. }),
  22554. smalltalk.IRMethod);
  22555. smalltalk.addMethod(
  22556. smalltalk.method({
  22557. selector: "theClass:",
  22558. category: 'accessing',
  22559. fn: function (aClass){
  22560. var self=this;
  22561. return smalltalk.withContext(function($ctx1) {
  22562. self["@theClass"]=aClass;
  22563. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.IRMethod)})},
  22564. args: ["aClass"],
  22565. source: "theClass: aClass\x0a\x09theClass := aClass",
  22566. messageSends: [],
  22567. referencedClasses: []
  22568. }),
  22569. smalltalk.IRMethod);
  22570. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  22571. smalltalk.IRReturn.comment="I am a local return instruction.";
  22572. smalltalk.addMethod(
  22573. smalltalk.method({
  22574. selector: "accept:",
  22575. category: 'visiting',
  22576. fn: function (aVisitor){
  22577. var self=this;
  22578. return smalltalk.withContext(function($ctx1) {
  22579. var $1;
  22580. $1=_st(aVisitor)._visitIRReturn_(self);
  22581. return $1;
  22582. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRReturn)})},
  22583. args: ["aVisitor"],
  22584. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  22585. messageSends: ["visitIRReturn:"],
  22586. referencedClasses: []
  22587. }),
  22588. smalltalk.IRReturn);
  22589. smalltalk.addMethod(
  22590. smalltalk.method({
  22591. selector: "canBeAssigned",
  22592. category: 'testing',
  22593. fn: function (){
  22594. var self=this;
  22595. return smalltalk.withContext(function($ctx1) {
  22596. return false;
  22597. }, function($ctx1) {$ctx1.fill(self,"canBeAssigned",{},smalltalk.IRReturn)})},
  22598. args: [],
  22599. source: "canBeAssigned\x0a\x09^ false",
  22600. messageSends: [],
  22601. referencedClasses: []
  22602. }),
  22603. smalltalk.IRReturn);
  22604. smalltalk.addMethod(
  22605. smalltalk.method({
  22606. selector: "isBlockReturn",
  22607. category: 'testing',
  22608. fn: function (){
  22609. var self=this;
  22610. return smalltalk.withContext(function($ctx1) {
  22611. return false;
  22612. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRReturn)})},
  22613. args: [],
  22614. source: "isBlockReturn\x0a\x09^ false",
  22615. messageSends: [],
  22616. referencedClasses: []
  22617. }),
  22618. smalltalk.IRReturn);
  22619. smalltalk.addMethod(
  22620. smalltalk.method({
  22621. selector: "isLocalReturn",
  22622. category: 'testing',
  22623. fn: function (){
  22624. var self=this;
  22625. return smalltalk.withContext(function($ctx1) {
  22626. return true;
  22627. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRReturn)})},
  22628. args: [],
  22629. source: "isLocalReturn\x0a\x09^ true",
  22630. messageSends: [],
  22631. referencedClasses: []
  22632. }),
  22633. smalltalk.IRReturn);
  22634. smalltalk.addMethod(
  22635. smalltalk.method({
  22636. selector: "isNonLocalReturn",
  22637. category: 'testing',
  22638. fn: function (){
  22639. var self=this;
  22640. return smalltalk.withContext(function($ctx1) {
  22641. var $1;
  22642. $1=_st(self._isLocalReturn())._not();
  22643. return $1;
  22644. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},smalltalk.IRReturn)})},
  22645. args: [],
  22646. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  22647. messageSends: ["not", "isLocalReturn"],
  22648. referencedClasses: []
  22649. }),
  22650. smalltalk.IRReturn);
  22651. smalltalk.addMethod(
  22652. smalltalk.method({
  22653. selector: "isReturn",
  22654. category: 'testing',
  22655. fn: function (){
  22656. var self=this;
  22657. return smalltalk.withContext(function($ctx1) {
  22658. return true;
  22659. }, function($ctx1) {$ctx1.fill(self,"isReturn",{},smalltalk.IRReturn)})},
  22660. args: [],
  22661. source: "isReturn\x0a\x09^ true",
  22662. messageSends: [],
  22663. referencedClasses: []
  22664. }),
  22665. smalltalk.IRReturn);
  22666. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  22667. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  22668. smalltalk.addMethod(
  22669. smalltalk.method({
  22670. selector: "accept:",
  22671. category: 'visiting',
  22672. fn: function (aVisitor){
  22673. var self=this;
  22674. return smalltalk.withContext(function($ctx1) {
  22675. var $1;
  22676. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  22677. return $1;
  22678. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockReturn)})},
  22679. args: ["aVisitor"],
  22680. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  22681. messageSends: ["visitIRBlockReturn:"],
  22682. referencedClasses: []
  22683. }),
  22684. smalltalk.IRBlockReturn);
  22685. smalltalk.addMethod(
  22686. smalltalk.method({
  22687. selector: "isBlockReturn",
  22688. category: 'testing',
  22689. fn: function (){
  22690. var self=this;
  22691. return smalltalk.withContext(function($ctx1) {
  22692. return true;
  22693. }, function($ctx1) {$ctx1.fill(self,"isBlockReturn",{},smalltalk.IRBlockReturn)})},
  22694. args: [],
  22695. source: "isBlockReturn\x0a\x09^ true",
  22696. messageSends: [],
  22697. referencedClasses: []
  22698. }),
  22699. smalltalk.IRBlockReturn);
  22700. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  22701. smalltalk.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  22702. smalltalk.addMethod(
  22703. smalltalk.method({
  22704. selector: "accept:",
  22705. category: 'visiting',
  22706. fn: function (aVisitor){
  22707. var self=this;
  22708. return smalltalk.withContext(function($ctx1) {
  22709. var $1;
  22710. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  22711. return $1;
  22712. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRNonLocalReturn)})},
  22713. args: ["aVisitor"],
  22714. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  22715. messageSends: ["visitIRNonLocalReturn:"],
  22716. referencedClasses: []
  22717. }),
  22718. smalltalk.IRNonLocalReturn);
  22719. smalltalk.addMethod(
  22720. smalltalk.method({
  22721. selector: "isLocalReturn",
  22722. category: 'testing',
  22723. fn: function (){
  22724. var self=this;
  22725. return smalltalk.withContext(function($ctx1) {
  22726. return false;
  22727. }, function($ctx1) {$ctx1.fill(self,"isLocalReturn",{},smalltalk.IRNonLocalReturn)})},
  22728. args: [],
  22729. source: "isLocalReturn\x0a\x09^ false",
  22730. messageSends: [],
  22731. referencedClasses: []
  22732. }),
  22733. smalltalk.IRNonLocalReturn);
  22734. smalltalk.addClass('IRTempDeclaration', smalltalk.IRScopedInstruction, ['name'], 'Compiler-IR');
  22735. smalltalk.addMethod(
  22736. smalltalk.method({
  22737. selector: "accept:",
  22738. category: 'visiting',
  22739. fn: function (aVisitor){
  22740. var self=this;
  22741. return smalltalk.withContext(function($ctx1) {
  22742. var $1;
  22743. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  22744. return $1;
  22745. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRTempDeclaration)})},
  22746. args: ["aVisitor"],
  22747. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  22748. messageSends: ["visitIRTempDeclaration:"],
  22749. referencedClasses: []
  22750. }),
  22751. smalltalk.IRTempDeclaration);
  22752. smalltalk.addMethod(
  22753. smalltalk.method({
  22754. selector: "isTempDeclaration",
  22755. category: 'testing',
  22756. fn: function (){
  22757. var self=this;
  22758. return smalltalk.withContext(function($ctx1) {
  22759. return true;
  22760. }, function($ctx1) {$ctx1.fill(self,"isTempDeclaration",{},smalltalk.IRTempDeclaration)})},
  22761. args: [],
  22762. source: "isTempDeclaration\x0a\x09^ true",
  22763. messageSends: [],
  22764. referencedClasses: []
  22765. }),
  22766. smalltalk.IRTempDeclaration);
  22767. smalltalk.addMethod(
  22768. smalltalk.method({
  22769. selector: "name",
  22770. category: 'accessing',
  22771. fn: function (){
  22772. var self=this;
  22773. return smalltalk.withContext(function($ctx1) {
  22774. var $1;
  22775. $1=self["@name"];
  22776. return $1;
  22777. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.IRTempDeclaration)})},
  22778. args: [],
  22779. source: "name\x0a\x09^ name",
  22780. messageSends: [],
  22781. referencedClasses: []
  22782. }),
  22783. smalltalk.IRTempDeclaration);
  22784. smalltalk.addMethod(
  22785. smalltalk.method({
  22786. selector: "name:",
  22787. category: 'accessing',
  22788. fn: function (aString){
  22789. var self=this;
  22790. return smalltalk.withContext(function($ctx1) {
  22791. self["@name"]=aString;
  22792. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.IRTempDeclaration)})},
  22793. args: ["aString"],
  22794. source: "name: aString\x0a\x09name := aString",
  22795. messageSends: [],
  22796. referencedClasses: []
  22797. }),
  22798. smalltalk.IRTempDeclaration);
  22799. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  22800. smalltalk.IRSend.comment="I am a message send instruction.";
  22801. smalltalk.addMethod(
  22802. smalltalk.method({
  22803. selector: "accept:",
  22804. category: 'visiting',
  22805. fn: function (aVisitor){
  22806. var self=this;
  22807. return smalltalk.withContext(function($ctx1) {
  22808. var $1;
  22809. $1=_st(aVisitor)._visitIRSend_(self);
  22810. return $1;
  22811. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSend)})},
  22812. args: ["aVisitor"],
  22813. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  22814. messageSends: ["visitIRSend:"],
  22815. referencedClasses: []
  22816. }),
  22817. smalltalk.IRSend);
  22818. smalltalk.addMethod(
  22819. smalltalk.method({
  22820. selector: "classSend",
  22821. category: 'accessing',
  22822. fn: function (){
  22823. var self=this;
  22824. return smalltalk.withContext(function($ctx1) {
  22825. var $1;
  22826. $1=self["@classSend"];
  22827. return $1;
  22828. }, function($ctx1) {$ctx1.fill(self,"classSend",{},smalltalk.IRSend)})},
  22829. args: [],
  22830. source: "classSend\x0a\x09^ classSend",
  22831. messageSends: [],
  22832. referencedClasses: []
  22833. }),
  22834. smalltalk.IRSend);
  22835. smalltalk.addMethod(
  22836. smalltalk.method({
  22837. selector: "classSend:",
  22838. category: 'accessing',
  22839. fn: function (aClass){
  22840. var self=this;
  22841. return smalltalk.withContext(function($ctx1) {
  22842. self["@classSend"]=aClass;
  22843. return self}, function($ctx1) {$ctx1.fill(self,"classSend:",{aClass:aClass},smalltalk.IRSend)})},
  22844. args: ["aClass"],
  22845. source: "classSend: aClass\x0a\x09classSend := aClass",
  22846. messageSends: [],
  22847. referencedClasses: []
  22848. }),
  22849. smalltalk.IRSend);
  22850. smalltalk.addMethod(
  22851. smalltalk.method({
  22852. selector: "index",
  22853. category: 'accessing',
  22854. fn: function (){
  22855. var self=this;
  22856. return smalltalk.withContext(function($ctx1) {
  22857. var $1;
  22858. $1=self["@index"];
  22859. return $1;
  22860. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.IRSend)})},
  22861. args: [],
  22862. source: "index\x0a\x09^ index",
  22863. messageSends: [],
  22864. referencedClasses: []
  22865. }),
  22866. smalltalk.IRSend);
  22867. smalltalk.addMethod(
  22868. smalltalk.method({
  22869. selector: "index:",
  22870. category: 'accessing',
  22871. fn: function (anInteger){
  22872. var self=this;
  22873. return smalltalk.withContext(function($ctx1) {
  22874. self["@index"]=anInteger;
  22875. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.IRSend)})},
  22876. args: ["anInteger"],
  22877. source: "index: anInteger\x0a\x09index := anInteger",
  22878. messageSends: [],
  22879. referencedClasses: []
  22880. }),
  22881. smalltalk.IRSend);
  22882. smalltalk.addMethod(
  22883. smalltalk.method({
  22884. selector: "isSend",
  22885. category: 'testing',
  22886. fn: function (){
  22887. var self=this;
  22888. return smalltalk.withContext(function($ctx1) {
  22889. return true;
  22890. }, function($ctx1) {$ctx1.fill(self,"isSend",{},smalltalk.IRSend)})},
  22891. args: [],
  22892. source: "isSend\x0a\x09^ true",
  22893. messageSends: [],
  22894. referencedClasses: []
  22895. }),
  22896. smalltalk.IRSend);
  22897. smalltalk.addMethod(
  22898. smalltalk.method({
  22899. selector: "selector",
  22900. category: 'accessing',
  22901. fn: function (){
  22902. var self=this;
  22903. return smalltalk.withContext(function($ctx1) {
  22904. var $1;
  22905. $1=self["@selector"];
  22906. return $1;
  22907. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.IRSend)})},
  22908. args: [],
  22909. source: "selector\x0a\x09^ selector",
  22910. messageSends: [],
  22911. referencedClasses: []
  22912. }),
  22913. smalltalk.IRSend);
  22914. smalltalk.addMethod(
  22915. smalltalk.method({
  22916. selector: "selector:",
  22917. category: 'accessing',
  22918. fn: function (aString){
  22919. var self=this;
  22920. return smalltalk.withContext(function($ctx1) {
  22921. self["@selector"]=aString;
  22922. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.IRSend)})},
  22923. args: ["aString"],
  22924. source: "selector: aString\x0a\x09selector := aString",
  22925. messageSends: [],
  22926. referencedClasses: []
  22927. }),
  22928. smalltalk.IRSend);
  22929. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  22930. smalltalk.addMethod(
  22931. smalltalk.method({
  22932. selector: "accept:",
  22933. category: 'visiting',
  22934. fn: function (aVisitor){
  22935. var self=this;
  22936. return smalltalk.withContext(function($ctx1) {
  22937. var $1;
  22938. $1=_st(aVisitor)._visitIRSequence_(self);
  22939. return $1;
  22940. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRSequence)})},
  22941. args: ["aVisitor"],
  22942. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  22943. messageSends: ["visitIRSequence:"],
  22944. referencedClasses: []
  22945. }),
  22946. smalltalk.IRSequence);
  22947. smalltalk.addMethod(
  22948. smalltalk.method({
  22949. selector: "isSequence",
  22950. category: 'testing',
  22951. fn: function (){
  22952. var self=this;
  22953. return smalltalk.withContext(function($ctx1) {
  22954. return true;
  22955. }, function($ctx1) {$ctx1.fill(self,"isSequence",{},smalltalk.IRSequence)})},
  22956. args: [],
  22957. source: "isSequence\x0a\x09^ true",
  22958. messageSends: [],
  22959. referencedClasses: []
  22960. }),
  22961. smalltalk.IRSequence);
  22962. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  22963. smalltalk.addMethod(
  22964. smalltalk.method({
  22965. selector: "accept:",
  22966. category: 'visiting',
  22967. fn: function (aVisitor){
  22968. var self=this;
  22969. return smalltalk.withContext(function($ctx1) {
  22970. var $1;
  22971. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  22972. return $1;
  22973. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRBlockSequence)})},
  22974. args: ["aVisitor"],
  22975. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  22976. messageSends: ["visitIRBlockSequence:"],
  22977. referencedClasses: []
  22978. }),
  22979. smalltalk.IRBlockSequence);
  22980. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  22981. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  22982. smalltalk.addMethod(
  22983. smalltalk.method({
  22984. selector: "accept:",
  22985. category: 'visiting',
  22986. fn: function (aVisitor){
  22987. var self=this;
  22988. return smalltalk.withContext(function($ctx1) {
  22989. var $1;
  22990. $1=_st(aVisitor)._visitIRValue_(self);
  22991. return $1;
  22992. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRValue)})},
  22993. args: ["aVisitor"],
  22994. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  22995. messageSends: ["visitIRValue:"],
  22996. referencedClasses: []
  22997. }),
  22998. smalltalk.IRValue);
  22999. smalltalk.addMethod(
  23000. smalltalk.method({
  23001. selector: "needsBoxingAsReceiver",
  23002. category: 'testing',
  23003. fn: function (){
  23004. var self=this;
  23005. return smalltalk.withContext(function($ctx1) {
  23006. return false;
  23007. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRValue)})},
  23008. args: [],
  23009. source: "needsBoxingAsReceiver\x0a\x09^ false",
  23010. messageSends: [],
  23011. referencedClasses: []
  23012. }),
  23013. smalltalk.IRValue);
  23014. smalltalk.addMethod(
  23015. smalltalk.method({
  23016. selector: "value",
  23017. category: 'accessing',
  23018. fn: function (){
  23019. var self=this;
  23020. return smalltalk.withContext(function($ctx1) {
  23021. var $1;
  23022. $1=self["@value"];
  23023. return $1;
  23024. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.IRValue)})},
  23025. args: [],
  23026. source: "value\x0a\x09^value",
  23027. messageSends: [],
  23028. referencedClasses: []
  23029. }),
  23030. smalltalk.IRValue);
  23031. smalltalk.addMethod(
  23032. smalltalk.method({
  23033. selector: "value:",
  23034. category: 'accessing',
  23035. fn: function (aString){
  23036. var self=this;
  23037. return smalltalk.withContext(function($ctx1) {
  23038. self["@value"]=aString;
  23039. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},smalltalk.IRValue)})},
  23040. args: ["aString"],
  23041. source: "value: aString\x0a\x09value := aString",
  23042. messageSends: [],
  23043. referencedClasses: []
  23044. }),
  23045. smalltalk.IRValue);
  23046. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  23047. smalltalk.IRVariable.comment="I am a variable instruction.";
  23048. smalltalk.addMethod(
  23049. smalltalk.method({
  23050. selector: "accept:",
  23051. category: 'visiting',
  23052. fn: function (aVisitor){
  23053. var self=this;
  23054. return smalltalk.withContext(function($ctx1) {
  23055. var $1;
  23056. $1=_st(aVisitor)._visitIRVariable_(self);
  23057. return $1;
  23058. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVariable)})},
  23059. args: ["aVisitor"],
  23060. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  23061. messageSends: ["visitIRVariable:"],
  23062. referencedClasses: []
  23063. }),
  23064. smalltalk.IRVariable);
  23065. smalltalk.addMethod(
  23066. smalltalk.method({
  23067. selector: "isVariable",
  23068. category: 'testing',
  23069. fn: function (){
  23070. var self=this;
  23071. return smalltalk.withContext(function($ctx1) {
  23072. return true;
  23073. }, function($ctx1) {$ctx1.fill(self,"isVariable",{},smalltalk.IRVariable)})},
  23074. args: [],
  23075. source: "isVariable\x0a\x09^ true",
  23076. messageSends: [],
  23077. referencedClasses: []
  23078. }),
  23079. smalltalk.IRVariable);
  23080. smalltalk.addMethod(
  23081. smalltalk.method({
  23082. selector: "needsBoxingAsReceiver",
  23083. category: 'testing',
  23084. fn: function (){
  23085. var self=this;
  23086. return smalltalk.withContext(function($ctx1) {
  23087. var $1;
  23088. $1=_st(_st(self._variable())._isPseudoVar())._not();
  23089. return $1;
  23090. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},smalltalk.IRVariable)})},
  23091. args: [],
  23092. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  23093. messageSends: ["not", "isPseudoVar", "variable"],
  23094. referencedClasses: []
  23095. }),
  23096. smalltalk.IRVariable);
  23097. smalltalk.addMethod(
  23098. smalltalk.method({
  23099. selector: "variable",
  23100. category: 'accessing',
  23101. fn: function (){
  23102. var self=this;
  23103. return smalltalk.withContext(function($ctx1) {
  23104. var $1;
  23105. $1=self["@variable"];
  23106. return $1;
  23107. }, function($ctx1) {$ctx1.fill(self,"variable",{},smalltalk.IRVariable)})},
  23108. args: [],
  23109. source: "variable\x0a\x09^ variable",
  23110. messageSends: [],
  23111. referencedClasses: []
  23112. }),
  23113. smalltalk.IRVariable);
  23114. smalltalk.addMethod(
  23115. smalltalk.method({
  23116. selector: "variable:",
  23117. category: 'accessing',
  23118. fn: function (aScopeVariable){
  23119. var self=this;
  23120. return smalltalk.withContext(function($ctx1) {
  23121. self["@variable"]=aScopeVariable;
  23122. return self}, function($ctx1) {$ctx1.fill(self,"variable:",{aScopeVariable:aScopeVariable},smalltalk.IRVariable)})},
  23123. args: ["aScopeVariable"],
  23124. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  23125. messageSends: [],
  23126. referencedClasses: []
  23127. }),
  23128. smalltalk.IRVariable);
  23129. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  23130. smalltalk.addMethod(
  23131. smalltalk.method({
  23132. selector: "accept:",
  23133. category: 'visiting',
  23134. fn: function (aVisitor){
  23135. var self=this;
  23136. return smalltalk.withContext(function($ctx1) {
  23137. var $1;
  23138. $1=_st(aVisitor)._visitIRVerbatim_(self);
  23139. return $1;
  23140. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRVerbatim)})},
  23141. args: ["aVisitor"],
  23142. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  23143. messageSends: ["visitIRVerbatim:"],
  23144. referencedClasses: []
  23145. }),
  23146. smalltalk.IRVerbatim);
  23147. smalltalk.addMethod(
  23148. smalltalk.method({
  23149. selector: "source",
  23150. category: 'accessing',
  23151. fn: function (){
  23152. var self=this;
  23153. return smalltalk.withContext(function($ctx1) {
  23154. var $1;
  23155. $1=self["@source"];
  23156. return $1;
  23157. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.IRVerbatim)})},
  23158. args: [],
  23159. source: "source\x0a\x09^ source",
  23160. messageSends: [],
  23161. referencedClasses: []
  23162. }),
  23163. smalltalk.IRVerbatim);
  23164. smalltalk.addMethod(
  23165. smalltalk.method({
  23166. selector: "source:",
  23167. category: 'accessing',
  23168. fn: function (aString){
  23169. var self=this;
  23170. return smalltalk.withContext(function($ctx1) {
  23171. self["@source"]=aString;
  23172. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.IRVerbatim)})},
  23173. args: ["aString"],
  23174. source: "source: aString\x0a\x09source := aString",
  23175. messageSends: [],
  23176. referencedClasses: []
  23177. }),
  23178. smalltalk.IRVerbatim);
  23179. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  23180. smalltalk.addMethod(
  23181. smalltalk.method({
  23182. selector: "visit:",
  23183. category: 'visiting',
  23184. fn: function (anIRInstruction){
  23185. var self=this;
  23186. return smalltalk.withContext(function($ctx1) {
  23187. var $1;
  23188. $1=_st(anIRInstruction)._accept_(self);
  23189. return $1;
  23190. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  23191. args: ["anIRInstruction"],
  23192. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  23193. messageSends: ["accept:"],
  23194. referencedClasses: []
  23195. }),
  23196. smalltalk.IRVisitor);
  23197. smalltalk.addMethod(
  23198. smalltalk.method({
  23199. selector: "visitIRAssignment:",
  23200. category: 'visiting',
  23201. fn: function (anIRAssignment){
  23202. var self=this;
  23203. return smalltalk.withContext(function($ctx1) {
  23204. var $1;
  23205. $1=self._visitIRInstruction_(anIRAssignment);
  23206. return $1;
  23207. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRVisitor)})},
  23208. args: ["anIRAssignment"],
  23209. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  23210. messageSends: ["visitIRInstruction:"],
  23211. referencedClasses: []
  23212. }),
  23213. smalltalk.IRVisitor);
  23214. smalltalk.addMethod(
  23215. smalltalk.method({
  23216. selector: "visitIRBlockReturn:",
  23217. category: 'visiting',
  23218. fn: function (anIRBlockReturn){
  23219. var self=this;
  23220. return smalltalk.withContext(function($ctx1) {
  23221. var $1;
  23222. $1=self._visitIRReturn_(anIRBlockReturn);
  23223. return $1;
  23224. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},smalltalk.IRVisitor)})},
  23225. args: ["anIRBlockReturn"],
  23226. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  23227. messageSends: ["visitIRReturn:"],
  23228. referencedClasses: []
  23229. }),
  23230. smalltalk.IRVisitor);
  23231. smalltalk.addMethod(
  23232. smalltalk.method({
  23233. selector: "visitIRBlockSequence:",
  23234. category: 'visiting',
  23235. fn: function (anIRBlockSequence){
  23236. var self=this;
  23237. return smalltalk.withContext(function($ctx1) {
  23238. var $1;
  23239. $1=self._visitIRSequence_(anIRBlockSequence);
  23240. return $1;
  23241. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},smalltalk.IRVisitor)})},
  23242. args: ["anIRBlockSequence"],
  23243. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  23244. messageSends: ["visitIRSequence:"],
  23245. referencedClasses: []
  23246. }),
  23247. smalltalk.IRVisitor);
  23248. smalltalk.addMethod(
  23249. smalltalk.method({
  23250. selector: "visitIRClosure:",
  23251. category: 'visiting',
  23252. fn: function (anIRClosure){
  23253. var self=this;
  23254. return smalltalk.withContext(function($ctx1) {
  23255. var $1;
  23256. $1=self._visitIRInstruction_(anIRClosure);
  23257. return $1;
  23258. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRVisitor)})},
  23259. args: ["anIRClosure"],
  23260. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  23261. messageSends: ["visitIRInstruction:"],
  23262. referencedClasses: []
  23263. }),
  23264. smalltalk.IRVisitor);
  23265. smalltalk.addMethod(
  23266. smalltalk.method({
  23267. selector: "visitIRDynamicArray:",
  23268. category: 'visiting',
  23269. fn: function (anIRDynamicArray){
  23270. var self=this;
  23271. return smalltalk.withContext(function($ctx1) {
  23272. var $1;
  23273. $1=self._visitIRInstruction_(anIRDynamicArray);
  23274. return $1;
  23275. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRVisitor)})},
  23276. args: ["anIRDynamicArray"],
  23277. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  23278. messageSends: ["visitIRInstruction:"],
  23279. referencedClasses: []
  23280. }),
  23281. smalltalk.IRVisitor);
  23282. smalltalk.addMethod(
  23283. smalltalk.method({
  23284. selector: "visitIRDynamicDictionary:",
  23285. category: 'visiting',
  23286. fn: function (anIRDynamicDictionary){
  23287. var self=this;
  23288. return smalltalk.withContext(function($ctx1) {
  23289. var $1;
  23290. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  23291. return $1;
  23292. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRVisitor)})},
  23293. args: ["anIRDynamicDictionary"],
  23294. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  23295. messageSends: ["visitIRInstruction:"],
  23296. referencedClasses: []
  23297. }),
  23298. smalltalk.IRVisitor);
  23299. smalltalk.addMethod(
  23300. smalltalk.method({
  23301. selector: "visitIRInlinedClosure:",
  23302. category: 'visiting',
  23303. fn: function (anIRInlinedClosure){
  23304. var self=this;
  23305. return smalltalk.withContext(function($ctx1) {
  23306. var $1;
  23307. $1=self._visitIRClosure_(anIRInlinedClosure);
  23308. return $1;
  23309. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRVisitor)})},
  23310. args: ["anIRInlinedClosure"],
  23311. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  23312. messageSends: ["visitIRClosure:"],
  23313. referencedClasses: []
  23314. }),
  23315. smalltalk.IRVisitor);
  23316. smalltalk.addMethod(
  23317. smalltalk.method({
  23318. selector: "visitIRInlinedSequence:",
  23319. category: 'visiting',
  23320. fn: function (anIRInlinedSequence){
  23321. var self=this;
  23322. return smalltalk.withContext(function($ctx1) {
  23323. var $1;
  23324. $1=self._visitIRSequence_(anIRInlinedSequence);
  23325. return $1;
  23326. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRVisitor)})},
  23327. args: ["anIRInlinedSequence"],
  23328. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  23329. messageSends: ["visitIRSequence:"],
  23330. referencedClasses: []
  23331. }),
  23332. smalltalk.IRVisitor);
  23333. smalltalk.addMethod(
  23334. smalltalk.method({
  23335. selector: "visitIRInstruction:",
  23336. category: 'visiting',
  23337. fn: function (anIRInstruction){
  23338. var self=this;
  23339. return smalltalk.withContext(function($ctx1) {
  23340. var $1;
  23341. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  23342. return smalltalk.withContext(function($ctx2) {
  23343. return self._visit_(each);
  23344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23345. $1=anIRInstruction;
  23346. return $1;
  23347. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},smalltalk.IRVisitor)})},
  23348. args: ["anIRInstruction"],
  23349. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  23350. messageSends: ["do:", "instructions", "visit:"],
  23351. referencedClasses: []
  23352. }),
  23353. smalltalk.IRVisitor);
  23354. smalltalk.addMethod(
  23355. smalltalk.method({
  23356. selector: "visitIRMethod:",
  23357. category: 'visiting',
  23358. fn: function (anIRMethod){
  23359. var self=this;
  23360. return smalltalk.withContext(function($ctx1) {
  23361. var $1;
  23362. $1=self._visitIRInstruction_(anIRMethod);
  23363. return $1;
  23364. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRVisitor)})},
  23365. args: ["anIRMethod"],
  23366. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  23367. messageSends: ["visitIRInstruction:"],
  23368. referencedClasses: []
  23369. }),
  23370. smalltalk.IRVisitor);
  23371. smalltalk.addMethod(
  23372. smalltalk.method({
  23373. selector: "visitIRNonLocalReturn:",
  23374. category: 'visiting',
  23375. fn: function (anIRNonLocalReturn){
  23376. var self=this;
  23377. return smalltalk.withContext(function($ctx1) {
  23378. var $1;
  23379. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  23380. return $1;
  23381. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRVisitor)})},
  23382. args: ["anIRNonLocalReturn"],
  23383. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  23384. messageSends: ["visitIRInstruction:"],
  23385. referencedClasses: []
  23386. }),
  23387. smalltalk.IRVisitor);
  23388. smalltalk.addMethod(
  23389. smalltalk.method({
  23390. selector: "visitIRNonLocalReturnHandling:",
  23391. category: 'visiting',
  23392. fn: function (anIRNonLocalReturnHandling){
  23393. var self=this;
  23394. return smalltalk.withContext(function($ctx1) {
  23395. var $1;
  23396. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  23397. return $1;
  23398. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},smalltalk.IRVisitor)})},
  23399. args: ["anIRNonLocalReturnHandling"],
  23400. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  23401. messageSends: ["visitIRInstruction:"],
  23402. referencedClasses: []
  23403. }),
  23404. smalltalk.IRVisitor);
  23405. smalltalk.addMethod(
  23406. smalltalk.method({
  23407. selector: "visitIRReturn:",
  23408. category: 'visiting',
  23409. fn: function (anIRReturn){
  23410. var self=this;
  23411. return smalltalk.withContext(function($ctx1) {
  23412. var $1;
  23413. $1=self._visitIRInstruction_(anIRReturn);
  23414. return $1;
  23415. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRVisitor)})},
  23416. args: ["anIRReturn"],
  23417. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  23418. messageSends: ["visitIRInstruction:"],
  23419. referencedClasses: []
  23420. }),
  23421. smalltalk.IRVisitor);
  23422. smalltalk.addMethod(
  23423. smalltalk.method({
  23424. selector: "visitIRSend:",
  23425. category: 'visiting',
  23426. fn: function (anIRSend){
  23427. var self=this;
  23428. return smalltalk.withContext(function($ctx1) {
  23429. var $1;
  23430. $1=self._visitIRInstruction_(anIRSend);
  23431. return $1;
  23432. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRVisitor)})},
  23433. args: ["anIRSend"],
  23434. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  23435. messageSends: ["visitIRInstruction:"],
  23436. referencedClasses: []
  23437. }),
  23438. smalltalk.IRVisitor);
  23439. smalltalk.addMethod(
  23440. smalltalk.method({
  23441. selector: "visitIRSequence:",
  23442. category: 'visiting',
  23443. fn: function (anIRSequence){
  23444. var self=this;
  23445. return smalltalk.withContext(function($ctx1) {
  23446. var $1;
  23447. $1=self._visitIRInstruction_(anIRSequence);
  23448. return $1;
  23449. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRVisitor)})},
  23450. args: ["anIRSequence"],
  23451. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  23452. messageSends: ["visitIRInstruction:"],
  23453. referencedClasses: []
  23454. }),
  23455. smalltalk.IRVisitor);
  23456. smalltalk.addMethod(
  23457. smalltalk.method({
  23458. selector: "visitIRTempDeclaration:",
  23459. category: 'visiting',
  23460. fn: function (anIRTempDeclaration){
  23461. var self=this;
  23462. return smalltalk.withContext(function($ctx1) {
  23463. var $1;
  23464. $1=self._visitIRInstruction_(anIRTempDeclaration);
  23465. return $1;
  23466. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRVisitor)})},
  23467. args: ["anIRTempDeclaration"],
  23468. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  23469. messageSends: ["visitIRInstruction:"],
  23470. referencedClasses: []
  23471. }),
  23472. smalltalk.IRVisitor);
  23473. smalltalk.addMethod(
  23474. smalltalk.method({
  23475. selector: "visitIRValue:",
  23476. category: 'visiting',
  23477. fn: function (anIRValue){
  23478. var self=this;
  23479. return smalltalk.withContext(function($ctx1) {
  23480. var $1;
  23481. $1=self._visitIRInstruction_(anIRValue);
  23482. return $1;
  23483. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRVisitor)})},
  23484. args: ["anIRValue"],
  23485. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  23486. messageSends: ["visitIRInstruction:"],
  23487. referencedClasses: []
  23488. }),
  23489. smalltalk.IRVisitor);
  23490. smalltalk.addMethod(
  23491. smalltalk.method({
  23492. selector: "visitIRVariable:",
  23493. category: 'visiting',
  23494. fn: function (anIRVariable){
  23495. var self=this;
  23496. return smalltalk.withContext(function($ctx1) {
  23497. var $1;
  23498. $1=self._visitIRInstruction_(anIRVariable);
  23499. return $1;
  23500. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRVisitor)})},
  23501. args: ["anIRVariable"],
  23502. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  23503. messageSends: ["visitIRInstruction:"],
  23504. referencedClasses: []
  23505. }),
  23506. smalltalk.IRVisitor);
  23507. smalltalk.addMethod(
  23508. smalltalk.method({
  23509. selector: "visitIRVerbatim:",
  23510. category: 'visiting',
  23511. fn: function (anIRVerbatim){
  23512. var self=this;
  23513. return smalltalk.withContext(function($ctx1) {
  23514. var $1;
  23515. $1=self._visitIRInstruction_(anIRVerbatim);
  23516. return $1;
  23517. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRVisitor)})},
  23518. args: ["anIRVerbatim"],
  23519. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  23520. messageSends: ["visitIRInstruction:"],
  23521. referencedClasses: []
  23522. }),
  23523. smalltalk.IRVisitor);
  23524. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  23525. smalltalk.addMethod(
  23526. smalltalk.method({
  23527. selector: "contents",
  23528. category: 'accessing',
  23529. fn: function (){
  23530. var self=this;
  23531. return smalltalk.withContext(function($ctx1) {
  23532. var $1;
  23533. $1=_st(self._stream())._contents();
  23534. return $1;
  23535. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.IRJSTranslator)})},
  23536. args: [],
  23537. source: "contents\x0a\x09^ self stream contents",
  23538. messageSends: ["contents", "stream"],
  23539. referencedClasses: []
  23540. }),
  23541. smalltalk.IRJSTranslator);
  23542. smalltalk.addMethod(
  23543. smalltalk.method({
  23544. selector: "currentClass",
  23545. category: 'accessing',
  23546. fn: function (){
  23547. var self=this;
  23548. return smalltalk.withContext(function($ctx1) {
  23549. var $1;
  23550. $1=self["@currentClass"];
  23551. return $1;
  23552. }, function($ctx1) {$ctx1.fill(self,"currentClass",{},smalltalk.IRJSTranslator)})},
  23553. args: [],
  23554. source: "currentClass\x0a\x09^ currentClass",
  23555. messageSends: [],
  23556. referencedClasses: []
  23557. }),
  23558. smalltalk.IRJSTranslator);
  23559. smalltalk.addMethod(
  23560. smalltalk.method({
  23561. selector: "currentClass:",
  23562. category: 'accessing',
  23563. fn: function (aClass){
  23564. var self=this;
  23565. return smalltalk.withContext(function($ctx1) {
  23566. self["@currentClass"]=aClass;
  23567. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass},smalltalk.IRJSTranslator)})},
  23568. args: ["aClass"],
  23569. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  23570. messageSends: [],
  23571. referencedClasses: []
  23572. }),
  23573. smalltalk.IRJSTranslator);
  23574. smalltalk.addMethod(
  23575. smalltalk.method({
  23576. selector: "initialize",
  23577. category: 'initialization',
  23578. fn: function (){
  23579. var self=this;
  23580. function $JSStream(){return smalltalk.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  23581. return smalltalk.withContext(function($ctx1) {
  23582. smalltalk.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []);
  23583. self["@stream"]=_st($JSStream())._new();
  23584. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.IRJSTranslator)})},
  23585. args: [],
  23586. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  23587. messageSends: ["initialize", "new"],
  23588. referencedClasses: ["JSStream"]
  23589. }),
  23590. smalltalk.IRJSTranslator);
  23591. smalltalk.addMethod(
  23592. smalltalk.method({
  23593. selector: "stream",
  23594. category: 'accessing',
  23595. fn: function (){
  23596. var self=this;
  23597. return smalltalk.withContext(function($ctx1) {
  23598. var $1;
  23599. $1=self["@stream"];
  23600. return $1;
  23601. }, function($ctx1) {$ctx1.fill(self,"stream",{},smalltalk.IRJSTranslator)})},
  23602. args: [],
  23603. source: "stream\x0a\x09^ stream",
  23604. messageSends: [],
  23605. referencedClasses: []
  23606. }),
  23607. smalltalk.IRJSTranslator);
  23608. smalltalk.addMethod(
  23609. smalltalk.method({
  23610. selector: "stream:",
  23611. category: 'accessing',
  23612. fn: function (aStream){
  23613. var self=this;
  23614. return smalltalk.withContext(function($ctx1) {
  23615. self["@stream"]=aStream;
  23616. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.IRJSTranslator)})},
  23617. args: ["aStream"],
  23618. source: "stream: aStream\x0a\x09stream := aStream",
  23619. messageSends: [],
  23620. referencedClasses: []
  23621. }),
  23622. smalltalk.IRJSTranslator);
  23623. smalltalk.addMethod(
  23624. smalltalk.method({
  23625. selector: "visitIRAssignment:",
  23626. category: 'visiting',
  23627. fn: function (anIRAssignment){
  23628. var self=this;
  23629. return smalltalk.withContext(function($ctx1) {
  23630. self._visit_(_st(_st(anIRAssignment)._instructions())._first());
  23631. _st(self._stream())._nextPutAssignment();
  23632. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  23633. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRJSTranslator)})},
  23634. args: ["anIRAssignment"],
  23635. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  23636. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  23637. referencedClasses: []
  23638. }),
  23639. smalltalk.IRJSTranslator);
  23640. smalltalk.addMethod(
  23641. smalltalk.method({
  23642. selector: "visitIRClosure:",
  23643. category: 'visiting',
  23644. fn: function (anIRClosure){
  23645. var self=this;
  23646. return smalltalk.withContext(function($ctx1) {
  23647. _st(self._stream())._nextPutClosureWith_arguments_((function(){
  23648. return smalltalk.withContext(function($ctx2) {
  23649. _st(self._stream())._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  23650. return smalltalk.withContext(function($ctx3) {
  23651. return _st(_st(each)._name())._asVariableName();
  23652. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})})));
  23653. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  23654. return smalltalk.withContext(function($ctx3) {
  23655. return smalltalk.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]);
  23656. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  23657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),_st(anIRClosure)._arguments());
  23658. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},smalltalk.IRJSTranslator)})},
  23659. args: ["anIRClosure"],
  23660. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  23661. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  23662. referencedClasses: []
  23663. }),
  23664. smalltalk.IRJSTranslator);
  23665. smalltalk.addMethod(
  23666. smalltalk.method({
  23667. selector: "visitIRDynamicArray:",
  23668. category: 'visiting',
  23669. fn: function (anIRDynamicArray){
  23670. var self=this;
  23671. return smalltalk.withContext(function($ctx1) {
  23672. _st(self._stream())._nextPutAll_("[");
  23673. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  23674. return smalltalk.withContext(function($ctx2) {
  23675. return self._visit_(each);
  23676. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  23677. return smalltalk.withContext(function($ctx2) {
  23678. return _st(self._stream())._nextPutAll_(",");
  23679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  23680. _st(self["@stream"])._nextPutAll_("]");
  23681. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},smalltalk.IRJSTranslator)})},
  23682. args: ["anIRDynamicArray"],
  23683. 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: ']'",
  23684. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  23685. referencedClasses: []
  23686. }),
  23687. smalltalk.IRJSTranslator);
  23688. smalltalk.addMethod(
  23689. smalltalk.method({
  23690. selector: "visitIRDynamicDictionary:",
  23691. category: 'visiting',
  23692. fn: function (anIRDynamicDictionary){
  23693. var self=this;
  23694. return smalltalk.withContext(function($ctx1) {
  23695. _st(self._stream())._nextPutAll_("smalltalk.HashedCollection._from_([");
  23696. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  23697. return smalltalk.withContext(function($ctx2) {
  23698. return self._visit_(each);
  23699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  23700. return smalltalk.withContext(function($ctx2) {
  23701. return _st(self._stream())._nextPutAll_(",");
  23702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  23703. _st(self._stream())._nextPutAll_("])");
  23704. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},smalltalk.IRJSTranslator)})},
  23705. args: ["anIRDynamicDictionary"],
  23706. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'smalltalk.HashedCollection._from_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  23707. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  23708. referencedClasses: []
  23709. }),
  23710. smalltalk.IRJSTranslator);
  23711. smalltalk.addMethod(
  23712. smalltalk.method({
  23713. selector: "visitIRMethod:",
  23714. category: 'visiting',
  23715. fn: function (anIRMethod){
  23716. var self=this;
  23717. return smalltalk.withContext(function($ctx1) {
  23718. var $1,$2;
  23719. _st(self._stream())._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  23720. return smalltalk.withContext(function($ctx2) {
  23721. return _st(self._stream())._nextPutFunctionWith_arguments_((function(){
  23722. return smalltalk.withContext(function($ctx3) {
  23723. _st(self._stream())._nextPutVars_(_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  23724. return smalltalk.withContext(function($ctx4) {
  23725. return _st(_st(each)._name())._asVariableName();
  23726. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})})));
  23727. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  23728. return smalltalk.withContext(function($ctx4) {
  23729. return _st(self._stream())._nextPutClassRefFunction_(each);
  23730. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})}));
  23731. return _st(self._stream())._nextPutContextFor_during_(anIRMethod,(function(){
  23732. return smalltalk.withContext(function($ctx4) {
  23733. $1=_st(_st(anIRMethod)._internalVariables())._notEmpty();
  23734. if(smalltalk.assert($1)){
  23735. _st(self._stream())._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asArray())._collect_((function(each){
  23736. return smalltalk.withContext(function($ctx5) {
  23737. return _st(_st(each)._variable())._alias();
  23738. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)})})));
  23739. };
  23740. $2=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  23741. if(smalltalk.assert($2)){
  23742. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  23743. return smalltalk.withContext(function($ctx5) {
  23744. return smalltalk.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  23745. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  23746. } else {
  23747. return smalltalk.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]);
  23748. };
  23749. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
  23750. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),_st(anIRMethod)._arguments());
  23751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23752. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},smalltalk.IRJSTranslator)})},
  23753. args: ["anIRMethod"],
  23754. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asArray collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ]]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ]]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  23755. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asArray", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  23756. referencedClasses: []
  23757. }),
  23758. smalltalk.IRJSTranslator);
  23759. smalltalk.addMethod(
  23760. smalltalk.method({
  23761. selector: "visitIRNonLocalReturn:",
  23762. category: 'visiting',
  23763. fn: function (anIRNonLocalReturn){
  23764. var self=this;
  23765. return smalltalk.withContext(function($ctx1) {
  23766. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  23767. return smalltalk.withContext(function($ctx2) {
  23768. return smalltalk.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  23769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23770. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRJSTranslator)})},
  23771. args: ["anIRNonLocalReturn"],
  23772. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  23773. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  23774. referencedClasses: []
  23775. }),
  23776. smalltalk.IRJSTranslator);
  23777. smalltalk.addMethod(
  23778. smalltalk.method({
  23779. selector: "visitIRReturn:",
  23780. category: 'visiting',
  23781. fn: function (anIRReturn){
  23782. var self=this;
  23783. return smalltalk.withContext(function($ctx1) {
  23784. _st(self._stream())._nextPutReturnWith_((function(){
  23785. return smalltalk.withContext(function($ctx2) {
  23786. return smalltalk.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  23787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23788. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRJSTranslator)})},
  23789. args: ["anIRReturn"],
  23790. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  23791. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  23792. referencedClasses: []
  23793. }),
  23794. smalltalk.IRJSTranslator);
  23795. smalltalk.addMethod(
  23796. smalltalk.method({
  23797. selector: "visitIRSend:",
  23798. category: 'visiting',
  23799. fn: function (anIRSend){
  23800. var self=this;
  23801. return smalltalk.withContext(function($ctx1) {
  23802. var $1;
  23803. $1=_st(anIRSend)._classSend();
  23804. if(($receiver = $1) == nil || $receiver == null){
  23805. self._visitSend_(anIRSend);
  23806. } else {
  23807. self._visitSuperSend_(anIRSend);
  23808. };
  23809. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  23810. args: ["anIRSend"],
  23811. source: "visitIRSend: anIRSend\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ]",
  23812. messageSends: ["ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:"],
  23813. referencedClasses: []
  23814. }),
  23815. smalltalk.IRJSTranslator);
  23816. smalltalk.addMethod(
  23817. smalltalk.method({
  23818. selector: "visitIRSequence:",
  23819. category: 'visiting',
  23820. fn: function (anIRSequence){
  23821. var self=this;
  23822. return smalltalk.withContext(function($ctx1) {
  23823. _st(self._stream())._nextPutSequenceWith_((function(){
  23824. return smalltalk.withContext(function($ctx2) {
  23825. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  23826. return smalltalk.withContext(function($ctx3) {
  23827. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  23828. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  23829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23830. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},smalltalk.IRJSTranslator)})},
  23831. args: ["anIRSequence"],
  23832. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  23833. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  23834. referencedClasses: []
  23835. }),
  23836. smalltalk.IRJSTranslator);
  23837. smalltalk.addMethod(
  23838. smalltalk.method({
  23839. selector: "visitIRTempDeclaration:",
  23840. category: 'visiting',
  23841. fn: function (anIRTempDeclaration){
  23842. var self=this;
  23843. return smalltalk.withContext(function($ctx1) {
  23844. return self}, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},smalltalk.IRJSTranslator)})},
  23845. args: ["anIRTempDeclaration"],
  23846. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  23847. messageSends: [],
  23848. referencedClasses: []
  23849. }),
  23850. smalltalk.IRJSTranslator);
  23851. smalltalk.addMethod(
  23852. smalltalk.method({
  23853. selector: "visitIRValue:",
  23854. category: 'visiting',
  23855. fn: function (anIRValue){
  23856. var self=this;
  23857. return smalltalk.withContext(function($ctx1) {
  23858. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  23859. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},smalltalk.IRJSTranslator)})},
  23860. args: ["anIRValue"],
  23861. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  23862. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  23863. referencedClasses: []
  23864. }),
  23865. smalltalk.IRJSTranslator);
  23866. smalltalk.addMethod(
  23867. smalltalk.method({
  23868. selector: "visitIRVariable:",
  23869. category: 'visiting',
  23870. fn: function (anIRVariable){
  23871. var self=this;
  23872. return smalltalk.withContext(function($ctx1) {
  23873. var $1;
  23874. $1=_st(_st(_st(anIRVariable)._variable())._name()).__eq("thisContext");
  23875. if(smalltalk.assert($1)){
  23876. _st(self._stream())._nextPutAll_("smalltalk.getThisContext()");
  23877. } else {
  23878. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  23879. };
  23880. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},smalltalk.IRJSTranslator)})},
  23881. args: ["anIRVariable"],
  23882. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  23883. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
  23884. referencedClasses: []
  23885. }),
  23886. smalltalk.IRJSTranslator);
  23887. smalltalk.addMethod(
  23888. smalltalk.method({
  23889. selector: "visitIRVerbatim:",
  23890. category: 'visiting',
  23891. fn: function (anIRVerbatim){
  23892. var self=this;
  23893. return smalltalk.withContext(function($ctx1) {
  23894. _st(self._stream())._nextPutStatementWith_((function(){
  23895. return smalltalk.withContext(function($ctx2) {
  23896. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  23897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23898. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},smalltalk.IRJSTranslator)})},
  23899. args: ["anIRVerbatim"],
  23900. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  23901. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  23902. referencedClasses: []
  23903. }),
  23904. smalltalk.IRJSTranslator);
  23905. smalltalk.addMethod(
  23906. smalltalk.method({
  23907. selector: "visitReceiver:",
  23908. category: 'visiting',
  23909. fn: function (anIRInstruction){
  23910. var self=this;
  23911. return smalltalk.withContext(function($ctx1) {
  23912. var $1,$2;
  23913. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  23914. if(! smalltalk.assert($1)){
  23915. $2=self._visit_(anIRInstruction);
  23916. return $2;
  23917. };
  23918. _st(self._stream())._nextPutAll_("_st(");
  23919. self._visit_(anIRInstruction);
  23920. _st(self._stream())._nextPutAll_(")");
  23921. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},smalltalk.IRJSTranslator)})},
  23922. args: ["anIRInstruction"],
  23923. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  23924. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
  23925. referencedClasses: []
  23926. }),
  23927. smalltalk.IRJSTranslator);
  23928. smalltalk.addMethod(
  23929. smalltalk.method({
  23930. selector: "visitSend:",
  23931. category: 'visiting',
  23932. fn: function (anIRSend){
  23933. var self=this;
  23934. return smalltalk.withContext(function($ctx1) {
  23935. self._visitReceiver_(_st(_st(anIRSend)._instructions())._first());
  23936. _st(self._stream())._nextPutAll_(_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
  23937. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  23938. return smalltalk.withContext(function($ctx2) {
  23939. return self._visit_(each);
  23940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  23941. return smalltalk.withContext(function($ctx2) {
  23942. return _st(self._stream())._nextPutAll_(",");
  23943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  23944. _st(self._stream())._nextPutAll_(")");
  23945. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  23946. args: ["anIRSend"],
  23947. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asSelector, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  23948. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "visit:"],
  23949. referencedClasses: []
  23950. }),
  23951. smalltalk.IRJSTranslator);
  23952. smalltalk.addMethod(
  23953. smalltalk.method({
  23954. selector: "visitSuperSend:",
  23955. category: 'visiting',
  23956. fn: function (anIRSend){
  23957. var self=this;
  23958. return smalltalk.withContext(function($ctx1) {
  23959. var $1,$2;
  23960. $1=self._stream();
  23961. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  23962. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  23963. _st($1)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
  23964. $2=_st($1)._nextPutAll_("_st(");
  23965. self._visit_(_st(_st(anIRSend)._instructions())._first());
  23966. _st(self._stream())._nextPutAll_("), [");
  23967. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  23968. return smalltalk.withContext(function($ctx2) {
  23969. return self._visit_(each);
  23970. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  23971. return smalltalk.withContext(function($ctx2) {
  23972. return _st(self._stream())._nextPutAll_(",");
  23973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  23974. _st(self._stream())._nextPutAll_("])");
  23975. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},smalltalk.IRJSTranslator)})},
  23976. args: ["anIRSend"],
  23977. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  23978. messageSends: ["nextPutAll:", "stream", "asJavascript", "currentClass", ",", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"],
  23979. referencedClasses: []
  23980. }),
  23981. smalltalk.IRJSTranslator);
  23982. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  23983. smalltalk.addMethod(
  23984. smalltalk.method({
  23985. selector: "contents",
  23986. category: 'accessing',
  23987. fn: function (){
  23988. var self=this;
  23989. return smalltalk.withContext(function($ctx1) {
  23990. var $1;
  23991. $1=_st(self["@stream"])._contents();
  23992. return $1;
  23993. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.JSStream)})},
  23994. args: [],
  23995. source: "contents\x0a\x09^ stream contents",
  23996. messageSends: ["contents"],
  23997. referencedClasses: []
  23998. }),
  23999. smalltalk.JSStream);
  24000. smalltalk.addMethod(
  24001. smalltalk.method({
  24002. selector: "initialize",
  24003. category: 'initialization',
  24004. fn: function (){
  24005. var self=this;
  24006. return smalltalk.withContext(function($ctx1) {
  24007. smalltalk.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []);
  24008. self["@stream"]=""._writeStream();
  24009. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.JSStream)})},
  24010. args: [],
  24011. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  24012. messageSends: ["initialize", "writeStream"],
  24013. referencedClasses: []
  24014. }),
  24015. smalltalk.JSStream);
  24016. smalltalk.addMethod(
  24017. smalltalk.method({
  24018. selector: "lf",
  24019. category: 'streaming',
  24020. fn: function (){
  24021. var self=this;
  24022. return smalltalk.withContext(function($ctx1) {
  24023. _st(self["@stream"])._lf();
  24024. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},smalltalk.JSStream)})},
  24025. args: [],
  24026. source: "lf\x0a\x09stream lf",
  24027. messageSends: ["lf"],
  24028. referencedClasses: []
  24029. }),
  24030. smalltalk.JSStream);
  24031. smalltalk.addMethod(
  24032. smalltalk.method({
  24033. selector: "nextPut:",
  24034. category: 'streaming',
  24035. fn: function (aString){
  24036. var self=this;
  24037. return smalltalk.withContext(function($ctx1) {
  24038. _st(self["@stream"])._nextPut_(aString);
  24039. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},smalltalk.JSStream)})},
  24040. args: ["aString"],
  24041. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  24042. messageSends: ["nextPut:"],
  24043. referencedClasses: []
  24044. }),
  24045. smalltalk.JSStream);
  24046. smalltalk.addMethod(
  24047. smalltalk.method({
  24048. selector: "nextPutAll:",
  24049. category: 'streaming',
  24050. fn: function (aString){
  24051. var self=this;
  24052. return smalltalk.withContext(function($ctx1) {
  24053. _st(self["@stream"])._nextPutAll_(aString);
  24054. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},smalltalk.JSStream)})},
  24055. args: ["aString"],
  24056. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  24057. messageSends: ["nextPutAll:"],
  24058. referencedClasses: []
  24059. }),
  24060. smalltalk.JSStream);
  24061. smalltalk.addMethod(
  24062. smalltalk.method({
  24063. selector: "nextPutAssignment",
  24064. category: 'streaming',
  24065. fn: function (){
  24066. var self=this;
  24067. return smalltalk.withContext(function($ctx1) {
  24068. _st(self["@stream"])._nextPutAll_("=");
  24069. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},smalltalk.JSStream)})},
  24070. args: [],
  24071. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  24072. messageSends: ["nextPutAll:"],
  24073. referencedClasses: []
  24074. }),
  24075. smalltalk.JSStream);
  24076. smalltalk.addMethod(
  24077. smalltalk.method({
  24078. selector: "nextPutBlockContextFor:during:",
  24079. category: 'streaming',
  24080. fn: function (anIRClosure,aBlock){
  24081. var self=this;
  24082. return smalltalk.withContext(function($ctx1) {
  24083. var $1,$2,$3,$4,$5,$6,$7,$8;
  24084. $1=self;
  24085. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  24086. $2=_st($1)._lf();
  24087. _st(aBlock)._value();
  24088. $3=self;
  24089. _st($3)._nextPutAll_(_st("}, function(".__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
  24090. $4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fillBlock({"));
  24091. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  24092. return smalltalk.withContext(function($ctx2) {
  24093. $5=self;
  24094. _st($5)._nextPutAll_(_st(each)._asVariableName());
  24095. _st($5)._nextPutAll_(":");
  24096. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  24097. return $6;
  24098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  24099. return smalltalk.withContext(function($ctx2) {
  24100. return self._nextPutAll_(",");
  24101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  24102. $7=self;
  24103. _st($7)._nextPutAll_("},");
  24104. $8=_st($7)._nextPutAll_(_st(_st(_st(_st(_st(_st(anIRClosure)._scope())._outerScope())._alias()).__comma(",")).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString())).__comma(")})"));
  24105. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},smalltalk.JSStream)})},
  24106. args: ["anIRClosure", "aBlock"],
  24107. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')})'",
  24108. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
  24109. referencedClasses: []
  24110. }),
  24111. smalltalk.JSStream);
  24112. smalltalk.addMethod(
  24113. smalltalk.method({
  24114. selector: "nextPutClassRefFunction:",
  24115. category: 'streaming',
  24116. fn: function (aString){
  24117. var self=this;
  24118. return smalltalk.withContext(function($ctx1) {
  24119. var $1,$2;
  24120. $1=self["@stream"];
  24121. _st($1)._nextPutAll_("function $");
  24122. _st($1)._nextPutAll_(aString);
  24123. _st($1)._nextPutAll_("(){return smalltalk.");
  24124. _st($1)._nextPutAll_(aString);
  24125. _st($1)._nextPutAll_("||(typeof ");
  24126. _st($1)._nextPutAll_(aString);
  24127. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  24128. _st($1)._nextPutAll_(aString);
  24129. _st($1)._nextPutAll_(")}");
  24130. $2=_st($1)._lf();
  24131. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},smalltalk.JSStream)})},
  24132. args: ["aString"],
  24133. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return smalltalk.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  24134. messageSends: ["nextPutAll:", "lf"],
  24135. referencedClasses: []
  24136. }),
  24137. smalltalk.JSStream);
  24138. smalltalk.addMethod(
  24139. smalltalk.method({
  24140. selector: "nextPutClosureWith:arguments:",
  24141. category: 'streaming',
  24142. fn: function (aBlock,anArray){
  24143. var self=this;
  24144. return smalltalk.withContext(function($ctx1) {
  24145. var $1,$2;
  24146. _st(self["@stream"])._nextPutAll_("(function(");
  24147. _st(anArray)._do_separatedBy_((function(each){
  24148. return smalltalk.withContext(function($ctx2) {
  24149. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  24150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  24151. return smalltalk.withContext(function($ctx2) {
  24152. return _st(self["@stream"])._nextPut_(",");
  24153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  24154. $1=self["@stream"];
  24155. _st($1)._nextPutAll_("){");
  24156. $2=_st($1)._lf();
  24157. _st(aBlock)._value();
  24158. _st(self["@stream"])._nextPutAll_("})");
  24159. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  24160. args: ["aBlock", "anArray"],
  24161. 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: '})'",
  24162. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  24163. referencedClasses: []
  24164. }),
  24165. smalltalk.JSStream);
  24166. smalltalk.addMethod(
  24167. smalltalk.method({
  24168. selector: "nextPutContextFor:during:",
  24169. category: 'streaming',
  24170. fn: function (aMethod,aBlock){
  24171. var self=this;
  24172. return smalltalk.withContext(function($ctx1) {
  24173. var $1,$2,$3,$4,$5,$6,$7,$8;
  24174. $1=self;
  24175. _st($1)._nextPutAll_(_st("return smalltalk.withContext(function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") { "));
  24176. $2=_st($1)._lf();
  24177. _st(aBlock)._value();
  24178. $3=self;
  24179. _st($3)._nextPutAll_(_st(_st("}, function(".__comma(_st(_st(aMethod)._scope())._alias())).__comma(") {")).__comma(_st(_st(aMethod)._scope())._alias()));
  24180. $4=_st($3)._nextPutAll_(_st(".fill(self,".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(",{"));
  24181. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  24182. return smalltalk.withContext(function($ctx2) {
  24183. $5=self;
  24184. _st($5)._nextPutAll_(_st(each)._asVariableName());
  24185. _st($5)._nextPutAll_(":");
  24186. $6=_st($5)._nextPutAll_(_st(each)._asVariableName());
  24187. return $6;
  24188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  24189. return smalltalk.withContext(function($ctx2) {
  24190. return self._nextPutAll_(",");
  24191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  24192. $7=self;
  24193. _st($7)._nextPutAll_("},");
  24194. _st($7)._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  24195. $8=_st($7)._nextPutAll_(")})");
  24196. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  24197. args: ["aMethod", "aBlock"],
  24198. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')})'",
  24199. messageSends: ["nextPutAll:", ",", "alias", "scope", "lf", "value", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
  24200. referencedClasses: []
  24201. }),
  24202. smalltalk.JSStream);
  24203. smalltalk.addMethod(
  24204. smalltalk.method({
  24205. selector: "nextPutFunctionWith:arguments:",
  24206. category: 'streaming',
  24207. fn: function (aBlock,anArray){
  24208. var self=this;
  24209. return smalltalk.withContext(function($ctx1) {
  24210. var $1,$2,$3,$4;
  24211. _st(self["@stream"])._nextPutAll_("fn: function(");
  24212. _st(anArray)._do_separatedBy_((function(each){
  24213. return smalltalk.withContext(function($ctx2) {
  24214. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  24215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  24216. return smalltalk.withContext(function($ctx2) {
  24217. return _st(self["@stream"])._nextPut_(",");
  24218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  24219. $1=self["@stream"];
  24220. _st($1)._nextPutAll_("){");
  24221. $2=_st($1)._lf();
  24222. $3=self["@stream"];
  24223. _st($3)._nextPutAll_("var self=this;");
  24224. $4=_st($3)._lf();
  24225. _st(aBlock)._value();
  24226. _st(self["@stream"])._nextPutAll_("}");
  24227. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},smalltalk.JSStream)})},
  24228. args: ["aBlock", "anArray"],
  24229. 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: '}'",
  24230. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  24231. referencedClasses: []
  24232. }),
  24233. smalltalk.JSStream);
  24234. smalltalk.addMethod(
  24235. smalltalk.method({
  24236. selector: "nextPutIf:with:",
  24237. category: 'streaming',
  24238. fn: function (aBlock,anotherBlock){
  24239. var self=this;
  24240. return smalltalk.withContext(function($ctx1) {
  24241. var $1,$2;
  24242. _st(self["@stream"])._nextPutAll_("if(");
  24243. _st(aBlock)._value();
  24244. $1=self["@stream"];
  24245. _st($1)._nextPutAll_("){");
  24246. $2=_st($1)._lf();
  24247. _st(anotherBlock)._value();
  24248. _st(self["@stream"])._nextPutAll_("}");
  24249. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},smalltalk.JSStream)})},
  24250. args: ["aBlock", "anotherBlock"],
  24251. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  24252. messageSends: ["nextPutAll:", "value", "lf"],
  24253. referencedClasses: []
  24254. }),
  24255. smalltalk.JSStream);
  24256. smalltalk.addMethod(
  24257. smalltalk.method({
  24258. selector: "nextPutIfElse:with:with:",
  24259. category: 'streaming',
  24260. fn: function (aBlock,ifBlock,elseBlock){
  24261. var self=this;
  24262. return smalltalk.withContext(function($ctx1) {
  24263. var $1,$2,$3,$4;
  24264. _st(self["@stream"])._nextPutAll_("if(");
  24265. _st(aBlock)._value();
  24266. $1=self["@stream"];
  24267. _st($1)._nextPutAll_("){");
  24268. $2=_st($1)._lf();
  24269. _st(ifBlock)._value();
  24270. $3=self["@stream"];
  24271. _st($3)._nextPutAll_("} else {");
  24272. $4=_st($3)._lf();
  24273. _st(elseBlock)._value();
  24274. _st(self["@stream"])._nextPutAll_("}");
  24275. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},smalltalk.JSStream)})},
  24276. args: ["aBlock", "ifBlock", "elseBlock"],
  24277. 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: '}'",
  24278. messageSends: ["nextPutAll:", "value", "lf"],
  24279. referencedClasses: []
  24280. }),
  24281. smalltalk.JSStream);
  24282. smalltalk.addMethod(
  24283. smalltalk.method({
  24284. selector: "nextPutMethodDeclaration:with:",
  24285. category: 'streaming',
  24286. fn: function (aMethod,aBlock){
  24287. var self=this;
  24288. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  24289. return smalltalk.withContext(function($ctx1) {
  24290. var $1,$2,$3,$4,$5,$6;
  24291. $1=self["@stream"];
  24292. _st($1)._nextPutAll_("smalltalk.method({");
  24293. _st($1)._lf();
  24294. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  24295. _st($1)._lf();
  24296. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  24297. $2=_st($1)._lf();
  24298. _st(aBlock)._value();
  24299. $3=self["@stream"];
  24300. _st($3)._nextPutAll_(_st(",".__comma(_st($String())._lf())).__comma("messageSends: "));
  24301. _st($3)._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
  24302. _st($3)._lf();
  24303. _st($3)._nextPutAll_(_st("args: ".__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  24304. return smalltalk.withContext(function($ctx2) {
  24305. return _st(each)._value();
  24306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asArray())._asJavascript())).__comma(","));
  24307. _st($3)._lf();
  24308. $4=_st($3)._nextPutAll_("referencedClasses: [");
  24309. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  24310. return smalltalk.withContext(function($ctx2) {
  24311. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  24312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  24313. return smalltalk.withContext(function($ctx2) {
  24314. return _st(self["@stream"])._nextPutAll_(",");
  24315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  24316. $5=self["@stream"];
  24317. _st($5)._nextPutAll_("]");
  24318. $6=_st($5)._nextPutAll_("})");
  24319. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},smalltalk.JSStream)})},
  24320. args: ["aMethod", "aBlock"],
  24321. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [:each | stream nextPutAll: each asJavascript]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  24322. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  24323. referencedClasses: ["String"]
  24324. }),
  24325. smalltalk.JSStream);
  24326. smalltalk.addMethod(
  24327. smalltalk.method({
  24328. selector: "nextPutNonLocalReturnHandlingWith:",
  24329. category: 'streaming',
  24330. fn: function (aBlock){
  24331. var self=this;
  24332. return smalltalk.withContext(function($ctx1) {
  24333. var $1,$2,$3,$4;
  24334. $1=self["@stream"];
  24335. _st($1)._nextPutAll_("var $early={};");
  24336. _st($1)._lf();
  24337. _st($1)._nextPutAll_("try {");
  24338. $2=_st($1)._lf();
  24339. _st(aBlock)._value();
  24340. $3=self["@stream"];
  24341. _st($3)._nextPutAll_("}");
  24342. _st($3)._lf();
  24343. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  24344. $4=_st($3)._lf();
  24345. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  24346. args: ["aBlock"],
  24347. 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",
  24348. messageSends: ["nextPutAll:", "lf", "value"],
  24349. referencedClasses: []
  24350. }),
  24351. smalltalk.JSStream);
  24352. smalltalk.addMethod(
  24353. smalltalk.method({
  24354. selector: "nextPutNonLocalReturnWith:",
  24355. category: 'streaming',
  24356. fn: function (aBlock){
  24357. var self=this;
  24358. return smalltalk.withContext(function($ctx1) {
  24359. _st(self["@stream"])._nextPutAll_("throw $early=[");
  24360. _st(aBlock)._value();
  24361. _st(self["@stream"])._nextPutAll_("]");
  24362. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  24363. args: ["aBlock"],
  24364. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  24365. messageSends: ["nextPutAll:", "value"],
  24366. referencedClasses: []
  24367. }),
  24368. smalltalk.JSStream);
  24369. smalltalk.addMethod(
  24370. smalltalk.method({
  24371. selector: "nextPutReturn",
  24372. category: 'streaming',
  24373. fn: function (){
  24374. var self=this;
  24375. return smalltalk.withContext(function($ctx1) {
  24376. _st(self["@stream"])._nextPutAll_("return ");
  24377. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},smalltalk.JSStream)})},
  24378. args: [],
  24379. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  24380. messageSends: ["nextPutAll:"],
  24381. referencedClasses: []
  24382. }),
  24383. smalltalk.JSStream);
  24384. smalltalk.addMethod(
  24385. smalltalk.method({
  24386. selector: "nextPutReturnWith:",
  24387. category: 'streaming',
  24388. fn: function (aBlock){
  24389. var self=this;
  24390. return smalltalk.withContext(function($ctx1) {
  24391. self._nextPutReturn();
  24392. _st(aBlock)._value();
  24393. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  24394. args: ["aBlock"],
  24395. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  24396. messageSends: ["nextPutReturn", "value"],
  24397. referencedClasses: []
  24398. }),
  24399. smalltalk.JSStream);
  24400. smalltalk.addMethod(
  24401. smalltalk.method({
  24402. selector: "nextPutSequenceWith:",
  24403. category: 'streaming',
  24404. fn: function (aBlock){
  24405. var self=this;
  24406. return smalltalk.withContext(function($ctx1) {
  24407. _st(aBlock)._value();
  24408. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  24409. args: ["aBlock"],
  24410. 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",
  24411. messageSends: ["value"],
  24412. referencedClasses: []
  24413. }),
  24414. smalltalk.JSStream);
  24415. smalltalk.addMethod(
  24416. smalltalk.method({
  24417. selector: "nextPutStatementWith:",
  24418. category: 'streaming',
  24419. fn: function (aBlock){
  24420. var self=this;
  24421. return smalltalk.withContext(function($ctx1) {
  24422. var $1,$2;
  24423. _st(aBlock)._value();
  24424. $1=self["@stream"];
  24425. _st($1)._nextPutAll_(";");
  24426. $2=_st($1)._lf();
  24427. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},smalltalk.JSStream)})},
  24428. args: ["aBlock"],
  24429. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  24430. messageSends: ["value", "nextPutAll:", "lf"],
  24431. referencedClasses: []
  24432. }),
  24433. smalltalk.JSStream);
  24434. smalltalk.addMethod(
  24435. smalltalk.method({
  24436. selector: "nextPutVars:",
  24437. category: 'streaming',
  24438. fn: function (aCollection){
  24439. var self=this;
  24440. return smalltalk.withContext(function($ctx1) {
  24441. var $1,$2,$3;
  24442. var $early={};
  24443. try {
  24444. _st(aCollection)._ifEmpty_((function(){
  24445. return smalltalk.withContext(function($ctx2) {
  24446. $1=self;
  24447. throw $early=[$1];
  24448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24449. _st(self["@stream"])._nextPutAll_("var ");
  24450. _st(aCollection)._do_separatedBy_((function(each){
  24451. return smalltalk.withContext(function($ctx2) {
  24452. return _st(self["@stream"])._nextPutAll_(each);
  24453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  24454. return smalltalk.withContext(function($ctx2) {
  24455. return _st(self["@stream"])._nextPutAll_(",");
  24456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  24457. $2=self["@stream"];
  24458. _st($2)._nextPutAll_(";");
  24459. $3=_st($2)._lf();
  24460. return self}
  24461. catch(e) {if(e===$early)return e[0]; throw e}
  24462. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},smalltalk.JSStream)})},
  24463. args: ["aCollection"],
  24464. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  24465. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  24466. referencedClasses: []
  24467. }),
  24468. smalltalk.JSStream);
  24469. smalltalk.addMethod(
  24470. smalltalk.method({
  24471. selector: "appendToInstruction:",
  24472. category: '*Compiler-IR',
  24473. fn: function (anIRInstruction){
  24474. var self=this;
  24475. return smalltalk.withContext(function($ctx1) {
  24476. _st(anIRInstruction)._appendBlock_(self);
  24477. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},smalltalk.BlockClosure)})},
  24478. args: ["anIRInstruction"],
  24479. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  24480. messageSends: ["appendBlock:"],
  24481. referencedClasses: []
  24482. }),
  24483. smalltalk.BlockClosure);
  24484. smalltalk.addMethod(
  24485. smalltalk.method({
  24486. selector: "asVariableName",
  24487. category: '*Compiler-IR',
  24488. fn: function (){
  24489. var self=this;
  24490. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  24491. return smalltalk.withContext(function($ctx1) {
  24492. var $2,$1;
  24493. $2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(self);
  24494. if(smalltalk.assert($2)){
  24495. $1=self.__comma("_");
  24496. } else {
  24497. $1=self;
  24498. };
  24499. return $1;
  24500. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
  24501. args: [],
  24502. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  24503. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
  24504. referencedClasses: ["Smalltalk"]
  24505. }),
  24506. smalltalk.String);
  24507. });
  24508. define("amber_core/Compiler-Inlining", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function(smalltalk,nil,_st){
  24509. smalltalk.addPackage('Compiler-Inlining');
  24510. smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24511. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  24512. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  24513. smalltalk.addMethod(
  24514. smalltalk.method({
  24515. selector: "accept:",
  24516. category: 'visiting',
  24517. fn: function (aVisitor){
  24518. var self=this;
  24519. return smalltalk.withContext(function($ctx1) {
  24520. var $1;
  24521. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  24522. return $1;
  24523. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedAssignment)})},
  24524. args: ["aVisitor"],
  24525. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  24526. messageSends: ["visitIRInlinedAssignment:"],
  24527. referencedClasses: []
  24528. }),
  24529. smalltalk.IRInlinedAssignment);
  24530. smalltalk.addMethod(
  24531. smalltalk.method({
  24532. selector: "isInlined",
  24533. category: 'testing',
  24534. fn: function (){
  24535. var self=this;
  24536. return smalltalk.withContext(function($ctx1) {
  24537. return true;
  24538. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedAssignment)})},
  24539. args: [],
  24540. source: "isInlined\x0a\x09^ true",
  24541. messageSends: [],
  24542. referencedClasses: []
  24543. }),
  24544. smalltalk.IRInlinedAssignment);
  24545. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  24546. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  24547. smalltalk.addMethod(
  24548. smalltalk.method({
  24549. selector: "accept:",
  24550. category: 'visiting',
  24551. fn: function (aVisitor){
  24552. var self=this;
  24553. return smalltalk.withContext(function($ctx1) {
  24554. _st(aVisitor)._visitIRInlinedClosure_(self);
  24555. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedClosure)})},
  24556. args: ["aVisitor"],
  24557. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  24558. messageSends: ["visitIRInlinedClosure:"],
  24559. referencedClasses: []
  24560. }),
  24561. smalltalk.IRInlinedClosure);
  24562. smalltalk.addMethod(
  24563. smalltalk.method({
  24564. selector: "isInlined",
  24565. category: 'testing',
  24566. fn: function (){
  24567. var self=this;
  24568. return smalltalk.withContext(function($ctx1) {
  24569. return true;
  24570. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedClosure)})},
  24571. args: [],
  24572. source: "isInlined\x0a\x09^ true",
  24573. messageSends: [],
  24574. referencedClasses: []
  24575. }),
  24576. smalltalk.IRInlinedClosure);
  24577. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  24578. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  24579. smalltalk.addMethod(
  24580. smalltalk.method({
  24581. selector: "accept:",
  24582. category: 'visiting',
  24583. fn: function (aVisitor){
  24584. var self=this;
  24585. return smalltalk.withContext(function($ctx1) {
  24586. var $1;
  24587. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  24588. return $1;
  24589. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedReturn)})},
  24590. args: ["aVisitor"],
  24591. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  24592. messageSends: ["visitIRInlinedReturn:"],
  24593. referencedClasses: []
  24594. }),
  24595. smalltalk.IRInlinedReturn);
  24596. smalltalk.addMethod(
  24597. smalltalk.method({
  24598. selector: "isInlined",
  24599. category: 'testing',
  24600. fn: function (){
  24601. var self=this;
  24602. return smalltalk.withContext(function($ctx1) {
  24603. return true;
  24604. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedReturn)})},
  24605. args: [],
  24606. source: "isInlined\x0a\x09^ true",
  24607. messageSends: [],
  24608. referencedClasses: []
  24609. }),
  24610. smalltalk.IRInlinedReturn);
  24611. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  24612. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  24613. smalltalk.addMethod(
  24614. smalltalk.method({
  24615. selector: "accept:",
  24616. category: 'visiting',
  24617. fn: function (aVisitor){
  24618. var self=this;
  24619. return smalltalk.withContext(function($ctx1) {
  24620. _st(aVisitor)._visitInlinedSend_(self);
  24621. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSend)})},
  24622. args: ["aVisitor"],
  24623. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  24624. messageSends: ["visitInlinedSend:"],
  24625. referencedClasses: []
  24626. }),
  24627. smalltalk.IRInlinedSend);
  24628. smalltalk.addMethod(
  24629. smalltalk.method({
  24630. selector: "isInlined",
  24631. category: 'testing',
  24632. fn: function (){
  24633. var self=this;
  24634. return smalltalk.withContext(function($ctx1) {
  24635. return true;
  24636. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSend)})},
  24637. args: [],
  24638. source: "isInlined\x0a\x09^ true",
  24639. messageSends: [],
  24640. referencedClasses: []
  24641. }),
  24642. smalltalk.IRInlinedSend);
  24643. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  24644. smalltalk.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  24645. smalltalk.addMethod(
  24646. smalltalk.method({
  24647. selector: "accept:",
  24648. category: 'visiting',
  24649. fn: function (aVisitor){
  24650. var self=this;
  24651. return smalltalk.withContext(function($ctx1) {
  24652. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  24653. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfFalse)})},
  24654. args: ["aVisitor"],
  24655. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  24656. messageSends: ["visitIRInlinedIfFalse:"],
  24657. referencedClasses: []
  24658. }),
  24659. smalltalk.IRInlinedIfFalse);
  24660. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  24661. smalltalk.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  24662. smalltalk.addMethod(
  24663. smalltalk.method({
  24664. selector: "accept:",
  24665. category: 'visiting',
  24666. fn: function (aVisitor){
  24667. var self=this;
  24668. return smalltalk.withContext(function($ctx1) {
  24669. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  24670. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfNilIfNotNil)})},
  24671. args: ["aVisitor"],
  24672. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  24673. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  24674. referencedClasses: []
  24675. }),
  24676. smalltalk.IRInlinedIfNilIfNotNil);
  24677. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  24678. smalltalk.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  24679. smalltalk.addMethod(
  24680. smalltalk.method({
  24681. selector: "accept:",
  24682. category: 'visiting',
  24683. fn: function (aVisitor){
  24684. var self=this;
  24685. return smalltalk.withContext(function($ctx1) {
  24686. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  24687. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrue)})},
  24688. args: ["aVisitor"],
  24689. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  24690. messageSends: ["visitIRInlinedIfTrue:"],
  24691. referencedClasses: []
  24692. }),
  24693. smalltalk.IRInlinedIfTrue);
  24694. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  24695. smalltalk.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  24696. smalltalk.addMethod(
  24697. smalltalk.method({
  24698. selector: "accept:",
  24699. category: 'visiting',
  24700. fn: function (aVisitor){
  24701. var self=this;
  24702. return smalltalk.withContext(function($ctx1) {
  24703. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  24704. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrueIfFalse)})},
  24705. args: ["aVisitor"],
  24706. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  24707. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  24708. referencedClasses: []
  24709. }),
  24710. smalltalk.IRInlinedIfTrueIfFalse);
  24711. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  24712. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  24713. smalltalk.addMethod(
  24714. smalltalk.method({
  24715. selector: "accept:",
  24716. category: 'visiting',
  24717. fn: function (aVisitor){
  24718. var self=this;
  24719. return smalltalk.withContext(function($ctx1) {
  24720. _st(aVisitor)._visitIRInlinedSequence_(self);
  24721. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSequence)})},
  24722. args: ["aVisitor"],
  24723. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  24724. messageSends: ["visitIRInlinedSequence:"],
  24725. referencedClasses: []
  24726. }),
  24727. smalltalk.IRInlinedSequence);
  24728. smalltalk.addMethod(
  24729. smalltalk.method({
  24730. selector: "isInlined",
  24731. category: 'testing',
  24732. fn: function (){
  24733. var self=this;
  24734. return smalltalk.withContext(function($ctx1) {
  24735. return true;
  24736. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSequence)})},
  24737. args: [],
  24738. source: "isInlined\x0a\x09^ true",
  24739. messageSends: [],
  24740. referencedClasses: []
  24741. }),
  24742. smalltalk.IRInlinedSequence);
  24743. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  24744. 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`";
  24745. smalltalk.addMethod(
  24746. smalltalk.method({
  24747. selector: "assignmentInliner",
  24748. category: 'factory',
  24749. fn: function (){
  24750. var self=this;
  24751. function $IRAssignmentInliner(){return smalltalk.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  24752. return smalltalk.withContext(function($ctx1) {
  24753. var $2,$3,$1;
  24754. $2=_st($IRAssignmentInliner())._new();
  24755. _st($2)._translator_(self);
  24756. $3=_st($2)._yourself();
  24757. $1=$3;
  24758. return $1;
  24759. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},smalltalk.IRInliner)})},
  24760. args: [],
  24761. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  24762. messageSends: ["translator:", "new", "yourself"],
  24763. referencedClasses: ["IRAssignmentInliner"]
  24764. }),
  24765. smalltalk.IRInliner);
  24766. smalltalk.addMethod(
  24767. smalltalk.method({
  24768. selector: "returnInliner",
  24769. category: 'factory',
  24770. fn: function (){
  24771. var self=this;
  24772. function $IRReturnInliner(){return smalltalk.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  24773. return smalltalk.withContext(function($ctx1) {
  24774. var $2,$3,$1;
  24775. $2=_st($IRReturnInliner())._new();
  24776. _st($2)._translator_(self);
  24777. $3=_st($2)._yourself();
  24778. $1=$3;
  24779. return $1;
  24780. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},smalltalk.IRInliner)})},
  24781. args: [],
  24782. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  24783. messageSends: ["translator:", "new", "yourself"],
  24784. referencedClasses: ["IRReturnInliner"]
  24785. }),
  24786. smalltalk.IRInliner);
  24787. smalltalk.addMethod(
  24788. smalltalk.method({
  24789. selector: "sendInliner",
  24790. category: 'factory',
  24791. fn: function (){
  24792. var self=this;
  24793. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  24794. return smalltalk.withContext(function($ctx1) {
  24795. var $2,$3,$1;
  24796. $2=_st($IRSendInliner())._new();
  24797. _st($2)._translator_(self);
  24798. $3=_st($2)._yourself();
  24799. $1=$3;
  24800. return $1;
  24801. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},smalltalk.IRInliner)})},
  24802. args: [],
  24803. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  24804. messageSends: ["translator:", "new", "yourself"],
  24805. referencedClasses: ["IRSendInliner"]
  24806. }),
  24807. smalltalk.IRInliner);
  24808. smalltalk.addMethod(
  24809. smalltalk.method({
  24810. selector: "shouldInlineAssignment:",
  24811. category: 'testing',
  24812. fn: function (anIRAssignment){
  24813. var self=this;
  24814. return smalltalk.withContext(function($ctx1) {
  24815. var $1;
  24816. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  24817. return smalltalk.withContext(function($ctx2) {
  24818. return _st(_st(_st(_st(anIRAssignment)._instructions())._last())._isSend())._and_((function(){
  24819. return smalltalk.withContext(function($ctx3) {
  24820. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  24821. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  24822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24823. return $1;
  24824. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  24825. args: ["anIRAssignment"],
  24826. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  24827. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"],
  24828. referencedClasses: []
  24829. }),
  24830. smalltalk.IRInliner);
  24831. smalltalk.addMethod(
  24832. smalltalk.method({
  24833. selector: "shouldInlineReturn:",
  24834. category: 'testing',
  24835. fn: function (anIRReturn){
  24836. var self=this;
  24837. return smalltalk.withContext(function($ctx1) {
  24838. var $1;
  24839. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  24840. return smalltalk.withContext(function($ctx2) {
  24841. return _st(_st(_st(_st(anIRReturn)._instructions())._first())._isSend())._and_((function(){
  24842. return smalltalk.withContext(function($ctx3) {
  24843. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  24844. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  24845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24846. return $1;
  24847. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  24848. args: ["anIRReturn"],
  24849. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  24850. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"],
  24851. referencedClasses: []
  24852. }),
  24853. smalltalk.IRInliner);
  24854. smalltalk.addMethod(
  24855. smalltalk.method({
  24856. selector: "shouldInlineSend:",
  24857. category: 'testing',
  24858. fn: function (anIRSend){
  24859. var self=this;
  24860. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  24861. return smalltalk.withContext(function($ctx1) {
  24862. var $1;
  24863. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  24864. return smalltalk.withContext(function($ctx2) {
  24865. return _st($IRSendInliner())._shouldInline_(anIRSend);
  24866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24867. return $1;
  24868. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  24869. args: ["anIRSend"],
  24870. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  24871. messageSends: ["and:", "not", "isInlined", "shouldInline:"],
  24872. referencedClasses: ["IRSendInliner"]
  24873. }),
  24874. smalltalk.IRInliner);
  24875. smalltalk.addMethod(
  24876. smalltalk.method({
  24877. selector: "transformNonLocalReturn:",
  24878. category: 'visiting',
  24879. fn: function (anIRNonLocalReturn){
  24880. var self=this;
  24881. var localReturn;
  24882. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  24883. return smalltalk.withContext(function($ctx1) {
  24884. var $1,$2,$3,$4,$5;
  24885. $1=_st(_st(anIRNonLocalReturn)._scope())._canInlineNonLocalReturns();
  24886. if(smalltalk.assert($1)){
  24887. _st(_st(_st(anIRNonLocalReturn)._scope())._methodScope())._removeNonLocalReturn_(_st(anIRNonLocalReturn)._scope());
  24888. $2=_st($IRReturn())._new();
  24889. _st($2)._scope_(_st(anIRNonLocalReturn)._scope());
  24890. $3=_st($2)._yourself();
  24891. localReturn=$3;
  24892. localReturn;
  24893. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  24894. return smalltalk.withContext(function($ctx2) {
  24895. return _st(localReturn)._add_(each);
  24896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  24897. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  24898. $4=localReturn;
  24899. return $4;
  24900. };
  24901. $5=smalltalk.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  24902. return $5;
  24903. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},smalltalk.IRInliner)})},
  24904. args: ["anIRNonLocalReturn"],
  24905. 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",
  24906. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"],
  24907. referencedClasses: ["IRReturn"]
  24908. }),
  24909. smalltalk.IRInliner);
  24910. smalltalk.addMethod(
  24911. smalltalk.method({
  24912. selector: "visitIRAssignment:",
  24913. category: 'visiting',
  24914. fn: function (anIRAssignment){
  24915. var self=this;
  24916. return smalltalk.withContext(function($ctx1) {
  24917. var $2,$1;
  24918. $2=self._shouldInlineAssignment_(anIRAssignment);
  24919. if(smalltalk.assert($2)){
  24920. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  24921. } else {
  24922. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]);
  24923. };
  24924. return $1;
  24925. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  24926. args: ["anIRAssignment"],
  24927. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  24928. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"],
  24929. referencedClasses: []
  24930. }),
  24931. smalltalk.IRInliner);
  24932. smalltalk.addMethod(
  24933. smalltalk.method({
  24934. selector: "visitIRNonLocalReturn:",
  24935. category: 'visiting',
  24936. fn: function (anIRNonLocalReturn){
  24937. var self=this;
  24938. return smalltalk.withContext(function($ctx1) {
  24939. var $1;
  24940. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  24941. return $1;
  24942. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRInliner)})},
  24943. args: ["anIRNonLocalReturn"],
  24944. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  24945. messageSends: ["transformNonLocalReturn:"],
  24946. referencedClasses: []
  24947. }),
  24948. smalltalk.IRInliner);
  24949. smalltalk.addMethod(
  24950. smalltalk.method({
  24951. selector: "visitIRReturn:",
  24952. category: 'visiting',
  24953. fn: function (anIRReturn){
  24954. var self=this;
  24955. return smalltalk.withContext(function($ctx1) {
  24956. var $2,$1;
  24957. $2=self._shouldInlineReturn_(anIRReturn);
  24958. if(smalltalk.assert($2)){
  24959. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  24960. } else {
  24961. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  24962. };
  24963. return $1;
  24964. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  24965. args: ["anIRReturn"],
  24966. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  24967. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"],
  24968. referencedClasses: []
  24969. }),
  24970. smalltalk.IRInliner);
  24971. smalltalk.addMethod(
  24972. smalltalk.method({
  24973. selector: "visitIRSend:",
  24974. category: 'visiting',
  24975. fn: function (anIRSend){
  24976. var self=this;
  24977. return smalltalk.withContext(function($ctx1) {
  24978. var $2,$1;
  24979. $2=self._shouldInlineSend_(anIRSend);
  24980. if(smalltalk.assert($2)){
  24981. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  24982. } else {
  24983. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]);
  24984. };
  24985. return $1;
  24986. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  24987. args: ["anIRSend"],
  24988. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  24989. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"],
  24990. referencedClasses: []
  24991. }),
  24992. smalltalk.IRInliner);
  24993. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  24994. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  24995. smalltalk.addMethod(
  24996. smalltalk.method({
  24997. selector: "visitIRInlinedAssignment:",
  24998. category: 'visiting',
  24999. fn: function (anIRInlinedAssignment){
  25000. var self=this;
  25001. return smalltalk.withContext(function($ctx1) {
  25002. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  25003. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},smalltalk.IRInliningJSTranslator)})},
  25004. args: ["anIRInlinedAssignment"],
  25005. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  25006. messageSends: ["visit:", "last", "instructions"],
  25007. referencedClasses: []
  25008. }),
  25009. smalltalk.IRInliningJSTranslator);
  25010. smalltalk.addMethod(
  25011. smalltalk.method({
  25012. selector: "visitIRInlinedClosure:",
  25013. category: 'visiting',
  25014. fn: function (anIRInlinedClosure){
  25015. var self=this;
  25016. return smalltalk.withContext(function($ctx1) {
  25017. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  25018. return smalltalk.withContext(function($ctx2) {
  25019. return _st(_st(each)._name())._asVariableName();
  25020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  25021. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  25022. return smalltalk.withContext(function($ctx2) {
  25023. return self._visit_(each);
  25024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  25025. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRInliningJSTranslator)})},
  25026. args: ["anIRInlinedClosure"],
  25027. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  25028. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"],
  25029. referencedClasses: []
  25030. }),
  25031. smalltalk.IRInliningJSTranslator);
  25032. smalltalk.addMethod(
  25033. smalltalk.method({
  25034. selector: "visitIRInlinedIfFalse:",
  25035. category: 'visiting',
  25036. fn: function (anIRInlinedIfFalse){
  25037. var self=this;
  25038. return smalltalk.withContext(function($ctx1) {
  25039. _st(self._stream())._nextPutIf_with_((function(){
  25040. return smalltalk.withContext(function($ctx2) {
  25041. _st(self._stream())._nextPutAll_("! smalltalk.assert(");
  25042. self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first());
  25043. return _st(self._stream())._nextPutAll_(")");
  25044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  25045. return smalltalk.withContext(function($ctx2) {
  25046. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  25047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  25048. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},smalltalk.IRInliningJSTranslator)})},
  25049. args: ["anIRInlinedIfFalse"],
  25050. 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 ]",
  25051. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  25052. referencedClasses: []
  25053. }),
  25054. smalltalk.IRInliningJSTranslator);
  25055. smalltalk.addMethod(
  25056. smalltalk.method({
  25057. selector: "visitIRInlinedIfNil:",
  25058. category: 'visiting',
  25059. fn: function (anIRInlinedIfNil){
  25060. var self=this;
  25061. return smalltalk.withContext(function($ctx1) {
  25062. _st(self._stream())._nextPutIf_with_((function(){
  25063. return smalltalk.withContext(function($ctx2) {
  25064. _st(self._stream())._nextPutAll_("($receiver = ");
  25065. self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first());
  25066. return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
  25067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  25068. return smalltalk.withContext(function($ctx2) {
  25069. return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  25070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  25071. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},smalltalk.IRInliningJSTranslator)})},
  25072. args: ["anIRInlinedIfNil"],
  25073. source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09self visit: anIRInlinedIfNil instructions first.\x0a\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
  25074. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  25075. referencedClasses: []
  25076. }),
  25077. smalltalk.IRInliningJSTranslator);
  25078. smalltalk.addMethod(
  25079. smalltalk.method({
  25080. selector: "visitIRInlinedIfNilIfNotNil:",
  25081. category: 'visiting',
  25082. fn: function (anIRInlinedIfNilIfNotNil){
  25083. var self=this;
  25084. return smalltalk.withContext(function($ctx1) {
  25085. _st(self._stream())._nextPutIfElse_with_with_((function(){
  25086. return smalltalk.withContext(function($ctx2) {
  25087. _st(self._stream())._nextPutAll_("($receiver = ");
  25088. self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first());
  25089. return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
  25090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  25091. return smalltalk.withContext(function($ctx2) {
  25092. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second());
  25093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  25094. return smalltalk.withContext(function($ctx2) {
  25095. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  25096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  25097. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},smalltalk.IRInliningJSTranslator)})},
  25098. args: ["anIRInlinedIfNilIfNotNil"],
  25099. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  25100. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
  25101. referencedClasses: []
  25102. }),
  25103. smalltalk.IRInliningJSTranslator);
  25104. smalltalk.addMethod(
  25105. smalltalk.method({
  25106. selector: "visitIRInlinedIfTrue:",
  25107. category: 'visiting',
  25108. fn: function (anIRInlinedIfTrue){
  25109. var self=this;
  25110. return smalltalk.withContext(function($ctx1) {
  25111. _st(self._stream())._nextPutIf_with_((function(){
  25112. return smalltalk.withContext(function($ctx2) {
  25113. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  25114. self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first());
  25115. return _st(self._stream())._nextPutAll_(")");
  25116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  25117. return smalltalk.withContext(function($ctx2) {
  25118. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  25119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  25120. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},smalltalk.IRInliningJSTranslator)})},
  25121. args: ["anIRInlinedIfTrue"],
  25122. 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 ]",
  25123. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  25124. referencedClasses: []
  25125. }),
  25126. smalltalk.IRInliningJSTranslator);
  25127. smalltalk.addMethod(
  25128. smalltalk.method({
  25129. selector: "visitIRInlinedIfTrueIfFalse:",
  25130. category: 'visiting',
  25131. fn: function (anIRInlinedIfTrueIfFalse){
  25132. var self=this;
  25133. return smalltalk.withContext(function($ctx1) {
  25134. _st(self._stream())._nextPutIfElse_with_with_((function(){
  25135. return smalltalk.withContext(function($ctx2) {
  25136. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  25137. self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first());
  25138. return _st(self._stream())._nextPutAll_(")");
  25139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  25140. return smalltalk.withContext(function($ctx2) {
  25141. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second());
  25142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  25143. return smalltalk.withContext(function($ctx2) {
  25144. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  25145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  25146. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},smalltalk.IRInliningJSTranslator)})},
  25147. args: ["anIRInlinedIfTrueIfFalse"],
  25148. 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 ]",
  25149. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
  25150. referencedClasses: []
  25151. }),
  25152. smalltalk.IRInliningJSTranslator);
  25153. smalltalk.addMethod(
  25154. smalltalk.method({
  25155. selector: "visitIRInlinedNonLocalReturn:",
  25156. category: 'visiting',
  25157. fn: function (anIRInlinedReturn){
  25158. var self=this;
  25159. return smalltalk.withContext(function($ctx1) {
  25160. _st(self._stream())._nextPutStatementWith_((function(){
  25161. return smalltalk.withContext(function($ctx2) {
  25162. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  25163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  25164. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  25165. return smalltalk.withContext(function($ctx2) {
  25166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  25167. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  25168. args: ["anIRInlinedReturn"],
  25169. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  25170. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"],
  25171. referencedClasses: []
  25172. }),
  25173. smalltalk.IRInliningJSTranslator);
  25174. smalltalk.addMethod(
  25175. smalltalk.method({
  25176. selector: "visitIRInlinedReturn:",
  25177. category: 'visiting',
  25178. fn: function (anIRInlinedReturn){
  25179. var self=this;
  25180. return smalltalk.withContext(function($ctx1) {
  25181. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  25182. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  25183. args: ["anIRInlinedReturn"],
  25184. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  25185. messageSends: ["visit:", "last", "instructions"],
  25186. referencedClasses: []
  25187. }),
  25188. smalltalk.IRInliningJSTranslator);
  25189. smalltalk.addMethod(
  25190. smalltalk.method({
  25191. selector: "visitIRInlinedSequence:",
  25192. category: 'visiting',
  25193. fn: function (anIRInlinedSequence){
  25194. var self=this;
  25195. return smalltalk.withContext(function($ctx1) {
  25196. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  25197. return smalltalk.withContext(function($ctx2) {
  25198. return _st(self._stream())._nextPutStatementWith_((function(){
  25199. return smalltalk.withContext(function($ctx3) {
  25200. return self._visit_(each);
  25201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  25202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25203. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRInliningJSTranslator)})},
  25204. args: ["anIRInlinedSequence"],
  25205. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  25206. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"],
  25207. referencedClasses: []
  25208. }),
  25209. smalltalk.IRInliningJSTranslator);
  25210. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  25211. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  25212. smalltalk.addMethod(
  25213. smalltalk.method({
  25214. selector: "ifFalse:",
  25215. category: 'inlining',
  25216. fn: function (anIRInstruction){
  25217. var self=this;
  25218. function $IRInlinedIfFalse(){return smalltalk.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  25219. return smalltalk.withContext(function($ctx1) {
  25220. var $1;
  25221. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  25222. return $1;
  25223. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  25224. args: ["anIRInstruction"],
  25225. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  25226. messageSends: ["inlinedSend:with:", "new"],
  25227. referencedClasses: ["IRInlinedIfFalse"]
  25228. }),
  25229. smalltalk.IRSendInliner);
  25230. smalltalk.addMethod(
  25231. smalltalk.method({
  25232. selector: "ifFalse:ifTrue:",
  25233. category: 'inlining',
  25234. fn: function (anIRInstruction,anotherIRInstruction){
  25235. var self=this;
  25236. return smalltalk.withContext(function($ctx1) {
  25237. var $1;
  25238. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  25239. return $1;
  25240. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  25241. args: ["anIRInstruction", "anotherIRInstruction"],
  25242. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  25243. messageSends: ["perform:withArguments:"],
  25244. referencedClasses: []
  25245. }),
  25246. smalltalk.IRSendInliner);
  25247. smalltalk.addMethod(
  25248. smalltalk.method({
  25249. selector: "ifNil:",
  25250. category: 'inlining',
  25251. fn: function (anIRInstruction){
  25252. var self=this;
  25253. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  25254. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  25255. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  25256. return smalltalk.withContext(function($ctx1) {
  25257. var $2,$3,$4,$5,$1;
  25258. $2=_st($IRClosure())._new();
  25259. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  25260. $3=_st($IRBlockSequence())._new();
  25261. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  25262. $4=_st($3)._yourself();
  25263. _st($2)._add_($4);
  25264. $5=_st($2)._yourself();
  25265. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,$5);
  25266. return $1;
  25267. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  25268. args: ["anIRInstruction"],
  25269. 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)",
  25270. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  25271. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  25272. }),
  25273. smalltalk.IRSendInliner);
  25274. smalltalk.addMethod(
  25275. smalltalk.method({
  25276. selector: "ifNil:ifNotNil:",
  25277. category: 'inlining',
  25278. fn: function (anIRInstruction,anotherIRInstruction){
  25279. var self=this;
  25280. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  25281. return smalltalk.withContext(function($ctx1) {
  25282. var $1;
  25283. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  25284. return $1;
  25285. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  25286. args: ["anIRInstruction", "anotherIRInstruction"],
  25287. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  25288. messageSends: ["inlinedSend:with:with:", "new"],
  25289. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  25290. }),
  25291. smalltalk.IRSendInliner);
  25292. smalltalk.addMethod(
  25293. smalltalk.method({
  25294. selector: "ifNotNil:",
  25295. category: 'inlining',
  25296. fn: function (anIRInstruction){
  25297. var self=this;
  25298. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  25299. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  25300. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  25301. return smalltalk.withContext(function($ctx1) {
  25302. var $2,$3,$4,$5,$1;
  25303. $2=_st($IRClosure())._new();
  25304. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  25305. $3=_st($IRBlockSequence())._new();
  25306. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  25307. $4=_st($3)._yourself();
  25308. _st($2)._add_($4);
  25309. $5=_st($2)._yourself();
  25310. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),$5,anIRInstruction);
  25311. return $1;
  25312. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  25313. args: ["anIRInstruction"],
  25314. 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",
  25315. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  25316. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  25317. }),
  25318. smalltalk.IRSendInliner);
  25319. smalltalk.addMethod(
  25320. smalltalk.method({
  25321. selector: "ifNotNil:ifNil:",
  25322. category: 'inlining',
  25323. fn: function (anIRInstruction,anotherIRInstruction){
  25324. var self=this;
  25325. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  25326. return smalltalk.withContext(function($ctx1) {
  25327. var $1;
  25328. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  25329. return $1;
  25330. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  25331. args: ["anIRInstruction", "anotherIRInstruction"],
  25332. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  25333. messageSends: ["inlinedSend:with:with:", "new"],
  25334. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  25335. }),
  25336. smalltalk.IRSendInliner);
  25337. smalltalk.addMethod(
  25338. smalltalk.method({
  25339. selector: "ifTrue:",
  25340. category: 'inlining',
  25341. fn: function (anIRInstruction){
  25342. var self=this;
  25343. function $IRInlinedIfTrue(){return smalltalk.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  25344. return smalltalk.withContext(function($ctx1) {
  25345. var $1;
  25346. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  25347. return $1;
  25348. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  25349. args: ["anIRInstruction"],
  25350. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  25351. messageSends: ["inlinedSend:with:", "new"],
  25352. referencedClasses: ["IRInlinedIfTrue"]
  25353. }),
  25354. smalltalk.IRSendInliner);
  25355. smalltalk.addMethod(
  25356. smalltalk.method({
  25357. selector: "ifTrue:ifFalse:",
  25358. category: 'inlining',
  25359. fn: function (anIRInstruction,anotherIRInstruction){
  25360. var self=this;
  25361. function $IRInlinedIfTrueIfFalse(){return smalltalk.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  25362. return smalltalk.withContext(function($ctx1) {
  25363. var $1;
  25364. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  25365. return $1;
  25366. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  25367. args: ["anIRInstruction", "anotherIRInstruction"],
  25368. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  25369. messageSends: ["inlinedSend:with:with:", "new"],
  25370. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  25371. }),
  25372. smalltalk.IRSendInliner);
  25373. smalltalk.addMethod(
  25374. smalltalk.method({
  25375. selector: "inlineClosure:",
  25376. category: 'inlining',
  25377. fn: function (anIRClosure){
  25378. var self=this;
  25379. var inlinedClosure,sequence,statements;
  25380. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  25381. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  25382. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  25383. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  25384. return smalltalk.withContext(function($ctx1) {
  25385. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  25386. inlinedClosure=self._inlinedClosure();
  25387. _st(inlinedClosure)._scope_(_st(anIRClosure)._scope());
  25388. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  25389. return smalltalk.withContext(function($ctx2) {
  25390. return _st(inlinedClosure)._add_(each);
  25391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25392. sequence=self._inlinedSequence();
  25393. _st(_st(anIRClosure)._arguments())._do_((function(each){
  25394. return smalltalk.withContext(function($ctx2) {
  25395. $1=_st($IRTempDeclaration())._new();
  25396. _st($1)._name_(each);
  25397. $2=_st($1)._yourself();
  25398. _st(inlinedClosure)._add_($2);
  25399. $3=_st($IRAssignment())._new();
  25400. $4=_st($AliasVar())._new();
  25401. _st($4)._scope_(_st(inlinedClosure)._scope());
  25402. _st($4)._name_(each);
  25403. $5=_st($4)._yourself();
  25404. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($5));
  25405. $6=_st($AliasVar())._new();
  25406. _st($6)._scope_(_st(inlinedClosure)._scope());
  25407. _st($6)._name_("$receiver");
  25408. $7=_st($6)._yourself();
  25409. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($7));
  25410. $8=_st($3)._yourself();
  25411. return _st(sequence)._add_($8);
  25412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  25413. _st(inlinedClosure)._add_(sequence);
  25414. statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions();
  25415. _st(statements)._ifNotEmpty_((function(){
  25416. return smalltalk.withContext(function($ctx2) {
  25417. _st(_st(statements)._allButLast())._do_((function(each){
  25418. return smalltalk.withContext(function($ctx3) {
  25419. return _st(sequence)._add_(each);
  25420. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
  25421. $9=_st(_st(_st(statements)._last())._isReturn())._and_((function(){
  25422. return smalltalk.withContext(function($ctx3) {
  25423. return _st(_st(statements)._last())._isBlockReturn();
  25424. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  25425. if(smalltalk.assert($9)){
  25426. return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first());
  25427. } else {
  25428. return _st(sequence)._add_(_st(statements)._last());
  25429. };
  25430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  25431. $10=inlinedClosure;
  25432. return $10;
  25433. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},smalltalk.IRSendInliner)})},
  25434. args: ["anIRClosure"],
  25435. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure scope: anIRClosure scope.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  25436. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"],
  25437. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"]
  25438. }),
  25439. smalltalk.IRSendInliner);
  25440. smalltalk.addMethod(
  25441. smalltalk.method({
  25442. selector: "inlineSend:",
  25443. category: 'inlining',
  25444. fn: function (anIRSend){
  25445. var self=this;
  25446. return smalltalk.withContext(function($ctx1) {
  25447. var $1;
  25448. self._send_(anIRSend);
  25449. $1=self._perform_withArguments_(_st(self._send())._selector(),_st(_st(self._send())._instructions())._allButFirst());
  25450. return $1;
  25451. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  25452. args: ["anIRSend"],
  25453. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  25454. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  25455. referencedClasses: []
  25456. }),
  25457. smalltalk.IRSendInliner);
  25458. smalltalk.addMethod(
  25459. smalltalk.method({
  25460. selector: "inlinedClosure",
  25461. category: 'factory',
  25462. fn: function (){
  25463. var self=this;
  25464. function $IRInlinedClosure(){return smalltalk.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  25465. return smalltalk.withContext(function($ctx1) {
  25466. var $1;
  25467. $1=_st($IRInlinedClosure())._new();
  25468. return $1;
  25469. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},smalltalk.IRSendInliner)})},
  25470. args: [],
  25471. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  25472. messageSends: ["new"],
  25473. referencedClasses: ["IRInlinedClosure"]
  25474. }),
  25475. smalltalk.IRSendInliner);
  25476. smalltalk.addMethod(
  25477. smalltalk.method({
  25478. selector: "inlinedSend:with:",
  25479. category: 'inlining',
  25480. fn: function (inlinedSend,anIRInstruction){
  25481. var self=this;
  25482. var inlinedClosure;
  25483. return smalltalk.withContext(function($ctx1) {
  25484. var $1,$2,$3,$4,$5;
  25485. $1=_st(anIRInstruction)._isClosure();
  25486. if(! smalltalk.assert($1)){
  25487. self._inliningError_("Message argument should be a block");
  25488. };
  25489. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  25490. if(! smalltalk.assert($2)){
  25491. self._inliningError_("Inlined block should have zero argument");
  25492. };
  25493. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  25494. $3=inlinedSend;
  25495. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  25496. $4=_st($3)._add_(inlinedClosure);
  25497. _st(self._send())._replaceWith_(inlinedSend);
  25498. $5=inlinedSend;
  25499. return $5;
  25500. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},smalltalk.IRSendInliner)})},
  25501. args: ["inlinedSend", "anIRInstruction"],
  25502. 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",
  25503. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
  25504. referencedClasses: []
  25505. }),
  25506. smalltalk.IRSendInliner);
  25507. smalltalk.addMethod(
  25508. smalltalk.method({
  25509. selector: "inlinedSend:with:with:",
  25510. category: 'inlining',
  25511. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  25512. var self=this;
  25513. var inlinedClosure1,inlinedClosure2;
  25514. return smalltalk.withContext(function($ctx1) {
  25515. var $1,$2,$3,$4,$5;
  25516. $1=_st(anIRInstruction)._isClosure();
  25517. if(! smalltalk.assert($1)){
  25518. self._inliningError_("Message argument should be a block");
  25519. };
  25520. $2=_st(anotherIRInstruction)._isClosure();
  25521. if(! smalltalk.assert($2)){
  25522. self._inliningError_("Message argument should be a block");
  25523. };
  25524. inlinedClosure1=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  25525. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  25526. $3=inlinedSend;
  25527. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  25528. _st($3)._add_(inlinedClosure1);
  25529. $4=_st($3)._add_(inlinedClosure2);
  25530. _st(self._send())._replaceWith_(inlinedSend);
  25531. $5=inlinedSend;
  25532. return $5;
  25533. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},smalltalk.IRSendInliner)})},
  25534. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  25535. source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09^ inlinedSend",
  25536. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
  25537. referencedClasses: []
  25538. }),
  25539. smalltalk.IRSendInliner);
  25540. smalltalk.addMethod(
  25541. smalltalk.method({
  25542. selector: "inlinedSequence",
  25543. category: 'factory',
  25544. fn: function (){
  25545. var self=this;
  25546. function $IRInlinedSequence(){return smalltalk.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  25547. return smalltalk.withContext(function($ctx1) {
  25548. var $1;
  25549. $1=_st($IRInlinedSequence())._new();
  25550. return $1;
  25551. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},smalltalk.IRSendInliner)})},
  25552. args: [],
  25553. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  25554. messageSends: ["new"],
  25555. referencedClasses: ["IRInlinedSequence"]
  25556. }),
  25557. smalltalk.IRSendInliner);
  25558. smalltalk.addMethod(
  25559. smalltalk.method({
  25560. selector: "inliningError:",
  25561. category: 'error handling',
  25562. fn: function (aString){
  25563. var self=this;
  25564. function $InliningError(){return smalltalk.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  25565. return smalltalk.withContext(function($ctx1) {
  25566. _st($InliningError())._signal_(aString);
  25567. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},smalltalk.IRSendInliner)})},
  25568. args: ["aString"],
  25569. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  25570. messageSends: ["signal:"],
  25571. referencedClasses: ["InliningError"]
  25572. }),
  25573. smalltalk.IRSendInliner);
  25574. smalltalk.addMethod(
  25575. smalltalk.method({
  25576. selector: "send",
  25577. category: 'accessing',
  25578. fn: function (){
  25579. var self=this;
  25580. return smalltalk.withContext(function($ctx1) {
  25581. var $1;
  25582. $1=self["@send"];
  25583. return $1;
  25584. }, function($ctx1) {$ctx1.fill(self,"send",{},smalltalk.IRSendInliner)})},
  25585. args: [],
  25586. source: "send\x0a\x09^ send",
  25587. messageSends: [],
  25588. referencedClasses: []
  25589. }),
  25590. smalltalk.IRSendInliner);
  25591. smalltalk.addMethod(
  25592. smalltalk.method({
  25593. selector: "send:",
  25594. category: 'accessing',
  25595. fn: function (anIRSend){
  25596. var self=this;
  25597. return smalltalk.withContext(function($ctx1) {
  25598. self["@send"]=anIRSend;
  25599. return self}, function($ctx1) {$ctx1.fill(self,"send:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  25600. args: ["anIRSend"],
  25601. source: "send: anIRSend\x0a\x09send := anIRSend",
  25602. messageSends: [],
  25603. referencedClasses: []
  25604. }),
  25605. smalltalk.IRSendInliner);
  25606. smalltalk.addMethod(
  25607. smalltalk.method({
  25608. selector: "translator",
  25609. category: 'accessing',
  25610. fn: function (){
  25611. var self=this;
  25612. return smalltalk.withContext(function($ctx1) {
  25613. var $1;
  25614. $1=self["@translator"];
  25615. return $1;
  25616. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.IRSendInliner)})},
  25617. args: [],
  25618. source: "translator\x0a\x09^ translator",
  25619. messageSends: [],
  25620. referencedClasses: []
  25621. }),
  25622. smalltalk.IRSendInliner);
  25623. smalltalk.addMethod(
  25624. smalltalk.method({
  25625. selector: "translator:",
  25626. category: 'accessing',
  25627. fn: function (anASTTranslator){
  25628. var self=this;
  25629. return smalltalk.withContext(function($ctx1) {
  25630. self["@translator"]=anASTTranslator;
  25631. return self}, function($ctx1) {$ctx1.fill(self,"translator:",{anASTTranslator:anASTTranslator},smalltalk.IRSendInliner)})},
  25632. args: ["anASTTranslator"],
  25633. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  25634. messageSends: [],
  25635. referencedClasses: []
  25636. }),
  25637. smalltalk.IRSendInliner);
  25638. smalltalk.addMethod(
  25639. smalltalk.method({
  25640. selector: "inlinedSelectors",
  25641. category: 'accessing',
  25642. fn: function (){
  25643. var self=this;
  25644. return smalltalk.withContext(function($ctx1) {
  25645. var $1;
  25646. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  25647. return $1;
  25648. }, function($ctx1) {$ctx1.fill(self,"inlinedSelectors",{},smalltalk.IRSendInliner.klass)})},
  25649. args: [],
  25650. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  25651. messageSends: [],
  25652. referencedClasses: []
  25653. }),
  25654. smalltalk.IRSendInliner.klass);
  25655. smalltalk.addMethod(
  25656. smalltalk.method({
  25657. selector: "shouldInline:",
  25658. category: 'accessing',
  25659. fn: function (anIRInstruction){
  25660. var self=this;
  25661. return smalltalk.withContext(function($ctx1) {
  25662. var $1,$2;
  25663. var $early={};
  25664. try {
  25665. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  25666. if(! smalltalk.assert($1)){
  25667. return false;
  25668. };
  25669. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  25670. return smalltalk.withContext(function($ctx2) {
  25671. $2=_st(each)._isClosure();
  25672. if(! smalltalk.assert($2)){
  25673. throw $early=[false];
  25674. };
  25675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  25676. return true;
  25677. }
  25678. catch(e) {if(e===$early)return e[0]; throw e}
  25679. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner.klass)})},
  25680. args: ["anIRInstruction"],
  25681. 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",
  25682. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"],
  25683. referencedClasses: []
  25684. }),
  25685. smalltalk.IRSendInliner.klass);
  25686. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  25687. 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};";
  25688. smalltalk.addMethod(
  25689. smalltalk.method({
  25690. selector: "assignment",
  25691. category: 'accessing',
  25692. fn: function (){
  25693. var self=this;
  25694. return smalltalk.withContext(function($ctx1) {
  25695. var $1;
  25696. $1=self["@assignment"];
  25697. return $1;
  25698. }, function($ctx1) {$ctx1.fill(self,"assignment",{},smalltalk.IRAssignmentInliner)})},
  25699. args: [],
  25700. source: "assignment\x0a\x09^ assignment",
  25701. messageSends: [],
  25702. referencedClasses: []
  25703. }),
  25704. smalltalk.IRAssignmentInliner);
  25705. smalltalk.addMethod(
  25706. smalltalk.method({
  25707. selector: "assignment:",
  25708. category: 'accessing',
  25709. fn: function (aNode){
  25710. var self=this;
  25711. return smalltalk.withContext(function($ctx1) {
  25712. self["@assignment"]=aNode;
  25713. return self}, function($ctx1) {$ctx1.fill(self,"assignment:",{aNode:aNode},smalltalk.IRAssignmentInliner)})},
  25714. args: ["aNode"],
  25715. source: "assignment: aNode\x0a\x09assignment := aNode",
  25716. messageSends: [],
  25717. referencedClasses: []
  25718. }),
  25719. smalltalk.IRAssignmentInliner);
  25720. smalltalk.addMethod(
  25721. smalltalk.method({
  25722. selector: "inlineAssignment:",
  25723. category: 'inlining',
  25724. fn: function (anIRAssignment){
  25725. var self=this;
  25726. var inlinedAssignment;
  25727. function $IRInlinedAssignment(){return smalltalk.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  25728. return smalltalk.withContext(function($ctx1) {
  25729. var $1;
  25730. self._assignment_(anIRAssignment);
  25731. inlinedAssignment=_st($IRInlinedAssignment())._new();
  25732. _st(_st(anIRAssignment)._instructions())._do_((function(each){
  25733. return smalltalk.withContext(function($ctx2) {
  25734. return _st(inlinedAssignment)._add_(each);
  25735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25736. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  25737. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  25738. $1=inlinedAssignment;
  25739. return $1;
  25740. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},smalltalk.IRAssignmentInliner)})},
  25741. args: ["anIRAssignment"],
  25742. 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",
  25743. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  25744. referencedClasses: ["IRInlinedAssignment"]
  25745. }),
  25746. smalltalk.IRAssignmentInliner);
  25747. smalltalk.addMethod(
  25748. smalltalk.method({
  25749. selector: "inlineClosure:",
  25750. category: 'inlining',
  25751. fn: function (anIRClosure){
  25752. var self=this;
  25753. var inlinedClosure,statements;
  25754. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  25755. return smalltalk.withContext(function($ctx1) {
  25756. var $1,$2,$3,$4;
  25757. inlinedClosure=smalltalk.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  25758. statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions();
  25759. _st(statements)._ifNotEmpty_((function(){
  25760. return smalltalk.withContext(function($ctx2) {
  25761. $1=_st(_st(statements)._last())._canBeAssigned();
  25762. if(smalltalk.assert($1)){
  25763. $2=_st($IRAssignment())._new();
  25764. _st($2)._add_(_st(_st(self._assignment())._instructions())._first());
  25765. _st($2)._add_(_st(_st(statements)._last())._copy());
  25766. $3=_st($2)._yourself();
  25767. return _st(_st(statements)._last())._replaceWith_($3);
  25768. };
  25769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  25770. $4=inlinedClosure;
  25771. return $4;
  25772. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},smalltalk.IRAssignmentInliner)})},
  25773. args: ["anIRClosure"],
  25774. 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",
  25775. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"],
  25776. referencedClasses: ["IRAssignment"]
  25777. }),
  25778. smalltalk.IRAssignmentInliner);
  25779. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  25780. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  25781. smalltalk.addMethod(
  25782. smalltalk.method({
  25783. selector: "inlineClosure:",
  25784. category: 'inlining',
  25785. fn: function (anIRClosure){
  25786. var self=this;
  25787. var closure,statements;
  25788. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  25789. return smalltalk.withContext(function($ctx1) {
  25790. var $1,$2,$3,$4;
  25791. closure=smalltalk.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  25792. statements=_st(_st(_st(closure)._instructions())._last())._instructions();
  25793. _st(statements)._ifNotEmpty_((function(){
  25794. return smalltalk.withContext(function($ctx2) {
  25795. $1=_st(_st(statements)._last())._isReturn();
  25796. if(! smalltalk.assert($1)){
  25797. $2=_st($IRReturn())._new();
  25798. _st($2)._add_(_st(_st(statements)._last())._copy());
  25799. $3=_st($2)._yourself();
  25800. return _st(_st(statements)._last())._replaceWith_($3);
  25801. };
  25802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  25803. $4=closure;
  25804. return $4;
  25805. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},smalltalk.IRReturnInliner)})},
  25806. args: ["anIRClosure"],
  25807. 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",
  25808. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"],
  25809. referencedClasses: ["IRReturn"]
  25810. }),
  25811. smalltalk.IRReturnInliner);
  25812. smalltalk.addMethod(
  25813. smalltalk.method({
  25814. selector: "inlineReturn:",
  25815. category: 'inlining',
  25816. fn: function (anIRReturn){
  25817. var self=this;
  25818. var return_;
  25819. return smalltalk.withContext(function($ctx1) {
  25820. var $1;
  25821. return_=self._inlinedReturn();
  25822. _st(_st(anIRReturn)._instructions())._do_((function(each){
  25823. return smalltalk.withContext(function($ctx2) {
  25824. return _st(return_)._add_(each);
  25825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25826. _st(anIRReturn)._replaceWith_(return_);
  25827. self._inlineSend_(_st(_st(return_)._instructions())._last());
  25828. $1=return_;
  25829. return $1;
  25830. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},smalltalk.IRReturnInliner)})},
  25831. args: ["anIRReturn"],
  25832. 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",
  25833. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  25834. referencedClasses: []
  25835. }),
  25836. smalltalk.IRReturnInliner);
  25837. smalltalk.addMethod(
  25838. smalltalk.method({
  25839. selector: "inlinedReturn",
  25840. category: 'factory',
  25841. fn: function (){
  25842. var self=this;
  25843. function $IRInlinedReturn(){return smalltalk.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  25844. return smalltalk.withContext(function($ctx1) {
  25845. var $1;
  25846. $1=_st($IRInlinedReturn())._new();
  25847. return $1;
  25848. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},smalltalk.IRReturnInliner)})},
  25849. args: [],
  25850. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  25851. messageSends: ["new"],
  25852. referencedClasses: ["IRInlinedReturn"]
  25853. }),
  25854. smalltalk.IRReturnInliner);
  25855. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  25856. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  25857. smalltalk.addMethod(
  25858. smalltalk.method({
  25859. selector: "compileNode:",
  25860. category: 'compiling',
  25861. fn: function (aNode){
  25862. var self=this;
  25863. var ir,stream;
  25864. return smalltalk.withContext(function($ctx1) {
  25865. var $2,$3,$1;
  25866. _st(self._semanticAnalyzer())._visit_(aNode);
  25867. ir=_st(self._translator())._visit_(aNode);
  25868. _st(self._inliner())._visit_(ir);
  25869. $2=self._irTranslator();
  25870. _st($2)._currentClass_(self._currentClass());
  25871. _st($2)._visit_(ir);
  25872. $3=_st($2)._contents();
  25873. $1=$3;
  25874. return $1;
  25875. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.InliningCodeGenerator)})},
  25876. args: ["aNode"],
  25877. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  25878. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"],
  25879. referencedClasses: []
  25880. }),
  25881. smalltalk.InliningCodeGenerator);
  25882. smalltalk.addMethod(
  25883. smalltalk.method({
  25884. selector: "inliner",
  25885. category: 'compiling',
  25886. fn: function (){
  25887. var self=this;
  25888. function $IRInliner(){return smalltalk.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  25889. return smalltalk.withContext(function($ctx1) {
  25890. var $1;
  25891. $1=_st($IRInliner())._new();
  25892. return $1;
  25893. }, function($ctx1) {$ctx1.fill(self,"inliner",{},smalltalk.InliningCodeGenerator)})},
  25894. args: [],
  25895. source: "inliner\x0a\x09^ IRInliner new",
  25896. messageSends: ["new"],
  25897. referencedClasses: ["IRInliner"]
  25898. }),
  25899. smalltalk.InliningCodeGenerator);
  25900. smalltalk.addMethod(
  25901. smalltalk.method({
  25902. selector: "irTranslator",
  25903. category: 'compiling',
  25904. fn: function (){
  25905. var self=this;
  25906. function $IRInliningJSTranslator(){return smalltalk.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  25907. return smalltalk.withContext(function($ctx1) {
  25908. var $1;
  25909. $1=_st($IRInliningJSTranslator())._new();
  25910. return $1;
  25911. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.InliningCodeGenerator)})},
  25912. args: [],
  25913. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  25914. messageSends: ["new"],
  25915. referencedClasses: ["IRInliningJSTranslator"]
  25916. }),
  25917. smalltalk.InliningCodeGenerator);
  25918. });
  25919. define("amber_core/Compiler-Semantic", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  25920. smalltalk.addPackage('Compiler-Semantic');
  25921. smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25922. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  25923. 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.";
  25924. smalltalk.addMethod(
  25925. smalltalk.method({
  25926. selector: "addArg:",
  25927. category: 'adding',
  25928. fn: function (aString){
  25929. var self=this;
  25930. function $ArgVar(){return smalltalk.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  25931. return smalltalk.withContext(function($ctx1) {
  25932. _st(self._args())._at_put_(aString,_st($ArgVar())._on_(aString));
  25933. _st(_st(self._args())._at_(aString))._scope_(self);
  25934. return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},smalltalk.LexicalScope)})},
  25935. args: ["aString"],
  25936. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  25937. messageSends: ["at:put:", "args", "on:", "scope:", "at:"],
  25938. referencedClasses: ["ArgVar"]
  25939. }),
  25940. smalltalk.LexicalScope);
  25941. smalltalk.addMethod(
  25942. smalltalk.method({
  25943. selector: "addTemp:",
  25944. category: 'adding',
  25945. fn: function (aString){
  25946. var self=this;
  25947. function $TempVar(){return smalltalk.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  25948. return smalltalk.withContext(function($ctx1) {
  25949. _st(self._temps())._at_put_(aString,_st($TempVar())._on_(aString));
  25950. _st(_st(self._temps())._at_(aString))._scope_(self);
  25951. return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},smalltalk.LexicalScope)})},
  25952. args: ["aString"],
  25953. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  25954. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"],
  25955. referencedClasses: ["TempVar"]
  25956. }),
  25957. smalltalk.LexicalScope);
  25958. smalltalk.addMethod(
  25959. smalltalk.method({
  25960. selector: "alias",
  25961. category: 'accessing',
  25962. fn: function (){
  25963. var self=this;
  25964. return smalltalk.withContext(function($ctx1) {
  25965. var $1;
  25966. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  25967. return $1;
  25968. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.LexicalScope)})},
  25969. args: [],
  25970. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  25971. messageSends: [",", "asString", "scopeLevel"],
  25972. referencedClasses: []
  25973. }),
  25974. smalltalk.LexicalScope);
  25975. smalltalk.addMethod(
  25976. smalltalk.method({
  25977. selector: "allVariableNames",
  25978. category: 'accessing',
  25979. fn: function (){
  25980. var self=this;
  25981. return smalltalk.withContext(function($ctx1) {
  25982. var $1;
  25983. $1=_st(_st(self._args())._keys()).__comma(_st(self._temps())._keys());
  25984. return $1;
  25985. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.LexicalScope)})},
  25986. args: [],
  25987. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  25988. messageSends: [",", "keys", "args", "temps"],
  25989. referencedClasses: []
  25990. }),
  25991. smalltalk.LexicalScope);
  25992. smalltalk.addMethod(
  25993. smalltalk.method({
  25994. selector: "args",
  25995. category: 'accessing',
  25996. fn: function (){
  25997. var self=this;
  25998. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  25999. return smalltalk.withContext(function($ctx1) {
  26000. var $2,$1;
  26001. $2=self["@args"];
  26002. if(($receiver = $2) == nil || $receiver == null){
  26003. self["@args"]=_st($Dictionary())._new();
  26004. $1=self["@args"];
  26005. } else {
  26006. $1=$2;
  26007. };
  26008. return $1;
  26009. }, function($ctx1) {$ctx1.fill(self,"args",{},smalltalk.LexicalScope)})},
  26010. args: [],
  26011. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  26012. messageSends: ["ifNil:", "new"],
  26013. referencedClasses: ["Dictionary"]
  26014. }),
  26015. smalltalk.LexicalScope);
  26016. smalltalk.addMethod(
  26017. smalltalk.method({
  26018. selector: "bindingFor:",
  26019. category: 'accessing',
  26020. fn: function (aStringOrNode){
  26021. var self=this;
  26022. return smalltalk.withContext(function($ctx1) {
  26023. var $1;
  26024. $1=_st(self._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  26025. return smalltalk.withContext(function($ctx2) {
  26026. return _st(self._args())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  26027. return smalltalk.withContext(function($ctx3) {
  26028. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  26029. return smalltalk.withContext(function($ctx4) {
  26030. return nil;
  26031. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
  26032. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  26033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26034. return $1;
  26035. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},smalltalk.LexicalScope)})},
  26036. args: ["aStringOrNode"],
  26037. 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 ]]]",
  26038. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"],
  26039. referencedClasses: []
  26040. }),
  26041. smalltalk.LexicalScope);
  26042. smalltalk.addMethod(
  26043. smalltalk.method({
  26044. selector: "blockIndex",
  26045. category: 'accessing',
  26046. fn: function (){
  26047. var self=this;
  26048. return smalltalk.withContext(function($ctx1) {
  26049. var $2,$1;
  26050. $2=self["@blockIndex"];
  26051. if(($receiver = $2) == nil || $receiver == null){
  26052. $1=(0);
  26053. } else {
  26054. $1=$2;
  26055. };
  26056. return $1;
  26057. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},smalltalk.LexicalScope)})},
  26058. args: [],
  26059. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  26060. messageSends: ["ifNil:"],
  26061. referencedClasses: []
  26062. }),
  26063. smalltalk.LexicalScope);
  26064. smalltalk.addMethod(
  26065. smalltalk.method({
  26066. selector: "blockIndex:",
  26067. category: 'accessing',
  26068. fn: function (anInteger){
  26069. var self=this;
  26070. return smalltalk.withContext(function($ctx1) {
  26071. self["@blockIndex"]=anInteger;
  26072. return self}, function($ctx1) {$ctx1.fill(self,"blockIndex:",{anInteger:anInteger},smalltalk.LexicalScope)})},
  26073. args: ["anInteger"],
  26074. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  26075. messageSends: [],
  26076. referencedClasses: []
  26077. }),
  26078. smalltalk.LexicalScope);
  26079. smalltalk.addMethod(
  26080. smalltalk.method({
  26081. selector: "canInlineNonLocalReturns",
  26082. category: 'testing',
  26083. fn: function (){
  26084. var self=this;
  26085. return smalltalk.withContext(function($ctx1) {
  26086. var $1;
  26087. $1=_st(self._isInlined())._and_((function(){
  26088. return smalltalk.withContext(function($ctx2) {
  26089. return _st(self._outerScope())._canInlineNonLocalReturns();
  26090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26091. return $1;
  26092. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.LexicalScope)})},
  26093. args: [],
  26094. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  26095. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"],
  26096. referencedClasses: []
  26097. }),
  26098. smalltalk.LexicalScope);
  26099. smalltalk.addMethod(
  26100. smalltalk.method({
  26101. selector: "instruction",
  26102. category: 'accessing',
  26103. fn: function (){
  26104. var self=this;
  26105. return smalltalk.withContext(function($ctx1) {
  26106. var $1;
  26107. $1=self["@instruction"];
  26108. return $1;
  26109. }, function($ctx1) {$ctx1.fill(self,"instruction",{},smalltalk.LexicalScope)})},
  26110. args: [],
  26111. source: "instruction\x0a\x09^ instruction",
  26112. messageSends: [],
  26113. referencedClasses: []
  26114. }),
  26115. smalltalk.LexicalScope);
  26116. smalltalk.addMethod(
  26117. smalltalk.method({
  26118. selector: "instruction:",
  26119. category: 'accessing',
  26120. fn: function (anIRInstruction){
  26121. var self=this;
  26122. return smalltalk.withContext(function($ctx1) {
  26123. self["@instruction"]=anIRInstruction;
  26124. return self}, function($ctx1) {$ctx1.fill(self,"instruction:",{anIRInstruction:anIRInstruction},smalltalk.LexicalScope)})},
  26125. args: ["anIRInstruction"],
  26126. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  26127. messageSends: [],
  26128. referencedClasses: []
  26129. }),
  26130. smalltalk.LexicalScope);
  26131. smalltalk.addMethod(
  26132. smalltalk.method({
  26133. selector: "isBlockScope",
  26134. category: 'testing',
  26135. fn: function (){
  26136. var self=this;
  26137. return smalltalk.withContext(function($ctx1) {
  26138. var $1;
  26139. $1=_st(self._isMethodScope())._not();
  26140. return $1;
  26141. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},smalltalk.LexicalScope)})},
  26142. args: [],
  26143. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  26144. messageSends: ["not", "isMethodScope"],
  26145. referencedClasses: []
  26146. }),
  26147. smalltalk.LexicalScope);
  26148. smalltalk.addMethod(
  26149. smalltalk.method({
  26150. selector: "isInlined",
  26151. category: 'testing',
  26152. fn: function (){
  26153. var self=this;
  26154. return smalltalk.withContext(function($ctx1) {
  26155. var $1;
  26156. $1=_st(_st(self._instruction())._notNil())._and_((function(){
  26157. return smalltalk.withContext(function($ctx2) {
  26158. return _st(self._instruction())._isInlined();
  26159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26160. return $1;
  26161. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.LexicalScope)})},
  26162. args: [],
  26163. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  26164. messageSends: ["and:", "notNil", "instruction", "isInlined"],
  26165. referencedClasses: []
  26166. }),
  26167. smalltalk.LexicalScope);
  26168. smalltalk.addMethod(
  26169. smalltalk.method({
  26170. selector: "isMethodScope",
  26171. category: 'testing',
  26172. fn: function (){
  26173. var self=this;
  26174. return smalltalk.withContext(function($ctx1) {
  26175. return false;
  26176. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.LexicalScope)})},
  26177. args: [],
  26178. source: "isMethodScope\x0a\x09^ false",
  26179. messageSends: [],
  26180. referencedClasses: []
  26181. }),
  26182. smalltalk.LexicalScope);
  26183. smalltalk.addMethod(
  26184. smalltalk.method({
  26185. selector: "lookupVariable:",
  26186. category: 'accessing',
  26187. fn: function (aNode){
  26188. var self=this;
  26189. var lookup;
  26190. return smalltalk.withContext(function($ctx1) {
  26191. var $1,$2,$3;
  26192. lookup=self._bindingFor_(aNode);
  26193. $1=lookup;
  26194. if(($receiver = $1) == nil || $receiver == null){
  26195. $2=self._outerScope();
  26196. if(($receiver = $2) == nil || $receiver == null){
  26197. lookup=$2;
  26198. } else {
  26199. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  26200. };
  26201. lookup;
  26202. } else {
  26203. $1;
  26204. };
  26205. $3=lookup;
  26206. return $3;
  26207. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},smalltalk.LexicalScope)})},
  26208. args: ["aNode"],
  26209. 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",
  26210. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"],
  26211. referencedClasses: []
  26212. }),
  26213. smalltalk.LexicalScope);
  26214. smalltalk.addMethod(
  26215. smalltalk.method({
  26216. selector: "methodScope",
  26217. category: 'accessing',
  26218. fn: function (){
  26219. var self=this;
  26220. return smalltalk.withContext(function($ctx1) {
  26221. var $2,$1;
  26222. $2=self._outerScope();
  26223. if(($receiver = $2) == nil || $receiver == null){
  26224. $1=$2;
  26225. } else {
  26226. $1=_st(self._outerScope())._methodScope();
  26227. };
  26228. return $1;
  26229. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.LexicalScope)})},
  26230. args: [],
  26231. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  26232. messageSends: ["ifNotNil:", "outerScope", "methodScope"],
  26233. referencedClasses: []
  26234. }),
  26235. smalltalk.LexicalScope);
  26236. smalltalk.addMethod(
  26237. smalltalk.method({
  26238. selector: "node",
  26239. category: 'accessing',
  26240. fn: function (){
  26241. var self=this;
  26242. return smalltalk.withContext(function($ctx1) {
  26243. var $1;
  26244. $1=self["@node"];
  26245. return $1;
  26246. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.LexicalScope)})},
  26247. args: [],
  26248. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  26249. messageSends: [],
  26250. referencedClasses: []
  26251. }),
  26252. smalltalk.LexicalScope);
  26253. smalltalk.addMethod(
  26254. smalltalk.method({
  26255. selector: "node:",
  26256. category: 'accessing',
  26257. fn: function (aNode){
  26258. var self=this;
  26259. return smalltalk.withContext(function($ctx1) {
  26260. self["@node"]=aNode;
  26261. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.LexicalScope)})},
  26262. args: ["aNode"],
  26263. source: "node: aNode\x0a\x09node := aNode",
  26264. messageSends: [],
  26265. referencedClasses: []
  26266. }),
  26267. smalltalk.LexicalScope);
  26268. smalltalk.addMethod(
  26269. smalltalk.method({
  26270. selector: "outerScope",
  26271. category: 'accessing',
  26272. fn: function (){
  26273. var self=this;
  26274. return smalltalk.withContext(function($ctx1) {
  26275. var $1;
  26276. $1=self["@outerScope"];
  26277. return $1;
  26278. }, function($ctx1) {$ctx1.fill(self,"outerScope",{},smalltalk.LexicalScope)})},
  26279. args: [],
  26280. source: "outerScope\x0a\x09^ outerScope",
  26281. messageSends: [],
  26282. referencedClasses: []
  26283. }),
  26284. smalltalk.LexicalScope);
  26285. smalltalk.addMethod(
  26286. smalltalk.method({
  26287. selector: "outerScope:",
  26288. category: 'accessing',
  26289. fn: function (aLexicalScope){
  26290. var self=this;
  26291. return smalltalk.withContext(function($ctx1) {
  26292. self["@outerScope"]=aLexicalScope;
  26293. return self}, function($ctx1) {$ctx1.fill(self,"outerScope:",{aLexicalScope:aLexicalScope},smalltalk.LexicalScope)})},
  26294. args: ["aLexicalScope"],
  26295. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  26296. messageSends: [],
  26297. referencedClasses: []
  26298. }),
  26299. smalltalk.LexicalScope);
  26300. smalltalk.addMethod(
  26301. smalltalk.method({
  26302. selector: "pseudoVars",
  26303. category: 'accessing',
  26304. fn: function (){
  26305. var self=this;
  26306. return smalltalk.withContext(function($ctx1) {
  26307. var $1;
  26308. $1=_st(self._methodScope())._pseudoVars();
  26309. return $1;
  26310. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.LexicalScope)})},
  26311. args: [],
  26312. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  26313. messageSends: ["pseudoVars", "methodScope"],
  26314. referencedClasses: []
  26315. }),
  26316. smalltalk.LexicalScope);
  26317. smalltalk.addMethod(
  26318. smalltalk.method({
  26319. selector: "scopeLevel",
  26320. category: 'accessing',
  26321. fn: function (){
  26322. var self=this;
  26323. return smalltalk.withContext(function($ctx1) {
  26324. var $1,$2,$3,$4;
  26325. $1=self._outerScope();
  26326. if(($receiver = $1) == nil || $receiver == null){
  26327. return (1);
  26328. } else {
  26329. $1;
  26330. };
  26331. $2=self._isInlined();
  26332. if(smalltalk.assert($2)){
  26333. $3=_st(self._outerScope())._scopeLevel();
  26334. return $3;
  26335. };
  26336. $4=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  26337. return $4;
  26338. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},smalltalk.LexicalScope)})},
  26339. args: [],
  26340. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  26341. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"],
  26342. referencedClasses: []
  26343. }),
  26344. smalltalk.LexicalScope);
  26345. smalltalk.addMethod(
  26346. smalltalk.method({
  26347. selector: "temps",
  26348. category: 'accessing',
  26349. fn: function (){
  26350. var self=this;
  26351. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26352. return smalltalk.withContext(function($ctx1) {
  26353. var $2,$1;
  26354. $2=self["@temps"];
  26355. if(($receiver = $2) == nil || $receiver == null){
  26356. self["@temps"]=_st($Dictionary())._new();
  26357. $1=self["@temps"];
  26358. } else {
  26359. $1=$2;
  26360. };
  26361. return $1;
  26362. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.LexicalScope)})},
  26363. args: [],
  26364. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  26365. messageSends: ["ifNil:", "new"],
  26366. referencedClasses: ["Dictionary"]
  26367. }),
  26368. smalltalk.LexicalScope);
  26369. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  26370. smalltalk.MethodLexicalScope.comment="I represent a method scope.";
  26371. smalltalk.addMethod(
  26372. smalltalk.method({
  26373. selector: "addIVar:",
  26374. category: 'adding',
  26375. fn: function (aString){
  26376. var self=this;
  26377. function $InstanceVar(){return smalltalk.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  26378. return smalltalk.withContext(function($ctx1) {
  26379. _st(self._iVars())._at_put_(aString,_st($InstanceVar())._on_(aString));
  26380. _st(_st(self._iVars())._at_(aString))._scope_(self);
  26381. return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},smalltalk.MethodLexicalScope)})},
  26382. args: ["aString"],
  26383. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  26384. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"],
  26385. referencedClasses: ["InstanceVar"]
  26386. }),
  26387. smalltalk.MethodLexicalScope);
  26388. smalltalk.addMethod(
  26389. smalltalk.method({
  26390. selector: "addNonLocalReturn:",
  26391. category: 'adding',
  26392. fn: function (aScope){
  26393. var self=this;
  26394. return smalltalk.withContext(function($ctx1) {
  26395. _st(self._nonLocalReturns())._add_(aScope);
  26396. return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  26397. args: ["aScope"],
  26398. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  26399. messageSends: ["add:", "nonLocalReturns"],
  26400. referencedClasses: []
  26401. }),
  26402. smalltalk.MethodLexicalScope);
  26403. smalltalk.addMethod(
  26404. smalltalk.method({
  26405. selector: "allVariableNames",
  26406. category: 'accessing',
  26407. fn: function (){
  26408. var self=this;
  26409. return smalltalk.withContext(function($ctx1) {
  26410. var $1;
  26411. $1=_st(smalltalk.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(self._iVars())._keys());
  26412. return $1;
  26413. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.MethodLexicalScope)})},
  26414. args: [],
  26415. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  26416. messageSends: [",", "allVariableNames", "keys", "iVars"],
  26417. referencedClasses: []
  26418. }),
  26419. smalltalk.MethodLexicalScope);
  26420. smalltalk.addMethod(
  26421. smalltalk.method({
  26422. selector: "bindingFor:",
  26423. category: 'accessing',
  26424. fn: function (aNode){
  26425. var self=this;
  26426. return smalltalk.withContext(function($ctx1) {
  26427. var $2,$1;
  26428. $2=smalltalk.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
  26429. if(($receiver = $2) == nil || $receiver == null){
  26430. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  26431. return smalltalk.withContext(function($ctx2) {
  26432. return nil;
  26433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  26434. } else {
  26435. $1=$2;
  26436. };
  26437. return $1;
  26438. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},smalltalk.MethodLexicalScope)})},
  26439. args: ["aNode"],
  26440. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  26441. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"],
  26442. referencedClasses: []
  26443. }),
  26444. smalltalk.MethodLexicalScope);
  26445. smalltalk.addMethod(
  26446. smalltalk.method({
  26447. selector: "canInlineNonLocalReturns",
  26448. category: 'testing',
  26449. fn: function (){
  26450. var self=this;
  26451. return smalltalk.withContext(function($ctx1) {
  26452. return true;
  26453. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  26454. args: [],
  26455. source: "canInlineNonLocalReturns\x0a\x09^ true",
  26456. messageSends: [],
  26457. referencedClasses: []
  26458. }),
  26459. smalltalk.MethodLexicalScope);
  26460. smalltalk.addMethod(
  26461. smalltalk.method({
  26462. selector: "hasLocalReturn",
  26463. category: 'testing',
  26464. fn: function (){
  26465. var self=this;
  26466. return smalltalk.withContext(function($ctx1) {
  26467. var $1;
  26468. $1=self._localReturn();
  26469. return $1;
  26470. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},smalltalk.MethodLexicalScope)})},
  26471. args: [],
  26472. source: "hasLocalReturn\x0a\x09^ self localReturn",
  26473. messageSends: ["localReturn"],
  26474. referencedClasses: []
  26475. }),
  26476. smalltalk.MethodLexicalScope);
  26477. smalltalk.addMethod(
  26478. smalltalk.method({
  26479. selector: "hasNonLocalReturn",
  26480. category: 'testing',
  26481. fn: function (){
  26482. var self=this;
  26483. return smalltalk.withContext(function($ctx1) {
  26484. var $1;
  26485. $1=_st(self._nonLocalReturns())._notEmpty();
  26486. return $1;
  26487. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},smalltalk.MethodLexicalScope)})},
  26488. args: [],
  26489. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  26490. messageSends: ["notEmpty", "nonLocalReturns"],
  26491. referencedClasses: []
  26492. }),
  26493. smalltalk.MethodLexicalScope);
  26494. smalltalk.addMethod(
  26495. smalltalk.method({
  26496. selector: "iVars",
  26497. category: 'accessing',
  26498. fn: function (){
  26499. var self=this;
  26500. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26501. return smalltalk.withContext(function($ctx1) {
  26502. var $2,$1;
  26503. $2=self["@iVars"];
  26504. if(($receiver = $2) == nil || $receiver == null){
  26505. self["@iVars"]=_st($Dictionary())._new();
  26506. $1=self["@iVars"];
  26507. } else {
  26508. $1=$2;
  26509. };
  26510. return $1;
  26511. }, function($ctx1) {$ctx1.fill(self,"iVars",{},smalltalk.MethodLexicalScope)})},
  26512. args: [],
  26513. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  26514. messageSends: ["ifNil:", "new"],
  26515. referencedClasses: ["Dictionary"]
  26516. }),
  26517. smalltalk.MethodLexicalScope);
  26518. smalltalk.addMethod(
  26519. smalltalk.method({
  26520. selector: "isMethodScope",
  26521. category: 'testing',
  26522. fn: function (){
  26523. var self=this;
  26524. return smalltalk.withContext(function($ctx1) {
  26525. return true;
  26526. }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.MethodLexicalScope)})},
  26527. args: [],
  26528. source: "isMethodScope\x0a\x09^ true",
  26529. messageSends: [],
  26530. referencedClasses: []
  26531. }),
  26532. smalltalk.MethodLexicalScope);
  26533. smalltalk.addMethod(
  26534. smalltalk.method({
  26535. selector: "localReturn",
  26536. category: 'accessing',
  26537. fn: function (){
  26538. var self=this;
  26539. return smalltalk.withContext(function($ctx1) {
  26540. var $2,$1;
  26541. $2=self["@localReturn"];
  26542. if(($receiver = $2) == nil || $receiver == null){
  26543. $1=false;
  26544. } else {
  26545. $1=$2;
  26546. };
  26547. return $1;
  26548. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},smalltalk.MethodLexicalScope)})},
  26549. args: [],
  26550. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  26551. messageSends: ["ifNil:"],
  26552. referencedClasses: []
  26553. }),
  26554. smalltalk.MethodLexicalScope);
  26555. smalltalk.addMethod(
  26556. smalltalk.method({
  26557. selector: "localReturn:",
  26558. category: 'accessing',
  26559. fn: function (aBoolean){
  26560. var self=this;
  26561. return smalltalk.withContext(function($ctx1) {
  26562. self["@localReturn"]=aBoolean;
  26563. return self}, function($ctx1) {$ctx1.fill(self,"localReturn:",{aBoolean:aBoolean},smalltalk.MethodLexicalScope)})},
  26564. args: ["aBoolean"],
  26565. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  26566. messageSends: [],
  26567. referencedClasses: []
  26568. }),
  26569. smalltalk.MethodLexicalScope);
  26570. smalltalk.addMethod(
  26571. smalltalk.method({
  26572. selector: "methodScope",
  26573. category: 'accessing',
  26574. fn: function (){
  26575. var self=this;
  26576. return smalltalk.withContext(function($ctx1) {
  26577. var $1;
  26578. $1=self;
  26579. return $1;
  26580. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.MethodLexicalScope)})},
  26581. args: [],
  26582. source: "methodScope\x0a\x09^ self",
  26583. messageSends: [],
  26584. referencedClasses: []
  26585. }),
  26586. smalltalk.MethodLexicalScope);
  26587. smalltalk.addMethod(
  26588. smalltalk.method({
  26589. selector: "nonLocalReturns",
  26590. category: 'accessing',
  26591. fn: function (){
  26592. var self=this;
  26593. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26594. return smalltalk.withContext(function($ctx1) {
  26595. var $2,$1;
  26596. $2=self["@nonLocalReturns"];
  26597. if(($receiver = $2) == nil || $receiver == null){
  26598. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  26599. $1=self["@nonLocalReturns"];
  26600. } else {
  26601. $1=$2;
  26602. };
  26603. return $1;
  26604. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},smalltalk.MethodLexicalScope)})},
  26605. args: [],
  26606. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  26607. messageSends: ["ifNil:", "new"],
  26608. referencedClasses: ["OrderedCollection"]
  26609. }),
  26610. smalltalk.MethodLexicalScope);
  26611. smalltalk.addMethod(
  26612. smalltalk.method({
  26613. selector: "pseudoVars",
  26614. category: 'accessing',
  26615. fn: function (){
  26616. var self=this;
  26617. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  26618. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26619. function $PseudoVar(){return smalltalk.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  26620. return smalltalk.withContext(function($ctx1) {
  26621. var $1,$2,$3,$4;
  26622. $1=self["@pseudoVars"];
  26623. if(($receiver = $1) == nil || $receiver == null){
  26624. self["@pseudoVars"]=_st($Dictionary())._new();
  26625. self["@pseudoVars"];
  26626. _st(_st(_st($Smalltalk())._current())._pseudoVariableNames())._do_((function(each){
  26627. return smalltalk.withContext(function($ctx2) {
  26628. $2=_st($PseudoVar())._on_(each);
  26629. _st($2)._scope_(self._methodScope());
  26630. $3=_st($2)._yourself();
  26631. return _st(self["@pseudoVars"])._at_put_(each,$3);
  26632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  26633. } else {
  26634. $1;
  26635. };
  26636. $4=self["@pseudoVars"];
  26637. return $4;
  26638. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.MethodLexicalScope)})},
  26639. args: [],
  26640. 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",
  26641. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "current", "at:put:", "scope:", "on:", "methodScope", "yourself"],
  26642. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"]
  26643. }),
  26644. smalltalk.MethodLexicalScope);
  26645. smalltalk.addMethod(
  26646. smalltalk.method({
  26647. selector: "removeNonLocalReturn:",
  26648. category: 'adding',
  26649. fn: function (aScope){
  26650. var self=this;
  26651. return smalltalk.withContext(function($ctx1) {
  26652. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  26653. return smalltalk.withContext(function($ctx2) {
  26654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26655. return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
  26656. args: ["aScope"],
  26657. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  26658. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  26659. referencedClasses: []
  26660. }),
  26661. smalltalk.MethodLexicalScope);
  26662. smalltalk.addMethod(
  26663. smalltalk.method({
  26664. selector: "unknownVariables",
  26665. category: 'accessing',
  26666. fn: function (){
  26667. var self=this;
  26668. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26669. return smalltalk.withContext(function($ctx1) {
  26670. var $2,$1;
  26671. $2=self["@unknownVariables"];
  26672. if(($receiver = $2) == nil || $receiver == null){
  26673. self["@unknownVariables"]=_st($OrderedCollection())._new();
  26674. $1=self["@unknownVariables"];
  26675. } else {
  26676. $1=$2;
  26677. };
  26678. return $1;
  26679. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.MethodLexicalScope)})},
  26680. args: [],
  26681. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  26682. messageSends: ["ifNil:", "new"],
  26683. referencedClasses: ["OrderedCollection"]
  26684. }),
  26685. smalltalk.MethodLexicalScope);
  26686. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  26687. 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.";
  26688. smalltalk.addMethod(
  26689. smalltalk.method({
  26690. selector: "alias",
  26691. category: 'accessing',
  26692. fn: function (){
  26693. var self=this;
  26694. return smalltalk.withContext(function($ctx1) {
  26695. var $1;
  26696. $1=_st(self._name())._asVariableName();
  26697. return $1;
  26698. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ScopeVar)})},
  26699. args: [],
  26700. source: "alias\x0a\x09^ self name asVariableName",
  26701. messageSends: ["asVariableName", "name"],
  26702. referencedClasses: []
  26703. }),
  26704. smalltalk.ScopeVar);
  26705. smalltalk.addMethod(
  26706. smalltalk.method({
  26707. selector: "isArgVar",
  26708. category: 'testing',
  26709. fn: function (){
  26710. var self=this;
  26711. return smalltalk.withContext(function($ctx1) {
  26712. return false;
  26713. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ScopeVar)})},
  26714. args: [],
  26715. source: "isArgVar\x0a\x09^ false",
  26716. messageSends: [],
  26717. referencedClasses: []
  26718. }),
  26719. smalltalk.ScopeVar);
  26720. smalltalk.addMethod(
  26721. smalltalk.method({
  26722. selector: "isClassRefVar",
  26723. category: 'testing',
  26724. fn: function (){
  26725. var self=this;
  26726. return smalltalk.withContext(function($ctx1) {
  26727. return false;
  26728. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ScopeVar)})},
  26729. args: [],
  26730. source: "isClassRefVar\x0a\x09^ false",
  26731. messageSends: [],
  26732. referencedClasses: []
  26733. }),
  26734. smalltalk.ScopeVar);
  26735. smalltalk.addMethod(
  26736. smalltalk.method({
  26737. selector: "isInstanceVar",
  26738. category: 'testing',
  26739. fn: function (){
  26740. var self=this;
  26741. return smalltalk.withContext(function($ctx1) {
  26742. return false;
  26743. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.ScopeVar)})},
  26744. args: [],
  26745. source: "isInstanceVar\x0a\x09^ false",
  26746. messageSends: [],
  26747. referencedClasses: []
  26748. }),
  26749. smalltalk.ScopeVar);
  26750. smalltalk.addMethod(
  26751. smalltalk.method({
  26752. selector: "isPseudoVar",
  26753. category: 'testing',
  26754. fn: function (){
  26755. var self=this;
  26756. return smalltalk.withContext(function($ctx1) {
  26757. return false;
  26758. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.ScopeVar)})},
  26759. args: [],
  26760. source: "isPseudoVar\x0a\x09^ false",
  26761. messageSends: [],
  26762. referencedClasses: []
  26763. }),
  26764. smalltalk.ScopeVar);
  26765. smalltalk.addMethod(
  26766. smalltalk.method({
  26767. selector: "isTempVar",
  26768. category: 'testing',
  26769. fn: function (){
  26770. var self=this;
  26771. return smalltalk.withContext(function($ctx1) {
  26772. return false;
  26773. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.ScopeVar)})},
  26774. args: [],
  26775. source: "isTempVar\x0a\x09^ false",
  26776. messageSends: [],
  26777. referencedClasses: []
  26778. }),
  26779. smalltalk.ScopeVar);
  26780. smalltalk.addMethod(
  26781. smalltalk.method({
  26782. selector: "isUnknownVar",
  26783. category: 'testing',
  26784. fn: function (){
  26785. var self=this;
  26786. return smalltalk.withContext(function($ctx1) {
  26787. return false;
  26788. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.ScopeVar)})},
  26789. args: [],
  26790. source: "isUnknownVar\x0a\x09^ false",
  26791. messageSends: [],
  26792. referencedClasses: []
  26793. }),
  26794. smalltalk.ScopeVar);
  26795. smalltalk.addMethod(
  26796. smalltalk.method({
  26797. selector: "name",
  26798. category: 'accessing',
  26799. fn: function (){
  26800. var self=this;
  26801. return smalltalk.withContext(function($ctx1) {
  26802. var $1;
  26803. $1=self["@name"];
  26804. return $1;
  26805. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ScopeVar)})},
  26806. args: [],
  26807. source: "name\x0a\x09^ name",
  26808. messageSends: [],
  26809. referencedClasses: []
  26810. }),
  26811. smalltalk.ScopeVar);
  26812. smalltalk.addMethod(
  26813. smalltalk.method({
  26814. selector: "name:",
  26815. category: 'accessing',
  26816. fn: function (aString){
  26817. var self=this;
  26818. return smalltalk.withContext(function($ctx1) {
  26819. self["@name"]=aString;
  26820. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ScopeVar)})},
  26821. args: ["aString"],
  26822. source: "name: aString\x0a\x09name := aString",
  26823. messageSends: [],
  26824. referencedClasses: []
  26825. }),
  26826. smalltalk.ScopeVar);
  26827. smalltalk.addMethod(
  26828. smalltalk.method({
  26829. selector: "scope",
  26830. category: 'accessing',
  26831. fn: function (){
  26832. var self=this;
  26833. return smalltalk.withContext(function($ctx1) {
  26834. var $1;
  26835. $1=self["@scope"];
  26836. return $1;
  26837. }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ScopeVar)})},
  26838. args: [],
  26839. source: "scope\x0a\x09^ scope",
  26840. messageSends: [],
  26841. referencedClasses: []
  26842. }),
  26843. smalltalk.ScopeVar);
  26844. smalltalk.addMethod(
  26845. smalltalk.method({
  26846. selector: "scope:",
  26847. category: 'accessing',
  26848. fn: function (aScope){
  26849. var self=this;
  26850. return smalltalk.withContext(function($ctx1) {
  26851. self["@scope"]=aScope;
  26852. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.ScopeVar)})},
  26853. args: ["aScope"],
  26854. source: "scope: aScope\x0a\x09scope := aScope",
  26855. messageSends: [],
  26856. referencedClasses: []
  26857. }),
  26858. smalltalk.ScopeVar);
  26859. smalltalk.addMethod(
  26860. smalltalk.method({
  26861. selector: "validateAssignment",
  26862. category: 'testing',
  26863. fn: function (){
  26864. var self=this;
  26865. function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  26866. return smalltalk.withContext(function($ctx1) {
  26867. var $1,$2,$3;
  26868. $1=_st(self._isArgVar())._or_((function(){
  26869. return smalltalk.withContext(function($ctx2) {
  26870. return self._isPseudoVar();
  26871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  26872. if(smalltalk.assert($1)){
  26873. $2=_st($InvalidAssignmentError())._new();
  26874. _st($2)._variableName_(self._name());
  26875. $3=_st($2)._signal();
  26876. $3;
  26877. };
  26878. return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},smalltalk.ScopeVar)})},
  26879. args: [],
  26880. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  26881. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"],
  26882. referencedClasses: ["InvalidAssignmentError"]
  26883. }),
  26884. smalltalk.ScopeVar);
  26885. smalltalk.addMethod(
  26886. smalltalk.method({
  26887. selector: "on:",
  26888. category: 'instance creation',
  26889. fn: function (aString){
  26890. var self=this;
  26891. return smalltalk.withContext(function($ctx1) {
  26892. var $2,$3,$1;
  26893. $2=self._new();
  26894. _st($2)._name_(aString);
  26895. $3=_st($2)._yourself();
  26896. $1=$3;
  26897. return $1;
  26898. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},smalltalk.ScopeVar.klass)})},
  26899. args: ["aString"],
  26900. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  26901. messageSends: ["name:", "new", "yourself"],
  26902. referencedClasses: []
  26903. }),
  26904. smalltalk.ScopeVar.klass);
  26905. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  26906. smalltalk.AliasVar.comment="I am an internally defined variable by the compiler";
  26907. smalltalk.addMethod(
  26908. smalltalk.method({
  26909. selector: "node",
  26910. category: 'accessing',
  26911. fn: function (){
  26912. var self=this;
  26913. return smalltalk.withContext(function($ctx1) {
  26914. var $1;
  26915. $1=self["@node"];
  26916. return $1;
  26917. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.AliasVar)})},
  26918. args: [],
  26919. source: "node\x0a\x09^ node",
  26920. messageSends: [],
  26921. referencedClasses: []
  26922. }),
  26923. smalltalk.AliasVar);
  26924. smalltalk.addMethod(
  26925. smalltalk.method({
  26926. selector: "node:",
  26927. category: 'accessing',
  26928. fn: function (aNode){
  26929. var self=this;
  26930. return smalltalk.withContext(function($ctx1) {
  26931. self["@node"]=aNode;
  26932. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.AliasVar)})},
  26933. args: ["aNode"],
  26934. source: "node: aNode\x0a\x09node := aNode",
  26935. messageSends: [],
  26936. referencedClasses: []
  26937. }),
  26938. smalltalk.AliasVar);
  26939. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  26940. smalltalk.ArgVar.comment="I am an argument of a method or block.";
  26941. smalltalk.addMethod(
  26942. smalltalk.method({
  26943. selector: "isArgVar",
  26944. category: 'testing',
  26945. fn: function (){
  26946. var self=this;
  26947. return smalltalk.withContext(function($ctx1) {
  26948. return true;
  26949. }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ArgVar)})},
  26950. args: [],
  26951. source: "isArgVar\x0a\x09^ true",
  26952. messageSends: [],
  26953. referencedClasses: []
  26954. }),
  26955. smalltalk.ArgVar);
  26956. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  26957. smalltalk.ClassRefVar.comment="I am an class reference variable";
  26958. smalltalk.addMethod(
  26959. smalltalk.method({
  26960. selector: "alias",
  26961. category: 'accessing',
  26962. fn: function (){
  26963. var self=this;
  26964. return smalltalk.withContext(function($ctx1) {
  26965. var $1;
  26966. $1=_st("$".__comma(self._name())).__comma("()");
  26967. return $1;
  26968. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ClassRefVar)})},
  26969. args: [],
  26970. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
  26971. messageSends: [",", "name"],
  26972. referencedClasses: []
  26973. }),
  26974. smalltalk.ClassRefVar);
  26975. smalltalk.addMethod(
  26976. smalltalk.method({
  26977. selector: "isClassRefVar",
  26978. category: 'testing',
  26979. fn: function (){
  26980. var self=this;
  26981. return smalltalk.withContext(function($ctx1) {
  26982. return true;
  26983. }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ClassRefVar)})},
  26984. args: [],
  26985. source: "isClassRefVar\x0a\x09^ true",
  26986. messageSends: [],
  26987. referencedClasses: []
  26988. }),
  26989. smalltalk.ClassRefVar);
  26990. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  26991. smalltalk.InstanceVar.comment="I am an instance variable of a method or block.";
  26992. smalltalk.addMethod(
  26993. smalltalk.method({
  26994. selector: "alias",
  26995. category: 'testing',
  26996. fn: function (){
  26997. var self=this;
  26998. return smalltalk.withContext(function($ctx1) {
  26999. var $1;
  27000. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  27001. return $1;
  27002. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.InstanceVar)})},
  27003. args: [],
  27004. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  27005. messageSends: [",", "name"],
  27006. referencedClasses: []
  27007. }),
  27008. smalltalk.InstanceVar);
  27009. smalltalk.addMethod(
  27010. smalltalk.method({
  27011. selector: "isInstanceVar",
  27012. category: 'testing',
  27013. fn: function (){
  27014. var self=this;
  27015. return smalltalk.withContext(function($ctx1) {
  27016. return true;
  27017. }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.InstanceVar)})},
  27018. args: [],
  27019. source: "isInstanceVar\x0a\x09^ true",
  27020. messageSends: [],
  27021. referencedClasses: []
  27022. }),
  27023. smalltalk.InstanceVar);
  27024. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  27025. smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  27026. smalltalk.addMethod(
  27027. smalltalk.method({
  27028. selector: "alias",
  27029. category: 'accessing',
  27030. fn: function (){
  27031. var self=this;
  27032. return smalltalk.withContext(function($ctx1) {
  27033. var $1;
  27034. $1=self._name();
  27035. return $1;
  27036. }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.PseudoVar)})},
  27037. args: [],
  27038. source: "alias\x0a\x09^ self name",
  27039. messageSends: ["name"],
  27040. referencedClasses: []
  27041. }),
  27042. smalltalk.PseudoVar);
  27043. smalltalk.addMethod(
  27044. smalltalk.method({
  27045. selector: "isPseudoVar",
  27046. category: 'testing',
  27047. fn: function (){
  27048. var self=this;
  27049. return smalltalk.withContext(function($ctx1) {
  27050. return true;
  27051. }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.PseudoVar)})},
  27052. args: [],
  27053. source: "isPseudoVar\x0a\x09^ true",
  27054. messageSends: [],
  27055. referencedClasses: []
  27056. }),
  27057. smalltalk.PseudoVar);
  27058. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  27059. smalltalk.TempVar.comment="I am an temporary variable of a method or block.";
  27060. smalltalk.addMethod(
  27061. smalltalk.method({
  27062. selector: "isTempVar",
  27063. category: 'testing',
  27064. fn: function (){
  27065. var self=this;
  27066. return smalltalk.withContext(function($ctx1) {
  27067. return true;
  27068. }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.TempVar)})},
  27069. args: [],
  27070. source: "isTempVar\x0a\x09^ true",
  27071. messageSends: [],
  27072. referencedClasses: []
  27073. }),
  27074. smalltalk.TempVar);
  27075. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  27076. smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  27077. smalltalk.addMethod(
  27078. smalltalk.method({
  27079. selector: "isUnknownVar",
  27080. category: 'testing',
  27081. fn: function (){
  27082. var self=this;
  27083. return smalltalk.withContext(function($ctx1) {
  27084. return true;
  27085. }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.UnknownVar)})},
  27086. args: [],
  27087. source: "isUnknownVar\x0a\x09^ true",
  27088. messageSends: [],
  27089. referencedClasses: []
  27090. }),
  27091. smalltalk.UnknownVar);
  27092. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  27093. smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  27094. smalltalk.addMethod(
  27095. smalltalk.method({
  27096. selector: "classReferences",
  27097. category: 'accessing',
  27098. fn: function (){
  27099. var self=this;
  27100. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  27101. return smalltalk.withContext(function($ctx1) {
  27102. var $2,$1;
  27103. $2=self["@classReferences"];
  27104. if(($receiver = $2) == nil || $receiver == null){
  27105. self["@classReferences"]=_st($Set())._new();
  27106. $1=self["@classReferences"];
  27107. } else {
  27108. $1=$2;
  27109. };
  27110. return $1;
  27111. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.SemanticAnalyzer)})},
  27112. args: [],
  27113. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  27114. messageSends: ["ifNil:", "new"],
  27115. referencedClasses: ["Set"]
  27116. }),
  27117. smalltalk.SemanticAnalyzer);
  27118. smalltalk.addMethod(
  27119. smalltalk.method({
  27120. selector: "errorShadowingVariable:",
  27121. category: 'error handling',
  27122. fn: function (aString){
  27123. var self=this;
  27124. function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  27125. return smalltalk.withContext(function($ctx1) {
  27126. var $1,$2;
  27127. $1=_st($ShadowingVariableError())._new();
  27128. _st($1)._variableName_(aString);
  27129. $2=_st($1)._signal();
  27130. return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  27131. args: ["aString"],
  27132. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  27133. messageSends: ["variableName:", "new", "signal"],
  27134. referencedClasses: ["ShadowingVariableError"]
  27135. }),
  27136. smalltalk.SemanticAnalyzer);
  27137. smalltalk.addMethod(
  27138. smalltalk.method({
  27139. selector: "errorUnknownVariable:",
  27140. category: 'error handling',
  27141. fn: function (aNode){
  27142. var self=this;
  27143. var identifier;
  27144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27145. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  27146. return smalltalk.withContext(function($ctx1) {
  27147. var $1,$2,$3;
  27148. identifier=_st(aNode)._value();
  27149. $1=_st(_st(_st(_st(_st($Smalltalk())._current())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  27150. return smalltalk.withContext(function($ctx2) {
  27151. return self._isVariableGloballyUndefined_(identifier);
  27152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27153. if(smalltalk.assert($1)){
  27154. $2=_st($UnknownVariableError())._new();
  27155. _st($2)._variableName_(_st(aNode)._value());
  27156. $3=_st($2)._signal();
  27157. $3;
  27158. } else {
  27159. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  27160. };
  27161. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
  27162. args: ["aNode"],
  27163. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk current globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  27164. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "current", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
  27165. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  27166. }),
  27167. smalltalk.SemanticAnalyzer);
  27168. smalltalk.addMethod(
  27169. smalltalk.method({
  27170. selector: "isVariableGloballyUndefined:",
  27171. category: 'testing',
  27172. fn: function (aString){
  27173. var self=this;
  27174. return smalltalk.withContext(function($ctx1) {
  27175. return eval('typeof ' + aString + ' == "undefined"');
  27176. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  27177. args: ["aString"],
  27178. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  27179. messageSends: [],
  27180. referencedClasses: []
  27181. }),
  27182. smalltalk.SemanticAnalyzer);
  27183. smalltalk.addMethod(
  27184. smalltalk.method({
  27185. selector: "messageSends",
  27186. category: 'accessing',
  27187. fn: function (){
  27188. var self=this;
  27189. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27190. return smalltalk.withContext(function($ctx1) {
  27191. var $2,$1;
  27192. $2=self["@messageSends"];
  27193. if(($receiver = $2) == nil || $receiver == null){
  27194. self["@messageSends"]=_st($Dictionary())._new();
  27195. $1=self["@messageSends"];
  27196. } else {
  27197. $1=$2;
  27198. };
  27199. return $1;
  27200. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.SemanticAnalyzer)})},
  27201. args: [],
  27202. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  27203. messageSends: ["ifNil:", "new"],
  27204. referencedClasses: ["Dictionary"]
  27205. }),
  27206. smalltalk.SemanticAnalyzer);
  27207. smalltalk.addMethod(
  27208. smalltalk.method({
  27209. selector: "newBlockScope",
  27210. category: 'factory',
  27211. fn: function (){
  27212. var self=this;
  27213. function $LexicalScope(){return smalltalk.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  27214. return smalltalk.withContext(function($ctx1) {
  27215. var $1;
  27216. $1=self._newScopeOfClass_($LexicalScope());
  27217. return $1;
  27218. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},smalltalk.SemanticAnalyzer)})},
  27219. args: [],
  27220. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  27221. messageSends: ["newScopeOfClass:"],
  27222. referencedClasses: ["LexicalScope"]
  27223. }),
  27224. smalltalk.SemanticAnalyzer);
  27225. smalltalk.addMethod(
  27226. smalltalk.method({
  27227. selector: "newMethodScope",
  27228. category: 'factory',
  27229. fn: function (){
  27230. var self=this;
  27231. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  27232. return smalltalk.withContext(function($ctx1) {
  27233. var $1;
  27234. $1=self._newScopeOfClass_($MethodLexicalScope());
  27235. return $1;
  27236. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},smalltalk.SemanticAnalyzer)})},
  27237. args: [],
  27238. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  27239. messageSends: ["newScopeOfClass:"],
  27240. referencedClasses: ["MethodLexicalScope"]
  27241. }),
  27242. smalltalk.SemanticAnalyzer);
  27243. smalltalk.addMethod(
  27244. smalltalk.method({
  27245. selector: "newScopeOfClass:",
  27246. category: 'factory',
  27247. fn: function (aLexicalScopeClass){
  27248. var self=this;
  27249. return smalltalk.withContext(function($ctx1) {
  27250. var $2,$3,$1;
  27251. $2=_st(aLexicalScopeClass)._new();
  27252. _st($2)._outerScope_(self["@currentScope"]);
  27253. $3=_st($2)._yourself();
  27254. $1=$3;
  27255. return $1;
  27256. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},smalltalk.SemanticAnalyzer)})},
  27257. args: ["aLexicalScopeClass"],
  27258. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  27259. messageSends: ["outerScope:", "new", "yourself"],
  27260. referencedClasses: []
  27261. }),
  27262. smalltalk.SemanticAnalyzer);
  27263. smalltalk.addMethod(
  27264. smalltalk.method({
  27265. selector: "nextBlockIndex",
  27266. category: 'private',
  27267. fn: function (){
  27268. var self=this;
  27269. return smalltalk.withContext(function($ctx1) {
  27270. var $1,$2;
  27271. $1=self["@blockIndex"];
  27272. if(($receiver = $1) == nil || $receiver == null){
  27273. self["@blockIndex"]=(0);
  27274. self["@blockIndex"];
  27275. } else {
  27276. $1;
  27277. };
  27278. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  27279. $2=self["@blockIndex"];
  27280. return $2;
  27281. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},smalltalk.SemanticAnalyzer)})},
  27282. args: [],
  27283. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  27284. messageSends: ["ifNil:", "+"],
  27285. referencedClasses: []
  27286. }),
  27287. smalltalk.SemanticAnalyzer);
  27288. smalltalk.addMethod(
  27289. smalltalk.method({
  27290. selector: "popScope",
  27291. category: 'scope',
  27292. fn: function (){
  27293. var self=this;
  27294. return smalltalk.withContext(function($ctx1) {
  27295. var $1;
  27296. $1=self["@currentScope"];
  27297. if(($receiver = $1) == nil || $receiver == null){
  27298. $1;
  27299. } else {
  27300. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  27301. self["@currentScope"];
  27302. };
  27303. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},smalltalk.SemanticAnalyzer)})},
  27304. args: [],
  27305. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  27306. messageSends: ["ifNotNil:", "outerScope"],
  27307. referencedClasses: []
  27308. }),
  27309. smalltalk.SemanticAnalyzer);
  27310. smalltalk.addMethod(
  27311. smalltalk.method({
  27312. selector: "pushScope:",
  27313. category: 'scope',
  27314. fn: function (aScope){
  27315. var self=this;
  27316. return smalltalk.withContext(function($ctx1) {
  27317. _st(aScope)._outerScope_(self["@currentScope"]);
  27318. self["@currentScope"]=aScope;
  27319. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},smalltalk.SemanticAnalyzer)})},
  27320. args: ["aScope"],
  27321. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  27322. messageSends: ["outerScope:"],
  27323. referencedClasses: []
  27324. }),
  27325. smalltalk.SemanticAnalyzer);
  27326. smalltalk.addMethod(
  27327. smalltalk.method({
  27328. selector: "superSends",
  27329. category: 'accessing',
  27330. fn: function (){
  27331. var self=this;
  27332. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27333. return smalltalk.withContext(function($ctx1) {
  27334. var $2,$1;
  27335. $2=self["@superSends"];
  27336. if(($receiver = $2) == nil || $receiver == null){
  27337. self["@superSends"]=_st($Dictionary())._new();
  27338. $1=self["@superSends"];
  27339. } else {
  27340. $1=$2;
  27341. };
  27342. return $1;
  27343. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.SemanticAnalyzer)})},
  27344. args: [],
  27345. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  27346. messageSends: ["ifNil:", "new"],
  27347. referencedClasses: ["Dictionary"]
  27348. }),
  27349. smalltalk.SemanticAnalyzer);
  27350. smalltalk.addMethod(
  27351. smalltalk.method({
  27352. selector: "theClass",
  27353. category: 'accessing',
  27354. fn: function (){
  27355. var self=this;
  27356. return smalltalk.withContext(function($ctx1) {
  27357. var $1;
  27358. $1=self["@theClass"];
  27359. return $1;
  27360. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SemanticAnalyzer)})},
  27361. args: [],
  27362. source: "theClass\x0a\x09^ theClass",
  27363. messageSends: [],
  27364. referencedClasses: []
  27365. }),
  27366. smalltalk.SemanticAnalyzer);
  27367. smalltalk.addMethod(
  27368. smalltalk.method({
  27369. selector: "theClass:",
  27370. category: 'accessing',
  27371. fn: function (aClass){
  27372. var self=this;
  27373. return smalltalk.withContext(function($ctx1) {
  27374. self["@theClass"]=aClass;
  27375. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SemanticAnalyzer)})},
  27376. args: ["aClass"],
  27377. source: "theClass: aClass\x0a\x09theClass := aClass",
  27378. messageSends: [],
  27379. referencedClasses: []
  27380. }),
  27381. smalltalk.SemanticAnalyzer);
  27382. smalltalk.addMethod(
  27383. smalltalk.method({
  27384. selector: "validateVariableScope:",
  27385. category: 'scope',
  27386. fn: function (aString){
  27387. var self=this;
  27388. return smalltalk.withContext(function($ctx1) {
  27389. var $1;
  27390. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  27391. if(($receiver = $1) == nil || $receiver == null){
  27392. $1;
  27393. } else {
  27394. self._errorShadowingVariable_(aString);
  27395. };
  27396. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  27397. args: ["aString"],
  27398. 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 ]",
  27399. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"],
  27400. referencedClasses: []
  27401. }),
  27402. smalltalk.SemanticAnalyzer);
  27403. smalltalk.addMethod(
  27404. smalltalk.method({
  27405. selector: "visitAssignmentNode:",
  27406. category: 'visiting',
  27407. fn: function (aNode){
  27408. var self=this;
  27409. return smalltalk.withContext(function($ctx1) {
  27410. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  27411. _st(_st(aNode)._left())._beAssigned();
  27412. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27413. args: ["aNode"],
  27414. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  27415. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  27416. referencedClasses: []
  27417. }),
  27418. smalltalk.SemanticAnalyzer);
  27419. smalltalk.addMethod(
  27420. smalltalk.method({
  27421. selector: "visitBlockNode:",
  27422. category: 'visiting',
  27423. fn: function (aNode){
  27424. var self=this;
  27425. return smalltalk.withContext(function($ctx1) {
  27426. self._pushScope_(self._newBlockScope());
  27427. _st(aNode)._scope_(self["@currentScope"]);
  27428. _st(self["@currentScope"])._node_(aNode);
  27429. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  27430. _st(_st(aNode)._parameters())._do_((function(each){
  27431. return smalltalk.withContext(function($ctx2) {
  27432. self._validateVariableScope_(each);
  27433. return _st(self["@currentScope"])._addArg_(each);
  27434. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27435. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  27436. self._popScope();
  27437. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27438. args: ["aNode"],
  27439. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  27440. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"],
  27441. referencedClasses: []
  27442. }),
  27443. smalltalk.SemanticAnalyzer);
  27444. smalltalk.addMethod(
  27445. smalltalk.method({
  27446. selector: "visitCascadeNode:",
  27447. category: 'visiting',
  27448. fn: function (aNode){
  27449. var self=this;
  27450. return smalltalk.withContext(function($ctx1) {
  27451. var $1;
  27452. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  27453. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  27454. if(smalltalk.assert($1)){
  27455. _st(_st(aNode)._nodes())._do_((function(each){
  27456. return smalltalk.withContext(function($ctx2) {
  27457. return _st(each)._superSend_(true);
  27458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  27459. };
  27460. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27461. args: ["aNode"],
  27462. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  27463. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"],
  27464. referencedClasses: []
  27465. }),
  27466. smalltalk.SemanticAnalyzer);
  27467. smalltalk.addMethod(
  27468. smalltalk.method({
  27469. selector: "visitMethodNode:",
  27470. category: 'visiting',
  27471. fn: function (aNode){
  27472. var self=this;
  27473. return smalltalk.withContext(function($ctx1) {
  27474. var $1,$2;
  27475. self._pushScope_(self._newMethodScope());
  27476. _st(aNode)._scope_(self["@currentScope"]);
  27477. _st(self["@currentScope"])._node_(aNode);
  27478. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  27479. return smalltalk.withContext(function($ctx2) {
  27480. return _st(self["@currentScope"])._addIVar_(each);
  27481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27482. _st(_st(aNode)._arguments())._do_((function(each){
  27483. return smalltalk.withContext(function($ctx2) {
  27484. self._validateVariableScope_(each);
  27485. return _st(self["@currentScope"])._addArg_(each);
  27486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  27487. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  27488. $1=aNode;
  27489. _st($1)._classReferences_(self._classReferences());
  27490. _st($1)._messageSends_(_st(self._messageSends())._keys());
  27491. $2=_st($1)._superSends_(_st(self._superSends())._keys());
  27492. self._popScope();
  27493. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27494. args: ["aNode"],
  27495. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends keys;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  27496. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"],
  27497. referencedClasses: []
  27498. }),
  27499. smalltalk.SemanticAnalyzer);
  27500. smalltalk.addMethod(
  27501. smalltalk.method({
  27502. selector: "visitReturnNode:",
  27503. category: 'visiting',
  27504. fn: function (aNode){
  27505. var self=this;
  27506. return smalltalk.withContext(function($ctx1) {
  27507. var $1;
  27508. _st(aNode)._scope_(self["@currentScope"]);
  27509. $1=_st(self["@currentScope"])._isMethodScope();
  27510. if(smalltalk.assert($1)){
  27511. _st(self["@currentScope"])._localReturn_(true);
  27512. } else {
  27513. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  27514. };
  27515. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  27516. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27517. args: ["aNode"],
  27518. 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",
  27519. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
  27520. referencedClasses: []
  27521. }),
  27522. smalltalk.SemanticAnalyzer);
  27523. smalltalk.addMethod(
  27524. smalltalk.method({
  27525. selector: "visitSendNode:",
  27526. category: 'visiting',
  27527. fn: function (aNode){
  27528. var self=this;
  27529. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  27530. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  27531. return smalltalk.withContext(function($ctx1) {
  27532. var $1,$2;
  27533. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  27534. if(smalltalk.assert($1)){
  27535. _st(aNode)._superSend_(true);
  27536. _st(_st(aNode)._receiver())._value_("self");
  27537. _st(self._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  27538. return smalltalk.withContext(function($ctx2) {
  27539. return _st($Set())._new();
  27540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27541. _st(_st(self._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  27542. } else {
  27543. $2=_st(_st($IRSendInliner())._inlinedSelectors())._includes_(_st(aNode)._selector());
  27544. if(smalltalk.assert($2)){
  27545. _st(aNode)._shouldBeInlined_(true);
  27546. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  27547. };
  27548. };
  27549. _st(self._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  27550. return smalltalk.withContext(function($ctx2) {
  27551. return _st($Set())._new();
  27552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  27553. _st(_st(self._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  27554. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  27555. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  27556. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27557. args: ["aNode"],
  27558. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver shouldBeAliased: true ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  27559. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"],
  27560. referencedClasses: ["Set", "IRSendInliner"]
  27561. }),
  27562. smalltalk.SemanticAnalyzer);
  27563. smalltalk.addMethod(
  27564. smalltalk.method({
  27565. selector: "visitSequenceNode:",
  27566. category: 'visiting',
  27567. fn: function (aNode){
  27568. var self=this;
  27569. return smalltalk.withContext(function($ctx1) {
  27570. _st(_st(aNode)._temps())._do_((function(each){
  27571. return smalltalk.withContext(function($ctx2) {
  27572. self._validateVariableScope_(each);
  27573. return _st(self["@currentScope"])._addTemp_(each);
  27574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27575. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  27576. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  27577. args: ["aNode"],
  27578. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  27579. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"],
  27580. referencedClasses: []
  27581. }),
  27582. smalltalk.SemanticAnalyzer);
  27583. smalltalk.addMethod(
  27584. smalltalk.method({
  27585. selector: "visitVariableNode:",
  27586. category: 'visiting',
  27587. fn: function (aNode){
  27588. var self=this;
  27589. var binding;
  27590. function $ClassRefVar(){return smalltalk.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  27591. function $UnknownVar(){return smalltalk.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  27592. return smalltalk.withContext(function($ctx1) {
  27593. var $1,$2,$3,$4,$5,$6;
  27594. binding=_st(self["@currentScope"])._lookupVariable_(aNode);
  27595. $1=binding;
  27596. if(($receiver = $1) == nil || $receiver == null){
  27597. $2=_st(_st(aNode)._value())._beginsWithCapital();
  27598. if(smalltalk.assert($2)){
  27599. $3=_st($ClassRefVar())._new();
  27600. _st($3)._name_(_st(aNode)._value());
  27601. $4=_st($3)._yourself();
  27602. binding=$4;
  27603. binding;
  27604. _st(self._classReferences())._add_(_st(aNode)._value());
  27605. } else {
  27606. self._errorUnknownVariable_(aNode);
  27607. $5=_st($UnknownVar())._new();
  27608. _st($5)._name_(_st(aNode)._value());
  27609. $6=_st($5)._yourself();
  27610. binding=$6;
  27611. binding;
  27612. };
  27613. } else {
  27614. $1;
  27615. };
  27616. _st(aNode)._binding_(binding);
  27617. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},smalltalk.SemanticAnalyzer)})},
  27618. args: ["aNode"],
  27619. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value beginsWithCapital\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  27620. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "beginsWithCapital", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"],
  27621. referencedClasses: ["ClassRefVar", "UnknownVar"]
  27622. }),
  27623. smalltalk.SemanticAnalyzer);
  27624. smalltalk.addMethod(
  27625. smalltalk.method({
  27626. selector: "on:",
  27627. category: 'instance creation',
  27628. fn: function (aClass){
  27629. var self=this;
  27630. return smalltalk.withContext(function($ctx1) {
  27631. var $2,$3,$1;
  27632. $2=self._new();
  27633. _st($2)._theClass_(aClass);
  27634. $3=_st($2)._yourself();
  27635. $1=$3;
  27636. return $1;
  27637. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},smalltalk.SemanticAnalyzer.klass)})},
  27638. args: ["aClass"],
  27639. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  27640. messageSends: ["theClass:", "new", "yourself"],
  27641. referencedClasses: []
  27642. }),
  27643. smalltalk.SemanticAnalyzer.klass);
  27644. smalltalk.addMethod(
  27645. smalltalk.method({
  27646. selector: "beginsWithCapital",
  27647. category: '*Compiler-Semantic',
  27648. fn: function (){
  27649. var self=this;
  27650. return smalltalk.withContext(function($ctx1) {
  27651. var $1;
  27652. $1=_st(_st(self._first())._asUppercase()).__eq_eq(self._first());
  27653. return $1;
  27654. }, function($ctx1) {$ctx1.fill(self,"beginsWithCapital",{},smalltalk.String)})},
  27655. args: [],
  27656. source: "beginsWithCapital\x0a\x09^ self first asUppercase == self first",
  27657. messageSends: ["==", "asUppercase", "first"],
  27658. referencedClasses: []
  27659. }),
  27660. smalltalk.String);
  27661. });
  27662. define("amber_core/Compiler-Interpreter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function(smalltalk,nil,_st){
  27663. smalltalk.addPackage('Compiler-Interpreter');
  27664. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27665. smalltalk.addClass('AIBlockClosure', smalltalk.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  27666. smalltalk.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  27667. smalltalk.addMethod(
  27668. smalltalk.method({
  27669. selector: "applyTo:arguments:",
  27670. category: 'evaluating',
  27671. fn: function (anObject,aCollection){
  27672. var self=this;
  27673. return smalltalk.withContext(function($ctx1) {
  27674. self._interpreterError();
  27675. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.AIBlockClosure)})},
  27676. args: ["anObject", "aCollection"],
  27677. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  27678. messageSends: ["interpreterError"],
  27679. referencedClasses: []
  27680. }),
  27681. smalltalk.AIBlockClosure);
  27682. smalltalk.addMethod(
  27683. smalltalk.method({
  27684. selector: "compiledSource",
  27685. category: 'accessing',
  27686. fn: function (){
  27687. var self=this;
  27688. return smalltalk.withContext(function($ctx1) {
  27689. return "[ AST Block closure ]";
  27690. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.AIBlockClosure)})},
  27691. args: [],
  27692. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  27693. messageSends: [],
  27694. referencedClasses: []
  27695. }),
  27696. smalltalk.AIBlockClosure);
  27697. smalltalk.addMethod(
  27698. smalltalk.method({
  27699. selector: "currySelf",
  27700. category: 'converting',
  27701. fn: function (){
  27702. var self=this;
  27703. return smalltalk.withContext(function($ctx1) {
  27704. self._interpreterError();
  27705. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.AIBlockClosure)})},
  27706. args: [],
  27707. source: "currySelf\x0a\x09self interpreterError",
  27708. messageSends: ["interpreterError"],
  27709. referencedClasses: []
  27710. }),
  27711. smalltalk.AIBlockClosure);
  27712. smalltalk.addMethod(
  27713. smalltalk.method({
  27714. selector: "initializeWithContext:node:",
  27715. category: 'initialization',
  27716. fn: function (aContext,aNode){
  27717. var self=this;
  27718. return smalltalk.withContext(function($ctx1) {
  27719. self["@node"]=aNode;
  27720. self["@outerContext"]=aContext;
  27721. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:node:",{aContext:aContext,aNode:aNode},smalltalk.AIBlockClosure)})},
  27722. args: ["aContext", "aNode"],
  27723. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  27724. messageSends: [],
  27725. referencedClasses: []
  27726. }),
  27727. smalltalk.AIBlockClosure);
  27728. smalltalk.addMethod(
  27729. smalltalk.method({
  27730. selector: "interpreterError",
  27731. category: 'error handling',
  27732. fn: function (){
  27733. var self=this;
  27734. function $ASTInterpreterError(){return smalltalk.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  27735. return smalltalk.withContext(function($ctx1) {
  27736. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  27737. return self}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},smalltalk.AIBlockClosure)})},
  27738. args: [],
  27739. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  27740. messageSends: ["signal:"],
  27741. referencedClasses: ["ASTInterpreterError"]
  27742. }),
  27743. smalltalk.AIBlockClosure);
  27744. smalltalk.addMethod(
  27745. smalltalk.method({
  27746. selector: "numArgs",
  27747. category: 'accessing',
  27748. fn: function (){
  27749. var self=this;
  27750. return smalltalk.withContext(function($ctx1) {
  27751. var $1;
  27752. $1=_st(_st(self["@node"])._temps())._size();
  27753. return $1;
  27754. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.AIBlockClosure)})},
  27755. args: [],
  27756. source: "numArgs\x0a\x09^ node temps size",
  27757. messageSends: ["size", "temps"],
  27758. referencedClasses: []
  27759. }),
  27760. smalltalk.AIBlockClosure);
  27761. smalltalk.addMethod(
  27762. smalltalk.method({
  27763. selector: "value",
  27764. category: 'evaluating',
  27765. fn: function (){
  27766. var self=this;
  27767. return smalltalk.withContext(function($ctx1) {
  27768. var $1;
  27769. $1=self._valueWithPossibleArguments_([]);
  27770. return $1;
  27771. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.AIBlockClosure)})},
  27772. args: [],
  27773. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  27774. messageSends: ["valueWithPossibleArguments:"],
  27775. referencedClasses: []
  27776. }),
  27777. smalltalk.AIBlockClosure);
  27778. smalltalk.addMethod(
  27779. smalltalk.method({
  27780. selector: "value:",
  27781. category: 'evaluating',
  27782. fn: function (anArgument){
  27783. var self=this;
  27784. return smalltalk.withContext(function($ctx1) {
  27785. var $1;
  27786. $1=self._valueWithPossibleArguments_([anArgument]);
  27787. return $1;
  27788. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},smalltalk.AIBlockClosure)})},
  27789. args: ["anArgument"],
  27790. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  27791. messageSends: ["valueWithPossibleArguments:"],
  27792. referencedClasses: []
  27793. }),
  27794. smalltalk.AIBlockClosure);
  27795. smalltalk.addMethod(
  27796. smalltalk.method({
  27797. selector: "value:value:",
  27798. category: 'evaluating',
  27799. fn: function (firstArgument,secondArgument){
  27800. var self=this;
  27801. return smalltalk.withContext(function($ctx1) {
  27802. var $1;
  27803. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  27804. return $1;
  27805. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.AIBlockClosure)})},
  27806. args: ["firstArgument", "secondArgument"],
  27807. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  27808. messageSends: ["valueWithPossibleArguments:"],
  27809. referencedClasses: []
  27810. }),
  27811. smalltalk.AIBlockClosure);
  27812. smalltalk.addMethod(
  27813. smalltalk.method({
  27814. selector: "value:value:value:",
  27815. category: 'evaluating',
  27816. fn: function (firstArgument,secondArgument,thirdArgument){
  27817. var self=this;
  27818. return smalltalk.withContext(function($ctx1) {
  27819. var $1;
  27820. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  27821. return $1;
  27822. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.AIBlockClosure)})},
  27823. args: ["firstArgument", "secondArgument", "thirdArgument"],
  27824. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  27825. messageSends: ["valueWithPossibleArguments:"],
  27826. referencedClasses: []
  27827. }),
  27828. smalltalk.AIBlockClosure);
  27829. smalltalk.addMethod(
  27830. smalltalk.method({
  27831. selector: "valueWithPossibleArguments:",
  27832. category: 'evaluating',
  27833. fn: function (aCollection){
  27834. var self=this;
  27835. var context,sequenceNode;
  27836. return smalltalk.withContext(function($ctx1) {
  27837. var $1,$2,$3,$4,$5;
  27838. context=_st(self["@outerContext"])._newBlockContext();
  27839. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  27840. _st($1)._parent_(nil);
  27841. $2=_st($1)._yourself();
  27842. sequenceNode=$2;
  27843. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  27844. return smalltalk.withContext(function($ctx2) {
  27845. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  27846. return smalltalk.withContext(function($ctx3) {
  27847. return nil;
  27848. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})));
  27849. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  27850. $3=_st(context)._interpreter();
  27851. _st($3)._node_(_st(sequenceNode)._nextChild());
  27852. $4=_st($3)._proceed();
  27853. _st(_st(self["@outerContext"])._interpreter())._setNonLocalReturnFromContext_(context);
  27854. $5=_st(_st(context)._interpreter())._pop();
  27855. return $5;
  27856. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},smalltalk.AIBlockClosure)})},
  27857. args: ["aCollection"],
  27858. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newBlockContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  27859. messageSends: ["newBlockContext", "parent:", "copy", "first", "nodes", "yourself", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
  27860. referencedClasses: []
  27861. }),
  27862. smalltalk.AIBlockClosure);
  27863. smalltalk.addMethod(
  27864. smalltalk.method({
  27865. selector: "forContext:node:",
  27866. category: 'instance creation',
  27867. fn: function (aContext,aNode){
  27868. var self=this;
  27869. return smalltalk.withContext(function($ctx1) {
  27870. var $2,$3,$1;
  27871. $2=self._new();
  27872. _st($2)._initializeWithContext_node_(aContext,aNode);
  27873. $3=_st($2)._yourself();
  27874. $1=$3;
  27875. return $1;
  27876. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},smalltalk.AIBlockClosure.klass)})},
  27877. args: ["aContext", "aNode"],
  27878. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  27879. messageSends: ["initializeWithContext:node:", "new", "yourself"],
  27880. referencedClasses: []
  27881. }),
  27882. smalltalk.AIBlockClosure.klass);
  27883. smalltalk.addClass('AIContext', smalltalk.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'ast', 'interpreter'], 'Compiler-Interpreter');
  27884. smalltalk.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  27885. smalltalk.addMethod(
  27886. smalltalk.method({
  27887. selector: "arguments",
  27888. category: 'interpreting',
  27889. fn: function (){
  27890. var self=this;
  27891. return smalltalk.withContext(function($ctx1) {
  27892. var $1;
  27893. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  27894. return smalltalk.withContext(function($ctx2) {
  27895. return self._localAt_(each);
  27896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27897. return $1;
  27898. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.AIContext)})},
  27899. args: [],
  27900. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ]",
  27901. messageSends: ["collect:", "arguments", "ast", "localAt:"],
  27902. referencedClasses: []
  27903. }),
  27904. smalltalk.AIContext);
  27905. smalltalk.addMethod(
  27906. smalltalk.method({
  27907. selector: "ast",
  27908. category: 'interpreting',
  27909. fn: function (){
  27910. var self=this;
  27911. return smalltalk.withContext(function($ctx1) {
  27912. var $1,$3,$2,$4,$5;
  27913. $1=self._isBlockContext();
  27914. if(smalltalk.assert($1)){
  27915. $3=self._outerContext();
  27916. if(($receiver = $3) == nil || $receiver == null){
  27917. $2=$3;
  27918. } else {
  27919. var context;
  27920. context=$receiver;
  27921. $2=_st(context)._ast();
  27922. };
  27923. return $2;
  27924. };
  27925. $4=self["@ast"];
  27926. if(($receiver = $4) == nil || $receiver == null){
  27927. self._initializeAST();
  27928. } else {
  27929. $4;
  27930. };
  27931. $5=self["@ast"];
  27932. return $5;
  27933. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.AIContext)})},
  27934. args: [],
  27935. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  27936. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"],
  27937. referencedClasses: []
  27938. }),
  27939. smalltalk.AIContext);
  27940. smalltalk.addMethod(
  27941. smalltalk.method({
  27942. selector: "index",
  27943. category: 'accessing',
  27944. fn: function (){
  27945. var self=this;
  27946. return smalltalk.withContext(function($ctx1) {
  27947. var $2,$1;
  27948. $2=self["@index"];
  27949. if(($receiver = $2) == nil || $receiver == null){
  27950. $1=(0);
  27951. } else {
  27952. $1=$2;
  27953. };
  27954. return $1;
  27955. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.AIContext)})},
  27956. args: [],
  27957. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  27958. messageSends: ["ifNil:"],
  27959. referencedClasses: []
  27960. }),
  27961. smalltalk.AIContext);
  27962. smalltalk.addMethod(
  27963. smalltalk.method({
  27964. selector: "index:",
  27965. category: 'accessing',
  27966. fn: function (anInteger){
  27967. var self=this;
  27968. return smalltalk.withContext(function($ctx1) {
  27969. self["@index"]=anInteger;
  27970. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.AIContext)})},
  27971. args: ["anInteger"],
  27972. source: "index: anInteger\x0a\x09index := anInteger",
  27973. messageSends: [],
  27974. referencedClasses: []
  27975. }),
  27976. smalltalk.AIContext);
  27977. smalltalk.addMethod(
  27978. smalltalk.method({
  27979. selector: "initializeAST",
  27980. category: 'initialization',
  27981. fn: function (){
  27982. var self=this;
  27983. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  27984. return smalltalk.withContext(function($ctx1) {
  27985. self["@ast"]=_st(self._method())._ast();
  27986. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  27987. return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},smalltalk.AIContext)})},
  27988. args: [],
  27989. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  27990. messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
  27991. referencedClasses: ["SemanticAnalyzer"]
  27992. }),
  27993. smalltalk.AIContext);
  27994. smalltalk.addMethod(
  27995. smalltalk.method({
  27996. selector: "initializeFromMethodContext:",
  27997. category: 'initialization',
  27998. fn: function (aMethodContext){
  27999. var self=this;
  28000. return smalltalk.withContext(function($ctx1) {
  28001. var $1,$2,$3,$4;
  28002. $1=self;
  28003. _st($1)._pc_(_st(aMethodContext)._pc());
  28004. _st($1)._index_(_st(aMethodContext)._index());
  28005. _st($1)._receiver_(_st(aMethodContext)._receiver());
  28006. $2=_st($1)._selector_(_st(aMethodContext)._selector());
  28007. $3=_st(aMethodContext)._outerContext();
  28008. if(($receiver = $3) == nil || $receiver == null){
  28009. $3;
  28010. } else {
  28011. var outer;
  28012. outer=$receiver;
  28013. $4=_st(outer)._methodContext();
  28014. if(($receiver = $4) == nil || $receiver == null){
  28015. $4;
  28016. } else {
  28017. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  28018. };
  28019. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  28020. return smalltalk.withContext(function($ctx2) {
  28021. return _st(self._locals())._at_put_(key,value);
  28022. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  28023. };
  28024. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  28025. args: ["aMethodContext"],
  28026. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self \x0a\x09\x09pc: aMethodContext pc;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  28027. messageSends: ["pc:", "pc", "index:", "index", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  28028. referencedClasses: []
  28029. }),
  28030. smalltalk.AIContext);
  28031. smalltalk.addMethod(
  28032. smalltalk.method({
  28033. selector: "initializeInterpreter",
  28034. category: 'initialization',
  28035. fn: function (){
  28036. var self=this;
  28037. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  28038. return smalltalk.withContext(function($ctx1) {
  28039. var $1,$2,$3;
  28040. $1=_st($ASTInterpreter())._new();
  28041. _st($1)._context_(self);
  28042. _st($1)._node_(self._retrieveNode());
  28043. $2=_st($1)._yourself();
  28044. self["@interpreter"]=$2;
  28045. $3=_st(_st(self._innerContext())._notNil())._and_((function(){
  28046. return smalltalk.withContext(function($ctx2) {
  28047. return _st(_st(self._innerContext())._isBlockContext())._not();
  28048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28049. if(smalltalk.assert($3)){
  28050. self._setupInterpreter_(self["@interpreter"]);
  28051. };
  28052. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},smalltalk.AIContext)})},
  28053. args: [],
  28054. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: self retrieveNode;\x0a\x09\x09yourself.\x0a\x09\x0a\x09(self innerContext notNil and: [ \x0a\x09\x09self innerContext isBlockContext not ]) ifTrue: [\x0a\x09\x09\x09self setupInterpreter: interpreter ]",
  28055. messageSends: ["context:", "new", "node:", "retrieveNode", "yourself", "ifTrue:", "and:", "notNil", "innerContext", "not", "isBlockContext", "setupInterpreter:"],
  28056. referencedClasses: ["ASTInterpreter"]
  28057. }),
  28058. smalltalk.AIContext);
  28059. smalltalk.addMethod(
  28060. smalltalk.method({
  28061. selector: "initializeLocals",
  28062. category: 'initialization',
  28063. fn: function (){
  28064. var self=this;
  28065. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  28066. return smalltalk.withContext(function($ctx1) {
  28067. self["@locals"]=_st($Dictionary())._new();
  28068. _st(self["@locals"])._at_put_("thisContext",self);
  28069. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  28070. args: [],
  28071. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  28072. messageSends: ["new", "at:put:"],
  28073. referencedClasses: ["Dictionary"]
  28074. }),
  28075. smalltalk.AIContext);
  28076. smalltalk.addMethod(
  28077. smalltalk.method({
  28078. selector: "innerContext",
  28079. category: 'accessing',
  28080. fn: function (){
  28081. var self=this;
  28082. return smalltalk.withContext(function($ctx1) {
  28083. var $1;
  28084. $1=self["@innerContext"];
  28085. return $1;
  28086. }, function($ctx1) {$ctx1.fill(self,"innerContext",{},smalltalk.AIContext)})},
  28087. args: [],
  28088. source: "innerContext\x0a\x09^ innerContext",
  28089. messageSends: [],
  28090. referencedClasses: []
  28091. }),
  28092. smalltalk.AIContext);
  28093. smalltalk.addMethod(
  28094. smalltalk.method({
  28095. selector: "innerContext:",
  28096. category: 'accessing',
  28097. fn: function (anAIContext){
  28098. var self=this;
  28099. return smalltalk.withContext(function($ctx1) {
  28100. self["@innerContext"]=anAIContext;
  28101. return self}, function($ctx1) {$ctx1.fill(self,"innerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  28102. args: ["anAIContext"],
  28103. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  28104. messageSends: [],
  28105. referencedClasses: []
  28106. }),
  28107. smalltalk.AIContext);
  28108. smalltalk.addMethod(
  28109. smalltalk.method({
  28110. selector: "interpreter",
  28111. category: 'interpreting',
  28112. fn: function (){
  28113. var self=this;
  28114. return smalltalk.withContext(function($ctx1) {
  28115. var $1,$2;
  28116. $1=self["@interpreter"];
  28117. if(($receiver = $1) == nil || $receiver == null){
  28118. self._initializeInterpreter();
  28119. } else {
  28120. $1;
  28121. };
  28122. $2=self["@interpreter"];
  28123. return $2;
  28124. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.AIContext)})},
  28125. args: [],
  28126. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  28127. messageSends: ["ifNil:", "initializeInterpreter"],
  28128. referencedClasses: []
  28129. }),
  28130. smalltalk.AIContext);
  28131. smalltalk.addMethod(
  28132. smalltalk.method({
  28133. selector: "interpreter:",
  28134. category: 'interpreting',
  28135. fn: function (anInterpreter){
  28136. var self=this;
  28137. return smalltalk.withContext(function($ctx1) {
  28138. self["@interpreter"]=anInterpreter;
  28139. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  28140. args: ["anInterpreter"],
  28141. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  28142. messageSends: [],
  28143. referencedClasses: []
  28144. }),
  28145. smalltalk.AIContext);
  28146. smalltalk.addMethod(
  28147. smalltalk.method({
  28148. selector: "localAt:",
  28149. category: 'accessing',
  28150. fn: function (aString){
  28151. var self=this;
  28152. return smalltalk.withContext(function($ctx1) {
  28153. var $2,$1;
  28154. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  28155. return smalltalk.withContext(function($ctx2) {
  28156. $2=self._outerContext();
  28157. if(($receiver = $2) == nil || $receiver == null){
  28158. return $2;
  28159. } else {
  28160. var context;
  28161. context=$receiver;
  28162. return _st(context)._localAt_(aString);
  28163. };
  28164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28165. return $1;
  28166. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  28167. args: ["aString"],
  28168. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext ifNotNil: [ :context | \x0a\x09\x09\x09context localAt: aString ] ]",
  28169. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:", "outerContext", "localAt:"],
  28170. referencedClasses: []
  28171. }),
  28172. smalltalk.AIContext);
  28173. smalltalk.addMethod(
  28174. smalltalk.method({
  28175. selector: "localAt:ifAbsent:",
  28176. category: 'accessing',
  28177. fn: function (aString,aBlock){
  28178. var self=this;
  28179. return smalltalk.withContext(function($ctx1) {
  28180. var $2,$1;
  28181. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  28182. return smalltalk.withContext(function($ctx2) {
  28183. $2=self._outerContext();
  28184. if(($receiver = $2) == nil || $receiver == null){
  28185. return _st(aBlock)._value();
  28186. } else {
  28187. var context;
  28188. context=$receiver;
  28189. return _st(context)._localAt_ifAbsent_(aString,aBlock);
  28190. };
  28191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28192. return $1;
  28193. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.AIContext)})},
  28194. args: ["aString", "aBlock"],
  28195. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext \x0a\x09\x09\x09ifNotNil: [ :context | context localAt: aString ifAbsent: aBlock ]\x0a\x09\x09\x09ifNil: [aBlock value] ]",
  28196. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:ifNil:", "outerContext", "localAt:ifAbsent:", "value"],
  28197. referencedClasses: []
  28198. }),
  28199. smalltalk.AIContext);
  28200. smalltalk.addMethod(
  28201. smalltalk.method({
  28202. selector: "localAt:put:",
  28203. category: 'accessing',
  28204. fn: function (aString,anObject){
  28205. var self=this;
  28206. return smalltalk.withContext(function($ctx1) {
  28207. _st(self._locals())._at_put_(aString,anObject);
  28208. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  28209. args: ["aString", "anObject"],
  28210. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  28211. messageSends: ["at:put:", "locals"],
  28212. referencedClasses: []
  28213. }),
  28214. smalltalk.AIContext);
  28215. smalltalk.addMethod(
  28216. smalltalk.method({
  28217. selector: "locals",
  28218. category: 'accessing',
  28219. fn: function (){
  28220. var self=this;
  28221. return smalltalk.withContext(function($ctx1) {
  28222. var $1,$2;
  28223. $1=self["@locals"];
  28224. if(($receiver = $1) == nil || $receiver == null){
  28225. self._initializeLocals();
  28226. } else {
  28227. $1;
  28228. };
  28229. $2=self["@locals"];
  28230. return $2;
  28231. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  28232. args: [],
  28233. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  28234. messageSends: ["ifNil:", "initializeLocals"],
  28235. referencedClasses: []
  28236. }),
  28237. smalltalk.AIContext);
  28238. smalltalk.addMethod(
  28239. smalltalk.method({
  28240. selector: "method",
  28241. category: 'accessing',
  28242. fn: function (){
  28243. var self=this;
  28244. return smalltalk.withContext(function($ctx1) {
  28245. var $2,$1;
  28246. $2=self._methodContext();
  28247. if(($receiver = $2) == nil || $receiver == null){
  28248. $1=$2;
  28249. } else {
  28250. $1=_st(_st(_st(self._methodContext())._receiver())._class())._lookupSelector_(_st(self._methodContext())._selector());
  28251. };
  28252. return $1;
  28253. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  28254. args: [],
  28255. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  28256. messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
  28257. referencedClasses: []
  28258. }),
  28259. smalltalk.AIContext);
  28260. smalltalk.addMethod(
  28261. smalltalk.method({
  28262. selector: "newBlockContext",
  28263. category: 'factory',
  28264. fn: function (){
  28265. var self=this;
  28266. return smalltalk.withContext(function($ctx1) {
  28267. var $2,$3,$1;
  28268. $2=_st(self._class())._new();
  28269. _st($2)._outerContext_(self);
  28270. $3=_st($2)._yourself();
  28271. $1=$3;
  28272. return $1;
  28273. }, function($ctx1) {$ctx1.fill(self,"newBlockContext",{},smalltalk.AIContext)})},
  28274. args: [],
  28275. source: "newBlockContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  28276. messageSends: ["outerContext:", "new", "class", "yourself"],
  28277. referencedClasses: []
  28278. }),
  28279. smalltalk.AIContext);
  28280. smalltalk.addMethod(
  28281. smalltalk.method({
  28282. selector: "outerContext",
  28283. category: 'accessing',
  28284. fn: function (){
  28285. var self=this;
  28286. return smalltalk.withContext(function($ctx1) {
  28287. var $1;
  28288. $1=self["@outerContext"];
  28289. return $1;
  28290. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  28291. args: [],
  28292. source: "outerContext\x0a\x09^ outerContext",
  28293. messageSends: [],
  28294. referencedClasses: []
  28295. }),
  28296. smalltalk.AIContext);
  28297. smalltalk.addMethod(
  28298. smalltalk.method({
  28299. selector: "outerContext:",
  28300. category: 'accessing',
  28301. fn: function (anAIContext){
  28302. var self=this;
  28303. return smalltalk.withContext(function($ctx1) {
  28304. self["@outerContext"]=anAIContext;
  28305. _st(self["@outerContext"])._innerContext_(self);
  28306. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  28307. args: ["anAIContext"],
  28308. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext innerContext: self",
  28309. messageSends: ["innerContext:"],
  28310. referencedClasses: []
  28311. }),
  28312. smalltalk.AIContext);
  28313. smalltalk.addMethod(
  28314. smalltalk.method({
  28315. selector: "pc",
  28316. category: 'interpreting',
  28317. fn: function (){
  28318. var self=this;
  28319. return smalltalk.withContext(function($ctx1) {
  28320. var $2,$1;
  28321. $2=self["@pc"];
  28322. if(($receiver = $2) == nil || $receiver == null){
  28323. self["@pc"]=(0);
  28324. $1=self["@pc"];
  28325. } else {
  28326. $1=$2;
  28327. };
  28328. return $1;
  28329. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  28330. args: [],
  28331. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  28332. messageSends: ["ifNil:"],
  28333. referencedClasses: []
  28334. }),
  28335. smalltalk.AIContext);
  28336. smalltalk.addMethod(
  28337. smalltalk.method({
  28338. selector: "pc:",
  28339. category: 'interpreting',
  28340. fn: function (anInteger){
  28341. var self=this;
  28342. return smalltalk.withContext(function($ctx1) {
  28343. self["@pc"]=anInteger;
  28344. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  28345. args: ["anInteger"],
  28346. source: "pc: anInteger\x0a\x09pc := anInteger",
  28347. messageSends: [],
  28348. referencedClasses: []
  28349. }),
  28350. smalltalk.AIContext);
  28351. smalltalk.addMethod(
  28352. smalltalk.method({
  28353. selector: "receiver",
  28354. category: 'interpreting',
  28355. fn: function (){
  28356. var self=this;
  28357. return smalltalk.withContext(function($ctx1) {
  28358. var $1;
  28359. $1=self._localAt_("self");
  28360. return $1;
  28361. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  28362. args: [],
  28363. source: "receiver\x0a\x09^ self localAt: 'self'",
  28364. messageSends: ["localAt:"],
  28365. referencedClasses: []
  28366. }),
  28367. smalltalk.AIContext);
  28368. smalltalk.addMethod(
  28369. smalltalk.method({
  28370. selector: "receiver:",
  28371. category: 'interpreting',
  28372. fn: function (anObject){
  28373. var self=this;
  28374. return smalltalk.withContext(function($ctx1) {
  28375. self._localAt_put_("self",anObject);
  28376. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  28377. args: ["anObject"],
  28378. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  28379. messageSends: ["localAt:put:"],
  28380. referencedClasses: []
  28381. }),
  28382. smalltalk.AIContext);
  28383. smalltalk.addMethod(
  28384. smalltalk.method({
  28385. selector: "retrieveNode",
  28386. category: 'interpreting',
  28387. fn: function (){
  28388. var self=this;
  28389. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  28390. return smalltalk.withContext(function($ctx1) {
  28391. var $2,$3,$4,$1;
  28392. $2=self._ast();
  28393. if(($receiver = $2) == nil || $receiver == null){
  28394. $1=$2;
  28395. } else {
  28396. $3=_st($ASTPCNodeVisitor())._new();
  28397. _st($3)._context_(self);
  28398. _st($3)._visit_(self._ast());
  28399. $4=_st($3)._currentNode();
  28400. $1=$4;
  28401. };
  28402. return $1;
  28403. }, function($ctx1) {$ctx1.fill(self,"retrieveNode",{},smalltalk.AIContext)})},
  28404. args: [],
  28405. source: "retrieveNode\x0a\x09^ self ast ifNotNil: [\x0a\x09\x09ASTPCNodeVisitor new\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode ]",
  28406. messageSends: ["ifNotNil:", "ast", "context:", "new", "visit:", "currentNode"],
  28407. referencedClasses: ["ASTPCNodeVisitor"]
  28408. }),
  28409. smalltalk.AIContext);
  28410. smalltalk.addMethod(
  28411. smalltalk.method({
  28412. selector: "selector",
  28413. category: 'accessing',
  28414. fn: function (){
  28415. var self=this;
  28416. return smalltalk.withContext(function($ctx1) {
  28417. var $1;
  28418. $1=self["@selector"];
  28419. return $1;
  28420. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  28421. args: [],
  28422. source: "selector\x0a\x09^ selector",
  28423. messageSends: [],
  28424. referencedClasses: []
  28425. }),
  28426. smalltalk.AIContext);
  28427. smalltalk.addMethod(
  28428. smalltalk.method({
  28429. selector: "selector:",
  28430. category: 'accessing',
  28431. fn: function (aString){
  28432. var self=this;
  28433. return smalltalk.withContext(function($ctx1) {
  28434. self["@selector"]=aString;
  28435. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.AIContext)})},
  28436. args: ["aString"],
  28437. source: "selector: aString\x0a\x09selector := aString",
  28438. messageSends: [],
  28439. referencedClasses: []
  28440. }),
  28441. smalltalk.AIContext);
  28442. smalltalk.addMethod(
  28443. smalltalk.method({
  28444. selector: "setupInterpreter:",
  28445. category: 'interpreting',
  28446. fn: function (anInterpreter){
  28447. var self=this;
  28448. return smalltalk.withContext(function($ctx1) {
  28449. _st(_st(_st(self._innerContext())._arguments())._reversed())._do_((function(each){
  28450. return smalltalk.withContext(function($ctx2) {
  28451. return _st(anInterpreter)._push_(each);
  28452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  28453. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  28454. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  28455. args: ["anInterpreter"],
  28456. source: "setupInterpreter: anInterpreter\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x0a\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  28457. messageSends: ["do:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  28458. referencedClasses: []
  28459. }),
  28460. smalltalk.AIContext);
  28461. smalltalk.addMethod(
  28462. smalltalk.method({
  28463. selector: "fromMethodContext:",
  28464. category: 'instance creation',
  28465. fn: function (aMethodContext){
  28466. var self=this;
  28467. return smalltalk.withContext(function($ctx1) {
  28468. var $2,$3,$1;
  28469. $2=self._new();
  28470. _st($2)._initializeFromMethodContext_(aMethodContext);
  28471. $3=_st($2)._yourself();
  28472. $1=$3;
  28473. return $1;
  28474. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  28475. args: ["aMethodContext"],
  28476. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  28477. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  28478. referencedClasses: []
  28479. }),
  28480. smalltalk.AIContext.klass);
  28481. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  28482. smalltalk.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTSteppingInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from a `MethodContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  28483. smalltalk.addMethod(
  28484. smalltalk.method({
  28485. selector: "atEnd",
  28486. category: 'testing',
  28487. fn: function (){
  28488. var self=this;
  28489. return smalltalk.withContext(function($ctx1) {
  28490. var $1;
  28491. $1=_st(self._interpreter())._atEnd();
  28492. return $1;
  28493. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  28494. args: [],
  28495. source: "atEnd\x0a\x09^ self interpreter atEnd",
  28496. messageSends: ["atEnd", "interpreter"],
  28497. referencedClasses: []
  28498. }),
  28499. smalltalk.ASTDebugger);
  28500. smalltalk.addMethod(
  28501. smalltalk.method({
  28502. selector: "buildAST",
  28503. category: 'initialization',
  28504. fn: function (){
  28505. var self=this;
  28506. var ast;
  28507. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28508. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  28509. return smalltalk.withContext(function($ctx1) {
  28510. var $1;
  28511. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  28512. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  28513. $1=ast;
  28514. return $1;
  28515. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  28516. args: [],
  28517. source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk current parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
  28518. messageSends: ["parse:", "current", "source", "method", "visit:", "on:", "class", "receiver", "context"],
  28519. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  28520. }),
  28521. smalltalk.ASTDebugger);
  28522. smalltalk.addMethod(
  28523. smalltalk.method({
  28524. selector: "context",
  28525. category: 'accessing',
  28526. fn: function (){
  28527. var self=this;
  28528. return smalltalk.withContext(function($ctx1) {
  28529. var $1;
  28530. $1=self["@context"];
  28531. return $1;
  28532. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  28533. args: [],
  28534. source: "context\x0a\x09^ context",
  28535. messageSends: [],
  28536. referencedClasses: []
  28537. }),
  28538. smalltalk.ASTDebugger);
  28539. smalltalk.addMethod(
  28540. smalltalk.method({
  28541. selector: "context:",
  28542. category: 'accessing',
  28543. fn: function (aContext){
  28544. var self=this;
  28545. return smalltalk.withContext(function($ctx1) {
  28546. self["@context"]=aContext;
  28547. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  28548. args: ["aContext"],
  28549. source: "context: aContext\x0a\x09context := aContext",
  28550. messageSends: [],
  28551. referencedClasses: []
  28552. }),
  28553. smalltalk.ASTDebugger);
  28554. smalltalk.addMethod(
  28555. smalltalk.method({
  28556. selector: "defaultInterpreterClass",
  28557. category: 'defaults',
  28558. fn: function (){
  28559. var self=this;
  28560. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  28561. return smalltalk.withContext(function($ctx1) {
  28562. var $1;
  28563. $1=$ASTInterpreter();
  28564. return $1;
  28565. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  28566. args: [],
  28567. source: "defaultInterpreterClass\x0a\x09^ ASTInterpreter",
  28568. messageSends: [],
  28569. referencedClasses: ["ASTInterpreter"]
  28570. }),
  28571. smalltalk.ASTDebugger);
  28572. smalltalk.addMethod(
  28573. smalltalk.method({
  28574. selector: "initializeInterpreter",
  28575. category: 'initialization',
  28576. fn: function (){
  28577. var self=this;
  28578. var ast,next;
  28579. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  28580. return smalltalk.withContext(function($ctx1) {
  28581. var $1,$2;
  28582. ast=self._buildAST();
  28583. $1=_st($ASTPCNodeVisitor())._new();
  28584. _st($1)._context_(self._context());
  28585. _st($1)._visit_(ast);
  28586. $2=_st($1)._currentNode();
  28587. next=$2;
  28588. _st(self._interpreter())._node_(next);
  28589. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  28590. args: [],
  28591. source: "initializeInterpreter\x0a\x09| ast next |\x0a\x09ast := self buildAST.\x0a\x09next := ASTPCNodeVisitor new\x0a\x09\x09context: self context;\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode.\x0a\x09self interpreter node: next",
  28592. messageSends: ["buildAST", "context:", "new", "context", "visit:", "currentNode", "node:", "interpreter"],
  28593. referencedClasses: ["ASTPCNodeVisitor"]
  28594. }),
  28595. smalltalk.ASTDebugger);
  28596. smalltalk.addMethod(
  28597. smalltalk.method({
  28598. selector: "initializeWithContext:",
  28599. category: 'initialization',
  28600. fn: function (aContext){
  28601. var self=this;
  28602. return smalltalk.withContext(function($ctx1) {
  28603. self._context_(aContext);
  28604. self._initializeInterpreter();
  28605. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  28606. args: ["aContext"],
  28607. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  28608. messageSends: ["context:", "initializeInterpreter"],
  28609. referencedClasses: []
  28610. }),
  28611. smalltalk.ASTDebugger);
  28612. smalltalk.addMethod(
  28613. smalltalk.method({
  28614. selector: "interpreter",
  28615. category: 'accessing',
  28616. fn: function (){
  28617. var self=this;
  28618. return smalltalk.withContext(function($ctx1) {
  28619. var $2,$1;
  28620. $2=self["@interpreter"];
  28621. if(($receiver = $2) == nil || $receiver == null){
  28622. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  28623. $1=self["@interpreter"];
  28624. } else {
  28625. $1=$2;
  28626. };
  28627. return $1;
  28628. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  28629. args: [],
  28630. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  28631. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  28632. referencedClasses: []
  28633. }),
  28634. smalltalk.ASTDebugger);
  28635. smalltalk.addMethod(
  28636. smalltalk.method({
  28637. selector: "interpreter:",
  28638. category: 'accessing',
  28639. fn: function (anInterpreter){
  28640. var self=this;
  28641. return smalltalk.withContext(function($ctx1) {
  28642. self["@interpreter"]=anInterpreter;
  28643. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  28644. args: ["anInterpreter"],
  28645. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  28646. messageSends: [],
  28647. referencedClasses: []
  28648. }),
  28649. smalltalk.ASTDebugger);
  28650. smalltalk.addMethod(
  28651. smalltalk.method({
  28652. selector: "method",
  28653. category: 'accessing',
  28654. fn: function (){
  28655. var self=this;
  28656. return smalltalk.withContext(function($ctx1) {
  28657. var $1;
  28658. $1=_st(self._context())._method();
  28659. return $1;
  28660. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  28661. args: [],
  28662. source: "method\x0a\x09^ self context method",
  28663. messageSends: ["method", "context"],
  28664. referencedClasses: []
  28665. }),
  28666. smalltalk.ASTDebugger);
  28667. smalltalk.addMethod(
  28668. smalltalk.method({
  28669. selector: "nextNode",
  28670. category: 'accessing',
  28671. fn: function (){
  28672. var self=this;
  28673. return smalltalk.withContext(function($ctx1) {
  28674. var $1;
  28675. $1=_st(self._interpreter())._nextNode();
  28676. return $1;
  28677. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  28678. args: [],
  28679. source: "nextNode\x0a\x09^ self interpreter nextNode",
  28680. messageSends: ["nextNode", "interpreter"],
  28681. referencedClasses: []
  28682. }),
  28683. smalltalk.ASTDebugger);
  28684. smalltalk.addMethod(
  28685. smalltalk.method({
  28686. selector: "proceed",
  28687. category: 'stepping',
  28688. fn: function (){
  28689. var self=this;
  28690. return smalltalk.withContext(function($ctx1) {
  28691. self._shouldBeImplemented();
  28692. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  28693. args: [],
  28694. source: "proceed\x0a\x09self shouldBeImplemented",
  28695. messageSends: ["shouldBeImplemented"],
  28696. referencedClasses: []
  28697. }),
  28698. smalltalk.ASTDebugger);
  28699. smalltalk.addMethod(
  28700. smalltalk.method({
  28701. selector: "restart",
  28702. category: 'stepping',
  28703. fn: function (){
  28704. var self=this;
  28705. return smalltalk.withContext(function($ctx1) {
  28706. _st(self._interpreter())._restart();
  28707. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  28708. args: [],
  28709. source: "restart\x0a\x09self interpreter restart",
  28710. messageSends: ["restart", "interpreter"],
  28711. referencedClasses: []
  28712. }),
  28713. smalltalk.ASTDebugger);
  28714. smalltalk.addMethod(
  28715. smalltalk.method({
  28716. selector: "stepInto",
  28717. category: 'stepping',
  28718. fn: function (){
  28719. var self=this;
  28720. return smalltalk.withContext(function($ctx1) {
  28721. self._shouldBeImplemented();
  28722. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  28723. args: [],
  28724. source: "stepInto\x0a\x09self shouldBeImplemented",
  28725. messageSends: ["shouldBeImplemented"],
  28726. referencedClasses: []
  28727. }),
  28728. smalltalk.ASTDebugger);
  28729. smalltalk.addMethod(
  28730. smalltalk.method({
  28731. selector: "stepOver",
  28732. category: 'stepping',
  28733. fn: function (){
  28734. var self=this;
  28735. return smalltalk.withContext(function($ctx1) {
  28736. _st(self._interpreter())._stepOver();
  28737. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  28738. args: [],
  28739. source: "stepOver\x0a\x09self interpreter stepOver",
  28740. messageSends: ["stepOver", "interpreter"],
  28741. referencedClasses: []
  28742. }),
  28743. smalltalk.ASTDebugger);
  28744. smalltalk.addMethod(
  28745. smalltalk.method({
  28746. selector: "context:",
  28747. category: 'instance creation',
  28748. fn: function (aContext){
  28749. var self=this;
  28750. return smalltalk.withContext(function($ctx1) {
  28751. var $2,$3,$1;
  28752. $2=self._new();
  28753. _st($2)._initializeWithContext_(aContext);
  28754. $3=_st($2)._yourself();
  28755. $1=$3;
  28756. return $1;
  28757. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  28758. args: ["aContext"],
  28759. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  28760. messageSends: ["initializeWithContext:", "new", "yourself"],
  28761. referencedClasses: []
  28762. }),
  28763. smalltalk.ASTDebugger.klass);
  28764. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  28765. smalltalk.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  28766. smalltalk.addMethod(
  28767. smalltalk.method({
  28768. selector: "assign:to:",
  28769. category: 'private',
  28770. fn: function (aNode,anObject){
  28771. var self=this;
  28772. return smalltalk.withContext(function($ctx1) {
  28773. var $1;
  28774. $1=_st(_st(aNode)._binding())._isInstanceVar();
  28775. if(smalltalk.assert($1)){
  28776. _st(_st(self._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  28777. } else {
  28778. _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  28779. };
  28780. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  28781. args: ["aNode", "anObject"],
  28782. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  28783. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  28784. referencedClasses: []
  28785. }),
  28786. smalltalk.ASTInterpreter);
  28787. smalltalk.addMethod(
  28788. smalltalk.method({
  28789. selector: "atEnd",
  28790. category: 'testing',
  28791. fn: function (){
  28792. var self=this;
  28793. return smalltalk.withContext(function($ctx1) {
  28794. var $1;
  28795. $1=_st(self._hasReturned())._or_((function(){
  28796. return smalltalk.withContext(function($ctx2) {
  28797. return _st(self._node())._isNil();
  28798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28799. return $1;
  28800. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTInterpreter)})},
  28801. args: [],
  28802. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  28803. messageSends: ["or:", "hasReturned", "isNil", "node"],
  28804. referencedClasses: []
  28805. }),
  28806. smalltalk.ASTInterpreter);
  28807. smalltalk.addMethod(
  28808. smalltalk.method({
  28809. selector: "context",
  28810. category: 'accessing',
  28811. fn: function (){
  28812. var self=this;
  28813. return smalltalk.withContext(function($ctx1) {
  28814. var $1;
  28815. $1=self["@context"];
  28816. return $1;
  28817. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  28818. args: [],
  28819. source: "context\x0a\x09^ context",
  28820. messageSends: [],
  28821. referencedClasses: []
  28822. }),
  28823. smalltalk.ASTInterpreter);
  28824. smalltalk.addMethod(
  28825. smalltalk.method({
  28826. selector: "context:",
  28827. category: 'accessing',
  28828. fn: function (aContext){
  28829. var self=this;
  28830. return smalltalk.withContext(function($ctx1) {
  28831. self["@context"]=aContext;
  28832. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  28833. args: ["aContext"],
  28834. source: "context: aContext\x0a\x09context := aContext",
  28835. messageSends: [],
  28836. referencedClasses: []
  28837. }),
  28838. smalltalk.ASTInterpreter);
  28839. smalltalk.addMethod(
  28840. smalltalk.method({
  28841. selector: "eval:",
  28842. category: 'private',
  28843. fn: function (aString){
  28844. var self=this;
  28845. var source,function_;
  28846. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  28847. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28848. return smalltalk.withContext(function($ctx1) {
  28849. var $1,$2,$3;
  28850. source=_st($String())._streamContents_((function(str){
  28851. return smalltalk.withContext(function($ctx2) {
  28852. _st(str)._nextPutAll_("(function(");
  28853. _st(_st(_st(self._context())._locals())._keys())._do_separatedBy_((function(each){
  28854. return smalltalk.withContext(function($ctx3) {
  28855. return _st(str)._nextPutAll_(each);
  28856. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  28857. return smalltalk.withContext(function($ctx3) {
  28858. return _st(str)._nextPutAll_(",");
  28859. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  28860. $1=str;
  28861. _st($1)._nextPutAll_("){ return (function() {");
  28862. _st($1)._nextPutAll_(aString);
  28863. $2=_st($1)._nextPutAll_("})() })");
  28864. return $2;
  28865. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  28866. function_=_st(_st($Compiler())._new())._eval_(source);
  28867. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  28868. return $3;
  28869. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  28870. args: ["aString"],
  28871. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})() })' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  28872. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  28873. referencedClasses: ["String", "Compiler"]
  28874. }),
  28875. smalltalk.ASTInterpreter);
  28876. smalltalk.addMethod(
  28877. smalltalk.method({
  28878. selector: "hasReturned",
  28879. category: 'testing',
  28880. fn: function (){
  28881. var self=this;
  28882. return smalltalk.withContext(function($ctx1) {
  28883. var $2,$1;
  28884. $2=self["@returned"];
  28885. if(($receiver = $2) == nil || $receiver == null){
  28886. $1=false;
  28887. } else {
  28888. $1=$2;
  28889. };
  28890. return $1;
  28891. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},smalltalk.ASTInterpreter)})},
  28892. args: [],
  28893. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  28894. messageSends: ["ifNil:"],
  28895. referencedClasses: []
  28896. }),
  28897. smalltalk.ASTInterpreter);
  28898. smalltalk.addMethod(
  28899. smalltalk.method({
  28900. selector: "interpret",
  28901. category: 'interpreting',
  28902. fn: function (){
  28903. var self=this;
  28904. return smalltalk.withContext(function($ctx1) {
  28905. self._visit_(self._node());
  28906. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},smalltalk.ASTInterpreter)})},
  28907. args: [],
  28908. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  28909. messageSends: ["visit:", "node"],
  28910. referencedClasses: []
  28911. }),
  28912. smalltalk.ASTInterpreter);
  28913. smalltalk.addMethod(
  28914. smalltalk.method({
  28915. selector: "interpret:",
  28916. category: 'interpreting',
  28917. fn: function (aNode){
  28918. var self=this;
  28919. return smalltalk.withContext(function($ctx1) {
  28920. self._node_(aNode);
  28921. self._interpret();
  28922. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  28923. args: ["aNode"],
  28924. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  28925. messageSends: ["node:", "interpret"],
  28926. referencedClasses: []
  28927. }),
  28928. smalltalk.ASTInterpreter);
  28929. smalltalk.addMethod(
  28930. smalltalk.method({
  28931. selector: "messageFromSendNode:arguments:",
  28932. category: 'private',
  28933. fn: function (aSendNode,aCollection){
  28934. var self=this;
  28935. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  28936. return smalltalk.withContext(function($ctx1) {
  28937. var $2,$3,$1;
  28938. $2=_st($Message())._new();
  28939. _st($2)._selector_(_st(aSendNode)._selector());
  28940. _st($2)._arguments_(aCollection);
  28941. $3=_st($2)._yourself();
  28942. $1=$3;
  28943. return $1;
  28944. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  28945. args: ["aSendNode", "aCollection"],
  28946. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  28947. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  28948. referencedClasses: ["Message"]
  28949. }),
  28950. smalltalk.ASTInterpreter);
  28951. smalltalk.addMethod(
  28952. smalltalk.method({
  28953. selector: "messageNotUnderstood:receiver:",
  28954. category: 'private',
  28955. fn: function (aMessage,anObject){
  28956. var self=this;
  28957. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  28958. return smalltalk.withContext(function($ctx1) {
  28959. var $1,$2;
  28960. $1=_st($MessageNotUnderstood())._new();
  28961. _st($1)._meesage_(aMessage);
  28962. _st($1)._receiver_(anObject);
  28963. $2=_st($1)._signal();
  28964. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},smalltalk.ASTInterpreter)})},
  28965. args: ["aMessage", "anObject"],
  28966. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  28967. messageSends: ["meesage:", "new", "receiver:", "signal"],
  28968. referencedClasses: ["MessageNotUnderstood"]
  28969. }),
  28970. smalltalk.ASTInterpreter);
  28971. smalltalk.addMethod(
  28972. smalltalk.method({
  28973. selector: "next",
  28974. category: 'interpreting',
  28975. fn: function (){
  28976. var self=this;
  28977. return smalltalk.withContext(function($ctx1) {
  28978. self._node_(_st(self._node())._nextNode());
  28979. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ASTInterpreter)})},
  28980. args: [],
  28981. source: "next\x0a\x09self node: self node nextNode",
  28982. messageSends: ["node:", "nextNode", "node"],
  28983. referencedClasses: []
  28984. }),
  28985. smalltalk.ASTInterpreter);
  28986. smalltalk.addMethod(
  28987. smalltalk.method({
  28988. selector: "node",
  28989. category: 'accessing',
  28990. fn: function (){
  28991. var self=this;
  28992. return smalltalk.withContext(function($ctx1) {
  28993. var $1;
  28994. $1=self["@node"];
  28995. return $1;
  28996. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.ASTInterpreter)})},
  28997. args: [],
  28998. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  28999. messageSends: [],
  29000. referencedClasses: []
  29001. }),
  29002. smalltalk.ASTInterpreter);
  29003. smalltalk.addMethod(
  29004. smalltalk.method({
  29005. selector: "node:",
  29006. category: 'accessing',
  29007. fn: function (aNode){
  29008. var self=this;
  29009. return smalltalk.withContext(function($ctx1) {
  29010. self["@node"]=aNode;
  29011. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29012. args: ["aNode"],
  29013. source: "node: aNode\x0a\x09node := aNode",
  29014. messageSends: [],
  29015. referencedClasses: []
  29016. }),
  29017. smalltalk.ASTInterpreter);
  29018. smalltalk.addMethod(
  29019. smalltalk.method({
  29020. selector: "peek",
  29021. category: 'stack',
  29022. fn: function (){
  29023. var self=this;
  29024. return smalltalk.withContext(function($ctx1) {
  29025. var $1;
  29026. var $early={};
  29027. try {
  29028. _st(self._stack())._ifEmpty_((function(){
  29029. return smalltalk.withContext(function($ctx2) {
  29030. throw $early=[nil];
  29031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  29032. $1=_st(self._stack())._last();
  29033. return $1;
  29034. }
  29035. catch(e) {if(e===$early)return e[0]; throw e}
  29036. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.ASTInterpreter)})},
  29037. args: [],
  29038. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  29039. messageSends: ["ifEmpty:", "stack", "last"],
  29040. referencedClasses: []
  29041. }),
  29042. smalltalk.ASTInterpreter);
  29043. smalltalk.addMethod(
  29044. smalltalk.method({
  29045. selector: "pop",
  29046. category: 'stack',
  29047. fn: function (){
  29048. var self=this;
  29049. var peekedValue;
  29050. return smalltalk.withContext(function($ctx1) {
  29051. var $1;
  29052. peekedValue=self._peek();
  29053. _st(self._stack())._removeLast();
  29054. $1=peekedValue;
  29055. return $1;
  29056. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},smalltalk.ASTInterpreter)})},
  29057. args: [],
  29058. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  29059. messageSends: ["peek", "removeLast", "stack"],
  29060. referencedClasses: []
  29061. }),
  29062. smalltalk.ASTInterpreter);
  29063. smalltalk.addMethod(
  29064. smalltalk.method({
  29065. selector: "proceed",
  29066. category: 'interpreting',
  29067. fn: function (){
  29068. var self=this;
  29069. return smalltalk.withContext(function($ctx1) {
  29070. _st((function(){
  29071. return smalltalk.withContext(function($ctx2) {
  29072. return self._atEnd();
  29073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  29074. return smalltalk.withContext(function($ctx2) {
  29075. return self._step();
  29076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  29077. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTInterpreter)})},
  29078. args: [],
  29079. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] whileFalse: [ \x0a\x09\x09self step ]",
  29080. messageSends: ["whileFalse:", "atEnd", "step"],
  29081. referencedClasses: []
  29082. }),
  29083. smalltalk.ASTInterpreter);
  29084. smalltalk.addMethod(
  29085. smalltalk.method({
  29086. selector: "push:",
  29087. category: 'stack',
  29088. fn: function (anObject){
  29089. var self=this;
  29090. return smalltalk.withContext(function($ctx1) {
  29091. var $1;
  29092. $1=_st(self._stack())._add_(anObject);
  29093. return $1;
  29094. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  29095. args: ["anObject"],
  29096. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  29097. messageSends: ["add:", "stack"],
  29098. referencedClasses: []
  29099. }),
  29100. smalltalk.ASTInterpreter);
  29101. smalltalk.addMethod(
  29102. smalltalk.method({
  29103. selector: "restart",
  29104. category: 'interpreting',
  29105. fn: function (){
  29106. var self=this;
  29107. return smalltalk.withContext(function($ctx1) {
  29108. self._node_(_st(_st(self._context())._ast())._nextChild());
  29109. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTInterpreter)})},
  29110. args: [],
  29111. source: "restart\x0a\x09self node: self context ast nextChild",
  29112. messageSends: ["node:", "nextChild", "ast", "context"],
  29113. referencedClasses: []
  29114. }),
  29115. smalltalk.ASTInterpreter);
  29116. smalltalk.addMethod(
  29117. smalltalk.method({
  29118. selector: "result",
  29119. category: 'accessing',
  29120. fn: function (){
  29121. var self=this;
  29122. return smalltalk.withContext(function($ctx1) {
  29123. var $2,$1;
  29124. $2=self._hasReturned();
  29125. if(smalltalk.assert($2)){
  29126. $1=self._returnValue();
  29127. } else {
  29128. $1=_st(self._context())._receiver();
  29129. };
  29130. return $1;
  29131. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  29132. args: [],
  29133. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  29134. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  29135. referencedClasses: []
  29136. }),
  29137. smalltalk.ASTInterpreter);
  29138. smalltalk.addMethod(
  29139. smalltalk.method({
  29140. selector: "returnValue",
  29141. category: 'accessing',
  29142. fn: function (){
  29143. var self=this;
  29144. return smalltalk.withContext(function($ctx1) {
  29145. var $1;
  29146. $1=self["@returnValue"];
  29147. return $1;
  29148. }, function($ctx1) {$ctx1.fill(self,"returnValue",{},smalltalk.ASTInterpreter)})},
  29149. args: [],
  29150. source: "returnValue\x0a\x09^ returnValue",
  29151. messageSends: [],
  29152. referencedClasses: []
  29153. }),
  29154. smalltalk.ASTInterpreter);
  29155. smalltalk.addMethod(
  29156. smalltalk.method({
  29157. selector: "returnValue:",
  29158. category: 'accessing',
  29159. fn: function (anObject){
  29160. var self=this;
  29161. return smalltalk.withContext(function($ctx1) {
  29162. self["@returnValue"]=anObject;
  29163. return self}, function($ctx1) {$ctx1.fill(self,"returnValue:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  29164. args: ["anObject"],
  29165. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  29166. messageSends: [],
  29167. referencedClasses: []
  29168. }),
  29169. smalltalk.ASTInterpreter);
  29170. smalltalk.addMethod(
  29171. smalltalk.method({
  29172. selector: "sendMessage:to:superSend:",
  29173. category: 'private',
  29174. fn: function (aMessage,anObject,aBoolean){
  29175. var self=this;
  29176. var method;
  29177. return smalltalk.withContext(function($ctx1) {
  29178. var $1,$2,$3,$4,$5,$6;
  29179. var $early={};
  29180. try {
  29181. $1=aBoolean;
  29182. if(! smalltalk.assert($1)){
  29183. $2=_st(aMessage)._sendTo_(anObject);
  29184. return $2;
  29185. };
  29186. $3=_st(_st(anObject)._class())._superclass();
  29187. if(($receiver = $3) == nil || $receiver == null){
  29188. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  29189. return $4;
  29190. } else {
  29191. $3;
  29192. };
  29193. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  29194. return smalltalk.withContext(function($ctx2) {
  29195. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  29196. throw $early=[$5];
  29197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  29198. $6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  29199. return $6;
  29200. }
  29201. catch(e) {if(e===$early)return e[0]; throw e}
  29202. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  29203. args: ["aMessage", "anObject", "aBoolean"],
  29204. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  29205. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  29206. referencedClasses: []
  29207. }),
  29208. smalltalk.ASTInterpreter);
  29209. smalltalk.addMethod(
  29210. smalltalk.method({
  29211. selector: "setNonLocalReturnFromContext:",
  29212. category: 'interpreting',
  29213. fn: function (aContext){
  29214. var self=this;
  29215. return smalltalk.withContext(function($ctx1) {
  29216. var $1;
  29217. $1=_st(_st(aContext)._interpreter())._hasReturned();
  29218. if(smalltalk.assert($1)){
  29219. self["@returned"]=true;
  29220. self["@returned"];
  29221. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  29222. };
  29223. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  29224. args: ["aContext"],
  29225. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  29226. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  29227. referencedClasses: []
  29228. }),
  29229. smalltalk.ASTInterpreter);
  29230. smalltalk.addMethod(
  29231. smalltalk.method({
  29232. selector: "skip",
  29233. category: 'interpreting',
  29234. fn: function (){
  29235. var self=this;
  29236. return smalltalk.withContext(function($ctx1) {
  29237. self._next();
  29238. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.ASTInterpreter)})},
  29239. args: [],
  29240. source: "skip\x0a\x09self next",
  29241. messageSends: ["next"],
  29242. referencedClasses: []
  29243. }),
  29244. smalltalk.ASTInterpreter);
  29245. smalltalk.addMethod(
  29246. smalltalk.method({
  29247. selector: "stack",
  29248. category: 'accessing',
  29249. fn: function (){
  29250. var self=this;
  29251. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29252. return smalltalk.withContext(function($ctx1) {
  29253. var $2,$1;
  29254. $2=self["@stack"];
  29255. if(($receiver = $2) == nil || $receiver == null){
  29256. self["@stack"]=_st($OrderedCollection())._new();
  29257. $1=self["@stack"];
  29258. } else {
  29259. $1=$2;
  29260. };
  29261. return $1;
  29262. }, function($ctx1) {$ctx1.fill(self,"stack",{},smalltalk.ASTInterpreter)})},
  29263. args: [],
  29264. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  29265. messageSends: ["ifNil:", "new"],
  29266. referencedClasses: ["OrderedCollection"]
  29267. }),
  29268. smalltalk.ASTInterpreter);
  29269. smalltalk.addMethod(
  29270. smalltalk.method({
  29271. selector: "step",
  29272. category: 'interpreting',
  29273. fn: function (){
  29274. var self=this;
  29275. return smalltalk.withContext(function($ctx1) {
  29276. var $1,$2;
  29277. $1=self;
  29278. _st($1)._interpret();
  29279. $2=_st($1)._next();
  29280. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTInterpreter)})},
  29281. args: [],
  29282. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  29283. messageSends: ["interpret", "next"],
  29284. referencedClasses: []
  29285. }),
  29286. smalltalk.ASTInterpreter);
  29287. smalltalk.addMethod(
  29288. smalltalk.method({
  29289. selector: "stepOver",
  29290. category: 'interpreting',
  29291. fn: function (){
  29292. var self=this;
  29293. return smalltalk.withContext(function($ctx1) {
  29294. self._step();
  29295. _st((function(){
  29296. return smalltalk.withContext(function($ctx2) {
  29297. return _st(self._node())._isSteppingNode();
  29298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  29299. return smalltalk.withContext(function($ctx2) {
  29300. return self._step();
  29301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  29302. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTInterpreter)})},
  29303. args: [],
  29304. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  29305. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  29306. referencedClasses: []
  29307. }),
  29308. smalltalk.ASTInterpreter);
  29309. smalltalk.addMethod(
  29310. smalltalk.method({
  29311. selector: "visit:",
  29312. category: 'visiting',
  29313. fn: function (aNode){
  29314. var self=this;
  29315. return smalltalk.withContext(function($ctx1) {
  29316. var $1;
  29317. $1=self._hasReturned();
  29318. if(! smalltalk.assert($1)){
  29319. smalltalk.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  29320. };
  29321. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29322. args: ["aNode"],
  29323. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  29324. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  29325. referencedClasses: []
  29326. }),
  29327. smalltalk.ASTInterpreter);
  29328. smalltalk.addMethod(
  29329. smalltalk.method({
  29330. selector: "visitAssignmentNode:",
  29331. category: 'visiting',
  29332. fn: function (aNode){
  29333. var self=this;
  29334. var poppedValue;
  29335. return smalltalk.withContext(function($ctx1) {
  29336. poppedValue=self._pop();
  29337. self._pop();
  29338. self._push_(poppedValue);
  29339. self._assign_to_(_st(aNode)._left(),poppedValue);
  29340. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},smalltalk.ASTInterpreter)})},
  29341. args: ["aNode"],
  29342. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  29343. messageSends: ["pop", "push:", "assign:to:", "left"],
  29344. referencedClasses: []
  29345. }),
  29346. smalltalk.ASTInterpreter);
  29347. smalltalk.addMethod(
  29348. smalltalk.method({
  29349. selector: "visitBlockNode:",
  29350. category: 'visiting',
  29351. fn: function (aNode){
  29352. var self=this;
  29353. var block;
  29354. function $AIBlockClosure(){return smalltalk.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  29355. return smalltalk.withContext(function($ctx1) {
  29356. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  29357. self._push_(block);
  29358. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},smalltalk.ASTInterpreter)})},
  29359. args: ["aNode"],
  29360. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  29361. messageSends: ["forContext:node:", "context", "push:"],
  29362. referencedClasses: ["AIBlockClosure"]
  29363. }),
  29364. smalltalk.ASTInterpreter);
  29365. smalltalk.addMethod(
  29366. smalltalk.method({
  29367. selector: "visitDynamicArrayNode:",
  29368. category: 'visiting',
  29369. fn: function (aNode){
  29370. var self=this;
  29371. var array;
  29372. return smalltalk.withContext(function($ctx1) {
  29373. array=[];
  29374. _st(_st(aNode)._nodes())._do_((function(each){
  29375. return smalltalk.withContext(function($ctx2) {
  29376. return _st(array)._addFirst_(self._pop());
  29377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29378. self._push_(array);
  29379. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.ASTInterpreter)})},
  29380. args: ["aNode"],
  29381. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  29382. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  29383. referencedClasses: []
  29384. }),
  29385. smalltalk.ASTInterpreter);
  29386. smalltalk.addMethod(
  29387. smalltalk.method({
  29388. selector: "visitDynamicDictionaryNode:",
  29389. category: 'visiting',
  29390. fn: function (aNode){
  29391. var self=this;
  29392. var associations,hashedCollection;
  29393. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29394. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  29395. return smalltalk.withContext(function($ctx1) {
  29396. associations=_st($OrderedCollection())._new();
  29397. hashedCollection=_st($HashedCollection())._new();
  29398. _st(_st(aNode)._nodes())._do_((function(each){
  29399. return smalltalk.withContext(function($ctx2) {
  29400. return _st(associations)._add_(self._pop());
  29401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29402. _st(_st(associations)._reversed())._do_((function(each){
  29403. return smalltalk.withContext(function($ctx2) {
  29404. return _st(hashedCollection)._add_(each);
  29405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29406. self._push_(hashedCollection);
  29407. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,associations:associations,hashedCollection:hashedCollection},smalltalk.ASTInterpreter)})},
  29408. args: ["aNode"],
  29409. source: "visitDynamicDictionaryNode: aNode\x0a\x09| associations hashedCollection |\x0a\x09\x0a\x09associations := OrderedCollection new.\x0a\x09hashedCollection := HashedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09associations add: self pop ].\x0a\x09\x0a\x09associations reversed do: [ :each |\x0a\x09\x09hashedCollection add: each ].\x0a\x09\x0a\x09self push: hashedCollection",
  29410. messageSends: ["new", "do:", "nodes", "add:", "pop", "reversed", "push:"],
  29411. referencedClasses: ["OrderedCollection", "HashedCollection"]
  29412. }),
  29413. smalltalk.ASTInterpreter);
  29414. smalltalk.addMethod(
  29415. smalltalk.method({
  29416. selector: "visitJSStatementNode:",
  29417. category: 'visiting',
  29418. fn: function (aNode){
  29419. var self=this;
  29420. return smalltalk.withContext(function($ctx1) {
  29421. self["@returned"]=true;
  29422. self._returnValue_(self._eval_(_st(aNode)._source()));
  29423. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29424. args: ["aNode"],
  29425. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  29426. messageSends: ["returnValue:", "eval:", "source"],
  29427. referencedClasses: []
  29428. }),
  29429. smalltalk.ASTInterpreter);
  29430. smalltalk.addMethod(
  29431. smalltalk.method({
  29432. selector: "visitNode:",
  29433. category: 'visiting',
  29434. fn: function (aNode){
  29435. var self=this;
  29436. return smalltalk.withContext(function($ctx1) {
  29437. return self}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29438. args: ["aNode"],
  29439. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  29440. messageSends: [],
  29441. referencedClasses: []
  29442. }),
  29443. smalltalk.ASTInterpreter);
  29444. smalltalk.addMethod(
  29445. smalltalk.method({
  29446. selector: "visitReturnNode:",
  29447. category: 'visiting',
  29448. fn: function (aNode){
  29449. var self=this;
  29450. return smalltalk.withContext(function($ctx1) {
  29451. self["@returned"]=true;
  29452. self._returnValue_(self._pop());
  29453. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29454. args: ["aNode"],
  29455. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  29456. messageSends: ["returnValue:", "pop"],
  29457. referencedClasses: []
  29458. }),
  29459. smalltalk.ASTInterpreter);
  29460. smalltalk.addMethod(
  29461. smalltalk.method({
  29462. selector: "visitSendNode:",
  29463. category: 'visiting',
  29464. fn: function (aNode){
  29465. var self=this;
  29466. var receiver,args,message,result;
  29467. return smalltalk.withContext(function($ctx1) {
  29468. var $1;
  29469. args=_st(_st(aNode)._arguments())._collect_((function(each){
  29470. return smalltalk.withContext(function($ctx2) {
  29471. return self._pop();
  29472. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29473. receiver=self._pop();
  29474. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  29475. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  29476. _st(self._context())._pc_(_st(_st(self._context())._pc()).__plus((1)));
  29477. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  29478. return smalltalk.withContext(function($ctx2) {
  29479. return _st(_st(aNode)._isLastChild())._not();
  29480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  29481. if(smalltalk.assert($1)){
  29482. self._push_(receiver);
  29483. } else {
  29484. self._push_(result);
  29485. };
  29486. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},smalltalk.ASTInterpreter)})},
  29487. args: ["aNode"],
  29488. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09self context pc: self context pc + 1.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  29489. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "pc:", "context", "+", "pc", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  29490. referencedClasses: []
  29491. }),
  29492. smalltalk.ASTInterpreter);
  29493. smalltalk.addMethod(
  29494. smalltalk.method({
  29495. selector: "visitValueNode:",
  29496. category: 'visiting',
  29497. fn: function (aNode){
  29498. var self=this;
  29499. return smalltalk.withContext(function($ctx1) {
  29500. self._push_(_st(aNode)._value());
  29501. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29502. args: ["aNode"],
  29503. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  29504. messageSends: ["push:", "value"],
  29505. referencedClasses: []
  29506. }),
  29507. smalltalk.ASTInterpreter);
  29508. smalltalk.addMethod(
  29509. smalltalk.method({
  29510. selector: "visitVariableNode:",
  29511. category: 'visiting',
  29512. fn: function (aNode){
  29513. var self=this;
  29514. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  29515. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29516. return smalltalk.withContext(function($ctx1) {
  29517. var $1,$2,$3,$5,$6,$4;
  29518. $1=_st(_st(aNode)._binding())._isUnknownVar();
  29519. if(smalltalk.assert($1)){
  29520. $2=self._push_(_st(_st($PlatformInterface())._globals())._at_ifAbsent_(_st(aNode)._value(),(function(){
  29521. return smalltalk.withContext(function($ctx2) {
  29522. return self._error_("Unknown variable");
  29523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})));
  29524. return $2;
  29525. };
  29526. $3=self;
  29527. $5=_st(_st(aNode)._binding())._isInstanceVar();
  29528. if(smalltalk.assert($5)){
  29529. $4=_st(_st(self._context())._receiver())._instVarAt_(_st(aNode)._value());
  29530. } else {
  29531. $4=_st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
  29532. return smalltalk.withContext(function($ctx2) {
  29533. $6=_st(_st(aNode)._value())._beginsWithCapital();
  29534. if(smalltalk.assert($6)){
  29535. return _st(_st($Smalltalk())._current())._at_ifAbsent_(_st(aNode)._value(),(function(){
  29536. return smalltalk.withContext(function($ctx3) {
  29537. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  29538. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  29539. };
  29540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  29541. };
  29542. _st($3)._push_($4);
  29543. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  29544. args: ["aNode"],
  29545. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value beginsWithCapital\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk current \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ]]]])",
  29546. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "beginsWithCapital", "current", "at:"],
  29547. referencedClasses: ["PlatformInterface", "Smalltalk"]
  29548. }),
  29549. smalltalk.ASTInterpreter);
  29550. smalltalk.addClass('ASTInterpreterError', smalltalk.Error, [], 'Compiler-Interpreter');
  29551. smalltalk.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  29552. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'blockIndex', 'currentNode'], 'Compiler-Interpreter');
  29553. smalltalk.ASTPCNodeVisitor.comment="I visit an AST until I get to the current pc node and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node corresponding to the `pc` is answered by `#currentNode`";
  29554. smalltalk.addMethod(
  29555. smalltalk.method({
  29556. selector: "blockIndex",
  29557. category: 'accessing',
  29558. fn: function (){
  29559. var self=this;
  29560. return smalltalk.withContext(function($ctx1) {
  29561. var $2,$1;
  29562. $2=self["@blockIndex"];
  29563. if(($receiver = $2) == nil || $receiver == null){
  29564. self["@blockIndex"]=(0);
  29565. $1=self["@blockIndex"];
  29566. } else {
  29567. $1=$2;
  29568. };
  29569. return $1;
  29570. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  29571. args: [],
  29572. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ blockIndex := 0 ]",
  29573. messageSends: ["ifNil:"],
  29574. referencedClasses: []
  29575. }),
  29576. smalltalk.ASTPCNodeVisitor);
  29577. smalltalk.addMethod(
  29578. smalltalk.method({
  29579. selector: "context",
  29580. category: 'accessing',
  29581. fn: function (){
  29582. var self=this;
  29583. return smalltalk.withContext(function($ctx1) {
  29584. var $1;
  29585. $1=self["@context"];
  29586. return $1;
  29587. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  29588. args: [],
  29589. source: "context\x0a\x09^ context",
  29590. messageSends: [],
  29591. referencedClasses: []
  29592. }),
  29593. smalltalk.ASTPCNodeVisitor);
  29594. smalltalk.addMethod(
  29595. smalltalk.method({
  29596. selector: "context:",
  29597. category: 'accessing',
  29598. fn: function (aContext){
  29599. var self=this;
  29600. return smalltalk.withContext(function($ctx1) {
  29601. self["@context"]=aContext;
  29602. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  29603. args: ["aContext"],
  29604. source: "context: aContext\x0a\x09context := aContext",
  29605. messageSends: [],
  29606. referencedClasses: []
  29607. }),
  29608. smalltalk.ASTPCNodeVisitor);
  29609. smalltalk.addMethod(
  29610. smalltalk.method({
  29611. selector: "currentNode",
  29612. category: 'accessing',
  29613. fn: function (){
  29614. var self=this;
  29615. return smalltalk.withContext(function($ctx1) {
  29616. var $1;
  29617. $1=self["@currentNode"];
  29618. return $1;
  29619. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  29620. args: [],
  29621. source: "currentNode\x0a\x09^ currentNode",
  29622. messageSends: [],
  29623. referencedClasses: []
  29624. }),
  29625. smalltalk.ASTPCNodeVisitor);
  29626. smalltalk.addMethod(
  29627. smalltalk.method({
  29628. selector: "increaseBlockIndex",
  29629. category: 'accessing',
  29630. fn: function (){
  29631. var self=this;
  29632. return smalltalk.withContext(function($ctx1) {
  29633. self["@blockIndex"]=_st(self._blockIndex()).__plus((1));
  29634. return self}, function($ctx1) {$ctx1.fill(self,"increaseBlockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  29635. args: [],
  29636. source: "increaseBlockIndex\x0a\x09blockIndex := self blockIndex + 1",
  29637. messageSends: ["+", "blockIndex"],
  29638. referencedClasses: []
  29639. }),
  29640. smalltalk.ASTPCNodeVisitor);
  29641. smalltalk.addMethod(
  29642. smalltalk.method({
  29643. selector: "pc",
  29644. category: 'accessing',
  29645. fn: function (){
  29646. var self=this;
  29647. return smalltalk.withContext(function($ctx1) {
  29648. var $2,$1;
  29649. $2=self["@pc"];
  29650. if(($receiver = $2) == nil || $receiver == null){
  29651. $1=(0);
  29652. } else {
  29653. $1=$2;
  29654. };
  29655. return $1;
  29656. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeVisitor)})},
  29657. args: [],
  29658. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  29659. messageSends: ["ifNil:"],
  29660. referencedClasses: []
  29661. }),
  29662. smalltalk.ASTPCNodeVisitor);
  29663. smalltalk.addMethod(
  29664. smalltalk.method({
  29665. selector: "pc:",
  29666. category: 'accessing',
  29667. fn: function (anInteger){
  29668. var self=this;
  29669. return smalltalk.withContext(function($ctx1) {
  29670. self["@pc"]=anInteger;
  29671. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitor)})},
  29672. args: ["anInteger"],
  29673. source: "pc: anInteger\x0a\x09pc := anInteger",
  29674. messageSends: [],
  29675. referencedClasses: []
  29676. }),
  29677. smalltalk.ASTPCNodeVisitor);
  29678. smalltalk.addMethod(
  29679. smalltalk.method({
  29680. selector: "useInlinings",
  29681. category: 'accessing',
  29682. fn: function (){
  29683. var self=this;
  29684. return smalltalk.withContext(function($ctx1) {
  29685. var $2,$1;
  29686. $2=self["@useInlinings"];
  29687. if(($receiver = $2) == nil || $receiver == null){
  29688. $1=true;
  29689. } else {
  29690. $1=$2;
  29691. };
  29692. return $1;
  29693. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeVisitor)})},
  29694. args: [],
  29695. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  29696. messageSends: ["ifNil:"],
  29697. referencedClasses: []
  29698. }),
  29699. smalltalk.ASTPCNodeVisitor);
  29700. smalltalk.addMethod(
  29701. smalltalk.method({
  29702. selector: "useInlinings:",
  29703. category: 'accessing',
  29704. fn: function (aBoolean){
  29705. var self=this;
  29706. return smalltalk.withContext(function($ctx1) {
  29707. self["@useInlinings"]=aBoolean;
  29708. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeVisitor)})},
  29709. args: ["aBoolean"],
  29710. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  29711. messageSends: [],
  29712. referencedClasses: []
  29713. }),
  29714. smalltalk.ASTPCNodeVisitor);
  29715. smalltalk.addMethod(
  29716. smalltalk.method({
  29717. selector: "visitBlockNode:",
  29718. category: 'visiting',
  29719. fn: function (aNode){
  29720. var self=this;
  29721. return smalltalk.withContext(function($ctx1) {
  29722. var $1,$2;
  29723. $1=_st(_st(_st(aNode)._parent())._isSendNode())._and_((function(){
  29724. return smalltalk.withContext(function($ctx2) {
  29725. return _st(_st(aNode)._parent())._shouldBeInlined();
  29726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  29727. if(smalltalk.assert($1)){
  29728. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  29729. } else {
  29730. $2=_st(self._blockIndex()).__gt_eq(_st(self._context())._index());
  29731. if(! smalltalk.assert($2)){
  29732. self._increaseBlockIndex();
  29733. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  29734. };
  29735. };
  29736. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  29737. args: ["aNode"],
  29738. source: "visitBlockNode: aNode\x0a\x09\x22Inlined send node. Assume that the block is inlined\x22\x0a\x09(aNode parent isSendNode and: [ aNode parent shouldBeInlined ])\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self blockIndex >= self context index ifFalse: [\x0a\x09\x09\x09\x09self increaseBlockIndex.\x0a\x09\x09\x09\x09super visitBlockNode: aNode ] ]\x0a\x09\x09ifTrue: [ super visitBlockNode: aNode ]",
  29739. messageSends: ["ifFalse:ifTrue:", "and:", "isSendNode", "parent", "shouldBeInlined", "ifFalse:", ">=", "blockIndex", "index", "context", "increaseBlockIndex", "visitBlockNode:"],
  29740. referencedClasses: []
  29741. }),
  29742. smalltalk.ASTPCNodeVisitor);
  29743. smalltalk.addMethod(
  29744. smalltalk.method({
  29745. selector: "visitJSStatementNode:",
  29746. category: 'visiting',
  29747. fn: function (aNode){
  29748. var self=this;
  29749. return smalltalk.withContext(function($ctx1) {
  29750. self["@currentNode"]=aNode;
  29751. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  29752. args: ["aNode"],
  29753. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  29754. messageSends: [],
  29755. referencedClasses: []
  29756. }),
  29757. smalltalk.ASTPCNodeVisitor);
  29758. smalltalk.addMethod(
  29759. smalltalk.method({
  29760. selector: "visitSendNode:",
  29761. category: 'visiting',
  29762. fn: function (aNode){
  29763. var self=this;
  29764. return smalltalk.withContext(function($ctx1) {
  29765. var $1,$2,$3;
  29766. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  29767. $1=_st(self._pc()).__eq(_st(self._context())._pc());
  29768. if(! smalltalk.assert($1)){
  29769. $2=_st(aNode)._shouldBeInlined();
  29770. if(! smalltalk.assert($2)){
  29771. $3=_st(self._blockIndex()).__eq(_st(self._context())._index());
  29772. if(smalltalk.assert($3)){
  29773. self._pc_(_st(self._pc()).__plus((1)));
  29774. self["@currentNode"]=aNode;
  29775. self["@currentNode"];
  29776. };
  29777. };
  29778. };
  29779. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  29780. args: ["aNode"],
  29781. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self pc = self context pc ifFalse: [\x0a\x09\x09aNode shouldBeInlined ifFalse: [\x0a\x09\x09\x09self blockIndex = self context index ifTrue: [\x0a\x09\x09\x09\x09self pc: self pc + 1.\x0a\x09\x09\x09\x09currentNode := aNode ] ] ]",
  29782. messageSends: ["visitSendNode:", "ifFalse:", "=", "pc", "context", "shouldBeInlined", "ifTrue:", "blockIndex", "index", "pc:", "+"],
  29783. referencedClasses: []
  29784. }),
  29785. smalltalk.ASTPCNodeVisitor);
  29786. smalltalk.addMethod(
  29787. smalltalk.method({
  29788. selector: "isSteppingNode",
  29789. category: '*Compiler-Interpreter',
  29790. fn: function (){
  29791. var self=this;
  29792. return smalltalk.withContext(function($ctx1) {
  29793. return false;
  29794. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  29795. args: [],
  29796. source: "isSteppingNode\x0a\x09^ false",
  29797. messageSends: [],
  29798. referencedClasses: []
  29799. }),
  29800. smalltalk.Node);
  29801. smalltalk.addMethod(
  29802. smalltalk.method({
  29803. selector: "isSteppingNode",
  29804. category: '*Compiler-Interpreter',
  29805. fn: function (){
  29806. var self=this;
  29807. return smalltalk.withContext(function($ctx1) {
  29808. return true;
  29809. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  29810. args: [],
  29811. source: "isSteppingNode\x0a\x09^ true",
  29812. messageSends: [],
  29813. referencedClasses: []
  29814. }),
  29815. smalltalk.AssignmentNode);
  29816. smalltalk.addMethod(
  29817. smalltalk.method({
  29818. selector: "isSteppingNode",
  29819. category: '*Compiler-Interpreter',
  29820. fn: function (){
  29821. var self=this;
  29822. return smalltalk.withContext(function($ctx1) {
  29823. return true;
  29824. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  29825. args: [],
  29826. source: "isSteppingNode\x0a\x09^ true",
  29827. messageSends: [],
  29828. referencedClasses: []
  29829. }),
  29830. smalltalk.BlockNode);
  29831. smalltalk.addMethod(
  29832. smalltalk.method({
  29833. selector: "isSteppingNode",
  29834. category: '*Compiler-Interpreter',
  29835. fn: function (){
  29836. var self=this;
  29837. return smalltalk.withContext(function($ctx1) {
  29838. return true;
  29839. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  29840. args: [],
  29841. source: "isSteppingNode\x0a\x09^ true",
  29842. messageSends: [],
  29843. referencedClasses: []
  29844. }),
  29845. smalltalk.DynamicArrayNode);
  29846. smalltalk.addMethod(
  29847. smalltalk.method({
  29848. selector: "isSteppingNode",
  29849. category: '*Compiler-Interpreter',
  29850. fn: function (){
  29851. var self=this;
  29852. return smalltalk.withContext(function($ctx1) {
  29853. return true;
  29854. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  29855. args: [],
  29856. source: "isSteppingNode\x0a\x09^ true",
  29857. messageSends: [],
  29858. referencedClasses: []
  29859. }),
  29860. smalltalk.DynamicDictionaryNode);
  29861. smalltalk.addMethod(
  29862. smalltalk.method({
  29863. selector: "isSteppingNode",
  29864. category: '*Compiler-Interpreter',
  29865. fn: function (){
  29866. var self=this;
  29867. return smalltalk.withContext(function($ctx1) {
  29868. return true;
  29869. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  29870. args: [],
  29871. source: "isSteppingNode\x0a\x09^ true",
  29872. messageSends: [],
  29873. referencedClasses: []
  29874. }),
  29875. smalltalk.JSStatementNode);
  29876. smalltalk.addMethod(
  29877. smalltalk.method({
  29878. selector: "isSteppingNode",
  29879. category: '*Compiler-Interpreter',
  29880. fn: function (){
  29881. var self=this;
  29882. return smalltalk.withContext(function($ctx1) {
  29883. return true;
  29884. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  29885. args: [],
  29886. source: "isSteppingNode\x0a\x09^ true",
  29887. messageSends: [],
  29888. referencedClasses: []
  29889. }),
  29890. smalltalk.SendNode);
  29891. });
  29892. define("amber_vm/parser", ["./smalltalk", "./nil"], function(smalltalk, nil) {
  29893. smalltalk.parser = (function(){
  29894. /*
  29895. * Generated by PEG.js 0.7.0.
  29896. *
  29897. * http://pegjs.majda.cz/
  29898. */
  29899. function quote(s) {
  29900. /*
  29901. * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
  29902. * string literal except for the closing quote character, backslash,
  29903. * carriage return, line separator, paragraph separator, and line feed.
  29904. * Any character may appear in the form of an escape sequence.
  29905. *
  29906. * For portability, we also escape escape all control and non-ASCII
  29907. * characters. Note that "\0" and "\v" escape sequences are not used
  29908. * because JSHint does not like the first and IE the second.
  29909. */
  29910. return '"' + s
  29911. .replace(/\\/g, '\\\\') // backslash
  29912. .replace(/"/g, '\\"') // closing quote character
  29913. .replace(/\x08/g, '\\b') // backspace
  29914. .replace(/\t/g, '\\t') // horizontal tab
  29915. .replace(/\n/g, '\\n') // line feed
  29916. .replace(/\f/g, '\\f') // form feed
  29917. .replace(/\r/g, '\\r') // carriage return
  29918. .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
  29919. + '"';
  29920. }
  29921. var result = {
  29922. /*
  29923. * Parses the input with a generated parser. If the parsing is successfull,
  29924. * returns a value explicitly or implicitly specified by the grammar from
  29925. * which the parser was generated (see |PEG.buildParser|). If the parsing is
  29926. * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
  29927. */
  29928. parse: function(input, startRule) {
  29929. var parseFunctions = {
  29930. "separator": parse_separator,
  29931. "comments": parse_comments,
  29932. "ws": parse_ws,
  29933. "identifier": parse_identifier,
  29934. "keyword": parse_keyword,
  29935. "selector": parse_selector,
  29936. "className": parse_className,
  29937. "string": parse_string,
  29938. "symbol": parse_symbol,
  29939. "bareSymbol": parse_bareSymbol,
  29940. "number": parse_number,
  29941. "hex": parse_hex,
  29942. "float": parse_float,
  29943. "integer": parse_integer,
  29944. "literalArray": parse_literalArray,
  29945. "bareLiteralArray": parse_bareLiteralArray,
  29946. "literalArrayRest": parse_literalArrayRest,
  29947. "dynamicArray": parse_dynamicArray,
  29948. "dynamicDictionary": parse_dynamicDictionary,
  29949. "pseudoVariable": parse_pseudoVariable,
  29950. "parseTimeLiteral": parse_parseTimeLiteral,
  29951. "runtimeLiteral": parse_runtimeLiteral,
  29952. "literal": parse_literal,
  29953. "variable": parse_variable,
  29954. "keywordPair": parse_keywordPair,
  29955. "binarySelector": parse_binarySelector,
  29956. "keywordPattern": parse_keywordPattern,
  29957. "binaryPattern": parse_binaryPattern,
  29958. "unaryPattern": parse_unaryPattern,
  29959. "expression": parse_expression,
  29960. "expressionList": parse_expressionList,
  29961. "expressions": parse_expressions,
  29962. "assignment": parse_assignment,
  29963. "ret": parse_ret,
  29964. "temps": parse_temps,
  29965. "blockParamList": parse_blockParamList,
  29966. "subexpression": parse_subexpression,
  29967. "statements": parse_statements,
  29968. "sequence": parse_sequence,
  29969. "stSequence": parse_stSequence,
  29970. "block": parse_block,
  29971. "operand": parse_operand,
  29972. "unaryMessage": parse_unaryMessage,
  29973. "unaryTail": parse_unaryTail,
  29974. "unarySend": parse_unarySend,
  29975. "binaryMessage": parse_binaryMessage,
  29976. "binaryTail": parse_binaryTail,
  29977. "binarySend": parse_binarySend,
  29978. "keywordMessage": parse_keywordMessage,
  29979. "keywordSend": parse_keywordSend,
  29980. "message": parse_message,
  29981. "cascade": parse_cascade,
  29982. "jsStatement": parse_jsStatement,
  29983. "method": parse_method
  29984. };
  29985. if (startRule !== undefined) {
  29986. if (parseFunctions[startRule] === undefined) {
  29987. throw new Error("Invalid rule name: " + quote(startRule) + ".");
  29988. }
  29989. } else {
  29990. startRule = "method";
  29991. }
  29992. var pos = { offset: 0, line: 1, column: 1, seenCR: false };
  29993. var reportFailures = 0;
  29994. var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
  29995. var rightmostFailuresExpected = [];
  29996. var cache = {};
  29997. function padLeft(input, padding, length) {
  29998. var result = input;
  29999. var padLength = length - input.length;
  30000. for (var i = 0; i < padLength; i++) {
  30001. result = padding + result;
  30002. }
  30003. return result;
  30004. }
  30005. function escape(ch) {
  30006. var charCode = ch.charCodeAt(0);
  30007. var escapeChar;
  30008. var length;
  30009. if (charCode <= 0xFF) {
  30010. escapeChar = 'x';
  30011. length = 2;
  30012. } else {
  30013. escapeChar = 'u';
  30014. length = 4;
  30015. }
  30016. return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
  30017. }
  30018. function clone(object) {
  30019. var result = {};
  30020. for (var key in object) {
  30021. result[key] = object[key];
  30022. }
  30023. return result;
  30024. }
  30025. function advance(pos, n) {
  30026. var endOffset = pos.offset + n;
  30027. for (var offset = pos.offset; offset < endOffset; offset++) {
  30028. var ch = input.charAt(offset);
  30029. if (ch === "\n") {
  30030. if (!pos.seenCR) { pos.line++; }
  30031. pos.column = 1;
  30032. pos.seenCR = false;
  30033. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  30034. pos.line++;
  30035. pos.column = 1;
  30036. pos.seenCR = true;
  30037. } else {
  30038. pos.column++;
  30039. pos.seenCR = false;
  30040. }
  30041. }
  30042. pos.offset += n;
  30043. }
  30044. function matchFailed(failure) {
  30045. if (pos.offset < rightmostFailuresPos.offset) {
  30046. return;
  30047. }
  30048. if (pos.offset > rightmostFailuresPos.offset) {
  30049. rightmostFailuresPos = clone(pos);
  30050. rightmostFailuresExpected = [];
  30051. }
  30052. rightmostFailuresExpected.push(failure);
  30053. }
  30054. function parse_separator() {
  30055. var cacheKey = "separator@" + pos.offset;
  30056. var cachedResult = cache[cacheKey];
  30057. if (cachedResult) {
  30058. pos = clone(cachedResult.nextPos);
  30059. return cachedResult.result;
  30060. }
  30061. var result0, result1;
  30062. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  30063. result1 = input.charAt(pos.offset);
  30064. advance(pos, 1);
  30065. } else {
  30066. result1 = null;
  30067. if (reportFailures === 0) {
  30068. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  30069. }
  30070. }
  30071. if (result1 !== null) {
  30072. result0 = [];
  30073. while (result1 !== null) {
  30074. result0.push(result1);
  30075. if (/^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/.test(input.charAt(pos.offset))) {
  30076. result1 = input.charAt(pos.offset);
  30077. advance(pos, 1);
  30078. } else {
  30079. result1 = null;
  30080. if (reportFailures === 0) {
  30081. matchFailed("[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]");
  30082. }
  30083. }
  30084. }
  30085. } else {
  30086. result0 = null;
  30087. }
  30088. cache[cacheKey] = {
  30089. nextPos: clone(pos),
  30090. result: result0
  30091. };
  30092. return result0;
  30093. }
  30094. function parse_comments() {
  30095. var cacheKey = "comments@" + pos.offset;
  30096. var cachedResult = cache[cacheKey];
  30097. if (cachedResult) {
  30098. pos = clone(cachedResult.nextPos);
  30099. return cachedResult.result;
  30100. }
  30101. var result0, result1, result2, result3;
  30102. var pos0;
  30103. pos0 = clone(pos);
  30104. if (/^["]/.test(input.charAt(pos.offset))) {
  30105. result1 = input.charAt(pos.offset);
  30106. advance(pos, 1);
  30107. } else {
  30108. result1 = null;
  30109. if (reportFailures === 0) {
  30110. matchFailed("[\"]");
  30111. }
  30112. }
  30113. if (result1 !== null) {
  30114. result2 = [];
  30115. if (/^[^"]/.test(input.charAt(pos.offset))) {
  30116. result3 = input.charAt(pos.offset);
  30117. advance(pos, 1);
  30118. } else {
  30119. result3 = null;
  30120. if (reportFailures === 0) {
  30121. matchFailed("[^\"]");
  30122. }
  30123. }
  30124. while (result3 !== null) {
  30125. result2.push(result3);
  30126. if (/^[^"]/.test(input.charAt(pos.offset))) {
  30127. result3 = input.charAt(pos.offset);
  30128. advance(pos, 1);
  30129. } else {
  30130. result3 = null;
  30131. if (reportFailures === 0) {
  30132. matchFailed("[^\"]");
  30133. }
  30134. }
  30135. }
  30136. if (result2 !== null) {
  30137. if (/^["]/.test(input.charAt(pos.offset))) {
  30138. result3 = input.charAt(pos.offset);
  30139. advance(pos, 1);
  30140. } else {
  30141. result3 = null;
  30142. if (reportFailures === 0) {
  30143. matchFailed("[\"]");
  30144. }
  30145. }
  30146. if (result3 !== null) {
  30147. result1 = [result1, result2, result3];
  30148. } else {
  30149. result1 = null;
  30150. pos = clone(pos0);
  30151. }
  30152. } else {
  30153. result1 = null;
  30154. pos = clone(pos0);
  30155. }
  30156. } else {
  30157. result1 = null;
  30158. pos = clone(pos0);
  30159. }
  30160. if (result1 !== null) {
  30161. result0 = [];
  30162. while (result1 !== null) {
  30163. result0.push(result1);
  30164. pos0 = clone(pos);
  30165. if (/^["]/.test(input.charAt(pos.offset))) {
  30166. result1 = input.charAt(pos.offset);
  30167. advance(pos, 1);
  30168. } else {
  30169. result1 = null;
  30170. if (reportFailures === 0) {
  30171. matchFailed("[\"]");
  30172. }
  30173. }
  30174. if (result1 !== null) {
  30175. result2 = [];
  30176. if (/^[^"]/.test(input.charAt(pos.offset))) {
  30177. result3 = input.charAt(pos.offset);
  30178. advance(pos, 1);
  30179. } else {
  30180. result3 = null;
  30181. if (reportFailures === 0) {
  30182. matchFailed("[^\"]");
  30183. }
  30184. }
  30185. while (result3 !== null) {
  30186. result2.push(result3);
  30187. if (/^[^"]/.test(input.charAt(pos.offset))) {
  30188. result3 = input.charAt(pos.offset);
  30189. advance(pos, 1);
  30190. } else {
  30191. result3 = null;
  30192. if (reportFailures === 0) {
  30193. matchFailed("[^\"]");
  30194. }
  30195. }
  30196. }
  30197. if (result2 !== null) {
  30198. if (/^["]/.test(input.charAt(pos.offset))) {
  30199. result3 = input.charAt(pos.offset);
  30200. advance(pos, 1);
  30201. } else {
  30202. result3 = null;
  30203. if (reportFailures === 0) {
  30204. matchFailed("[\"]");
  30205. }
  30206. }
  30207. if (result3 !== null) {
  30208. result1 = [result1, result2, result3];
  30209. } else {
  30210. result1 = null;
  30211. pos = clone(pos0);
  30212. }
  30213. } else {
  30214. result1 = null;
  30215. pos = clone(pos0);
  30216. }
  30217. } else {
  30218. result1 = null;
  30219. pos = clone(pos0);
  30220. }
  30221. }
  30222. } else {
  30223. result0 = null;
  30224. }
  30225. cache[cacheKey] = {
  30226. nextPos: clone(pos),
  30227. result: result0
  30228. };
  30229. return result0;
  30230. }
  30231. function parse_ws() {
  30232. var cacheKey = "ws@" + pos.offset;
  30233. var cachedResult = cache[cacheKey];
  30234. if (cachedResult) {
  30235. pos = clone(cachedResult.nextPos);
  30236. return cachedResult.result;
  30237. }
  30238. var result0, result1;
  30239. result0 = [];
  30240. result1 = parse_separator();
  30241. if (result1 === null) {
  30242. result1 = parse_comments();
  30243. }
  30244. while (result1 !== null) {
  30245. result0.push(result1);
  30246. result1 = parse_separator();
  30247. if (result1 === null) {
  30248. result1 = parse_comments();
  30249. }
  30250. }
  30251. cache[cacheKey] = {
  30252. nextPos: clone(pos),
  30253. result: result0
  30254. };
  30255. return result0;
  30256. }
  30257. function parse_identifier() {
  30258. var cacheKey = "identifier@" + pos.offset;
  30259. var cachedResult = cache[cacheKey];
  30260. if (cachedResult) {
  30261. pos = clone(cachedResult.nextPos);
  30262. return cachedResult.result;
  30263. }
  30264. var result0, result1, result2;
  30265. var pos0, pos1;
  30266. pos0 = clone(pos);
  30267. pos1 = clone(pos);
  30268. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  30269. result0 = input.charAt(pos.offset);
  30270. advance(pos, 1);
  30271. } else {
  30272. result0 = null;
  30273. if (reportFailures === 0) {
  30274. matchFailed("[a-zA-Z]");
  30275. }
  30276. }
  30277. if (result0 !== null) {
  30278. result1 = [];
  30279. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  30280. result2 = input.charAt(pos.offset);
  30281. advance(pos, 1);
  30282. } else {
  30283. result2 = null;
  30284. if (reportFailures === 0) {
  30285. matchFailed("[a-zA-Z0-9]");
  30286. }
  30287. }
  30288. while (result2 !== null) {
  30289. result1.push(result2);
  30290. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  30291. result2 = input.charAt(pos.offset);
  30292. advance(pos, 1);
  30293. } else {
  30294. result2 = null;
  30295. if (reportFailures === 0) {
  30296. matchFailed("[a-zA-Z0-9]");
  30297. }
  30298. }
  30299. }
  30300. if (result1 !== null) {
  30301. result0 = [result0, result1];
  30302. } else {
  30303. result0 = null;
  30304. pos = clone(pos1);
  30305. }
  30306. } else {
  30307. result0 = null;
  30308. pos = clone(pos1);
  30309. }
  30310. if (result0 !== null) {
  30311. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30312. }
  30313. if (result0 === null) {
  30314. pos = clone(pos0);
  30315. }
  30316. cache[cacheKey] = {
  30317. nextPos: clone(pos),
  30318. result: result0
  30319. };
  30320. return result0;
  30321. }
  30322. function parse_keyword() {
  30323. var cacheKey = "keyword@" + pos.offset;
  30324. var cachedResult = cache[cacheKey];
  30325. if (cachedResult) {
  30326. pos = clone(cachedResult.nextPos);
  30327. return cachedResult.result;
  30328. }
  30329. var result0, result1;
  30330. var pos0, pos1;
  30331. pos0 = clone(pos);
  30332. pos1 = clone(pos);
  30333. result0 = parse_identifier();
  30334. if (result0 !== null) {
  30335. if (/^[:]/.test(input.charAt(pos.offset))) {
  30336. result1 = input.charAt(pos.offset);
  30337. advance(pos, 1);
  30338. } else {
  30339. result1 = null;
  30340. if (reportFailures === 0) {
  30341. matchFailed("[:]");
  30342. }
  30343. }
  30344. if (result1 !== null) {
  30345. result0 = [result0, result1];
  30346. } else {
  30347. result0 = null;
  30348. pos = clone(pos1);
  30349. }
  30350. } else {
  30351. result0 = null;
  30352. pos = clone(pos1);
  30353. }
  30354. if (result0 !== null) {
  30355. result0 = (function(offset, line, column, first, last) {return first + last;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30356. }
  30357. if (result0 === null) {
  30358. pos = clone(pos0);
  30359. }
  30360. cache[cacheKey] = {
  30361. nextPos: clone(pos),
  30362. result: result0
  30363. };
  30364. return result0;
  30365. }
  30366. function parse_selector() {
  30367. var cacheKey = "selector@" + pos.offset;
  30368. var cachedResult = cache[cacheKey];
  30369. if (cachedResult) {
  30370. pos = clone(cachedResult.nextPos);
  30371. return cachedResult.result;
  30372. }
  30373. var result0, result1, result2;
  30374. var pos0, pos1;
  30375. pos0 = clone(pos);
  30376. pos1 = clone(pos);
  30377. if (/^[a-zA-Z]/.test(input.charAt(pos.offset))) {
  30378. result0 = input.charAt(pos.offset);
  30379. advance(pos, 1);
  30380. } else {
  30381. result0 = null;
  30382. if (reportFailures === 0) {
  30383. matchFailed("[a-zA-Z]");
  30384. }
  30385. }
  30386. if (result0 !== null) {
  30387. result1 = [];
  30388. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  30389. result2 = input.charAt(pos.offset);
  30390. advance(pos, 1);
  30391. } else {
  30392. result2 = null;
  30393. if (reportFailures === 0) {
  30394. matchFailed("[a-zA-Z0-9:]");
  30395. }
  30396. }
  30397. while (result2 !== null) {
  30398. result1.push(result2);
  30399. if (/^[a-zA-Z0-9:]/.test(input.charAt(pos.offset))) {
  30400. result2 = input.charAt(pos.offset);
  30401. advance(pos, 1);
  30402. } else {
  30403. result2 = null;
  30404. if (reportFailures === 0) {
  30405. matchFailed("[a-zA-Z0-9:]");
  30406. }
  30407. }
  30408. }
  30409. if (result1 !== null) {
  30410. result0 = [result0, result1];
  30411. } else {
  30412. result0 = null;
  30413. pos = clone(pos1);
  30414. }
  30415. } else {
  30416. result0 = null;
  30417. pos = clone(pos1);
  30418. }
  30419. if (result0 !== null) {
  30420. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30421. }
  30422. if (result0 === null) {
  30423. pos = clone(pos0);
  30424. }
  30425. cache[cacheKey] = {
  30426. nextPos: clone(pos),
  30427. result: result0
  30428. };
  30429. return result0;
  30430. }
  30431. function parse_className() {
  30432. var cacheKey = "className@" + pos.offset;
  30433. var cachedResult = cache[cacheKey];
  30434. if (cachedResult) {
  30435. pos = clone(cachedResult.nextPos);
  30436. return cachedResult.result;
  30437. }
  30438. var result0, result1, result2;
  30439. var pos0, pos1;
  30440. pos0 = clone(pos);
  30441. pos1 = clone(pos);
  30442. if (/^[A-Z]/.test(input.charAt(pos.offset))) {
  30443. result0 = input.charAt(pos.offset);
  30444. advance(pos, 1);
  30445. } else {
  30446. result0 = null;
  30447. if (reportFailures === 0) {
  30448. matchFailed("[A-Z]");
  30449. }
  30450. }
  30451. if (result0 !== null) {
  30452. result1 = [];
  30453. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  30454. result2 = input.charAt(pos.offset);
  30455. advance(pos, 1);
  30456. } else {
  30457. result2 = null;
  30458. if (reportFailures === 0) {
  30459. matchFailed("[a-zA-Z0-9]");
  30460. }
  30461. }
  30462. while (result2 !== null) {
  30463. result1.push(result2);
  30464. if (/^[a-zA-Z0-9]/.test(input.charAt(pos.offset))) {
  30465. result2 = input.charAt(pos.offset);
  30466. advance(pos, 1);
  30467. } else {
  30468. result2 = null;
  30469. if (reportFailures === 0) {
  30470. matchFailed("[a-zA-Z0-9]");
  30471. }
  30472. }
  30473. }
  30474. if (result1 !== null) {
  30475. result0 = [result0, result1];
  30476. } else {
  30477. result0 = null;
  30478. pos = clone(pos1);
  30479. }
  30480. } else {
  30481. result0 = null;
  30482. pos = clone(pos1);
  30483. }
  30484. if (result0 !== null) {
  30485. result0 = (function(offset, line, column, first, others) {return first + others.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30486. }
  30487. if (result0 === null) {
  30488. pos = clone(pos0);
  30489. }
  30490. cache[cacheKey] = {
  30491. nextPos: clone(pos),
  30492. result: result0
  30493. };
  30494. return result0;
  30495. }
  30496. function parse_string() {
  30497. var cacheKey = "string@" + pos.offset;
  30498. var cachedResult = cache[cacheKey];
  30499. if (cachedResult) {
  30500. pos = clone(cachedResult.nextPos);
  30501. return cachedResult.result;
  30502. }
  30503. var result0, result1, result2;
  30504. var pos0, pos1, pos2;
  30505. pos0 = clone(pos);
  30506. pos1 = clone(pos);
  30507. if (/^[']/.test(input.charAt(pos.offset))) {
  30508. result0 = input.charAt(pos.offset);
  30509. advance(pos, 1);
  30510. } else {
  30511. result0 = null;
  30512. if (reportFailures === 0) {
  30513. matchFailed("[']");
  30514. }
  30515. }
  30516. if (result0 !== null) {
  30517. result1 = [];
  30518. pos2 = clone(pos);
  30519. if (input.substr(pos.offset, 2) === "''") {
  30520. result2 = "''";
  30521. advance(pos, 2);
  30522. } else {
  30523. result2 = null;
  30524. if (reportFailures === 0) {
  30525. matchFailed("\"''\"");
  30526. }
  30527. }
  30528. if (result2 !== null) {
  30529. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  30530. }
  30531. if (result2 === null) {
  30532. pos = clone(pos2);
  30533. }
  30534. if (result2 === null) {
  30535. if (/^[^']/.test(input.charAt(pos.offset))) {
  30536. result2 = input.charAt(pos.offset);
  30537. advance(pos, 1);
  30538. } else {
  30539. result2 = null;
  30540. if (reportFailures === 0) {
  30541. matchFailed("[^']");
  30542. }
  30543. }
  30544. }
  30545. while (result2 !== null) {
  30546. result1.push(result2);
  30547. pos2 = clone(pos);
  30548. if (input.substr(pos.offset, 2) === "''") {
  30549. result2 = "''";
  30550. advance(pos, 2);
  30551. } else {
  30552. result2 = null;
  30553. if (reportFailures === 0) {
  30554. matchFailed("\"''\"");
  30555. }
  30556. }
  30557. if (result2 !== null) {
  30558. result2 = (function(offset, line, column) {return "'";})(pos2.offset, pos2.line, pos2.column);
  30559. }
  30560. if (result2 === null) {
  30561. pos = clone(pos2);
  30562. }
  30563. if (result2 === null) {
  30564. if (/^[^']/.test(input.charAt(pos.offset))) {
  30565. result2 = input.charAt(pos.offset);
  30566. advance(pos, 1);
  30567. } else {
  30568. result2 = null;
  30569. if (reportFailures === 0) {
  30570. matchFailed("[^']");
  30571. }
  30572. }
  30573. }
  30574. }
  30575. if (result1 !== null) {
  30576. if (/^[']/.test(input.charAt(pos.offset))) {
  30577. result2 = input.charAt(pos.offset);
  30578. advance(pos, 1);
  30579. } else {
  30580. result2 = null;
  30581. if (reportFailures === 0) {
  30582. matchFailed("[']");
  30583. }
  30584. }
  30585. if (result2 !== null) {
  30586. result0 = [result0, result1, result2];
  30587. } else {
  30588. result0 = null;
  30589. pos = clone(pos1);
  30590. }
  30591. } else {
  30592. result0 = null;
  30593. pos = clone(pos1);
  30594. }
  30595. } else {
  30596. result0 = null;
  30597. pos = clone(pos1);
  30598. }
  30599. if (result0 !== null) {
  30600. result0 = (function(offset, line, column, val) {
  30601. return smalltalk.ValueNode._new()
  30602. ._position_((line).__at(column))
  30603. ._value_(val.join("").replace(/\"/ig, '"'));
  30604. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  30605. }
  30606. if (result0 === null) {
  30607. pos = clone(pos0);
  30608. }
  30609. cache[cacheKey] = {
  30610. nextPos: clone(pos),
  30611. result: result0
  30612. };
  30613. return result0;
  30614. }
  30615. function parse_symbol() {
  30616. var cacheKey = "symbol@" + pos.offset;
  30617. var cachedResult = cache[cacheKey];
  30618. if (cachedResult) {
  30619. pos = clone(cachedResult.nextPos);
  30620. return cachedResult.result;
  30621. }
  30622. var result0, result1;
  30623. var pos0, pos1;
  30624. pos0 = clone(pos);
  30625. pos1 = clone(pos);
  30626. if (input.charCodeAt(pos.offset) === 35) {
  30627. result0 = "#";
  30628. advance(pos, 1);
  30629. } else {
  30630. result0 = null;
  30631. if (reportFailures === 0) {
  30632. matchFailed("\"#\"");
  30633. }
  30634. }
  30635. if (result0 !== null) {
  30636. result1 = parse_bareSymbol();
  30637. if (result1 !== null) {
  30638. result0 = [result0, result1];
  30639. } else {
  30640. result0 = null;
  30641. pos = clone(pos1);
  30642. }
  30643. } else {
  30644. result0 = null;
  30645. pos = clone(pos1);
  30646. }
  30647. if (result0 !== null) {
  30648. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  30649. }
  30650. if (result0 === null) {
  30651. pos = clone(pos0);
  30652. }
  30653. cache[cacheKey] = {
  30654. nextPos: clone(pos),
  30655. result: result0
  30656. };
  30657. return result0;
  30658. }
  30659. function parse_bareSymbol() {
  30660. var cacheKey = "bareSymbol@" + pos.offset;
  30661. var cachedResult = cache[cacheKey];
  30662. if (cachedResult) {
  30663. pos = clone(cachedResult.nextPos);
  30664. return cachedResult.result;
  30665. }
  30666. var result0;
  30667. var pos0, pos1;
  30668. pos0 = clone(pos);
  30669. result0 = parse_selector();
  30670. if (result0 === null) {
  30671. result0 = parse_binarySelector();
  30672. if (result0 === null) {
  30673. pos1 = clone(pos);
  30674. result0 = parse_string();
  30675. if (result0 !== null) {
  30676. result0 = (function(offset, line, column, node) {return node._value();})(pos1.offset, pos1.line, pos1.column, result0);
  30677. }
  30678. if (result0 === null) {
  30679. pos = clone(pos1);
  30680. }
  30681. }
  30682. }
  30683. if (result0 !== null) {
  30684. result0 = (function(offset, line, column, val) {
  30685. return smalltalk.ValueNode._new()
  30686. ._position_((line).__at(column))
  30687. ._value_(val);
  30688. })(pos0.offset, pos0.line, pos0.column, result0);
  30689. }
  30690. if (result0 === null) {
  30691. pos = clone(pos0);
  30692. }
  30693. cache[cacheKey] = {
  30694. nextPos: clone(pos),
  30695. result: result0
  30696. };
  30697. return result0;
  30698. }
  30699. function parse_number() {
  30700. var cacheKey = "number@" + pos.offset;
  30701. var cachedResult = cache[cacheKey];
  30702. if (cachedResult) {
  30703. pos = clone(cachedResult.nextPos);
  30704. return cachedResult.result;
  30705. }
  30706. var result0;
  30707. var pos0;
  30708. pos0 = clone(pos);
  30709. result0 = parse_hex();
  30710. if (result0 === null) {
  30711. result0 = parse_float();
  30712. if (result0 === null) {
  30713. result0 = parse_integer();
  30714. }
  30715. }
  30716. if (result0 !== null) {
  30717. result0 = (function(offset, line, column, n) {
  30718. return smalltalk.ValueNode._new()
  30719. ._position_((line).__at(column))
  30720. ._value_(n);
  30721. })(pos0.offset, pos0.line, pos0.column, result0);
  30722. }
  30723. if (result0 === null) {
  30724. pos = clone(pos0);
  30725. }
  30726. cache[cacheKey] = {
  30727. nextPos: clone(pos),
  30728. result: result0
  30729. };
  30730. return result0;
  30731. }
  30732. function parse_hex() {
  30733. var cacheKey = "hex@" + pos.offset;
  30734. var cachedResult = cache[cacheKey];
  30735. if (cachedResult) {
  30736. pos = clone(cachedResult.nextPos);
  30737. return cachedResult.result;
  30738. }
  30739. var result0, result1, result2, result3;
  30740. var pos0, pos1;
  30741. pos0 = clone(pos);
  30742. pos1 = clone(pos);
  30743. if (/^[\-]/.test(input.charAt(pos.offset))) {
  30744. result0 = input.charAt(pos.offset);
  30745. advance(pos, 1);
  30746. } else {
  30747. result0 = null;
  30748. if (reportFailures === 0) {
  30749. matchFailed("[\\-]");
  30750. }
  30751. }
  30752. result0 = result0 !== null ? result0 : "";
  30753. if (result0 !== null) {
  30754. if (input.substr(pos.offset, 3) === "16r") {
  30755. result1 = "16r";
  30756. advance(pos, 3);
  30757. } else {
  30758. result1 = null;
  30759. if (reportFailures === 0) {
  30760. matchFailed("\"16r\"");
  30761. }
  30762. }
  30763. if (result1 !== null) {
  30764. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  30765. result3 = input.charAt(pos.offset);
  30766. advance(pos, 1);
  30767. } else {
  30768. result3 = null;
  30769. if (reportFailures === 0) {
  30770. matchFailed("[0-9a-fA-F]");
  30771. }
  30772. }
  30773. if (result3 !== null) {
  30774. result2 = [];
  30775. while (result3 !== null) {
  30776. result2.push(result3);
  30777. if (/^[0-9a-fA-F]/.test(input.charAt(pos.offset))) {
  30778. result3 = input.charAt(pos.offset);
  30779. advance(pos, 1);
  30780. } else {
  30781. result3 = null;
  30782. if (reportFailures === 0) {
  30783. matchFailed("[0-9a-fA-F]");
  30784. }
  30785. }
  30786. }
  30787. } else {
  30788. result2 = null;
  30789. }
  30790. if (result2 !== null) {
  30791. result0 = [result0, result1, result2];
  30792. } else {
  30793. result0 = null;
  30794. pos = clone(pos1);
  30795. }
  30796. } else {
  30797. result0 = null;
  30798. pos = clone(pos1);
  30799. }
  30800. } else {
  30801. result0 = null;
  30802. pos = clone(pos1);
  30803. }
  30804. if (result0 !== null) {
  30805. result0 = (function(offset, line, column, neg, num) {return parseInt((neg + num.join("")), 16);})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  30806. }
  30807. if (result0 === null) {
  30808. pos = clone(pos0);
  30809. }
  30810. cache[cacheKey] = {
  30811. nextPos: clone(pos),
  30812. result: result0
  30813. };
  30814. return result0;
  30815. }
  30816. function parse_float() {
  30817. var cacheKey = "float@" + pos.offset;
  30818. var cachedResult = cache[cacheKey];
  30819. if (cachedResult) {
  30820. pos = clone(cachedResult.nextPos);
  30821. return cachedResult.result;
  30822. }
  30823. var result0, result1, result2, result3, result4;
  30824. var pos0, pos1;
  30825. pos0 = clone(pos);
  30826. pos1 = clone(pos);
  30827. if (/^[\-]/.test(input.charAt(pos.offset))) {
  30828. result0 = input.charAt(pos.offset);
  30829. advance(pos, 1);
  30830. } else {
  30831. result0 = null;
  30832. if (reportFailures === 0) {
  30833. matchFailed("[\\-]");
  30834. }
  30835. }
  30836. result0 = result0 !== null ? result0 : "";
  30837. if (result0 !== null) {
  30838. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30839. result2 = input.charAt(pos.offset);
  30840. advance(pos, 1);
  30841. } else {
  30842. result2 = null;
  30843. if (reportFailures === 0) {
  30844. matchFailed("[0-9]");
  30845. }
  30846. }
  30847. if (result2 !== null) {
  30848. result1 = [];
  30849. while (result2 !== null) {
  30850. result1.push(result2);
  30851. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30852. result2 = input.charAt(pos.offset);
  30853. advance(pos, 1);
  30854. } else {
  30855. result2 = null;
  30856. if (reportFailures === 0) {
  30857. matchFailed("[0-9]");
  30858. }
  30859. }
  30860. }
  30861. } else {
  30862. result1 = null;
  30863. }
  30864. if (result1 !== null) {
  30865. if (input.charCodeAt(pos.offset) === 46) {
  30866. result2 = ".";
  30867. advance(pos, 1);
  30868. } else {
  30869. result2 = null;
  30870. if (reportFailures === 0) {
  30871. matchFailed("\".\"");
  30872. }
  30873. }
  30874. if (result2 !== null) {
  30875. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30876. result4 = input.charAt(pos.offset);
  30877. advance(pos, 1);
  30878. } else {
  30879. result4 = null;
  30880. if (reportFailures === 0) {
  30881. matchFailed("[0-9]");
  30882. }
  30883. }
  30884. if (result4 !== null) {
  30885. result3 = [];
  30886. while (result4 !== null) {
  30887. result3.push(result4);
  30888. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30889. result4 = input.charAt(pos.offset);
  30890. advance(pos, 1);
  30891. } else {
  30892. result4 = null;
  30893. if (reportFailures === 0) {
  30894. matchFailed("[0-9]");
  30895. }
  30896. }
  30897. }
  30898. } else {
  30899. result3 = null;
  30900. }
  30901. if (result3 !== null) {
  30902. result0 = [result0, result1, result2, result3];
  30903. } else {
  30904. result0 = null;
  30905. pos = clone(pos1);
  30906. }
  30907. } else {
  30908. result0 = null;
  30909. pos = clone(pos1);
  30910. }
  30911. } else {
  30912. result0 = null;
  30913. pos = clone(pos1);
  30914. }
  30915. } else {
  30916. result0 = null;
  30917. pos = clone(pos1);
  30918. }
  30919. if (result0 !== null) {
  30920. result0 = (function(offset, line, column, neg, digits, dec) {return parseFloat((neg + digits.join("") + "." + dec.join("")), 10);})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1], result0[3]);
  30921. }
  30922. if (result0 === null) {
  30923. pos = clone(pos0);
  30924. }
  30925. cache[cacheKey] = {
  30926. nextPos: clone(pos),
  30927. result: result0
  30928. };
  30929. return result0;
  30930. }
  30931. function parse_integer() {
  30932. var cacheKey = "integer@" + pos.offset;
  30933. var cachedResult = cache[cacheKey];
  30934. if (cachedResult) {
  30935. pos = clone(cachedResult.nextPos);
  30936. return cachedResult.result;
  30937. }
  30938. var result0, result1, result2;
  30939. var pos0, pos1;
  30940. pos0 = clone(pos);
  30941. pos1 = clone(pos);
  30942. if (/^[\-]/.test(input.charAt(pos.offset))) {
  30943. result0 = input.charAt(pos.offset);
  30944. advance(pos, 1);
  30945. } else {
  30946. result0 = null;
  30947. if (reportFailures === 0) {
  30948. matchFailed("[\\-]");
  30949. }
  30950. }
  30951. result0 = result0 !== null ? result0 : "";
  30952. if (result0 !== null) {
  30953. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30954. result2 = input.charAt(pos.offset);
  30955. advance(pos, 1);
  30956. } else {
  30957. result2 = null;
  30958. if (reportFailures === 0) {
  30959. matchFailed("[0-9]");
  30960. }
  30961. }
  30962. if (result2 !== null) {
  30963. result1 = [];
  30964. while (result2 !== null) {
  30965. result1.push(result2);
  30966. if (/^[0-9]/.test(input.charAt(pos.offset))) {
  30967. result2 = input.charAt(pos.offset);
  30968. advance(pos, 1);
  30969. } else {
  30970. result2 = null;
  30971. if (reportFailures === 0) {
  30972. matchFailed("[0-9]");
  30973. }
  30974. }
  30975. }
  30976. } else {
  30977. result1 = null;
  30978. }
  30979. if (result1 !== null) {
  30980. result0 = [result0, result1];
  30981. } else {
  30982. result0 = null;
  30983. pos = clone(pos1);
  30984. }
  30985. } else {
  30986. result0 = null;
  30987. pos = clone(pos1);
  30988. }
  30989. if (result0 !== null) {
  30990. result0 = (function(offset, line, column, neg, digits) {return (parseInt(neg+digits.join(""), 10));})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  30991. }
  30992. if (result0 === null) {
  30993. pos = clone(pos0);
  30994. }
  30995. cache[cacheKey] = {
  30996. nextPos: clone(pos),
  30997. result: result0
  30998. };
  30999. return result0;
  31000. }
  31001. function parse_literalArray() {
  31002. var cacheKey = "literalArray@" + pos.offset;
  31003. var cachedResult = cache[cacheKey];
  31004. if (cachedResult) {
  31005. pos = clone(cachedResult.nextPos);
  31006. return cachedResult.result;
  31007. }
  31008. var result0, result1;
  31009. var pos0, pos1;
  31010. pos0 = clone(pos);
  31011. pos1 = clone(pos);
  31012. if (input.substr(pos.offset, 2) === "#(") {
  31013. result0 = "#(";
  31014. advance(pos, 2);
  31015. } else {
  31016. result0 = null;
  31017. if (reportFailures === 0) {
  31018. matchFailed("\"#(\"");
  31019. }
  31020. }
  31021. if (result0 !== null) {
  31022. result1 = parse_literalArrayRest();
  31023. if (result1 !== null) {
  31024. result0 = [result0, result1];
  31025. } else {
  31026. result0 = null;
  31027. pos = clone(pos1);
  31028. }
  31029. } else {
  31030. result0 = null;
  31031. pos = clone(pos1);
  31032. }
  31033. if (result0 !== null) {
  31034. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  31035. }
  31036. if (result0 === null) {
  31037. pos = clone(pos0);
  31038. }
  31039. cache[cacheKey] = {
  31040. nextPos: clone(pos),
  31041. result: result0
  31042. };
  31043. return result0;
  31044. }
  31045. function parse_bareLiteralArray() {
  31046. var cacheKey = "bareLiteralArray@" + pos.offset;
  31047. var cachedResult = cache[cacheKey];
  31048. if (cachedResult) {
  31049. pos = clone(cachedResult.nextPos);
  31050. return cachedResult.result;
  31051. }
  31052. var result0, result1;
  31053. var pos0, pos1;
  31054. pos0 = clone(pos);
  31055. pos1 = clone(pos);
  31056. if (input.charCodeAt(pos.offset) === 40) {
  31057. result0 = "(";
  31058. advance(pos, 1);
  31059. } else {
  31060. result0 = null;
  31061. if (reportFailures === 0) {
  31062. matchFailed("\"(\"");
  31063. }
  31064. }
  31065. if (result0 !== null) {
  31066. result1 = parse_literalArrayRest();
  31067. if (result1 !== null) {
  31068. result0 = [result0, result1];
  31069. } else {
  31070. result0 = null;
  31071. pos = clone(pos1);
  31072. }
  31073. } else {
  31074. result0 = null;
  31075. pos = clone(pos1);
  31076. }
  31077. if (result0 !== null) {
  31078. result0 = (function(offset, line, column, rest) {return rest;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  31079. }
  31080. if (result0 === null) {
  31081. pos = clone(pos0);
  31082. }
  31083. cache[cacheKey] = {
  31084. nextPos: clone(pos),
  31085. result: result0
  31086. };
  31087. return result0;
  31088. }
  31089. function parse_literalArrayRest() {
  31090. var cacheKey = "literalArrayRest@" + pos.offset;
  31091. var cachedResult = cache[cacheKey];
  31092. if (cachedResult) {
  31093. pos = clone(cachedResult.nextPos);
  31094. return cachedResult.result;
  31095. }
  31096. var result0, result1, result2, result3;
  31097. var pos0, pos1, pos2, pos3;
  31098. pos0 = clone(pos);
  31099. pos1 = clone(pos);
  31100. result0 = parse_ws();
  31101. if (result0 !== null) {
  31102. result1 = [];
  31103. pos2 = clone(pos);
  31104. pos3 = clone(pos);
  31105. result2 = parse_parseTimeLiteral();
  31106. if (result2 === null) {
  31107. result2 = parse_bareLiteralArray();
  31108. if (result2 === null) {
  31109. result2 = parse_bareSymbol();
  31110. }
  31111. }
  31112. if (result2 !== null) {
  31113. result3 = parse_ws();
  31114. if (result3 !== null) {
  31115. result2 = [result2, result3];
  31116. } else {
  31117. result2 = null;
  31118. pos = clone(pos3);
  31119. }
  31120. } else {
  31121. result2 = null;
  31122. pos = clone(pos3);
  31123. }
  31124. if (result2 !== null) {
  31125. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31126. }
  31127. if (result2 === null) {
  31128. pos = clone(pos2);
  31129. }
  31130. while (result2 !== null) {
  31131. result1.push(result2);
  31132. pos2 = clone(pos);
  31133. pos3 = clone(pos);
  31134. result2 = parse_parseTimeLiteral();
  31135. if (result2 === null) {
  31136. result2 = parse_bareLiteralArray();
  31137. if (result2 === null) {
  31138. result2 = parse_bareSymbol();
  31139. }
  31140. }
  31141. if (result2 !== null) {
  31142. result3 = parse_ws();
  31143. if (result3 !== null) {
  31144. result2 = [result2, result3];
  31145. } else {
  31146. result2 = null;
  31147. pos = clone(pos3);
  31148. }
  31149. } else {
  31150. result2 = null;
  31151. pos = clone(pos3);
  31152. }
  31153. if (result2 !== null) {
  31154. result2 = (function(offset, line, column, lit) {return lit._value();})(pos2.offset, pos2.line, pos2.column, result2[0]);
  31155. }
  31156. if (result2 === null) {
  31157. pos = clone(pos2);
  31158. }
  31159. }
  31160. if (result1 !== null) {
  31161. result2 = parse_ws();
  31162. if (result2 !== null) {
  31163. if (input.charCodeAt(pos.offset) === 41) {
  31164. result3 = ")";
  31165. advance(pos, 1);
  31166. } else {
  31167. result3 = null;
  31168. if (reportFailures === 0) {
  31169. matchFailed("\")\"");
  31170. }
  31171. }
  31172. if (result3 !== null) {
  31173. result0 = [result0, result1, result2, result3];
  31174. } else {
  31175. result0 = null;
  31176. pos = clone(pos1);
  31177. }
  31178. } else {
  31179. result0 = null;
  31180. pos = clone(pos1);
  31181. }
  31182. } else {
  31183. result0 = null;
  31184. pos = clone(pos1);
  31185. }
  31186. } else {
  31187. result0 = null;
  31188. pos = clone(pos1);
  31189. }
  31190. if (result0 !== null) {
  31191. result0 = (function(offset, line, column, lits) {
  31192. return smalltalk.ValueNode._new()
  31193. ._position_((line).__at(column))
  31194. ._value_(lits);
  31195. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  31196. }
  31197. if (result0 === null) {
  31198. pos = clone(pos0);
  31199. }
  31200. cache[cacheKey] = {
  31201. nextPos: clone(pos),
  31202. result: result0
  31203. };
  31204. return result0;
  31205. }
  31206. function parse_dynamicArray() {
  31207. var cacheKey = "dynamicArray@" + pos.offset;
  31208. var cachedResult = cache[cacheKey];
  31209. if (cachedResult) {
  31210. pos = clone(cachedResult.nextPos);
  31211. return cachedResult.result;
  31212. }
  31213. var result0, result1, result2, result3, result4, result5;
  31214. var pos0, pos1;
  31215. pos0 = clone(pos);
  31216. pos1 = clone(pos);
  31217. if (input.charCodeAt(pos.offset) === 123) {
  31218. result0 = "{";
  31219. advance(pos, 1);
  31220. } else {
  31221. result0 = null;
  31222. if (reportFailures === 0) {
  31223. matchFailed("\"{\"");
  31224. }
  31225. }
  31226. if (result0 !== null) {
  31227. result1 = parse_ws();
  31228. if (result1 !== null) {
  31229. result2 = parse_expressions();
  31230. result2 = result2 !== null ? result2 : "";
  31231. if (result2 !== null) {
  31232. result3 = parse_ws();
  31233. if (result3 !== null) {
  31234. if (input.charCodeAt(pos.offset) === 46) {
  31235. result4 = ".";
  31236. advance(pos, 1);
  31237. } else {
  31238. result4 = null;
  31239. if (reportFailures === 0) {
  31240. matchFailed("\".\"");
  31241. }
  31242. }
  31243. result4 = result4 !== null ? result4 : "";
  31244. if (result4 !== null) {
  31245. if (input.charCodeAt(pos.offset) === 125) {
  31246. result5 = "}";
  31247. advance(pos, 1);
  31248. } else {
  31249. result5 = null;
  31250. if (reportFailures === 0) {
  31251. matchFailed("\"}\"");
  31252. }
  31253. }
  31254. if (result5 !== null) {
  31255. result0 = [result0, result1, result2, result3, result4, result5];
  31256. } else {
  31257. result0 = null;
  31258. pos = clone(pos1);
  31259. }
  31260. } else {
  31261. result0 = null;
  31262. pos = clone(pos1);
  31263. }
  31264. } else {
  31265. result0 = null;
  31266. pos = clone(pos1);
  31267. }
  31268. } else {
  31269. result0 = null;
  31270. pos = clone(pos1);
  31271. }
  31272. } else {
  31273. result0 = null;
  31274. pos = clone(pos1);
  31275. }
  31276. } else {
  31277. result0 = null;
  31278. pos = clone(pos1);
  31279. }
  31280. if (result0 !== null) {
  31281. result0 = (function(offset, line, column, expressions) {
  31282. return smalltalk.DynamicArrayNode._new()
  31283. ._position_((line).__at(column))
  31284. ._nodes_(expressions);
  31285. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  31286. }
  31287. if (result0 === null) {
  31288. pos = clone(pos0);
  31289. }
  31290. cache[cacheKey] = {
  31291. nextPos: clone(pos),
  31292. result: result0
  31293. };
  31294. return result0;
  31295. }
  31296. function parse_dynamicDictionary() {
  31297. var cacheKey = "dynamicDictionary@" + pos.offset;
  31298. var cachedResult = cache[cacheKey];
  31299. if (cachedResult) {
  31300. pos = clone(cachedResult.nextPos);
  31301. return cachedResult.result;
  31302. }
  31303. var result0, result1, result2, result3, result4;
  31304. var pos0, pos1;
  31305. pos0 = clone(pos);
  31306. pos1 = clone(pos);
  31307. if (input.substr(pos.offset, 2) === "#{") {
  31308. result0 = "#{";
  31309. advance(pos, 2);
  31310. } else {
  31311. result0 = null;
  31312. if (reportFailures === 0) {
  31313. matchFailed("\"#{\"");
  31314. }
  31315. }
  31316. if (result0 !== null) {
  31317. result1 = parse_ws();
  31318. if (result1 !== null) {
  31319. result2 = parse_expressions();
  31320. result2 = result2 !== null ? result2 : "";
  31321. if (result2 !== null) {
  31322. result3 = parse_ws();
  31323. if (result3 !== null) {
  31324. if (input.charCodeAt(pos.offset) === 125) {
  31325. result4 = "}";
  31326. advance(pos, 1);
  31327. } else {
  31328. result4 = null;
  31329. if (reportFailures === 0) {
  31330. matchFailed("\"}\"");
  31331. }
  31332. }
  31333. if (result4 !== null) {
  31334. result0 = [result0, result1, result2, result3, result4];
  31335. } else {
  31336. result0 = null;
  31337. pos = clone(pos1);
  31338. }
  31339. } else {
  31340. result0 = null;
  31341. pos = clone(pos1);
  31342. }
  31343. } else {
  31344. result0 = null;
  31345. pos = clone(pos1);
  31346. }
  31347. } else {
  31348. result0 = null;
  31349. pos = clone(pos1);
  31350. }
  31351. } else {
  31352. result0 = null;
  31353. pos = clone(pos1);
  31354. }
  31355. if (result0 !== null) {
  31356. result0 = (function(offset, line, column, expressions) {
  31357. return smalltalk.DynamicDictionaryNode._new()
  31358. ._position_((line).__at(column))
  31359. ._nodes_(expressions);
  31360. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  31361. }
  31362. if (result0 === null) {
  31363. pos = clone(pos0);
  31364. }
  31365. cache[cacheKey] = {
  31366. nextPos: clone(pos),
  31367. result: result0
  31368. };
  31369. return result0;
  31370. }
  31371. function parse_pseudoVariable() {
  31372. var cacheKey = "pseudoVariable@" + pos.offset;
  31373. var cachedResult = cache[cacheKey];
  31374. if (cachedResult) {
  31375. pos = clone(cachedResult.nextPos);
  31376. return cachedResult.result;
  31377. }
  31378. var result0;
  31379. var pos0, pos1;
  31380. pos0 = clone(pos);
  31381. pos1 = clone(pos);
  31382. if (input.substr(pos.offset, 4) === "true") {
  31383. result0 = "true";
  31384. advance(pos, 4);
  31385. } else {
  31386. result0 = null;
  31387. if (reportFailures === 0) {
  31388. matchFailed("\"true\"");
  31389. }
  31390. }
  31391. if (result0 !== null) {
  31392. result0 = (function(offset, line, column) {return true;})(pos1.offset, pos1.line, pos1.column);
  31393. }
  31394. if (result0 === null) {
  31395. pos = clone(pos1);
  31396. }
  31397. if (result0 === null) {
  31398. pos1 = clone(pos);
  31399. if (input.substr(pos.offset, 5) === "false") {
  31400. result0 = "false";
  31401. advance(pos, 5);
  31402. } else {
  31403. result0 = null;
  31404. if (reportFailures === 0) {
  31405. matchFailed("\"false\"");
  31406. }
  31407. }
  31408. if (result0 !== null) {
  31409. result0 = (function(offset, line, column) {return false;})(pos1.offset, pos1.line, pos1.column);
  31410. }
  31411. if (result0 === null) {
  31412. pos = clone(pos1);
  31413. }
  31414. if (result0 === null) {
  31415. pos1 = clone(pos);
  31416. if (input.substr(pos.offset, 3) === "nil") {
  31417. result0 = "nil";
  31418. advance(pos, 3);
  31419. } else {
  31420. result0 = null;
  31421. if (reportFailures === 0) {
  31422. matchFailed("\"nil\"");
  31423. }
  31424. }
  31425. if (result0 !== null) {
  31426. result0 = (function(offset, line, column) {return nil;})(pos1.offset, pos1.line, pos1.column);
  31427. }
  31428. if (result0 === null) {
  31429. pos = clone(pos1);
  31430. }
  31431. }
  31432. }
  31433. if (result0 !== null) {
  31434. result0 = (function(offset, line, column, val) {
  31435. return smalltalk.ValueNode._new()
  31436. ._position_((line).__at(column))
  31437. ._value_(val);
  31438. })(pos0.offset, pos0.line, pos0.column, result0);
  31439. }
  31440. if (result0 === null) {
  31441. pos = clone(pos0);
  31442. }
  31443. cache[cacheKey] = {
  31444. nextPos: clone(pos),
  31445. result: result0
  31446. };
  31447. return result0;
  31448. }
  31449. function parse_parseTimeLiteral() {
  31450. var cacheKey = "parseTimeLiteral@" + pos.offset;
  31451. var cachedResult = cache[cacheKey];
  31452. if (cachedResult) {
  31453. pos = clone(cachedResult.nextPos);
  31454. return cachedResult.result;
  31455. }
  31456. var result0;
  31457. result0 = parse_pseudoVariable();
  31458. if (result0 === null) {
  31459. result0 = parse_number();
  31460. if (result0 === null) {
  31461. result0 = parse_literalArray();
  31462. if (result0 === null) {
  31463. result0 = parse_string();
  31464. if (result0 === null) {
  31465. result0 = parse_symbol();
  31466. }
  31467. }
  31468. }
  31469. }
  31470. cache[cacheKey] = {
  31471. nextPos: clone(pos),
  31472. result: result0
  31473. };
  31474. return result0;
  31475. }
  31476. function parse_runtimeLiteral() {
  31477. var cacheKey = "runtimeLiteral@" + pos.offset;
  31478. var cachedResult = cache[cacheKey];
  31479. if (cachedResult) {
  31480. pos = clone(cachedResult.nextPos);
  31481. return cachedResult.result;
  31482. }
  31483. var result0;
  31484. result0 = parse_dynamicDictionary();
  31485. if (result0 === null) {
  31486. result0 = parse_dynamicArray();
  31487. if (result0 === null) {
  31488. result0 = parse_block();
  31489. }
  31490. }
  31491. cache[cacheKey] = {
  31492. nextPos: clone(pos),
  31493. result: result0
  31494. };
  31495. return result0;
  31496. }
  31497. function parse_literal() {
  31498. var cacheKey = "literal@" + pos.offset;
  31499. var cachedResult = cache[cacheKey];
  31500. if (cachedResult) {
  31501. pos = clone(cachedResult.nextPos);
  31502. return cachedResult.result;
  31503. }
  31504. var result0;
  31505. result0 = parse_runtimeLiteral();
  31506. if (result0 === null) {
  31507. result0 = parse_parseTimeLiteral();
  31508. }
  31509. cache[cacheKey] = {
  31510. nextPos: clone(pos),
  31511. result: result0
  31512. };
  31513. return result0;
  31514. }
  31515. function parse_variable() {
  31516. var cacheKey = "variable@" + pos.offset;
  31517. var cachedResult = cache[cacheKey];
  31518. if (cachedResult) {
  31519. pos = clone(cachedResult.nextPos);
  31520. return cachedResult.result;
  31521. }
  31522. var result0;
  31523. var pos0;
  31524. pos0 = clone(pos);
  31525. result0 = parse_identifier();
  31526. if (result0 !== null) {
  31527. result0 = (function(offset, line, column, identifier) {
  31528. return smalltalk.VariableNode._new()
  31529. ._position_((line).__at(column))
  31530. ._value_(identifier);
  31531. })(pos0.offset, pos0.line, pos0.column, result0);
  31532. }
  31533. if (result0 === null) {
  31534. pos = clone(pos0);
  31535. }
  31536. cache[cacheKey] = {
  31537. nextPos: clone(pos),
  31538. result: result0
  31539. };
  31540. return result0;
  31541. }
  31542. function parse_keywordPair() {
  31543. var cacheKey = "keywordPair@" + pos.offset;
  31544. var cachedResult = cache[cacheKey];
  31545. if (cachedResult) {
  31546. pos = clone(cachedResult.nextPos);
  31547. return cachedResult.result;
  31548. }
  31549. var result0, result1, result2, result3;
  31550. var pos0, pos1;
  31551. pos0 = clone(pos);
  31552. pos1 = clone(pos);
  31553. result0 = parse_keyword();
  31554. if (result0 !== null) {
  31555. result1 = parse_ws();
  31556. if (result1 !== null) {
  31557. result2 = parse_binarySend();
  31558. if (result2 !== null) {
  31559. result3 = parse_ws();
  31560. if (result3 !== null) {
  31561. result0 = [result0, result1, result2, result3];
  31562. } else {
  31563. result0 = null;
  31564. pos = clone(pos1);
  31565. }
  31566. } else {
  31567. result0 = null;
  31568. pos = clone(pos1);
  31569. }
  31570. } else {
  31571. result0 = null;
  31572. pos = clone(pos1);
  31573. }
  31574. } else {
  31575. result0 = null;
  31576. pos = clone(pos1);
  31577. }
  31578. if (result0 !== null) {
  31579. result0 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  31580. }
  31581. if (result0 === null) {
  31582. pos = clone(pos0);
  31583. }
  31584. cache[cacheKey] = {
  31585. nextPos: clone(pos),
  31586. result: result0
  31587. };
  31588. return result0;
  31589. }
  31590. function parse_binarySelector() {
  31591. var cacheKey = "binarySelector@" + pos.offset;
  31592. var cachedResult = cache[cacheKey];
  31593. if (cachedResult) {
  31594. pos = clone(cachedResult.nextPos);
  31595. return cachedResult.result;
  31596. }
  31597. var result0, result1;
  31598. var pos0;
  31599. pos0 = clone(pos);
  31600. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  31601. result1 = input.charAt(pos.offset);
  31602. advance(pos, 1);
  31603. } else {
  31604. result1 = null;
  31605. if (reportFailures === 0) {
  31606. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  31607. }
  31608. }
  31609. if (result1 !== null) {
  31610. result0 = [];
  31611. while (result1 !== null) {
  31612. result0.push(result1);
  31613. if (/^[\\+*\/=><,@%~|&\-]/.test(input.charAt(pos.offset))) {
  31614. result1 = input.charAt(pos.offset);
  31615. advance(pos, 1);
  31616. } else {
  31617. result1 = null;
  31618. if (reportFailures === 0) {
  31619. matchFailed("[\\\\+*\\/=><,@%~|&\\-]");
  31620. }
  31621. }
  31622. }
  31623. } else {
  31624. result0 = null;
  31625. }
  31626. if (result0 !== null) {
  31627. result0 = (function(offset, line, column, bin) {return bin.join("");})(pos0.offset, pos0.line, pos0.column, result0);
  31628. }
  31629. if (result0 === null) {
  31630. pos = clone(pos0);
  31631. }
  31632. cache[cacheKey] = {
  31633. nextPos: clone(pos),
  31634. result: result0
  31635. };
  31636. return result0;
  31637. }
  31638. function parse_keywordPattern() {
  31639. var cacheKey = "keywordPattern@" + pos.offset;
  31640. var cachedResult = cache[cacheKey];
  31641. if (cachedResult) {
  31642. pos = clone(cachedResult.nextPos);
  31643. return cachedResult.result;
  31644. }
  31645. var result0, result1, result2, result3, result4;
  31646. var pos0, pos1, pos2;
  31647. pos0 = clone(pos);
  31648. pos1 = clone(pos);
  31649. pos2 = clone(pos);
  31650. result1 = parse_ws();
  31651. if (result1 !== null) {
  31652. result2 = parse_keyword();
  31653. if (result2 !== null) {
  31654. result3 = parse_ws();
  31655. if (result3 !== null) {
  31656. result4 = parse_identifier();
  31657. if (result4 !== null) {
  31658. result1 = [result1, result2, result3, result4];
  31659. } else {
  31660. result1 = null;
  31661. pos = clone(pos2);
  31662. }
  31663. } else {
  31664. result1 = null;
  31665. pos = clone(pos2);
  31666. }
  31667. } else {
  31668. result1 = null;
  31669. pos = clone(pos2);
  31670. }
  31671. } else {
  31672. result1 = null;
  31673. pos = clone(pos2);
  31674. }
  31675. if (result1 !== null) {
  31676. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  31677. }
  31678. if (result1 === null) {
  31679. pos = clone(pos1);
  31680. }
  31681. if (result1 !== null) {
  31682. result0 = [];
  31683. while (result1 !== null) {
  31684. result0.push(result1);
  31685. pos1 = clone(pos);
  31686. pos2 = clone(pos);
  31687. result1 = parse_ws();
  31688. if (result1 !== null) {
  31689. result2 = parse_keyword();
  31690. if (result2 !== null) {
  31691. result3 = parse_ws();
  31692. if (result3 !== null) {
  31693. result4 = parse_identifier();
  31694. if (result4 !== null) {
  31695. result1 = [result1, result2, result3, result4];
  31696. } else {
  31697. result1 = null;
  31698. pos = clone(pos2);
  31699. }
  31700. } else {
  31701. result1 = null;
  31702. pos = clone(pos2);
  31703. }
  31704. } else {
  31705. result1 = null;
  31706. pos = clone(pos2);
  31707. }
  31708. } else {
  31709. result1 = null;
  31710. pos = clone(pos2);
  31711. }
  31712. if (result1 !== null) {
  31713. result1 = (function(offset, line, column, key, arg) {return {key:key, arg: arg};})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
  31714. }
  31715. if (result1 === null) {
  31716. pos = clone(pos1);
  31717. }
  31718. }
  31719. } else {
  31720. result0 = null;
  31721. }
  31722. if (result0 !== null) {
  31723. result0 = (function(offset, line, column, pairs) {
  31724. var keywords = [];
  31725. var params = [];
  31726. var i = 0;
  31727. for(i = 0; i < pairs.length; i++){
  31728. keywords.push(pairs[i].key);
  31729. }
  31730. for(i = 0; i < pairs.length; i++){
  31731. params.push(pairs[i].arg);
  31732. }
  31733. return [keywords.join(""), params];
  31734. })(pos0.offset, pos0.line, pos0.column, result0);
  31735. }
  31736. if (result0 === null) {
  31737. pos = clone(pos0);
  31738. }
  31739. cache[cacheKey] = {
  31740. nextPos: clone(pos),
  31741. result: result0
  31742. };
  31743. return result0;
  31744. }
  31745. function parse_binaryPattern() {
  31746. var cacheKey = "binaryPattern@" + pos.offset;
  31747. var cachedResult = cache[cacheKey];
  31748. if (cachedResult) {
  31749. pos = clone(cachedResult.nextPos);
  31750. return cachedResult.result;
  31751. }
  31752. var result0, result1, result2, result3;
  31753. var pos0, pos1;
  31754. pos0 = clone(pos);
  31755. pos1 = clone(pos);
  31756. result0 = parse_ws();
  31757. if (result0 !== null) {
  31758. result1 = parse_binarySelector();
  31759. if (result1 !== null) {
  31760. result2 = parse_ws();
  31761. if (result2 !== null) {
  31762. result3 = parse_identifier();
  31763. if (result3 !== null) {
  31764. result0 = [result0, result1, result2, result3];
  31765. } else {
  31766. result0 = null;
  31767. pos = clone(pos1);
  31768. }
  31769. } else {
  31770. result0 = null;
  31771. pos = clone(pos1);
  31772. }
  31773. } else {
  31774. result0 = null;
  31775. pos = clone(pos1);
  31776. }
  31777. } else {
  31778. result0 = null;
  31779. pos = clone(pos1);
  31780. }
  31781. if (result0 !== null) {
  31782. result0 = (function(offset, line, column, selector, arg) {return [selector, [arg]];})(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  31783. }
  31784. if (result0 === null) {
  31785. pos = clone(pos0);
  31786. }
  31787. cache[cacheKey] = {
  31788. nextPos: clone(pos),
  31789. result: result0
  31790. };
  31791. return result0;
  31792. }
  31793. function parse_unaryPattern() {
  31794. var cacheKey = "unaryPattern@" + pos.offset;
  31795. var cachedResult = cache[cacheKey];
  31796. if (cachedResult) {
  31797. pos = clone(cachedResult.nextPos);
  31798. return cachedResult.result;
  31799. }
  31800. var result0, result1;
  31801. var pos0, pos1;
  31802. pos0 = clone(pos);
  31803. pos1 = clone(pos);
  31804. result0 = parse_ws();
  31805. if (result0 !== null) {
  31806. result1 = parse_identifier();
  31807. if (result1 !== null) {
  31808. result0 = [result0, result1];
  31809. } else {
  31810. result0 = null;
  31811. pos = clone(pos1);
  31812. }
  31813. } else {
  31814. result0 = null;
  31815. pos = clone(pos1);
  31816. }
  31817. if (result0 !== null) {
  31818. result0 = (function(offset, line, column, selector) {return [selector, []];})(pos0.offset, pos0.line, pos0.column, result0[1]);
  31819. }
  31820. if (result0 === null) {
  31821. pos = clone(pos0);
  31822. }
  31823. cache[cacheKey] = {
  31824. nextPos: clone(pos),
  31825. result: result0
  31826. };
  31827. return result0;
  31828. }
  31829. function parse_expression() {
  31830. var cacheKey = "expression@" + pos.offset;
  31831. var cachedResult = cache[cacheKey];
  31832. if (cachedResult) {
  31833. pos = clone(cachedResult.nextPos);
  31834. return cachedResult.result;
  31835. }
  31836. var result0;
  31837. result0 = parse_assignment();
  31838. if (result0 === null) {
  31839. result0 = parse_cascade();
  31840. if (result0 === null) {
  31841. result0 = parse_keywordSend();
  31842. if (result0 === null) {
  31843. result0 = parse_binarySend();
  31844. }
  31845. }
  31846. }
  31847. cache[cacheKey] = {
  31848. nextPos: clone(pos),
  31849. result: result0
  31850. };
  31851. return result0;
  31852. }
  31853. function parse_expressionList() {
  31854. var cacheKey = "expressionList@" + pos.offset;
  31855. var cachedResult = cache[cacheKey];
  31856. if (cachedResult) {
  31857. pos = clone(cachedResult.nextPos);
  31858. return cachedResult.result;
  31859. }
  31860. var result0, result1, result2, result3;
  31861. var pos0, pos1;
  31862. pos0 = clone(pos);
  31863. pos1 = clone(pos);
  31864. result0 = parse_ws();
  31865. if (result0 !== null) {
  31866. if (input.charCodeAt(pos.offset) === 46) {
  31867. result1 = ".";
  31868. advance(pos, 1);
  31869. } else {
  31870. result1 = null;
  31871. if (reportFailures === 0) {
  31872. matchFailed("\".\"");
  31873. }
  31874. }
  31875. if (result1 !== null) {
  31876. result2 = parse_ws();
  31877. if (result2 !== null) {
  31878. result3 = parse_expression();
  31879. if (result3 !== null) {
  31880. result0 = [result0, result1, result2, result3];
  31881. } else {
  31882. result0 = null;
  31883. pos = clone(pos1);
  31884. }
  31885. } else {
  31886. result0 = null;
  31887. pos = clone(pos1);
  31888. }
  31889. } else {
  31890. result0 = null;
  31891. pos = clone(pos1);
  31892. }
  31893. } else {
  31894. result0 = null;
  31895. pos = clone(pos1);
  31896. }
  31897. if (result0 !== null) {
  31898. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[3]);
  31899. }
  31900. if (result0 === null) {
  31901. pos = clone(pos0);
  31902. }
  31903. cache[cacheKey] = {
  31904. nextPos: clone(pos),
  31905. result: result0
  31906. };
  31907. return result0;
  31908. }
  31909. function parse_expressions() {
  31910. var cacheKey = "expressions@" + pos.offset;
  31911. var cachedResult = cache[cacheKey];
  31912. if (cachedResult) {
  31913. pos = clone(cachedResult.nextPos);
  31914. return cachedResult.result;
  31915. }
  31916. var result0, result1, result2;
  31917. var pos0, pos1;
  31918. pos0 = clone(pos);
  31919. pos1 = clone(pos);
  31920. result0 = parse_expression();
  31921. if (result0 !== null) {
  31922. result1 = [];
  31923. result2 = parse_expressionList();
  31924. while (result2 !== null) {
  31925. result1.push(result2);
  31926. result2 = parse_expressionList();
  31927. }
  31928. if (result1 !== null) {
  31929. result0 = [result0, result1];
  31930. } else {
  31931. result0 = null;
  31932. pos = clone(pos1);
  31933. }
  31934. } else {
  31935. result0 = null;
  31936. pos = clone(pos1);
  31937. }
  31938. if (result0 !== null) {
  31939. result0 = (function(offset, line, column, first, others) {
  31940. var result = [first];
  31941. for(var i = 0; i < others.length; i++) {
  31942. result.push(others[i]);
  31943. }
  31944. return result;
  31945. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  31946. }
  31947. if (result0 === null) {
  31948. pos = clone(pos0);
  31949. }
  31950. cache[cacheKey] = {
  31951. nextPos: clone(pos),
  31952. result: result0
  31953. };
  31954. return result0;
  31955. }
  31956. function parse_assignment() {
  31957. var cacheKey = "assignment@" + pos.offset;
  31958. var cachedResult = cache[cacheKey];
  31959. if (cachedResult) {
  31960. pos = clone(cachedResult.nextPos);
  31961. return cachedResult.result;
  31962. }
  31963. var result0, result1, result2, result3, result4;
  31964. var pos0, pos1;
  31965. pos0 = clone(pos);
  31966. pos1 = clone(pos);
  31967. result0 = parse_variable();
  31968. if (result0 !== null) {
  31969. result1 = parse_ws();
  31970. if (result1 !== null) {
  31971. if (input.substr(pos.offset, 2) === ":=") {
  31972. result2 = ":=";
  31973. advance(pos, 2);
  31974. } else {
  31975. result2 = null;
  31976. if (reportFailures === 0) {
  31977. matchFailed("\":=\"");
  31978. }
  31979. }
  31980. if (result2 !== null) {
  31981. result3 = parse_ws();
  31982. if (result3 !== null) {
  31983. result4 = parse_expression();
  31984. if (result4 !== null) {
  31985. result0 = [result0, result1, result2, result3, result4];
  31986. } else {
  31987. result0 = null;
  31988. pos = clone(pos1);
  31989. }
  31990. } else {
  31991. result0 = null;
  31992. pos = clone(pos1);
  31993. }
  31994. } else {
  31995. result0 = null;
  31996. pos = clone(pos1);
  31997. }
  31998. } else {
  31999. result0 = null;
  32000. pos = clone(pos1);
  32001. }
  32002. } else {
  32003. result0 = null;
  32004. pos = clone(pos1);
  32005. }
  32006. if (result0 !== null) {
  32007. result0 = (function(offset, line, column, variable, expression) {
  32008. return smalltalk.AssignmentNode._new()
  32009. ._position_((line).__at(column))
  32010. ._left_(variable)
  32011. ._right_(expression);
  32012. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  32013. }
  32014. if (result0 === null) {
  32015. pos = clone(pos0);
  32016. }
  32017. cache[cacheKey] = {
  32018. nextPos: clone(pos),
  32019. result: result0
  32020. };
  32021. return result0;
  32022. }
  32023. function parse_ret() {
  32024. var cacheKey = "ret@" + pos.offset;
  32025. var cachedResult = cache[cacheKey];
  32026. if (cachedResult) {
  32027. pos = clone(cachedResult.nextPos);
  32028. return cachedResult.result;
  32029. }
  32030. var result0, result1, result2, result3, result4;
  32031. var pos0, pos1;
  32032. pos0 = clone(pos);
  32033. pos1 = clone(pos);
  32034. if (input.charCodeAt(pos.offset) === 94) {
  32035. result0 = "^";
  32036. advance(pos, 1);
  32037. } else {
  32038. result0 = null;
  32039. if (reportFailures === 0) {
  32040. matchFailed("\"^\"");
  32041. }
  32042. }
  32043. if (result0 !== null) {
  32044. result1 = parse_ws();
  32045. if (result1 !== null) {
  32046. result2 = parse_expression();
  32047. if (result2 !== null) {
  32048. result3 = parse_ws();
  32049. if (result3 !== null) {
  32050. if (input.charCodeAt(pos.offset) === 46) {
  32051. result4 = ".";
  32052. advance(pos, 1);
  32053. } else {
  32054. result4 = null;
  32055. if (reportFailures === 0) {
  32056. matchFailed("\".\"");
  32057. }
  32058. }
  32059. result4 = result4 !== null ? result4 : "";
  32060. if (result4 !== null) {
  32061. result0 = [result0, result1, result2, result3, result4];
  32062. } else {
  32063. result0 = null;
  32064. pos = clone(pos1);
  32065. }
  32066. } else {
  32067. result0 = null;
  32068. pos = clone(pos1);
  32069. }
  32070. } else {
  32071. result0 = null;
  32072. pos = clone(pos1);
  32073. }
  32074. } else {
  32075. result0 = null;
  32076. pos = clone(pos1);
  32077. }
  32078. } else {
  32079. result0 = null;
  32080. pos = clone(pos1);
  32081. }
  32082. if (result0 !== null) {
  32083. result0 = (function(offset, line, column, expression) {
  32084. return smalltalk.ReturnNode._new()
  32085. ._position_((line).__at(column))
  32086. ._nodes_([expression]);
  32087. })(pos0.offset, pos0.line, pos0.column, result0[2]);
  32088. }
  32089. if (result0 === null) {
  32090. pos = clone(pos0);
  32091. }
  32092. cache[cacheKey] = {
  32093. nextPos: clone(pos),
  32094. result: result0
  32095. };
  32096. return result0;
  32097. }
  32098. function parse_temps() {
  32099. var cacheKey = "temps@" + pos.offset;
  32100. var cachedResult = cache[cacheKey];
  32101. if (cachedResult) {
  32102. pos = clone(cachedResult.nextPos);
  32103. return cachedResult.result;
  32104. }
  32105. var result0, result1, result2, result3, result4;
  32106. var pos0, pos1, pos2, pos3;
  32107. pos0 = clone(pos);
  32108. pos1 = clone(pos);
  32109. if (input.charCodeAt(pos.offset) === 124) {
  32110. result0 = "|";
  32111. advance(pos, 1);
  32112. } else {
  32113. result0 = null;
  32114. if (reportFailures === 0) {
  32115. matchFailed("\"|\"");
  32116. }
  32117. }
  32118. if (result0 !== null) {
  32119. result1 = [];
  32120. pos2 = clone(pos);
  32121. pos3 = clone(pos);
  32122. result2 = parse_ws();
  32123. if (result2 !== null) {
  32124. result3 = parse_identifier();
  32125. if (result3 !== null) {
  32126. result4 = parse_ws();
  32127. if (result4 !== null) {
  32128. result2 = [result2, result3, result4];
  32129. } else {
  32130. result2 = null;
  32131. pos = clone(pos3);
  32132. }
  32133. } else {
  32134. result2 = null;
  32135. pos = clone(pos3);
  32136. }
  32137. } else {
  32138. result2 = null;
  32139. pos = clone(pos3);
  32140. }
  32141. if (result2 !== null) {
  32142. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  32143. }
  32144. if (result2 === null) {
  32145. pos = clone(pos2);
  32146. }
  32147. while (result2 !== null) {
  32148. result1.push(result2);
  32149. pos2 = clone(pos);
  32150. pos3 = clone(pos);
  32151. result2 = parse_ws();
  32152. if (result2 !== null) {
  32153. result3 = parse_identifier();
  32154. if (result3 !== null) {
  32155. result4 = parse_ws();
  32156. if (result4 !== null) {
  32157. result2 = [result2, result3, result4];
  32158. } else {
  32159. result2 = null;
  32160. pos = clone(pos3);
  32161. }
  32162. } else {
  32163. result2 = null;
  32164. pos = clone(pos3);
  32165. }
  32166. } else {
  32167. result2 = null;
  32168. pos = clone(pos3);
  32169. }
  32170. if (result2 !== null) {
  32171. result2 = (function(offset, line, column, variable) {return variable;})(pos2.offset, pos2.line, pos2.column, result2[1]);
  32172. }
  32173. if (result2 === null) {
  32174. pos = clone(pos2);
  32175. }
  32176. }
  32177. if (result1 !== null) {
  32178. if (input.charCodeAt(pos.offset) === 124) {
  32179. result2 = "|";
  32180. advance(pos, 1);
  32181. } else {
  32182. result2 = null;
  32183. if (reportFailures === 0) {
  32184. matchFailed("\"|\"");
  32185. }
  32186. }
  32187. if (result2 !== null) {
  32188. result0 = [result0, result1, result2];
  32189. } else {
  32190. result0 = null;
  32191. pos = clone(pos1);
  32192. }
  32193. } else {
  32194. result0 = null;
  32195. pos = clone(pos1);
  32196. }
  32197. } else {
  32198. result0 = null;
  32199. pos = clone(pos1);
  32200. }
  32201. if (result0 !== null) {
  32202. result0 = (function(offset, line, column, vars) {return vars;})(pos0.offset, pos0.line, pos0.column, result0[1]);
  32203. }
  32204. if (result0 === null) {
  32205. pos = clone(pos0);
  32206. }
  32207. cache[cacheKey] = {
  32208. nextPos: clone(pos),
  32209. result: result0
  32210. };
  32211. return result0;
  32212. }
  32213. function parse_blockParamList() {
  32214. var cacheKey = "blockParamList@" + pos.offset;
  32215. var cachedResult = cache[cacheKey];
  32216. if (cachedResult) {
  32217. pos = clone(cachedResult.nextPos);
  32218. return cachedResult.result;
  32219. }
  32220. var result0, result1, result2, result3, result4;
  32221. var pos0, pos1, pos2, pos3;
  32222. pos0 = clone(pos);
  32223. pos1 = clone(pos);
  32224. pos2 = clone(pos);
  32225. pos3 = clone(pos);
  32226. result1 = parse_ws();
  32227. if (result1 !== null) {
  32228. if (input.charCodeAt(pos.offset) === 58) {
  32229. result2 = ":";
  32230. advance(pos, 1);
  32231. } else {
  32232. result2 = null;
  32233. if (reportFailures === 0) {
  32234. matchFailed("\":\"");
  32235. }
  32236. }
  32237. if (result2 !== null) {
  32238. result3 = parse_ws();
  32239. if (result3 !== null) {
  32240. result4 = parse_identifier();
  32241. if (result4 !== null) {
  32242. result1 = [result1, result2, result3, result4];
  32243. } else {
  32244. result1 = null;
  32245. pos = clone(pos3);
  32246. }
  32247. } else {
  32248. result1 = null;
  32249. pos = clone(pos3);
  32250. }
  32251. } else {
  32252. result1 = null;
  32253. pos = clone(pos3);
  32254. }
  32255. } else {
  32256. result1 = null;
  32257. pos = clone(pos3);
  32258. }
  32259. if (result1 !== null) {
  32260. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  32261. }
  32262. if (result1 === null) {
  32263. pos = clone(pos2);
  32264. }
  32265. if (result1 !== null) {
  32266. result0 = [];
  32267. while (result1 !== null) {
  32268. result0.push(result1);
  32269. pos2 = clone(pos);
  32270. pos3 = clone(pos);
  32271. result1 = parse_ws();
  32272. if (result1 !== null) {
  32273. if (input.charCodeAt(pos.offset) === 58) {
  32274. result2 = ":";
  32275. advance(pos, 1);
  32276. } else {
  32277. result2 = null;
  32278. if (reportFailures === 0) {
  32279. matchFailed("\":\"");
  32280. }
  32281. }
  32282. if (result2 !== null) {
  32283. result3 = parse_ws();
  32284. if (result3 !== null) {
  32285. result4 = parse_identifier();
  32286. if (result4 !== null) {
  32287. result1 = [result1, result2, result3, result4];
  32288. } else {
  32289. result1 = null;
  32290. pos = clone(pos3);
  32291. }
  32292. } else {
  32293. result1 = null;
  32294. pos = clone(pos3);
  32295. }
  32296. } else {
  32297. result1 = null;
  32298. pos = clone(pos3);
  32299. }
  32300. } else {
  32301. result1 = null;
  32302. pos = clone(pos3);
  32303. }
  32304. if (result1 !== null) {
  32305. result1 = (function(offset, line, column, param) {return param;})(pos2.offset, pos2.line, pos2.column, result1[3]);
  32306. }
  32307. if (result1 === null) {
  32308. pos = clone(pos2);
  32309. }
  32310. }
  32311. } else {
  32312. result0 = null;
  32313. }
  32314. if (result0 !== null) {
  32315. result1 = parse_ws();
  32316. if (result1 !== null) {
  32317. if (input.charCodeAt(pos.offset) === 124) {
  32318. result2 = "|";
  32319. advance(pos, 1);
  32320. } else {
  32321. result2 = null;
  32322. if (reportFailures === 0) {
  32323. matchFailed("\"|\"");
  32324. }
  32325. }
  32326. if (result2 !== null) {
  32327. result0 = [result0, result1, result2];
  32328. } else {
  32329. result0 = null;
  32330. pos = clone(pos1);
  32331. }
  32332. } else {
  32333. result0 = null;
  32334. pos = clone(pos1);
  32335. }
  32336. } else {
  32337. result0 = null;
  32338. pos = clone(pos1);
  32339. }
  32340. if (result0 !== null) {
  32341. result0 = (function(offset, line, column, params) {return params;})(pos0.offset, pos0.line, pos0.column, result0[0]);
  32342. }
  32343. if (result0 === null) {
  32344. pos = clone(pos0);
  32345. }
  32346. cache[cacheKey] = {
  32347. nextPos: clone(pos),
  32348. result: result0
  32349. };
  32350. return result0;
  32351. }
  32352. function parse_subexpression() {
  32353. var cacheKey = "subexpression@" + pos.offset;
  32354. var cachedResult = cache[cacheKey];
  32355. if (cachedResult) {
  32356. pos = clone(cachedResult.nextPos);
  32357. return cachedResult.result;
  32358. }
  32359. var result0, result1, result2, result3, result4;
  32360. var pos0, pos1;
  32361. pos0 = clone(pos);
  32362. pos1 = clone(pos);
  32363. if (input.charCodeAt(pos.offset) === 40) {
  32364. result0 = "(";
  32365. advance(pos, 1);
  32366. } else {
  32367. result0 = null;
  32368. if (reportFailures === 0) {
  32369. matchFailed("\"(\"");
  32370. }
  32371. }
  32372. if (result0 !== null) {
  32373. result1 = parse_ws();
  32374. if (result1 !== null) {
  32375. result2 = parse_expression();
  32376. if (result2 !== null) {
  32377. result3 = parse_ws();
  32378. if (result3 !== null) {
  32379. if (input.charCodeAt(pos.offset) === 41) {
  32380. result4 = ")";
  32381. advance(pos, 1);
  32382. } else {
  32383. result4 = null;
  32384. if (reportFailures === 0) {
  32385. matchFailed("\")\"");
  32386. }
  32387. }
  32388. if (result4 !== null) {
  32389. result0 = [result0, result1, result2, result3, result4];
  32390. } else {
  32391. result0 = null;
  32392. pos = clone(pos1);
  32393. }
  32394. } else {
  32395. result0 = null;
  32396. pos = clone(pos1);
  32397. }
  32398. } else {
  32399. result0 = null;
  32400. pos = clone(pos1);
  32401. }
  32402. } else {
  32403. result0 = null;
  32404. pos = clone(pos1);
  32405. }
  32406. } else {
  32407. result0 = null;
  32408. pos = clone(pos1);
  32409. }
  32410. if (result0 !== null) {
  32411. result0 = (function(offset, line, column, expression) {return expression;})(pos0.offset, pos0.line, pos0.column, result0[2]);
  32412. }
  32413. if (result0 === null) {
  32414. pos = clone(pos0);
  32415. }
  32416. cache[cacheKey] = {
  32417. nextPos: clone(pos),
  32418. result: result0
  32419. };
  32420. return result0;
  32421. }
  32422. function parse_statements() {
  32423. var cacheKey = "statements@" + pos.offset;
  32424. var cachedResult = cache[cacheKey];
  32425. if (cachedResult) {
  32426. pos = clone(cachedResult.nextPos);
  32427. return cachedResult.result;
  32428. }
  32429. var result0, result1, result2, result3, result4, result5, result6;
  32430. var pos0, pos1;
  32431. pos0 = clone(pos);
  32432. pos1 = clone(pos);
  32433. result0 = parse_ret();
  32434. if (result0 !== null) {
  32435. result1 = [];
  32436. if (/^[.]/.test(input.charAt(pos.offset))) {
  32437. result2 = input.charAt(pos.offset);
  32438. advance(pos, 1);
  32439. } else {
  32440. result2 = null;
  32441. if (reportFailures === 0) {
  32442. matchFailed("[.]");
  32443. }
  32444. }
  32445. while (result2 !== null) {
  32446. result1.push(result2);
  32447. if (/^[.]/.test(input.charAt(pos.offset))) {
  32448. result2 = input.charAt(pos.offset);
  32449. advance(pos, 1);
  32450. } else {
  32451. result2 = null;
  32452. if (reportFailures === 0) {
  32453. matchFailed("[.]");
  32454. }
  32455. }
  32456. }
  32457. if (result1 !== null) {
  32458. result0 = [result0, result1];
  32459. } else {
  32460. result0 = null;
  32461. pos = clone(pos1);
  32462. }
  32463. } else {
  32464. result0 = null;
  32465. pos = clone(pos1);
  32466. }
  32467. if (result0 !== null) {
  32468. result0 = (function(offset, line, column, ret) {return [ret];})(pos0.offset, pos0.line, pos0.column, result0[0]);
  32469. }
  32470. if (result0 === null) {
  32471. pos = clone(pos0);
  32472. }
  32473. if (result0 === null) {
  32474. pos0 = clone(pos);
  32475. pos1 = clone(pos);
  32476. result0 = parse_expressions();
  32477. if (result0 !== null) {
  32478. result1 = parse_ws();
  32479. if (result1 !== null) {
  32480. if (/^[.]/.test(input.charAt(pos.offset))) {
  32481. result3 = input.charAt(pos.offset);
  32482. advance(pos, 1);
  32483. } else {
  32484. result3 = null;
  32485. if (reportFailures === 0) {
  32486. matchFailed("[.]");
  32487. }
  32488. }
  32489. if (result3 !== null) {
  32490. result2 = [];
  32491. while (result3 !== null) {
  32492. result2.push(result3);
  32493. if (/^[.]/.test(input.charAt(pos.offset))) {
  32494. result3 = input.charAt(pos.offset);
  32495. advance(pos, 1);
  32496. } else {
  32497. result3 = null;
  32498. if (reportFailures === 0) {
  32499. matchFailed("[.]");
  32500. }
  32501. }
  32502. }
  32503. } else {
  32504. result2 = null;
  32505. }
  32506. if (result2 !== null) {
  32507. result3 = parse_ws();
  32508. if (result3 !== null) {
  32509. result4 = parse_ret();
  32510. if (result4 !== null) {
  32511. result5 = [];
  32512. if (/^[.]/.test(input.charAt(pos.offset))) {
  32513. result6 = input.charAt(pos.offset);
  32514. advance(pos, 1);
  32515. } else {
  32516. result6 = null;
  32517. if (reportFailures === 0) {
  32518. matchFailed("[.]");
  32519. }
  32520. }
  32521. while (result6 !== null) {
  32522. result5.push(result6);
  32523. if (/^[.]/.test(input.charAt(pos.offset))) {
  32524. result6 = input.charAt(pos.offset);
  32525. advance(pos, 1);
  32526. } else {
  32527. result6 = null;
  32528. if (reportFailures === 0) {
  32529. matchFailed("[.]");
  32530. }
  32531. }
  32532. }
  32533. if (result5 !== null) {
  32534. result0 = [result0, result1, result2, result3, result4, result5];
  32535. } else {
  32536. result0 = null;
  32537. pos = clone(pos1);
  32538. }
  32539. } else {
  32540. result0 = null;
  32541. pos = clone(pos1);
  32542. }
  32543. } else {
  32544. result0 = null;
  32545. pos = clone(pos1);
  32546. }
  32547. } else {
  32548. result0 = null;
  32549. pos = clone(pos1);
  32550. }
  32551. } else {
  32552. result0 = null;
  32553. pos = clone(pos1);
  32554. }
  32555. } else {
  32556. result0 = null;
  32557. pos = clone(pos1);
  32558. }
  32559. if (result0 !== null) {
  32560. result0 = (function(offset, line, column, exps, ret) {
  32561. var expressions = exps;
  32562. expressions.push(ret);
  32563. return expressions;
  32564. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
  32565. }
  32566. if (result0 === null) {
  32567. pos = clone(pos0);
  32568. }
  32569. if (result0 === null) {
  32570. pos0 = clone(pos);
  32571. pos1 = clone(pos);
  32572. result0 = parse_expressions();
  32573. result0 = result0 !== null ? result0 : "";
  32574. if (result0 !== null) {
  32575. result1 = [];
  32576. if (/^[.]/.test(input.charAt(pos.offset))) {
  32577. result2 = input.charAt(pos.offset);
  32578. advance(pos, 1);
  32579. } else {
  32580. result2 = null;
  32581. if (reportFailures === 0) {
  32582. matchFailed("[.]");
  32583. }
  32584. }
  32585. while (result2 !== null) {
  32586. result1.push(result2);
  32587. if (/^[.]/.test(input.charAt(pos.offset))) {
  32588. result2 = input.charAt(pos.offset);
  32589. advance(pos, 1);
  32590. } else {
  32591. result2 = null;
  32592. if (reportFailures === 0) {
  32593. matchFailed("[.]");
  32594. }
  32595. }
  32596. }
  32597. if (result1 !== null) {
  32598. result0 = [result0, result1];
  32599. } else {
  32600. result0 = null;
  32601. pos = clone(pos1);
  32602. }
  32603. } else {
  32604. result0 = null;
  32605. pos = clone(pos1);
  32606. }
  32607. if (result0 !== null) {
  32608. result0 = (function(offset, line, column, expressions) {
  32609. return expressions || [];
  32610. })(pos0.offset, pos0.line, pos0.column, result0[0]);
  32611. }
  32612. if (result0 === null) {
  32613. pos = clone(pos0);
  32614. }
  32615. }
  32616. }
  32617. cache[cacheKey] = {
  32618. nextPos: clone(pos),
  32619. result: result0
  32620. };
  32621. return result0;
  32622. }
  32623. function parse_sequence() {
  32624. var cacheKey = "sequence@" + pos.offset;
  32625. var cachedResult = cache[cacheKey];
  32626. if (cachedResult) {
  32627. pos = clone(cachedResult.nextPos);
  32628. return cachedResult.result;
  32629. }
  32630. var result0;
  32631. result0 = parse_jsStatement();
  32632. if (result0 === null) {
  32633. result0 = parse_stSequence();
  32634. }
  32635. cache[cacheKey] = {
  32636. nextPos: clone(pos),
  32637. result: result0
  32638. };
  32639. return result0;
  32640. }
  32641. function parse_stSequence() {
  32642. var cacheKey = "stSequence@" + pos.offset;
  32643. var cachedResult = cache[cacheKey];
  32644. if (cachedResult) {
  32645. pos = clone(cachedResult.nextPos);
  32646. return cachedResult.result;
  32647. }
  32648. var result0, result1, result2, result3;
  32649. var pos0, pos1;
  32650. pos0 = clone(pos);
  32651. pos1 = clone(pos);
  32652. result0 = parse_temps();
  32653. result0 = result0 !== null ? result0 : "";
  32654. if (result0 !== null) {
  32655. result1 = parse_ws();
  32656. if (result1 !== null) {
  32657. result2 = parse_statements();
  32658. result2 = result2 !== null ? result2 : "";
  32659. if (result2 !== null) {
  32660. result3 = parse_ws();
  32661. if (result3 !== null) {
  32662. result0 = [result0, result1, result2, result3];
  32663. } else {
  32664. result0 = null;
  32665. pos = clone(pos1);
  32666. }
  32667. } else {
  32668. result0 = null;
  32669. pos = clone(pos1);
  32670. }
  32671. } else {
  32672. result0 = null;
  32673. pos = clone(pos1);
  32674. }
  32675. } else {
  32676. result0 = null;
  32677. pos = clone(pos1);
  32678. }
  32679. if (result0 !== null) {
  32680. result0 = (function(offset, line, column, temps, statements) {
  32681. return smalltalk.SequenceNode._new()
  32682. ._position_((line).__at(column))
  32683. ._temps_(temps || [])
  32684. ._nodes_(statements || []);
  32685. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  32686. }
  32687. if (result0 === null) {
  32688. pos = clone(pos0);
  32689. }
  32690. cache[cacheKey] = {
  32691. nextPos: clone(pos),
  32692. result: result0
  32693. };
  32694. return result0;
  32695. }
  32696. function parse_block() {
  32697. var cacheKey = "block@" + pos.offset;
  32698. var cachedResult = cache[cacheKey];
  32699. if (cachedResult) {
  32700. pos = clone(cachedResult.nextPos);
  32701. return cachedResult.result;
  32702. }
  32703. var result0, result1, result2, result3, result4, result5, result6;
  32704. var pos0, pos1;
  32705. pos0 = clone(pos);
  32706. pos1 = clone(pos);
  32707. if (input.charCodeAt(pos.offset) === 91) {
  32708. result0 = "[";
  32709. advance(pos, 1);
  32710. } else {
  32711. result0 = null;
  32712. if (reportFailures === 0) {
  32713. matchFailed("\"[\"");
  32714. }
  32715. }
  32716. if (result0 !== null) {
  32717. result1 = parse_ws();
  32718. if (result1 !== null) {
  32719. result2 = parse_blockParamList();
  32720. result2 = result2 !== null ? result2 : "";
  32721. if (result2 !== null) {
  32722. result3 = parse_ws();
  32723. if (result3 !== null) {
  32724. result4 = parse_sequence();
  32725. result4 = result4 !== null ? result4 : "";
  32726. if (result4 !== null) {
  32727. result5 = parse_ws();
  32728. if (result5 !== null) {
  32729. if (input.charCodeAt(pos.offset) === 93) {
  32730. result6 = "]";
  32731. advance(pos, 1);
  32732. } else {
  32733. result6 = null;
  32734. if (reportFailures === 0) {
  32735. matchFailed("\"]\"");
  32736. }
  32737. }
  32738. if (result6 !== null) {
  32739. result0 = [result0, result1, result2, result3, result4, result5, result6];
  32740. } else {
  32741. result0 = null;
  32742. pos = clone(pos1);
  32743. }
  32744. } else {
  32745. result0 = null;
  32746. pos = clone(pos1);
  32747. }
  32748. } else {
  32749. result0 = null;
  32750. pos = clone(pos1);
  32751. }
  32752. } else {
  32753. result0 = null;
  32754. pos = clone(pos1);
  32755. }
  32756. } else {
  32757. result0 = null;
  32758. pos = clone(pos1);
  32759. }
  32760. } else {
  32761. result0 = null;
  32762. pos = clone(pos1);
  32763. }
  32764. } else {
  32765. result0 = null;
  32766. pos = clone(pos1);
  32767. }
  32768. if (result0 !== null) {
  32769. result0 = (function(offset, line, column, params, sequence) {
  32770. return smalltalk.BlockNode._new()
  32771. ._position_((line).__at(column))
  32772. ._parameters_(params || [])
  32773. ._nodes_([sequence._asBlockSequenceNode()]);
  32774. })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4]);
  32775. }
  32776. if (result0 === null) {
  32777. pos = clone(pos0);
  32778. }
  32779. cache[cacheKey] = {
  32780. nextPos: clone(pos),
  32781. result: result0
  32782. };
  32783. return result0;
  32784. }
  32785. function parse_operand() {
  32786. var cacheKey = "operand@" + pos.offset;
  32787. var cachedResult = cache[cacheKey];
  32788. if (cachedResult) {
  32789. pos = clone(cachedResult.nextPos);
  32790. return cachedResult.result;
  32791. }
  32792. var result0;
  32793. result0 = parse_literal();
  32794. if (result0 === null) {
  32795. result0 = parse_variable();
  32796. if (result0 === null) {
  32797. result0 = parse_subexpression();
  32798. }
  32799. }
  32800. cache[cacheKey] = {
  32801. nextPos: clone(pos),
  32802. result: result0
  32803. };
  32804. return result0;
  32805. }
  32806. function parse_unaryMessage() {
  32807. var cacheKey = "unaryMessage@" + pos.offset;
  32808. var cachedResult = cache[cacheKey];
  32809. if (cachedResult) {
  32810. pos = clone(cachedResult.nextPos);
  32811. return cachedResult.result;
  32812. }
  32813. var result0, result1, result2;
  32814. var pos0, pos1, pos2;
  32815. pos0 = clone(pos);
  32816. pos1 = clone(pos);
  32817. result0 = parse_ws();
  32818. if (result0 !== null) {
  32819. result1 = parse_identifier();
  32820. if (result1 !== null) {
  32821. pos2 = clone(pos);
  32822. reportFailures++;
  32823. if (/^[:]/.test(input.charAt(pos.offset))) {
  32824. result2 = input.charAt(pos.offset);
  32825. advance(pos, 1);
  32826. } else {
  32827. result2 = null;
  32828. if (reportFailures === 0) {
  32829. matchFailed("[:]");
  32830. }
  32831. }
  32832. reportFailures--;
  32833. if (result2 === null) {
  32834. result2 = "";
  32835. } else {
  32836. result2 = null;
  32837. pos = clone(pos2);
  32838. }
  32839. if (result2 !== null) {
  32840. result0 = [result0, result1, result2];
  32841. } else {
  32842. result0 = null;
  32843. pos = clone(pos1);
  32844. }
  32845. } else {
  32846. result0 = null;
  32847. pos = clone(pos1);
  32848. }
  32849. } else {
  32850. result0 = null;
  32851. pos = clone(pos1);
  32852. }
  32853. if (result0 !== null) {
  32854. result0 = (function(offset, line, column, selector) {
  32855. return smalltalk.SendNode._new()
  32856. ._position_((line).__at(column))
  32857. ._selector_(selector);
  32858. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  32859. }
  32860. if (result0 === null) {
  32861. pos = clone(pos0);
  32862. }
  32863. cache[cacheKey] = {
  32864. nextPos: clone(pos),
  32865. result: result0
  32866. };
  32867. return result0;
  32868. }
  32869. function parse_unaryTail() {
  32870. var cacheKey = "unaryTail@" + pos.offset;
  32871. var cachedResult = cache[cacheKey];
  32872. if (cachedResult) {
  32873. pos = clone(cachedResult.nextPos);
  32874. return cachedResult.result;
  32875. }
  32876. var result0, result1, result2, result3;
  32877. var pos0, pos1;
  32878. pos0 = clone(pos);
  32879. pos1 = clone(pos);
  32880. result0 = parse_unaryMessage();
  32881. if (result0 !== null) {
  32882. result1 = parse_ws();
  32883. if (result1 !== null) {
  32884. result2 = parse_unaryTail();
  32885. result2 = result2 !== null ? result2 : "";
  32886. if (result2 !== null) {
  32887. result3 = parse_ws();
  32888. if (result3 !== null) {
  32889. result0 = [result0, result1, result2, result3];
  32890. } else {
  32891. result0 = null;
  32892. pos = clone(pos1);
  32893. }
  32894. } else {
  32895. result0 = null;
  32896. pos = clone(pos1);
  32897. }
  32898. } else {
  32899. result0 = null;
  32900. pos = clone(pos1);
  32901. }
  32902. } else {
  32903. result0 = null;
  32904. pos = clone(pos1);
  32905. }
  32906. if (result0 !== null) {
  32907. result0 = (function(offset, line, column, message, tail) {
  32908. if(tail) {
  32909. return tail._valueForReceiver_(message);
  32910. }
  32911. else {
  32912. return message;
  32913. }
  32914. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  32915. }
  32916. if (result0 === null) {
  32917. pos = clone(pos0);
  32918. }
  32919. cache[cacheKey] = {
  32920. nextPos: clone(pos),
  32921. result: result0
  32922. };
  32923. return result0;
  32924. }
  32925. function parse_unarySend() {
  32926. var cacheKey = "unarySend@" + pos.offset;
  32927. var cachedResult = cache[cacheKey];
  32928. if (cachedResult) {
  32929. pos = clone(cachedResult.nextPos);
  32930. return cachedResult.result;
  32931. }
  32932. var result0, result1, result2;
  32933. var pos0, pos1;
  32934. pos0 = clone(pos);
  32935. pos1 = clone(pos);
  32936. result0 = parse_operand();
  32937. if (result0 !== null) {
  32938. result1 = parse_ws();
  32939. if (result1 !== null) {
  32940. result2 = parse_unaryTail();
  32941. result2 = result2 !== null ? result2 : "";
  32942. if (result2 !== null) {
  32943. result0 = [result0, result1, result2];
  32944. } else {
  32945. result0 = null;
  32946. pos = clone(pos1);
  32947. }
  32948. } else {
  32949. result0 = null;
  32950. pos = clone(pos1);
  32951. }
  32952. } else {
  32953. result0 = null;
  32954. pos = clone(pos1);
  32955. }
  32956. if (result0 !== null) {
  32957. result0 = (function(offset, line, column, receiver, tail) {
  32958. if(tail) {
  32959. return tail._valueForReceiver_(receiver);
  32960. }
  32961. else {
  32962. return receiver;
  32963. }
  32964. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
  32965. }
  32966. if (result0 === null) {
  32967. pos = clone(pos0);
  32968. }
  32969. cache[cacheKey] = {
  32970. nextPos: clone(pos),
  32971. result: result0
  32972. };
  32973. return result0;
  32974. }
  32975. function parse_binaryMessage() {
  32976. var cacheKey = "binaryMessage@" + pos.offset;
  32977. var cachedResult = cache[cacheKey];
  32978. if (cachedResult) {
  32979. pos = clone(cachedResult.nextPos);
  32980. return cachedResult.result;
  32981. }
  32982. var result0, result1, result2, result3;
  32983. var pos0, pos1;
  32984. pos0 = clone(pos);
  32985. pos1 = clone(pos);
  32986. result0 = parse_ws();
  32987. if (result0 !== null) {
  32988. result1 = parse_binarySelector();
  32989. if (result1 !== null) {
  32990. result2 = parse_ws();
  32991. if (result2 !== null) {
  32992. result3 = parse_unarySend();
  32993. if (result3 === null) {
  32994. result3 = parse_operand();
  32995. }
  32996. if (result3 !== null) {
  32997. result0 = [result0, result1, result2, result3];
  32998. } else {
  32999. result0 = null;
  33000. pos = clone(pos1);
  33001. }
  33002. } else {
  33003. result0 = null;
  33004. pos = clone(pos1);
  33005. }
  33006. } else {
  33007. result0 = null;
  33008. pos = clone(pos1);
  33009. }
  33010. } else {
  33011. result0 = null;
  33012. pos = clone(pos1);
  33013. }
  33014. if (result0 !== null) {
  33015. result0 = (function(offset, line, column, selector, arg) {
  33016. return smalltalk.SendNode._new()
  33017. ._position_((line).__at(column))
  33018. ._selector_(selector)
  33019. ._arguments_([arg]);
  33020. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  33021. }
  33022. if (result0 === null) {
  33023. pos = clone(pos0);
  33024. }
  33025. cache[cacheKey] = {
  33026. nextPos: clone(pos),
  33027. result: result0
  33028. };
  33029. return result0;
  33030. }
  33031. function parse_binaryTail() {
  33032. var cacheKey = "binaryTail@" + pos.offset;
  33033. var cachedResult = cache[cacheKey];
  33034. if (cachedResult) {
  33035. pos = clone(cachedResult.nextPos);
  33036. return cachedResult.result;
  33037. }
  33038. var result0, result1;
  33039. var pos0, pos1;
  33040. pos0 = clone(pos);
  33041. pos1 = clone(pos);
  33042. result0 = parse_binaryMessage();
  33043. if (result0 !== null) {
  33044. result1 = parse_binaryTail();
  33045. result1 = result1 !== null ? result1 : "";
  33046. if (result1 !== null) {
  33047. result0 = [result0, result1];
  33048. } else {
  33049. result0 = null;
  33050. pos = clone(pos1);
  33051. }
  33052. } else {
  33053. result0 = null;
  33054. pos = clone(pos1);
  33055. }
  33056. if (result0 !== null) {
  33057. result0 = (function(offset, line, column, message, tail) {
  33058. if(tail) {
  33059. return tail._valueForReceiver_(message);
  33060. }
  33061. else {
  33062. return message;
  33063. }
  33064. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  33065. }
  33066. if (result0 === null) {
  33067. pos = clone(pos0);
  33068. }
  33069. cache[cacheKey] = {
  33070. nextPos: clone(pos),
  33071. result: result0
  33072. };
  33073. return result0;
  33074. }
  33075. function parse_binarySend() {
  33076. var cacheKey = "binarySend@" + pos.offset;
  33077. var cachedResult = cache[cacheKey];
  33078. if (cachedResult) {
  33079. pos = clone(cachedResult.nextPos);
  33080. return cachedResult.result;
  33081. }
  33082. var result0, result1;
  33083. var pos0, pos1;
  33084. pos0 = clone(pos);
  33085. pos1 = clone(pos);
  33086. result0 = parse_unarySend();
  33087. if (result0 !== null) {
  33088. result1 = parse_binaryTail();
  33089. result1 = result1 !== null ? result1 : "";
  33090. if (result1 !== null) {
  33091. result0 = [result0, result1];
  33092. } else {
  33093. result0 = null;
  33094. pos = clone(pos1);
  33095. }
  33096. } else {
  33097. result0 = null;
  33098. pos = clone(pos1);
  33099. }
  33100. if (result0 !== null) {
  33101. result0 = (function(offset, line, column, receiver, tail) {
  33102. if(tail) {
  33103. return tail._valueForReceiver_(receiver);
  33104. }
  33105. else {
  33106. return receiver;
  33107. }
  33108. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  33109. }
  33110. if (result0 === null) {
  33111. pos = clone(pos0);
  33112. }
  33113. cache[cacheKey] = {
  33114. nextPos: clone(pos),
  33115. result: result0
  33116. };
  33117. return result0;
  33118. }
  33119. function parse_keywordMessage() {
  33120. var cacheKey = "keywordMessage@" + pos.offset;
  33121. var cachedResult = cache[cacheKey];
  33122. if (cachedResult) {
  33123. pos = clone(cachedResult.nextPos);
  33124. return cachedResult.result;
  33125. }
  33126. var result0, result1, result2, result3;
  33127. var pos0, pos1, pos2, pos3;
  33128. pos0 = clone(pos);
  33129. pos1 = clone(pos);
  33130. result0 = parse_ws();
  33131. if (result0 !== null) {
  33132. pos2 = clone(pos);
  33133. pos3 = clone(pos);
  33134. result2 = parse_keywordPair();
  33135. if (result2 !== null) {
  33136. result3 = parse_ws();
  33137. if (result3 !== null) {
  33138. result2 = [result2, result3];
  33139. } else {
  33140. result2 = null;
  33141. pos = clone(pos3);
  33142. }
  33143. } else {
  33144. result2 = null;
  33145. pos = clone(pos3);
  33146. }
  33147. if (result2 !== null) {
  33148. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  33149. }
  33150. if (result2 === null) {
  33151. pos = clone(pos2);
  33152. }
  33153. if (result2 !== null) {
  33154. result1 = [];
  33155. while (result2 !== null) {
  33156. result1.push(result2);
  33157. pos2 = clone(pos);
  33158. pos3 = clone(pos);
  33159. result2 = parse_keywordPair();
  33160. if (result2 !== null) {
  33161. result3 = parse_ws();
  33162. if (result3 !== null) {
  33163. result2 = [result2, result3];
  33164. } else {
  33165. result2 = null;
  33166. pos = clone(pos3);
  33167. }
  33168. } else {
  33169. result2 = null;
  33170. pos = clone(pos3);
  33171. }
  33172. if (result2 !== null) {
  33173. result2 = (function(offset, line, column, pair) {return pair;})(pos2.offset, pos2.line, pos2.column, result2[0]);
  33174. }
  33175. if (result2 === null) {
  33176. pos = clone(pos2);
  33177. }
  33178. }
  33179. } else {
  33180. result1 = null;
  33181. }
  33182. if (result1 !== null) {
  33183. result0 = [result0, result1];
  33184. } else {
  33185. result0 = null;
  33186. pos = clone(pos1);
  33187. }
  33188. } else {
  33189. result0 = null;
  33190. pos = clone(pos1);
  33191. }
  33192. if (result0 !== null) {
  33193. result0 = (function(offset, line, column, pairs) {
  33194. var selector = [];
  33195. var args = [];
  33196. for(var i = 0; i < pairs.length; i++) {
  33197. selector.push(pairs[i].key);
  33198. args.push(pairs[i].arg);
  33199. }
  33200. return smalltalk.SendNode._new()
  33201. ._position_((line).__at(column))
  33202. ._selector_(selector.join(""))
  33203. ._arguments_(args);
  33204. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  33205. }
  33206. if (result0 === null) {
  33207. pos = clone(pos0);
  33208. }
  33209. cache[cacheKey] = {
  33210. nextPos: clone(pos),
  33211. result: result0
  33212. };
  33213. return result0;
  33214. }
  33215. function parse_keywordSend() {
  33216. var cacheKey = "keywordSend@" + pos.offset;
  33217. var cachedResult = cache[cacheKey];
  33218. if (cachedResult) {
  33219. pos = clone(cachedResult.nextPos);
  33220. return cachedResult.result;
  33221. }
  33222. var result0, result1;
  33223. var pos0, pos1;
  33224. pos0 = clone(pos);
  33225. pos1 = clone(pos);
  33226. result0 = parse_binarySend();
  33227. if (result0 !== null) {
  33228. result1 = parse_keywordMessage();
  33229. if (result1 !== null) {
  33230. result0 = [result0, result1];
  33231. } else {
  33232. result0 = null;
  33233. pos = clone(pos1);
  33234. }
  33235. } else {
  33236. result0 = null;
  33237. pos = clone(pos1);
  33238. }
  33239. if (result0 !== null) {
  33240. result0 = (function(offset, line, column, receiver, tail) {
  33241. return tail._valueForReceiver_(receiver);
  33242. })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
  33243. }
  33244. if (result0 === null) {
  33245. pos = clone(pos0);
  33246. }
  33247. cache[cacheKey] = {
  33248. nextPos: clone(pos),
  33249. result: result0
  33250. };
  33251. return result0;
  33252. }
  33253. function parse_message() {
  33254. var cacheKey = "message@" + pos.offset;
  33255. var cachedResult = cache[cacheKey];
  33256. if (cachedResult) {
  33257. pos = clone(cachedResult.nextPos);
  33258. return cachedResult.result;
  33259. }
  33260. var result0;
  33261. result0 = parse_binaryMessage();
  33262. if (result0 === null) {
  33263. result0 = parse_unaryMessage();
  33264. if (result0 === null) {
  33265. result0 = parse_keywordMessage();
  33266. }
  33267. }
  33268. cache[cacheKey] = {
  33269. nextPos: clone(pos),
  33270. result: result0
  33271. };
  33272. return result0;
  33273. }
  33274. function parse_cascade() {
  33275. var cacheKey = "cascade@" + pos.offset;
  33276. var cachedResult = cache[cacheKey];
  33277. if (cachedResult) {
  33278. pos = clone(cachedResult.nextPos);
  33279. return cachedResult.result;
  33280. }
  33281. var result0, result1, result2, result3, result4, result5, result6, result7;
  33282. var pos0, pos1, pos2, pos3;
  33283. pos0 = clone(pos);
  33284. pos1 = clone(pos);
  33285. result0 = parse_ws();
  33286. if (result0 !== null) {
  33287. result1 = parse_keywordSend();
  33288. if (result1 === null) {
  33289. result1 = parse_binarySend();
  33290. }
  33291. if (result1 !== null) {
  33292. pos2 = clone(pos);
  33293. pos3 = clone(pos);
  33294. result3 = parse_ws();
  33295. if (result3 !== null) {
  33296. if (input.charCodeAt(pos.offset) === 59) {
  33297. result4 = ";";
  33298. advance(pos, 1);
  33299. } else {
  33300. result4 = null;
  33301. if (reportFailures === 0) {
  33302. matchFailed("\";\"");
  33303. }
  33304. }
  33305. if (result4 !== null) {
  33306. result5 = parse_ws();
  33307. if (result5 !== null) {
  33308. result6 = parse_message();
  33309. if (result6 !== null) {
  33310. result7 = parse_ws();
  33311. if (result7 !== null) {
  33312. result3 = [result3, result4, result5, result6, result7];
  33313. } else {
  33314. result3 = null;
  33315. pos = clone(pos3);
  33316. }
  33317. } else {
  33318. result3 = null;
  33319. pos = clone(pos3);
  33320. }
  33321. } else {
  33322. result3 = null;
  33323. pos = clone(pos3);
  33324. }
  33325. } else {
  33326. result3 = null;
  33327. pos = clone(pos3);
  33328. }
  33329. } else {
  33330. result3 = null;
  33331. pos = clone(pos3);
  33332. }
  33333. if (result3 !== null) {
  33334. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  33335. }
  33336. if (result3 === null) {
  33337. pos = clone(pos2);
  33338. }
  33339. if (result3 !== null) {
  33340. result2 = [];
  33341. while (result3 !== null) {
  33342. result2.push(result3);
  33343. pos2 = clone(pos);
  33344. pos3 = clone(pos);
  33345. result3 = parse_ws();
  33346. if (result3 !== null) {
  33347. if (input.charCodeAt(pos.offset) === 59) {
  33348. result4 = ";";
  33349. advance(pos, 1);
  33350. } else {
  33351. result4 = null;
  33352. if (reportFailures === 0) {
  33353. matchFailed("\";\"");
  33354. }
  33355. }
  33356. if (result4 !== null) {
  33357. result5 = parse_ws();
  33358. if (result5 !== null) {
  33359. result6 = parse_message();
  33360. if (result6 !== null) {
  33361. result7 = parse_ws();
  33362. if (result7 !== null) {
  33363. result3 = [result3, result4, result5, result6, result7];
  33364. } else {
  33365. result3 = null;
  33366. pos = clone(pos3);
  33367. }
  33368. } else {
  33369. result3 = null;
  33370. pos = clone(pos3);
  33371. }
  33372. } else {
  33373. result3 = null;
  33374. pos = clone(pos3);
  33375. }
  33376. } else {
  33377. result3 = null;
  33378. pos = clone(pos3);
  33379. }
  33380. } else {
  33381. result3 = null;
  33382. pos = clone(pos3);
  33383. }
  33384. if (result3 !== null) {
  33385. result3 = (function(offset, line, column, mess) {return mess;})(pos2.offset, pos2.line, pos2.column, result3[3]);
  33386. }
  33387. if (result3 === null) {
  33388. pos = clone(pos2);
  33389. }
  33390. }
  33391. } else {
  33392. result2 = null;
  33393. }
  33394. if (result2 !== null) {
  33395. result0 = [result0, result1, result2];
  33396. } else {
  33397. result0 = null;
  33398. pos = clone(pos1);
  33399. }
  33400. } else {
  33401. result0 = null;
  33402. pos = clone(pos1);
  33403. }
  33404. } else {
  33405. result0 = null;
  33406. pos = clone(pos1);
  33407. }
  33408. if (result0 !== null) {
  33409. result0 = (function(offset, line, column, send, messages) {
  33410. var cascade = [];
  33411. cascade.push(send);
  33412. for(var i = 0; i < messages.length; i++) {
  33413. cascade.push(messages[i]);
  33414. }
  33415. return smalltalk.CascadeNode._new()
  33416. ._position_((line).__at(column))
  33417. ._receiver_(send._receiver())
  33418. ._nodes_(cascade);
  33419. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]);
  33420. }
  33421. if (result0 === null) {
  33422. pos = clone(pos0);
  33423. }
  33424. cache[cacheKey] = {
  33425. nextPos: clone(pos),
  33426. result: result0
  33427. };
  33428. return result0;
  33429. }
  33430. function parse_jsStatement() {
  33431. var cacheKey = "jsStatement@" + pos.offset;
  33432. var cachedResult = cache[cacheKey];
  33433. if (cachedResult) {
  33434. pos = clone(cachedResult.nextPos);
  33435. return cachedResult.result;
  33436. }
  33437. var result0, result1, result2;
  33438. var pos0, pos1, pos2;
  33439. pos0 = clone(pos);
  33440. pos1 = clone(pos);
  33441. if (input.charCodeAt(pos.offset) === 60) {
  33442. result0 = "<";
  33443. advance(pos, 1);
  33444. } else {
  33445. result0 = null;
  33446. if (reportFailures === 0) {
  33447. matchFailed("\"<\"");
  33448. }
  33449. }
  33450. if (result0 !== null) {
  33451. result1 = [];
  33452. pos2 = clone(pos);
  33453. if (input.substr(pos.offset, 2) === ">>") {
  33454. result2 = ">>";
  33455. advance(pos, 2);
  33456. } else {
  33457. result2 = null;
  33458. if (reportFailures === 0) {
  33459. matchFailed("\">>\"");
  33460. }
  33461. }
  33462. if (result2 !== null) {
  33463. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  33464. }
  33465. if (result2 === null) {
  33466. pos = clone(pos2);
  33467. }
  33468. if (result2 === null) {
  33469. if (/^[^>]/.test(input.charAt(pos.offset))) {
  33470. result2 = input.charAt(pos.offset);
  33471. advance(pos, 1);
  33472. } else {
  33473. result2 = null;
  33474. if (reportFailures === 0) {
  33475. matchFailed("[^>]");
  33476. }
  33477. }
  33478. }
  33479. while (result2 !== null) {
  33480. result1.push(result2);
  33481. pos2 = clone(pos);
  33482. if (input.substr(pos.offset, 2) === ">>") {
  33483. result2 = ">>";
  33484. advance(pos, 2);
  33485. } else {
  33486. result2 = null;
  33487. if (reportFailures === 0) {
  33488. matchFailed("\">>\"");
  33489. }
  33490. }
  33491. if (result2 !== null) {
  33492. result2 = (function(offset, line, column) {return ">";})(pos2.offset, pos2.line, pos2.column);
  33493. }
  33494. if (result2 === null) {
  33495. pos = clone(pos2);
  33496. }
  33497. if (result2 === null) {
  33498. if (/^[^>]/.test(input.charAt(pos.offset))) {
  33499. result2 = input.charAt(pos.offset);
  33500. advance(pos, 1);
  33501. } else {
  33502. result2 = null;
  33503. if (reportFailures === 0) {
  33504. matchFailed("[^>]");
  33505. }
  33506. }
  33507. }
  33508. }
  33509. if (result1 !== null) {
  33510. if (input.charCodeAt(pos.offset) === 62) {
  33511. result2 = ">";
  33512. advance(pos, 1);
  33513. } else {
  33514. result2 = null;
  33515. if (reportFailures === 0) {
  33516. matchFailed("\">\"");
  33517. }
  33518. }
  33519. if (result2 !== null) {
  33520. result0 = [result0, result1, result2];
  33521. } else {
  33522. result0 = null;
  33523. pos = clone(pos1);
  33524. }
  33525. } else {
  33526. result0 = null;
  33527. pos = clone(pos1);
  33528. }
  33529. } else {
  33530. result0 = null;
  33531. pos = clone(pos1);
  33532. }
  33533. if (result0 !== null) {
  33534. result0 = (function(offset, line, column, val) {
  33535. return smalltalk.JSStatementNode._new()
  33536. ._position_((line).__at(column))
  33537. ._source_(val.join(""));
  33538. })(pos0.offset, pos0.line, pos0.column, result0[1]);
  33539. }
  33540. if (result0 === null) {
  33541. pos = clone(pos0);
  33542. }
  33543. cache[cacheKey] = {
  33544. nextPos: clone(pos),
  33545. result: result0
  33546. };
  33547. return result0;
  33548. }
  33549. function parse_method() {
  33550. var cacheKey = "method@" + pos.offset;
  33551. var cachedResult = cache[cacheKey];
  33552. if (cachedResult) {
  33553. pos = clone(cachedResult.nextPos);
  33554. return cachedResult.result;
  33555. }
  33556. var result0, result1, result2, result3, result4;
  33557. var pos0, pos1;
  33558. pos0 = clone(pos);
  33559. pos1 = clone(pos);
  33560. result0 = parse_ws();
  33561. if (result0 !== null) {
  33562. result1 = parse_keywordPattern();
  33563. if (result1 === null) {
  33564. result1 = parse_binaryPattern();
  33565. if (result1 === null) {
  33566. result1 = parse_unaryPattern();
  33567. }
  33568. }
  33569. if (result1 !== null) {
  33570. result2 = parse_ws();
  33571. if (result2 !== null) {
  33572. result3 = parse_sequence();
  33573. result3 = result3 !== null ? result3 : "";
  33574. if (result3 !== null) {
  33575. result4 = parse_ws();
  33576. if (result4 !== null) {
  33577. result0 = [result0, result1, result2, result3, result4];
  33578. } else {
  33579. result0 = null;
  33580. pos = clone(pos1);
  33581. }
  33582. } else {
  33583. result0 = null;
  33584. pos = clone(pos1);
  33585. }
  33586. } else {
  33587. result0 = null;
  33588. pos = clone(pos1);
  33589. }
  33590. } else {
  33591. result0 = null;
  33592. pos = clone(pos1);
  33593. }
  33594. } else {
  33595. result0 = null;
  33596. pos = clone(pos1);
  33597. }
  33598. if (result0 !== null) {
  33599. result0 = (function(offset, line, column, pattern, sequence) {
  33600. return smalltalk.MethodNode._new()
  33601. ._position_((line).__at(column))
  33602. ._selector_(pattern[0])
  33603. ._arguments_(pattern[1])
  33604. ._nodes_([sequence]);
  33605. })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3]);
  33606. }
  33607. if (result0 === null) {
  33608. pos = clone(pos0);
  33609. }
  33610. cache[cacheKey] = {
  33611. nextPos: clone(pos),
  33612. result: result0
  33613. };
  33614. return result0;
  33615. }
  33616. function cleanupExpected(expected) {
  33617. expected.sort();
  33618. var lastExpected = null;
  33619. var cleanExpected = [];
  33620. for (var i = 0; i < expected.length; i++) {
  33621. if (expected[i] !== lastExpected) {
  33622. cleanExpected.push(expected[i]);
  33623. lastExpected = expected[i];
  33624. }
  33625. }
  33626. return cleanExpected;
  33627. }
  33628. var result = parseFunctions[startRule]();
  33629. /*
  33630. * The parser is now in one of the following three states:
  33631. *
  33632. * 1. The parser successfully parsed the whole input.
  33633. *
  33634. * - |result !== null|
  33635. * - |pos.offset === input.length|
  33636. * - |rightmostFailuresExpected| may or may not contain something
  33637. *
  33638. * 2. The parser successfully parsed only a part of the input.
  33639. *
  33640. * - |result !== null|
  33641. * - |pos.offset < input.length|
  33642. * - |rightmostFailuresExpected| may or may not contain something
  33643. *
  33644. * 3. The parser did not successfully parse any part of the input.
  33645. *
  33646. * - |result === null|
  33647. * - |pos.offset === 0|
  33648. * - |rightmostFailuresExpected| contains at least one failure
  33649. *
  33650. * All code following this comment (including called functions) must
  33651. * handle these states.
  33652. */
  33653. if (result === null || pos.offset !== input.length) {
  33654. var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
  33655. var found = offset < input.length ? input.charAt(offset) : null;
  33656. var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
  33657. throw new this.SyntaxError(
  33658. cleanupExpected(rightmostFailuresExpected),
  33659. found,
  33660. offset,
  33661. errorPosition.line,
  33662. errorPosition.column
  33663. );
  33664. }
  33665. return result;
  33666. },
  33667. /* Returns the parser source code. */
  33668. toSource: function() { return this._source; }
  33669. };
  33670. /* Thrown when a parser encounters a syntax error. */
  33671. result.SyntaxError = function(expected, found, offset, line, column) {
  33672. function buildMessage(expected, found) {
  33673. var expectedHumanized, foundHumanized;
  33674. switch (expected.length) {
  33675. case 0:
  33676. expectedHumanized = "end of input";
  33677. break;
  33678. case 1:
  33679. expectedHumanized = expected[0];
  33680. break;
  33681. default:
  33682. expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
  33683. + " or "
  33684. + expected[expected.length - 1];
  33685. }
  33686. foundHumanized = found ? quote(found) : "end of input";
  33687. return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
  33688. }
  33689. this.name = "SyntaxError";
  33690. this.expected = expected;
  33691. this.found = found;
  33692. this.message = buildMessage(expected, found);
  33693. this.offset = offset;
  33694. this.line = line;
  33695. this.column = column;
  33696. };
  33697. result.SyntaxError.prototype = Error.prototype;
  33698. return result;
  33699. })();
  33700. });
  33701. define("amber_cli/AmberCli", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  33702. smalltalk.addPackage('AmberCli');
  33703. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  33704. smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
  33705. smalltalk.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  33706. smalltalk.addMethod(
  33707. smalltalk.method({
  33708. selector: "commandLineSwitches",
  33709. category: 'commandline',
  33710. fn: function (){
  33711. var self=this;
  33712. var switches;
  33713. return smalltalk.withContext(function($ctx1) {
  33714. var $1;
  33715. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  33716. return smalltalk.withContext(function($ctx2) {
  33717. return _st(each)._selector();
  33718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  33719. switches=_st(switches)._select_((function(each){
  33720. return smalltalk.withContext(function($ctx2) {
  33721. return _st(each)._match_("^[^:]*:$");
  33722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  33723. switches=_st(switches)._collect_((function(each){
  33724. return smalltalk.withContext(function($ctx2) {
  33725. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  33726. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  33727. $1=switches;
  33728. return $1;
  33729. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})},
  33730. args: [],
  33731. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^switches",
  33732. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  33733. referencedClasses: []
  33734. }),
  33735. smalltalk.AmberCli.klass);
  33736. smalltalk.addMethod(
  33737. smalltalk.method({
  33738. selector: "handleArguments:",
  33739. category: 'commandline',
  33740. fn: function (args){
  33741. var self=this;
  33742. var selector;
  33743. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  33744. return smalltalk.withContext(function($ctx1) {
  33745. selector=self._selectorForCommandLineSwitch_(_st(args)._first());
  33746. _st(args)._remove_(_st(args)._first());
  33747. self._perform_withArguments_(selector,_st($Array())._with_(args));
  33748. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
  33749. args: ["args"],
  33750. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  33751. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  33752. referencedClasses: ["Array"]
  33753. }),
  33754. smalltalk.AmberCli.klass);
  33755. smalltalk.addMethod(
  33756. smalltalk.method({
  33757. selector: "help:",
  33758. category: 'commands',
  33759. fn: function (args){
  33760. var self=this;
  33761. return smalltalk.withContext(function($ctx1) {
  33762. _st(console)._log_("Available Commands:");
  33763. _st(self._commandLineSwitches())._do_((function(each){
  33764. return smalltalk.withContext(function($ctx2) {
  33765. return _st(console)._log_(each);
  33766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  33767. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
  33768. args: ["args"],
  33769. source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  33770. messageSends: ["log:", "do:", "commandLineSwitches"],
  33771. referencedClasses: []
  33772. }),
  33773. smalltalk.AmberCli.klass);
  33774. smalltalk.addMethod(
  33775. smalltalk.method({
  33776. selector: "main",
  33777. category: 'startup',
  33778. fn: function (){
  33779. var self=this;
  33780. var args,nodeMinorVersion;
  33781. return smalltalk.withContext(function($ctx1) {
  33782. var $1,$2,$3;
  33783. nodeMinorVersion=_st(_st(_st(_st(process)._version())._tokenize_("."))._second())._asNumber();
  33784. $1=_st(nodeMinorVersion).__lt((8));
  33785. if(smalltalk.assert($1)){
  33786. _st(console)._log_("You are currently using Node.js ".__comma(_st(process)._version()));
  33787. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  33788. return (-1);
  33789. };
  33790. args=_st(process)._argv();
  33791. _st(args)._removeFrom_to_((1),(2));
  33792. $2=_st(args)._isEmpty();
  33793. if(smalltalk.assert($2)){
  33794. self._help_(nil);
  33795. } else {
  33796. $3=self._handleArguments_(args);
  33797. return $3;
  33798. };
  33799. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass)})},
  33800. args: [],
  33801. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09console log: 'You are currently using Node.js ', (process version).\x0a\x09\x09console log: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  33802. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "<", "log:", ",", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"],
  33803. referencedClasses: []
  33804. }),
  33805. smalltalk.AmberCli.klass);
  33806. smalltalk.addMethod(
  33807. smalltalk.method({
  33808. selector: "repl:",
  33809. category: 'commands',
  33810. fn: function (args){
  33811. var self=this;
  33812. function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
  33813. return smalltalk.withContext(function($ctx1) {
  33814. var $1;
  33815. $1=_st(_st($Repl())._new())._createInterface();
  33816. return $1;
  33817. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
  33818. args: ["args"],
  33819. source: "repl: args\x0a\x09^Repl new createInterface",
  33820. messageSends: ["createInterface", "new"],
  33821. referencedClasses: ["Repl"]
  33822. }),
  33823. smalltalk.AmberCli.klass);
  33824. smalltalk.addMethod(
  33825. smalltalk.method({
  33826. selector: "selectorForCommandLineSwitch:",
  33827. category: 'commandline',
  33828. fn: function (aSwitch){
  33829. var self=this;
  33830. var command,selector;
  33831. return smalltalk.withContext(function($ctx1) {
  33832. var $1,$2;
  33833. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  33834. if(smalltalk.assert($1)){
  33835. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  33836. return smalltalk.withContext(function($ctx2) {
  33837. return _st(_st(each)._second())._asUppercase();
  33838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}))).__comma(":");
  33839. selector;
  33840. } else {
  33841. selector="help:";
  33842. selector;
  33843. };
  33844. $2=selector;
  33845. return $2;
  33846. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
  33847. args: ["aSwitch"],
  33848. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^selector",
  33849. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"],
  33850. referencedClasses: []
  33851. }),
  33852. smalltalk.AmberCli.klass);
  33853. smalltalk.addMethod(
  33854. smalltalk.method({
  33855. selector: "serve:",
  33856. category: 'commands',
  33857. fn: function (args){
  33858. var self=this;
  33859. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  33860. return smalltalk.withContext(function($ctx1) {
  33861. var $1;
  33862. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  33863. return $1;
  33864. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})},
  33865. args: ["args"],
  33866. source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start",
  33867. messageSends: ["start", "createServerWithArguments:"],
  33868. referencedClasses: ["FileServer"]
  33869. }),
  33870. smalltalk.AmberCli.klass);
  33871. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  33872. smalltalk.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.";
  33873. smalltalk.addMethod(
  33874. smalltalk.method({
  33875. selector: "base64Decode:",
  33876. category: 'private',
  33877. fn: function (aString){
  33878. var self=this;
  33879. return smalltalk.withContext(function($ctx1) {
  33880. return (new Buffer(aString, 'base64').toString());
  33881. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  33882. args: ["aString"],
  33883. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  33884. messageSends: [],
  33885. referencedClasses: []
  33886. }),
  33887. smalltalk.FileServer);
  33888. smalltalk.addMethod(
  33889. smalltalk.method({
  33890. selector: "basePath",
  33891. category: 'accessing',
  33892. fn: function (){
  33893. var self=this;
  33894. return smalltalk.withContext(function($ctx1) {
  33895. var $2,$1;
  33896. $2=self["@basePath"];
  33897. if(($receiver = $2) == nil || $receiver == null){
  33898. $1="./";
  33899. } else {
  33900. $1=$2;
  33901. };
  33902. return $1;
  33903. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  33904. args: [],
  33905. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  33906. messageSends: ["ifNil:"],
  33907. referencedClasses: []
  33908. }),
  33909. smalltalk.FileServer);
  33910. smalltalk.addMethod(
  33911. smalltalk.method({
  33912. selector: "basePath:",
  33913. category: 'accessing',
  33914. fn: function (aString){
  33915. var self=this;
  33916. return smalltalk.withContext(function($ctx1) {
  33917. self["@basePath"]=aString;
  33918. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  33919. args: ["aString"],
  33920. source: "basePath: aString\x0a\x09basePath := aString",
  33921. messageSends: [],
  33922. referencedClasses: []
  33923. }),
  33924. smalltalk.FileServer);
  33925. smalltalk.addMethod(
  33926. smalltalk.method({
  33927. selector: "checkDirectoryLayout",
  33928. category: 'initialization',
  33929. fn: function (){
  33930. var self=this;
  33931. return smalltalk.withContext(function($ctx1) {
  33932. var $1,$2,$3;
  33933. $1=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("index.html"));
  33934. if(! smalltalk.assert($1)){
  33935. _st(console)._warn_("Warning: project directory does not contain index.html");
  33936. };
  33937. $2=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("st"));
  33938. if(! smalltalk.assert($2)){
  33939. _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  33940. };
  33941. $3=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
  33942. if(! smalltalk.assert($3)){
  33943. _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  33944. };
  33945. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  33946. args: [],
  33947. source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  33948. messageSends: ["ifFalse:", "existsSync:", ",", "basePath", "warn:"],
  33949. referencedClasses: []
  33950. }),
  33951. smalltalk.FileServer);
  33952. smalltalk.addMethod(
  33953. smalltalk.method({
  33954. selector: "fallbackPage",
  33955. category: 'accessing',
  33956. fn: function (){
  33957. var self=this;
  33958. return smalltalk.withContext(function($ctx1) {
  33959. var $1;
  33960. $1=self["@fallbackPage"];
  33961. return $1;
  33962. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  33963. args: [],
  33964. source: "fallbackPage\x0a\x09^fallbackPage",
  33965. messageSends: [],
  33966. referencedClasses: []
  33967. }),
  33968. smalltalk.FileServer);
  33969. smalltalk.addMethod(
  33970. smalltalk.method({
  33971. selector: "fallbackPage:",
  33972. category: 'accessing',
  33973. fn: function (aString){
  33974. var self=this;
  33975. return smalltalk.withContext(function($ctx1) {
  33976. self["@fallbackPage"]=aString;
  33977. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  33978. args: ["aString"],
  33979. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  33980. messageSends: [],
  33981. referencedClasses: []
  33982. }),
  33983. smalltalk.FileServer);
  33984. smalltalk.addMethod(
  33985. smalltalk.method({
  33986. selector: "handleGETRequest:respondTo:",
  33987. category: 'request handling',
  33988. fn: function (aRequest,aResponse){
  33989. var self=this;
  33990. var uri,filename;
  33991. return smalltalk.withContext(function($ctx1) {
  33992. var $1;
  33993. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  33994. filename=_st(self["@path"])._join_with_(self._basePath(),uri);
  33995. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  33996. return smalltalk.withContext(function($ctx2) {
  33997. $1=aBoolean;
  33998. if(smalltalk.assert($1)){
  33999. return self._respondFileNamed_to_(filename,aResponse);
  34000. } else {
  34001. return self._respondNotFoundTo_(aResponse);
  34002. };
  34003. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)})}));
  34004. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  34005. args: ["aRequest", "aResponse"],
  34006. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  34007. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  34008. referencedClasses: []
  34009. }),
  34010. smalltalk.FileServer);
  34011. smalltalk.addMethod(
  34012. smalltalk.method({
  34013. selector: "handleOPTIONSRequest:respondTo:",
  34014. category: 'request handling',
  34015. fn: function (aRequest,aResponse){
  34016. var self=this;
  34017. return smalltalk.withContext(function($ctx1) {
  34018. _st(aResponse)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Access-Control-Allow-Origin".__minus_gt("*"),"Access-Control-Allow-Methods".__minus_gt("GET, PUT, POST, DELETE, OPTIONS"),"Access-Control-Allow-Headers".__minus_gt("Content-Type, Accept"),"Content-Length".__minus_gt((0)),"Access-Control-Max-Age".__minus_gt((10))]));
  34019. _st(aResponse)._end();
  34020. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  34021. args: ["aRequest", "aResponse"],
  34022. source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end",
  34023. messageSends: ["writeHead:options:", "->", "end"],
  34024. referencedClasses: []
  34025. }),
  34026. smalltalk.FileServer);
  34027. smalltalk.addMethod(
  34028. smalltalk.method({
  34029. selector: "handlePUTRequest:respondTo:",
  34030. category: 'request handling',
  34031. fn: function (aRequest,aResponse){
  34032. var self=this;
  34033. var file,stream;
  34034. return smalltalk.withContext(function($ctx1) {
  34035. var $1,$2;
  34036. $1=self._isAuthenticated_(aRequest);
  34037. if(! smalltalk.assert($1)){
  34038. self._respondAuthenticationRequiredTo_(aResponse);
  34039. return nil;
  34040. };
  34041. file=".".__comma(_st(aRequest)._url());
  34042. stream=_st(self["@fs"])._createWriteStream_(file);
  34043. _st(stream)._on_do_("error",(function(error){
  34044. return smalltalk.withContext(function($ctx2) {
  34045. _st(console)._warn_("Error creating WriteStream for file ".__comma(file));
  34046. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  34047. _st(console)._warn_(" The exact error is: ".__comma(error));
  34048. return self._respondNotCreatedTo_(aResponse);
  34049. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  34050. _st(stream)._on_do_("close",(function(){
  34051. return smalltalk.withContext(function($ctx2) {
  34052. return self._respondCreatedTo_(aResponse);
  34053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  34054. _st(aRequest)._setEncoding_("utf8");
  34055. _st(aRequest)._on_do_("data",(function(data){
  34056. return smalltalk.withContext(function($ctx2) {
  34057. return _st(stream)._write_(data);
  34058. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)})}));
  34059. _st(aRequest)._on_do_("end",(function(){
  34060. return smalltalk.withContext(function($ctx2) {
  34061. $2=_st(stream)._writable();
  34062. if(smalltalk.assert($2)){
  34063. return _st(stream)._end();
  34064. };
  34065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  34066. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  34067. args: ["aRequest", "aResponse"],
  34068. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary js/ or st/ directory in your project?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  34069. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"],
  34070. referencedClasses: []
  34071. }),
  34072. smalltalk.FileServer);
  34073. smalltalk.addMethod(
  34074. smalltalk.method({
  34075. selector: "handleRequest:respondTo:",
  34076. category: 'request handling',
  34077. fn: function (aRequest,aResponse){
  34078. var self=this;
  34079. return smalltalk.withContext(function($ctx1) {
  34080. var $1,$2,$3;
  34081. $1=_st(_st(aRequest)._method()).__eq("PUT");
  34082. if(smalltalk.assert($1)){
  34083. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  34084. };
  34085. $2=_st(_st(aRequest)._method()).__eq("GET");
  34086. if(smalltalk.assert($2)){
  34087. self._handleGETRequest_respondTo_(aRequest,aResponse);
  34088. };
  34089. $3=_st(_st(aRequest)._method()).__eq("OPTIONS");
  34090. if(smalltalk.assert($3)){
  34091. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  34092. };
  34093. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  34094. args: ["aRequest", "aResponse"],
  34095. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  34096. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  34097. referencedClasses: []
  34098. }),
  34099. smalltalk.FileServer);
  34100. smalltalk.addMethod(
  34101. smalltalk.method({
  34102. selector: "host",
  34103. category: 'accessing',
  34104. fn: function (){
  34105. var self=this;
  34106. return smalltalk.withContext(function($ctx1) {
  34107. var $1;
  34108. $1=self["@host"];
  34109. return $1;
  34110. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  34111. args: [],
  34112. source: "host\x0a\x09^host",
  34113. messageSends: [],
  34114. referencedClasses: []
  34115. }),
  34116. smalltalk.FileServer);
  34117. smalltalk.addMethod(
  34118. smalltalk.method({
  34119. selector: "host:",
  34120. category: 'accessing',
  34121. fn: function (hostname){
  34122. var self=this;
  34123. return smalltalk.withContext(function($ctx1) {
  34124. self["@host"]=hostname;
  34125. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  34126. args: ["hostname"],
  34127. source: "host: hostname\x0a\x09host := hostname",
  34128. messageSends: [],
  34129. referencedClasses: []
  34130. }),
  34131. smalltalk.FileServer);
  34132. smalltalk.addMethod(
  34133. smalltalk.method({
  34134. selector: "initialize",
  34135. category: 'initialization',
  34136. fn: function (){
  34137. var self=this;
  34138. return smalltalk.withContext(function($ctx1) {
  34139. smalltalk.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []);
  34140. self["@path"]=self._require_("path");
  34141. self["@http"]=self._require_("http");
  34142. self["@fs"]=self._require_("fs");
  34143. self["@util"]=self._require_("util");
  34144. self["@url"]=self._require_("url");
  34145. self["@host"]=_st(self._class())._defaultHost();
  34146. self["@port"]=_st(self._class())._defaultPort();
  34147. self["@username"]=nil;
  34148. self["@password"]=nil;
  34149. self["@fallbackPage"]=nil;
  34150. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  34151. args: [],
  34152. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
  34153. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  34154. referencedClasses: []
  34155. }),
  34156. smalltalk.FileServer);
  34157. smalltalk.addMethod(
  34158. smalltalk.method({
  34159. selector: "isAuthenticated:",
  34160. category: 'private',
  34161. fn: function (aRequest){
  34162. var self=this;
  34163. var header,token,auth,parts;
  34164. return smalltalk.withContext(function($ctx1) {
  34165. var $1,$2,$3,$4,$5;
  34166. $1=_st(_st(self["@username"])._isNil())._and_((function(){
  34167. return smalltalk.withContext(function($ctx2) {
  34168. return _st(self["@password"])._isNil();
  34169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  34170. if(smalltalk.assert($1)){
  34171. return true;
  34172. };
  34173. $2=_st(_st(aRequest)._headers())._at_("authorization");
  34174. if(($receiver = $2) == nil || $receiver == null){
  34175. header="";
  34176. } else {
  34177. header=$2;
  34178. };
  34179. $3=_st(header)._isEmpty();
  34180. if(smalltalk.assert($3)){
  34181. return false;
  34182. } else {
  34183. $4=_st(header)._tokenize_(" ");
  34184. if(($receiver = $4) == nil || $receiver == null){
  34185. token="";
  34186. } else {
  34187. token=$4;
  34188. };
  34189. token;
  34190. auth=self._base64Decode_(_st(token)._at_((2)));
  34191. auth;
  34192. parts=_st(auth)._tokenize_(":");
  34193. parts;
  34194. $5=_st(_st(self["@username"]).__eq(_st(parts)._at_((1))))._and_((function(){
  34195. return smalltalk.withContext(function($ctx2) {
  34196. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  34197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  34198. if(smalltalk.assert($5)){
  34199. return true;
  34200. } else {
  34201. return false;
  34202. };
  34203. };
  34204. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  34205. args: ["aRequest"],
  34206. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^true]\x0a\x09\x09\x09ifFalse: [^false]\x0a\x09].",
  34207. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="],
  34208. referencedClasses: []
  34209. }),
  34210. smalltalk.FileServer);
  34211. smalltalk.addMethod(
  34212. smalltalk.method({
  34213. selector: "password:",
  34214. category: 'accessing',
  34215. fn: function (aPassword){
  34216. var self=this;
  34217. return smalltalk.withContext(function($ctx1) {
  34218. self["@password"]=aPassword;
  34219. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  34220. args: ["aPassword"],
  34221. source: "password: aPassword\x0a\x09password := aPassword.",
  34222. messageSends: [],
  34223. referencedClasses: []
  34224. }),
  34225. smalltalk.FileServer);
  34226. smalltalk.addMethod(
  34227. smalltalk.method({
  34228. selector: "port",
  34229. category: 'accessing',
  34230. fn: function (){
  34231. var self=this;
  34232. return smalltalk.withContext(function($ctx1) {
  34233. var $1;
  34234. $1=self["@port"];
  34235. return $1;
  34236. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  34237. args: [],
  34238. source: "port\x0a\x09^port",
  34239. messageSends: [],
  34240. referencedClasses: []
  34241. }),
  34242. smalltalk.FileServer);
  34243. smalltalk.addMethod(
  34244. smalltalk.method({
  34245. selector: "port:",
  34246. category: 'accessing',
  34247. fn: function (aNumber){
  34248. var self=this;
  34249. return smalltalk.withContext(function($ctx1) {
  34250. self["@port"]=aNumber;
  34251. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  34252. args: ["aNumber"],
  34253. source: "port: aNumber\x0a\x09port := aNumber",
  34254. messageSends: [],
  34255. referencedClasses: []
  34256. }),
  34257. smalltalk.FileServer);
  34258. smalltalk.addMethod(
  34259. smalltalk.method({
  34260. selector: "require:",
  34261. category: 'private',
  34262. fn: function (aModuleString){
  34263. var self=this;
  34264. return smalltalk.withContext(function($ctx1) {
  34265. var $1;
  34266. $1=_st(require)._value_(aModuleString);
  34267. return $1;
  34268. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  34269. args: ["aModuleString"],
  34270. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  34271. messageSends: ["value:"],
  34272. referencedClasses: []
  34273. }),
  34274. smalltalk.FileServer);
  34275. smalltalk.addMethod(
  34276. smalltalk.method({
  34277. selector: "respondAuthenticationRequiredTo:",
  34278. category: 'request handling',
  34279. fn: function (aResponse){
  34280. var self=this;
  34281. return smalltalk.withContext(function($ctx1) {
  34282. var $1,$2;
  34283. $1=aResponse;
  34284. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._from_(["WWW-Authenticate".__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  34285. _st($1)._write_("<html><body>Authentication needed</body></html>");
  34286. $2=_st($1)._end();
  34287. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34288. args: ["aResponse"],
  34289. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  34290. messageSends: ["writeHead:options:", "->", "write:", "end"],
  34291. referencedClasses: []
  34292. }),
  34293. smalltalk.FileServer);
  34294. smalltalk.addMethod(
  34295. smalltalk.method({
  34296. selector: "respondCreatedTo:",
  34297. category: 'request handling',
  34298. fn: function (aResponse){
  34299. var self=this;
  34300. return smalltalk.withContext(function($ctx1) {
  34301. var $1,$2;
  34302. $1=aResponse;
  34303. _st($1)._writeHead_options_((201),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  34304. $2=_st($1)._end();
  34305. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34306. args: ["aResponse"],
  34307. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  34308. messageSends: ["writeHead:options:", "->", "end"],
  34309. referencedClasses: []
  34310. }),
  34311. smalltalk.FileServer);
  34312. smalltalk.addMethod(
  34313. smalltalk.method({
  34314. selector: "respondFileNamed:to:",
  34315. category: 'request handling',
  34316. fn: function (aFilename,aResponse){
  34317. var self=this;
  34318. var type,filename;
  34319. return smalltalk.withContext(function($ctx1) {
  34320. var $1,$2,$3,$4,$5;
  34321. filename=aFilename;
  34322. $1=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  34323. if(smalltalk.assert($1)){
  34324. filename=_st(filename).__comma("index.html");
  34325. filename;
  34326. };
  34327. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  34328. return smalltalk.withContext(function($ctx2) {
  34329. $2=_st(ex)._notNil();
  34330. if(smalltalk.assert($2)){
  34331. _st(console)._log_(_st(filename).__comma(" does not exist"));
  34332. return self._respondInternalErrorTo_(aResponse);
  34333. } else {
  34334. type=_st(self._class())._mimeTypeFor_(filename);
  34335. type;
  34336. $3=_st(type).__eq("application/javascript");
  34337. if(smalltalk.assert($3)){
  34338. type=_st(type).__comma(";charset=utf-8");
  34339. type;
  34340. };
  34341. $4=aResponse;
  34342. _st($4)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt(type)]));
  34343. _st($4)._write_encoding_(file,"binary");
  34344. $5=_st($4)._end();
  34345. return $5;
  34346. };
  34347. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,2)})}));
  34348. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  34349. args: ["aFilename", "aResponse"],
  34350. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondInternalErrorTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  34351. messageSends: ["ifTrue:", "isDirectory", "statSync:", ",", "readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end"],
  34352. referencedClasses: []
  34353. }),
  34354. smalltalk.FileServer);
  34355. smalltalk.addMethod(
  34356. smalltalk.method({
  34357. selector: "respondInternalErrorTo:",
  34358. category: 'request handling',
  34359. fn: function (aResponse){
  34360. var self=this;
  34361. return smalltalk.withContext(function($ctx1) {
  34362. var $1,$2;
  34363. $1=aResponse;
  34364. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  34365. _st($1)._write_("500 Internal server error");
  34366. $2=_st($1)._end();
  34367. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34368. args: ["aResponse"],
  34369. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  34370. messageSends: ["writeHead:options:", "->", "write:", "end"],
  34371. referencedClasses: []
  34372. }),
  34373. smalltalk.FileServer);
  34374. smalltalk.addMethod(
  34375. smalltalk.method({
  34376. selector: "respondNotCreatedTo:",
  34377. category: 'request handling',
  34378. fn: function (aResponse){
  34379. var self=this;
  34380. return smalltalk.withContext(function($ctx1) {
  34381. var $1,$2;
  34382. $1=aResponse;
  34383. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  34384. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  34385. $2=_st($1)._end();
  34386. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34387. args: ["aResponse"],
  34388. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the st/js directories on the server?';\x0a\x09\x09end.",
  34389. messageSends: ["writeHead:options:", "->", "write:", "end"],
  34390. referencedClasses: []
  34391. }),
  34392. smalltalk.FileServer);
  34393. smalltalk.addMethod(
  34394. smalltalk.method({
  34395. selector: "respondNotFoundTo:",
  34396. category: 'request handling',
  34397. fn: function (aResponse){
  34398. var self=this;
  34399. return smalltalk.withContext(function($ctx1) {
  34400. var $1,$2,$3,$4;
  34401. $1=_st(self._fallbackPage())._isNil();
  34402. if(! smalltalk.assert($1)){
  34403. $2=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  34404. return $2;
  34405. };
  34406. $3=aResponse;
  34407. _st($3)._writeHead_options_((404),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  34408. _st($3)._write_("404 Not found");
  34409. $4=_st($3)._end();
  34410. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34411. args: ["aResponse"],
  34412. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  34413. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "->", "write:", "end"],
  34414. referencedClasses: []
  34415. }),
  34416. smalltalk.FileServer);
  34417. smalltalk.addMethod(
  34418. smalltalk.method({
  34419. selector: "respondOKTo:",
  34420. category: 'request handling',
  34421. fn: function (aResponse){
  34422. var self=this;
  34423. return smalltalk.withContext(function($ctx1) {
  34424. var $1,$2;
  34425. $1=aResponse;
  34426. _st($1)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain"),"Access-Control-Allow-Origin".__minus_gt("*")]));
  34427. $2=_st($1)._end();
  34428. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  34429. args: ["aResponse"],
  34430. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  34431. messageSends: ["writeHead:options:", "->", "end"],
  34432. referencedClasses: []
  34433. }),
  34434. smalltalk.FileServer);
  34435. smalltalk.addMethod(
  34436. smalltalk.method({
  34437. selector: "start",
  34438. category: 'starting',
  34439. fn: function (){
  34440. var self=this;
  34441. return smalltalk.withContext(function($ctx1) {
  34442. var $1,$2;
  34443. self._checkDirectoryLayout();
  34444. $1=_st(self["@http"])._createServer_((function(request,response){
  34445. return smalltalk.withContext(function($ctx2) {
  34446. return self._handleRequest_respondTo_(request,response);
  34447. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)})}));
  34448. _st($1)._on_do_("error",(function(error){
  34449. return smalltalk.withContext(function($ctx2) {
  34450. return _st(console)._log_("Error starting server: ".__comma(error));
  34451. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  34452. _st($1)._on_do_("listening",(function(){
  34453. return smalltalk.withContext(function($ctx2) {
  34454. return _st(console)._log_(_st(_st("Starting file server on http://".__comma(self._host())).__comma(":")).__comma(_st(self._port())._asString()));
  34455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  34456. $2=_st($1)._listen_host_(self._port(),self._host());
  34457. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  34458. args: [],
  34459. source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  34460. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"],
  34461. referencedClasses: []
  34462. }),
  34463. smalltalk.FileServer);
  34464. smalltalk.addMethod(
  34465. smalltalk.method({
  34466. selector: "startOn:",
  34467. category: 'starting',
  34468. fn: function (aPort){
  34469. var self=this;
  34470. return smalltalk.withContext(function($ctx1) {
  34471. self._port_(aPort);
  34472. self._start();
  34473. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  34474. args: ["aPort"],
  34475. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  34476. messageSends: ["port:", "start"],
  34477. referencedClasses: []
  34478. }),
  34479. smalltalk.FileServer);
  34480. smalltalk.addMethod(
  34481. smalltalk.method({
  34482. selector: "username:",
  34483. category: 'accessing',
  34484. fn: function (aUsername){
  34485. var self=this;
  34486. return smalltalk.withContext(function($ctx1) {
  34487. self["@username"]=aUsername;
  34488. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  34489. args: ["aUsername"],
  34490. source: "username: aUsername\x0a\x09username := aUsername.",
  34491. messageSends: [],
  34492. referencedClasses: []
  34493. }),
  34494. smalltalk.FileServer);
  34495. smalltalk.addMethod(
  34496. smalltalk.method({
  34497. selector: "writeData:toFileNamed:",
  34498. category: 'private',
  34499. fn: function (data,aFilename){
  34500. var self=this;
  34501. return smalltalk.withContext(function($ctx1) {
  34502. _st(console)._log_(aFilename);
  34503. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  34504. args: ["data", "aFilename"],
  34505. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  34506. messageSends: ["log:"],
  34507. referencedClasses: []
  34508. }),
  34509. smalltalk.FileServer);
  34510. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  34511. smalltalk.addMethod(
  34512. smalltalk.method({
  34513. selector: "commandLineSwitches",
  34514. category: 'accessing',
  34515. fn: function (){
  34516. var self=this;
  34517. var switches;
  34518. return smalltalk.withContext(function($ctx1) {
  34519. var $1;
  34520. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  34521. return smalltalk.withContext(function($ctx2) {
  34522. return _st(each)._selector();
  34523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34524. switches=_st(switches)._select_((function(each){
  34525. return smalltalk.withContext(function($ctx2) {
  34526. return _st(each)._match_("^[^:]*:$");
  34527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  34528. switches=_st(switches)._collect_((function(each){
  34529. return smalltalk.withContext(function($ctx2) {
  34530. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  34531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  34532. $1=switches;
  34533. return $1;
  34534. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  34535. args: [],
  34536. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^switches",
  34537. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  34538. referencedClasses: []
  34539. }),
  34540. smalltalk.FileServer.klass);
  34541. smalltalk.addMethod(
  34542. smalltalk.method({
  34543. selector: "createServerWithArguments:",
  34544. category: 'initialization',
  34545. fn: function (options){
  34546. var self=this;
  34547. var server,popFront,front,optionName,optionValue,switches;
  34548. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  34549. return smalltalk.withContext(function($ctx1) {
  34550. var $1,$2,$3,$4,$5;
  34551. var $early={};
  34552. try {
  34553. switches=self._commandLineSwitches();
  34554. server=self._new();
  34555. _st(options)._ifEmpty_((function(){
  34556. return smalltalk.withContext(function($ctx2) {
  34557. $1=server;
  34558. throw $early=[$1];
  34559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  34560. $2=_st(_st(options)._size())._even();
  34561. if(! smalltalk.assert($2)){
  34562. _st(console)._log_("Using default parameters.");
  34563. _st(console)._log_("Wrong commandline options or not enough arguments for: ".__comma(options));
  34564. _st(console)._log_("Use any of the following ones: ".__comma(switches));
  34565. $3=server;
  34566. return $3;
  34567. };
  34568. popFront=(function(args){
  34569. return smalltalk.withContext(function($ctx2) {
  34570. front=_st(args)._first();
  34571. front;
  34572. _st(args)._remove_(front);
  34573. return front;
  34574. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)})});
  34575. _st((function(){
  34576. return smalltalk.withContext(function($ctx2) {
  34577. return _st(options)._notEmpty();
  34578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
  34579. return smalltalk.withContext(function($ctx2) {
  34580. optionName=_st(popFront)._value_(options);
  34581. optionName;
  34582. optionValue=_st(popFront)._value_(options);
  34583. optionValue;
  34584. $4=_st(switches)._includes_(optionName);
  34585. if(smalltalk.assert($4)){
  34586. optionName=self._selectorForCommandLineSwitch_(optionName);
  34587. optionName;
  34588. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  34589. } else {
  34590. _st(console)._log_(_st(optionName).__comma(" is not a valid commandline option"));
  34591. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  34592. };
  34593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  34594. $5=server;
  34595. return $5;
  34596. }
  34597. catch(e) {if(e===$early)return e[0]; throw e}
  34598. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  34599. args: ["options"],
  34600. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^server.",
  34601. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"],
  34602. referencedClasses: ["Array"]
  34603. }),
  34604. smalltalk.FileServer.klass);
  34605. smalltalk.addMethod(
  34606. smalltalk.method({
  34607. selector: "defaultHost",
  34608. category: 'accessing',
  34609. fn: function (){
  34610. var self=this;
  34611. return smalltalk.withContext(function($ctx1) {
  34612. return "127.0.0.1";
  34613. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  34614. args: [],
  34615. source: "defaultHost\x0a\x09^'127.0.0.1'",
  34616. messageSends: [],
  34617. referencedClasses: []
  34618. }),
  34619. smalltalk.FileServer.klass);
  34620. smalltalk.addMethod(
  34621. smalltalk.method({
  34622. selector: "defaultMimeTypes",
  34623. category: 'accessing',
  34624. fn: function (){
  34625. var self=this;
  34626. return smalltalk.withContext(function($ctx1) {
  34627. var $1;
  34628. $1=smalltalk.HashedCollection._from_(["%".__minus_gt("application/x-trash"),"323".__minus_gt("text/h323"),"abw".__minus_gt("application/x-abiword"),"ai".__minus_gt("application/postscript"),"aif".__minus_gt("audio/x-aiff"),"aifc".__minus_gt("audio/x-aiff"),"aiff".__minus_gt("audio/x-aiff"),"alc".__minus_gt("chemical/x-alchemy"),"art".__minus_gt("image/x-jg"),"asc".__minus_gt("text/plain"),"asf".__minus_gt("video/x-ms-asf"),"asn".__minus_gt("chemical/x-ncbi-asn1-spec"),"aso".__minus_gt("chemical/x-ncbi-asn1-binary"),"asx".__minus_gt("video/x-ms-asf"),"au".__minus_gt("audio/basic"),"avi".__minus_gt("video/x-msvideo"),"b".__minus_gt("chemical/x-molconn-Z"),"bak".__minus_gt("application/x-trash"),"bat".__minus_gt("application/x-msdos-program"),"bcpio".__minus_gt("application/x-bcpio"),"bib".__minus_gt("text/x-bibtex"),"bin".__minus_gt("application/octet-stream"),"bmp".__minus_gt("image/x-ms-bmp"),"book".__minus_gt("application/x-maker"),"bsd".__minus_gt("chemical/x-crossfire"),"c".__minus_gt("text/x-csrc"),"c++".__minus_gt("text/x-c++src"),"c3d".__minus_gt("chemical/x-chem3d"),"cac".__minus_gt("chemical/x-cache"),"cache".__minus_gt("chemical/x-cache"),"cascii".__minus_gt("chemical/x-cactvs-binary"),"cat".__minus_gt("application/vnd.ms-pki.seccat"),"cbin".__minus_gt("chemical/x-cactvs-binary"),"cc".__minus_gt("text/x-c++src"),"cdf".__minus_gt("application/x-cdf"),"cdr".__minus_gt("image/x-coreldraw"),"cdt".__minus_gt("image/x-coreldrawtemplate"),"cdx".__minus_gt("chemical/x-cdx"),"cdy".__minus_gt("application/vnd.cinderella"),"cef".__minus_gt("chemical/x-cxf"),"cer".__minus_gt("chemical/x-cerius"),"chm".__minus_gt("chemical/x-chemdraw"),"chrt".__minus_gt("application/x-kchart"),"cif".__minus_gt("chemical/x-cif"),"class".__minus_gt("application/java-vm"),"cls".__minus_gt("text/x-tex"),"cmdf".__minus_gt("chemical/x-cmdf"),"cml".__minus_gt("chemical/x-cml"),"cod".__minus_gt("application/vnd.rim.cod"),"com".__minus_gt("application/x-msdos-program"),"cpa".__minus_gt("chemical/x-compass"),"cpio".__minus_gt("application/x-cpio"),"cpp".__minus_gt("text/x-c++src"),"cpt".__minus_gt("image/x-corelphotopaint"),"crl".__minus_gt("application/x-pkcs7-crl"),"crt".__minus_gt("application/x-x509-ca-cert"),"csf".__minus_gt("chemical/x-cache-csf"),"csh".__minus_gt("text/x-csh"),"csm".__minus_gt("chemical/x-csml"),"csml".__minus_gt("chemical/x-csml"),"css".__minus_gt("text/css"),"csv".__minus_gt("text/comma-separated-values"),"ctab".__minus_gt("chemical/x-cactvs-binary"),"ctx".__minus_gt("chemical/x-ctx"),"cu".__minus_gt("application/cu-seeme"),"cub".__minus_gt("chemical/x-gaussian-cube"),"cxf".__minus_gt("chemical/x-cxf"),"cxx".__minus_gt("text/x-c++src"),"dat".__minus_gt("chemical/x-mopac-input"),"dcr".__minus_gt("application/x-director"),"deb".__minus_gt("application/x-debian-package"),"dif".__minus_gt("video/dv"),"diff".__minus_gt("text/plain"),"dir".__minus_gt("application/x-director"),"djv".__minus_gt("image/vnd.djvu"),"djvu".__minus_gt("image/vnd.djvu"),"dl".__minus_gt("video/dl"),"dll".__minus_gt("application/x-msdos-program"),"dmg".__minus_gt("application/x-apple-diskimage"),"dms".__minus_gt("application/x-dms"),"doc".__minus_gt("application/msword"),"dot".__minus_gt("application/msword"),"dv".__minus_gt("video/dv"),"dvi".__minus_gt("application/x-dvi"),"dx".__minus_gt("chemical/x-jcamp-dx"),"dxr".__minus_gt("application/x-director"),"emb".__minus_gt("chemical/x-embl-dl-nucleotide"),"embl".__minus_gt("chemical/x-embl-dl-nucleotide"),"ent".__minus_gt("chemical/x-pdb"),"eps".__minus_gt("application/postscript"),"etx".__minus_gt("text/x-setext"),"exe".__minus_gt("application/x-msdos-program"),"ez".__minus_gt("application/andrew-inset"),"fb".__minus_gt("application/x-maker"),"fbdoc".__minus_gt("application/x-maker"),"fch".__minus_gt("chemical/x-gaussian-checkpoint"),"fchk".__minus_gt("chemical/x-gaussian-checkpoint"),"fig".__minus_gt("application/x-xfig"),"flac".__minus_gt("application/x-flac"),"fli".__minus_gt("video/fli"),"fm".__minus_gt("application/x-maker"),"frame".__minus_gt("application/x-maker"),"frm".__minus_gt("application/x-maker"),"gal".__minus_gt("chemical/x-gaussian-log"),"gam".__minus_gt("chemical/x-gamess-input"),"gamin".__minus_gt("chemical/x-gamess-input"),"gau".__minus_gt("chemical/x-gaussian-input"),"gcd".__minus_gt("text/x-pcs-gcd"),"gcf".__minus_gt("application/x-graphing-calculator"),"gcg".__minus_gt("chemical/x-gcg8-sequence"),"gen".__minus_gt("chemical/x-genbank"),"gf".__minus_gt("application/x-tex-gf"),"gif".__minus_gt("image/gif"),"gjc".__minus_gt("chemical/x-gaussian-input"),"gjf".__minus_gt("chemical/x-gaussian-input"),"gl".__minus_gt("video/gl"),"gnumeric".__minus_gt("application/x-gnumeric"),"gpt".__minus_gt("chemical/x-mopac-graph"),"gsf".__minus_gt("application/x-font"),"gsm".__minus_gt("audio/x-gsm"),"gtar".__minus_gt("application/x-gtar"),"h".__minus_gt("text/x-chdr"),"h++".__minus_gt("text/x-c++hdr"),"hdf".__minus_gt("application/x-hdf"),"hh".__minus_gt("text/x-c++hdr"),"hin".__minus_gt("chemical/x-hin"),"hpp".__minus_gt("text/x-c++hdr"),"hqx".__minus_gt("application/mac-binhex40"),"hs".__minus_gt("text/x-haskell"),"hta".__minus_gt("application/hta"),"htc".__minus_gt("text/x-component"),"htm".__minus_gt("text/html"),"html".__minus_gt("text/html"),"hxx".__minus_gt("text/x-c++hdr"),"ica".__minus_gt("application/x-ica"),"ice".__minus_gt("x-conference/x-cooltalk"),"ico".__minus_gt("image/x-icon"),"ics".__minus_gt("text/calendar"),"icz".__minus_gt("text/calendar"),"ief".__minus_gt("image/ief"),"iges".__minus_gt("model/iges"),"igs".__minus_gt("model/iges"),"iii".__minus_gt("application/x-iphone"),"inp".__minus_gt("chemical/x-gamess-input"),"ins".__minus_gt("application/x-internet-signup"),"iso".__minus_gt("application/x-iso9660-image"),"isp".__minus_gt("application/x-internet-signup"),"ist".__minus_gt("chemical/x-isostar"),"istr".__minus_gt("chemical/x-isostar"),"jad".__minus_gt("text/vnd.sun.j2me.app-descriptor"),"jar".__minus_gt("application/java-archive"),"java".__minus_gt("text/x-java"),"jdx".__minus_gt("chemical/x-jcamp-dx"),"jmz".__minus_gt("application/x-jmol"),"jng".__minus_gt("image/x-jng"),"jnlp".__minus_gt("application/x-java-jnlp-file"),"jpe".__minus_gt("image/jpeg"),"jpeg".__minus_gt("image/jpeg"),"jpg".__minus_gt("image/jpeg"),"js".__minus_gt("application/javascript"),"kar".__minus_gt("audio/midi"),"key".__minus_gt("application/pgp-keys"),"kil".__minus_gt("application/x-killustrator"),"kin".__minus_gt("chemical/x-kinemage"),"kpr".__minus_gt("application/x-kpresenter"),"kpt".__minus_gt("application/x-kpresenter"),"ksp".__minus_gt("application/x-kspread"),"kwd".__minus_gt("application/x-kword"),"kwt".__minus_gt("application/x-kword"),"latex".__minus_gt("application/x-latex"),"lha".__minus_gt("application/x-lha"),"lhs".__minus_gt("text/x-literate-haskell"),"lsf".__minus_gt("video/x-la-asf"),"lsx".__minus_gt("video/x-la-asf"),"ltx".__minus_gt("text/x-tex"),"lzh".__minus_gt("application/x-lzh"),"lzx".__minus_gt("application/x-lzx"),"m3u".__minus_gt("audio/x-mpegurl"),"m4a".__minus_gt("audio/mpeg"),"maker".__minus_gt("application/x-maker"),"man".__minus_gt("application/x-troff-man"),"mcif".__minus_gt("chemical/x-mmcif"),"mcm".__minus_gt("chemical/x-macmolecule"),"mdb".__minus_gt("application/msaccess"),"me".__minus_gt("application/x-troff-me"),"mesh".__minus_gt("model/mesh"),"mid".__minus_gt("audio/midi"),"midi".__minus_gt("audio/midi"),"mif".__minus_gt("application/x-mif"),"mm".__minus_gt("application/x-freemind"),"mmd".__minus_gt("chemical/x-macromodel-input"),"mmf".__minus_gt("application/vnd.smaf"),"mml".__minus_gt("text/mathml"),"mmod".__minus_gt("chemical/x-macromodel-input"),"mng".__minus_gt("video/x-mng"),"moc".__minus_gt("text/x-moc"),"mol".__minus_gt("chemical/x-mdl-molfile"),"mol2".__minus_gt("chemical/x-mol2"),"moo".__minus_gt("chemical/x-mopac-out"),"mop".__minus_gt("chemical/x-mopac-input"),"mopcrt".__minus_gt("chemical/x-mopac-input"),"mov".__minus_gt("video/quicktime"),"movie".__minus_gt("video/x-sgi-movie"),"mp2".__minus_gt("audio/mpeg"),"mp3".__minus_gt("audio/mpeg"),"mp4".__minus_gt("video/mp4"),"mpc".__minus_gt("chemical/x-mopac-input"),"mpe".__minus_gt("video/mpeg"),"mpeg".__minus_gt("video/mpeg"),"mpega".__minus_gt("audio/mpeg"),"mpg".__minus_gt("video/mpeg"),"mpga".__minus_gt("audio/mpeg"),"ms".__minus_gt("application/x-troff-ms"),"msh".__minus_gt("model/mesh"),"msi".__minus_gt("application/x-msi"),"mvb".__minus_gt("chemical/x-mopac-vib"),"mxu".__minus_gt("video/vnd.mpegurl"),"nb".__minus_gt("application/mathematica"),"nc".__minus_gt("application/x-netcdf"),"nwc".__minus_gt("application/x-nwc"),"o".__minus_gt("application/x-object"),"oda".__minus_gt("application/oda"),"odb".__minus_gt("application/vnd.oasis.opendocument.database"),"odc".__minus_gt("application/vnd.oasis.opendocument.chart"),"odf".__minus_gt("application/vnd.oasis.opendocument.formula"),"odg".__minus_gt("application/vnd.oasis.opendocument.graphics"),"odi".__minus_gt("application/vnd.oasis.opendocument.image"),"odm".__minus_gt("application/vnd.oasis.opendocument.text-master"),"odp".__minus_gt("application/vnd.oasis.opendocument.presentation"),"ods".__minus_gt("application/vnd.oasis.opendocument.spreadsheet"),"odt".__minus_gt("application/vnd.oasis.opendocument.text"),"ogg".__minus_gt("application/ogg"),"old".__minus_gt("application/x-trash"),"oth".__minus_gt("application/vnd.oasis.opendocument.text-web"),"oza".__minus_gt("application/x-oz-application"),"p".__minus_gt("text/x-pascal"),"p7r".__minus_gt("application/x-pkcs7-certreqresp"),"pac".__minus_gt("application/x-ns-proxy-autoconfig"),"pas".__minus_gt("text/x-pascal"),"pat".__minus_gt("image/x-coreldrawpattern"),"pbm".__minus_gt("image/x-portable-bitmap"),"pcf".__minus_gt("application/x-font"),"pcf.Z".__minus_gt("application/x-font"),"pcx".__minus_gt("image/pcx"),"pdb".__minus_gt("chemical/x-pdb"),"pdf".__minus_gt("application/pdf"),"pfa".__minus_gt("application/x-font"),"pfb".__minus_gt("application/x-font"),"pgm".__minus_gt("image/x-portable-graymap"),"pgn".__minus_gt("application/x-chess-pgn"),"pgp".__minus_gt("application/pgp-signature"),"pk".__minus_gt("application/x-tex-pk"),"pl".__minus_gt("text/x-perl"),"pls".__minus_gt("audio/x-scpls"),"pm".__minus_gt("text/x-perl"),"png".__minus_gt("image/png"),"pnm".__minus_gt("image/x-portable-anymap"),"pot".__minus_gt("text/plain"),"ppm".__minus_gt("image/x-portable-pixmap"),"pps".__minus_gt("application/vnd.ms-powerpoint"),"ppt".__minus_gt("application/vnd.ms-powerpoint"),"prf".__minus_gt("application/pics-rules"),"prt".__minus_gt("chemical/x-ncbi-asn1-ascii"),"ps".__minus_gt("application/postscript"),"psd".__minus_gt("image/x-photoshop"),"psp".__minus_gt("text/x-psp"),"py".__minus_gt("text/x-python"),"pyc".__minus_gt("application/x-python-code"),"pyo".__minus_gt("application/x-python-code"),"qt".__minus_gt("video/quicktime"),"qtl".__minus_gt("application/x-quicktimeplayer"),"ra".__minus_gt("audio/x-realaudio"),"ram".__minus_gt("audio/x-pn-realaudio"),"rar".__minus_gt("application/rar"),"ras".__minus_gt("image/x-cmu-raster"),"rd".__minus_gt("chemical/x-mdl-rdfile"),"rdf".__minus_gt("application/rdf+xml"),"rgb".__minus_gt("image/x-rgb"),"rm".__minus_gt("audio/x-pn-realaudio"),"roff".__minus_gt("application/x-troff"),"ros".__minus_gt("chemical/x-rosdal"),"rpm".__minus_gt("application/x-redhat-package-manager"),"rss".__minus_gt("application/rss+xml"),"rtf".__minus_gt("text/rtf"),"rtx".__minus_gt("text/richtext"),"rxn".__minus_gt("chemical/x-mdl-rxnfile"),"sct".__minus_gt("text/scriptlet"),"sd".__minus_gt("chemical/x-mdl-sdfile"),"sd2".__minus_gt("audio/x-sd2"),"sda".__minus_gt("application/vnd.stardivision.draw"),"sdc".__minus_gt("application/vnd.stardivision.calc"),"sdd".__minus_gt("application/vnd.stardivision.impress"),"sdf".__minus_gt("chemical/x-mdl-sdfile"),"sdp".__minus_gt("application/vnd.stardivision.impress"),"sdw".__minus_gt("application/vnd.stardivision.writer"),"ser".__minus_gt("application/java-serialized-object"),"sgf".__minus_gt("application/x-go-sgf"),"sgl".__minus_gt("application/vnd.stardivision.writer-global"),"sh".__minus_gt("text/x-sh"),"shar".__minus_gt("application/x-shar"),"shtml".__minus_gt("text/html"),"sid".__minus_gt("audio/prs.sid"),"sik".__minus_gt("application/x-trash"),"silo".__minus_gt("model/mesh"),"sis".__minus_gt("application/vnd.symbian.install"),"sit".__minus_gt("application/x-stuffit"),"skd".__minus_gt("application/x-koan"),"skm".__minus_gt("application/x-koan"),"skp".__minus_gt("application/x-koan"),"skt".__minus_gt("application/x-koan"),"smf".__minus_gt("application/vnd.stardivision.math"),"smi".__minus_gt("application/smil"),"smil".__minus_gt("application/smil"),"snd".__minus_gt("audio/basic"),"spc".__minus_gt("chemical/x-galactic-spc"),"spl".__minus_gt("application/x-futuresplash"),"src".__minus_gt("application/x-wais-source"),"stc".__minus_gt("application/vnd.sun.xml.calc.template"),"std".__minus_gt("application/vnd.sun.xml.draw.template"),"sti".__minus_gt("application/vnd.sun.xml.impress.template"),"stl".__minus_gt("application/vnd.ms-pki.stl"),"stw".__minus_gt("application/vnd.sun.xml.writer.template"),"sty".__minus_gt("text/x-tex"),"sv4cpio".__minus_gt("application/x-sv4cpio"),"sv4crc".__minus_gt("application/x-sv4crc"),"svg".__minus_gt("image/svg+xml"),"svgz".__minus_gt("image/svg+xml"),"sw".__minus_gt("chemical/x-swissprot"),"swf".__minus_gt("application/x-shockwave-flash"),"swfl".__minus_gt("application/x-shockwave-flash"),"sxc".__minus_gt("application/vnd.sun.xml.calc"),"sxd".__minus_gt("application/vnd.sun.xml.draw"),"sxg".__minus_gt("application/vnd.sun.xml.writer.global"),"sxi".__minus_gt("application/vnd.sun.xml.impress"),"sxm".__minus_gt("application/vnd.sun.xml.math"),"sxw".__minus_gt("application/vnd.sun.xml.writer"),"t".__minus_gt("application/x-troff"),"tar".__minus_gt("application/x-tar"),"taz".__minus_gt("application/x-gtar"),"tcl".__minus_gt("text/x-tcl"),"tex".__minus_gt("text/x-tex"),"texi".__minus_gt("application/x-texinfo"),"texinfo".__minus_gt("application/x-texinfo"),"text".__minus_gt("text/plain"),"tgf".__minus_gt("chemical/x-mdl-tgf"),"tgz".__minus_gt("application/x-gtar"),"tif".__minus_gt("image/tiff"),"tiff".__minus_gt("image/tiff"),"tk".__minus_gt("text/x-tcl"),"tm".__minus_gt("text/texmacs"),"torrent".__minus_gt("application/x-bittorrent"),"tr".__minus_gt("application/x-troff"),"ts".__minus_gt("text/texmacs"),"tsp".__minus_gt("application/dsptype"),"tsv".__minus_gt("text/tab-separated-values"),"txt".__minus_gt("text/plain"),"udeb".__minus_gt("application/x-debian-package"),"uls".__minus_gt("text/iuls"),"ustar".__minus_gt("application/x-ustar"),"val".__minus_gt("chemical/x-ncbi-asn1-binary"),"vcd".__minus_gt("application/x-cdlink"),"vcf".__minus_gt("text/x-vcard"),"vcs".__minus_gt("text/x-vcalendar"),"vmd".__minus_gt("chemical/x-vmd"),"vms".__minus_gt("chemical/x-vamas-iso14976"),"vor".__minus_gt("application/vnd.stardivision.writer"),"vrm".__minus_gt("x-world/x-vrml"),"vrml".__minus_gt("x-world/x-vrml"),"vsd".__minus_gt("application/vnd.visio"),"wad".__minus_gt("application/x-doom"),"wav".__minus_gt("audio/x-wav"),"wax".__minus_gt("audio/x-ms-wax"),"wbmp".__minus_gt("image/vnd.wap.wbmp"),"wbxml".__minus_gt("application/vnd.wap.wbxml"),"wk".__minus_gt("application/x-123"),"wm".__minus_gt("video/x-ms-wm"),"wma".__minus_gt("audio/x-ms-wma"),"wmd".__minus_gt("application/x-ms-wmd"),"wml".__minus_gt("text/vnd.wap.wml"),"wmlc".__minus_gt("application/vnd.wap.wmlc"),"wmls".__minus_gt("text/vnd.wap.wmlscript"),"wmlsc".__minus_gt("application/vnd.wap.wmlscriptc"),"wmv".__minus_gt("video/x-ms-wmv"),"wmx".__minus_gt("video/x-ms-wmx"),"wmz".__minus_gt("application/x-ms-wmz"),"wp5".__minus_gt("application/wordperfect5.1"),"wpd".__minus_gt("application/wordperfect"),"wrl".__minus_gt("x-world/x-vrml"),"wsc".__minus_gt("text/scriptlet"),"wvx".__minus_gt("video/x-ms-wvx"),"wz".__minus_gt("application/x-wingz"),"xbm".__minus_gt("image/x-xbitmap"),"xcf".__minus_gt("application/x-xcf"),"xht".__minus_gt("application/xhtml+xml"),"xhtml".__minus_gt("application/xhtml+xml"),"xlb".__minus_gt("application/vnd.ms-excel"),"xls".__minus_gt("application/vnd.ms-excel"),"xlt".__minus_gt("application/vnd.ms-excel"),"xml".__minus_gt("application/xml"),"xpi".__minus_gt("application/x-xpinstall"),"xpm".__minus_gt("image/x-xpixmap"),"xsl".__minus_gt("application/xml"),"xtel".__minus_gt("chemical/x-xtel"),"xul".__minus_gt("application/vnd.mozilla.xul+xml"),"xwd".__minus_gt("image/x-xwindowdump"),"xyz".__minus_gt("chemical/x-xyz"),"zip".__minus_gt("application/zip"),"zmt".__minus_gt("chemical/x-mopac-input"),"~".__minus_gt("application/x-trash")]);
  34629. return $1;
  34630. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  34631. args: [],
  34632. source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}",
  34633. messageSends: ["->"],
  34634. referencedClasses: []
  34635. }),
  34636. smalltalk.FileServer.klass);
  34637. smalltalk.addMethod(
  34638. smalltalk.method({
  34639. selector: "defaultPort",
  34640. category: 'accessing',
  34641. fn: function (){
  34642. var self=this;
  34643. return smalltalk.withContext(function($ctx1) {
  34644. return (4000);
  34645. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  34646. args: [],
  34647. source: "defaultPort\x0a\x09^4000",
  34648. messageSends: [],
  34649. referencedClasses: []
  34650. }),
  34651. smalltalk.FileServer.klass);
  34652. smalltalk.addMethod(
  34653. smalltalk.method({
  34654. selector: "main",
  34655. category: 'initialization',
  34656. fn: function (){
  34657. var self=this;
  34658. var fileServer,args;
  34659. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  34660. return smalltalk.withContext(function($ctx1) {
  34661. var $1,$2;
  34662. var $early={};
  34663. try {
  34664. args=_st(process)._argv();
  34665. _st(args)._removeFrom_to_((1),(3));
  34666. _st(args)._detect_ifNone_((function(each){
  34667. return smalltalk.withContext(function($ctx2) {
  34668. $1=_st(each).__eq("--help");
  34669. if(smalltalk.assert($1)){
  34670. return _st($FileServer())._printHelp();
  34671. };
  34672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  34673. return smalltalk.withContext(function($ctx2) {
  34674. fileServer=_st($FileServer())._createServerWithArguments_(args);
  34675. fileServer;
  34676. $2=_st(fileServer)._start();
  34677. throw $early=[$2];
  34678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  34679. return self}
  34680. catch(e) {if(e===$early)return e[0]; throw e}
  34681. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  34682. args: [],
  34683. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^fileServer start]",
  34684. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"],
  34685. referencedClasses: ["FileServer"]
  34686. }),
  34687. smalltalk.FileServer.klass);
  34688. smalltalk.addMethod(
  34689. smalltalk.method({
  34690. selector: "mimeTypeFor:",
  34691. category: 'accessing',
  34692. fn: function (aString){
  34693. var self=this;
  34694. return smalltalk.withContext(function($ctx1) {
  34695. var $1;
  34696. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  34697. return smalltalk.withContext(function($ctx2) {
  34698. return "text/plain";
  34699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  34700. return $1;
  34701. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  34702. args: ["aString"],
  34703. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  34704. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  34705. referencedClasses: []
  34706. }),
  34707. smalltalk.FileServer.klass);
  34708. smalltalk.addMethod(
  34709. smalltalk.method({
  34710. selector: "mimeTypes",
  34711. category: 'accessing',
  34712. fn: function (){
  34713. var self=this;
  34714. return smalltalk.withContext(function($ctx1) {
  34715. var $2,$1;
  34716. $2=self["@mimeTypes"];
  34717. if(($receiver = $2) == nil || $receiver == null){
  34718. self["@mimeTypes"]=self._defaultMimeTypes();
  34719. $1=self["@mimeTypes"];
  34720. } else {
  34721. $1=$2;
  34722. };
  34723. return $1;
  34724. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  34725. args: [],
  34726. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  34727. messageSends: ["ifNil:", "defaultMimeTypes"],
  34728. referencedClasses: []
  34729. }),
  34730. smalltalk.FileServer.klass);
  34731. smalltalk.addMethod(
  34732. smalltalk.method({
  34733. selector: "printHelp",
  34734. category: 'accessing',
  34735. fn: function (){
  34736. var self=this;
  34737. return smalltalk.withContext(function($ctx1) {
  34738. _st(console)._log_("Available commandline options are:");
  34739. _st(console)._log_("--help");
  34740. _st(self._commandLineSwitches())._do_((function(each){
  34741. return smalltalk.withContext(function($ctx2) {
  34742. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  34743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34744. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  34745. args: [],
  34746. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  34747. messageSends: ["log:", "do:", "commandLineSwitches", ","],
  34748. referencedClasses: []
  34749. }),
  34750. smalltalk.FileServer.klass);
  34751. smalltalk.addMethod(
  34752. smalltalk.method({
  34753. selector: "selectorForCommandLineSwitch:",
  34754. category: 'accessing',
  34755. fn: function (aSwitch){
  34756. var self=this;
  34757. return smalltalk.withContext(function($ctx1) {
  34758. var $1;
  34759. $1=_st(_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  34760. return smalltalk.withContext(function($ctx2) {
  34761. return _st(_st(each)._second())._asUppercase();
  34762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}))).__comma(":");
  34763. return $1;
  34764. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  34765. args: ["aSwitch"],
  34766. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
  34767. messageSends: [",", "replace:with:", "asUppercase", "second"],
  34768. referencedClasses: []
  34769. }),
  34770. smalltalk.FileServer.klass);
  34771. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  34772. smalltalk.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support.";
  34773. smalltalk.addMethod(
  34774. smalltalk.method({
  34775. selector: "addVariableNamed:to:",
  34776. category: 'private',
  34777. fn: function (aString,anObject){
  34778. var self=this;
  34779. var newClass,newObject;
  34780. return smalltalk.withContext(function($ctx1) {
  34781. var $1;
  34782. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  34783. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  34784. newObject=_st(newClass)._new();
  34785. self._setPreviousVariablesFor_from_(newObject,anObject);
  34786. $1=newObject;
  34787. return $1;
  34788. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},smalltalk.Repl)})},
  34789. args: ["aString", "anObject"],
  34790. source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject",
  34791. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"],
  34792. referencedClasses: []
  34793. }),
  34794. smalltalk.Repl);
  34795. smalltalk.addMethod(
  34796. smalltalk.method({
  34797. selector: "assignNewVariable:do:",
  34798. category: 'private',
  34799. fn: function (buffer,aBlock){
  34800. var self=this;
  34801. return smalltalk.withContext(function($ctx1) {
  34802. var $2,$3,$5,$7,$6,$4,$1;
  34803. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  34804. var varName,value;
  34805. return smalltalk.withContext(function($ctx2) {
  34806. $2=name;
  34807. if(($receiver = $2) == nil || $receiver == null){
  34808. varName=self._nextResultName();
  34809. } else {
  34810. varName=$2;
  34811. };
  34812. varName;
  34813. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  34814. self["@session"];
  34815. $3=self;
  34816. $5=_st(varName).__comma(" := ");
  34817. $7=expr;
  34818. if(($receiver = $7) == nil || $receiver == null){
  34819. $6=buffer;
  34820. } else {
  34821. $6=$7;
  34822. };
  34823. $4=_st($5).__comma($6);
  34824. value=_st($3)._eval_on_($4,self["@session"]);
  34825. value;
  34826. return _st(aBlock)._value_value_(varName,value);
  34827. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)})}));
  34828. return $1;
  34829. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},smalltalk.Repl)})},
  34830. args: ["buffer", "aBlock"],
  34831. source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session.\x0a\x09\x09aBlock value: varName value: value]",
  34832. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "eval:on:", ",", "value:value:"],
  34833. referencedClasses: []
  34834. }),
  34835. smalltalk.Repl);
  34836. smalltalk.addMethod(
  34837. smalltalk.method({
  34838. selector: "clearScreen",
  34839. category: 'private',
  34840. fn: function (){
  34841. var self=this;
  34842. var esc,cls;
  34843. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  34844. return smalltalk.withContext(function($ctx1) {
  34845. esc=_st($String())._fromCharCode_((27));
  34846. cls=_st(_st(_st(esc).__comma("[2J")).__comma(esc)).__comma("[0;0f");
  34847. _st(_st(process)._stdout())._write_(cls);
  34848. _st(self["@interface"])._prompt();
  34849. return self}, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},smalltalk.Repl)})},
  34850. args: [],
  34851. source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt",
  34852. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"],
  34853. referencedClasses: ["String"]
  34854. }),
  34855. smalltalk.Repl);
  34856. smalltalk.addMethod(
  34857. smalltalk.method({
  34858. selector: "close",
  34859. category: 'actions',
  34860. fn: function (){
  34861. var self=this;
  34862. return smalltalk.withContext(function($ctx1) {
  34863. _st(_st(process)._stdin())._destroy();
  34864. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
  34865. args: [],
  34866. source: "close\x0a\x09process stdin destroy",
  34867. messageSends: ["destroy", "stdin"],
  34868. referencedClasses: []
  34869. }),
  34870. smalltalk.Repl);
  34871. smalltalk.addMethod(
  34872. smalltalk.method({
  34873. selector: "commands",
  34874. category: 'accessing',
  34875. fn: function (){
  34876. var self=this;
  34877. return smalltalk.withContext(function($ctx1) {
  34878. var $1;
  34879. $1=self["@commands"];
  34880. return $1;
  34881. }, function($ctx1) {$ctx1.fill(self,"commands",{},smalltalk.Repl)})},
  34882. args: [],
  34883. source: "commands\x0a\x09^ commands",
  34884. messageSends: [],
  34885. referencedClasses: []
  34886. }),
  34887. smalltalk.Repl);
  34888. smalltalk.addMethod(
  34889. smalltalk.method({
  34890. selector: "createInterface",
  34891. category: 'actions',
  34892. fn: function (){
  34893. var self=this;
  34894. return smalltalk.withContext(function($ctx1) {
  34895. var $1,$2;
  34896. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  34897. _st(self["@interface"])._on_do_("line",(function(buffer){
  34898. return smalltalk.withContext(function($ctx2) {
  34899. return self._processLine_(buffer);
  34900. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)})}));
  34901. _st(self["@interface"])._on_do_("close",(function(){
  34902. return smalltalk.withContext(function($ctx2) {
  34903. return self._close();
  34904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  34905. $1=self;
  34906. _st($1)._printWelcome();
  34907. _st($1)._setupHotkeys();
  34908. $2=_st($1)._setPrompt();
  34909. _st(self["@interface"])._prompt();
  34910. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
  34911. args: [],
  34912. source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt",
  34913. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"],
  34914. referencedClasses: []
  34915. }),
  34916. smalltalk.Repl);
  34917. smalltalk.addMethod(
  34918. smalltalk.method({
  34919. selector: "encapsulateVariable:withValue:in:",
  34920. category: 'private',
  34921. fn: function (aString,anObject,aClass){
  34922. var self=this;
  34923. var compiler;
  34924. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  34925. return smalltalk.withContext(function($ctx1) {
  34926. compiler=_st($Compiler())._new();
  34927. _st(compiler)._install_forClass_category_(_st(_st(_st(aString).__comma(": anObject ^ ")).__comma(aString)).__comma(" := anObject"),aClass,"session");
  34928. _st(compiler)._install_forClass_category_(_st(_st(aString).__comma(" ^ ")).__comma(aString),aClass,"session");
  34929. return self}, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},smalltalk.Repl)})},
  34930. args: ["aString", "anObject", "aClass"],
  34931. source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass category: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass category: 'session'.",
  34932. messageSends: ["new", "install:forClass:category:", ","],
  34933. referencedClasses: ["Compiler"]
  34934. }),
  34935. smalltalk.Repl);
  34936. smalltalk.addMethod(
  34937. smalltalk.method({
  34938. selector: "eval:",
  34939. category: 'actions',
  34940. fn: function (buffer){
  34941. var self=this;
  34942. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  34943. return smalltalk.withContext(function($ctx1) {
  34944. var $1;
  34945. $1=self._eval_on_(buffer,_st($DoIt())._new());
  34946. return $1;
  34947. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},smalltalk.Repl)})},
  34948. args: ["buffer"],
  34949. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  34950. messageSends: ["eval:on:", "new"],
  34951. referencedClasses: ["DoIt"]
  34952. }),
  34953. smalltalk.Repl);
  34954. smalltalk.addMethod(
  34955. smalltalk.method({
  34956. selector: "eval:on:",
  34957. category: 'actions',
  34958. fn: function (buffer,anObject){
  34959. var self=this;
  34960. var result;
  34961. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  34962. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  34963. return smalltalk.withContext(function($ctx1) {
  34964. var $1,$2,$3;
  34965. $1=_st(buffer)._isEmpty();
  34966. if(! smalltalk.assert($1)){
  34967. self._try_catch_((function(){
  34968. return smalltalk.withContext(function($ctx2) {
  34969. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  34970. return result;
  34971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(e){
  34972. return smalltalk.withContext(function($ctx2) {
  34973. $2=_st(e)._isSmalltalkError();
  34974. if(smalltalk.assert($2)){
  34975. return _st(_st($ErrorHandler())._new())._handleError_(e);
  34976. } else {
  34977. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  34978. };
  34979. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
  34980. };
  34981. $3=result;
  34982. return $3;
  34983. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},smalltalk.Repl)})},
  34984. args: ["buffer", "anObject"],
  34985. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ErrorHandler new handleError: e]\x0a\x09\x09\x09 ifFalse: [process stdout write: e jsStack]]].\x0a\x09^ result",
  34986. messageSends: ["ifFalse:", "isEmpty", "try:catch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "handleError:", "write:", "stdout", "jsStack"],
  34987. referencedClasses: ["Compiler", "ErrorHandler"]
  34988. }),
  34989. smalltalk.Repl);
  34990. smalltalk.addMethod(
  34991. smalltalk.method({
  34992. selector: "executeCommand:",
  34993. category: 'private',
  34994. fn: function (aString){
  34995. var self=this;
  34996. return smalltalk.withContext(function($ctx1) {
  34997. var $1;
  34998. var $early={};
  34999. try {
  35000. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  35001. return smalltalk.withContext(function($ctx2) {
  35002. $1=_st(names)._includes_(aString);
  35003. if(smalltalk.assert($1)){
  35004. _st(cmd)._value();
  35005. throw $early=[true];
  35006. };
  35007. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)})}));
  35008. return false;
  35009. }
  35010. catch(e) {if(e===$early)return e[0]; throw e}
  35011. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},smalltalk.Repl)})},
  35012. args: ["aString"],
  35013. source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false",
  35014. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"],
  35015. referencedClasses: []
  35016. }),
  35017. smalltalk.Repl);
  35018. smalltalk.addMethod(
  35019. smalltalk.method({
  35020. selector: "initialize",
  35021. category: 'initialization',
  35022. fn: function (){
  35023. var self=this;
  35024. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  35025. return smalltalk.withContext(function($ctx1) {
  35026. smalltalk.Repl.superclass.fn.prototype._initialize.apply(_st(self), []);
  35027. self["@session"]=_st($DoIt())._new();
  35028. self["@readline"]=_st(require)._value_("readline");
  35029. self["@util"]=_st(require)._value_("util");
  35030. self._setupCommands();
  35031. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
  35032. args: [],
  35033. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  35034. messageSends: ["initialize", "new", "value:", "setupCommands"],
  35035. referencedClasses: ["DoIt"]
  35036. }),
  35037. smalltalk.Repl);
  35038. smalltalk.addMethod(
  35039. smalltalk.method({
  35040. selector: "instanceVariableNamesFor:",
  35041. category: 'private',
  35042. fn: function (aClass){
  35043. var self=this;
  35044. return smalltalk.withContext(function($ctx1) {
  35045. var $2,$1;
  35046. $2=_st(aClass)._superclass();
  35047. if(($receiver = $2) == nil || $receiver == null){
  35048. $1=_st(aClass)._instanceVariableNames();
  35049. } else {
  35050. $1=_st(_st(aClass)._instanceVariableNames())._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  35051. };
  35052. return $1;
  35053. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},smalltalk.Repl)})},
  35054. args: ["aClass"],
  35055. source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]",
  35056. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"],
  35057. referencedClasses: []
  35058. }),
  35059. smalltalk.Repl);
  35060. smalltalk.addMethod(
  35061. smalltalk.method({
  35062. selector: "isIdentifier:",
  35063. category: 'private',
  35064. fn: function (aString){
  35065. var self=this;
  35066. return smalltalk.withContext(function($ctx1) {
  35067. var $1;
  35068. $1=_st(aString)._match_("^[a-z_]\x5cw+$"._asRegexp());
  35069. return $1;
  35070. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},smalltalk.Repl)})},
  35071. args: ["aString"],
  35072. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw+$' asRegexp",
  35073. messageSends: ["match:", "asRegexp"],
  35074. referencedClasses: []
  35075. }),
  35076. smalltalk.Repl);
  35077. smalltalk.addMethod(
  35078. smalltalk.method({
  35079. selector: "isVariableDefined:",
  35080. category: 'private',
  35081. fn: function (aString){
  35082. var self=this;
  35083. return smalltalk.withContext(function($ctx1) {
  35084. var $1;
  35085. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  35086. return $1;
  35087. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},smalltalk.Repl)})},
  35088. args: ["aString"],
  35089. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  35090. messageSends: ["includes:", "instanceVariableNamesFor:", "class"],
  35091. referencedClasses: []
  35092. }),
  35093. smalltalk.Repl);
  35094. smalltalk.addMethod(
  35095. smalltalk.method({
  35096. selector: "nextResultName",
  35097. category: 'private',
  35098. fn: function (){
  35099. var self=this;
  35100. return smalltalk.withContext(function($ctx1) {
  35101. var $1,$2;
  35102. $1=self["@resultCount"];
  35103. if(($receiver = $1) == nil || $receiver == null){
  35104. self["@resultCount"]=(1);
  35105. } else {
  35106. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  35107. };
  35108. $2="res".__comma(_st(self["@resultCount"])._asString());
  35109. return $2;
  35110. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},smalltalk.Repl)})},
  35111. args: [],
  35112. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  35113. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"],
  35114. referencedClasses: []
  35115. }),
  35116. smalltalk.Repl);
  35117. smalltalk.addMethod(
  35118. smalltalk.method({
  35119. selector: "onKeyPress:",
  35120. category: 'private',
  35121. fn: function (key){
  35122. var self=this;
  35123. return smalltalk.withContext(function($ctx1) {
  35124. var $1;
  35125. $1=_st(_st(key)._ctrl())._and_((function(){
  35126. return smalltalk.withContext(function($ctx2) {
  35127. return _st(_st(key)._name()).__eq("l");
  35128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  35129. if(smalltalk.assert($1)){
  35130. self._clearScreen();
  35131. };
  35132. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},smalltalk.Repl)})},
  35133. args: ["key"],
  35134. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  35135. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"],
  35136. referencedClasses: []
  35137. }),
  35138. smalltalk.Repl);
  35139. smalltalk.addMethod(
  35140. smalltalk.method({
  35141. selector: "parseAssignment:do:",
  35142. category: 'private',
  35143. fn: function (aString,aBlock){
  35144. var self=this;
  35145. var assignment;
  35146. return smalltalk.withContext(function($ctx1) {
  35147. var $2,$1;
  35148. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  35149. return smalltalk.withContext(function($ctx2) {
  35150. return _st(s)._trimBoth();
  35151. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)})}));
  35152. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  35153. return smalltalk.withContext(function($ctx2) {
  35154. return self._isIdentifier_(_st(assignment)._first());
  35155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  35156. if(smalltalk.assert($2)){
  35157. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  35158. } else {
  35159. $1=_st(aBlock)._value_value_(nil,nil);
  35160. };
  35161. return $1;
  35162. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},smalltalk.Repl)})},
  35163. args: ["aString", "aBlock"],
  35164. source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [aBlock value: assignment first value: assignment last]\x0a\x09\x09ifFalse: [aBlock value: nil value: nil]",
  35165. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"],
  35166. referencedClasses: []
  35167. }),
  35168. smalltalk.Repl);
  35169. smalltalk.addMethod(
  35170. smalltalk.method({
  35171. selector: "presentResultNamed:withValue:",
  35172. category: 'private',
  35173. fn: function (varName,value){
  35174. var self=this;
  35175. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  35176. return smalltalk.withContext(function($ctx1) {
  35177. var $1,$2;
  35178. $1=$Transcript();
  35179. _st($1)._show_(_st(_st(_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name())).__comma(" = ")).__comma(_st(value)._asString()));
  35180. $2=_st($1)._cr();
  35181. _st(self["@interface"])._prompt();
  35182. return self}, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},smalltalk.Repl)})},
  35183. args: ["varName", "value"],
  35184. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  35185. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"],
  35186. referencedClasses: ["Transcript"]
  35187. }),
  35188. smalltalk.Repl);
  35189. smalltalk.addMethod(
  35190. smalltalk.method({
  35191. selector: "printWelcome",
  35192. category: 'private',
  35193. fn: function (){
  35194. var self=this;
  35195. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  35196. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35197. return smalltalk.withContext(function($ctx1) {
  35198. var $1,$2;
  35199. _st($Transcript())._show_(_st(_st(_st("Welcome to Amber version ".__comma(_st(_st($Smalltalk())._current())._version())).__comma(" (NodeJS ")).__comma(_st(_st(process)._versions())._node())).__comma(")."));
  35200. $1=$Transcript();
  35201. _st($1)._show_("Type :q to exit.");
  35202. $2=_st($1)._cr();
  35203. return self}, function($ctx1) {$ctx1.fill(self,"printWelcome",{},smalltalk.Repl)})},
  35204. args: [],
  35205. source: "printWelcome\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  35206. messageSends: ["show:", ",", "version", "current", "node", "versions", "cr"],
  35207. referencedClasses: ["Transcript", "Smalltalk"]
  35208. }),
  35209. smalltalk.Repl);
  35210. smalltalk.addMethod(
  35211. smalltalk.method({
  35212. selector: "processLine:",
  35213. category: 'private',
  35214. fn: function (buffer){
  35215. var self=this;
  35216. var show;
  35217. return smalltalk.withContext(function($ctx1) {
  35218. var $1,$2;
  35219. show=(function(varName,value){
  35220. return smalltalk.withContext(function($ctx2) {
  35221. return self._presentResultNamed_withValue_(varName,value);
  35222. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)})});
  35223. $1=self._executeCommand_(buffer);
  35224. if(! smalltalk.assert($1)){
  35225. $2=self._isVariableDefined_(buffer);
  35226. if(smalltalk.assert($2)){
  35227. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  35228. } else {
  35229. self._assignNewVariable_do_(buffer,show);
  35230. };
  35231. };
  35232. return self}, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},smalltalk.Repl)})},
  35233. args: ["buffer"],
  35234. source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]",
  35235. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"],
  35236. referencedClasses: []
  35237. }),
  35238. smalltalk.Repl);
  35239. smalltalk.addMethod(
  35240. smalltalk.method({
  35241. selector: "prompt",
  35242. category: 'accessing',
  35243. fn: function (){
  35244. var self=this;
  35245. return smalltalk.withContext(function($ctx1) {
  35246. return "amber >> ";
  35247. }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
  35248. args: [],
  35249. source: "prompt\x0a\x09^'amber >> '",
  35250. messageSends: [],
  35251. referencedClasses: []
  35252. }),
  35253. smalltalk.Repl);
  35254. smalltalk.addMethod(
  35255. smalltalk.method({
  35256. selector: "setPreviousVariablesFor:from:",
  35257. category: 'private',
  35258. fn: function (newObject,oldObject){
  35259. var self=this;
  35260. return smalltalk.withContext(function($ctx1) {
  35261. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  35262. return smalltalk.withContext(function($ctx2) {
  35263. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  35264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  35265. return self}, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},smalltalk.Repl)})},
  35266. args: ["newObject", "oldObject"],
  35267. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  35268. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"],
  35269. referencedClasses: []
  35270. }),
  35271. smalltalk.Repl);
  35272. smalltalk.addMethod(
  35273. smalltalk.method({
  35274. selector: "setPrompt",
  35275. category: 'actions',
  35276. fn: function (){
  35277. var self=this;
  35278. return smalltalk.withContext(function($ctx1) {
  35279. _st(self["@interface"])._setPrompt_(self._prompt());
  35280. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
  35281. args: [],
  35282. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  35283. messageSends: ["setPrompt:", "prompt"],
  35284. referencedClasses: []
  35285. }),
  35286. smalltalk.Repl);
  35287. smalltalk.addMethod(
  35288. smalltalk.method({
  35289. selector: "setupCommands",
  35290. category: 'initialization',
  35291. fn: function (){
  35292. var self=this;
  35293. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35294. return smalltalk.withContext(function($ctx1) {
  35295. self["@commands"]=_st($Dictionary())._from_([_st([":q"]).__minus_gt((function(){
  35296. return smalltalk.withContext(function($ctx2) {
  35297. return _st(process)._exit();
  35298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})),_st([""]).__minus_gt((function(){
  35299. return smalltalk.withContext(function($ctx2) {
  35300. return _st(self["@interface"])._prompt();
  35301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))]);
  35302. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},smalltalk.Repl)})},
  35303. args: [],
  35304. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  35305. messageSends: ["from:", "->", "exit", "prompt"],
  35306. referencedClasses: ["Dictionary"]
  35307. }),
  35308. smalltalk.Repl);
  35309. smalltalk.addMethod(
  35310. smalltalk.method({
  35311. selector: "setupHotkeys",
  35312. category: 'initialization',
  35313. fn: function (){
  35314. var self=this;
  35315. return smalltalk.withContext(function($ctx1) {
  35316. var $1;
  35317. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  35318. return smalltalk.withContext(function($ctx2) {
  35319. $1=key;
  35320. if(($receiver = $1) == nil || $receiver == null){
  35321. return $1;
  35322. } else {
  35323. return self._onKeyPress_(key);
  35324. };
  35325. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)})}));
  35326. return self}, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},smalltalk.Repl)})},
  35327. args: [],
  35328. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  35329. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"],
  35330. referencedClasses: []
  35331. }),
  35332. smalltalk.Repl);
  35333. smalltalk.addMethod(
  35334. smalltalk.method({
  35335. selector: "subclass:withVariable:",
  35336. category: 'private',
  35337. fn: function (aClass,varName){
  35338. var self=this;
  35339. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  35340. return smalltalk.withContext(function($ctx1) {
  35341. var $1;
  35342. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  35343. return $1;
  35344. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},smalltalk.Repl)})},
  35345. args: ["aClass", "varName"],
  35346. source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'",
  35347. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"],
  35348. referencedClasses: ["ClassBuilder"]
  35349. }),
  35350. smalltalk.Repl);
  35351. smalltalk.addMethod(
  35352. smalltalk.method({
  35353. selector: "subclassNameFor:",
  35354. category: 'private',
  35355. fn: function (aClass){
  35356. var self=this;
  35357. return smalltalk.withContext(function($ctx1) {
  35358. var $2,$1;
  35359. $2=_st(_st(aClass)._name())._matchesOf_("\x5cd+$");
  35360. if(($receiver = $2) == nil || $receiver == null){
  35361. $1=_st(_st(aClass)._name()).__comma("2");
  35362. } else {
  35363. var counter;
  35364. counter=_st(_st(_st(_st(_st(aClass)._name())._matchesOf_("\x5cd+$"))._first())._asNumber()).__plus((1));
  35365. counter;
  35366. $1=_st(_st(aClass)._name())._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  35367. };
  35368. return $1;
  35369. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},smalltalk.Repl)})},
  35370. args: ["aClass"],
  35371. source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].",
  35372. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","],
  35373. referencedClasses: []
  35374. }),
  35375. smalltalk.Repl);
  35376. smalltalk.addMethod(
  35377. smalltalk.method({
  35378. selector: "main",
  35379. category: 'initialization',
  35380. fn: function (){
  35381. var self=this;
  35382. return smalltalk.withContext(function($ctx1) {
  35383. _st(self._new())._createInterface();
  35384. return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
  35385. args: [],
  35386. source: "main\x0a\x09self new createInterface",
  35387. messageSends: ["createInterface", "new"],
  35388. referencedClasses: []
  35389. }),
  35390. smalltalk.Repl.klass);
  35391. });
  35392. define("amber_vm/_init", ["amber_vm/smalltalk","amber_vm/smalltalk","amber_vm/nil","amber_core/Kernel-Objects","amber_core/Kernel-Classes","amber_core/Kernel-Methods","amber_core/Kernel-Collections","amber_core/Kernel-Infrastructure","amber_core/Kernel-Exceptions","amber_core/Kernel-Transcript","amber_core/Kernel-Announcements","amber_core/Compiler-Exceptions","amber_core/Compiler-Core","amber_core/Compiler-AST","amber_core/Compiler-IR","amber_core/Compiler-Inlining","amber_core/Compiler-Semantic","amber_core/Compiler-Interpreter","amber_vm/parser","amber_cli/AmberCli"], function (smalltalk) {
  35393. smalltalk.initialize();
  35394. smalltalk.AmberCli._main();
  35395. });
  35396. requirejs("amber_vm/_init");